@firebase/firestore 3.4.0 → 3.4.1-canary.0db840a09
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/firestore/compat/index.d.ts +1 -1
- package/dist/firestore/src/model/collections.d.ts +1 -1
- package/dist/firestore/src/model/document.d.ts +3 -1
- package/dist/index.esm2017.js +159 -159
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +68 -68
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +14 -21
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +14 -17
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +852 -852
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +3 -1
- package/dist/lite/firestore/compat/index.d.ts +1 -1
- package/dist/lite/firestore/src/model/collections.d.ts +1 -1
- package/dist/lite/firestore/src/model/document.d.ts +3 -1
- package/dist/lite/index.browser.esm2017.js +4 -4
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +4 -4
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +4 -4
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +4 -4
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +61 -61
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +67 -0
- package/dist/lite/packages/firestore/babel-register.d.ts +1 -0
- package/dist/lite/packages/firestore/compat/index.d.ts +1 -1
- package/dist/lite/packages/firestore/src/model/collections.d.ts +1 -1
- package/dist/lite/packages/firestore/src/model/document.d.ts +3 -1
- package/dist/lite/private.d.ts +67 -0
- package/dist/packages/firestore/babel-register.d.ts +1 -0
- package/dist/packages/firestore/compat/index.d.ts +1 -1
- package/dist/packages/firestore/dist/index.esm2017.d.ts +21 -21
- package/dist/packages/firestore/src/model/collections.d.ts +1 -1
- package/dist/packages/firestore/src/model/document.d.ts +3 -1
- package/dist/private.d.ts +3 -1
- package/package.json +10 -10
package/dist/index.rn.js
CHANGED
|
@@ -2,11 +2,11 @@ import { _getProvider, getApp as t, _removeServiceInstance as e, _registerCompon
|
|
|
2
2
|
|
|
3
3
|
import { Component as r } from "@firebase/component";
|
|
4
4
|
|
|
5
|
-
import { Logger as o, LogLevel as
|
|
5
|
+
import { Logger as o, LogLevel as a } from "@firebase/logger";
|
|
6
6
|
|
|
7
|
-
import { base64 as
|
|
7
|
+
import { base64 as c, getUA as u, isIndexedDBAvailable as h, isSafari as l, isMobileCordova as f, isReactNative as d, isElectron as w, isIE as _, isUWP as m, isBrowserExtension as g, createMockUserToken as y, getModularInstance as p, deepEqual as T } from "@firebase/util";
|
|
8
8
|
|
|
9
|
-
import { XhrIo as E, EventType as I, ErrorCode as A, createWebChannelTransport as R, getStatEventTarget as
|
|
9
|
+
import { XhrIo as E, EventType as I, ErrorCode as A, createWebChannelTransport as R, getStatEventTarget as b, FetchXmlHttpFactory as P, WebChannel as v, Event as V, Stat as S } from "@firebase/webchannel-wrapper";
|
|
10
10
|
|
|
11
11
|
const D = "@firebase/firestore";
|
|
12
12
|
|
|
@@ -70,7 +70,7 @@ C.MOCK_USER = new C("mock-user");
|
|
|
70
70
|
* See the License for the specific language governing permissions and
|
|
71
71
|
* limitations under the License.
|
|
72
72
|
*/
|
|
73
|
-
let N = "9.6.
|
|
73
|
+
let N = "9.6.1-canary.0db840a09";
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* @license
|
|
@@ -112,14 +112,14 @@ function x() {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
function F(t, ...e) {
|
|
115
|
-
if (k.logLevel <=
|
|
115
|
+
if (k.logLevel <= a.DEBUG) {
|
|
116
116
|
const n = e.map(L);
|
|
117
117
|
k.debug(`Firestore (${N}): ${t}`, ...n);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
function O(t, ...e) {
|
|
122
|
-
if (k.logLevel <=
|
|
122
|
+
if (k.logLevel <= a.ERROR) {
|
|
123
123
|
const n = e.map(L);
|
|
124
124
|
k.error(`Firestore (${N}): ${t}`, ...n);
|
|
125
125
|
}
|
|
@@ -128,7 +128,7 @@ function O(t, ...e) {
|
|
|
128
128
|
/**
|
|
129
129
|
* @internal
|
|
130
130
|
*/ function M(t, ...e) {
|
|
131
|
-
if (k.logLevel <=
|
|
131
|
+
if (k.logLevel <= a.WARN) {
|
|
132
132
|
const n = e.map(L);
|
|
133
133
|
k.warn(`Firestore (${N}): ${t}`, ...n);
|
|
134
134
|
}
|
|
@@ -742,7 +742,7 @@ function rt(t, e) {
|
|
|
742
742
|
/**
|
|
743
743
|
* Returns the immediate lexicographically-following string. This is useful to
|
|
744
744
|
* construct an inclusive range for indexeddb iterators.
|
|
745
|
-
*/ function
|
|
745
|
+
*/ function at(t) {
|
|
746
746
|
// Return the input string, with an additional NUL byte appended.
|
|
747
747
|
return t + "\0";
|
|
748
748
|
}
|
|
@@ -778,7 +778,7 @@ function rt(t, e) {
|
|
|
778
778
|
* For examples and further specifications, refer to the
|
|
779
779
|
* {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}.
|
|
780
780
|
*/
|
|
781
|
-
class
|
|
781
|
+
class ct {
|
|
782
782
|
/**
|
|
783
783
|
* Creates a new timestamp.
|
|
784
784
|
*
|
|
@@ -810,7 +810,7 @@ class at {
|
|
|
810
810
|
*
|
|
811
811
|
* @returns a new timestamp representing the current date.
|
|
812
812
|
*/ static now() {
|
|
813
|
-
return
|
|
813
|
+
return ct.fromMillis(Date.now());
|
|
814
814
|
}
|
|
815
815
|
/**
|
|
816
816
|
* Creates a new timestamp from the given date.
|
|
@@ -819,7 +819,7 @@ class at {
|
|
|
819
819
|
* @returns A new `Timestamp` representing the same point in time as the given
|
|
820
820
|
* date.
|
|
821
821
|
*/ static fromDate(t) {
|
|
822
|
-
return
|
|
822
|
+
return ct.fromMillis(t.getTime());
|
|
823
823
|
}
|
|
824
824
|
/**
|
|
825
825
|
* Creates a new timestamp from the given number of milliseconds.
|
|
@@ -830,7 +830,7 @@ class at {
|
|
|
830
830
|
* number of milliseconds.
|
|
831
831
|
*/ static fromMillis(t) {
|
|
832
832
|
const e = Math.floor(t / 1e3), n = Math.floor(1e6 * (t - 1e3 * e));
|
|
833
|
-
return new
|
|
833
|
+
return new ct(e, n);
|
|
834
834
|
}
|
|
835
835
|
/**
|
|
836
836
|
* Converts a `Timestamp` to a JavaScript `Date` object. This conversion
|
|
@@ -916,7 +916,7 @@ class at {
|
|
|
916
916
|
return new ut(t);
|
|
917
917
|
}
|
|
918
918
|
static min() {
|
|
919
|
-
return new ut(new
|
|
919
|
+
return new ut(new ct(0, 0));
|
|
920
920
|
}
|
|
921
921
|
compareTo(t) {
|
|
922
922
|
return this.timestamp._compareTo(t.timestamp);
|
|
@@ -1225,7 +1225,7 @@ function yt(t) {
|
|
|
1225
1225
|
// We use `decodeStringToByteArray()` instead of `decodeString()` since
|
|
1226
1226
|
// `decodeString()` returns Unicode strings, which doesn't match the values
|
|
1227
1227
|
// returned by `atob()`'s Latin1 representation.
|
|
1228
|
-
|
|
1228
|
+
c.decodeStringToByteArray(t, false));
|
|
1229
1229
|
}
|
|
1230
1230
|
|
|
1231
1231
|
/** Converts a binary string to a Base64 encoded string. */
|
|
@@ -1285,7 +1285,7 @@ function pt() {
|
|
|
1285
1285
|
return function(t) {
|
|
1286
1286
|
const e = [];
|
|
1287
1287
|
for (let n = 0; n < t.length; n++) e[n] = t.charCodeAt(n);
|
|
1288
|
-
return
|
|
1288
|
+
return c.encodeByteArray(e, !1);
|
|
1289
1289
|
}(this.binaryString);
|
|
1290
1290
|
}
|
|
1291
1291
|
toUint8Array() {
|
|
@@ -1404,7 +1404,7 @@ const Et = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1404
1404
|
* FieldValueOptions to value().
|
|
1405
1405
|
* - With respect to other ServerTimestampValues, they sort by their
|
|
1406
1406
|
* localWriteTime.
|
|
1407
|
-
*/ function
|
|
1407
|
+
*/ function bt(t) {
|
|
1408
1408
|
var e, n;
|
|
1409
1409
|
return "server_timestamp" === (null === (n = ((null === (e = null == t ? void 0 : t.mapValue) || void 0 === e ? void 0 : e.fields) || {}).__type__) || void 0 === n ? void 0 : n.stringValue);
|
|
1410
1410
|
}
|
|
@@ -1418,16 +1418,16 @@ const Et = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1418
1418
|
* Preserving the previous values allows the user to display the last resoled
|
|
1419
1419
|
* value until the backend responds with the timestamp.
|
|
1420
1420
|
*/
|
|
1421
|
-
function
|
|
1421
|
+
function Pt(t) {
|
|
1422
1422
|
const e = t.mapValue.fields.__previous_value__;
|
|
1423
|
-
return
|
|
1423
|
+
return bt(e) ? Pt(e) : e;
|
|
1424
1424
|
}
|
|
1425
1425
|
|
|
1426
1426
|
/**
|
|
1427
1427
|
* Returns the local time at which this timestamp was first set.
|
|
1428
1428
|
*/ function vt(t) {
|
|
1429
1429
|
const e = It(t.mapValue.fields.__local_write_time__.timestampValue);
|
|
1430
|
-
return new
|
|
1430
|
+
return new ct(e.seconds, e.nanos);
|
|
1431
1431
|
}
|
|
1432
1432
|
|
|
1433
1433
|
/**
|
|
@@ -1537,7 +1537,7 @@ function Vt(t) {
|
|
|
1537
1537
|
* limitations under the License.
|
|
1538
1538
|
*/
|
|
1539
1539
|
/** Extracts the backend's type order for the provided value. */ function Nt(t) {
|
|
1540
|
-
return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ?
|
|
1540
|
+
return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? bt(t) ? 4 /* ServerTimestampValue */ : 10 /* ObjectValue */ : B();
|
|
1541
1541
|
}
|
|
1542
1542
|
|
|
1543
1543
|
/** Tests `left` and `right` for equality based on the backend semantics. */ function kt(t, e) {
|
|
@@ -2014,7 +2014,7 @@ function Ut(t) {
|
|
|
2014
2014
|
isEqual(t) {
|
|
2015
2015
|
return t instanceof zt && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
|
|
2016
2016
|
}
|
|
2017
|
-
|
|
2017
|
+
mutableCopy() {
|
|
2018
2018
|
return new zt(this.key, this.documentType, this.version, this.data.clone(), this.documentState);
|
|
2019
2019
|
}
|
|
2020
2020
|
toString() {
|
|
@@ -2111,7 +2111,7 @@ class ee extends class {} {
|
|
|
2111
2111
|
/**
|
|
2112
2112
|
* Creates a filter based on the provided arguments.
|
|
2113
2113
|
*/ static create(t, e, n) {
|
|
2114
|
-
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.P(t, e, n) : new se(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new
|
|
2114
|
+
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.P(t, e, n) : new se(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new ae(t, n) : "in" /* IN */ === e ? new ce(t, n) : "not-in" /* NOT_IN */ === e ? new ue(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new he(t, n) : new ee(t, e, n);
|
|
2115
2115
|
}
|
|
2116
2116
|
static P(t, e, n) {
|
|
2117
2117
|
return "in" /* IN */ === e ? new ie(t, n) : new re(t, n);
|
|
@@ -2191,7 +2191,7 @@ function oe(t, e) {
|
|
|
2191
2191
|
return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((t => Ct.fromName(t.referenceValue)));
|
|
2192
2192
|
}
|
|
2193
2193
|
|
|
2194
|
-
/** A Filter that implements the array-contains operator. */ class
|
|
2194
|
+
/** A Filter that implements the array-contains operator. */ class ae extends ee {
|
|
2195
2195
|
constructor(t, e) {
|
|
2196
2196
|
super(t, "array-contains" /* ARRAY_CONTAINS */ , e);
|
|
2197
2197
|
}
|
|
@@ -2201,7 +2201,7 @@ function oe(t, e) {
|
|
|
2201
2201
|
}
|
|
2202
2202
|
}
|
|
2203
2203
|
|
|
2204
|
-
/** A Filter that implements the IN operator. */ class
|
|
2204
|
+
/** A Filter that implements the IN operator. */ class ce extends ee {
|
|
2205
2205
|
constructor(t, e) {
|
|
2206
2206
|
super(t, "in" /* IN */ , e);
|
|
2207
2207
|
}
|
|
@@ -2322,16 +2322,16 @@ function me(t, e) {
|
|
|
2322
2322
|
* Initializes a Query with a path and optional additional query constraints.
|
|
2323
2323
|
* Path must currently be empty if this is a collection group query.
|
|
2324
2324
|
*/
|
|
2325
|
-
constructor(t, e = null, n = [], s = [], i = null, r = "F" /* First */ , o = null,
|
|
2325
|
+
constructor(t, e = null, n = [], s = [], i = null, r = "F" /* First */ , o = null, a = null) {
|
|
2326
2326
|
this.path = t, this.collectionGroup = e, this.explicitOrderBy = n, this.filters = s,
|
|
2327
|
-
this.limit = i, this.limitType = r, this.startAt = o, this.endAt =
|
|
2327
|
+
this.limit = i, this.limitType = r, this.startAt = o, this.endAt = a, this.S = null,
|
|
2328
2328
|
// The corresponding `Target` of this `Query` instance.
|
|
2329
2329
|
this.D = null, this.startAt, this.endAt;
|
|
2330
2330
|
}
|
|
2331
2331
|
}
|
|
2332
2332
|
|
|
2333
|
-
/** Creates a new Query instance with the options provided. */ function ye(t, e, n, s, i, r, o,
|
|
2334
|
-
return new ge(t, e, n, s, i, r, o,
|
|
2333
|
+
/** Creates a new Query instance with the options provided. */ function ye(t, e, n, s, i, r, o, a) {
|
|
2334
|
+
return new ge(t, e, n, s, i, r, o, a);
|
|
2335
2335
|
}
|
|
2336
2336
|
|
|
2337
2337
|
/** Creates a new Query for a query that matches all documents at `path` */ function pe(t) {
|
|
@@ -2376,7 +2376,7 @@ function Re(t) {
|
|
|
2376
2376
|
* Returns the implicit order by constraint that is used to execute the Query,
|
|
2377
2377
|
* which can be different from the order by constraints the user provided (e.g.
|
|
2378
2378
|
* the SDK and backend always orders by `__name__`).
|
|
2379
|
-
*/ function
|
|
2379
|
+
*/ function be(t) {
|
|
2380
2380
|
const e = K(t);
|
|
2381
2381
|
if (null === e.S) {
|
|
2382
2382
|
e.S = [];
|
|
@@ -2401,12 +2401,12 @@ function Re(t) {
|
|
|
2401
2401
|
|
|
2402
2402
|
/**
|
|
2403
2403
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
2404
|
-
*/ function
|
|
2404
|
+
*/ function Pe(t) {
|
|
2405
2405
|
const e = K(t);
|
|
2406
|
-
if (!e.D) if ("F" /* First */ === e.limitType) e.D = Jt(e.path, e.collectionGroup,
|
|
2406
|
+
if (!e.D) if ("F" /* First */ === e.limitType) e.D = Jt(e.path, e.collectionGroup, be(e), e.filters, e.limit, e.startAt, e.endAt); else {
|
|
2407
2407
|
// Flip the orderBy directions since we want the last results
|
|
2408
2408
|
const t = [];
|
|
2409
|
-
for (const n of
|
|
2409
|
+
for (const n of be(e)) {
|
|
2410
2410
|
const e = "desc" /* DESCENDING */ === n.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
|
|
2411
2411
|
t.push(new de(n.field, e));
|
|
2412
2412
|
}
|
|
@@ -2423,18 +2423,18 @@ function ve(t, e, n) {
|
|
|
2423
2423
|
}
|
|
2424
2424
|
|
|
2425
2425
|
function Ve(t, e) {
|
|
2426
|
-
return Zt(
|
|
2426
|
+
return Zt(Pe(t), Pe(e)) && t.limitType === e.limitType;
|
|
2427
2427
|
}
|
|
2428
2428
|
|
|
2429
2429
|
// TODO(b/29183165): This is used to get a unique string from a query to, for
|
|
2430
2430
|
// example, use as a dictionary key, but the implementation is subject to
|
|
2431
2431
|
// collisions. Make it collision-free.
|
|
2432
2432
|
function Se(t) {
|
|
2433
|
-
return `${Yt(
|
|
2433
|
+
return `${Yt(Pe(t))}|lt:${t.limitType}`;
|
|
2434
2434
|
}
|
|
2435
2435
|
|
|
2436
2436
|
function De(t) {
|
|
2437
|
-
return `Query(target=${Xt(
|
|
2437
|
+
return `Query(target=${Xt(Pe(t))}; limitType=${t.limitType})`;
|
|
2438
2438
|
}
|
|
2439
2439
|
|
|
2440
2440
|
/** Returns whether `doc` matches the constraints of `query`. */ function Ce(t, e) {
|
|
@@ -2455,8 +2455,8 @@ function De(t) {
|
|
|
2455
2455
|
return !0;
|
|
2456
2456
|
}
|
|
2457
2457
|
/** Makes sure a document is within the bounds, if provided. */ (t, e) && function(t, e) {
|
|
2458
|
-
if (t.startAt && !_e(t.startAt,
|
|
2459
|
-
if (t.endAt && _e(t.endAt,
|
|
2458
|
+
if (t.startAt && !_e(t.startAt, be(t), e)) return !1;
|
|
2459
|
+
if (t.endAt && _e(t.endAt, be(t), e)) return !1;
|
|
2460
2460
|
return !0;
|
|
2461
2461
|
}
|
|
2462
2462
|
/**
|
|
@@ -2468,7 +2468,7 @@ function De(t) {
|
|
|
2468
2468
|
function Ne(t) {
|
|
2469
2469
|
return (e, n) => {
|
|
2470
2470
|
let s = !1;
|
|
2471
|
-
for (const i of
|
|
2471
|
+
for (const i of be(t)) {
|
|
2472
2472
|
const t = ke(i, e, n);
|
|
2473
2473
|
if (0 !== t) return t;
|
|
2474
2474
|
s = s || i.field.isKeyField();
|
|
@@ -2828,13 +2828,13 @@ class Ye {
|
|
|
2828
2828
|
* of the document.
|
|
2829
2829
|
* @param mutationResult - The result of applying the mutation from the backend.
|
|
2830
2830
|
*/ function en(t, e, n) {
|
|
2831
|
-
t instanceof
|
|
2831
|
+
t instanceof an ? function(t, e, n) {
|
|
2832
2832
|
// Unlike setMutationApplyToLocalView, if we're applying a mutation to a
|
|
2833
2833
|
// remote document the server has accepted the mutation so the precondition
|
|
2834
2834
|
// must have held.
|
|
2835
2835
|
const s = t.value.clone(), i = hn(t.fieldTransforms, e, n.transformResults);
|
|
2836
2836
|
s.setAll(i), e.convertToFoundDocument(n.version, s).setHasCommittedMutations();
|
|
2837
|
-
}(t, e, n) : t instanceof
|
|
2837
|
+
}(t, e, n) : t instanceof cn ? function(t, e, n) {
|
|
2838
2838
|
if (!Ze(t.precondition, e))
|
|
2839
2839
|
// Since the mutation was not rejected, we know that the precondition
|
|
2840
2840
|
// matched on the backend. We therefore must not have the expected version
|
|
@@ -2863,7 +2863,7 @@ class Ye {
|
|
|
2863
2863
|
* @param localWriteTime - A timestamp indicating the local write time of the
|
|
2864
2864
|
* batch this mutation is a part of.
|
|
2865
2865
|
*/ function nn(t, e, n) {
|
|
2866
|
-
t instanceof
|
|
2866
|
+
t instanceof an ? function(t, e, n) {
|
|
2867
2867
|
if (!Ze(t.precondition, e))
|
|
2868
2868
|
// The mutation failed to apply (e.g. a document ID created with add()
|
|
2869
2869
|
// caused a name collision).
|
|
@@ -2883,7 +2883,7 @@ class Ye {
|
|
|
2883
2883
|
* is deleted.
|
|
2884
2884
|
* * When a field is not in the mask but is in the values, the values map is
|
|
2885
2885
|
* ignored.
|
|
2886
|
-
*/ (t, e, n) : t instanceof
|
|
2886
|
+
*/ (t, e, n) : t instanceof cn ? function(t, e, n) {
|
|
2887
2887
|
if (!Ze(t.precondition, e)) return;
|
|
2888
2888
|
const s = ln(t.fieldTransforms, n, e), i = e.data;
|
|
2889
2889
|
i.setAll(un(t)), i.setAll(s), e.convertToFoundDocument(on(e), i).setHasLocalMutations();
|
|
@@ -2947,14 +2947,14 @@ function rn(t, e) {
|
|
|
2947
2947
|
/**
|
|
2948
2948
|
* A mutation that creates or replaces the document at the given key with the
|
|
2949
2949
|
* object value contents.
|
|
2950
|
-
*/ class
|
|
2950
|
+
*/ class an extends tn {
|
|
2951
2951
|
constructor(t, e, n, s = []) {
|
|
2952
2952
|
super(), this.key = t, this.value = e, this.precondition = n, this.fieldTransforms = s,
|
|
2953
2953
|
this.type = 0 /* Set */;
|
|
2954
2954
|
}
|
|
2955
2955
|
}
|
|
2956
2956
|
|
|
2957
|
-
class
|
|
2957
|
+
class cn extends tn {
|
|
2958
2958
|
constructor(t, e, n, s, i = []) {
|
|
2959
2959
|
super(), this.key = t, this.data = e, this.fieldMask = n, this.precondition = s,
|
|
2960
2960
|
this.fieldTransforms = i, this.type = 1 /* Patch */;
|
|
@@ -2985,8 +2985,8 @@ function un(t) {
|
|
|
2985
2985
|
const s = new Map;
|
|
2986
2986
|
U(t.length === n.length);
|
|
2987
2987
|
for (let i = 0; i < n.length; i++) {
|
|
2988
|
-
const r = t[i], o = r.transform,
|
|
2989
|
-
s.set(r.field, Le(o,
|
|
2988
|
+
const r = t[i], o = r.transform, a = e.data.field(r.field);
|
|
2989
|
+
s.set(r.field, Le(o, a, n[i]));
|
|
2990
2990
|
}
|
|
2991
2991
|
return s;
|
|
2992
2992
|
}
|
|
@@ -3680,14 +3680,14 @@ class An {
|
|
|
3680
3680
|
* limitations under the License.
|
|
3681
3681
|
*/ const Rn = new pn(Ct.comparator);
|
|
3682
3682
|
|
|
3683
|
-
function
|
|
3683
|
+
function bn() {
|
|
3684
3684
|
return Rn;
|
|
3685
3685
|
}
|
|
3686
3686
|
|
|
3687
|
-
const
|
|
3687
|
+
const Pn = new pn(Ct.comparator);
|
|
3688
3688
|
|
|
3689
3689
|
function vn() {
|
|
3690
|
-
return
|
|
3690
|
+
return Pn;
|
|
3691
3691
|
}
|
|
3692
3692
|
|
|
3693
3693
|
const Vn = new pn(Ct.comparator);
|
|
@@ -3766,7 +3766,7 @@ function kn() {
|
|
|
3766
3766
|
// PORTING NOTE: Multi-tab only
|
|
3767
3767
|
static createSynthesizedRemoteEventForCurrentChange(t, e) {
|
|
3768
3768
|
const n = new Map;
|
|
3769
|
-
return n.set(t, $n.createSynthesizedTargetChangeForCurrentChange(t, e)), new xn(ut.min(), n, kn(),
|
|
3769
|
+
return n.set(t, $n.createSynthesizedTargetChangeForCurrentChange(t, e)), new xn(ut.min(), n, kn(), bn(), Cn());
|
|
3770
3770
|
}
|
|
3771
3771
|
}
|
|
3772
3772
|
|
|
@@ -3986,7 +3986,7 @@ class Bn {
|
|
|
3986
3986
|
/** The internal state of all tracked targets. */
|
|
3987
3987
|
this.nt = new Map,
|
|
3988
3988
|
/** Keeps track of the documents to update since the last raised snapshot. */
|
|
3989
|
-
this.st =
|
|
3989
|
+
this.st = bn(),
|
|
3990
3990
|
/** A mapping of document keys to their set of target IDs. */
|
|
3991
3991
|
this.it = Un(),
|
|
3992
3992
|
/**
|
|
@@ -3999,8 +3999,8 @@ class Bn {
|
|
|
3999
3999
|
/**
|
|
4000
4000
|
* Processes and adds the DocumentWatchChange to the current set of changes.
|
|
4001
4001
|
*/ ot(t) {
|
|
4002
|
-
for (const e of t.$) t.F && t.F.isFoundDocument() ? this.
|
|
4003
|
-
for (const e of t.removedTargetIds) this.
|
|
4002
|
+
for (const e of t.$) t.F && t.F.isFoundDocument() ? this.at(e, t.F) : this.ct(e, t.key, t.F);
|
|
4003
|
+
for (const e of t.removedTargetIds) this.ct(e, t.key, t.F);
|
|
4004
4004
|
}
|
|
4005
4005
|
/** Processes and adds the WatchTargetChange to the current set of changes. */ ut(t) {
|
|
4006
4006
|
this.forEachTarget(t, (e => {
|
|
@@ -4070,7 +4070,7 @@ class Bn {
|
|
|
4070
4070
|
// until it is resolved, essentially exposing inconsistency between
|
|
4071
4071
|
// queries.
|
|
4072
4072
|
const n = new Ct(t.path);
|
|
4073
|
-
this.
|
|
4073
|
+
this.ct(e, n, zt.newNoDocument(n, ut.min()));
|
|
4074
4074
|
} else U(1 === n); else {
|
|
4075
4075
|
this._t(e) !== n && (
|
|
4076
4076
|
// Existence filter mismatch: We reset the mapping and raise a new
|
|
@@ -4097,7 +4097,7 @@ class Bn {
|
|
|
4097
4097
|
// instead resulting in an explicit delete message and we could
|
|
4098
4098
|
// remove this special logic.
|
|
4099
4099
|
const e = new Ct(i.target.path);
|
|
4100
|
-
null !== this.st.get(e) || this.yt(s, e) || this.
|
|
4100
|
+
null !== this.st.get(e) || this.yt(s, e) || this.ct(s, e, zt.newNoDocument(e, t));
|
|
4101
4101
|
}
|
|
4102
4102
|
n.j && (e.set(s, n.G()), n.H());
|
|
4103
4103
|
}
|
|
@@ -4116,14 +4116,14 @@ class Bn {
|
|
|
4116
4116
|
})), s && (n = n.add(t));
|
|
4117
4117
|
}));
|
|
4118
4118
|
const s = new xn(t, e, this.rt, this.st, n);
|
|
4119
|
-
return this.st =
|
|
4119
|
+
return this.st = bn(), this.it = Un(), this.rt = new In(rt), s;
|
|
4120
4120
|
}
|
|
4121
4121
|
/**
|
|
4122
4122
|
* Adds the provided document to the internal list of document updates and
|
|
4123
4123
|
* its document key to the given target's mapping.
|
|
4124
4124
|
*/
|
|
4125
4125
|
// Visible for testing.
|
|
4126
|
-
|
|
4126
|
+
at(t, e) {
|
|
4127
4127
|
if (!this.lt(t)) return;
|
|
4128
4128
|
const n = this.yt(t, e.key) ? 2 /* Modified */ : 0 /* Added */;
|
|
4129
4129
|
this.ht(t).J(e.key, n), this.st = this.st.insert(e.key, e), this.it = this.it.insert(e.key, this.Tt(e.key).add(t));
|
|
@@ -4136,7 +4136,7 @@ class Bn {
|
|
|
4136
4136
|
* to update the remote document cache.
|
|
4137
4137
|
*/
|
|
4138
4138
|
// Visible for testing.
|
|
4139
|
-
|
|
4139
|
+
ct(t, e, n) {
|
|
4140
4140
|
if (!this.lt(t)) return;
|
|
4141
4141
|
const s = this.ht(t);
|
|
4142
4142
|
this.yt(t, e) ? s.J(e, 1 /* Removed */) :
|
|
@@ -4191,7 +4191,7 @@ class Bn {
|
|
|
4191
4191
|
*/ ft(t) {
|
|
4192
4192
|
this.nt.set(t, new Ln);
|
|
4193
4193
|
this.et.getRemoteKeysForTarget(t).forEach((e => {
|
|
4194
|
-
this.
|
|
4194
|
+
this.ct(t, e, /*updatedDocument=*/ null);
|
|
4195
4195
|
}));
|
|
4196
4196
|
}
|
|
4197
4197
|
/**
|
|
@@ -4298,7 +4298,7 @@ function Gn(t, e) {
|
|
|
4298
4298
|
function Hn(t) {
|
|
4299
4299
|
return U(!!t), ut.fromTimestamp(function(t) {
|
|
4300
4300
|
const e = It(t);
|
|
4301
|
-
return new
|
|
4301
|
+
return new ct(e.seconds, e.nanos);
|
|
4302
4302
|
}(t));
|
|
4303
4303
|
}
|
|
4304
4304
|
|
|
@@ -4310,7 +4310,7 @@ function Jn(t, e) {
|
|
|
4310
4310
|
|
|
4311
4311
|
function Yn(t) {
|
|
4312
4312
|
const e = wt.fromString(t);
|
|
4313
|
-
return U(
|
|
4313
|
+
return U(bs(e)), e;
|
|
4314
4314
|
}
|
|
4315
4315
|
|
|
4316
4316
|
function Xn(t, e) {
|
|
@@ -4377,7 +4377,7 @@ function os(t, e) {
|
|
|
4377
4377
|
}(t, e) : B();
|
|
4378
4378
|
}
|
|
4379
4379
|
|
|
4380
|
-
function
|
|
4380
|
+
function as(t, e) {
|
|
4381
4381
|
let n;
|
|
4382
4382
|
if ("targetChange" in e) {
|
|
4383
4383
|
e.targetChange;
|
|
@@ -4388,7 +4388,7 @@ function cs(t, e) {
|
|
|
4388
4388
|
}(e.targetChange.targetChangeType || "NO_CHANGE"), i = e.targetChange.targetIds || [], r = function(t, e) {
|
|
4389
4389
|
return t.C ? (U(void 0 === e || "string" == typeof e), Tt.fromBase64String(e || "")) : (U(void 0 === e || e instanceof Uint8Array),
|
|
4390
4390
|
Tt.fromUint8Array(e || new Uint8Array));
|
|
4391
|
-
}(t, e.targetChange.resumeToken), o = e.targetChange.cause,
|
|
4391
|
+
}(t, e.targetChange.resumeToken), o = e.targetChange.cause, a = o && function(t) {
|
|
4392
4392
|
const e = void 0 === t.code ? j.UNKNOWN : yn(t.code);
|
|
4393
4393
|
return new Q(e, t.message || "");
|
|
4394
4394
|
}
|
|
@@ -4400,7 +4400,7 @@ function cs(t, e) {
|
|
|
4400
4400
|
* our generated proto interfaces say Int32Value must be. But GRPC actually
|
|
4401
4401
|
* expects a { value: <number> } struct.
|
|
4402
4402
|
*/ (o);
|
|
4403
|
-
n = new Mn(s, i, r,
|
|
4403
|
+
n = new Mn(s, i, r, a || null);
|
|
4404
4404
|
} else if ("documentChange" in e) {
|
|
4405
4405
|
e.documentChange;
|
|
4406
4406
|
const s = e.documentChange;
|
|
@@ -4409,14 +4409,14 @@ function cs(t, e) {
|
|
|
4409
4409
|
mapValue: {
|
|
4410
4410
|
fields: s.document.fields
|
|
4411
4411
|
}
|
|
4412
|
-
}),
|
|
4413
|
-
n = new Fn(
|
|
4412
|
+
}), a = zt.newFoundDocument(i, r, o), c = s.targetIds || [], u = s.removedTargetIds || [];
|
|
4413
|
+
n = new Fn(c, u, a.key, a);
|
|
4414
4414
|
} else if ("documentDelete" in e) {
|
|
4415
4415
|
e.documentDelete;
|
|
4416
4416
|
const s = e.documentDelete;
|
|
4417
4417
|
s.document;
|
|
4418
|
-
const i = Zn(t, s.document), r = s.readTime ? Hn(s.readTime) : ut.min(), o = zt.newNoDocument(i, r),
|
|
4419
|
-
n = new Fn([],
|
|
4418
|
+
const i = Zn(t, s.document), r = s.readTime ? Hn(s.readTime) : ut.min(), o = zt.newNoDocument(i, r), a = s.removedTargetIds || [];
|
|
4419
|
+
n = new Fn([], a, o.key, o);
|
|
4420
4420
|
} else if ("documentRemove" in e) {
|
|
4421
4421
|
e.documentRemove;
|
|
4422
4422
|
const s = e.documentRemove;
|
|
@@ -4436,13 +4436,13 @@ function cs(t, e) {
|
|
|
4436
4436
|
return n;
|
|
4437
4437
|
}
|
|
4438
4438
|
|
|
4439
|
-
function
|
|
4439
|
+
function cs(t, e) {
|
|
4440
4440
|
let n;
|
|
4441
|
-
if (e instanceof
|
|
4441
|
+
if (e instanceof an) n = {
|
|
4442
4442
|
update: is(t, e.key, e.value)
|
|
4443
4443
|
}; else if (e instanceof fn) n = {
|
|
4444
4444
|
delete: Xn(t, e.key)
|
|
4445
|
-
}; else if (e instanceof
|
|
4445
|
+
}; else if (e instanceof cn) n = {
|
|
4446
4446
|
update: is(t, e.key, e.data),
|
|
4447
4447
|
updateMask: Rs(e.fieldMask)
|
|
4448
4448
|
}; else {
|
|
@@ -4510,9 +4510,9 @@ function us(t, e) {
|
|
|
4510
4510
|
const e = t.fieldPaths || [];
|
|
4511
4511
|
return new gt(e.map((t => mt.fromServerFormat(t))));
|
|
4512
4512
|
}(e.updateMask);
|
|
4513
|
-
return new
|
|
4513
|
+
return new cn(i, r, t, n, s);
|
|
4514
4514
|
}
|
|
4515
|
-
return new
|
|
4515
|
+
return new an(i, r, n, s);
|
|
4516
4516
|
}
|
|
4517
4517
|
if (e.delete) {
|
|
4518
4518
|
const s = Zn(t, e.delete);
|
|
@@ -4659,15 +4659,15 @@ function ds(t) {
|
|
|
4659
4659
|
// visible for testing
|
|
4660
4660
|
(t.direction));
|
|
4661
4661
|
}(t))));
|
|
4662
|
-
let
|
|
4663
|
-
n.limit && (
|
|
4662
|
+
let a = null;
|
|
4663
|
+
n.limit && (a = function(t) {
|
|
4664
4664
|
let e;
|
|
4665
4665
|
return e = "object" == typeof t ? t.value : t, Vt(e) ? null : e;
|
|
4666
4666
|
}(n.limit));
|
|
4667
|
-
let
|
|
4668
|
-
n.startAt && (
|
|
4667
|
+
let c = null;
|
|
4668
|
+
n.startAt && (c = gs(n.startAt));
|
|
4669
4669
|
let u = null;
|
|
4670
|
-
return n.endAt && (u = gs(n.endAt)), ye(e, i, o, r,
|
|
4670
|
+
return n.endAt && (u = gs(n.endAt)), ye(e, i, o, r, a, "F" /* First */ , c, u);
|
|
4671
4671
|
}
|
|
4672
4672
|
|
|
4673
4673
|
function ws(t, e) {
|
|
@@ -4803,7 +4803,7 @@ function Rs(t) {
|
|
|
4803
4803
|
};
|
|
4804
4804
|
}
|
|
4805
4805
|
|
|
4806
|
-
function
|
|
4806
|
+
function bs(t) {
|
|
4807
4807
|
// Resource names have at least 4 components (project ID, database ID)
|
|
4808
4808
|
return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
|
|
4809
4809
|
}
|
|
@@ -4827,7 +4827,7 @@ function Ps(t) {
|
|
|
4827
4827
|
/**
|
|
4828
4828
|
* Encodes a resource path into a IndexedDb-compatible string form.
|
|
4829
4829
|
*/
|
|
4830
|
-
function
|
|
4830
|
+
function Ps(t) {
|
|
4831
4831
|
let e = "";
|
|
4832
4832
|
for (let n = 0; n < t.length; n++) e.length > 0 && (e = Vs(e)), e = vs(t.get(n), e);
|
|
4833
4833
|
return Vs(e);
|
|
@@ -5091,13 +5091,13 @@ class xs {
|
|
|
5091
5091
|
* Creates a [userId, encodedPath] key for use in the DbDocumentMutations
|
|
5092
5092
|
* index to iterate over all at document mutations for a given path or lower.
|
|
5093
5093
|
*/ static prefixForPath(t, e) {
|
|
5094
|
-
return [ t,
|
|
5094
|
+
return [ t, Ps(e) ];
|
|
5095
5095
|
}
|
|
5096
5096
|
/**
|
|
5097
5097
|
* Creates a full index key of [userId, encodedPath, batchId] for inserting
|
|
5098
5098
|
* and deleting into the DbDocumentMutations index.
|
|
5099
5099
|
*/ static key(t, e, n) {
|
|
5100
|
-
return [ t,
|
|
5100
|
+
return [ t, Ps(e), n ];
|
|
5101
5101
|
}
|
|
5102
5102
|
}
|
|
5103
5103
|
|
|
@@ -5708,12 +5708,12 @@ class Js {
|
|
|
5708
5708
|
// bug we're checking for should exist in iOS >= 12.2 and < 13, but for
|
|
5709
5709
|
// whatever reason it's much harder to hit after 12.2 so we only proactively
|
|
5710
5710
|
// log on 12.2.
|
|
5711
|
-
12.2 === Ys.
|
|
5711
|
+
12.2 === Ys.bt(u()) && O("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.");
|
|
5712
5712
|
}
|
|
5713
5713
|
/** Deletes the specified database. */ static delete(t) {
|
|
5714
5714
|
return F("SimpleDb", "Removing database:", t), ni(window.indexedDB.deleteDatabase(t)).toPromise();
|
|
5715
5715
|
}
|
|
5716
|
-
/** Returns true if IndexedDB is available in the current environment. */ static
|
|
5716
|
+
/** Returns true if IndexedDB is available in the current environment. */ static Pt() {
|
|
5717
5717
|
if (!h()) return !1;
|
|
5718
5718
|
if (Ys.vt()) return !0;
|
|
5719
5719
|
// We extensively use indexed array values and compound keys,
|
|
@@ -5723,7 +5723,7 @@ class Js {
|
|
|
5723
5723
|
// For tracking support of this feature, see here:
|
|
5724
5724
|
// https://developer.microsoft.com/en-us/microsoft-edge/platform/status/indexeddbarraysandmultientrysupport/
|
|
5725
5725
|
// Check the UA string to find out the browser.
|
|
5726
|
-
const t = u(), e = Ys.
|
|
5726
|
+
const t = u(), e = Ys.bt(t), n = 0 < e && e < 10, s = Ys.Vt(t), i = 0 < s && s < 4.5;
|
|
5727
5727
|
// IE 10
|
|
5728
5728
|
// ua = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)';
|
|
5729
5729
|
// IE 11
|
|
@@ -5746,7 +5746,7 @@ class Js {
|
|
|
5746
5746
|
}
|
|
5747
5747
|
// visible for testing
|
|
5748
5748
|
/** Parse User Agent to determine iOS version. Returns -1 if not found. */
|
|
5749
|
-
static
|
|
5749
|
+
static bt(t) {
|
|
5750
5750
|
const e = t.match(/i(?:phone|pad|pod) os ([\d_]+)/i), n = e ? e[1].split("_").slice(0, 2).join(".") : "-1";
|
|
5751
5751
|
return Number(n);
|
|
5752
5752
|
}
|
|
@@ -6016,7 +6016,7 @@ class Js {
|
|
|
6016
6016
|
let si = !1;
|
|
6017
6017
|
|
|
6018
6018
|
function ii(t) {
|
|
6019
|
-
const e = Ys.
|
|
6019
|
+
const e = Ys.bt(u());
|
|
6020
6020
|
if (e >= 12.2 && e < 13) {
|
|
6021
6021
|
const e = "An internal error was encountered in the Indexed Database server";
|
|
6022
6022
|
if (t.message.indexOf(e) >= 0) {
|
|
@@ -6077,7 +6077,7 @@ function oi(t, e) {
|
|
|
6077
6077
|
*/
|
|
6078
6078
|
/**
|
|
6079
6079
|
* A batch of mutations that will be sent as one unit to the backend.
|
|
6080
|
-
*/ class
|
|
6080
|
+
*/ class ai {
|
|
6081
6081
|
/**
|
|
6082
6082
|
* @param batchId - The unique ID of this mutation batch.
|
|
6083
6083
|
* @param localWriteTime - The original write time of this mutation.
|
|
@@ -6142,7 +6142,7 @@ function oi(t, e) {
|
|
|
6142
6142
|
}
|
|
6143
6143
|
}
|
|
6144
6144
|
|
|
6145
|
-
/** The result of applying a mutation batch to the backend. */ class
|
|
6145
|
+
/** The result of applying a mutation batch to the backend. */ class ci {
|
|
6146
6146
|
constructor(t, e, n,
|
|
6147
6147
|
/**
|
|
6148
6148
|
* A pre-computed mapping from each mutated document to the resulting
|
|
@@ -6160,7 +6160,7 @@ function oi(t, e) {
|
|
|
6160
6160
|
let s = Sn();
|
|
6161
6161
|
const i = t.mutations;
|
|
6162
6162
|
for (let t = 0; t < i.length; t++) s = s.insert(i[t].key, n[t].version);
|
|
6163
|
-
return new
|
|
6163
|
+
return new ci(t, e, n, s);
|
|
6164
6164
|
}
|
|
6165
6165
|
}
|
|
6166
6166
|
|
|
@@ -6301,7 +6301,7 @@ function di(t) {
|
|
|
6301
6301
|
}
|
|
6302
6302
|
|
|
6303
6303
|
function wi(t) {
|
|
6304
|
-
const e = new
|
|
6304
|
+
const e = new ct(t[0], t[1]);
|
|
6305
6305
|
return ut.fromTimestamp(e);
|
|
6306
6306
|
}
|
|
6307
6307
|
|
|
@@ -6311,7 +6311,7 @@ function _i(t) {
|
|
|
6311
6311
|
}
|
|
6312
6312
|
|
|
6313
6313
|
function mi(t) {
|
|
6314
|
-
const e = new
|
|
6314
|
+
const e = new ct(t.seconds, t.nanoseconds);
|
|
6315
6315
|
return ut.fromTimestamp(e);
|
|
6316
6316
|
}
|
|
6317
6317
|
|
|
@@ -6332,8 +6332,8 @@ function gi(t, e) {
|
|
|
6332
6332
|
++t;
|
|
6333
6333
|
}
|
|
6334
6334
|
}
|
|
6335
|
-
const s = e.mutations.map((e => us(t.Gt, e))), i =
|
|
6336
|
-
return new
|
|
6335
|
+
const s = e.mutations.map((e => us(t.Gt, e))), i = ct.fromMillis(e.localWriteTimeMs);
|
|
6336
|
+
return new ai(e.batchId, i, n, s);
|
|
6337
6337
|
}
|
|
6338
6338
|
|
|
6339
6339
|
/** Decodes a DbTarget into TargetData */ function yi(t) {
|
|
@@ -6341,8 +6341,8 @@ function gi(t, e) {
|
|
|
6341
6341
|
let s;
|
|
6342
6342
|
var i;
|
|
6343
6343
|
return void 0 !== t.query.documents ? (U(1 === (i = t.query).documents.length),
|
|
6344
|
-
s =
|
|
6345
|
-
return
|
|
6344
|
+
s = Pe(pe(es(i.documents[0])))) : s = function(t) {
|
|
6345
|
+
return Pe(ds(t));
|
|
6346
6346
|
}(t.query), new ui(s, t.targetId, 0 /* Listen */ , t.lastListenSequenceNumber, e, n, Tt.fromBase64String(t.resumeToken));
|
|
6347
6347
|
}
|
|
6348
6348
|
|
|
@@ -6464,7 +6464,7 @@ class Ei {
|
|
|
6464
6464
|
* An in-memory implementation of IndexManager.
|
|
6465
6465
|
*/ class Ri {
|
|
6466
6466
|
constructor() {
|
|
6467
|
-
this.zt = new
|
|
6467
|
+
this.zt = new bi;
|
|
6468
6468
|
}
|
|
6469
6469
|
addToCollectionParentIndex(t, e) {
|
|
6470
6470
|
return this.zt.add(e), Hs.resolve();
|
|
@@ -6478,7 +6478,7 @@ class Ei {
|
|
|
6478
6478
|
* Internal implementation of the collection-parent index exposed by MemoryIndexManager.
|
|
6479
6479
|
* Also used for in-memory caching by IndexedDbIndexManager and initial index population
|
|
6480
6480
|
* in indexeddb_schema.ts
|
|
6481
|
-
*/ class
|
|
6481
|
+
*/ class bi {
|
|
6482
6482
|
constructor() {
|
|
6483
6483
|
this.index = {};
|
|
6484
6484
|
}
|
|
@@ -6514,7 +6514,7 @@ class Ei {
|
|
|
6514
6514
|
*/
|
|
6515
6515
|
/**
|
|
6516
6516
|
* A persisted implementation of IndexManager.
|
|
6517
|
-
*/ class
|
|
6517
|
+
*/ class Pi {
|
|
6518
6518
|
constructor() {
|
|
6519
6519
|
/**
|
|
6520
6520
|
* An in-memory copy of the index entries we've already written since the SDK
|
|
@@ -6523,7 +6523,7 @@ class Ei {
|
|
|
6523
6523
|
* This is *NOT* a complete cache of what's in persistence and so can never be used to
|
|
6524
6524
|
* satisfy reads.
|
|
6525
6525
|
*/
|
|
6526
|
-
this.Ht = new
|
|
6526
|
+
this.Ht = new bi;
|
|
6527
6527
|
}
|
|
6528
6528
|
/**
|
|
6529
6529
|
* Adds a new entry to the collection parent index.
|
|
@@ -6541,14 +6541,14 @@ class Ei {
|
|
|
6541
6541
|
}));
|
|
6542
6542
|
const i = {
|
|
6543
6543
|
collectionId: n,
|
|
6544
|
-
parent:
|
|
6544
|
+
parent: Ps(s)
|
|
6545
6545
|
};
|
|
6546
6546
|
return vi(t).put(i);
|
|
6547
6547
|
}
|
|
6548
6548
|
return Hs.resolve();
|
|
6549
6549
|
}
|
|
6550
6550
|
getCollectionParents(t, e) {
|
|
6551
|
-
const n = [], s = IDBKeyRange.bound([ e, "" ], [
|
|
6551
|
+
const n = [], s = IDBKeyRange.bound([ e, "" ], [ at(e), "" ],
|
|
6552
6552
|
/*lowerOpen=*/ !1,
|
|
6553
6553
|
/*upperOpen=*/ !0);
|
|
6554
6554
|
return vi(t).Bt(s).next((t => {
|
|
@@ -6633,12 +6633,12 @@ class Si {
|
|
|
6633
6633
|
*/
|
|
6634
6634
|
function Di(t, e, n) {
|
|
6635
6635
|
const s = t.store(ks.store), i = t.store(xs.store), r = [], o = IDBKeyRange.only(n.batchId);
|
|
6636
|
-
let
|
|
6637
|
-
const
|
|
6636
|
+
let a = 0;
|
|
6637
|
+
const c = s.jt({
|
|
6638
6638
|
range: o
|
|
6639
|
-
}, ((t, e, n) => (
|
|
6640
|
-
r.push(
|
|
6641
|
-
U(1 ===
|
|
6639
|
+
}, ((t, e, n) => (a++, n.delete())));
|
|
6640
|
+
r.push(c.next((() => {
|
|
6641
|
+
U(1 === a);
|
|
6642
6642
|
})));
|
|
6643
6643
|
const u = [];
|
|
6644
6644
|
for (const t of n.mutations) {
|
|
@@ -6738,20 +6738,20 @@ class Ni {
|
|
|
6738
6738
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6739
6739
|
return r.add({}).next((o => {
|
|
6740
6740
|
U("number" == typeof o);
|
|
6741
|
-
const
|
|
6742
|
-
const s = n.baseMutations.map((e =>
|
|
6741
|
+
const a = new ai(o, e, n, s), c = function(t, e, n) {
|
|
6742
|
+
const s = n.baseMutations.map((e => cs(t.Gt, e))), i = n.mutations.map((e => cs(t.Gt, e)));
|
|
6743
6743
|
return new ks(e, n.batchId, n.localWriteTime.toMillis(), s, i);
|
|
6744
|
-
}(this.k, this.userId,
|
|
6744
|
+
}(this.k, this.userId, a), u = [];
|
|
6745
6745
|
let h = new In(((t, e) => rt(t.canonicalString(), e.canonicalString())));
|
|
6746
6746
|
for (const t of s) {
|
|
6747
6747
|
const e = xs.key(this.userId, t.key.path, o);
|
|
6748
|
-
h = h.add(t.key.path.popLast()), u.push(r.put(
|
|
6748
|
+
h = h.add(t.key.path.popLast()), u.push(r.put(c)), u.push(i.put(e, xs.PLACEHOLDER));
|
|
6749
6749
|
}
|
|
6750
6750
|
return h.forEach((e => {
|
|
6751
6751
|
u.push(this.Jt.addToCollectionParentIndex(t, e));
|
|
6752
6752
|
})), t.addOnCommittedListener((() => {
|
|
6753
|
-
this.Yt[o] =
|
|
6754
|
-
})), Hs.waitFor(u).next((() =>
|
|
6753
|
+
this.Yt[o] = a.keys();
|
|
6754
|
+
})), Hs.waitFor(u).next((() => a));
|
|
6755
6755
|
}));
|
|
6756
6756
|
}
|
|
6757
6757
|
lookupMutationBatch(t, e) {
|
|
@@ -6805,7 +6805,7 @@ class Ni {
|
|
|
6805
6805
|
return $i(t).jt({
|
|
6806
6806
|
range: s
|
|
6807
6807
|
}, ((n, s, r) => {
|
|
6808
|
-
const [o,
|
|
6808
|
+
const [o, a, c] = n, u = Ss(a);
|
|
6809
6809
|
// Only consider rows matching exactly the specific key of
|
|
6810
6810
|
// interest. Note that because we order by path first, and we
|
|
6811
6811
|
// order terminators before path separators, we'll encounter all
|
|
@@ -6815,7 +6815,7 @@ class Ni {
|
|
|
6815
6815
|
// can stop as soon as we hit any such row.
|
|
6816
6816
|
if (o === this.userId && e.path.isEqual(u))
|
|
6817
6817
|
// Look up the mutation batch in the store.
|
|
6818
|
-
return xi(t).get(
|
|
6818
|
+
return xi(t).get(c).next((t => {
|
|
6819
6819
|
if (!t) throw B();
|
|
6820
6820
|
U(t.userId === this.userId), i.push(gi(this.k, t));
|
|
6821
6821
|
}));
|
|
@@ -6829,7 +6829,7 @@ class Ni {
|
|
|
6829
6829
|
const i = xs.prefixForPath(this.userId, e.path), r = IDBKeyRange.lowerBound(i), o = $i(t).jt({
|
|
6830
6830
|
range: r
|
|
6831
6831
|
}, ((t, s, i) => {
|
|
6832
|
-
const [r, o,
|
|
6832
|
+
const [r, o, a] = t, c = Ss(o);
|
|
6833
6833
|
// Only consider rows matching exactly the specific key of
|
|
6834
6834
|
// interest. Note that because we order by path first, and we
|
|
6835
6835
|
// order terminators before path separators, we'll encounter all
|
|
@@ -6837,7 +6837,7 @@ class Ni {
|
|
|
6837
6837
|
// the rows for documentKey will occur before any rows for
|
|
6838
6838
|
// documents nested in a subcollection beneath documentKey so we
|
|
6839
6839
|
// can stop as soon as we hit any such row.
|
|
6840
|
-
r === this.userId && e.path.isEqual(
|
|
6840
|
+
r === this.userId && e.path.isEqual(c) ? n = n.add(a) : i.done();
|
|
6841
6841
|
}));
|
|
6842
6842
|
s.push(o);
|
|
6843
6843
|
})), Hs.waitFor(s).next((() => this.te(t, n)));
|
|
@@ -6851,14 +6851,14 @@ class Ni {
|
|
|
6851
6851
|
return $i(t).jt({
|
|
6852
6852
|
range: r
|
|
6853
6853
|
}, ((t, e, i) => {
|
|
6854
|
-
const [r,
|
|
6854
|
+
const [r, a, c] = t, u = Ss(a);
|
|
6855
6855
|
r === this.userId && n.isPrefixOf(u) ?
|
|
6856
6856
|
// Rows with document keys more than one segment longer than the
|
|
6857
6857
|
// query path can't be matches. For example, a query on 'rooms'
|
|
6858
6858
|
// can't match the document /rooms/abc/messages/xyx.
|
|
6859
6859
|
// TODO(mcg): we'll need a different scanner when we implement
|
|
6860
6860
|
// ancestor queries.
|
|
6861
|
-
u.length === s && (o = o.add(
|
|
6861
|
+
u.length === s && (o = o.add(c)) : i.done();
|
|
6862
6862
|
})).next((() => this.te(t, o)));
|
|
6863
6863
|
}
|
|
6864
6864
|
te(t, e) {
|
|
@@ -6927,8 +6927,8 @@ class Ni {
|
|
|
6927
6927
|
range: r,
|
|
6928
6928
|
Kt: !0
|
|
6929
6929
|
}, ((t, n, s) => {
|
|
6930
|
-
const [r,
|
|
6931
|
-
r === e &&
|
|
6930
|
+
const [r, a, /*batchID*/ c] = t;
|
|
6931
|
+
r === e && a === i && (o = !0), s.done();
|
|
6932
6932
|
})).next((() => o));
|
|
6933
6933
|
}
|
|
6934
6934
|
|
|
@@ -7031,29 +7031,29 @@ class Oi {
|
|
|
7031
7031
|
allocateTargetId(t) {
|
|
7032
7032
|
return this.oe(t).next((e => {
|
|
7033
7033
|
const n = new Oi(e.highestTargetId);
|
|
7034
|
-
return e.highestTargetId = n.next(), this.
|
|
7034
|
+
return e.highestTargetId = n.next(), this.ae(t, e).next((() => e.highestTargetId));
|
|
7035
7035
|
}));
|
|
7036
7036
|
}
|
|
7037
7037
|
getLastRemoteSnapshotVersion(t) {
|
|
7038
|
-
return this.oe(t).next((t => ut.fromTimestamp(new
|
|
7038
|
+
return this.oe(t).next((t => ut.fromTimestamp(new ct(t.lastRemoteSnapshotVersion.seconds, t.lastRemoteSnapshotVersion.nanoseconds))));
|
|
7039
7039
|
}
|
|
7040
7040
|
getHighestSequenceNumber(t) {
|
|
7041
7041
|
return this.oe(t).next((t => t.highestListenSequenceNumber));
|
|
7042
7042
|
}
|
|
7043
7043
|
setTargetsMetadata(t, e, n) {
|
|
7044
7044
|
return this.oe(t).next((s => (s.highestListenSequenceNumber = e, n && (s.lastRemoteSnapshotVersion = n.toTimestamp()),
|
|
7045
|
-
e > s.highestListenSequenceNumber && (s.highestListenSequenceNumber = e), this.
|
|
7045
|
+
e > s.highestListenSequenceNumber && (s.highestListenSequenceNumber = e), this.ae(t, s))));
|
|
7046
7046
|
}
|
|
7047
7047
|
addTargetData(t, e) {
|
|
7048
|
-
return this.
|
|
7049
|
-
this.
|
|
7048
|
+
return this.ce(t, e).next((() => this.oe(t).next((n => (n.targetCount += 1, this.ue(e, n),
|
|
7049
|
+
this.ae(t, n))))));
|
|
7050
7050
|
}
|
|
7051
7051
|
updateTargetData(t, e) {
|
|
7052
|
-
return this.
|
|
7052
|
+
return this.ce(t, e);
|
|
7053
7053
|
}
|
|
7054
7054
|
removeTargetData(t, e) {
|
|
7055
7055
|
return this.removeMatchingKeysForTargetId(t, e.targetId).next((() => Li(t).delete(e.targetId))).next((() => this.oe(t))).next((e => (U(e.targetCount > 0),
|
|
7056
|
-
e.targetCount -= 1, this.
|
|
7056
|
+
e.targetCount -= 1, this.ae(t, e))));
|
|
7057
7057
|
}
|
|
7058
7058
|
/**
|
|
7059
7059
|
* Drops any targets with sequence number less than or equal to the upper bound, excepting those
|
|
@@ -7063,8 +7063,8 @@ class Oi {
|
|
|
7063
7063
|
let s = 0;
|
|
7064
7064
|
const i = [];
|
|
7065
7065
|
return Li(t).jt(((r, o) => {
|
|
7066
|
-
const
|
|
7067
|
-
|
|
7066
|
+
const a = yi(o);
|
|
7067
|
+
a.sequenceNumber <= e && null === n.get(a.targetId) && (s++, i.push(this.removeTargetData(t, a)));
|
|
7068
7068
|
})).next((() => Hs.waitFor(i))).next((() => s));
|
|
7069
7069
|
}
|
|
7070
7070
|
/**
|
|
@@ -7078,10 +7078,10 @@ class Oi {
|
|
|
7078
7078
|
oe(t) {
|
|
7079
7079
|
return Bi(t).get(Us.key).next((t => (U(null !== t), t)));
|
|
7080
7080
|
}
|
|
7081
|
-
|
|
7081
|
+
ae(t, e) {
|
|
7082
7082
|
return Bi(t).put(Us.key, e);
|
|
7083
7083
|
}
|
|
7084
|
-
|
|
7084
|
+
ce(t, e) {
|
|
7085
7085
|
return Li(t).put(pi(this.k, e));
|
|
7086
7086
|
}
|
|
7087
7087
|
/**
|
|
@@ -7118,7 +7118,7 @@ class Oi {
|
|
|
7118
7118
|
// IndexedDb.
|
|
7119
7119
|
const s = [], i = Ui(t);
|
|
7120
7120
|
return e.forEach((e => {
|
|
7121
|
-
const r =
|
|
7121
|
+
const r = Ps(e.path);
|
|
7122
7122
|
s.push(i.put(new Bs(n, r))), s.push(this.referenceDelegate.addReference(t, n, e));
|
|
7123
7123
|
})), Hs.waitFor(s);
|
|
7124
7124
|
}
|
|
@@ -7127,7 +7127,7 @@ class Oi {
|
|
|
7127
7127
|
// IndexedDb.
|
|
7128
7128
|
const s = Ui(t);
|
|
7129
7129
|
return Hs.forEach(e, (e => {
|
|
7130
|
-
const i =
|
|
7130
|
+
const i = Ps(e.path);
|
|
7131
7131
|
return Hs.waitFor([ s.delete([ n, i ]), this.referenceDelegate.removeReference(t, n, e) ]);
|
|
7132
7132
|
}));
|
|
7133
7133
|
}
|
|
@@ -7151,7 +7151,7 @@ class Oi {
|
|
|
7151
7151
|
})).next((() => i));
|
|
7152
7152
|
}
|
|
7153
7153
|
containsKey(t, e) {
|
|
7154
|
-
const n =
|
|
7154
|
+
const n = Ps(e.path), s = IDBKeyRange.bound([ n ], [ at(n) ],
|
|
7155
7155
|
/*lowerOpen=*/ !1,
|
|
7156
7156
|
/*upperOpen=*/ !0);
|
|
7157
7157
|
let i = 0;
|
|
@@ -7333,16 +7333,16 @@ class Oi {
|
|
|
7333
7333
|
return this.ge.getCacheSize(t);
|
|
7334
7334
|
}
|
|
7335
7335
|
Te(t, e) {
|
|
7336
|
-
let n, s, i, r, o,
|
|
7336
|
+
let n, s, i, r, o, c, u;
|
|
7337
7337
|
const h = Date.now();
|
|
7338
7338
|
return this.calculateTargetCount(t, this.params.percentileToCollect).next((e => (
|
|
7339
7339
|
// Cap at the configured max
|
|
7340
7340
|
e > this.params.maximumSequenceNumbersToCollect ? (F("LruGarbageCollector", `Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${e}`),
|
|
7341
7341
|
s = this.params.maximumSequenceNumbersToCollect) : s = e, r = Date.now(), this.nthSequenceNumber(t, s)))).next((s => (n = s,
|
|
7342
|
-
o = Date.now(), this.removeTargets(t, n, e)))).next((e => (i = e,
|
|
7342
|
+
o = Date.now(), this.removeTargets(t, n, e)))).next((e => (i = e, c = Date.now(),
|
|
7343
7343
|
this.removeOrphanedDocuments(t, n)))).next((t => {
|
|
7344
|
-
if (u = Date.now(), x() <=
|
|
7345
|
-
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 ` + (
|
|
7344
|
+
if (u = Date.now(), x() <= a.DEBUG) {
|
|
7345
|
+
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 ` + (c - o) + "ms\n" + `\tRemoved ${t} documents in ` + (u - c) + "ms\n" + `Total Duration: ${u - h}ms`);
|
|
7346
7346
|
}
|
|
7347
7347
|
return Hs.resolve({
|
|
7348
7348
|
didRun: !0,
|
|
@@ -7425,7 +7425,7 @@ class Gi {
|
|
|
7425
7425
|
if (!e)
|
|
7426
7426
|
// Our size accounting requires us to read all documents before
|
|
7427
7427
|
// removing them.
|
|
7428
|
-
return i++, n.getEntry(t, r).next((() => (n.removeEntry(r), Ui(t).delete([ 0,
|
|
7428
|
+
return i++, n.getEntry(t, r).next((() => (n.removeEntry(r), Ui(t).delete([ 0, Ps(r.path) ]))));
|
|
7429
7429
|
}));
|
|
7430
7430
|
s.push(e);
|
|
7431
7431
|
}
|
|
@@ -7480,7 +7480,7 @@ function zi(t, e) {
|
|
|
7480
7480
|
* store.
|
|
7481
7481
|
*/
|
|
7482
7482
|
function(t, e) {
|
|
7483
|
-
return new Bs(0,
|
|
7483
|
+
return new Bs(0, Ps(t.path), e);
|
|
7484
7484
|
}(e, t.currentSequenceNumber));
|
|
7485
7485
|
}
|
|
7486
7486
|
|
|
@@ -7699,23 +7699,23 @@ function zi(t, e) {
|
|
|
7699
7699
|
return this.getMetadata(t).next((n => (n.byteSize += e, this.Re(t, n))));
|
|
7700
7700
|
}
|
|
7701
7701
|
getEntry(t, e) {
|
|
7702
|
-
return tr(t).get(er(e)).next((t => this.
|
|
7702
|
+
return tr(t).get(er(e)).next((t => this.be(e, t)));
|
|
7703
7703
|
}
|
|
7704
7704
|
/**
|
|
7705
7705
|
* Looks up an entry in the cache.
|
|
7706
7706
|
*
|
|
7707
7707
|
* @param documentKey - The key of the entry to look up.
|
|
7708
7708
|
* @returns The cached document entry and its size.
|
|
7709
|
-
*/
|
|
7709
|
+
*/ Pe(t, e) {
|
|
7710
7710
|
return tr(t).get(er(e)).next((t => ({
|
|
7711
|
-
document: this.
|
|
7711
|
+
document: this.be(e, t),
|
|
7712
7712
|
size: Ci(t)
|
|
7713
7713
|
})));
|
|
7714
7714
|
}
|
|
7715
7715
|
getEntries(t, e) {
|
|
7716
|
-
let n =
|
|
7716
|
+
let n = bn();
|
|
7717
7717
|
return this.ve(t, e, ((t, e) => {
|
|
7718
|
-
const s = this.
|
|
7718
|
+
const s = this.be(t, e);
|
|
7719
7719
|
n = n.insert(t, s);
|
|
7720
7720
|
})).next((() => n));
|
|
7721
7721
|
}
|
|
@@ -7726,9 +7726,9 @@ function zi(t, e) {
|
|
|
7726
7726
|
* @returns A map of documents indexed by key and a map of sizes indexed by
|
|
7727
7727
|
* key (zero if the document does not exist).
|
|
7728
7728
|
*/ Ve(t, e) {
|
|
7729
|
-
let n =
|
|
7729
|
+
let n = bn(), s = new pn(Ct.comparator);
|
|
7730
7730
|
return this.ve(t, e, ((t, e) => {
|
|
7731
|
-
const i = this.
|
|
7731
|
+
const i = this.be(t, e);
|
|
7732
7732
|
n = n.insert(t, i), s = s.insert(t, Ci(e));
|
|
7733
7733
|
})).next((() => ({
|
|
7734
7734
|
documents: n,
|
|
@@ -7757,7 +7757,7 @@ function zi(t, e) {
|
|
|
7757
7757
|
}));
|
|
7758
7758
|
}
|
|
7759
7759
|
getDocumentsMatchingQuery(t, e, n) {
|
|
7760
|
-
let s =
|
|
7760
|
+
let s = bn();
|
|
7761
7761
|
const i = e.path.length + 1, r = {};
|
|
7762
7762
|
if (n.isEqual(ut.min())) {
|
|
7763
7763
|
// Documents are ordered by key, so we can use a prefix scan to narrow
|
|
@@ -7798,7 +7798,7 @@ function zi(t, e) {
|
|
|
7798
7798
|
/**
|
|
7799
7799
|
* Decodes `remoteDoc` and returns the document (or null, if the document
|
|
7800
7800
|
* corresponds to the format used for sentinel deletes).
|
|
7801
|
-
*/
|
|
7801
|
+
*/ be(t, e) {
|
|
7802
7802
|
if (e) {
|
|
7803
7803
|
const t = li(this.k, e);
|
|
7804
7804
|
// Whether the document is a sentinel removal and should only be used in the
|
|
@@ -7839,10 +7839,10 @@ class Xi extends Ji {
|
|
|
7839
7839
|
return this.changes.forEach(((i, r) => {
|
|
7840
7840
|
const o = this.Ce.get(i);
|
|
7841
7841
|
if (r.document.isValidDocument()) {
|
|
7842
|
-
const
|
|
7842
|
+
const a = fi(this.De.k, r.document, this.getReadTime(i));
|
|
7843
7843
|
s = s.add(i.path.popLast());
|
|
7844
|
-
const
|
|
7845
|
-
n +=
|
|
7844
|
+
const c = Ci(a);
|
|
7845
|
+
n += c - o, e.push(this.De.addEntry(t, i, a));
|
|
7846
7846
|
} else if (n -= o, this.trackRemovals) {
|
|
7847
7847
|
// In order to track removals, we store a "sentinel delete" in the
|
|
7848
7848
|
// RemoteDocumentCache. This entry is represented by a NoDocument
|
|
@@ -7857,7 +7857,7 @@ class Xi extends Ji {
|
|
|
7857
7857
|
}
|
|
7858
7858
|
getFromCache(t, e) {
|
|
7859
7859
|
// Record the size of everything we load from the cache so we can compute a delta later.
|
|
7860
|
-
return this.De.
|
|
7860
|
+
return this.De.Pe(t, e).next((t => (this.Ce.set(e, t.size), t.document)));
|
|
7861
7861
|
}
|
|
7862
7862
|
getAllFromCache(t, e) {
|
|
7863
7863
|
// Record the size of everything we load from the cache so we can compute
|
|
@@ -8057,9 +8057,9 @@ function er(t) {
|
|
|
8057
8057
|
const s = [];
|
|
8058
8058
|
return n.jt(((n, i) => {
|
|
8059
8059
|
const r = new wt(n), o = function(t) {
|
|
8060
|
-
return [ 0,
|
|
8060
|
+
return [ 0, Ps(t) ];
|
|
8061
8061
|
}(r);
|
|
8062
|
-
s.push(e.get(o).next((n => n ? Hs.resolve() : (n => e.put(new Bs(0,
|
|
8062
|
+
s.push(e.get(o).next((n => n ? Hs.resolve() : (n => e.put(new Bs(0, Ps(n), t.highestListenSequenceNumber)))(r))));
|
|
8063
8063
|
})).next((() => Hs.waitFor(s)));
|
|
8064
8064
|
}));
|
|
8065
8065
|
}
|
|
@@ -8068,12 +8068,12 @@ function er(t) {
|
|
|
8068
8068
|
t.createObjectStore(qs.store, {
|
|
8069
8069
|
keyPath: qs.keyPath
|
|
8070
8070
|
});
|
|
8071
|
-
const n = e.store(qs.store), s = new
|
|
8071
|
+
const n = e.store(qs.store), s = new bi, i = t => {
|
|
8072
8072
|
if (s.add(t)) {
|
|
8073
8073
|
const e = t.lastSegment(), s = t.popLast();
|
|
8074
8074
|
return n.put({
|
|
8075
8075
|
collectionId: e,
|
|
8076
|
-
parent:
|
|
8076
|
+
parent: Ps(s)
|
|
8077
8077
|
});
|
|
8078
8078
|
}
|
|
8079
8079
|
};
|
|
@@ -8172,14 +8172,14 @@ class rr {
|
|
|
8172
8172
|
* Whether to synchronize the in-memory state of multiple tabs and share
|
|
8173
8173
|
* access to local persistence.
|
|
8174
8174
|
*/
|
|
8175
|
-
t, e, n, s, i, r, o,
|
|
8175
|
+
t, e, n, s, i, r, o, a, c,
|
|
8176
8176
|
/**
|
|
8177
8177
|
* If set to true, forcefully obtains database access. Existing tabs will
|
|
8178
8178
|
* no longer be able to access IndexedDB.
|
|
8179
8179
|
*/
|
|
8180
8180
|
u) {
|
|
8181
8181
|
if (this.allowTabSynchronization = t, this.persistenceKey = e, this.clientId = n,
|
|
8182
|
-
this.Oe = i, this.window = r, this.document = o, this.Me =
|
|
8182
|
+
this.Oe = i, this.window = r, this.document = o, this.Me = c, this.Le = u, this.Be = null,
|
|
8183
8183
|
this.Ue = !1, this.isPrimary = !1, this.networkEnabled = !0,
|
|
8184
8184
|
/** Our window.unload handler, if registered. */
|
|
8185
8185
|
this.qe = null, this.inForeground = !1,
|
|
@@ -8190,10 +8190,10 @@ class rr {
|
|
|
8190
8190
|
/** The last time we garbage collected the client metadata object store. */
|
|
8191
8191
|
this.Qe = Number.NEGATIVE_INFINITY,
|
|
8192
8192
|
/** A listener to notify on primary state changes. */
|
|
8193
|
-
this.We = t => Promise.resolve(), !rr.
|
|
8194
|
-
this.referenceDelegate = new Gi(this, s), this.Ge = e + "main", this.k = new hi(
|
|
8193
|
+
this.We = t => Promise.resolve(), !rr.Pt()) throw new Q(j.UNIMPLEMENTED, "This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");
|
|
8194
|
+
this.referenceDelegate = new Gi(this, s), this.Ge = e + "main", this.k = new hi(a),
|
|
8195
8195
|
this.ze = new Ys(this.Ge, 11, new nr(this.k)), this.He = new Mi(this.referenceDelegate, this.k),
|
|
8196
|
-
this.Jt = new
|
|
8196
|
+
this.Jt = new Pi, this.Je = function(t, e) {
|
|
8197
8197
|
return new Yi(t, e);
|
|
8198
8198
|
}
|
|
8199
8199
|
/**
|
|
@@ -8265,11 +8265,11 @@ class rr {
|
|
|
8265
8265
|
* primary state listener if the client either newly obtained or released its
|
|
8266
8266
|
* primary lease.
|
|
8267
8267
|
*/ Ze() {
|
|
8268
|
-
return this.runTransaction("updateClientMetadataAndTryBecomePrimary", "readwrite", (t =>
|
|
8268
|
+
return this.runTransaction("updateClientMetadataAndTryBecomePrimary", "readwrite", (t => ar(t).put(new Ks(this.clientId, Date.now(), this.networkEnabled, this.inForeground)).next((() => {
|
|
8269
8269
|
if (this.isPrimary) return this.rn(t).next((t => {
|
|
8270
8270
|
t || (this.isPrimary = !1, this.Oe.enqueueRetryable((() => this.We(!1))));
|
|
8271
8271
|
}));
|
|
8272
|
-
})).next((() => this.on(t))).next((e => this.isPrimary && !e ? this.
|
|
8272
|
+
})).next((() => this.on(t))).next((e => this.isPrimary && !e ? this.an(t).next((() => !1)) : !!e && this.cn(t).next((() => !0)))))).catch((t => {
|
|
8273
8273
|
if (ti(t))
|
|
8274
8274
|
// Proceed with the existing state. Any subsequent access to
|
|
8275
8275
|
// IndexedDB will verify the lease.
|
|
@@ -8285,7 +8285,7 @@ class rr {
|
|
|
8285
8285
|
return or(t).get(Cs.key).next((t => Hs.resolve(this.un(t))));
|
|
8286
8286
|
}
|
|
8287
8287
|
hn(t) {
|
|
8288
|
-
return
|
|
8288
|
+
return ar(t).delete(this.clientId);
|
|
8289
8289
|
}
|
|
8290
8290
|
/**
|
|
8291
8291
|
* If the garbage collection threshold has passed, prunes the
|
|
@@ -8356,7 +8356,7 @@ class rr {
|
|
|
8356
8356
|
return !1;
|
|
8357
8357
|
}
|
|
8358
8358
|
}
|
|
8359
|
-
return !(!this.networkEnabled || !this.inForeground) ||
|
|
8359
|
+
return !(!this.networkEnabled || !this.inForeground) || ar(t).Bt().next((t => void 0 === this.dn(t, 5e3).find((t => {
|
|
8360
8360
|
if (this.clientId !== t.clientId) {
|
|
8361
8361
|
const e = !this.networkEnabled && t.networkEnabled, n = !this.inForeground && t.inForeground, s = this.networkEnabled === t.networkEnabled;
|
|
8362
8362
|
if (e || n && s) return !0;
|
|
@@ -8375,7 +8375,7 @@ class rr {
|
|
|
8375
8375
|
// has obtained the primary lease.
|
|
8376
8376
|
await this.ze.runTransaction("shutdown", "readwrite", [ Cs.store, Ks.store ], (t => {
|
|
8377
8377
|
const e = new ri(t, nt.I);
|
|
8378
|
-
return this.
|
|
8378
|
+
return this.an(e).next((() => this.hn(e)));
|
|
8379
8379
|
})), this.ze.close(),
|
|
8380
8380
|
// Remove the entry marking the client as zombied from LocalStorage since
|
|
8381
8381
|
// we successfully deleted its metadata from IndexedDb.
|
|
@@ -8394,7 +8394,7 @@ class rr {
|
|
|
8394
8394
|
*
|
|
8395
8395
|
* PORTING NOTE: This is only used for Web multi-tab.
|
|
8396
8396
|
*/ Tn() {
|
|
8397
|
-
return this.runTransaction("getActiveClients", "readonly", (t =>
|
|
8397
|
+
return this.runTransaction("getActiveClients", "readonly", (t => ar(t).Bt().next((t => this.dn(t, 18e5).map((t => t.clientId))))));
|
|
8398
8398
|
}
|
|
8399
8399
|
get started() {
|
|
8400
8400
|
return this.Ue;
|
|
@@ -8425,7 +8425,7 @@ class rr {
|
|
|
8425
8425
|
if (!e) throw O(`Failed to obtain primary lease for action '${t}'.`), this.isPrimary = !1,
|
|
8426
8426
|
this.Oe.enqueueRetryable((() => this.We(!1))), new Q(j.FAILED_PRECONDITION, Gs);
|
|
8427
8427
|
return n(i);
|
|
8428
|
-
})).next((t => this.
|
|
8428
|
+
})).next((t => this.cn(i).next((() => t)))) : this.En(i).next((() => n(i)))))).then((t => (i.raiseOnCommittedEvent(),
|
|
8429
8429
|
t)));
|
|
8430
8430
|
}
|
|
8431
8431
|
/**
|
|
@@ -8442,14 +8442,14 @@ class rr {
|
|
|
8442
8442
|
/**
|
|
8443
8443
|
* Obtains or extends the new primary lease for the local client. This
|
|
8444
8444
|
* method does not verify that the client is eligible for this lease.
|
|
8445
|
-
*/
|
|
8445
|
+
*/ cn(t) {
|
|
8446
8446
|
const e = new Cs(this.clientId, this.allowTabSynchronization, Date.now());
|
|
8447
8447
|
return or(t).put(Cs.key, e);
|
|
8448
8448
|
}
|
|
8449
|
-
static
|
|
8450
|
-
return Ys.
|
|
8449
|
+
static Pt() {
|
|
8450
|
+
return Ys.Pt();
|
|
8451
8451
|
}
|
|
8452
|
-
/** Checks the primary lease and removes it if we are the current primary. */
|
|
8452
|
+
/** Checks the primary lease and removes it if we are the current primary. */ an(t) {
|
|
8453
8453
|
const e = or(t);
|
|
8454
8454
|
return e.get(Cs.key).next((t => this.un(t) ? (F("IndexedDbPersistence", "Releasing primary lease."),
|
|
8455
8455
|
e.delete(Cs.key)) : Hs.resolve()));
|
|
@@ -8540,14 +8540,14 @@ class rr {
|
|
|
8540
8540
|
|
|
8541
8541
|
/**
|
|
8542
8542
|
* Helper to get a typed SimpleDbStore for the client metadata object store.
|
|
8543
|
-
*/ function
|
|
8543
|
+
*/ function ar(t) {
|
|
8544
8544
|
return oi(t, Ks.store);
|
|
8545
8545
|
}
|
|
8546
8546
|
|
|
8547
8547
|
/**
|
|
8548
8548
|
* Generates a string used as a prefix when storing data in IndexedDB and
|
|
8549
8549
|
* LocalStorage.
|
|
8550
|
-
*/ function
|
|
8550
|
+
*/ function cr(t, e) {
|
|
8551
8551
|
// Use two different prefix formats:
|
|
8552
8552
|
// * firestore / persistenceKey / projectID . databaseID / ...
|
|
8553
8553
|
// * firestore / persistenceKey / projectID / ...
|
|
@@ -8610,9 +8610,9 @@ class ur {
|
|
|
8610
8610
|
* @returns Local view of the document or null if we don't have any cached
|
|
8611
8611
|
* state for it.
|
|
8612
8612
|
*/ Rn(t, e) {
|
|
8613
|
-
return this.An.getAllMutationBatchesAffectingDocumentKey(t, e).next((n => this.
|
|
8613
|
+
return this.An.getAllMutationBatchesAffectingDocumentKey(t, e).next((n => this.bn(t, e, n)));
|
|
8614
8614
|
}
|
|
8615
|
-
/** Internal version of `getDocument` that allows reusing batches. */
|
|
8615
|
+
/** Internal version of `getDocument` that allows reusing batches. */ bn(t, e, n) {
|
|
8616
8616
|
return this.Je.getEntry(t, e).next((t => {
|
|
8617
8617
|
for (const e of n) e.applyToLocalView(t);
|
|
8618
8618
|
return t;
|
|
@@ -8620,7 +8620,7 @@ class ur {
|
|
|
8620
8620
|
}
|
|
8621
8621
|
// Returns the view of the given `docs` as they would appear after applying
|
|
8622
8622
|
// all mutations in the given `batches`.
|
|
8623
|
-
|
|
8623
|
+
Pn(t, e) {
|
|
8624
8624
|
t.forEach(((t, n) => {
|
|
8625
8625
|
for (const t of e) t.applyToLocalView(n);
|
|
8626
8626
|
}));
|
|
@@ -8637,7 +8637,7 @@ class ur {
|
|
|
8637
8637
|
* Applies the local view the given `baseDocs` without retrieving documents
|
|
8638
8638
|
* from the local store.
|
|
8639
8639
|
*/ Vn(t, e) {
|
|
8640
|
-
return this.An.getAllMutationBatchesAffectingDocumentKeys(t, e).next((t => this.
|
|
8640
|
+
return this.An.getAllMutationBatchesAffectingDocumentKeys(t, e).next((t => this.Pn(e, t)));
|
|
8641
8641
|
}
|
|
8642
8642
|
/**
|
|
8643
8643
|
* Performs a query against the local view of all documents.
|
|
@@ -8703,7 +8703,7 @@ class ur {
|
|
|
8703
8703
|
}
|
|
8704
8704
|
Nn(t, e, n) {
|
|
8705
8705
|
let s = Cn();
|
|
8706
|
-
for (const t of e) for (const e of t.mutations) e instanceof
|
|
8706
|
+
for (const t of e) for (const e of t.mutations) e instanceof cn && null === n.get(e.key) && (s = s.add(e.key));
|
|
8707
8707
|
let i = n;
|
|
8708
8708
|
return this.Je.getEntries(t, s).next((t => (t.forEach(((t, e) => {
|
|
8709
8709
|
e.isFoundDocument() && (i = i.insert(t, e));
|
|
@@ -8796,7 +8796,7 @@ class ur {
|
|
|
8796
8796
|
return 0 === t.filters.length && null === t.limit && null == t.startAt && null == t.endAt && (0 === t.explicitOrderBy.length || 1 === t.explicitOrderBy.length && t.explicitOrderBy[0].field.isKeyField());
|
|
8797
8797
|
}(e) || n.isEqual(ut.min()) ? this.Mn(t, e) : this.On.vn(t, s).next((i => {
|
|
8798
8798
|
const r = this.Ln(e, i);
|
|
8799
|
-
return (Te(e) || Ee(e)) && this.Bn(e.limitType, r, s, n) ? this.Mn(t, e) : (x() <=
|
|
8799
|
+
return (Te(e) || Ee(e)) && this.Bn(e.limitType, r, s, n) ? this.Mn(t, e) : (x() <= a.DEBUG && F("QueryEngine", "Re-using previous result from %s to execute query: %s", n.toString(), De(e)),
|
|
8800
8800
|
this.On.getDocumentsMatchingQuery(t, e, n).next((t => (
|
|
8801
8801
|
// We merge `previousResults` into `updateResults`, since
|
|
8802
8802
|
// `updateResults` is already a DocumentMap. If a document is
|
|
@@ -8842,7 +8842,7 @@ class ur {
|
|
|
8842
8842
|
return !!i && (i.hasPendingWrites || i.version.compareTo(s) > 0);
|
|
8843
8843
|
}
|
|
8844
8844
|
Mn(t, e) {
|
|
8845
|
-
return x() <=
|
|
8845
|
+
return x() <= a.DEBUG && F("QueryEngine", "Using full collection scan to execute query:", De(e)),
|
|
8846
8846
|
this.On.getDocumentsMatchingQuery(t, e, ut.min());
|
|
8847
8847
|
}
|
|
8848
8848
|
}
|
|
@@ -9022,16 +9022,16 @@ function gr(t) {
|
|
|
9022
9022
|
i = n.qn;
|
|
9023
9023
|
const o = [];
|
|
9024
9024
|
e.targetChanges.forEach(((e, r) => {
|
|
9025
|
-
const
|
|
9026
|
-
if (!
|
|
9025
|
+
const a = i.get(r);
|
|
9026
|
+
if (!a) return;
|
|
9027
9027
|
// Only update the remote keys if the target is still active. This
|
|
9028
9028
|
// ensures that we can persist the updated target data along with
|
|
9029
9029
|
// the updated assignment.
|
|
9030
9030
|
o.push(n.He.removeMatchingKeys(t, e.removedDocuments, r).next((() => n.He.addMatchingKeys(t, e.addedDocuments, r))));
|
|
9031
|
-
const
|
|
9031
|
+
const c = e.resumeToken;
|
|
9032
9032
|
// Update the resume token if the change includes one.
|
|
9033
|
-
if (
|
|
9034
|
-
const u =
|
|
9033
|
+
if (c.approximateByteSize() > 0) {
|
|
9034
|
+
const u = a.withResumeToken(c, s).withSequenceNumber(t.currentSequenceNumber);
|
|
9035
9035
|
i = i.insert(r, u),
|
|
9036
9036
|
// Update the target data if there are target changes (or if
|
|
9037
9037
|
// sufficient time has passed since the last update).
|
|
@@ -9064,10 +9064,10 @@ function gr(t) {
|
|
|
9064
9064
|
}
|
|
9065
9065
|
/**
|
|
9066
9066
|
* Notifies local store of the changed views to locally pin documents.
|
|
9067
|
-
*/ (
|
|
9067
|
+
*/ (a, u, e) && o.push(n.He.updateTargetData(t, u));
|
|
9068
9068
|
}
|
|
9069
9069
|
}));
|
|
9070
|
-
let
|
|
9070
|
+
let a = bn();
|
|
9071
9071
|
// HACK: The only reason we allow a null snapshot version is so that we
|
|
9072
9072
|
// can synthesize remote events when we get permission denied errors while
|
|
9073
9073
|
// trying to resolve the state of a locally cached document that is in
|
|
@@ -9078,12 +9078,12 @@ function gr(t) {
|
|
|
9078
9078
|
// Each loop iteration only affects its "own" doc, so it's safe to get all the remote
|
|
9079
9079
|
// documents in advance in a single call.
|
|
9080
9080
|
o.push(pr(t, r, e.documentUpdates, s, void 0).next((t => {
|
|
9081
|
-
|
|
9081
|
+
a = t;
|
|
9082
9082
|
}))), !s.isEqual(ut.min())) {
|
|
9083
9083
|
const e = n.He.getLastRemoteSnapshotVersion(t).next((e => n.He.setTargetsMetadata(t, t.currentSequenceNumber, s)));
|
|
9084
9084
|
o.push(e);
|
|
9085
9085
|
}
|
|
9086
|
-
return Hs.waitFor(o).next((() => r.apply(t))).next((() => n.Wn.Vn(t,
|
|
9086
|
+
return Hs.waitFor(o).next((() => r.apply(t))).next((() => n.Wn.Vn(t, a))).next((() => a));
|
|
9087
9087
|
})).then((t => (n.qn = i, t)));
|
|
9088
9088
|
}
|
|
9089
9089
|
|
|
@@ -9108,9 +9108,9 @@ function gr(t) {
|
|
|
9108
9108
|
i) {
|
|
9109
9109
|
let r = Cn();
|
|
9110
9110
|
return n.forEach((t => r = r.add(t))), e.getEntries(t, r).next((t => {
|
|
9111
|
-
let r =
|
|
9111
|
+
let r = bn();
|
|
9112
9112
|
return n.forEach(((n, o) => {
|
|
9113
|
-
const
|
|
9113
|
+
const a = t.get(n), c = (null == i ? void 0 : i.get(n)) || s;
|
|
9114
9114
|
// Note: The order of the steps below is important, since we want
|
|
9115
9115
|
// to ensure that rejected limbo resolutions (which fabricate
|
|
9116
9116
|
// NoDocuments with SnapshotVersion.min()) never add documents to
|
|
@@ -9119,8 +9119,8 @@ i) {
|
|
|
9119
9119
|
// NoDocuments with SnapshotVersion.min() are used in manufactured
|
|
9120
9120
|
// events. We remove these documents from cache since we lost
|
|
9121
9121
|
// access.
|
|
9122
|
-
e.removeEntry(n,
|
|
9123
|
-
r = r.insert(n, o)) : F("LocalStore", "Ignoring outdated watch update for ", n, ". Current version:",
|
|
9122
|
+
e.removeEntry(n, c), r = r.insert(n, o)) : !a.isValidDocument() || o.version.compareTo(a.version) > 0 || 0 === o.version.compareTo(a.version) && a.hasPendingWrites ? (e.addEntry(o, c),
|
|
9123
|
+
r = r.insert(n, o)) : F("LocalStore", "Ignoring outdated watch update for ", n, ". Current version:", a.version, " Watch version:", o.version);
|
|
9124
9124
|
})), r;
|
|
9125
9125
|
}));
|
|
9126
9126
|
}
|
|
@@ -9210,7 +9210,7 @@ async function Ir(t, e, n) {
|
|
|
9210
9210
|
return s.persistence.runTransaction("Execute query", "readonly", (t => function(t, e, n) {
|
|
9211
9211
|
const s = K(t), i = s.Kn.get(n);
|
|
9212
9212
|
return void 0 !== i ? Hs.resolve(s.qn.get(i)) : s.He.getTargetData(e, n);
|
|
9213
|
-
}(s, t,
|
|
9213
|
+
}(s, t, Pe(e)).next((e => {
|
|
9214
9214
|
if (e) return i = e.lastLimboFreeSnapshotVersion, s.He.getMatchingKeysForTargetId(t, e.targetId).next((t => {
|
|
9215
9215
|
r = t;
|
|
9216
9216
|
}));
|
|
@@ -9233,15 +9233,15 @@ function Rr(t, e) {
|
|
|
9233
9233
|
* since the prior call.
|
|
9234
9234
|
*/
|
|
9235
9235
|
// PORTING NOTE: Multi-Tab only.
|
|
9236
|
-
function
|
|
9236
|
+
function br(t) {
|
|
9237
9237
|
const e = K(t);
|
|
9238
9238
|
return e.persistence.runTransaction("Get new document changes", "readonly", (t => function(t, e, n) {
|
|
9239
9239
|
const s = K(t);
|
|
9240
|
-
let i =
|
|
9241
|
-
const o = tr(e),
|
|
9240
|
+
let i = bn(), r = di(n);
|
|
9241
|
+
const o = tr(e), a = IDBKeyRange.lowerBound(r, !0);
|
|
9242
9242
|
return o.jt({
|
|
9243
9243
|
index: Os.readTimeIndex,
|
|
9244
|
-
range:
|
|
9244
|
+
range: a
|
|
9245
9245
|
}, ((t, e) => {
|
|
9246
9246
|
// Unlike `getEntry()` and others, `getNewDocumentChanges()` parses
|
|
9247
9247
|
// the documents directly since we want to keep sentinel deletes.
|
|
@@ -9266,7 +9266,7 @@ function Pr(t) {
|
|
|
9266
9266
|
* only return changes that happened after client initialization.
|
|
9267
9267
|
*/
|
|
9268
9268
|
// PORTING NOTE: Multi-Tab only.
|
|
9269
|
-
async function
|
|
9269
|
+
async function Pr(t) {
|
|
9270
9270
|
const e = K(t);
|
|
9271
9271
|
return e.persistence.runTransaction("Synchronize last document change read time", "readonly", (t => function(t) {
|
|
9272
9272
|
const e = tr(t);
|
|
@@ -9298,21 +9298,21 @@ async function br(t) {
|
|
|
9298
9298
|
*/
|
|
9299
9299
|
async function vr(t, e, n, s) {
|
|
9300
9300
|
const i = K(t);
|
|
9301
|
-
let r = Cn(), o =
|
|
9301
|
+
let r = Cn(), o = bn(), a = Sn();
|
|
9302
9302
|
for (const t of n) {
|
|
9303
9303
|
const n = e.Hn(t.metadata.name);
|
|
9304
|
-
t.document && (r = r.add(n)), o = o.insert(n, e.Jn(t)),
|
|
9304
|
+
t.document && (r = r.add(n)), o = o.insert(n, e.Jn(t)), a = a.insert(n, e.Yn(t.metadata.readTime));
|
|
9305
9305
|
}
|
|
9306
|
-
const
|
|
9306
|
+
const c = i.Qn.newChangeBuffer({
|
|
9307
9307
|
trackRemovals: !0
|
|
9308
9308
|
}), u = await Er(i, function(t) {
|
|
9309
9309
|
// It is OK that the path used for the query is not valid, because this will
|
|
9310
9310
|
// not be read and queried.
|
|
9311
|
-
return
|
|
9311
|
+
return Pe(pe(wt.fromString(`__bundle__/docs/${t}`)));
|
|
9312
9312
|
}(s));
|
|
9313
9313
|
// Allocates a target to hold all document keys from the bundle, such that
|
|
9314
9314
|
// they will not get garbage collected right away.
|
|
9315
|
-
return i.persistence.runTransaction("Apply bundle documents", "readwrite", (t => pr(t,
|
|
9315
|
+
return i.persistence.runTransaction("Apply bundle documents", "readwrite", (t => pr(t, c, o, ut.min(), a).next((e => (c.apply(t),
|
|
9316
9316
|
e))).next((e => i.He.removeMatchingKeysForTargetId(t, u.targetId).next((() => i.He.addMatchingKeys(t, r, u.targetId))).next((() => i.Wn.Vn(t, e))).next((() => e))))));
|
|
9317
9317
|
}
|
|
9318
9318
|
|
|
@@ -9329,7 +9329,7 @@ async function Vr(t, e, n = Cn()) {
|
|
|
9329
9329
|
// NOTE: this also means if no corresponding target exists, the new target
|
|
9330
9330
|
// will remain active and will not get collected, unless users happen to
|
|
9331
9331
|
// unlisten the query somehow.
|
|
9332
|
-
const s = await Er(t,
|
|
9332
|
+
const s = await Er(t, Pe(Ti(e.bundledQuery))), i = K(t);
|
|
9333
9333
|
return i.persistence.runTransaction("Save named query", "readwrite", (t => {
|
|
9334
9334
|
const r = Hn(e.readTime);
|
|
9335
9335
|
// Simply save the query itself if it is older than what the SDK already
|
|
@@ -9516,7 +9516,7 @@ class Cr {
|
|
|
9516
9516
|
addMutationBatch(t, e, n, s) {
|
|
9517
9517
|
const i = this.ds;
|
|
9518
9518
|
this.ds++, this.An.length > 0 && this.An[this.An.length - 1];
|
|
9519
|
-
const r = new
|
|
9519
|
+
const r = new ai(i, e, n, s);
|
|
9520
9520
|
this.An.push(r);
|
|
9521
9521
|
// Track references by document key and index collection parents.
|
|
9522
9522
|
for (const e of s) this.ws = this.ws.add(new Cr(e.key, i)), this.Jt.addToCollectionParentIndex(t, e.key.path.popLast());
|
|
@@ -9686,7 +9686,7 @@ class kr {
|
|
|
9686
9686
|
*/ addEntry(t, e, n) {
|
|
9687
9687
|
const s = e.key, i = this.docs.get(s), r = i ? i.size : 0, o = this.Ts(e);
|
|
9688
9688
|
return this.docs = this.docs.insert(s, {
|
|
9689
|
-
document: e.
|
|
9689
|
+
document: e.mutableCopy(),
|
|
9690
9690
|
size: o,
|
|
9691
9691
|
readTime: n
|
|
9692
9692
|
}), this.size += o - r, this.Jt.addToCollectionParentIndex(t, s.path.popLast());
|
|
@@ -9702,24 +9702,24 @@ class kr {
|
|
|
9702
9702
|
}
|
|
9703
9703
|
getEntry(t, e) {
|
|
9704
9704
|
const n = this.docs.get(e);
|
|
9705
|
-
return Hs.resolve(n ? n.document.
|
|
9705
|
+
return Hs.resolve(n ? n.document.mutableCopy() : zt.newInvalidDocument(e));
|
|
9706
9706
|
}
|
|
9707
9707
|
getEntries(t, e) {
|
|
9708
|
-
let n =
|
|
9708
|
+
let n = bn();
|
|
9709
9709
|
return e.forEach((t => {
|
|
9710
9710
|
const e = this.docs.get(t);
|
|
9711
|
-
n = n.insert(t, e ? e.document.
|
|
9711
|
+
n = n.insert(t, e ? e.document.mutableCopy() : zt.newInvalidDocument(t));
|
|
9712
9712
|
})), Hs.resolve(n);
|
|
9713
9713
|
}
|
|
9714
9714
|
getDocumentsMatchingQuery(t, e, n) {
|
|
9715
|
-
let s =
|
|
9715
|
+
let s = bn();
|
|
9716
9716
|
// Documents are ordered by key, so we can use a prefix scan to narrow down
|
|
9717
9717
|
// the documents we need to match the query against.
|
|
9718
9718
|
const i = new Ct(e.path.child("")), r = this.docs.getIteratorFrom(i);
|
|
9719
9719
|
for (;r.hasNext(); ) {
|
|
9720
9720
|
const {key: t, value: {document: i, readTime: o}} = r.getNext();
|
|
9721
9721
|
if (!e.path.isPrefixOf(t.path)) break;
|
|
9722
|
-
o.compareTo(n) <= 0 || Ce(e, i) && (s = s.insert(i.key, i.
|
|
9722
|
+
o.compareTo(n) <= 0 || Ce(e, i) && (s = s.insert(i.key, i.mutableCopy()));
|
|
9723
9723
|
}
|
|
9724
9724
|
return Hs.resolve(s);
|
|
9725
9725
|
}
|
|
@@ -9797,7 +9797,7 @@ class xr extends Ji {
|
|
|
9797
9797
|
* A ordered bidirectional mapping between documents and the remote target
|
|
9798
9798
|
* IDs.
|
|
9799
9799
|
*/
|
|
9800
|
-
this.Rs = new Dr, this.targetCount = 0, this.
|
|
9800
|
+
this.Rs = new Dr, this.targetCount = 0, this.bs = Oi.ie();
|
|
9801
9801
|
}
|
|
9802
9802
|
forEachTarget(t, e) {
|
|
9803
9803
|
return this.Is.forEach(((t, n) => e(n))), Hs.resolve();
|
|
@@ -9809,22 +9809,22 @@ class xr extends Ji {
|
|
|
9809
9809
|
return Hs.resolve(this.As);
|
|
9810
9810
|
}
|
|
9811
9811
|
allocateTargetId(t) {
|
|
9812
|
-
return this.highestTargetId = this.
|
|
9812
|
+
return this.highestTargetId = this.bs.next(), Hs.resolve(this.highestTargetId);
|
|
9813
9813
|
}
|
|
9814
9814
|
setTargetsMetadata(t, e, n) {
|
|
9815
9815
|
return n && (this.lastRemoteSnapshotVersion = n), e > this.As && (this.As = e),
|
|
9816
9816
|
Hs.resolve();
|
|
9817
9817
|
}
|
|
9818
|
-
|
|
9818
|
+
ce(t) {
|
|
9819
9819
|
this.Is.set(t.target, t);
|
|
9820
9820
|
const e = t.targetId;
|
|
9821
|
-
e > this.highestTargetId && (this.
|
|
9821
|
+
e > this.highestTargetId && (this.bs = new Oi(e), this.highestTargetId = e), t.sequenceNumber > this.As && (this.As = t.sequenceNumber);
|
|
9822
9822
|
}
|
|
9823
9823
|
addTargetData(t, e) {
|
|
9824
|
-
return this.
|
|
9824
|
+
return this.ce(e), this.targetCount += 1, Hs.resolve();
|
|
9825
9825
|
}
|
|
9826
9826
|
updateTargetData(t, e) {
|
|
9827
|
-
return this.
|
|
9827
|
+
return this.ce(e), Hs.resolve();
|
|
9828
9828
|
}
|
|
9829
9829
|
removeTargetData(t, e) {
|
|
9830
9830
|
return this.Is.delete(e.target), this.Rs.us(e.targetId), this.targetCount -= 1,
|
|
@@ -9895,7 +9895,7 @@ class Fr {
|
|
|
9895
9895
|
* checked or asserted on every access.
|
|
9896
9896
|
*/
|
|
9897
9897
|
constructor(t, e) {
|
|
9898
|
-
this.
|
|
9898
|
+
this.Ps = {}, this.Be = new nt(0), this.Ue = !1, this.Ue = !0, this.referenceDelegate = t(this),
|
|
9899
9899
|
this.He = new $r(this);
|
|
9900
9900
|
this.Jt = new Ri, this.Je = function(t, e) {
|
|
9901
9901
|
return new kr(t, e);
|
|
@@ -9921,8 +9921,8 @@ class Fr {
|
|
|
9921
9921
|
return this.Jt;
|
|
9922
9922
|
}
|
|
9923
9923
|
getMutationQueue(t) {
|
|
9924
|
-
let e = this.
|
|
9925
|
-
return e || (e = new Nr(this.Jt, this.referenceDelegate), this.
|
|
9924
|
+
let e = this.Ps[t.toKey()];
|
|
9925
|
+
return e || (e = new Nr(this.Jt, this.referenceDelegate), this.Ps[t.toKey()] = e),
|
|
9926
9926
|
e;
|
|
9927
9927
|
}
|
|
9928
9928
|
getTargetCache() {
|
|
@@ -9941,7 +9941,7 @@ class Fr {
|
|
|
9941
9941
|
t)));
|
|
9942
9942
|
}
|
|
9943
9943
|
Ds(t, e) {
|
|
9944
|
-
return Hs.or(Object.values(this.
|
|
9944
|
+
return Hs.or(Object.values(this.Ps).map((n => () => n.containsKey(t, e))));
|
|
9945
9945
|
}
|
|
9946
9946
|
}
|
|
9947
9947
|
|
|
@@ -10254,7 +10254,7 @@ class Wr {
|
|
|
10254
10254
|
// mutations but before we observe WebStorage events.
|
|
10255
10255
|
this.window.addEventListener("storage", this.Us);
|
|
10256
10256
|
}
|
|
10257
|
-
/** Returns 'true' if WebStorage is available in the current environment. */ static
|
|
10257
|
+
/** Returns 'true' if WebStorage is available in the current environment. */ static Pt(t) {
|
|
10258
10258
|
return !(!t || !t.localStorage);
|
|
10259
10259
|
}
|
|
10260
10260
|
async start() {
|
|
@@ -10341,7 +10341,7 @@ class Wr {
|
|
|
10341
10341
|
this.oi(t);
|
|
10342
10342
|
}
|
|
10343
10343
|
notifyBundleLoaded() {
|
|
10344
|
-
this.
|
|
10344
|
+
this.ai();
|
|
10345
10345
|
}
|
|
10346
10346
|
shutdown() {
|
|
10347
10347
|
this.started && (this.window.removeEventListener("storage", this.Us), this.removeItem(this.Qs),
|
|
@@ -10367,7 +10367,7 @@ class Wr {
|
|
|
10367
10367
|
if (this.started) {
|
|
10368
10368
|
if (null !== e.key) if (this.Gs.test(e.key)) {
|
|
10369
10369
|
if (null == e.newValue) {
|
|
10370
|
-
const t = this.
|
|
10370
|
+
const t = this.ci(e.key);
|
|
10371
10371
|
return this.ui(t, null);
|
|
10372
10372
|
}
|
|
10373
10373
|
{
|
|
@@ -10436,13 +10436,13 @@ class Wr {
|
|
|
10436
10436
|
const s = Ur(this.persistenceKey, t), i = new Kr(t, e, n);
|
|
10437
10437
|
this.setItem(s, i.Os());
|
|
10438
10438
|
}
|
|
10439
|
-
|
|
10439
|
+
ai() {
|
|
10440
10440
|
this.setItem(this.Ys, "value-not-used");
|
|
10441
10441
|
}
|
|
10442
10442
|
/**
|
|
10443
10443
|
* Parses a client state key in WebStorage. Returns null if the key does not
|
|
10444
10444
|
* match the expected key format.
|
|
10445
|
-
*/
|
|
10445
|
+
*/ ci(t) {
|
|
10446
10446
|
const e = this.Gs.exec(t);
|
|
10447
10447
|
return e ? e[1] : null;
|
|
10448
10448
|
}
|
|
@@ -10450,7 +10450,7 @@ class Wr {
|
|
|
10450
10450
|
* Parses a client state in WebStorage. Returns 'null' if the value could not
|
|
10451
10451
|
* be parsed.
|
|
10452
10452
|
*/ hi(t, e) {
|
|
10453
|
-
const n = this.
|
|
10453
|
+
const n = this.ci(t);
|
|
10454
10454
|
return jr.Fs(n, e);
|
|
10455
10455
|
}
|
|
10456
10456
|
/**
|
|
@@ -10600,10 +10600,10 @@ class zr {
|
|
|
10600
10600
|
*/
|
|
10601
10601
|
class Jr {
|
|
10602
10602
|
constructor() {
|
|
10603
|
-
this.Ii = () => this.Ai(), this.Ri = () => this.
|
|
10603
|
+
this.Ii = () => this.Ai(), this.Ri = () => this.bi(), this.Pi = [], this.vi();
|
|
10604
10604
|
}
|
|
10605
10605
|
Ei(t) {
|
|
10606
|
-
this.
|
|
10606
|
+
this.Pi.push(t);
|
|
10607
10607
|
}
|
|
10608
10608
|
shutdown() {
|
|
10609
10609
|
window.removeEventListener("online", this.Ii), window.removeEventListener("offline", this.Ri);
|
|
@@ -10613,16 +10613,16 @@ class Jr {
|
|
|
10613
10613
|
}
|
|
10614
10614
|
Ai() {
|
|
10615
10615
|
F("ConnectivityMonitor", "Network connectivity changed: AVAILABLE");
|
|
10616
|
-
for (const t of this.
|
|
10616
|
+
for (const t of this.Pi) t(0 /* AVAILABLE */);
|
|
10617
10617
|
}
|
|
10618
|
-
|
|
10618
|
+
bi() {
|
|
10619
10619
|
F("ConnectivityMonitor", "Network connectivity changed: UNAVAILABLE");
|
|
10620
|
-
for (const t of this.
|
|
10620
|
+
for (const t of this.Pi) t(1 /* UNAVAILABLE */);
|
|
10621
10621
|
}
|
|
10622
10622
|
// TODO(chenbrian): Consider passing in window either into this component or
|
|
10623
10623
|
// here for testing via FakeWindow.
|
|
10624
10624
|
/** Checks that all used attributes of window are available. */
|
|
10625
|
-
static
|
|
10625
|
+
static Pt() {
|
|
10626
10626
|
return "undefined" != typeof window && void 0 !== window.addEventListener && void 0 !== window.removeEventListener;
|
|
10627
10627
|
}
|
|
10628
10628
|
}
|
|
@@ -10806,12 +10806,12 @@ class {
|
|
|
10806
10806
|
F("Connection", 'RPC "' + t + '" completed.');
|
|
10807
10807
|
}
|
|
10808
10808
|
}));
|
|
10809
|
-
const
|
|
10810
|
-
o.send(e, "POST",
|
|
10809
|
+
const a = JSON.stringify(s);
|
|
10810
|
+
o.send(e, "POST", a, n, 15);
|
|
10811
10811
|
}));
|
|
10812
10812
|
}
|
|
10813
10813
|
Qi(t, e, n) {
|
|
10814
|
-
const s = [ this.Mi, "/", "google.firestore.v1.Firestore", "/", t, "/channel" ], i = R(), r =
|
|
10814
|
+
const s = [ this.Mi, "/", "google.firestore.v1.Firestore", "/", t, "/channel" ], i = R(), r = b(), o = {
|
|
10815
10815
|
// Required for backend stickiness, routing behavior is based on this
|
|
10816
10816
|
// parameter.
|
|
10817
10817
|
httpSessionIdParam: "gsessionid",
|
|
@@ -10835,7 +10835,7 @@ class {
|
|
|
10835
10835
|
forceLongPolling: this.forceLongPolling,
|
|
10836
10836
|
detectBufferingProxy: this.autoDetectLongPolling
|
|
10837
10837
|
};
|
|
10838
|
-
this.useFetchStreams && (o.xmlHttpFactory = new
|
|
10838
|
+
this.useFetchStreams && (o.xmlHttpFactory = new P({})), this.qi(o.initMessageHeaders, e, n),
|
|
10839
10839
|
// Sending the custom headers we just added to request.initMessageHeaders
|
|
10840
10840
|
// (Authorization, etc.) will trigger the browser to make a CORS preflight
|
|
10841
10841
|
// request because the XHR will no longer meet the criteria for a "simple"
|
|
@@ -10852,9 +10852,9 @@ class {
|
|
|
10852
10852
|
// known to (sometimes) not include an Origin. See
|
|
10853
10853
|
// https://github.com/firebase/firebase-js-sdk/issues/1491.
|
|
10854
10854
|
f() || d() || w() || _() || m() || g() || (o.httpHeadersOverwriteParam = "$httpHeaders");
|
|
10855
|
-
const
|
|
10856
|
-
F("Connection", "Creating WebChannel: " +
|
|
10857
|
-
const
|
|
10855
|
+
const a = s.join("");
|
|
10856
|
+
F("Connection", "Creating WebChannel: " + a, o);
|
|
10857
|
+
const c = i.createWebChannel(a, o);
|
|
10858
10858
|
// WebChannel supports sending the first message with the handshake - saving
|
|
10859
10859
|
// a network round trip. However, it will have to call send in the same
|
|
10860
10860
|
// JS event loop as open. In order to enforce this, we delay actually
|
|
@@ -10867,9 +10867,9 @@ class {
|
|
|
10867
10867
|
const l = new Xr({
|
|
10868
10868
|
Vi: t => {
|
|
10869
10869
|
h ? F("Connection", "Not sending because WebChannel is closed:", t) : (u || (F("Connection", "Opening WebChannel transport."),
|
|
10870
|
-
|
|
10870
|
+
c.open(), u = !0), F("Connection", "WebChannel sending:", t), c.send(t));
|
|
10871
10871
|
},
|
|
10872
|
-
Si: () =>
|
|
10872
|
+
Si: () => c.close()
|
|
10873
10873
|
}), y = (t, e, n) => {
|
|
10874
10874
|
// TODO(dimond): closure typing seems broken because WebChannel does
|
|
10875
10875
|
// not implement goog.events.Listenable
|
|
@@ -10887,13 +10887,13 @@ class {
|
|
|
10887
10887
|
// exception and rethrow using a setTimeout so they become visible again.
|
|
10888
10888
|
// Note that eventually this function could go away if we are confident
|
|
10889
10889
|
// enough the code is exception free.
|
|
10890
|
-
return y(
|
|
10890
|
+
return y(c, v.EventType.OPEN, (() => {
|
|
10891
10891
|
h || F("Connection", "WebChannel transport opened.");
|
|
10892
|
-
})), y(
|
|
10892
|
+
})), y(c, v.EventType.CLOSE, (() => {
|
|
10893
10893
|
h || (h = !0, F("Connection", "WebChannel transport closed"), l.Fi());
|
|
10894
|
-
})), y(
|
|
10894
|
+
})), y(c, v.EventType.ERROR, (t => {
|
|
10895
10895
|
h || (h = !0, M("Connection", "WebChannel transport errored:", t), l.Fi(new Q(j.UNAVAILABLE, "The operation could not be completed")));
|
|
10896
|
-
})), y(
|
|
10896
|
+
})), y(c, v.EventType.MESSAGE, (t => {
|
|
10897
10897
|
var e;
|
|
10898
10898
|
if (!h) {
|
|
10899
10899
|
const n = t.data[0];
|
|
@@ -10923,7 +10923,7 @@ class {
|
|
|
10923
10923
|
}(t), n = i.message;
|
|
10924
10924
|
void 0 === e && (e = j.INTERNAL, n = "Unknown error status: " + t + " with message " + i.message),
|
|
10925
10925
|
// Mark closed so no further events are propagated
|
|
10926
|
-
h = !0, l.Fi(new Q(e, n)),
|
|
10926
|
+
h = !0, l.Fi(new Q(e, n)), c.close();
|
|
10927
10927
|
} else F("Connection", "WebChannel received:", n), l.Oi(n);
|
|
10928
10928
|
}
|
|
10929
10929
|
})), y(r, V.STAT_EVENT, (t => {
|
|
@@ -11138,15 +11138,15 @@ class so {
|
|
|
11138
11138
|
* ListenerType: The type of the listener that will be used for callbacks
|
|
11139
11139
|
*/
|
|
11140
11140
|
class io {
|
|
11141
|
-
constructor(t, e, n, s, i, r, o,
|
|
11141
|
+
constructor(t, e, n, s, i, r, o, a) {
|
|
11142
11142
|
this.Oe = t, this.nr = n, this.sr = s, this.ir = i, this.authCredentialsProvider = r,
|
|
11143
|
-
this.appCheckCredentialsProvider = o, this.listener =
|
|
11143
|
+
this.appCheckCredentialsProvider = o, this.listener = a, this.state = 0 /* Initial */ ,
|
|
11144
11144
|
/**
|
|
11145
11145
|
* A close count that's incremented every time the stream is closed; used by
|
|
11146
11146
|
* getCloseGuardedDispatcher() to invalidate callbacks that happen after
|
|
11147
11147
|
* close.
|
|
11148
11148
|
*/
|
|
11149
|
-
this.rr = 0, this.
|
|
11149
|
+
this.rr = 0, this.ar = null, this.cr = null, this.stream = null, this.ur = new so(t, e);
|
|
11150
11150
|
}
|
|
11151
11151
|
/**
|
|
11152
11152
|
* Returns true if start() has been called and no error has occurred. True
|
|
@@ -11202,7 +11202,7 @@ class io {
|
|
|
11202
11202
|
*/ _r() {
|
|
11203
11203
|
// Starts the idle time if we are in state 'Open' and are not yet already
|
|
11204
11204
|
// running a timer (in which case the previous idle timeout still applies).
|
|
11205
|
-
this.lr() && null === this.
|
|
11205
|
+
this.lr() && null === this.ar && (this.ar = this.Oe.enqueueAfterDelay(this.nr, 6e4, (() => this.mr())));
|
|
11206
11206
|
}
|
|
11207
11207
|
/** Sends a message to the underlying stream. */ gr(t) {
|
|
11208
11208
|
this.yr(), this.stream.send(t);
|
|
@@ -11214,10 +11214,10 @@ class io {
|
|
|
11214
11214
|
return this.close(0 /* Initial */);
|
|
11215
11215
|
}
|
|
11216
11216
|
/** Marks the stream as active again. */ yr() {
|
|
11217
|
-
this.
|
|
11217
|
+
this.ar && (this.ar.cancel(), this.ar = null);
|
|
11218
11218
|
}
|
|
11219
11219
|
/** Cancels the health check delayed operation. */ pr() {
|
|
11220
|
-
this.
|
|
11220
|
+
this.cr && (this.cr.cancel(), this.cr = null);
|
|
11221
11221
|
}
|
|
11222
11222
|
/**
|
|
11223
11223
|
* Closes the stream and cleans up as necessary:
|
|
@@ -11285,7 +11285,7 @@ class io {
|
|
|
11285
11285
|
Ir(t, e) {
|
|
11286
11286
|
const n = this.Er(this.rr);
|
|
11287
11287
|
this.stream = this.Rr(t, e), this.stream.Di((() => {
|
|
11288
|
-
n((() => (this.state = 2 /* Open */ , this.
|
|
11288
|
+
n((() => (this.state = 2 /* Open */ , this.cr = this.Oe.enqueueAfterDelay(this.sr, 1e4, (() => (this.lr() && (this.state = 3 /* Healthy */),
|
|
11289
11289
|
Promise.resolve()))), this.listener.Di())));
|
|
11290
11290
|
})), this.stream.Ni((t => {
|
|
11291
11291
|
n((() => this.Ar(t)));
|
|
@@ -11336,7 +11336,7 @@ class io {
|
|
|
11336
11336
|
onMessage(t) {
|
|
11337
11337
|
// A successful response means the stream is healthy
|
|
11338
11338
|
this.ur.reset();
|
|
11339
|
-
const e =
|
|
11339
|
+
const e = as(this.k, t), n = function(t) {
|
|
11340
11340
|
// We have only reached a consistent snapshot for the entire stream if there
|
|
11341
11341
|
// is a read_time set and it applies to all targets (i.e. the list of
|
|
11342
11342
|
// targets is empty). The backend is guaranteed to send such responses.
|
|
@@ -11344,14 +11344,14 @@ class io {
|
|
|
11344
11344
|
const e = t.targetChange;
|
|
11345
11345
|
return e.targetIds && e.targetIds.length ? ut.min() : e.readTime ? Hn(e.readTime) : ut.min();
|
|
11346
11346
|
}(t);
|
|
11347
|
-
return this.listener.
|
|
11347
|
+
return this.listener.br(e, n);
|
|
11348
11348
|
}
|
|
11349
11349
|
/**
|
|
11350
11350
|
* Registers interest in the results of the given target. If the target
|
|
11351
11351
|
* includes a resumeToken it will be included in the request. Results that
|
|
11352
11352
|
* affect the target will be streamed back as WatchChange messages that
|
|
11353
11353
|
* reference the targetId.
|
|
11354
|
-
*/
|
|
11354
|
+
*/ Pr(t) {
|
|
11355
11355
|
const e = {};
|
|
11356
11356
|
e.database = ns(this.k), e.addTarget = function(t, e) {
|
|
11357
11357
|
let n;
|
|
@@ -11442,7 +11442,7 @@ class io {
|
|
|
11442
11442
|
/** Sends a group of mutations to the Firestore backend to apply. */ Dr(t) {
|
|
11443
11443
|
const e = {
|
|
11444
11444
|
streamToken: this.lastStreamToken,
|
|
11445
|
-
writes: t.map((t =>
|
|
11445
|
+
writes: t.map((t => cs(this.k, t)))
|
|
11446
11446
|
};
|
|
11447
11447
|
this.gr(e);
|
|
11448
11448
|
}
|
|
@@ -11473,7 +11473,7 @@ class io {
|
|
|
11473
11473
|
* An implementation of Datastore that exposes additional state for internal
|
|
11474
11474
|
* consumption.
|
|
11475
11475
|
*/
|
|
11476
|
-
class
|
|
11476
|
+
class ao extends class {} {
|
|
11477
11477
|
constructor(t, e, n, s) {
|
|
11478
11478
|
super(), this.authCredentials = t, this.appCheckCredentials = e, this.ir = n, this.k = s,
|
|
11479
11479
|
this.$r = !1;
|
|
@@ -11511,7 +11511,7 @@ class co extends class {} {
|
|
|
11511
11511
|
* then we set the OnlineState to Offline, and the client will behave as if
|
|
11512
11512
|
* it is offline (get()s will return cached data, etc.).
|
|
11513
11513
|
*/
|
|
11514
|
-
class
|
|
11514
|
+
class co {
|
|
11515
11515
|
constructor(t, e) {
|
|
11516
11516
|
this.asyncQueue = t, this.onlineStateHandler = e,
|
|
11517
11517
|
/** The current OnlineState. */
|
|
@@ -11656,7 +11656,7 @@ class ao {
|
|
|
11656
11656
|
e.Gr.delete(4 /* ConnectivityChange */), await ho(e);
|
|
11657
11657
|
}(this));
|
|
11658
11658
|
}));
|
|
11659
|
-
})), this.Jr = new
|
|
11659
|
+
})), this.Jr = new co(n, s);
|
|
11660
11660
|
}
|
|
11661
11661
|
}
|
|
11662
11662
|
|
|
@@ -11700,7 +11700,7 @@ function fo(t, e) {
|
|
|
11700
11700
|
* We need to increment the the expected number of pending responses we're due
|
|
11701
11701
|
* from watch so we wait for the ack to process any messages from this target.
|
|
11702
11702
|
*/ function _o(t, e) {
|
|
11703
|
-
t.Yr.X(e.targetId), Fo(t).
|
|
11703
|
+
t.Yr.X(e.targetId), Fo(t).Pr(e);
|
|
11704
11704
|
}
|
|
11705
11705
|
|
|
11706
11706
|
/**
|
|
@@ -11851,11 +11851,11 @@ async function Ao(t, e, n) {
|
|
|
11851
11851
|
/**
|
|
11852
11852
|
* Executes `op`. If `op` fails, takes the network offline until `op`
|
|
11853
11853
|
* succeeds. Returns after the first attempt.
|
|
11854
|
-
*/ function
|
|
11854
|
+
*/ function bo(t, e) {
|
|
11855
11855
|
return e().catch((n => Ro(t, n, e)));
|
|
11856
11856
|
}
|
|
11857
11857
|
|
|
11858
|
-
async function
|
|
11858
|
+
async function Po(t) {
|
|
11859
11859
|
const e = K(t), n = Oo(e);
|
|
11860
11860
|
let s = e.Qr.length > 0 ? e.Qr[e.Qr.length - 1].batchId : -1;
|
|
11861
11861
|
for (;vo(e); ) try {
|
|
@@ -11906,11 +11906,11 @@ async function No(t) {
|
|
|
11906
11906
|
}
|
|
11907
11907
|
|
|
11908
11908
|
async function ko(t, e, n) {
|
|
11909
|
-
const s = t.Qr.shift(), i =
|
|
11910
|
-
await
|
|
11909
|
+
const s = t.Qr.shift(), i = ci.from(s, e, n);
|
|
11910
|
+
await bo(t, (() => t.remoteSyncer.applySuccessfulWrite(i))),
|
|
11911
11911
|
// It's possible that with the completion of this mutation another
|
|
11912
11912
|
// slot has freed up.
|
|
11913
|
-
await
|
|
11913
|
+
await Po(t);
|
|
11914
11914
|
}
|
|
11915
11915
|
|
|
11916
11916
|
async function xo(t, e) {
|
|
@@ -11928,10 +11928,10 @@ async function xo(t, e) {
|
|
|
11928
11928
|
// In this case it's also unlikely that the server itself is melting
|
|
11929
11929
|
// down -- this was just a bad request so inhibit backoff on the next
|
|
11930
11930
|
// restart.
|
|
11931
|
-
Oo(t).wr(), await
|
|
11931
|
+
Oo(t).wr(), await bo(t, (() => t.remoteSyncer.rejectFailedWrite(n.batchId, e))),
|
|
11932
11932
|
// It's possible that with the completion of this mutation
|
|
11933
11933
|
// another slot has freed up.
|
|
11934
|
-
await
|
|
11934
|
+
await Po(t);
|
|
11935
11935
|
}
|
|
11936
11936
|
var n;
|
|
11937
11937
|
}(t, e),
|
|
@@ -11981,7 +11981,7 @@ async function $o(t, e) {
|
|
|
11981
11981
|
*/ (t.datastore, t.asyncQueue, {
|
|
11982
11982
|
Di: Eo.bind(null, t),
|
|
11983
11983
|
Ni: Io.bind(null, t),
|
|
11984
|
-
|
|
11984
|
+
br: Ao.bind(null, t)
|
|
11985
11985
|
}), t.zr.push((async e => {
|
|
11986
11986
|
e ? (t.Xr.wr(), yo(t) ? go(t) : t.Jr.set("Unknown" /* Unknown */)) : (await t.Xr.stop(),
|
|
11987
11987
|
To(t));
|
|
@@ -12009,7 +12009,7 @@ async function $o(t, e) {
|
|
|
12009
12009
|
}), t.zr.push((async e => {
|
|
12010
12010
|
e ? (t.Zr.wr(),
|
|
12011
12011
|
// This will start the write stream if necessary.
|
|
12012
|
-
await
|
|
12012
|
+
await Po(t)) : (await t.Zr.stop(), t.Qr.length > 0 && (F("RemoteStore", `Stopping write stream with ${t.Qr.length} pending writes`),
|
|
12013
12013
|
t.Qr = []));
|
|
12014
12014
|
}))), t.Zr;
|
|
12015
12015
|
}
|
|
@@ -12261,9 +12261,9 @@ class Mo {
|
|
|
12261
12261
|
}
|
|
12262
12262
|
|
|
12263
12263
|
class qo {
|
|
12264
|
-
constructor(t, e, n, s, i, r, o,
|
|
12264
|
+
constructor(t, e, n, s, i, r, o, a) {
|
|
12265
12265
|
this.query = t, this.docs = e, this.oldDocs = n, this.docChanges = s, this.mutatedKeys = i,
|
|
12266
|
-
this.fromCache = r, this.syncStateChanged = o, this.excludesMetadataChanges =
|
|
12266
|
+
this.fromCache = r, this.syncStateChanged = o, this.excludesMetadataChanges = a;
|
|
12267
12267
|
}
|
|
12268
12268
|
/** Returns a view snapshot as if all documents in the snapshot were added. */ static fromInitialDocuments(t, e, n, s) {
|
|
12269
12269
|
const i = [];
|
|
@@ -12382,12 +12382,12 @@ function Ho(t) {
|
|
|
12382
12382
|
* It uses an Observer to dispatch events.
|
|
12383
12383
|
*/ class Jo {
|
|
12384
12384
|
constructor(t, e, n) {
|
|
12385
|
-
this.query = t, this.
|
|
12385
|
+
this.query = t, this.ao = e,
|
|
12386
12386
|
/**
|
|
12387
12387
|
* Initial snapshots (e.g. from cache) may not be propagated to the wrapped
|
|
12388
12388
|
* observer. This flag is set to true once we've actually raised an event.
|
|
12389
12389
|
*/
|
|
12390
|
-
this.
|
|
12390
|
+
this.co = !1, this.uo = null, this.onlineState = "Unknown" /* Unknown */ , this.options = n || {};
|
|
12391
12391
|
}
|
|
12392
12392
|
/**
|
|
12393
12393
|
* Applies the new ViewSnapshot to this listener, raising a user-facing event
|
|
@@ -12403,16 +12403,16 @@ function Ho(t) {
|
|
|
12403
12403
|
/* excludesMetadataChanges= */ !0);
|
|
12404
12404
|
}
|
|
12405
12405
|
let e = !1;
|
|
12406
|
-
return this.
|
|
12406
|
+
return this.co ? this.ho(t) && (this.ao.next(t), e = !0) : this.lo(t, this.onlineState) && (this.fo(t),
|
|
12407
12407
|
e = !0), this.uo = t, e;
|
|
12408
12408
|
}
|
|
12409
12409
|
onError(t) {
|
|
12410
|
-
this.
|
|
12410
|
+
this.ao.error(t);
|
|
12411
12411
|
}
|
|
12412
12412
|
/** Returns whether a snapshot was raised. */ ro(t) {
|
|
12413
12413
|
this.onlineState = t;
|
|
12414
12414
|
let e = !1;
|
|
12415
|
-
return this.uo && !this.
|
|
12415
|
+
return this.uo && !this.co && this.lo(this.uo, t) && (this.fo(this.uo), e = !0),
|
|
12416
12416
|
e;
|
|
12417
12417
|
}
|
|
12418
12418
|
lo(t, e) {
|
|
@@ -12439,8 +12439,8 @@ function Ho(t) {
|
|
|
12439
12439
|
// stripped out.
|
|
12440
12440
|
}
|
|
12441
12441
|
fo(t) {
|
|
12442
|
-
t = qo.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache), this.
|
|
12443
|
-
this.
|
|
12442
|
+
t = qo.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache), this.co = !0,
|
|
12443
|
+
this.ao.next(t);
|
|
12444
12444
|
}
|
|
12445
12445
|
}
|
|
12446
12446
|
|
|
@@ -12518,7 +12518,7 @@ function Ho(t) {
|
|
|
12518
12518
|
/** Batched queries to be saved into storage */
|
|
12519
12519
|
this.queries = [],
|
|
12520
12520
|
/** Batched documents to be saved into storage */
|
|
12521
|
-
this.documents = [], this.progress =
|
|
12521
|
+
this.documents = [], this.progress = ta(t);
|
|
12522
12522
|
}
|
|
12523
12523
|
/**
|
|
12524
12524
|
* Adds an element from the bundle to the loader.
|
|
@@ -12557,7 +12557,7 @@ function Ho(t) {
|
|
|
12557
12557
|
/**
|
|
12558
12558
|
* Returns a `LoadBundleTaskProgress` representing the initial progress of
|
|
12559
12559
|
* loading a bundle.
|
|
12560
|
-
*/ function
|
|
12560
|
+
*/ function ta(t) {
|
|
12561
12561
|
return {
|
|
12562
12562
|
taskState: "Running",
|
|
12563
12563
|
documentsLoaded: 0,
|
|
@@ -12587,13 +12587,13 @@ function Ho(t) {
|
|
|
12587
12587
|
* See the License for the specific language governing permissions and
|
|
12588
12588
|
* limitations under the License.
|
|
12589
12589
|
*/
|
|
12590
|
-
class
|
|
12590
|
+
class ea {
|
|
12591
12591
|
constructor(t) {
|
|
12592
12592
|
this.key = t;
|
|
12593
12593
|
}
|
|
12594
12594
|
}
|
|
12595
12595
|
|
|
12596
|
-
class
|
|
12596
|
+
class na {
|
|
12597
12597
|
constructor(t) {
|
|
12598
12598
|
this.key = t;
|
|
12599
12599
|
}
|
|
@@ -12603,7 +12603,7 @@ class nc {
|
|
|
12603
12603
|
* View is responsible for computing the final merged truth of what docs are in
|
|
12604
12604
|
* a query. It gets notified of local and remote changes to docs, and applies
|
|
12605
12605
|
* the query filters and limits to determine the most correct possible results.
|
|
12606
|
-
*/ class
|
|
12606
|
+
*/ class sa {
|
|
12607
12607
|
constructor(t,
|
|
12608
12608
|
/** Documents included in the remote target */
|
|
12609
12609
|
e) {
|
|
@@ -12623,7 +12623,7 @@ class nc {
|
|
|
12623
12623
|
/**
|
|
12624
12624
|
* The set of remote documents that the server has told us belongs to the target associated with
|
|
12625
12625
|
* this view.
|
|
12626
|
-
*/ get
|
|
12626
|
+
*/ get bo() {
|
|
12627
12627
|
return this.To;
|
|
12628
12628
|
}
|
|
12629
12629
|
/**
|
|
@@ -12635,7 +12635,7 @@ class nc {
|
|
|
12635
12635
|
* @param previousChanges - If this is being called with a refill, then start
|
|
12636
12636
|
* with this set of docs and changes instead of the current view.
|
|
12637
12637
|
* @returns a new set of docs, changes, and refill flag.
|
|
12638
|
-
*/
|
|
12638
|
+
*/ Po(t, e) {
|
|
12639
12639
|
const n = e ? e.vo : new Uo, s = e ? e.Ro : this.Ro;
|
|
12640
12640
|
let i = e ? e.mutatedKeys : this.mutatedKeys, r = s, o = !1;
|
|
12641
12641
|
// Track the last doc in a (full) limit. This is necessary, because some
|
|
@@ -12646,7 +12646,7 @@ class nc {
|
|
|
12646
12646
|
// deletes. So we keep this doc at the old limit to compare the updates to.
|
|
12647
12647
|
// Note that this should never get used in a refill (when previousChanges is
|
|
12648
12648
|
// set), because there will only be adds -- no deletes or updates.
|
|
12649
|
-
const
|
|
12649
|
+
const a = Te(this.query) && s.size === this.query.limit ? s.last() : null, c = Ee(this.query) && s.size === this.query.limit ? s.first() : null;
|
|
12650
12650
|
// Drop documents out to meet limit/limitToLast requirement.
|
|
12651
12651
|
if (t.inorderTraversal(((t, e) => {
|
|
12652
12652
|
const u = s.get(t), h = Ce(this.query, e) ? e : null, l = !!u && this.mutatedKeys.has(u.key), f = !!h && (h.hasLocalMutations ||
|
|
@@ -12662,7 +12662,7 @@ class nc {
|
|
|
12662
12662
|
}), d = !0) : this.Vo(u, h) || (n.track({
|
|
12663
12663
|
type: 2 /* Modified */ ,
|
|
12664
12664
|
doc: h
|
|
12665
|
-
}), d = !0, (
|
|
12665
|
+
}), d = !0, (a && this.Ao(h, a) > 0 || c && this.Ao(h, c) < 0) && (
|
|
12666
12666
|
// This doc moved from inside the limit to outside the limit.
|
|
12667
12667
|
// That means there may be some other doc in the local cache
|
|
12668
12668
|
// that should be included instead.
|
|
@@ -12673,7 +12673,7 @@ class nc {
|
|
|
12673
12673
|
}), d = !0) : u && !h && (n.track({
|
|
12674
12674
|
type: 1 /* Removed */ ,
|
|
12675
12675
|
doc: u
|
|
12676
|
-
}), d = !0, (
|
|
12676
|
+
}), d = !0, (a || c) && (
|
|
12677
12677
|
// A doc was removed from a full limit query. We'll need to
|
|
12678
12678
|
// requery from the local cache to see if we know about some other
|
|
12679
12679
|
// doc that should be in the results.
|
|
@@ -12757,10 +12757,10 @@ class nc {
|
|
|
12757
12757
|
* See the License for the specific language governing permissions and
|
|
12758
12758
|
* limitations under the License.
|
|
12759
12759
|
*/ (t.type, e.type) || this.Ao(t.doc, e.doc))), this.So(n);
|
|
12760
|
-
const r = e ? this.Do() : [], o = 0 === this.Io.size && this.current ? 1 /* Synced */ : 0 /* Local */ ,
|
|
12761
|
-
if (this.Eo = o, 0 !== i.length ||
|
|
12760
|
+
const r = e ? this.Do() : [], o = 0 === this.Io.size && this.current ? 1 /* Synced */ : 0 /* Local */ , a = o !== this.Eo;
|
|
12761
|
+
if (this.Eo = o, 0 !== i.length || a) {
|
|
12762
12762
|
return {
|
|
12763
|
-
snapshot: new qo(this.query, t.Ro, s, i, t.mutatedKeys, 0 /* Local */ === o,
|
|
12763
|
+
snapshot: new qo(this.query, t.Ro, s, i, t.mutatedKeys, 0 /* Local */ === o, a,
|
|
12764
12764
|
/* excludesMetadataChanges= */ !1),
|
|
12765
12765
|
Co: r
|
|
12766
12766
|
};
|
|
@@ -12816,9 +12816,9 @@ class nc {
|
|
|
12816
12816
|
// Diff the new limbo docs with the old limbo docs.
|
|
12817
12817
|
const e = [];
|
|
12818
12818
|
return t.forEach((t => {
|
|
12819
|
-
this.Io.has(t) || e.push(new
|
|
12819
|
+
this.Io.has(t) || e.push(new na(t));
|
|
12820
12820
|
})), this.Io.forEach((n => {
|
|
12821
|
-
t.has(n) || e.push(new
|
|
12821
|
+
t.has(n) || e.push(new ea(n));
|
|
12822
12822
|
})), e;
|
|
12823
12823
|
}
|
|
12824
12824
|
/**
|
|
@@ -12843,7 +12843,7 @@ class nc {
|
|
|
12843
12843
|
// PORTING NOTE: Multi-tab only.
|
|
12844
12844
|
ko(t) {
|
|
12845
12845
|
this.To = t.zn, this.Io = Cn();
|
|
12846
|
-
const e = this.
|
|
12846
|
+
const e = this.Po(t.documents);
|
|
12847
12847
|
return this.applyChanges(e, /*updateLimboDocuments=*/ !0);
|
|
12848
12848
|
}
|
|
12849
12849
|
/**
|
|
@@ -12861,7 +12861,7 @@ class nc {
|
|
|
12861
12861
|
* QueryView contains all of the data that SyncEngine needs to keep track of for
|
|
12862
12862
|
* a particular query.
|
|
12863
12863
|
*/
|
|
12864
|
-
class
|
|
12864
|
+
class ia {
|
|
12865
12865
|
constructor(
|
|
12866
12866
|
/**
|
|
12867
12867
|
* The query itself.
|
|
@@ -12883,7 +12883,7 @@ class ic {
|
|
|
12883
12883
|
}
|
|
12884
12884
|
}
|
|
12885
12885
|
|
|
12886
|
-
/** Tracks a limbo resolution. */ class
|
|
12886
|
+
/** Tracks a limbo resolution. */ class ra {
|
|
12887
12887
|
constructor(t) {
|
|
12888
12888
|
this.key = t,
|
|
12889
12889
|
/**
|
|
@@ -12908,7 +12908,7 @@ class ic {
|
|
|
12908
12908
|
* the class is not exported so they are only accessible from this module.
|
|
12909
12909
|
* This is useful to implement optional features (like bundles) in free
|
|
12910
12910
|
* functions, such that they are tree-shakeable.
|
|
12911
|
-
*/ class
|
|
12911
|
+
*/ class oa {
|
|
12912
12912
|
constructor(t, e, n,
|
|
12913
12913
|
// PORTING NOTE: Manages state synchronization in multi-tab environments.
|
|
12914
12914
|
s, i, r) {
|
|
@@ -12954,8 +12954,8 @@ class ic {
|
|
|
12954
12954
|
* server. All the subsequent view snapshots or errors are sent to the
|
|
12955
12955
|
* subscribed handlers. Returns the initial snapshot.
|
|
12956
12956
|
*/
|
|
12957
|
-
async function
|
|
12958
|
-
const n =
|
|
12957
|
+
async function aa(t, e) {
|
|
12958
|
+
const n = Fa(t);
|
|
12959
12959
|
let s, i;
|
|
12960
12960
|
const r = n.Oo.get(e);
|
|
12961
12961
|
if (r)
|
|
@@ -12966,8 +12966,8 @@ async function cc(t, e) {
|
|
|
12966
12966
|
// to the query. EventManager will not have an assigned target ID in this
|
|
12967
12967
|
// case and calls `listen` to obtain this ID.
|
|
12968
12968
|
s = r.targetId, n.sharedClientState.addLocalQueryTarget(s), i = r.view.xo(); else {
|
|
12969
|
-
const t = await Er(n.localStore,
|
|
12970
|
-
s = t.targetId, i = await
|
|
12969
|
+
const t = await Er(n.localStore, Pe(e)), r = n.sharedClientState.addLocalQueryTarget(t.targetId);
|
|
12970
|
+
s = t.targetId, i = await ca(n, e, s, "current" === r), n.isPrimaryClient && fo(n.remoteStore, t);
|
|
12971
12971
|
}
|
|
12972
12972
|
return i;
|
|
12973
12973
|
}
|
|
@@ -12975,31 +12975,31 @@ async function cc(t, e) {
|
|
|
12975
12975
|
/**
|
|
12976
12976
|
* Registers a view for a previously unknown query and computes its initial
|
|
12977
12977
|
* snapshot.
|
|
12978
|
-
*/ async function
|
|
12978
|
+
*/ async function ca(t, e, n, s) {
|
|
12979
12979
|
// PORTING NOTE: On Web only, we inject the code that registers new Limbo
|
|
12980
12980
|
// targets based on view changes. This allows us to only depend on Limbo
|
|
12981
12981
|
// changes when user code includes queries.
|
|
12982
12982
|
t.Go = (e, n, s) => async function(t, e, n, s) {
|
|
12983
|
-
let i = e.view.
|
|
12983
|
+
let i = e.view.Po(n);
|
|
12984
12984
|
i.Bn && (
|
|
12985
12985
|
// The query has a limit and some docs were removed, so we need
|
|
12986
12986
|
// to re-run the query against the local store to make sure we
|
|
12987
12987
|
// didn't lose any good docs that had been past the limit.
|
|
12988
12988
|
i = await Ar(t.localStore, e.query,
|
|
12989
|
-
/* usePreviousResults= */ !1).then((({documents: t}) => e.view.
|
|
12989
|
+
/* usePreviousResults= */ !1).then((({documents: t}) => e.view.Po(t, i))));
|
|
12990
12990
|
const r = s && s.targetChanges.get(e.targetId), o = e.view.applyChanges(i,
|
|
12991
12991
|
/* updateLimboDocuments= */ t.isPrimaryClient, r);
|
|
12992
|
-
return
|
|
12992
|
+
return Ea(t, e.targetId, o.Co), o.snapshot;
|
|
12993
12993
|
}(t, e, n, s);
|
|
12994
12994
|
const i = await Ar(t.localStore, e,
|
|
12995
|
-
/* usePreviousResults= */ !0), r = new
|
|
12996
|
-
/* updateLimboDocuments= */ t.isPrimaryClient,
|
|
12997
|
-
|
|
12998
|
-
const u = new
|
|
12999
|
-
return t.Oo.set(e, u), t.Mo.has(n) ? t.Mo.get(n).push(e) : t.Mo.set(n, [ e ]),
|
|
12995
|
+
/* usePreviousResults= */ !0), r = new sa(e, i.zn), o = r.Po(i.documents), a = $n.createSynthesizedTargetChangeForCurrentChange(n, s && "Offline" /* Offline */ !== t.onlineState), c = r.applyChanges(o,
|
|
12996
|
+
/* updateLimboDocuments= */ t.isPrimaryClient, a);
|
|
12997
|
+
Ea(t, n, c.Co);
|
|
12998
|
+
const u = new ia(e, n, r);
|
|
12999
|
+
return t.Oo.set(e, u), t.Mo.has(n) ? t.Mo.get(n).push(e) : t.Mo.set(n, [ e ]), c.snapshot;
|
|
13000
13000
|
}
|
|
13001
13001
|
|
|
13002
|
-
/** Stops listening to the query. */ async function
|
|
13002
|
+
/** Stops listening to the query. */ async function ua(t, e) {
|
|
13003
13003
|
const n = K(t), s = n.Oo.get(e), i = n.Mo.get(s.targetId);
|
|
13004
13004
|
if (i.length > 1) return n.Mo.set(s.targetId, i.filter((t => !Ve(t, e)))), void n.Oo.delete(e);
|
|
13005
13005
|
// No other queries are mapped to the target, clean up the query and the target.
|
|
@@ -13010,9 +13010,9 @@ async function cc(t, e) {
|
|
|
13010
13010
|
n.sharedClientState.isActiveQueryTarget(s.targetId) || await Ir(n.localStore, s.targetId,
|
|
13011
13011
|
/*keepPersistedTargetData=*/ !1).then((() => {
|
|
13012
13012
|
n.sharedClientState.clearQueryState(s.targetId), wo(n.remoteStore, s.targetId),
|
|
13013
|
-
|
|
13013
|
+
pa(n, s.targetId);
|
|
13014
13014
|
})).catch(qi);
|
|
13015
|
-
} else
|
|
13015
|
+
} else pa(n, s.targetId), await Ir(n.localStore, s.targetId,
|
|
13016
13016
|
/*keepPersistedTargetData=*/ !0);
|
|
13017
13017
|
}
|
|
13018
13018
|
|
|
@@ -13025,11 +13025,11 @@ async function cc(t, e) {
|
|
|
13025
13025
|
* have completed, *not* when the write was acked by the backend. The
|
|
13026
13026
|
* userCallback is resolved once the write was acked/rejected by the
|
|
13027
13027
|
* backend (or failed locally for any other reason).
|
|
13028
|
-
*/ async function
|
|
13029
|
-
const s =
|
|
13028
|
+
*/ async function ha(t, e, n) {
|
|
13029
|
+
const s = Oa(t);
|
|
13030
13030
|
try {
|
|
13031
13031
|
const t = await function(t, e) {
|
|
13032
|
-
const n = K(t), s =
|
|
13032
|
+
const n = K(t), s = ct.now(), i = e.reduce(((t, e) => t.add(e.key)), Cn());
|
|
13033
13033
|
let r;
|
|
13034
13034
|
return n.persistence.runTransaction("Locally write mutations", "readwrite", (t => n.Wn.vn(t, i).next((i => {
|
|
13035
13035
|
r = i;
|
|
@@ -13045,7 +13045,7 @@ async function cc(t, e) {
|
|
|
13045
13045
|
// NOTE: The base state should only be applied if there's some
|
|
13046
13046
|
// existing document to override, so use a Precondition of
|
|
13047
13047
|
// exists=true
|
|
13048
|
-
o.push(new
|
|
13048
|
+
o.push(new cn(t.key, e, Gt(e.value.mapValue), Xe.exists(!0)));
|
|
13049
13049
|
}
|
|
13050
13050
|
return n.An.addMutationBatch(t, s, o, e);
|
|
13051
13051
|
})))).then((t => (t.applyToLocalDocumentSet(r), {
|
|
@@ -13061,7 +13061,7 @@ async function cc(t, e) {
|
|
|
13061
13061
|
/**
|
|
13062
13062
|
* Resolves or rejects the user callback for the given batch and then discards
|
|
13063
13063
|
* it.
|
|
13064
|
-
*/ (s, t.batchId, n), await
|
|
13064
|
+
*/ (s, t.batchId, n), await Ra(s, t.changes), await Po(s.remoteStore);
|
|
13065
13065
|
} catch (t) {
|
|
13066
13066
|
// If we can't persist the mutation, we reject the user callback and
|
|
13067
13067
|
// don't send the mutation. The user can then retry the write.
|
|
@@ -13074,7 +13074,7 @@ async function cc(t, e) {
|
|
|
13074
13074
|
* Applies one remote event to the sync engine, notifying any views of the
|
|
13075
13075
|
* changes, and releasing any pending mutation batches that would become
|
|
13076
13076
|
* visible because of the snapshot version the remote event contains.
|
|
13077
|
-
*/ async function
|
|
13077
|
+
*/ async function la(t, e) {
|
|
13078
13078
|
const n = K(t);
|
|
13079
13079
|
try {
|
|
13080
13080
|
const t = await yr(n.localStore, e);
|
|
@@ -13087,7 +13087,7 @@ async function cc(t, e) {
|
|
|
13087
13087
|
U(t.addedDocuments.size + t.modifiedDocuments.size + t.removedDocuments.size <= 1),
|
|
13088
13088
|
t.addedDocuments.size > 0 ? s.$o = !0 : t.modifiedDocuments.size > 0 ? U(s.$o) : t.removedDocuments.size > 0 && (U(s.$o),
|
|
13089
13089
|
s.$o = !1));
|
|
13090
|
-
})), await
|
|
13090
|
+
})), await Ra(n, t, e);
|
|
13091
13091
|
} catch (t) {
|
|
13092
13092
|
await qi(t);
|
|
13093
13093
|
}
|
|
@@ -13096,7 +13096,7 @@ async function cc(t, e) {
|
|
|
13096
13096
|
/**
|
|
13097
13097
|
* Applies an OnlineState change to the sync engine and notifies any views of
|
|
13098
13098
|
* the change.
|
|
13099
|
-
*/ function
|
|
13099
|
+
*/ function fa(t, e, n) {
|
|
13100
13100
|
const s = K(t);
|
|
13101
13101
|
// If we are the secondary client, we explicitly ignore the remote store's
|
|
13102
13102
|
// online state (the local client may go offline, even though the primary
|
|
@@ -13116,7 +13116,7 @@ async function cc(t, e) {
|
|
|
13116
13116
|
// Run global snapshot listeners if a consistent snapshot has been emitted.
|
|
13117
13117
|
t.ro(e) && (s = !0);
|
|
13118
13118
|
})), s && Ho(n);
|
|
13119
|
-
}(s.eventManager, e), t.length && s.Fo.
|
|
13119
|
+
}(s.eventManager, e), t.length && s.Fo.br(t), s.onlineState = e, s.isPrimaryClient && s.sharedClientState.setOnlineState(e);
|
|
13120
13120
|
}
|
|
13121
13121
|
}
|
|
13122
13122
|
|
|
@@ -13130,7 +13130,7 @@ async function cc(t, e) {
|
|
|
13130
13130
|
* @param err - A description of the condition that has forced the rejection.
|
|
13131
13131
|
* Nearly always this will be an indication that the user is no longer
|
|
13132
13132
|
* authorized to see the data matching the target.
|
|
13133
|
-
*/ async function
|
|
13133
|
+
*/ async function da(t, e, n) {
|
|
13134
13134
|
const s = K(t);
|
|
13135
13135
|
// PORTING NOTE: Multi-tab only.
|
|
13136
13136
|
s.sharedClientState.updateQueryState(e, "rejected", n);
|
|
@@ -13147,18 +13147,18 @@ async function cc(t, e) {
|
|
|
13147
13147
|
const n = Cn().add(r), i = new xn(ut.min(),
|
|
13148
13148
|
/* targetChanges= */ new Map,
|
|
13149
13149
|
/* targetMismatches= */ new In(rt), t, n);
|
|
13150
|
-
await
|
|
13150
|
+
await la(s, i),
|
|
13151
13151
|
// Since this query failed, we won't want to manually unlisten to it.
|
|
13152
13152
|
// We only remove it from bookkeeping after we successfully applied the
|
|
13153
13153
|
// RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to
|
|
13154
13154
|
// this query when the RemoteStore restarts the Watch stream, which should
|
|
13155
13155
|
// re-trigger the target failure.
|
|
13156
|
-
s.Bo = s.Bo.remove(r), s.Uo.delete(e),
|
|
13156
|
+
s.Bo = s.Bo.remove(r), s.Uo.delete(e), Aa(s);
|
|
13157
13157
|
} else await Ir(s.localStore, e,
|
|
13158
|
-
/* keepPersistedTargetData */ !1).then((() =>
|
|
13158
|
+
/* keepPersistedTargetData */ !1).then((() => pa(s, e, n))).catch(qi);
|
|
13159
13159
|
}
|
|
13160
13160
|
|
|
13161
|
-
async function
|
|
13161
|
+
async function wa(t, e) {
|
|
13162
13162
|
const n = K(t), s = e.batch.batchId;
|
|
13163
13163
|
try {
|
|
13164
13164
|
const t = await mr(n.localStore, e);
|
|
@@ -13166,14 +13166,14 @@ async function wc(t, e) {
|
|
|
13166
13166
|
// raise events immediately (depending on whether the watcher is caught
|
|
13167
13167
|
// up), so we raise user callbacks first so that they consistently happen
|
|
13168
13168
|
// before listen events.
|
|
13169
|
-
|
|
13170
|
-
await
|
|
13169
|
+
ya(n, s, /*error=*/ null), ga(n, s), n.sharedClientState.updateMutationState(s, "acknowledged"),
|
|
13170
|
+
await Ra(n, t);
|
|
13171
13171
|
} catch (t) {
|
|
13172
13172
|
await qi(t);
|
|
13173
13173
|
}
|
|
13174
13174
|
}
|
|
13175
13175
|
|
|
13176
|
-
async function
|
|
13176
|
+
async function _a(t, e, n) {
|
|
13177
13177
|
const s = K(t);
|
|
13178
13178
|
try {
|
|
13179
13179
|
const t = await function(t, e) {
|
|
@@ -13193,8 +13193,8 @@ async function _c(t, e, n) {
|
|
|
13193
13193
|
// raise events immediately (depending on whether the watcher is caught up),
|
|
13194
13194
|
// so we raise user callbacks first so that they consistently happen before
|
|
13195
13195
|
// listen events.
|
|
13196
|
-
|
|
13197
|
-
await
|
|
13196
|
+
ya(s, e, n), ga(s, e), s.sharedClientState.updateMutationState(e, "rejected", n),
|
|
13197
|
+
await Ra(s, t);
|
|
13198
13198
|
} catch (n) {
|
|
13199
13199
|
await qi(n);
|
|
13200
13200
|
}
|
|
@@ -13203,7 +13203,7 @@ async function _c(t, e, n) {
|
|
|
13203
13203
|
/**
|
|
13204
13204
|
* Registers a user callback that resolves when all pending mutations at the moment of calling
|
|
13205
13205
|
* are acknowledged .
|
|
13206
|
-
*/ async function
|
|
13206
|
+
*/ async function ma(t, e) {
|
|
13207
13207
|
const n = K(t);
|
|
13208
13208
|
po(n.remoteStore) || F("SyncEngine", "The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled.");
|
|
13209
13209
|
try {
|
|
@@ -13225,13 +13225,13 @@ async function _c(t, e, n) {
|
|
|
13225
13225
|
/**
|
|
13226
13226
|
* Triggers the callbacks that are waiting for this batch id to get acknowledged by server,
|
|
13227
13227
|
* if there are any.
|
|
13228
|
-
*/ function
|
|
13228
|
+
*/ function ga(t, e) {
|
|
13229
13229
|
(t.jo.get(e) || []).forEach((t => {
|
|
13230
13230
|
t.resolve();
|
|
13231
13231
|
})), t.jo.delete(e);
|
|
13232
13232
|
}
|
|
13233
13233
|
|
|
13234
|
-
/** Reject all outstanding callbacks waiting for pending writes to complete. */ function
|
|
13234
|
+
/** Reject all outstanding callbacks waiting for pending writes to complete. */ function ya(t, e, n) {
|
|
13235
13235
|
const s = K(t);
|
|
13236
13236
|
let i = s.Ko[s.currentUser.toKey()];
|
|
13237
13237
|
// NOTE: Mutations restored from persistence won't have callbacks, so it's
|
|
@@ -13242,39 +13242,39 @@ async function _c(t, e, n) {
|
|
|
13242
13242
|
}
|
|
13243
13243
|
}
|
|
13244
13244
|
|
|
13245
|
-
function
|
|
13245
|
+
function pa(t, e, n = null) {
|
|
13246
13246
|
t.sharedClientState.removeLocalQueryTarget(e);
|
|
13247
13247
|
for (const s of t.Mo.get(e)) t.Oo.delete(s), n && t.Fo.zo(s, n);
|
|
13248
13248
|
if (t.Mo.delete(e), t.isPrimaryClient) {
|
|
13249
13249
|
t.qo.us(e).forEach((e => {
|
|
13250
13250
|
t.qo.containsKey(e) ||
|
|
13251
13251
|
// We removed the last reference for this key
|
|
13252
|
-
|
|
13252
|
+
Ta(t, e);
|
|
13253
13253
|
}));
|
|
13254
13254
|
}
|
|
13255
13255
|
}
|
|
13256
13256
|
|
|
13257
|
-
function
|
|
13257
|
+
function Ta(t, e) {
|
|
13258
13258
|
t.Lo.delete(e.path.canonicalString());
|
|
13259
13259
|
// It's possible that the target already got removed because the query failed. In that case,
|
|
13260
13260
|
// the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.
|
|
13261
13261
|
const n = t.Bo.get(e);
|
|
13262
|
-
null !== n && (wo(t.remoteStore, n), t.Bo = t.Bo.remove(e), t.Uo.delete(n),
|
|
13262
|
+
null !== n && (wo(t.remoteStore, n), t.Bo = t.Bo.remove(e), t.Uo.delete(n), Aa(t));
|
|
13263
13263
|
}
|
|
13264
13264
|
|
|
13265
|
-
function
|
|
13266
|
-
for (const s of n) if (s instanceof
|
|
13265
|
+
function Ea(t, e, n) {
|
|
13266
|
+
for (const s of n) if (s instanceof ea) t.qo.addReference(s.key, e), Ia(t, s); else if (s instanceof na) {
|
|
13267
13267
|
F("SyncEngine", "Document no longer in limbo: " + s.key), t.qo.removeReference(s.key, e);
|
|
13268
13268
|
t.qo.containsKey(s.key) ||
|
|
13269
13269
|
// We removed the last reference for this key
|
|
13270
|
-
|
|
13270
|
+
Ta(t, s.key);
|
|
13271
13271
|
} else B();
|
|
13272
13272
|
}
|
|
13273
13273
|
|
|
13274
|
-
function
|
|
13274
|
+
function Ia(t, e) {
|
|
13275
13275
|
const n = e.key, s = n.path.canonicalString();
|
|
13276
13276
|
t.Bo.get(n) || t.Lo.has(s) || (F("SyncEngine", "New document in limbo: " + n), t.Lo.add(s),
|
|
13277
|
-
|
|
13277
|
+
Aa(t));
|
|
13278
13278
|
}
|
|
13279
13279
|
|
|
13280
13280
|
/**
|
|
@@ -13284,27 +13284,27 @@ function Ic(t, e) {
|
|
|
13284
13284
|
* Without bounding the number of concurrent resolutions, the server can fail
|
|
13285
13285
|
* with "resource exhausted" errors which can lead to pathological client
|
|
13286
13286
|
* behavior as seen in https://github.com/firebase/firebase-js-sdk/issues/2683.
|
|
13287
|
-
*/ function
|
|
13287
|
+
*/ function Aa(t) {
|
|
13288
13288
|
for (;t.Lo.size > 0 && t.Bo.size < t.maxConcurrentLimboResolutions; ) {
|
|
13289
13289
|
const e = t.Lo.values().next().value;
|
|
13290
13290
|
t.Lo.delete(e);
|
|
13291
13291
|
const n = new Ct(wt.fromString(e)), s = t.Qo.next();
|
|
13292
|
-
t.Uo.set(s, new
|
|
13292
|
+
t.Uo.set(s, new ra(n)), t.Bo = t.Bo.insert(n, s), fo(t.remoteStore, new ui(Pe(pe(n.path)), s, 2 /* LimboResolution */ , nt.I));
|
|
13293
13293
|
}
|
|
13294
13294
|
}
|
|
13295
13295
|
|
|
13296
|
-
async function
|
|
13296
|
+
async function Ra(t, e, n) {
|
|
13297
13297
|
const s = K(t), i = [], r = [], o = [];
|
|
13298
|
-
s.Oo.isEmpty() || (s.Oo.forEach(((t,
|
|
13299
|
-
o.push(s.Go(
|
|
13298
|
+
s.Oo.isEmpty() || (s.Oo.forEach(((t, a) => {
|
|
13299
|
+
o.push(s.Go(a, e, n).then((t => {
|
|
13300
13300
|
if (t) {
|
|
13301
|
-
s.isPrimaryClient && s.sharedClientState.updateQueryState(
|
|
13301
|
+
s.isPrimaryClient && s.sharedClientState.updateQueryState(a.targetId, t.fromCache ? "not-current" : "current"),
|
|
13302
13302
|
i.push(t);
|
|
13303
|
-
const e = lr.$n(
|
|
13303
|
+
const e = lr.$n(a.targetId, t);
|
|
13304
13304
|
r.push(e);
|
|
13305
13305
|
}
|
|
13306
13306
|
})));
|
|
13307
|
-
})), await Promise.all(o), s.Fo.
|
|
13307
|
+
})), await Promise.all(o), s.Fo.br(i), await async function(t, e) {
|
|
13308
13308
|
const n = K(t);
|
|
13309
13309
|
try {
|
|
13310
13310
|
await n.persistence.runTransaction("notifyLocalViewChanges", "readwrite", (t => Hs.forEach(e, (e => Hs.forEach(e.kn, (s => n.persistence.referenceDelegate.addReference(t, e.targetId, s))).next((() => Hs.forEach(e.xn, (s => n.persistence.referenceDelegate.removeReference(t, e.targetId, s)))))))));
|
|
@@ -13327,7 +13327,7 @@ async function Rc(t, e, n) {
|
|
|
13327
13327
|
}(s.localStore, r));
|
|
13328
13328
|
}
|
|
13329
13329
|
|
|
13330
|
-
async function
|
|
13330
|
+
async function ba(t, e) {
|
|
13331
13331
|
const n = K(t);
|
|
13332
13332
|
if (!n.currentUser.isEqual(e)) {
|
|
13333
13333
|
F("SyncEngine", "User change. New user:", e.toKey());
|
|
@@ -13342,11 +13342,11 @@ async function Pc(t, e) {
|
|
|
13342
13342
|
})), t.jo.clear();
|
|
13343
13343
|
}(n, "'waitForPendingWrites' promise is rejected due to a user change."),
|
|
13344
13344
|
// TODO(b/114226417): Consider calling this only in the primary tab.
|
|
13345
|
-
n.sharedClientState.handleUserChange(e, t.removedBatchIds, t.addedBatchIds), await
|
|
13345
|
+
n.sharedClientState.handleUserChange(e, t.removedBatchIds, t.addedBatchIds), await Ra(n, t.Gn);
|
|
13346
13346
|
}
|
|
13347
13347
|
}
|
|
13348
13348
|
|
|
13349
|
-
function
|
|
13349
|
+
function Pa(t, e) {
|
|
13350
13350
|
const n = K(t), s = n.Uo.get(e);
|
|
13351
13351
|
if (s && s.$o) return Cn().add(s.key);
|
|
13352
13352
|
{
|
|
@@ -13355,7 +13355,7 @@ function bc(t, e) {
|
|
|
13355
13355
|
if (!s) return t;
|
|
13356
13356
|
for (const e of s) {
|
|
13357
13357
|
const s = n.Oo.get(e);
|
|
13358
|
-
t = t.unionWith(s.view.
|
|
13358
|
+
t = t.unionWith(s.view.bo);
|
|
13359
13359
|
}
|
|
13360
13360
|
return t;
|
|
13361
13361
|
}
|
|
@@ -13364,10 +13364,10 @@ function bc(t, e) {
|
|
|
13364
13364
|
/**
|
|
13365
13365
|
* Reconcile the list of synced documents in an existing view with those
|
|
13366
13366
|
* from persistence.
|
|
13367
|
-
*/ async function
|
|
13367
|
+
*/ async function va(t, e) {
|
|
13368
13368
|
const n = K(t), s = await Ar(n.localStore, e.query,
|
|
13369
13369
|
/* usePreviousResults= */ !0), i = e.view.ko(s);
|
|
13370
|
-
return n.isPrimaryClient &&
|
|
13370
|
+
return n.isPrimaryClient && Ea(n, e.targetId, i.Co), i;
|
|
13371
13371
|
}
|
|
13372
13372
|
|
|
13373
13373
|
/**
|
|
@@ -13375,14 +13375,14 @@ function bc(t, e) {
|
|
|
13375
13375
|
* snapshots if needed.
|
|
13376
13376
|
*/
|
|
13377
13377
|
// PORTING NOTE: Multi-Tab only.
|
|
13378
|
-
async function
|
|
13378
|
+
async function Va(t) {
|
|
13379
13379
|
const e = K(t);
|
|
13380
|
-
return
|
|
13380
|
+
return br(e.localStore).then((t => Ra(e, t)));
|
|
13381
13381
|
}
|
|
13382
13382
|
|
|
13383
13383
|
/** Applies a mutation state to an existing batch. */
|
|
13384
13384
|
// PORTING NOTE: Multi-Tab only.
|
|
13385
|
-
async function
|
|
13385
|
+
async function Sa(t, e, n, s) {
|
|
13386
13386
|
const i = K(t), r = await function(t, e) {
|
|
13387
13387
|
const n = K(t), s = K(n.An);
|
|
13388
13388
|
return n.persistence.runTransaction("Lookup mutation documents", "readonly", (t => s.Zt(t, e).next((e => e ? n.Wn.vn(t, e) : Hs.resolve(null)))));
|
|
@@ -13393,14 +13393,14 @@ async function Sc(t, e, n, s) {
|
|
|
13393
13393
|
// If we are the primary client, we need to send this write to the
|
|
13394
13394
|
// backend. Secondary clients will ignore these writes since their remote
|
|
13395
13395
|
// connection is disabled.
|
|
13396
|
-
await
|
|
13396
|
+
await Po(i.remoteStore) : "acknowledged" === n || "rejected" === n ? (
|
|
13397
13397
|
// NOTE: Both these methods are no-ops for batches that originated from
|
|
13398
13398
|
// other clients.
|
|
13399
|
-
|
|
13399
|
+
ya(i, e, s || null), ga(i, e), function(t, e) {
|
|
13400
13400
|
K(K(t).An).ee(e);
|
|
13401
13401
|
}
|
|
13402
13402
|
// PORTING NOTE: Multi-Tab only.
|
|
13403
|
-
(i.localStore, e)) : B(), await
|
|
13403
|
+
(i.localStore, e)) : B(), await Ra(i, r)) :
|
|
13404
13404
|
// A throttled tab may not have seen the mutation before it was completed
|
|
13405
13405
|
// and removed from the mutation queue, in which case we won't have cached
|
|
13406
13406
|
// the affected documents. In this case we can safely ignore the update
|
|
@@ -13413,26 +13413,26 @@ async function Sc(t, e, n, s) {
|
|
|
13413
13413
|
|
|
13414
13414
|
/** Applies a query target change from a different tab. */
|
|
13415
13415
|
// PORTING NOTE: Multi-Tab only.
|
|
13416
|
-
async function
|
|
13416
|
+
async function Da(t, e) {
|
|
13417
13417
|
const n = K(t);
|
|
13418
|
-
if (
|
|
13418
|
+
if (Fa(n), Oa(n), !0 === e && !0 !== n.Wo) {
|
|
13419
13419
|
// Secondary tabs only maintain Views for their local listeners and the
|
|
13420
13420
|
// Views internal state may not be 100% populated (in particular
|
|
13421
13421
|
// secondary tabs don't track syncedDocuments, the set of documents the
|
|
13422
13422
|
// server considers to be in the target). So when a secondary becomes
|
|
13423
13423
|
// primary, we need to need to make sure that all views for all targets
|
|
13424
13424
|
// match the state on disk.
|
|
13425
|
-
const t = n.sharedClientState.getAllActiveQueryTargets(), e = await
|
|
13425
|
+
const t = n.sharedClientState.getAllActiveQueryTargets(), e = await Ca(n, t.toArray());
|
|
13426
13426
|
n.Wo = !0, await $o(n.remoteStore, !0);
|
|
13427
13427
|
for (const t of e) fo(n.remoteStore, t);
|
|
13428
13428
|
} else if (!1 === e && !1 !== n.Wo) {
|
|
13429
13429
|
const t = [];
|
|
13430
13430
|
let e = Promise.resolve();
|
|
13431
13431
|
n.Mo.forEach(((s, i) => {
|
|
13432
|
-
n.sharedClientState.isLocalQueryTarget(i) ? t.push(i) : e = e.then((() => (
|
|
13432
|
+
n.sharedClientState.isLocalQueryTarget(i) ? t.push(i) : e = e.then((() => (pa(n, i),
|
|
13433
13433
|
Ir(n.localStore, i,
|
|
13434
13434
|
/*keepPersistedTargetData=*/ !0)))), wo(n.remoteStore, i);
|
|
13435
|
-
})), await e, await
|
|
13435
|
+
})), await e, await Ca(n, t),
|
|
13436
13436
|
// PORTING NOTE: Multi-Tab only.
|
|
13437
13437
|
function(t) {
|
|
13438
13438
|
const e = K(t);
|
|
@@ -13455,7 +13455,7 @@ async function Dc(t, e) {
|
|
|
13455
13455
|
}
|
|
13456
13456
|
}
|
|
13457
13457
|
|
|
13458
|
-
async function
|
|
13458
|
+
async function Ca(t, e, n) {
|
|
13459
13459
|
const s = K(t), i = [], r = [];
|
|
13460
13460
|
for (const t of e) {
|
|
13461
13461
|
let e;
|
|
@@ -13465,21 +13465,21 @@ async function Cc(t, e, n) {
|
|
|
13465
13465
|
// from LocalStore (as the resume token and the snapshot version
|
|
13466
13466
|
// might have changed) and reconcile their views with the persisted
|
|
13467
13467
|
// state (the list of syncedDocuments may have gotten out of sync).
|
|
13468
|
-
e = await Er(s.localStore,
|
|
13468
|
+
e = await Er(s.localStore, Pe(n[0]));
|
|
13469
13469
|
for (const t of n) {
|
|
13470
|
-
const e = s.Oo.get(t), n = await
|
|
13470
|
+
const e = s.Oo.get(t), n = await va(s, e);
|
|
13471
13471
|
n.snapshot && r.push(n.snapshot);
|
|
13472
13472
|
}
|
|
13473
13473
|
} else {
|
|
13474
13474
|
// For queries that never executed on this client, we need to
|
|
13475
13475
|
// allocate the target in LocalStore and initialize a new View.
|
|
13476
13476
|
const n = await Rr(s.localStore, t);
|
|
13477
|
-
e = await Er(s.localStore, n), await
|
|
13477
|
+
e = await Er(s.localStore, n), await ca(s, Na(n), t,
|
|
13478
13478
|
/*current=*/ !1);
|
|
13479
13479
|
}
|
|
13480
13480
|
i.push(e);
|
|
13481
13481
|
}
|
|
13482
|
-
return s.Fo.
|
|
13482
|
+
return s.Fo.br(r), i;
|
|
13483
13483
|
}
|
|
13484
13484
|
|
|
13485
13485
|
/**
|
|
@@ -13493,20 +13493,20 @@ async function Cc(t, e, n) {
|
|
|
13493
13493
|
* difference will not cause issues.
|
|
13494
13494
|
*/
|
|
13495
13495
|
// PORTING NOTE: Multi-Tab only.
|
|
13496
|
-
function
|
|
13496
|
+
function Na(t) {
|
|
13497
13497
|
return ye(t.path, t.collectionGroup, t.orderBy, t.filters, t.limit, "F" /* First */ , t.startAt, t.endAt);
|
|
13498
13498
|
}
|
|
13499
13499
|
|
|
13500
13500
|
/** Returns the IDs of the clients that are currently active. */
|
|
13501
13501
|
// PORTING NOTE: Multi-Tab only.
|
|
13502
|
-
function
|
|
13502
|
+
function ka(t) {
|
|
13503
13503
|
const e = K(t);
|
|
13504
13504
|
return K(K(e.localStore).persistence).Tn();
|
|
13505
13505
|
}
|
|
13506
13506
|
|
|
13507
13507
|
/** Applies a query target change from a different tab. */
|
|
13508
13508
|
// PORTING NOTE: Multi-Tab only.
|
|
13509
|
-
async function
|
|
13509
|
+
async function xa(t, e, n, s) {
|
|
13510
13510
|
const i = K(t);
|
|
13511
13511
|
if (i.Wo)
|
|
13512
13512
|
// If we receive a target state notification via WebStorage, we are
|
|
@@ -13515,14 +13515,14 @@ async function xc(t, e, n, s) {
|
|
|
13515
13515
|
case "current":
|
|
13516
13516
|
case "not-current":
|
|
13517
13517
|
{
|
|
13518
|
-
const t = await
|
|
13519
|
-
await
|
|
13518
|
+
const t = await br(i.localStore), s = xn.createSynthesizedRemoteEventForCurrentChange(e, "current" === n);
|
|
13519
|
+
await Ra(i, t, s);
|
|
13520
13520
|
break;
|
|
13521
13521
|
}
|
|
13522
13522
|
|
|
13523
13523
|
case "rejected":
|
|
13524
13524
|
await Ir(i.localStore, e,
|
|
13525
|
-
/* keepPersistedTargetData */ !0),
|
|
13525
|
+
/* keepPersistedTargetData */ !0), pa(i, e, s);
|
|
13526
13526
|
break;
|
|
13527
13527
|
|
|
13528
13528
|
default:
|
|
@@ -13530,8 +13530,8 @@ async function xc(t, e, n, s) {
|
|
|
13530
13530
|
}
|
|
13531
13531
|
}
|
|
13532
13532
|
|
|
13533
|
-
/** Adds or removes Watch targets for queries from different tabs. */ async function $
|
|
13534
|
-
const s =
|
|
13533
|
+
/** Adds or removes Watch targets for queries from different tabs. */ async function $a(t, e, n) {
|
|
13534
|
+
const s = Fa(t);
|
|
13535
13535
|
if (s.Wo) {
|
|
13536
13536
|
for (const t of e) {
|
|
13537
13537
|
if (s.Mo.has(t)) {
|
|
@@ -13540,7 +13540,7 @@ async function xc(t, e, n, s) {
|
|
|
13540
13540
|
continue;
|
|
13541
13541
|
}
|
|
13542
13542
|
const e = await Rr(s.localStore, t), n = await Er(s.localStore, e);
|
|
13543
|
-
await
|
|
13543
|
+
await ca(s, Na(e), n.targetId,
|
|
13544
13544
|
/*current=*/ !1), fo(s.remoteStore, n);
|
|
13545
13545
|
}
|
|
13546
13546
|
for (const t of n)
|
|
@@ -13550,21 +13550,21 @@ async function xc(t, e, n, s) {
|
|
|
13550
13550
|
// Release queries that are still active.
|
|
13551
13551
|
await Ir(s.localStore, t,
|
|
13552
13552
|
/* keepPersistedTargetData */ !1).then((() => {
|
|
13553
|
-
wo(s.remoteStore, t),
|
|
13553
|
+
wo(s.remoteStore, t), pa(s, t);
|
|
13554
13554
|
})).catch(qi);
|
|
13555
13555
|
}
|
|
13556
13556
|
}
|
|
13557
13557
|
|
|
13558
|
-
function
|
|
13558
|
+
function Fa(t) {
|
|
13559
13559
|
const e = K(t);
|
|
13560
|
-
return e.remoteStore.remoteSyncer.applyRemoteEvent =
|
|
13561
|
-
e.remoteStore.remoteSyncer.rejectListen =
|
|
13560
|
+
return e.remoteStore.remoteSyncer.applyRemoteEvent = la.bind(null, e), e.remoteStore.remoteSyncer.getRemoteKeysForTarget = Pa.bind(null, e),
|
|
13561
|
+
e.remoteStore.remoteSyncer.rejectListen = da.bind(null, e), e.Fo.br = Go.bind(null, e.eventManager),
|
|
13562
13562
|
e.Fo.zo = zo.bind(null, e.eventManager), e;
|
|
13563
13563
|
}
|
|
13564
13564
|
|
|
13565
|
-
function
|
|
13565
|
+
function Oa(t) {
|
|
13566
13566
|
const e = K(t);
|
|
13567
|
-
return e.remoteStore.remoteSyncer.applySuccessfulWrite =
|
|
13567
|
+
return e.remoteStore.remoteSyncer.applySuccessfulWrite = wa.bind(null, e), e.remoteStore.remoteSyncer.rejectFailedWrite = _a.bind(null, e),
|
|
13568
13568
|
e;
|
|
13569
13569
|
}
|
|
13570
13570
|
|
|
@@ -13575,7 +13575,7 @@ function Oc(t) {
|
|
|
13575
13575
|
* @param syncEngine - SyncEngine to use.
|
|
13576
13576
|
* @param bundleReader - Bundle to load into the SDK.
|
|
13577
13577
|
* @param task - LoadBundleTask used to update the loading progress to public API.
|
|
13578
|
-
*/ function
|
|
13578
|
+
*/ function Ma(t, e, n) {
|
|
13579
13579
|
const s = K(t);
|
|
13580
13580
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
13581
13581
|
(async function(t, e, n) {
|
|
@@ -13596,7 +13596,7 @@ function Oc(t) {
|
|
|
13596
13596
|
totalBytes: t.totalBytes
|
|
13597
13597
|
};
|
|
13598
13598
|
}(s));
|
|
13599
|
-
n._updateProgress(
|
|
13599
|
+
n._updateProgress(ta(s));
|
|
13600
13600
|
const i = new Zo(s, t.localStore, e.k);
|
|
13601
13601
|
let r = await e.Ho();
|
|
13602
13602
|
for (;r; ) {
|
|
@@ -13607,7 +13607,7 @@ function Oc(t) {
|
|
|
13607
13607
|
// TODO(b/160876443): This currently raises snapshots with
|
|
13608
13608
|
// `fromCache=false` if users already listen to some queries and bundles
|
|
13609
13609
|
// has newer version.
|
|
13610
|
-
await
|
|
13610
|
+
await Ra(t, o.In,
|
|
13611
13611
|
/* remoteEvent */ void 0),
|
|
13612
13612
|
// Save metadata, so loading the same bundle will skip.
|
|
13613
13613
|
await function(t, e) {
|
|
@@ -13646,7 +13646,7 @@ function Oc(t) {
|
|
|
13646
13646
|
}));
|
|
13647
13647
|
}
|
|
13648
13648
|
|
|
13649
|
-
class
|
|
13649
|
+
class La {
|
|
13650
13650
|
constructor() {
|
|
13651
13651
|
this.synchronizeTabs = !1;
|
|
13652
13652
|
}
|
|
@@ -13674,14 +13674,14 @@ class Lc {
|
|
|
13674
13674
|
|
|
13675
13675
|
/**
|
|
13676
13676
|
* Provides all components needed for Firestore with IndexedDB persistence.
|
|
13677
|
-
*/ class
|
|
13677
|
+
*/ class Ba extends La {
|
|
13678
13678
|
constructor(t, e, n) {
|
|
13679
|
-
super(), this.
|
|
13679
|
+
super(), this.ta = t, this.cacheSizeBytes = e, this.forceOwnership = n, this.synchronizeTabs = !1;
|
|
13680
13680
|
}
|
|
13681
13681
|
async initialize(t) {
|
|
13682
|
-
await super.initialize(t), await
|
|
13682
|
+
await super.initialize(t), await Pr(this.localStore), await this.ta.initialize(this, t),
|
|
13683
13683
|
// Enqueue writes from a previous session
|
|
13684
|
-
await
|
|
13684
|
+
await Oa(this.ta.syncEngine), await Po(this.ta.remoteStore),
|
|
13685
13685
|
// NOTE: This will immediately call the listener, so we make sure to
|
|
13686
13686
|
// set it after localStore / remoteStore are started.
|
|
13687
13687
|
await this.persistence.sn((() => (this.gcScheduler && !this.gcScheduler.started && this.gcScheduler.start(this.localStore),
|
|
@@ -13695,7 +13695,7 @@ class Lc {
|
|
|
13695
13695
|
return new Qi(e, t.asyncQueue);
|
|
13696
13696
|
}
|
|
13697
13697
|
Yo(t) {
|
|
13698
|
-
const e =
|
|
13698
|
+
const e = cr(t.databaseInfo.databaseId, t.databaseInfo.persistenceKey), n = void 0 !== this.cacheSizeBytes ? Si.withCacheSize(this.cacheSizeBytes) : Si.DEFAULT;
|
|
13699
13699
|
return new rr(this.synchronizeTabs, e, t.clientId, n, t.asyncQueue, to(), eo(), this.k, this.sharedClientState, !!this.forceOwnership);
|
|
13700
13700
|
}
|
|
13701
13701
|
Jo(t) {
|
|
@@ -13710,30 +13710,30 @@ class Lc {
|
|
|
13710
13710
|
* In the legacy client, this provider is used to provide both multi-tab and
|
|
13711
13711
|
* non-multi-tab persistence since we cannot tell at build time whether
|
|
13712
13712
|
* `synchronizeTabs` will be enabled.
|
|
13713
|
-
*/ class
|
|
13713
|
+
*/ class Ua extends Ba {
|
|
13714
13714
|
constructor(t, e) {
|
|
13715
|
-
super(t, e, /* forceOwnership= */ !1), this.
|
|
13715
|
+
super(t, e, /* forceOwnership= */ !1), this.ta = t, this.cacheSizeBytes = e, this.synchronizeTabs = !0;
|
|
13716
13716
|
}
|
|
13717
13717
|
async initialize(t) {
|
|
13718
13718
|
await super.initialize(t);
|
|
13719
|
-
const e = this.
|
|
13719
|
+
const e = this.ta.syncEngine;
|
|
13720
13720
|
this.sharedClientState instanceof Gr && (this.sharedClientState.syncEngine = {
|
|
13721
|
-
mi:
|
|
13722
|
-
gi:
|
|
13723
|
-
yi: $
|
|
13724
|
-
Tn:
|
|
13725
|
-
_i:
|
|
13721
|
+
mi: Sa.bind(null, e),
|
|
13722
|
+
gi: xa.bind(null, e),
|
|
13723
|
+
yi: $a.bind(null, e),
|
|
13724
|
+
Tn: ka.bind(null, e),
|
|
13725
|
+
_i: Va.bind(null, e)
|
|
13726
13726
|
}, await this.sharedClientState.start()),
|
|
13727
13727
|
// NOTE: This will immediately call the listener, so we make sure to
|
|
13728
13728
|
// set it after localStore / remoteStore are started.
|
|
13729
13729
|
await this.persistence.sn((async t => {
|
|
13730
|
-
await
|
|
13730
|
+
await Da(this.ta.syncEngine, t), this.gcScheduler && (t && !this.gcScheduler.started ? this.gcScheduler.start(this.localStore) : t || this.gcScheduler.stop());
|
|
13731
13731
|
}));
|
|
13732
13732
|
}
|
|
13733
13733
|
Jo(t) {
|
|
13734
13734
|
const e = to();
|
|
13735
|
-
if (!Gr.
|
|
13736
|
-
const n =
|
|
13735
|
+
if (!Gr.Pt(e)) throw new Q(j.UNIMPLEMENTED, "IndexedDB persistence is only available on platforms that support LocalStorage.");
|
|
13736
|
+
const n = cr(t.databaseInfo.databaseId, t.databaseInfo.persistenceKey);
|
|
13737
13737
|
return new Gr(e, t.asyncQueue, n, t.clientId, t.initialUser);
|
|
13738
13738
|
}
|
|
13739
13739
|
}
|
|
@@ -13741,13 +13741,13 @@ class Lc {
|
|
|
13741
13741
|
/**
|
|
13742
13742
|
* Initializes and wires the components that are needed to interface with the
|
|
13743
13743
|
* network.
|
|
13744
|
-
*/ class
|
|
13744
|
+
*/ class qa {
|
|
13745
13745
|
async initialize(t, e) {
|
|
13746
13746
|
this.localStore || (this.localStore = t.localStore, this.sharedClientState = t.sharedClientState,
|
|
13747
13747
|
this.datastore = this.createDatastore(e), this.remoteStore = this.createRemoteStore(e),
|
|
13748
13748
|
this.eventManager = this.createEventManager(e), this.syncEngine = this.createSyncEngine(e,
|
|
13749
|
-
/* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t =>
|
|
13750
|
-
this.remoteStore.remoteSyncer.handleCredentialChange =
|
|
13749
|
+
/* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t => fa(this.syncEngine, t, 1 /* SharedClientState */),
|
|
13750
|
+
this.remoteStore.remoteSyncer.handleCredentialChange = ba.bind(null, this.syncEngine),
|
|
13751
13751
|
await $o(this.remoteStore, this.syncEngine.isPrimaryClient));
|
|
13752
13752
|
}
|
|
13753
13753
|
createEventManager(t) {
|
|
@@ -13757,20 +13757,20 @@ class Lc {
|
|
|
13757
13757
|
const e = no(t.databaseInfo.databaseId), n = (s = t.databaseInfo, new Zr(s));
|
|
13758
13758
|
var s;
|
|
13759
13759
|
/** Return the Platform-specific connectivity monitor. */ return function(t, e, n, s) {
|
|
13760
|
-
return new
|
|
13760
|
+
return new ao(t, e, n, s);
|
|
13761
13761
|
}(t.authCredentials, t.appCheckCredentials, n, e);
|
|
13762
13762
|
}
|
|
13763
13763
|
createRemoteStore(t) {
|
|
13764
|
-
return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t =>
|
|
13765
|
-
r = Jr.
|
|
13764
|
+
return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t => fa(this.syncEngine, t, 0 /* RemoteStore */),
|
|
13765
|
+
r = Jr.Pt() ? new Jr : new Hr, new uo(e, n, s, i, r);
|
|
13766
13766
|
var e, n, s, i, r;
|
|
13767
13767
|
/** Re-enables the network. Idempotent. */ }
|
|
13768
13768
|
createSyncEngine(t, e) {
|
|
13769
13769
|
return function(t, e, n,
|
|
13770
13770
|
// PORTING NOTE: Manages state synchronization in multi-tab environments.
|
|
13771
13771
|
s, i, r, o) {
|
|
13772
|
-
const
|
|
13773
|
-
return o && (
|
|
13772
|
+
const a = new oa(t, e, n, s, i, r);
|
|
13773
|
+
return o && (a.Wo = !0), a;
|
|
13774
13774
|
}(this.localStore, this.remoteStore, this.eventManager, this.sharedClientState, t.initialUser, t.maxConcurrentLimboResolutions, e);
|
|
13775
13775
|
}
|
|
13776
13776
|
terminate() {
|
|
@@ -13812,7 +13812,7 @@ class Lc {
|
|
|
13812
13812
|
* @param bytesPerRead - How many bytes each `read()` from the returned reader
|
|
13813
13813
|
* will read.
|
|
13814
13814
|
*/
|
|
13815
|
-
function
|
|
13815
|
+
function Ka(t, e = 10240) {
|
|
13816
13816
|
let n = 0;
|
|
13817
13817
|
// The TypeScript definition for ReadableStreamReader changed. We use
|
|
13818
13818
|
// `any` here to allow this code to compile with different versions.
|
|
@@ -13878,7 +13878,7 @@ function Kc(t, e = 10240) {
|
|
|
13878
13878
|
* asynchronously. To allow immediate silencing, a mute call is added which
|
|
13879
13879
|
* causes events scheduled to no longer be raised.
|
|
13880
13880
|
*/
|
|
13881
|
-
class
|
|
13881
|
+
class ja {
|
|
13882
13882
|
constructor(t) {
|
|
13883
13883
|
this.observer = t,
|
|
13884
13884
|
/**
|
|
@@ -13888,15 +13888,15 @@ class jc {
|
|
|
13888
13888
|
this.muted = !1;
|
|
13889
13889
|
}
|
|
13890
13890
|
next(t) {
|
|
13891
|
-
this.observer.next && this.
|
|
13891
|
+
this.observer.next && this.ea(this.observer.next, t);
|
|
13892
13892
|
}
|
|
13893
13893
|
error(t) {
|
|
13894
|
-
this.observer.error ? this.
|
|
13894
|
+
this.observer.error ? this.ea(this.observer.error, t) : console.error("Uncaught Error in snapshot listener:", t);
|
|
13895
13895
|
}
|
|
13896
|
-
|
|
13896
|
+
na() {
|
|
13897
13897
|
this.muted = !0;
|
|
13898
13898
|
}
|
|
13899
|
-
|
|
13899
|
+
ea(t, e) {
|
|
13900
13900
|
this.muted || setTimeout((() => {
|
|
13901
13901
|
this.muted || t(e);
|
|
13902
13902
|
}), 0);
|
|
@@ -13924,32 +13924,32 @@ class jc {
|
|
|
13924
13924
|
*
|
|
13925
13925
|
* Takes a bundle stream or buffer, and presents abstractions to read bundled
|
|
13926
13926
|
* elements out of the underlying content.
|
|
13927
|
-
*/ class
|
|
13927
|
+
*/ class Qa {
|
|
13928
13928
|
constructor(
|
|
13929
13929
|
/** The reader to read from underlying binary bundle data source. */
|
|
13930
13930
|
t, e) {
|
|
13931
|
-
this.
|
|
13931
|
+
this.sa = t, this.k = e,
|
|
13932
13932
|
/** Cached bundle metadata. */
|
|
13933
13933
|
this.metadata = new W,
|
|
13934
13934
|
/**
|
|
13935
13935
|
* Internal buffer to hold bundle content, accumulating incomplete element
|
|
13936
13936
|
* content.
|
|
13937
13937
|
*/
|
|
13938
|
-
this.buffer = new Uint8Array, this.
|
|
13938
|
+
this.buffer = new Uint8Array, this.ia = new TextDecoder("utf-8"),
|
|
13939
13939
|
// Read the metadata (which is the first element).
|
|
13940
|
-
this.
|
|
13940
|
+
this.ra().then((t => {
|
|
13941
13941
|
t && t._o() ? 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)}`));
|
|
13942
13942
|
}), (t => this.metadata.reject(t)));
|
|
13943
13943
|
}
|
|
13944
13944
|
close() {
|
|
13945
|
-
return this.
|
|
13945
|
+
return this.sa.cancel();
|
|
13946
13946
|
}
|
|
13947
13947
|
async getMetadata() {
|
|
13948
13948
|
return this.metadata.promise;
|
|
13949
13949
|
}
|
|
13950
13950
|
async Ho() {
|
|
13951
13951
|
// Makes sure metadata is read before proceeding.
|
|
13952
|
-
return await this.getMetadata(), this.
|
|
13952
|
+
return await this.getMetadata(), this.ra();
|
|
13953
13953
|
}
|
|
13954
13954
|
/**
|
|
13955
13955
|
* Reads from the head of internal buffer, and pulling more data from
|
|
@@ -13960,15 +13960,15 @@ class jc {
|
|
|
13960
13960
|
*
|
|
13961
13961
|
* Returns either the bundled element, or null if we have reached the end of
|
|
13962
13962
|
* the stream.
|
|
13963
|
-
*/ async
|
|
13964
|
-
const t = await this.
|
|
13963
|
+
*/ async ra() {
|
|
13964
|
+
const t = await this.oa();
|
|
13965
13965
|
if (null === t) return null;
|
|
13966
|
-
const e = this.
|
|
13967
|
-
isNaN(n) && this.
|
|
13968
|
-
const s = await this.
|
|
13966
|
+
const e = this.ia.decode(t), n = Number(e);
|
|
13967
|
+
isNaN(n) && this.aa(`length string (${e}) is not valid number`);
|
|
13968
|
+
const s = await this.ca(n);
|
|
13969
13969
|
return new Yo(JSON.parse(s), t.length + n);
|
|
13970
13970
|
}
|
|
13971
|
-
/** First index of '{' from the underlying buffer. */
|
|
13971
|
+
/** First index of '{' from the underlying buffer. */ ua() {
|
|
13972
13972
|
return this.buffer.findIndex((t => t === "{".charCodeAt(0)));
|
|
13973
13973
|
}
|
|
13974
13974
|
/**
|
|
@@ -13976,17 +13976,17 @@ class jc {
|
|
|
13976
13976
|
* return the content.
|
|
13977
13977
|
*
|
|
13978
13978
|
* If reached end of the stream, returns a null.
|
|
13979
|
-
*/ async
|
|
13980
|
-
for (;this.
|
|
13981
|
-
if (await this.
|
|
13979
|
+
*/ async oa() {
|
|
13980
|
+
for (;this.ua() < 0; ) {
|
|
13981
|
+
if (await this.ha()) break;
|
|
13982
13982
|
}
|
|
13983
13983
|
// Broke out of the loop because underlying stream is closed, and there
|
|
13984
13984
|
// happens to be no more data to process.
|
|
13985
13985
|
if (0 === this.buffer.length) return null;
|
|
13986
|
-
const t = this.
|
|
13986
|
+
const t = this.ua();
|
|
13987
13987
|
// Broke out of the loop because underlying stream is closed, but still
|
|
13988
13988
|
// cannot find an open bracket.
|
|
13989
|
-
t < 0 && this.
|
|
13989
|
+
t < 0 && this.aa("Reached the end of bundle when a length string is expected.");
|
|
13990
13990
|
const e = this.buffer.slice(0, t);
|
|
13991
13991
|
// Update the internal buffer to drop the read length.
|
|
13992
13992
|
return this.buffer = this.buffer.slice(t), e;
|
|
@@ -13996,23 +13996,23 @@ class jc {
|
|
|
13996
13996
|
* number of bytes, pulling more data from the underlying stream if needed.
|
|
13997
13997
|
*
|
|
13998
13998
|
* Returns a string decoded from the read bytes.
|
|
13999
|
-
*/ async
|
|
13999
|
+
*/ async ca(t) {
|
|
14000
14000
|
for (;this.buffer.length < t; ) {
|
|
14001
|
-
await this.
|
|
14001
|
+
await this.ha() && this.aa("Reached the end of bundle when more is expected.");
|
|
14002
14002
|
}
|
|
14003
|
-
const e = this.
|
|
14003
|
+
const e = this.ia.decode(this.buffer.slice(0, t));
|
|
14004
14004
|
// Update the internal buffer to drop the read json string.
|
|
14005
14005
|
return this.buffer = this.buffer.slice(t), e;
|
|
14006
14006
|
}
|
|
14007
|
-
|
|
14007
|
+
aa(t) {
|
|
14008
14008
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
14009
|
-
throw this.
|
|
14009
|
+
throw this.sa.cancel(), new Error(`Invalid bundle format: ${t}`);
|
|
14010
14010
|
}
|
|
14011
14011
|
/**
|
|
14012
14012
|
* Pulls more data from underlying stream to internal buffer.
|
|
14013
14013
|
* Returns a boolean indicating whether the stream is finished.
|
|
14014
|
-
*/ async
|
|
14015
|
-
const t = await this.
|
|
14014
|
+
*/ async ha() {
|
|
14015
|
+
const t = await this.sa.read();
|
|
14016
14016
|
if (!t.done) {
|
|
14017
14017
|
const e = new Uint8Array(this.buffer.length + t.value.length);
|
|
14018
14018
|
e.set(this.buffer), e.set(t.value, this.buffer.length), this.buffer = e;
|
|
@@ -14041,7 +14041,7 @@ class jc {
|
|
|
14041
14041
|
* Internal transaction object responsible for accumulating the mutations to
|
|
14042
14042
|
* perform and the base versions for any documents read.
|
|
14043
14043
|
*/
|
|
14044
|
-
class
|
|
14044
|
+
class Wa {
|
|
14045
14045
|
constructor(t) {
|
|
14046
14046
|
this.datastore = t,
|
|
14047
14047
|
// The version of each document that was read during this transaction.
|
|
@@ -14069,11 +14069,11 @@ class Wc {
|
|
|
14069
14069
|
const e = os(n.k, t);
|
|
14070
14070
|
o.set(e.key.toString(), e);
|
|
14071
14071
|
}));
|
|
14072
|
-
const
|
|
14072
|
+
const a = [];
|
|
14073
14073
|
return e.forEach((t => {
|
|
14074
14074
|
const e = o.get(t.toString());
|
|
14075
|
-
U(!!e),
|
|
14076
|
-
})),
|
|
14075
|
+
U(!!e), a.push(e);
|
|
14076
|
+
})), a;
|
|
14077
14077
|
}(this.datastore, t);
|
|
14078
14078
|
return e.forEach((t => this.recordVersion(t))), e;
|
|
14079
14079
|
}
|
|
@@ -14105,7 +14105,7 @@ class Wc {
|
|
|
14105
14105
|
this.mutations.push(new dn(n, this.precondition(n)));
|
|
14106
14106
|
})), await async function(t, e) {
|
|
14107
14107
|
const n = K(t), s = ns(n.k) + "/documents", i = {
|
|
14108
|
-
writes: e.map((t =>
|
|
14108
|
+
writes: e.map((t => cs(n.k, t)))
|
|
14109
14109
|
};
|
|
14110
14110
|
await n.Bi("Commit", s, i);
|
|
14111
14111
|
}(this.datastore, this.mutations), this.committed = !0;
|
|
@@ -14182,29 +14182,29 @@ class Wc {
|
|
|
14182
14182
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
14183
14183
|
* with backoff.
|
|
14184
14184
|
*/
|
|
14185
|
-
class
|
|
14185
|
+
class Ga {
|
|
14186
14186
|
constructor(t, e, n, s) {
|
|
14187
14187
|
this.asyncQueue = t, this.datastore = e, this.updateFunction = n, this.deferred = s,
|
|
14188
|
-
this.
|
|
14188
|
+
this.la = 5, this.ur = new so(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
14189
14189
|
}
|
|
14190
14190
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
14191
|
-
this.
|
|
14191
|
+
this.la -= 1, this.fa();
|
|
14192
14192
|
}
|
|
14193
|
-
|
|
14193
|
+
fa() {
|
|
14194
14194
|
this.ur.Zi((async () => {
|
|
14195
|
-
const t = new
|
|
14195
|
+
const t = new Wa(this.datastore), e = this.da(t);
|
|
14196
14196
|
e && e.then((e => {
|
|
14197
14197
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
14198
14198
|
this.deferred.resolve(e);
|
|
14199
14199
|
})).catch((t => {
|
|
14200
|
-
this.
|
|
14200
|
+
this.wa(t);
|
|
14201
14201
|
}))));
|
|
14202
14202
|
})).catch((t => {
|
|
14203
|
-
this.
|
|
14203
|
+
this.wa(t);
|
|
14204
14204
|
}));
|
|
14205
14205
|
}));
|
|
14206
14206
|
}
|
|
14207
|
-
|
|
14207
|
+
da(t) {
|
|
14208
14208
|
try {
|
|
14209
14209
|
const e = this.updateFunction(t);
|
|
14210
14210
|
return !Vt(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
@@ -14214,11 +14214,11 @@ class Gc {
|
|
|
14214
14214
|
return this.deferred.reject(t), null;
|
|
14215
14215
|
}
|
|
14216
14216
|
}
|
|
14217
|
-
|
|
14218
|
-
this.
|
|
14217
|
+
wa(t) {
|
|
14218
|
+
this.la > 0 && this._a(t) ? (this.la -= 1, this.asyncQueue.enqueueAndForget((() => (this.fa(),
|
|
14219
14219
|
Promise.resolve())))) : this.deferred.reject(t);
|
|
14220
14220
|
}
|
|
14221
|
-
|
|
14221
|
+
_a(t) {
|
|
14222
14222
|
if ("FirebaseError" === t.name) {
|
|
14223
14223
|
// In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
|
|
14224
14224
|
// non-matching document versions with ABORTED. These errors should be retried.
|
|
@@ -14250,7 +14250,7 @@ class Gc {
|
|
|
14250
14250
|
* pieces of the client SDK architecture. It is responsible for creating the
|
|
14251
14251
|
* async queue that is shared by all of the other components in the system.
|
|
14252
14252
|
*/
|
|
14253
|
-
class
|
|
14253
|
+
class za {
|
|
14254
14254
|
constructor(t, e,
|
|
14255
14255
|
/**
|
|
14256
14256
|
* Asynchronous queue responsible for all of our internal processing. When
|
|
@@ -14308,7 +14308,7 @@ class zc {
|
|
|
14308
14308
|
}
|
|
14309
14309
|
}
|
|
14310
14310
|
|
|
14311
|
-
async function
|
|
14311
|
+
async function Ha(t, e) {
|
|
14312
14312
|
t.asyncQueue.verifyOperationInProgress(), F("FirestoreClient", "Initializing OfflineComponentProvider");
|
|
14313
14313
|
const n = await t.getConfiguration();
|
|
14314
14314
|
await e.initialize(n);
|
|
@@ -14321,9 +14321,9 @@ async function Hc(t, e) {
|
|
|
14321
14321
|
e.persistence.setDatabaseDeletedListener((() => t.terminate())), t.offlineComponents = e;
|
|
14322
14322
|
}
|
|
14323
14323
|
|
|
14324
|
-
async function
|
|
14324
|
+
async function Ja(t, e) {
|
|
14325
14325
|
t.asyncQueue.verifyOperationInProgress();
|
|
14326
|
-
const n = await
|
|
14326
|
+
const n = await Ya(t);
|
|
14327
14327
|
F("FirestoreClient", "Initializing OnlineComponentProvider");
|
|
14328
14328
|
const s = await t.getConfiguration();
|
|
14329
14329
|
await e.initialize(n, s),
|
|
@@ -14343,41 +14343,41 @@ async function Jc(t, e) {
|
|
|
14343
14343
|
}(e.remoteStore, t))), t.onlineComponents = e;
|
|
14344
14344
|
}
|
|
14345
14345
|
|
|
14346
|
-
async function
|
|
14346
|
+
async function Ya(t) {
|
|
14347
14347
|
return t.offlineComponents || (F("FirestoreClient", "Using default OfflineComponentProvider"),
|
|
14348
|
-
await
|
|
14348
|
+
await Ha(t, new La)), t.offlineComponents;
|
|
14349
14349
|
}
|
|
14350
14350
|
|
|
14351
|
-
async function
|
|
14351
|
+
async function Xa(t) {
|
|
14352
14352
|
return t.onlineComponents || (F("FirestoreClient", "Using default OnlineComponentProvider"),
|
|
14353
|
-
await
|
|
14353
|
+
await Ja(t, new qa)), t.onlineComponents;
|
|
14354
14354
|
}
|
|
14355
14355
|
|
|
14356
|
-
function
|
|
14357
|
-
return
|
|
14356
|
+
function Za(t) {
|
|
14357
|
+
return Ya(t).then((t => t.persistence));
|
|
14358
14358
|
}
|
|
14359
14359
|
|
|
14360
|
-
function
|
|
14361
|
-
return
|
|
14360
|
+
function tc(t) {
|
|
14361
|
+
return Ya(t).then((t => t.localStore));
|
|
14362
14362
|
}
|
|
14363
14363
|
|
|
14364
|
-
function
|
|
14365
|
-
return
|
|
14364
|
+
function ec(t) {
|
|
14365
|
+
return Xa(t).then((t => t.remoteStore));
|
|
14366
14366
|
}
|
|
14367
14367
|
|
|
14368
|
-
function
|
|
14369
|
-
return
|
|
14368
|
+
function nc(t) {
|
|
14369
|
+
return Xa(t).then((t => t.syncEngine));
|
|
14370
14370
|
}
|
|
14371
14371
|
|
|
14372
|
-
async function
|
|
14373
|
-
const e = await
|
|
14374
|
-
return n.onListen =
|
|
14372
|
+
async function sc(t) {
|
|
14373
|
+
const e = await Xa(t), n = e.eventManager;
|
|
14374
|
+
return n.onListen = aa.bind(null, e.syncEngine), n.onUnlisten = ua.bind(null, e.syncEngine),
|
|
14375
14375
|
n;
|
|
14376
14376
|
}
|
|
14377
14377
|
|
|
14378
|
-
/** Enables the network connection and re-enqueues all pending operations. */ function
|
|
14378
|
+
/** Enables the network connection and re-enqueues all pending operations. */ function ic(t) {
|
|
14379
14379
|
return t.asyncQueue.enqueue((async () => {
|
|
14380
|
-
const e = await
|
|
14380
|
+
const e = await Za(t), n = await ec(t);
|
|
14381
14381
|
return e.setNetworkEnabled(!0), function(t) {
|
|
14382
14382
|
const e = K(t);
|
|
14383
14383
|
return e.Gr.delete(0 /* UserDisabled */), ho(e);
|
|
@@ -14385,9 +14385,9 @@ async function sa(t) {
|
|
|
14385
14385
|
}));
|
|
14386
14386
|
}
|
|
14387
14387
|
|
|
14388
|
-
/** Disables the network connection. Pending operations will not complete. */ function
|
|
14388
|
+
/** Disables the network connection. Pending operations will not complete. */ function rc(t) {
|
|
14389
14389
|
return t.asyncQueue.enqueue((async () => {
|
|
14390
|
-
const e = await
|
|
14390
|
+
const e = await Za(t), n = await ec(t);
|
|
14391
14391
|
return e.setNetworkEnabled(!1), async function(t) {
|
|
14392
14392
|
const e = K(t);
|
|
14393
14393
|
e.Gr.add(0 /* UserDisabled */), await lo(e),
|
|
@@ -14401,7 +14401,7 @@ async function sa(t) {
|
|
|
14401
14401
|
* Returns a Promise that resolves when all writes that were pending at the time
|
|
14402
14402
|
* this method was called received server acknowledgement. An acknowledgement
|
|
14403
14403
|
* can be either acceptance or rejection.
|
|
14404
|
-
*/ function
|
|
14404
|
+
*/ function oc(t, e) {
|
|
14405
14405
|
const n = new W;
|
|
14406
14406
|
return t.asyncQueue.enqueueAndForget((async () => async function(t, e, n) {
|
|
14407
14407
|
try {
|
|
@@ -14418,19 +14418,19 @@ async function sa(t) {
|
|
|
14418
14418
|
/**
|
|
14419
14419
|
* Retrieves a latency-compensated document from the backend via a
|
|
14420
14420
|
* SnapshotListener.
|
|
14421
|
-
*/ (await
|
|
14421
|
+
*/ (await tc(t), e, n))), n.promise;
|
|
14422
14422
|
}
|
|
14423
14423
|
|
|
14424
|
-
function
|
|
14424
|
+
function ac(t, e, n = {}) {
|
|
14425
14425
|
const s = new W;
|
|
14426
14426
|
return t.asyncQueue.enqueueAndForget((async () => function(t, e, n, s, i) {
|
|
14427
|
-
const r = new
|
|
14427
|
+
const r = new ja({
|
|
14428
14428
|
next: r => {
|
|
14429
14429
|
// Remove query first before passing event to user to avoid
|
|
14430
14430
|
// user actions affecting the now stale query.
|
|
14431
14431
|
e.enqueueAndForget((() => Wo(t, o)));
|
|
14432
|
-
const
|
|
14433
|
-
!
|
|
14432
|
+
const a = r.docs.has(n);
|
|
14433
|
+
!a && r.fromCache ?
|
|
14434
14434
|
// TODO(dimond): If we're online and the document doesn't
|
|
14435
14435
|
// exist then we resolve with a doc.exists set to false. If
|
|
14436
14436
|
// we're offline however, we reject the Promise in this
|
|
@@ -14438,7 +14438,7 @@ function ca(t, e, n = {}) {
|
|
|
14438
14438
|
// the server so we can deliver that even when you're
|
|
14439
14439
|
// offline 2) Actually reject the Promise in the online case
|
|
14440
14440
|
// if the document doesn't exist.
|
|
14441
|
-
i.reject(new Q(j.UNAVAILABLE, "Failed to get document because the client is offline.")) :
|
|
14441
|
+
i.reject(new Q(j.UNAVAILABLE, "Failed to get document because the client is offline.")) : a && r.fromCache && s && "server" === s.source ? i.reject(new Q(j.UNAVAILABLE, 'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')) : i.resolve(r);
|
|
14442
14442
|
},
|
|
14443
14443
|
error: t => i.reject(t)
|
|
14444
14444
|
}), o = new Jo(pe(n.path), r, {
|
|
@@ -14446,15 +14446,15 @@ function ca(t, e, n = {}) {
|
|
|
14446
14446
|
wo: !0
|
|
14447
14447
|
});
|
|
14448
14448
|
return Qo(t, o);
|
|
14449
|
-
}(await
|
|
14449
|
+
}(await sc(t), t.asyncQueue, e, n, s))), s.promise;
|
|
14450
14450
|
}
|
|
14451
14451
|
|
|
14452
|
-
function
|
|
14452
|
+
function cc(t, e) {
|
|
14453
14453
|
const n = new W;
|
|
14454
14454
|
return t.asyncQueue.enqueueAndForget((async () => async function(t, e, n) {
|
|
14455
14455
|
try {
|
|
14456
14456
|
const s = await Ar(t, e,
|
|
14457
|
-
/* usePreviousResults= */ !0), i = new
|
|
14457
|
+
/* usePreviousResults= */ !0), i = new sa(e, s.zn), r = i.Po(s.documents), o = i.applyChanges(r,
|
|
14458
14458
|
/* updateLimboDocuments= */ !1);
|
|
14459
14459
|
n.resolve(o.snapshot);
|
|
14460
14460
|
} catch (t) {
|
|
@@ -14465,13 +14465,13 @@ function aa(t, e) {
|
|
|
14465
14465
|
/**
|
|
14466
14466
|
* Retrieves a latency-compensated query snapshot from the backend via a
|
|
14467
14467
|
* SnapshotListener.
|
|
14468
|
-
*/ (await
|
|
14468
|
+
*/ (await tc(t), e, n))), n.promise;
|
|
14469
14469
|
}
|
|
14470
14470
|
|
|
14471
|
-
function
|
|
14471
|
+
function uc(t, e, n = {}) {
|
|
14472
14472
|
const s = new W;
|
|
14473
14473
|
return t.asyncQueue.enqueueAndForget((async () => function(t, e, n, s, i) {
|
|
14474
|
-
const r = new
|
|
14474
|
+
const r = new ja({
|
|
14475
14475
|
next: n => {
|
|
14476
14476
|
// Remove query first before passing event to user to avoid
|
|
14477
14477
|
// user actions affecting the now stale query.
|
|
@@ -14483,20 +14483,20 @@ function ua(t, e, n = {}) {
|
|
|
14483
14483
|
wo: !0
|
|
14484
14484
|
});
|
|
14485
14485
|
return Qo(t, o);
|
|
14486
|
-
}(await
|
|
14486
|
+
}(await sc(t), t.asyncQueue, e, n, s))), s.promise;
|
|
14487
14487
|
}
|
|
14488
14488
|
|
|
14489
|
-
function
|
|
14490
|
-
const n = new
|
|
14489
|
+
function hc(t, e) {
|
|
14490
|
+
const n = new ja(e);
|
|
14491
14491
|
return t.asyncQueue.enqueueAndForget((async () => function(t, e) {
|
|
14492
14492
|
K(t).io.add(e),
|
|
14493
14493
|
// Immediately fire an initial event, indicating all existing listeners
|
|
14494
14494
|
// are in-sync.
|
|
14495
14495
|
e.next();
|
|
14496
|
-
}(await
|
|
14497
|
-
n.
|
|
14496
|
+
}(await sc(t), n))), () => {
|
|
14497
|
+
n.na(), t.asyncQueue.enqueueAndForget((async () => function(t, e) {
|
|
14498
14498
|
K(t).io.delete(e);
|
|
14499
|
-
}(await
|
|
14499
|
+
}(await sc(t), n)));
|
|
14500
14500
|
};
|
|
14501
14501
|
}
|
|
14502
14502
|
|
|
@@ -14514,25 +14514,25 @@ function ha(t, e) {
|
|
|
14514
14514
|
* accessed with the transaction will not reflect local changes that have not
|
|
14515
14515
|
* been committed. For this reason, it is required that all reads are
|
|
14516
14516
|
* performed before any writes. Transactions must be performed while online.
|
|
14517
|
-
*/ function
|
|
14517
|
+
*/ function lc(t, e) {
|
|
14518
14518
|
const n = new W;
|
|
14519
14519
|
return t.asyncQueue.enqueueAndForget((async () => {
|
|
14520
14520
|
const s = await function(t) {
|
|
14521
|
-
return
|
|
14521
|
+
return Xa(t).then((t => t.datastore));
|
|
14522
14522
|
}(t);
|
|
14523
|
-
new
|
|
14523
|
+
new Ga(t.asyncQueue, s, e, n).run();
|
|
14524
14524
|
})), n.promise;
|
|
14525
14525
|
}
|
|
14526
14526
|
|
|
14527
|
-
function
|
|
14527
|
+
function fc(t, e, n, s) {
|
|
14528
14528
|
const i = function(t, e) {
|
|
14529
14529
|
let n;
|
|
14530
14530
|
n = "string" == typeof t ? (new TextEncoder).encode(t) : t;
|
|
14531
14531
|
return function(t, e) {
|
|
14532
|
-
return new
|
|
14532
|
+
return new Qa(t, e);
|
|
14533
14533
|
}(function(t, e) {
|
|
14534
|
-
if (t instanceof Uint8Array) return
|
|
14535
|
-
if (t instanceof ArrayBuffer) return
|
|
14534
|
+
if (t instanceof Uint8Array) return Ka(t, e);
|
|
14535
|
+
if (t instanceof ArrayBuffer) return Ka(new Uint8Array(t), e);
|
|
14536
14536
|
if (t instanceof ReadableStream) return t.getReader();
|
|
14537
14537
|
throw new Error("Source of `toByteStreamReader` has to be a ArrayBuffer or ReadableStream");
|
|
14538
14538
|
}(n), e);
|
|
@@ -14554,18 +14554,18 @@ function fa(t, e, n, s) {
|
|
|
14554
14554
|
* limitations under the License.
|
|
14555
14555
|
*/ (n, no(e));
|
|
14556
14556
|
t.asyncQueue.enqueueAndForget((async () => {
|
|
14557
|
-
|
|
14557
|
+
Ma(await nc(t), i, s);
|
|
14558
14558
|
}));
|
|
14559
14559
|
}
|
|
14560
14560
|
|
|
14561
|
-
function
|
|
14561
|
+
function dc(t, e) {
|
|
14562
14562
|
return t.asyncQueue.enqueue((async () => function(t, e) {
|
|
14563
14563
|
const n = K(t);
|
|
14564
14564
|
return n.persistence.runTransaction("Get named query", "readonly", (t => n.Ye.getNamedQuery(t, e)));
|
|
14565
|
-
}(await
|
|
14565
|
+
}(await tc(t), e)));
|
|
14566
14566
|
}
|
|
14567
14567
|
|
|
14568
|
-
class
|
|
14568
|
+
class wc {
|
|
14569
14569
|
/**
|
|
14570
14570
|
* Constructs a DatabaseInfo using the provided host, databaseId and
|
|
14571
14571
|
* persistenceKey.
|
|
@@ -14583,9 +14583,9 @@ class wa {
|
|
|
14583
14583
|
* @param useFetchStreams Whether to use the Fetch API instead of
|
|
14584
14584
|
* XMLHTTPRequest
|
|
14585
14585
|
*/
|
|
14586
|
-
constructor(t, e, n, s, i, r, o,
|
|
14586
|
+
constructor(t, e, n, s, i, r, o, a) {
|
|
14587
14587
|
this.databaseId = t, this.appId = e, this.persistenceKey = n, this.host = s, this.ssl = i,
|
|
14588
|
-
this.forceLongPolling = r, this.autoDetectLongPolling = o, this.useFetchStreams =
|
|
14588
|
+
this.forceLongPolling = r, this.autoDetectLongPolling = o, this.useFetchStreams = a;
|
|
14589
14589
|
}
|
|
14590
14590
|
}
|
|
14591
14591
|
|
|
@@ -14594,7 +14594,7 @@ class wa {
|
|
|
14594
14594
|
* Represents the database ID a Firestore client is associated with.
|
|
14595
14595
|
* @internal
|
|
14596
14596
|
*/
|
|
14597
|
-
class
|
|
14597
|
+
class _c {
|
|
14598
14598
|
constructor(t, e) {
|
|
14599
14599
|
this.projectId = t, this.database = e || "(default)";
|
|
14600
14600
|
}
|
|
@@ -14602,7 +14602,7 @@ class _a {
|
|
|
14602
14602
|
return "(default)" === this.database;
|
|
14603
14603
|
}
|
|
14604
14604
|
isEqual(t) {
|
|
14605
|
-
return t instanceof
|
|
14605
|
+
return t instanceof _c && t.projectId === this.projectId && t.database === this.database;
|
|
14606
14606
|
}
|
|
14607
14607
|
}
|
|
14608
14608
|
|
|
@@ -14621,7 +14621,7 @@ class _a {
|
|
|
14621
14621
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14622
14622
|
* See the License for the specific language governing permissions and
|
|
14623
14623
|
* limitations under the License.
|
|
14624
|
-
*/ const
|
|
14624
|
+
*/ const mc = new Map;
|
|
14625
14625
|
|
|
14626
14626
|
/**
|
|
14627
14627
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -14643,28 +14643,28 @@ class _a {
|
|
|
14643
14643
|
* See the License for the specific language governing permissions and
|
|
14644
14644
|
* limitations under the License.
|
|
14645
14645
|
*/
|
|
14646
|
-
function
|
|
14646
|
+
function gc(t, e, n) {
|
|
14647
14647
|
if (!n) throw new Q(j.INVALID_ARGUMENT, `Function ${t}() cannot be called with an empty ${e}.`);
|
|
14648
14648
|
}
|
|
14649
14649
|
|
|
14650
14650
|
/**
|
|
14651
14651
|
* Validates that two boolean options are not set at the same time.
|
|
14652
14652
|
* @internal
|
|
14653
|
-
*/ function
|
|
14653
|
+
*/ function yc(t, e, n, s) {
|
|
14654
14654
|
if (!0 === e && !0 === s) throw new Q(j.INVALID_ARGUMENT, `${t} and ${n} cannot be used together.`);
|
|
14655
14655
|
}
|
|
14656
14656
|
|
|
14657
14657
|
/**
|
|
14658
14658
|
* Validates that `path` refers to a document (indicated by the fact it contains
|
|
14659
14659
|
* an even numbers of segments).
|
|
14660
|
-
*/ function
|
|
14660
|
+
*/ function pc(t) {
|
|
14661
14661
|
if (!Ct.isDocumentKey(t)) throw new Q(j.INVALID_ARGUMENT, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
|
|
14662
14662
|
}
|
|
14663
14663
|
|
|
14664
14664
|
/**
|
|
14665
14665
|
* Validates that `path` refers to a collection (indicated by the fact it
|
|
14666
14666
|
* contains an odd numbers of segments).
|
|
14667
|
-
*/ function
|
|
14667
|
+
*/ function Tc(t) {
|
|
14668
14668
|
if (Ct.isDocumentKey(t)) throw new Q(j.INVALID_ARGUMENT, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
|
|
14669
14669
|
}
|
|
14670
14670
|
|
|
@@ -14673,7 +14673,7 @@ function ga(t, e, n) {
|
|
|
14673
14673
|
* (i.e. excludes Array, Date, etc.).
|
|
14674
14674
|
*/
|
|
14675
14675
|
/** Returns a string describing the type / value of the provided input. */
|
|
14676
|
-
function
|
|
14676
|
+
function Ec(t) {
|
|
14677
14677
|
if (void 0 === t) return "undefined";
|
|
14678
14678
|
if (null === t) return "null";
|
|
14679
14679
|
if ("string" == typeof t) return t.length > 20 && (t = `${t.substring(0, 20)}...`),
|
|
@@ -14702,7 +14702,7 @@ function Ea(t) {
|
|
|
14702
14702
|
return "function" == typeof t ? "a function" : B();
|
|
14703
14703
|
}
|
|
14704
14704
|
|
|
14705
|
-
function
|
|
14705
|
+
function Ic(t,
|
|
14706
14706
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14707
14707
|
e) {
|
|
14708
14708
|
if ("_delegate" in t && (
|
|
@@ -14711,14 +14711,14 @@ e) {
|
|
|
14711
14711
|
t = t._delegate), !(t instanceof e)) {
|
|
14712
14712
|
if (e.name === t.constructor.name) throw new Q(j.INVALID_ARGUMENT, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
|
|
14713
14713
|
{
|
|
14714
|
-
const n =
|
|
14714
|
+
const n = Ec(t);
|
|
14715
14715
|
throw new Q(j.INVALID_ARGUMENT, `Expected type '${e.name}', but it was: ${n}`);
|
|
14716
14716
|
}
|
|
14717
14717
|
}
|
|
14718
14718
|
return t;
|
|
14719
14719
|
}
|
|
14720
14720
|
|
|
14721
|
-
function
|
|
14721
|
+
function Ac(t, e) {
|
|
14722
14722
|
if (e <= 0) throw new Q(j.INVALID_ARGUMENT, `Function ${t}() requires a positive number, but it was: ${e}.`);
|
|
14723
14723
|
}
|
|
14724
14724
|
|
|
@@ -14744,7 +14744,7 @@ function Aa(t, e) {
|
|
|
14744
14744
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
14745
14745
|
* defaults can be supplied and the value can be checked for equality.
|
|
14746
14746
|
*/
|
|
14747
|
-
class
|
|
14747
|
+
class Rc {
|
|
14748
14748
|
constructor(t) {
|
|
14749
14749
|
var e;
|
|
14750
14750
|
if (void 0 === t.host) {
|
|
@@ -14757,7 +14757,7 @@ class Ra {
|
|
|
14757
14757
|
this.cacheSizeBytes = t.cacheSizeBytes;
|
|
14758
14758
|
}
|
|
14759
14759
|
this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
|
|
14760
|
-
this.useFetchStreams = !!t.useFetchStreams,
|
|
14760
|
+
this.useFetchStreams = !!t.useFetchStreams, yc("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
|
|
14761
14761
|
}
|
|
14762
14762
|
isEqual(t) {
|
|
14763
14763
|
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;
|
|
@@ -14784,18 +14784,18 @@ class Ra {
|
|
|
14784
14784
|
* The Cloud Firestore service interface.
|
|
14785
14785
|
*
|
|
14786
14786
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
14787
|
-
*/ class
|
|
14787
|
+
*/ class bc {
|
|
14788
14788
|
/** @hideconstructor */
|
|
14789
14789
|
constructor(t, e, n) {
|
|
14790
14790
|
this._authCredentials = e, this._appCheckCredentials = n,
|
|
14791
14791
|
/**
|
|
14792
14792
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
14793
14793
|
*/
|
|
14794
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
14795
|
-
this._settingsFrozen = !1, t instanceof
|
|
14794
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new Rc({}),
|
|
14795
|
+
this._settingsFrozen = !1, t instanceof _c ? this._databaseId = t : (this._app = t,
|
|
14796
14796
|
this._databaseId = function(t) {
|
|
14797
14797
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new Q(j.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
|
|
14798
|
-
return new
|
|
14798
|
+
return new _c(t.options.projectId);
|
|
14799
14799
|
}
|
|
14800
14800
|
/**
|
|
14801
14801
|
* Modify this instance to communicate with the Cloud Firestore emulator.
|
|
@@ -14826,7 +14826,7 @@ class Ra {
|
|
|
14826
14826
|
}
|
|
14827
14827
|
_setSettings(t) {
|
|
14828
14828
|
if (this._settingsFrozen) throw new Q(j.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.");
|
|
14829
|
-
this._settings = new
|
|
14829
|
+
this._settings = new Rc(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
14830
14830
|
if (!t) return new z;
|
|
14831
14831
|
switch (t.type) {
|
|
14832
14832
|
case "gapi":
|
|
@@ -14871,15 +14871,15 @@ class Ra {
|
|
|
14871
14871
|
* when the `Firestore` instance is terminated.
|
|
14872
14872
|
*/
|
|
14873
14873
|
return function(t) {
|
|
14874
|
-
const e =
|
|
14875
|
-
e && (F("ComponentProvider", "Removing Datastore"),
|
|
14874
|
+
const e = mc.get(t);
|
|
14875
|
+
e && (F("ComponentProvider", "Removing Datastore"), mc.delete(t), e.terminate());
|
|
14876
14876
|
}(this), Promise.resolve();
|
|
14877
14877
|
}
|
|
14878
14878
|
}
|
|
14879
14879
|
|
|
14880
|
-
function
|
|
14880
|
+
function Pc(t, e, n, s = {}) {
|
|
14881
14881
|
var i;
|
|
14882
|
-
const r = (t =
|
|
14882
|
+
const r = (t = Ic(t, bc))._getSettings();
|
|
14883
14883
|
if ("firestore.googleapis.com" !== r.host && r.host !== e && M("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
14884
14884
|
t._setSettings(Object.assign(Object.assign({}, r), {
|
|
14885
14885
|
host: `${e}:${n}`,
|
|
@@ -14918,7 +14918,7 @@ function ba(t, e, n, s = {}) {
|
|
|
14918
14918
|
* A `DocumentReference` refers to a document location in a Firestore database
|
|
14919
14919
|
* and can be used to write, read, or listen to the location. The document at
|
|
14920
14920
|
* the referenced location may or may not exist.
|
|
14921
|
-
*/ class
|
|
14921
|
+
*/ class vc {
|
|
14922
14922
|
/** @hideconstructor */
|
|
14923
14923
|
constructor(t,
|
|
14924
14924
|
/**
|
|
@@ -14946,17 +14946,17 @@ function ba(t, e, n, s = {}) {
|
|
|
14946
14946
|
/**
|
|
14947
14947
|
* The collection this `DocumentReference` belongs to.
|
|
14948
14948
|
*/ get parent() {
|
|
14949
|
-
return new
|
|
14949
|
+
return new Sc(this.firestore, this.converter, this._key.path.popLast());
|
|
14950
14950
|
}
|
|
14951
14951
|
withConverter(t) {
|
|
14952
|
-
return new
|
|
14952
|
+
return new vc(this.firestore, t, this._key);
|
|
14953
14953
|
}
|
|
14954
14954
|
}
|
|
14955
14955
|
|
|
14956
14956
|
/**
|
|
14957
14957
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
14958
14958
|
* construct refined `Query` objects by adding filters and ordering.
|
|
14959
|
-
*/ class
|
|
14959
|
+
*/ class Vc {
|
|
14960
14960
|
// This is the lite version of the Query class in the main SDK.
|
|
14961
14961
|
/** @hideconstructor protected */
|
|
14962
14962
|
constructor(t,
|
|
@@ -14969,14 +14969,14 @@ function ba(t, e, n, s = {}) {
|
|
|
14969
14969
|
this.type = "query", this.firestore = t;
|
|
14970
14970
|
}
|
|
14971
14971
|
withConverter(t) {
|
|
14972
|
-
return new
|
|
14972
|
+
return new Vc(this.firestore, t, this._query);
|
|
14973
14973
|
}
|
|
14974
14974
|
}
|
|
14975
14975
|
|
|
14976
14976
|
/**
|
|
14977
14977
|
* A `CollectionReference` object can be used for adding documents, getting
|
|
14978
14978
|
* document references, and querying for documents (using {@link query}).
|
|
14979
|
-
*/ class
|
|
14979
|
+
*/ class Sc extends Vc {
|
|
14980
14980
|
/** @hideconstructor */
|
|
14981
14981
|
constructor(t, e, n) {
|
|
14982
14982
|
super(t, e, pe(n)), this._path = n,
|
|
@@ -14997,23 +14997,23 @@ function ba(t, e, n, s = {}) {
|
|
|
14997
14997
|
* subcollection. If this isn't a subcollection, the reference is null.
|
|
14998
14998
|
*/ get parent() {
|
|
14999
14999
|
const t = this._path.popLast();
|
|
15000
|
-
return t.isEmpty() ? null : new
|
|
15000
|
+
return t.isEmpty() ? null : new vc(this.firestore,
|
|
15001
15001
|
/* converter= */ null, new Ct(t));
|
|
15002
15002
|
}
|
|
15003
15003
|
withConverter(t) {
|
|
15004
|
-
return new
|
|
15004
|
+
return new Sc(this.firestore, t, this._path);
|
|
15005
15005
|
}
|
|
15006
15006
|
}
|
|
15007
15007
|
|
|
15008
|
-
function
|
|
15009
|
-
if (t = p(t),
|
|
15008
|
+
function Dc(t, e, ...n) {
|
|
15009
|
+
if (t = p(t), gc("collection", "path", e), t instanceof bc) {
|
|
15010
15010
|
const s = wt.fromString(e, ...n);
|
|
15011
|
-
return
|
|
15011
|
+
return Tc(s), new Sc(t, /* converter= */ null, s);
|
|
15012
15012
|
}
|
|
15013
15013
|
{
|
|
15014
|
-
if (!(t instanceof
|
|
15014
|
+
if (!(t instanceof vc || t instanceof Sc)) throw new Q(j.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
15015
15015
|
const s = t._path.child(wt.fromString(e, ...n));
|
|
15016
|
-
return
|
|
15016
|
+
return Tc(s), new Sc(t.firestore,
|
|
15017
15017
|
/* converter= */ null, s);
|
|
15018
15018
|
}
|
|
15019
15019
|
}
|
|
@@ -15030,9 +15030,9 @@ function Da(t, e, ...n) {
|
|
|
15030
15030
|
* collection or subcollection with this ID as the last segment of its path
|
|
15031
15031
|
* will be included. Cannot contain a slash.
|
|
15032
15032
|
* @returns The created `Query`.
|
|
15033
|
-
*/ function
|
|
15034
|
-
if (t =
|
|
15035
|
-
return new
|
|
15033
|
+
*/ function Cc(t, e) {
|
|
15034
|
+
if (t = Ic(t, bc), gc("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new Q(j.INVALID_ARGUMENT, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
15035
|
+
return new Vc(t,
|
|
15036
15036
|
/* converter= */ null,
|
|
15037
15037
|
/**
|
|
15038
15038
|
* Creates a new Query for a collection group query that matches all documents
|
|
@@ -15043,19 +15043,19 @@ function Da(t, e, ...n) {
|
|
|
15043
15043
|
}(e));
|
|
15044
15044
|
}
|
|
15045
15045
|
|
|
15046
|
-
function
|
|
15046
|
+
function Nc(t, e, ...n) {
|
|
15047
15047
|
if (t = p(t),
|
|
15048
15048
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
15049
15049
|
// 'undefined' and 'null'.
|
|
15050
|
-
1 === arguments.length && (e = it.A()),
|
|
15050
|
+
1 === arguments.length && (e = it.A()), gc("doc", "path", e), t instanceof bc) {
|
|
15051
15051
|
const s = wt.fromString(e, ...n);
|
|
15052
|
-
return
|
|
15052
|
+
return pc(s), new vc(t,
|
|
15053
15053
|
/* converter= */ null, new Ct(s));
|
|
15054
15054
|
}
|
|
15055
15055
|
{
|
|
15056
|
-
if (!(t instanceof
|
|
15056
|
+
if (!(t instanceof vc || t instanceof Sc)) throw new Q(j.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
15057
15057
|
const s = t._path.child(wt.fromString(e, ...n));
|
|
15058
|
-
return
|
|
15058
|
+
return pc(s), new vc(t.firestore, t instanceof Sc ? t.converter : null, new Ct(s));
|
|
15059
15059
|
}
|
|
15060
15060
|
}
|
|
15061
15061
|
|
|
@@ -15066,8 +15066,8 @@ function Na(t, e, ...n) {
|
|
|
15066
15066
|
* @param right - A reference to compare.
|
|
15067
15067
|
* @returns true if the references point to the same location in the same
|
|
15068
15068
|
* Firestore database.
|
|
15069
|
-
*/ function
|
|
15070
|
-
return t = p(t), e = p(e), (t instanceof
|
|
15069
|
+
*/ function kc(t, e) {
|
|
15070
|
+
return t = p(t), e = p(e), (t instanceof vc || t instanceof Sc) && (e instanceof vc || e instanceof Sc) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
|
|
15071
15071
|
}
|
|
15072
15072
|
|
|
15073
15073
|
/**
|
|
@@ -15078,8 +15078,8 @@ function Na(t, e, ...n) {
|
|
|
15078
15078
|
* @param right - A `Query` to compare.
|
|
15079
15079
|
* @returns true if the references point to the same location in the same
|
|
15080
15080
|
* Firestore database.
|
|
15081
|
-
*/ function
|
|
15082
|
-
return t = p(t), e = p(e), t instanceof
|
|
15081
|
+
*/ function xc(t, e) {
|
|
15082
|
+
return t = p(t), e = p(e), t instanceof Vc && e instanceof Vc && (t.firestore === e.firestore && Ve(t._query, e._query) && t.converter === e.converter);
|
|
15083
15083
|
}
|
|
15084
15084
|
|
|
15085
15085
|
/**
|
|
@@ -15097,42 +15097,42 @@ function Na(t, e, ...n) {
|
|
|
15097
15097
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15098
15098
|
* See the License for the specific language governing permissions and
|
|
15099
15099
|
* limitations under the License.
|
|
15100
|
-
*/ class $
|
|
15100
|
+
*/ class $c {
|
|
15101
15101
|
constructor() {
|
|
15102
15102
|
// The last promise in the queue.
|
|
15103
|
-
this.
|
|
15103
|
+
this.ma = Promise.resolve(),
|
|
15104
15104
|
// A list of retryable operations. Retryable operations are run in order and
|
|
15105
15105
|
// retried with backoff.
|
|
15106
|
-
this.
|
|
15106
|
+
this.ga = [],
|
|
15107
15107
|
// Is this AsyncQueue being shut down? Once it is set to true, it will not
|
|
15108
15108
|
// be changed again.
|
|
15109
|
-
this.
|
|
15109
|
+
this.ya = !1,
|
|
15110
15110
|
// Operations scheduled to be queued in the future. Operations are
|
|
15111
15111
|
// automatically removed after they are run or canceled.
|
|
15112
|
-
this.
|
|
15112
|
+
this.pa = [],
|
|
15113
15113
|
// visible for testing
|
|
15114
|
-
this.
|
|
15114
|
+
this.Ta = null,
|
|
15115
15115
|
// Flag set while there's an outstanding AsyncQueue operation, used for
|
|
15116
15116
|
// assertion sanity-checks.
|
|
15117
|
-
this.
|
|
15117
|
+
this.Ea = !1,
|
|
15118
15118
|
// Enabled during shutdown on Safari to prevent future access to IndexedDB.
|
|
15119
|
-
this.
|
|
15119
|
+
this.Ia = !1,
|
|
15120
15120
|
// List of TimerIds to fast-forward delays for.
|
|
15121
|
-
this.
|
|
15121
|
+
this.Aa = [],
|
|
15122
15122
|
// Backoff timer used to schedule retries for retryable operations
|
|
15123
15123
|
this.ur = new so(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
15124
15124
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
15125
15125
|
// operations. Meant to speed up recovery when we regain file system access
|
|
15126
15126
|
// after page comes into foreground.
|
|
15127
|
-
this.
|
|
15127
|
+
this.Ra = () => {
|
|
15128
15128
|
const t = eo();
|
|
15129
15129
|
t && F("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.ur.er();
|
|
15130
15130
|
};
|
|
15131
15131
|
const t = eo();
|
|
15132
|
-
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.
|
|
15132
|
+
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Ra);
|
|
15133
15133
|
}
|
|
15134
15134
|
get isShuttingDown() {
|
|
15135
|
-
return this.
|
|
15135
|
+
return this.ya;
|
|
15136
15136
|
}
|
|
15137
15137
|
/**
|
|
15138
15138
|
* Adds a new operation to the queue without waiting for it to complete (i.e.
|
|
@@ -15142,44 +15142,44 @@ function Na(t, e, ...n) {
|
|
|
15142
15142
|
this.enqueue(t);
|
|
15143
15143
|
}
|
|
15144
15144
|
enqueueAndForgetEvenWhileRestricted(t) {
|
|
15145
|
-
this.
|
|
15145
|
+
this.ba(),
|
|
15146
15146
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
15147
|
-
this.
|
|
15147
|
+
this.Pa(t);
|
|
15148
15148
|
}
|
|
15149
15149
|
enterRestrictedMode(t) {
|
|
15150
|
-
if (!this.
|
|
15151
|
-
this.
|
|
15150
|
+
if (!this.ya) {
|
|
15151
|
+
this.ya = !0, this.Ia = t || !1;
|
|
15152
15152
|
const e = eo();
|
|
15153
|
-
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.
|
|
15153
|
+
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Ra);
|
|
15154
15154
|
}
|
|
15155
15155
|
}
|
|
15156
15156
|
enqueue(t) {
|
|
15157
|
-
if (this.
|
|
15157
|
+
if (this.ba(), this.ya)
|
|
15158
15158
|
// Return a Promise which never resolves.
|
|
15159
15159
|
return new Promise((() => {}));
|
|
15160
15160
|
// Create a deferred Promise that we can return to the callee. This
|
|
15161
15161
|
// allows us to return a "hanging Promise" only to the callee and still
|
|
15162
15162
|
// advance the queue even when the operation is not run.
|
|
15163
15163
|
const e = new W;
|
|
15164
|
-
return this.
|
|
15164
|
+
return this.Pa((() => this.ya && this.Ia ? Promise.resolve() : (t().then(e.resolve, e.reject),
|
|
15165
15165
|
e.promise))).then((() => e.promise));
|
|
15166
15166
|
}
|
|
15167
15167
|
enqueueRetryable(t) {
|
|
15168
|
-
this.enqueueAndForget((() => (this.
|
|
15168
|
+
this.enqueueAndForget((() => (this.ga.push(t), this.va())));
|
|
15169
15169
|
}
|
|
15170
15170
|
/**
|
|
15171
15171
|
* Runs the next operation from the retryable queue. If the operation fails,
|
|
15172
15172
|
* reschedules with backoff.
|
|
15173
|
-
*/ async
|
|
15174
|
-
if (0 !== this.
|
|
15173
|
+
*/ async va() {
|
|
15174
|
+
if (0 !== this.ga.length) {
|
|
15175
15175
|
try {
|
|
15176
|
-
await this.
|
|
15176
|
+
await this.ga[0](), this.ga.shift(), this.ur.reset();
|
|
15177
15177
|
} catch (t) {
|
|
15178
15178
|
if (!ti(t)) throw t;
|
|
15179
15179
|
// Failure will be handled by AsyncQueue
|
|
15180
15180
|
F("AsyncQueue", "Operation failed with retryable error: " + t);
|
|
15181
15181
|
}
|
|
15182
|
-
this.
|
|
15182
|
+
this.ga.length > 0 &&
|
|
15183
15183
|
// If there are additional operations, we re-schedule `retryNextOp()`.
|
|
15184
15184
|
// This is necessary to run retryable operations that failed during
|
|
15185
15185
|
// their initial attempt since we don't know whether they are already
|
|
@@ -15190,12 +15190,12 @@ function Na(t, e, ...n) {
|
|
|
15190
15190
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
15191
15191
|
// new backoff on every call, there is only ever a single additional
|
|
15192
15192
|
// operation in the queue.
|
|
15193
|
-
this.ur.Zi((() => this.
|
|
15193
|
+
this.ur.Zi((() => this.va()));
|
|
15194
15194
|
}
|
|
15195
15195
|
}
|
|
15196
|
-
|
|
15197
|
-
const e = this.
|
|
15198
|
-
this.
|
|
15196
|
+
Pa(t) {
|
|
15197
|
+
const e = this.ma.then((() => (this.Ea = !0, t().catch((t => {
|
|
15198
|
+
this.Ta = t, this.Ea = !1;
|
|
15199
15199
|
const e =
|
|
15200
15200
|
/**
|
|
15201
15201
|
* Chrome includes Error.message in Error.stack. Other browsers do not.
|
|
@@ -15227,38 +15227,38 @@ function Na(t, e, ...n) {
|
|
|
15227
15227
|
// all further attempts to chain (via .then) will just short-circuit
|
|
15228
15228
|
// and return the rejected Promise.
|
|
15229
15229
|
throw O("INTERNAL UNHANDLED ERROR: ", e), t;
|
|
15230
|
-
})).then((t => (this.
|
|
15231
|
-
return this.
|
|
15230
|
+
})).then((t => (this.Ea = !1, t))))));
|
|
15231
|
+
return this.ma = e, e;
|
|
15232
15232
|
}
|
|
15233
15233
|
enqueueAfterDelay(t, e, n) {
|
|
15234
|
-
this.
|
|
15234
|
+
this.ba(),
|
|
15235
15235
|
// Fast-forward delays for timerIds that have been overriden.
|
|
15236
|
-
this.
|
|
15237
|
-
const s = Mo.createAndSchedule(this, t, e, n, (t => this.
|
|
15238
|
-
return this.
|
|
15236
|
+
this.Aa.indexOf(t) > -1 && (e = 0);
|
|
15237
|
+
const s = Mo.createAndSchedule(this, t, e, n, (t => this.Va(t)));
|
|
15238
|
+
return this.pa.push(s), s;
|
|
15239
15239
|
}
|
|
15240
|
-
|
|
15241
|
-
this.
|
|
15240
|
+
ba() {
|
|
15241
|
+
this.Ta && B();
|
|
15242
15242
|
}
|
|
15243
15243
|
verifyOperationInProgress() {}
|
|
15244
15244
|
/**
|
|
15245
15245
|
* Waits until all currently queued tasks are finished executing. Delayed
|
|
15246
15246
|
* operations are not run.
|
|
15247
|
-
*/ async
|
|
15247
|
+
*/ async Sa() {
|
|
15248
15248
|
// Operations in the queue prior to draining may have enqueued additional
|
|
15249
15249
|
// operations. Keep draining the queue until the tail is no longer advanced,
|
|
15250
15250
|
// which indicates that no more new operations were enqueued and that all
|
|
15251
15251
|
// operations were executed.
|
|
15252
15252
|
let t;
|
|
15253
15253
|
do {
|
|
15254
|
-
t = this.
|
|
15255
|
-
} while (t !== this.
|
|
15254
|
+
t = this.ma, await t;
|
|
15255
|
+
} while (t !== this.ma);
|
|
15256
15256
|
}
|
|
15257
15257
|
/**
|
|
15258
15258
|
* For Tests: Determine if a delayed operation with a particular TimerId
|
|
15259
15259
|
* exists.
|
|
15260
|
-
*/
|
|
15261
|
-
for (const e of this.
|
|
15260
|
+
*/ Da(t) {
|
|
15261
|
+
for (const e of this.pa) if (e.timerId === t) return !0;
|
|
15262
15262
|
return !1;
|
|
15263
15263
|
}
|
|
15264
15264
|
/**
|
|
@@ -15267,28 +15267,28 @@ function Na(t, e, ...n) {
|
|
|
15267
15267
|
* @param lastTimerId - Delayed operations up to and including this TimerId
|
|
15268
15268
|
* will be drained. Pass TimerId.All to run all delayed operations.
|
|
15269
15269
|
* @returns a Promise that resolves once all operations have been run.
|
|
15270
|
-
*/
|
|
15270
|
+
*/ Ca(t) {
|
|
15271
15271
|
// Note that draining may generate more delayed ops, so we do that first.
|
|
15272
|
-
return this.
|
|
15272
|
+
return this.Sa().then((() => {
|
|
15273
15273
|
// Run ops in the same order they'd run if they ran naturally.
|
|
15274
|
-
this.
|
|
15275
|
-
for (const e of this.
|
|
15276
|
-
return this.
|
|
15274
|
+
this.pa.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
|
|
15275
|
+
for (const e of this.pa) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
|
|
15276
|
+
return this.Sa();
|
|
15277
15277
|
}));
|
|
15278
15278
|
}
|
|
15279
15279
|
/**
|
|
15280
15280
|
* For Tests: Skip all subsequent delays for a timer id.
|
|
15281
|
-
*/
|
|
15282
|
-
this.
|
|
15281
|
+
*/ Na(t) {
|
|
15282
|
+
this.Aa.push(t);
|
|
15283
15283
|
}
|
|
15284
|
-
/** Called once a DelayedOperation is run or canceled. */
|
|
15284
|
+
/** Called once a DelayedOperation is run or canceled. */ Va(t) {
|
|
15285
15285
|
// NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
|
|
15286
|
-
const e = this.
|
|
15287
|
-
this.
|
|
15286
|
+
const e = this.pa.indexOf(t);
|
|
15287
|
+
this.pa.splice(e, 1);
|
|
15288
15288
|
}
|
|
15289
15289
|
}
|
|
15290
15290
|
|
|
15291
|
-
function
|
|
15291
|
+
function Fc(t) {
|
|
15292
15292
|
/**
|
|
15293
15293
|
* Returns true if obj is an object and contains at least one of the specified
|
|
15294
15294
|
* methods.
|
|
@@ -15323,7 +15323,7 @@ function Fa(t) {
|
|
|
15323
15323
|
*/ (t, [ "next", "error", "complete" ]);
|
|
15324
15324
|
}
|
|
15325
15325
|
|
|
15326
|
-
class
|
|
15326
|
+
class Oc {
|
|
15327
15327
|
constructor() {
|
|
15328
15328
|
this._progressObserver = {}, this._taskCompletionResolver = new W, this._lastProgress = {
|
|
15329
15329
|
taskState: "Running",
|
|
@@ -15407,27 +15407,27 @@ class Oa {
|
|
|
15407
15407
|
* See the License for the specific language governing permissions and
|
|
15408
15408
|
* limitations under the License.
|
|
15409
15409
|
*/
|
|
15410
|
-
/** DOMException error code constants. */ const
|
|
15410
|
+
/** DOMException error code constants. */ const Mc = -1;
|
|
15411
15411
|
|
|
15412
15412
|
/**
|
|
15413
15413
|
* The Cloud Firestore service interface.
|
|
15414
15414
|
*
|
|
15415
15415
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
15416
15416
|
*/
|
|
15417
|
-
class
|
|
15417
|
+
class Lc extends bc {
|
|
15418
15418
|
/** @hideconstructor */
|
|
15419
15419
|
constructor(t, e, n) {
|
|
15420
15420
|
super(t, e, n),
|
|
15421
15421
|
/**
|
|
15422
15422
|
* Whether it's a {@link Firestore} or Firestore Lite instance.
|
|
15423
15423
|
*/
|
|
15424
|
-
this.type = "firestore", this._queue = new $
|
|
15424
|
+
this.type = "firestore", this._queue = new $c, this._persistenceKey = "name" in t ? t.name : "[DEFAULT]";
|
|
15425
15425
|
}
|
|
15426
15426
|
_terminate() {
|
|
15427
15427
|
return this._firestoreClient ||
|
|
15428
15428
|
// The client must be initialized to ensure that all subsequent API
|
|
15429
15429
|
// usage throws an exception.
|
|
15430
|
-
|
|
15430
|
+
Kc(this), this._firestoreClient.terminate();
|
|
15431
15431
|
}
|
|
15432
15432
|
}
|
|
15433
15433
|
|
|
@@ -15441,7 +15441,7 @@ class La extends Pa {
|
|
|
15441
15441
|
* be associated.
|
|
15442
15442
|
* @param settings - A settings object to configure the {@link Firestore} instance.
|
|
15443
15443
|
* @returns A newly initialized {@link Firestore} instance.
|
|
15444
|
-
*/ function
|
|
15444
|
+
*/ function Bc(t, e) {
|
|
15445
15445
|
const n = _getProvider(t, "firestore");
|
|
15446
15446
|
if (n.isInitialized()) {
|
|
15447
15447
|
const t = n.getImmediate(), s = n.getOptions();
|
|
@@ -15462,22 +15462,22 @@ class La extends Pa {
|
|
|
15462
15462
|
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
|
|
15463
15463
|
* instance is associated with.
|
|
15464
15464
|
* @returns The {@link Firestore} instance of the provided app.
|
|
15465
|
-
*/ function
|
|
15465
|
+
*/ function Uc(e = t()) {
|
|
15466
15466
|
return _getProvider(e, "firestore").getImmediate();
|
|
15467
15467
|
}
|
|
15468
15468
|
|
|
15469
15469
|
/**
|
|
15470
15470
|
* @internal
|
|
15471
|
-
*/ function
|
|
15472
|
-
return t._firestoreClient ||
|
|
15471
|
+
*/ function qc(t) {
|
|
15472
|
+
return t._firestoreClient || Kc(t), t._firestoreClient.verifyNotTerminated(), t._firestoreClient;
|
|
15473
15473
|
}
|
|
15474
15474
|
|
|
15475
|
-
function
|
|
15475
|
+
function Kc(t) {
|
|
15476
15476
|
var e;
|
|
15477
15477
|
const n = t._freezeSettings(), s = function(t, e, n, s) {
|
|
15478
|
-
return new
|
|
15478
|
+
return new wc(t, e, n, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams);
|
|
15479
15479
|
}(t._databaseId, (null === (e = t._app) || void 0 === e ? void 0 : e.options.appId) || "", t._persistenceKey, n);
|
|
15480
|
-
t._firestoreClient = new
|
|
15480
|
+
t._firestoreClient = new za(t._authCredentials, t._appCheckCredentials, t._queue, s);
|
|
15481
15481
|
}
|
|
15482
15482
|
|
|
15483
15483
|
/**
|
|
@@ -15502,10 +15502,10 @@ function Ka(t) {
|
|
|
15502
15502
|
* @param persistenceSettings - Optional settings object to configure
|
|
15503
15503
|
* persistence.
|
|
15504
15504
|
* @returns A `Promise` that represents successfully enabling persistent storage.
|
|
15505
|
-
*/ function
|
|
15506
|
-
tu(t =
|
|
15507
|
-
const n =
|
|
15508
|
-
return
|
|
15505
|
+
*/ function jc(t, e) {
|
|
15506
|
+
tu(t = Ic(t, Lc));
|
|
15507
|
+
const n = qc(t), s = t._freezeSettings(), i = new qa;
|
|
15508
|
+
return Wc(n, i, new Ba(i, s.cacheSizeBytes, null == e ? void 0 : e.forceOwnership));
|
|
15509
15509
|
}
|
|
15510
15510
|
|
|
15511
15511
|
/**
|
|
@@ -15529,10 +15529,10 @@ function Ka(t) {
|
|
|
15529
15529
|
* @param firestore - The {@link Firestore} instance to enable persistence for.
|
|
15530
15530
|
* @returns A `Promise` that represents successfully enabling persistent
|
|
15531
15531
|
* storage.
|
|
15532
|
-
*/ function
|
|
15533
|
-
tu(t =
|
|
15534
|
-
const e =
|
|
15535
|
-
return
|
|
15532
|
+
*/ function Qc(t) {
|
|
15533
|
+
tu(t = Ic(t, Lc));
|
|
15534
|
+
const e = qc(t), n = t._freezeSettings(), s = new qa;
|
|
15535
|
+
return Wc(e, s, new Ua(s, n.cacheSizeBytes));
|
|
15536
15536
|
}
|
|
15537
15537
|
|
|
15538
15538
|
/**
|
|
@@ -15540,11 +15540,11 @@ function Ka(t) {
|
|
|
15540
15540
|
* If the operation fails with a recoverable error (see
|
|
15541
15541
|
* `canRecoverFromIndexedDbError()` below), the returned Promise is rejected
|
|
15542
15542
|
* but the client remains usable.
|
|
15543
|
-
*/ function
|
|
15543
|
+
*/ function Wc(t, e, n) {
|
|
15544
15544
|
const s = new W;
|
|
15545
15545
|
return t.asyncQueue.enqueue((async () => {
|
|
15546
15546
|
try {
|
|
15547
|
-
await
|
|
15547
|
+
await Ha(t, n), await Ja(t, e), s.resolve();
|
|
15548
15548
|
} catch (t) {
|
|
15549
15549
|
if (!
|
|
15550
15550
|
/**
|
|
@@ -15598,16 +15598,16 @@ function Ka(t) {
|
|
|
15598
15598
|
})).then((() => s.promise));
|
|
15599
15599
|
}
|
|
15600
15600
|
|
|
15601
|
-
function
|
|
15601
|
+
function Gc(t) {
|
|
15602
15602
|
if (t._initialized && !t._terminated) throw new Q(j.FAILED_PRECONDITION, "Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");
|
|
15603
15603
|
const e = new W;
|
|
15604
15604
|
return t._queue.enqueueAndForgetEvenWhileRestricted((async () => {
|
|
15605
15605
|
try {
|
|
15606
15606
|
await async function(t) {
|
|
15607
|
-
if (!Ys.
|
|
15607
|
+
if (!Ys.Pt()) return Promise.resolve();
|
|
15608
15608
|
const e = t + "main";
|
|
15609
15609
|
await Ys.delete(e);
|
|
15610
|
-
}(
|
|
15610
|
+
}(cr(t._databaseId, t._persistenceKey)), e.resolve();
|
|
15611
15611
|
} catch (t) {
|
|
15612
15612
|
e.reject(t);
|
|
15613
15613
|
}
|
|
@@ -15629,11 +15629,11 @@ function Ga(t) {
|
|
|
15629
15629
|
*
|
|
15630
15630
|
* @returns A `Promise` which resolves when all currently pending writes have been
|
|
15631
15631
|
* acknowledged by the backend.
|
|
15632
|
-
*/ function
|
|
15632
|
+
*/ function zc(t) {
|
|
15633
15633
|
return function(t) {
|
|
15634
15634
|
const e = new W;
|
|
15635
|
-
return t.asyncQueue.enqueueAndForget((async () =>
|
|
15636
|
-
}(
|
|
15635
|
+
return t.asyncQueue.enqueueAndForget((async () => ma(await nc(t), e))), e.promise;
|
|
15636
|
+
}(qc(t = Ic(t, Lc)));
|
|
15637
15637
|
}
|
|
15638
15638
|
|
|
15639
15639
|
/**
|
|
@@ -15641,8 +15641,8 @@ function Ga(t) {
|
|
|
15641
15641
|
* call to {@link disableNetwork}.
|
|
15642
15642
|
*
|
|
15643
15643
|
* @returns A `Promise` that is resolved once the network has been enabled.
|
|
15644
|
-
*/ function
|
|
15645
|
-
return
|
|
15644
|
+
*/ function Hc(t) {
|
|
15645
|
+
return ic(qc(t = Ic(t, Lc)));
|
|
15646
15646
|
}
|
|
15647
15647
|
|
|
15648
15648
|
/**
|
|
@@ -15652,8 +15652,8 @@ function Ga(t) {
|
|
|
15652
15652
|
* operations will be queued until the network is restored.
|
|
15653
15653
|
*
|
|
15654
15654
|
* @returns A `Promise` that is resolved once the network has been disabled.
|
|
15655
|
-
*/ function
|
|
15656
|
-
return
|
|
15655
|
+
*/ function Jc(t) {
|
|
15656
|
+
return rc(qc(t = Ic(t, Lc)));
|
|
15657
15657
|
}
|
|
15658
15658
|
|
|
15659
15659
|
/**
|
|
@@ -15677,7 +15677,7 @@ function Ga(t) {
|
|
|
15677
15677
|
*
|
|
15678
15678
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
15679
15679
|
* terminated.
|
|
15680
|
-
*/ function
|
|
15680
|
+
*/ function Yc(t) {
|
|
15681
15681
|
return e(t.app, "firestore"), t._delete();
|
|
15682
15682
|
}
|
|
15683
15683
|
|
|
@@ -15691,9 +15691,9 @@ function Ga(t) {
|
|
|
15691
15691
|
* @returns
|
|
15692
15692
|
* A `LoadBundleTask` object, which notifies callers with progress updates, and completion
|
|
15693
15693
|
* or error events. It can be used as a `Promise<LoadBundleTaskProgress>`.
|
|
15694
|
-
*/ function
|
|
15695
|
-
const n =
|
|
15696
|
-
return
|
|
15694
|
+
*/ function Xc(t, e) {
|
|
15695
|
+
const n = qc(t = Ic(t, Lc)), s = new Oc;
|
|
15696
|
+
return fc(n, t._databaseId, e, s), s;
|
|
15697
15697
|
}
|
|
15698
15698
|
|
|
15699
15699
|
/**
|
|
@@ -15702,8 +15702,8 @@ function Ga(t) {
|
|
|
15702
15702
|
* The named queries are packaged into bundles on the server side (along
|
|
15703
15703
|
* with resulting documents), and loaded to local cache using `loadBundle`. Once in local
|
|
15704
15704
|
* cache, use this method to extract a {@link Query} by name.
|
|
15705
|
-
*/ function
|
|
15706
|
-
return
|
|
15705
|
+
*/ function Zc(t, e) {
|
|
15706
|
+
return dc(qc(t = Ic(t, Lc)), e).then((e => e ? new Vc(t, null, e.query) : null));
|
|
15707
15707
|
}
|
|
15708
15708
|
|
|
15709
15709
|
function tu(t) {
|
|
@@ -15963,23 +15963,23 @@ class eu {
|
|
|
15963
15963
|
* limitations under the License.
|
|
15964
15964
|
*/ const ou = /^__.*__$/;
|
|
15965
15965
|
|
|
15966
|
-
/** The result of parsing document data (e.g. for a setData call). */ class
|
|
15966
|
+
/** The result of parsing document data (e.g. for a setData call). */ class au {
|
|
15967
15967
|
constructor(t, e, n) {
|
|
15968
15968
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
15969
15969
|
}
|
|
15970
15970
|
toMutation(t, e) {
|
|
15971
|
-
return null !== this.fieldMask ? new
|
|
15971
|
+
return null !== this.fieldMask ? new cn(t, this.data, this.fieldMask, e, this.fieldTransforms) : new an(t, this.data, e, this.fieldTransforms);
|
|
15972
15972
|
}
|
|
15973
15973
|
}
|
|
15974
15974
|
|
|
15975
|
-
/** The result of parsing "update" data (i.e. for an updateData call). */ class
|
|
15975
|
+
/** The result of parsing "update" data (i.e. for an updateData call). */ class cu {
|
|
15976
15976
|
constructor(t,
|
|
15977
15977
|
// The fieldMask does not include document transforms.
|
|
15978
15978
|
e, n) {
|
|
15979
15979
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
15980
15980
|
}
|
|
15981
15981
|
toMutation(t, e) {
|
|
15982
|
-
return new
|
|
15982
|
+
return new cn(t, this.data, this.fieldMask, e, this.fieldTransforms);
|
|
15983
15983
|
}
|
|
15984
15984
|
}
|
|
15985
15985
|
|
|
@@ -16024,55 +16024,55 @@ function uu(t) {
|
|
|
16024
16024
|
this.settings = t, this.databaseId = e, this.k = n, this.ignoreUndefinedProperties = s,
|
|
16025
16025
|
// Minor hack: If fieldTransforms is undefined, we assume this is an
|
|
16026
16026
|
// external call and we need to validate the entire path.
|
|
16027
|
-
void 0 === i && this.
|
|
16027
|
+
void 0 === i && this.ka(), this.fieldTransforms = i || [], this.fieldMask = r || [];
|
|
16028
16028
|
}
|
|
16029
16029
|
get path() {
|
|
16030
16030
|
return this.settings.path;
|
|
16031
16031
|
}
|
|
16032
|
-
get
|
|
16033
|
-
return this.settings
|
|
16032
|
+
get xa() {
|
|
16033
|
+
return this.settings.xa;
|
|
16034
16034
|
}
|
|
16035
|
-
/** Returns a new context with the specified settings overwritten. */
|
|
16035
|
+
/** Returns a new context with the specified settings overwritten. */ $a(t) {
|
|
16036
16036
|
return new hu(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.k, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
16037
16037
|
}
|
|
16038
|
-
|
|
16038
|
+
Fa(t) {
|
|
16039
16039
|
var e;
|
|
16040
|
-
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this
|
|
16040
|
+
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.$a({
|
|
16041
16041
|
path: n,
|
|
16042
|
-
|
|
16042
|
+
Oa: !1
|
|
16043
16043
|
});
|
|
16044
|
-
return s.
|
|
16044
|
+
return s.Ma(t), s;
|
|
16045
16045
|
}
|
|
16046
|
-
|
|
16046
|
+
La(t) {
|
|
16047
16047
|
var e;
|
|
16048
|
-
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this
|
|
16048
|
+
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.$a({
|
|
16049
16049
|
path: n,
|
|
16050
|
-
|
|
16050
|
+
Oa: !1
|
|
16051
16051
|
});
|
|
16052
|
-
return s.
|
|
16052
|
+
return s.ka(), s;
|
|
16053
16053
|
}
|
|
16054
|
-
|
|
16054
|
+
Ba(t) {
|
|
16055
16055
|
// TODO(b/34871131): We don't support array paths right now; so make path
|
|
16056
16056
|
// undefined.
|
|
16057
|
-
return this
|
|
16057
|
+
return this.$a({
|
|
16058
16058
|
path: void 0,
|
|
16059
|
-
|
|
16059
|
+
Oa: !0
|
|
16060
16060
|
});
|
|
16061
16061
|
}
|
|
16062
|
-
|
|
16063
|
-
return Du(t, this.settings.methodName, this.settings.
|
|
16062
|
+
Ua(t) {
|
|
16063
|
+
return Du(t, this.settings.methodName, this.settings.qa || !1, this.path, this.settings.Ka);
|
|
16064
16064
|
}
|
|
16065
16065
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
16066
16066
|
return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
|
|
16067
16067
|
}
|
|
16068
|
-
|
|
16068
|
+
ka() {
|
|
16069
16069
|
// TODO(b/34871131): Remove null check once we have proper paths for fields
|
|
16070
16070
|
// within arrays.
|
|
16071
|
-
if (this.path) for (let t = 0; t < this.path.length; t++) this.
|
|
16071
|
+
if (this.path) for (let t = 0; t < this.path.length; t++) this.Ma(this.path.get(t));
|
|
16072
16072
|
}
|
|
16073
|
-
|
|
16074
|
-
if (0 === t.length) throw this.
|
|
16075
|
-
if (uu(this
|
|
16073
|
+
Ma(t) {
|
|
16074
|
+
if (0 === t.length) throw this.Ua("Document fields must not be empty");
|
|
16075
|
+
if (uu(this.xa) && ou.test(t)) throw this.Ua('Document fields cannot begin and end with "__"');
|
|
16076
16076
|
}
|
|
16077
16077
|
}
|
|
16078
16078
|
|
|
@@ -16083,14 +16083,14 @@ function uu(t) {
|
|
|
16083
16083
|
constructor(t, e, n) {
|
|
16084
16084
|
this.databaseId = t, this.ignoreUndefinedProperties = e, this.k = n || no(t);
|
|
16085
16085
|
}
|
|
16086
|
-
/** Creates a new top-level parse context. */
|
|
16086
|
+
/** Creates a new top-level parse context. */ ja(t, e, n, s = !1) {
|
|
16087
16087
|
return new hu({
|
|
16088
|
-
|
|
16088
|
+
xa: t,
|
|
16089
16089
|
methodName: e,
|
|
16090
|
-
|
|
16090
|
+
Ka: n,
|
|
16091
16091
|
path: mt.emptyPath(),
|
|
16092
|
-
|
|
16093
|
-
|
|
16092
|
+
Oa: !1,
|
|
16093
|
+
qa: s
|
|
16094
16094
|
}, this.databaseId, this.k, this.ignoreUndefinedProperties);
|
|
16095
16095
|
}
|
|
16096
16096
|
}
|
|
@@ -16101,25 +16101,25 @@ function fu(t) {
|
|
|
16101
16101
|
}
|
|
16102
16102
|
|
|
16103
16103
|
/** Parse document data from a set() call. */ function du(t, e, n, s, i, r = {}) {
|
|
16104
|
-
const o = t.
|
|
16105
|
-
|
|
16106
|
-
const
|
|
16107
|
-
let
|
|
16108
|
-
if (r.merge)
|
|
16104
|
+
const o = t.ja(r.merge || r.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
|
|
16105
|
+
Pu("Data must be an object, but it was:", o, s);
|
|
16106
|
+
const a = Ru(s, o);
|
|
16107
|
+
let c, u;
|
|
16108
|
+
if (r.merge) c = new gt(o.fieldMask), u = o.fieldTransforms; else if (r.mergeFields) {
|
|
16109
16109
|
const t = [];
|
|
16110
16110
|
for (const s of r.mergeFields) {
|
|
16111
16111
|
const i = vu(e, s, n);
|
|
16112
16112
|
if (!o.contains(i)) throw new Q(j.INVALID_ARGUMENT, `Field '${i}' is specified in your field mask but missing from your input data.`);
|
|
16113
16113
|
Cu(t, i) || t.push(i);
|
|
16114
16114
|
}
|
|
16115
|
-
|
|
16116
|
-
} else
|
|
16117
|
-
return new
|
|
16115
|
+
c = new gt(t), u = o.fieldTransforms.filter((t => c.covers(t.field)));
|
|
16116
|
+
} else c = null, u = o.fieldTransforms;
|
|
16117
|
+
return new au(new Wt(a), c, u);
|
|
16118
16118
|
}
|
|
16119
16119
|
|
|
16120
16120
|
class wu extends iu {
|
|
16121
16121
|
_toFieldTransform(t) {
|
|
16122
|
-
if (2 /* MergeSet */ !== t
|
|
16122
|
+
if (2 /* MergeSet */ !== t.xa) throw 1 /* Update */ === t.xa ? t.Ua(`${this._methodName}() can only appear at the top level of your update data`) : t.Ua(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
|
|
16123
16123
|
// No transform to add for a delete, but we need to add it to our
|
|
16124
16124
|
// fieldMask so it gets deleted.
|
|
16125
16125
|
return t.fieldMask.push(t.path), null;
|
|
@@ -16146,10 +16146,10 @@ class wu extends iu {
|
|
|
16146
16146
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
16147
16147
|
*/ function _u(t, e, n) {
|
|
16148
16148
|
return new hu({
|
|
16149
|
-
|
|
16150
|
-
|
|
16149
|
+
xa: 3 /* Argument */ ,
|
|
16150
|
+
Ka: e.settings.Ka,
|
|
16151
16151
|
methodName: t._methodName,
|
|
16152
|
-
|
|
16152
|
+
Oa: n
|
|
16153
16153
|
}, e.databaseId, e.k, e.ignoreUndefinedProperties);
|
|
16154
16154
|
}
|
|
16155
16155
|
|
|
@@ -16164,11 +16164,11 @@ class mu extends iu {
|
|
|
16164
16164
|
|
|
16165
16165
|
class gu extends iu {
|
|
16166
16166
|
constructor(t, e) {
|
|
16167
|
-
super(t), this.
|
|
16167
|
+
super(t), this.Qa = e;
|
|
16168
16168
|
}
|
|
16169
16169
|
_toFieldTransform(t) {
|
|
16170
16170
|
const e = _u(this, t,
|
|
16171
|
-
/*array=*/ !0), n = this.
|
|
16171
|
+
/*array=*/ !0), n = this.Qa.map((t => Au(t, e))), s = new qe(n);
|
|
16172
16172
|
return new He(t.path, s);
|
|
16173
16173
|
}
|
|
16174
16174
|
isEqual(t) {
|
|
@@ -16179,11 +16179,11 @@ class gu extends iu {
|
|
|
16179
16179
|
|
|
16180
16180
|
class yu extends iu {
|
|
16181
16181
|
constructor(t, e) {
|
|
16182
|
-
super(t), this.
|
|
16182
|
+
super(t), this.Qa = e;
|
|
16183
16183
|
}
|
|
16184
16184
|
_toFieldTransform(t) {
|
|
16185
16185
|
const e = _u(this, t,
|
|
16186
|
-
/*array=*/ !0), n = this.
|
|
16186
|
+
/*array=*/ !0), n = this.Qa.map((t => Au(t, e))), s = new je(n);
|
|
16187
16187
|
return new He(t.path, s);
|
|
16188
16188
|
}
|
|
16189
16189
|
isEqual(t) {
|
|
@@ -16194,10 +16194,10 @@ class yu extends iu {
|
|
|
16194
16194
|
|
|
16195
16195
|
class pu extends iu {
|
|
16196
16196
|
constructor(t, e) {
|
|
16197
|
-
super(t), this.
|
|
16197
|
+
super(t), this.Wa = e;
|
|
16198
16198
|
}
|
|
16199
16199
|
_toFieldTransform(t) {
|
|
16200
|
-
const e = new We(t.k, Fe(t.k, this.
|
|
16200
|
+
const e = new We(t.k, Fe(t.k, this.Wa));
|
|
16201
16201
|
return new He(t.path, e);
|
|
16202
16202
|
}
|
|
16203
16203
|
isEqual(t) {
|
|
@@ -16207,40 +16207,40 @@ class pu extends iu {
|
|
|
16207
16207
|
}
|
|
16208
16208
|
|
|
16209
16209
|
/** Parse update data from an update() call. */ function Tu(t, e, n, s) {
|
|
16210
|
-
const i = t.
|
|
16211
|
-
|
|
16210
|
+
const i = t.ja(1 /* Update */ , e, n);
|
|
16211
|
+
Pu("Data must be an object, but it was:", i, s);
|
|
16212
16212
|
const r = [], o = Wt.empty();
|
|
16213
16213
|
lt(s, ((t, s) => {
|
|
16214
|
-
const
|
|
16214
|
+
const a = Su(e, t, n);
|
|
16215
16215
|
// For Compat types, we have to "extract" the underlying types before
|
|
16216
16216
|
// performing validation.
|
|
16217
16217
|
s = p(s);
|
|
16218
|
-
const
|
|
16218
|
+
const c = i.La(a);
|
|
16219
16219
|
if (s instanceof wu)
|
|
16220
16220
|
// Add it to the field mask, but don't add anything to updateData.
|
|
16221
|
-
r.push(
|
|
16222
|
-
const t = Au(s,
|
|
16223
|
-
null != t && (r.push(
|
|
16221
|
+
r.push(a); else {
|
|
16222
|
+
const t = Au(s, c);
|
|
16223
|
+
null != t && (r.push(a), o.set(a, t));
|
|
16224
16224
|
}
|
|
16225
16225
|
}));
|
|
16226
|
-
const
|
|
16227
|
-
return new
|
|
16226
|
+
const a = new gt(r);
|
|
16227
|
+
return new cu(o, a, i.fieldTransforms);
|
|
16228
16228
|
}
|
|
16229
16229
|
|
|
16230
16230
|
/** Parse update data from a list of field/value arguments. */ function Eu(t, e, n, s, i, r) {
|
|
16231
|
-
const o = t.
|
|
16231
|
+
const o = t.ja(1 /* Update */ , e, n), a = [ vu(e, s, n) ], c = [ i ];
|
|
16232
16232
|
if (r.length % 2 != 0) throw new Q(j.INVALID_ARGUMENT, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
16233
|
-
for (let t = 0; t < r.length; t += 2)
|
|
16233
|
+
for (let t = 0; t < r.length; t += 2) a.push(vu(e, r[t])), c.push(r[t + 1]);
|
|
16234
16234
|
const u = [], h = Wt.empty();
|
|
16235
16235
|
// We iterate in reverse order to pick the last value for a field if the
|
|
16236
16236
|
// user specified the field multiple times.
|
|
16237
|
-
for (let t =
|
|
16238
|
-
const e =
|
|
16239
|
-
let n =
|
|
16237
|
+
for (let t = a.length - 1; t >= 0; --t) if (!Cu(u, a[t])) {
|
|
16238
|
+
const e = a[t];
|
|
16239
|
+
let n = c[t];
|
|
16240
16240
|
// For Compat types, we have to "extract" the underlying types before
|
|
16241
16241
|
// performing validation.
|
|
16242
16242
|
n = p(n);
|
|
16243
|
-
const s = o.
|
|
16243
|
+
const s = o.La(e);
|
|
16244
16244
|
if (n instanceof wu)
|
|
16245
16245
|
// Add it to the field mask, but don't add anything to updateData.
|
|
16246
16246
|
u.push(e); else {
|
|
@@ -16249,7 +16249,7 @@ class pu extends iu {
|
|
|
16249
16249
|
}
|
|
16250
16250
|
}
|
|
16251
16251
|
const l = new gt(u);
|
|
16252
|
-
return new
|
|
16252
|
+
return new cu(h, l, o.fieldTransforms);
|
|
16253
16253
|
}
|
|
16254
16254
|
|
|
16255
16255
|
/**
|
|
@@ -16259,7 +16259,7 @@ class pu extends iu {
|
|
|
16259
16259
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
16260
16260
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
16261
16261
|
*/ function Iu(t, e, n, s = !1) {
|
|
16262
|
-
return Au(n, t.
|
|
16262
|
+
return Au(n, t.ja(s ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
16263
16263
|
}
|
|
16264
16264
|
|
|
16265
16265
|
/**
|
|
@@ -16271,10 +16271,10 @@ class pu extends iu {
|
|
|
16271
16271
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
16272
16272
|
* that should not be included in the resulting parsed data.
|
|
16273
16273
|
*/ function Au(t, e) {
|
|
16274
|
-
if (
|
|
16274
|
+
if (bu(
|
|
16275
16275
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
16276
16276
|
// from firestore-exp.
|
|
16277
|
-
t = p(t))) return
|
|
16277
|
+
t = p(t))) return Pu("Unsupported field value:", e, t), Ru(t, e);
|
|
16278
16278
|
if (t instanceof iu)
|
|
16279
16279
|
// FieldValues usually parse into transforms (except FieldValue.delete())
|
|
16280
16280
|
// in which case we do not want to include this field in our parsed data
|
|
@@ -16287,8 +16287,8 @@ class pu extends iu {
|
|
|
16287
16287
|
*/
|
|
16288
16288
|
return function(t, e) {
|
|
16289
16289
|
// Sentinels are only supported with writes, and not within arrays.
|
|
16290
|
-
if (!uu(e
|
|
16291
|
-
if (!e.path) throw e.
|
|
16290
|
+
if (!uu(e.xa)) throw e.Ua(`${t._methodName}() can only be used with update() and set()`);
|
|
16291
|
+
if (!e.path) throw e.Ua(`${t._methodName}() is not currently supported inside arrays`);
|
|
16292
16292
|
const n = t._toFieldTransform(e);
|
|
16293
16293
|
n && e.fieldTransforms.push(n);
|
|
16294
16294
|
}
|
|
@@ -16312,12 +16312,12 @@ class pu extends iu {
|
|
|
16312
16312
|
// the set of values to be included for the IN query) that may directly
|
|
16313
16313
|
// contain additional arrays (each representing an individual field
|
|
16314
16314
|
// value), so we disable this validation.
|
|
16315
|
-
if (e.settings.
|
|
16315
|
+
if (e.settings.Oa && 4 /* ArrayArgument */ !== e.xa) throw e.Ua("Nested arrays are not supported");
|
|
16316
16316
|
return function(t, e) {
|
|
16317
16317
|
const n = [];
|
|
16318
16318
|
let s = 0;
|
|
16319
16319
|
for (const i of t) {
|
|
16320
|
-
let t = Au(i, e.
|
|
16320
|
+
let t = Au(i, e.Ba(s));
|
|
16321
16321
|
null == t && (
|
|
16322
16322
|
// Just include nulls in the array for fields being replaced with a
|
|
16323
16323
|
// sentinel.
|
|
@@ -16344,16 +16344,16 @@ class pu extends iu {
|
|
|
16344
16344
|
stringValue: t
|
|
16345
16345
|
};
|
|
16346
16346
|
if (t instanceof Date) {
|
|
16347
|
-
const n =
|
|
16347
|
+
const n = ct.fromDate(t);
|
|
16348
16348
|
return {
|
|
16349
16349
|
timestampValue: Wn(e.k, n)
|
|
16350
16350
|
};
|
|
16351
16351
|
}
|
|
16352
|
-
if (t instanceof
|
|
16352
|
+
if (t instanceof ct) {
|
|
16353
16353
|
// Firestore backend truncates precision down to microseconds. To ensure
|
|
16354
16354
|
// offline mode works the same with regards to truncation, perform the
|
|
16355
16355
|
// truncation immediately without waiting for the backend to do that.
|
|
16356
|
-
const n = new
|
|
16356
|
+
const n = new ct(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
16357
16357
|
return {
|
|
16358
16358
|
timestampValue: Wn(e.k, n)
|
|
16359
16359
|
};
|
|
@@ -16367,14 +16367,14 @@ class pu extends iu {
|
|
|
16367
16367
|
if (t instanceof su) return {
|
|
16368
16368
|
bytesValue: Gn(e.k, t._byteString)
|
|
16369
16369
|
};
|
|
16370
|
-
if (t instanceof
|
|
16370
|
+
if (t instanceof vc) {
|
|
16371
16371
|
const n = e.databaseId, s = t.firestore._databaseId;
|
|
16372
|
-
if (!s.isEqual(n)) throw e.
|
|
16372
|
+
if (!s.isEqual(n)) throw e.Ua(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`);
|
|
16373
16373
|
return {
|
|
16374
16374
|
referenceValue: Jn(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
16375
16375
|
};
|
|
16376
16376
|
}
|
|
16377
|
-
throw e.
|
|
16377
|
+
throw e.Ua(`Unsupported field value: ${Ec(t)}`);
|
|
16378
16378
|
}
|
|
16379
16379
|
/**
|
|
16380
16380
|
* Checks whether an object looks like a JSON object that should be converted
|
|
@@ -16391,7 +16391,7 @@ function Ru(t, e) {
|
|
|
16391
16391
|
// If we encounter an empty object, we explicitly add it to the update
|
|
16392
16392
|
// mask to ensure that the server creates a map entry.
|
|
16393
16393
|
e.path && e.path.length > 0 && e.fieldMask.push(e.path) : lt(t, ((t, s) => {
|
|
16394
|
-
const i = Au(s, e.
|
|
16394
|
+
const i = Au(s, e.Fa(t));
|
|
16395
16395
|
null != i && (n[t] = i);
|
|
16396
16396
|
})), {
|
|
16397
16397
|
mapValue: {
|
|
@@ -16400,16 +16400,16 @@ function Ru(t, e) {
|
|
|
16400
16400
|
};
|
|
16401
16401
|
}
|
|
16402
16402
|
|
|
16403
|
-
function
|
|
16404
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof
|
|
16403
|
+
function bu(t) {
|
|
16404
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof ct || t instanceof ru || t instanceof su || t instanceof vc || t instanceof iu);
|
|
16405
16405
|
}
|
|
16406
16406
|
|
|
16407
|
-
function
|
|
16408
|
-
if (!
|
|
16407
|
+
function Pu(t, e, n) {
|
|
16408
|
+
if (!bu(n) || !function(t) {
|
|
16409
16409
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
16410
16410
|
}(n)) {
|
|
16411
|
-
const s =
|
|
16412
|
-
throw "an object" === s ? e.
|
|
16411
|
+
const s = Ec(n);
|
|
16412
|
+
throw "an object" === s ? e.Ua(t + " a custom object") : e.Ua(t + " " + s);
|
|
16413
16413
|
}
|
|
16414
16414
|
}
|
|
16415
16415
|
|
|
@@ -16453,11 +16453,11 @@ function bu(t, e, n) {
|
|
|
16453
16453
|
|
|
16454
16454
|
function Du(t, e, n, s, i) {
|
|
16455
16455
|
const r = s && !s.isEmpty(), o = void 0 !== i;
|
|
16456
|
-
let
|
|
16457
|
-
n && (
|
|
16458
|
-
let
|
|
16459
|
-
return (r || o) && (
|
|
16460
|
-
|
|
16456
|
+
let a = `Function ${e}() called with invalid data`;
|
|
16457
|
+
n && (a += " (via `toFirestore()`)"), a += ". ";
|
|
16458
|
+
let c = "";
|
|
16459
|
+
return (r || o) && (c += " (found", r && (c += ` in field ${s}`), o && (c += ` in document ${i}`),
|
|
16460
|
+
c += ")"), new Q(j.INVALID_ARGUMENT, a + t + c);
|
|
16461
16461
|
}
|
|
16462
16462
|
|
|
16463
16463
|
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Cu(t, e) {
|
|
@@ -16504,7 +16504,7 @@ function Du(t, e, n, s, i) {
|
|
|
16504
16504
|
/**
|
|
16505
16505
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
16506
16506
|
*/ get ref() {
|
|
16507
|
-
return new
|
|
16507
|
+
return new vc(this._firestore, this._converter, this._key);
|
|
16508
16508
|
}
|
|
16509
16509
|
/**
|
|
16510
16510
|
* Signals whether or not the document at the snapshot's location exists.
|
|
@@ -16812,7 +16812,7 @@ function Lu(t) {
|
|
|
16812
16812
|
* @param right - A snapshot to compare.
|
|
16813
16813
|
* @returns true if the snapshots are equal.
|
|
16814
16814
|
*/ function Bu(t, e) {
|
|
16815
|
-
return t instanceof Fu && e instanceof Fu ? 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 Mu && e instanceof Mu && (t._firestore === e._firestore &&
|
|
16815
|
+
return t instanceof Fu && e instanceof Fu ? 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 Mu && e instanceof Mu && (t._firestore === e._firestore && xc(t.query, e.query) && t.metadata.isEqual(e.metadata) && t._snapshot.isEqual(e._snapshot));
|
|
16816
16816
|
}
|
|
16817
16817
|
|
|
16818
16818
|
/**
|
|
@@ -16858,27 +16858,27 @@ function Lu(t) {
|
|
|
16858
16858
|
|
|
16859
16859
|
class ju extends qu {
|
|
16860
16860
|
constructor(t, e, n) {
|
|
16861
|
-
super(), this.
|
|
16861
|
+
super(), this.Ga = t, this.za = e, this.Ha = n, this.type = "where";
|
|
16862
16862
|
}
|
|
16863
16863
|
_apply(t) {
|
|
16864
16864
|
const e = fu(t.firestore), n = function(t, e, n, s, i, r, o) {
|
|
16865
|
-
let
|
|
16865
|
+
let a;
|
|
16866
16866
|
if (i.isKeyField()) {
|
|
16867
16867
|
if ("array-contains" /* ARRAY_CONTAINS */ === r || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === r) throw new Q(j.INVALID_ARGUMENT, `Invalid Query. You can't perform '${r}' queries on FieldPath.documentId().`);
|
|
16868
16868
|
if ("in" /* IN */ === r || "not-in" /* NOT_IN */ === r) {
|
|
16869
16869
|
rh(o, r);
|
|
16870
16870
|
const e = [];
|
|
16871
16871
|
for (const n of o) e.push(ih(s, t, n));
|
|
16872
|
-
|
|
16872
|
+
a = {
|
|
16873
16873
|
arrayValue: {
|
|
16874
16874
|
values: e
|
|
16875
16875
|
}
|
|
16876
16876
|
};
|
|
16877
|
-
} else
|
|
16877
|
+
} else a = ih(s, t, o);
|
|
16878
16878
|
} else "in" /* IN */ !== r && "not-in" /* NOT_IN */ !== r && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== r || rh(o, r),
|
|
16879
|
-
|
|
16879
|
+
a = Iu(n, e, o,
|
|
16880
16880
|
/* allowArrays= */ "in" /* IN */ === r || "not-in" /* NOT_IN */ === r);
|
|
16881
|
-
const
|
|
16881
|
+
const c = ee.create(i, r, a);
|
|
16882
16882
|
return function(t, e) {
|
|
16883
16883
|
if (e.V()) {
|
|
16884
16884
|
const n = Ae(t);
|
|
@@ -16926,9 +16926,9 @@ class ju extends qu {
|
|
|
16926
16926
|
if (null !== n)
|
|
16927
16927
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
16928
16928
|
throw n === e.op ? new Q(j.INVALID_ARGUMENT, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new Q(j.INVALID_ARGUMENT, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
16929
|
-
}(t,
|
|
16930
|
-
}(t._query, "where", e, t.firestore._databaseId, this.
|
|
16931
|
-
return new
|
|
16929
|
+
}(t, c), c;
|
|
16930
|
+
}(t._query, "where", e, t.firestore._databaseId, this.Ga, this.za, this.Ha);
|
|
16931
|
+
return new Vc(t.firestore, t.converter, function(t, e) {
|
|
16932
16932
|
const n = t.filters.concat([ e ]);
|
|
16933
16933
|
return new ge(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
16934
16934
|
}(t._query, n));
|
|
@@ -16952,7 +16952,7 @@ class ju extends qu {
|
|
|
16952
16952
|
|
|
16953
16953
|
class Wu extends qu {
|
|
16954
16954
|
constructor(t, e) {
|
|
16955
|
-
super(), this.
|
|
16955
|
+
super(), this.Ga = t, this.Ja = e, this.type = "orderBy";
|
|
16956
16956
|
}
|
|
16957
16957
|
_apply(t) {
|
|
16958
16958
|
const e = function(t, e, n) {
|
|
@@ -16977,8 +16977,8 @@ class Wu extends qu {
|
|
|
16977
16977
|
* Will throw if the document does not contain all fields of the order by
|
|
16978
16978
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
16979
16979
|
* server timestamp.
|
|
16980
|
-
*/ (t._query, this.
|
|
16981
|
-
return new
|
|
16980
|
+
*/ (t._query, this.Ga, this.Ja);
|
|
16981
|
+
return new Vc(t.firestore, t.converter, function(t, e) {
|
|
16982
16982
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
16983
16983
|
const n = t.explicitOrderBy.concat([ e ]);
|
|
16984
16984
|
return new ge(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -17001,10 +17001,10 @@ class Wu extends qu {
|
|
|
17001
17001
|
|
|
17002
17002
|
class zu extends qu {
|
|
17003
17003
|
constructor(t, e, n) {
|
|
17004
|
-
super(), this.type = t, this.
|
|
17004
|
+
super(), this.type = t, this.Ya = e, this.Xa = n;
|
|
17005
17005
|
}
|
|
17006
17006
|
_apply(t) {
|
|
17007
|
-
return new
|
|
17007
|
+
return new Vc(t.firestore, t.converter, ve(t._query, this.Ya, this.Xa));
|
|
17008
17008
|
}
|
|
17009
17009
|
}
|
|
17010
17010
|
|
|
@@ -17014,7 +17014,7 @@ class zu extends qu {
|
|
|
17014
17014
|
* @param limit - The maximum number of items to return.
|
|
17015
17015
|
* @returns The created {@link Query}.
|
|
17016
17016
|
*/ function Hu(t) {
|
|
17017
|
-
return
|
|
17017
|
+
return Ac("limit", t), new zu("limit", t, "F" /* First */);
|
|
17018
17018
|
}
|
|
17019
17019
|
|
|
17020
17020
|
/**
|
|
@@ -17026,16 +17026,16 @@ class zu extends qu {
|
|
|
17026
17026
|
* @param limit - The maximum number of items to return.
|
|
17027
17027
|
* @returns The created {@link Query}.
|
|
17028
17028
|
*/ function Ju(t) {
|
|
17029
|
-
return
|
|
17029
|
+
return Ac("limitToLast", t), new zu("limitToLast", t, "L" /* Last */);
|
|
17030
17030
|
}
|
|
17031
17031
|
|
|
17032
17032
|
class Yu extends qu {
|
|
17033
17033
|
constructor(t, e, n) {
|
|
17034
|
-
super(), this.type = t, this.
|
|
17034
|
+
super(), this.type = t, this.Za = e, this.tc = n;
|
|
17035
17035
|
}
|
|
17036
17036
|
_apply(t) {
|
|
17037
|
-
const e = sh(t, this.type, this.
|
|
17038
|
-
return new
|
|
17037
|
+
const e = sh(t, this.type, this.Za, this.tc);
|
|
17038
|
+
return new Vc(t.firestore, t.converter, function(t, e) {
|
|
17039
17039
|
return new ge(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
17040
17040
|
}(t._query, e));
|
|
17041
17041
|
}
|
|
@@ -17052,11 +17052,11 @@ function Zu(...t) {
|
|
|
17052
17052
|
|
|
17053
17053
|
class th extends qu {
|
|
17054
17054
|
constructor(t, e, n) {
|
|
17055
|
-
super(), this.type = t, this.
|
|
17055
|
+
super(), this.type = t, this.Za = e, this.tc = n;
|
|
17056
17056
|
}
|
|
17057
17057
|
_apply(t) {
|
|
17058
|
-
const e = sh(t, this.type, this.
|
|
17059
|
-
return new
|
|
17058
|
+
const e = sh(t, this.type, this.Za, this.tc);
|
|
17059
|
+
return new Vc(t.firestore, t.converter, function(t, e) {
|
|
17060
17060
|
return new ge(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
17061
17061
|
}(t._query, e));
|
|
17062
17062
|
}
|
|
@@ -17081,9 +17081,9 @@ function nh(...t) {
|
|
|
17081
17081
|
// the provided document. Without the key (by using the explicit sort
|
|
17082
17082
|
// orders), multiple documents could match the position, yielding duplicate
|
|
17083
17083
|
// results.
|
|
17084
|
-
for (const n of
|
|
17084
|
+
for (const n of be(t)) if (n.field.isKeyField()) r.push(Lt(e, s.key)); else {
|
|
17085
17085
|
const t = s.data.field(n.field);
|
|
17086
|
-
if (
|
|
17086
|
+
if (bt(t)) throw new Q(j.INVALID_ARGUMENT, 'Invalid query. You are trying to start or end a query using a document for which the field "' + n.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
|
|
17087
17087
|
if (null === t) {
|
|
17088
17088
|
const t = n.field.canonicalString();
|
|
17089
17089
|
throw new Q(j.INVALID_ARGUMENT, `Invalid query. You are trying to start or end a query using a document for which the field '${t}' (used as the orderBy) does not exist.`);
|
|
@@ -17101,22 +17101,22 @@ function nh(...t) {
|
|
|
17101
17101
|
// Use explicit order by's because it has to match the query the user made
|
|
17102
17102
|
const o = t.explicitOrderBy;
|
|
17103
17103
|
if (i.length > o.length) throw new Q(j.INVALID_ARGUMENT, `Too many arguments provided to ${s}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
|
|
17104
|
-
const
|
|
17104
|
+
const a = [];
|
|
17105
17105
|
for (let r = 0; r < i.length; r++) {
|
|
17106
|
-
const
|
|
17106
|
+
const c = i[r];
|
|
17107
17107
|
if (o[r].field.isKeyField()) {
|
|
17108
|
-
if ("string" != typeof
|
|
17109
|
-
if (!Re(t) && -1 !==
|
|
17110
|
-
const n = t.path.child(wt.fromString(
|
|
17108
|
+
if ("string" != typeof c) throw new Q(j.INVALID_ARGUMENT, `Invalid query. Expected a string for document ID in ${s}(), but got a ${typeof c}`);
|
|
17109
|
+
if (!Re(t) && -1 !== c.indexOf("/")) throw new Q(j.INVALID_ARGUMENT, `Invalid query. When querying a collection and ordering by FieldPath.documentId(), the value passed to ${s}() must be a plain document ID, but '${c}' contains a slash.`);
|
|
17110
|
+
const n = t.path.child(wt.fromString(c));
|
|
17111
17111
|
if (!Ct.isDocumentKey(n)) throw new Q(j.INVALID_ARGUMENT, `Invalid query. When querying a collection group and ordering by FieldPath.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.`);
|
|
17112
17112
|
const i = new Ct(n);
|
|
17113
|
-
|
|
17113
|
+
a.push(Lt(e, i));
|
|
17114
17114
|
} else {
|
|
17115
|
-
const t = Iu(n, s,
|
|
17116
|
-
|
|
17115
|
+
const t = Iu(n, s, c);
|
|
17116
|
+
a.push(t);
|
|
17117
17117
|
}
|
|
17118
17118
|
}
|
|
17119
|
-
return new le(
|
|
17119
|
+
return new le(a, r);
|
|
17120
17120
|
}
|
|
17121
17121
|
/**
|
|
17122
17122
|
* Parses the given `documentIdValue` into a `ReferenceValue`, throwing
|
|
@@ -17134,8 +17134,8 @@ function ih(t, e, n) {
|
|
|
17134
17134
|
if (!Ct.isDocumentKey(s)) throw new Q(j.INVALID_ARGUMENT, `Invalid query. When querying a collection group by FieldPath.documentId(), the value provided must result in a valid document path, but '${s}' is not because it has an odd number of segments (${s.length}).`);
|
|
17135
17135
|
return Lt(t, new Ct(s));
|
|
17136
17136
|
}
|
|
17137
|
-
if (n instanceof
|
|
17138
|
-
throw new Q(j.INVALID_ARGUMENT, `Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: ${
|
|
17137
|
+
if (n instanceof vc) return Lt(t, n._key);
|
|
17138
|
+
throw new Q(j.INVALID_ARGUMENT, `Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: ${Ec(n)}.`);
|
|
17139
17139
|
}
|
|
17140
17140
|
|
|
17141
17141
|
/**
|
|
@@ -17171,7 +17171,7 @@ function oh(t, e, n) {
|
|
|
17171
17171
|
* to the user.
|
|
17172
17172
|
*
|
|
17173
17173
|
* @internal
|
|
17174
|
-
*/ class
|
|
17174
|
+
*/ class ah {
|
|
17175
17175
|
convertValue(t, e = "none") {
|
|
17176
17176
|
switch (Nt(t)) {
|
|
17177
17177
|
case 0 /* NullValue */ :
|
|
@@ -17226,7 +17226,7 @@ function oh(t, e, n) {
|
|
|
17226
17226
|
convertServerTimestamp(t, e) {
|
|
17227
17227
|
switch (e) {
|
|
17228
17228
|
case "previous":
|
|
17229
|
-
const n =
|
|
17229
|
+
const n = Pt(t);
|
|
17230
17230
|
return null == n ? null : this.convertValue(n, e);
|
|
17231
17231
|
|
|
17232
17232
|
case "estimate":
|
|
@@ -17238,12 +17238,12 @@ function oh(t, e, n) {
|
|
|
17238
17238
|
}
|
|
17239
17239
|
convertTimestamp(t) {
|
|
17240
17240
|
const e = It(t);
|
|
17241
|
-
return new
|
|
17241
|
+
return new ct(e.seconds, e.nanos);
|
|
17242
17242
|
}
|
|
17243
17243
|
convertDocumentKey(t, e) {
|
|
17244
17244
|
const n = wt.fromString(t);
|
|
17245
|
-
U(
|
|
17246
|
-
const s = new
|
|
17245
|
+
U(bs(n));
|
|
17246
|
+
const s = new _c(n.get(1), n.get(3)), i = new Ct(n.popFirst(5));
|
|
17247
17247
|
return s.isEqual(e) ||
|
|
17248
17248
|
// TODO(b/64130202): Somehow support foreign references.
|
|
17249
17249
|
O(`Document ${i} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),
|
|
@@ -17275,7 +17275,7 @@ function oh(t, e, n) {
|
|
|
17275
17275
|
* because we want to provide the user with a more specific error message if
|
|
17276
17276
|
* their `set()` or fails due to invalid data originating from a `toFirestore()`
|
|
17277
17277
|
* call.
|
|
17278
|
-
*/ function
|
|
17278
|
+
*/ function ch(t, e, n) {
|
|
17279
17279
|
let s;
|
|
17280
17280
|
// Cast to `any` in order to satisfy the union type constraint on
|
|
17281
17281
|
// toFirestore().
|
|
@@ -17284,7 +17284,7 @@ function oh(t, e, n) {
|
|
|
17284
17284
|
s;
|
|
17285
17285
|
}
|
|
17286
17286
|
|
|
17287
|
-
class uh extends
|
|
17287
|
+
class uh extends ah {
|
|
17288
17288
|
constructor(t) {
|
|
17289
17289
|
super(), this.firestore = t;
|
|
17290
17290
|
}
|
|
@@ -17293,7 +17293,7 @@ class uh extends ch {
|
|
|
17293
17293
|
}
|
|
17294
17294
|
convertReference(t) {
|
|
17295
17295
|
const e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
17296
|
-
return new
|
|
17296
|
+
return new vc(this.firestore, /* converter= */ null, e);
|
|
17297
17297
|
}
|
|
17298
17298
|
}
|
|
17299
17299
|
|
|
@@ -17328,7 +17328,7 @@ class uh extends ch {
|
|
|
17328
17328
|
}
|
|
17329
17329
|
set(t, e, n) {
|
|
17330
17330
|
this._verifyNotCommitted();
|
|
17331
|
-
const s = lh(t, this._firestore), i =
|
|
17331
|
+
const s = lh(t, this._firestore), i = ch(s.converter, e, n), r = du(this._dataReader, "WriteBatch.set", s._key, i, null !== s.converter, n);
|
|
17332
17332
|
return this._mutations.push(r.toMutation(s._key, Xe.none())), this;
|
|
17333
17333
|
}
|
|
17334
17334
|
update(t, e, n, ...s) {
|
|
@@ -17428,12 +17428,12 @@ function lh(t, e) {
|
|
|
17428
17428
|
* current document contents.
|
|
17429
17429
|
*/
|
|
17430
17430
|
function fh(t) {
|
|
17431
|
-
t =
|
|
17432
|
-
const e =
|
|
17433
|
-
return
|
|
17431
|
+
t = Ic(t, vc);
|
|
17432
|
+
const e = Ic(t.firestore, Lc);
|
|
17433
|
+
return ac(qc(e), t._key).then((n => Ph(e, t, n)));
|
|
17434
17434
|
}
|
|
17435
17435
|
|
|
17436
|
-
class dh extends
|
|
17436
|
+
class dh extends ah {
|
|
17437
17437
|
constructor(t) {
|
|
17438
17438
|
super(), this.firestore = t;
|
|
17439
17439
|
}
|
|
@@ -17442,7 +17442,7 @@ class dh extends ch {
|
|
|
17442
17442
|
}
|
|
17443
17443
|
convertReference(t) {
|
|
17444
17444
|
const e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
17445
|
-
return new
|
|
17445
|
+
return new vc(this.firestore, /* converter= */ null, e);
|
|
17446
17446
|
}
|
|
17447
17447
|
}
|
|
17448
17448
|
|
|
@@ -17453,9 +17453,9 @@ class dh extends ch {
|
|
|
17453
17453
|
* @returns A `Promise` resolved with a `DocumentSnapshot` containing the
|
|
17454
17454
|
* current document contents.
|
|
17455
17455
|
*/ function wh(t) {
|
|
17456
|
-
t =
|
|
17457
|
-
const e =
|
|
17458
|
-
return
|
|
17456
|
+
t = Ic(t, vc);
|
|
17457
|
+
const e = Ic(t.firestore, Lc), n = qc(e), s = new dh(e);
|
|
17458
|
+
return oc(n, t._key).then((n => new Fu(e, s, t._key, n, new $u(null !== n && n.hasLocalMutations,
|
|
17459
17459
|
/* fromCache= */ !0), t.converter)));
|
|
17460
17460
|
}
|
|
17461
17461
|
|
|
@@ -17466,11 +17466,11 @@ class dh extends ch {
|
|
|
17466
17466
|
* @returns A `Promise` resolved with a `DocumentSnapshot` containing the
|
|
17467
17467
|
* current document contents.
|
|
17468
17468
|
*/ function _h(t) {
|
|
17469
|
-
t =
|
|
17470
|
-
const e =
|
|
17471
|
-
return
|
|
17469
|
+
t = Ic(t, vc);
|
|
17470
|
+
const e = Ic(t.firestore, Lc);
|
|
17471
|
+
return ac(qc(e), t._key, {
|
|
17472
17472
|
source: "server"
|
|
17473
|
-
}).then((n =>
|
|
17473
|
+
}).then((n => Ph(e, t, n)));
|
|
17474
17474
|
}
|
|
17475
17475
|
|
|
17476
17476
|
/**
|
|
@@ -17483,9 +17483,9 @@ class dh extends ch {
|
|
|
17483
17483
|
*
|
|
17484
17484
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
17485
17485
|
*/ function mh(t) {
|
|
17486
|
-
t =
|
|
17487
|
-
const e =
|
|
17488
|
-
return Uu(t._query),
|
|
17486
|
+
t = Ic(t, Vc);
|
|
17487
|
+
const e = Ic(t.firestore, Lc), n = qc(e), s = new dh(e);
|
|
17488
|
+
return Uu(t._query), uc(n, t._query).then((n => new Mu(e, s, t, n)));
|
|
17489
17489
|
}
|
|
17490
17490
|
|
|
17491
17491
|
/**
|
|
@@ -17494,9 +17494,9 @@ class dh extends ch {
|
|
|
17494
17494
|
*
|
|
17495
17495
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
17496
17496
|
*/ function gh(t) {
|
|
17497
|
-
t =
|
|
17498
|
-
const e =
|
|
17499
|
-
return
|
|
17497
|
+
t = Ic(t, Vc);
|
|
17498
|
+
const e = Ic(t.firestore, Lc), n = qc(e), s = new dh(e);
|
|
17499
|
+
return cc(n, t._query).then((n => new Mu(e, s, t, n)));
|
|
17500
17500
|
}
|
|
17501
17501
|
|
|
17502
17502
|
/**
|
|
@@ -17505,28 +17505,28 @@ class dh extends ch {
|
|
|
17505
17505
|
*
|
|
17506
17506
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
17507
17507
|
*/ function yh(t) {
|
|
17508
|
-
t =
|
|
17509
|
-
const e =
|
|
17510
|
-
return
|
|
17508
|
+
t = Ic(t, Vc);
|
|
17509
|
+
const e = Ic(t.firestore, Lc), n = qc(e), s = new dh(e);
|
|
17510
|
+
return uc(n, t._query, {
|
|
17511
17511
|
source: "server"
|
|
17512
17512
|
}).then((n => new Mu(e, s, t, n)));
|
|
17513
17513
|
}
|
|
17514
17514
|
|
|
17515
17515
|
function ph(t, e, n) {
|
|
17516
|
-
t =
|
|
17517
|
-
const s =
|
|
17518
|
-
return
|
|
17516
|
+
t = Ic(t, vc);
|
|
17517
|
+
const s = Ic(t.firestore, Lc), i = ch(t.converter, e, n);
|
|
17518
|
+
return bh(s, [ du(fu(s), "setDoc", t._key, i, null !== t.converter, n).toMutation(t._key, Xe.none()) ]);
|
|
17519
17519
|
}
|
|
17520
17520
|
|
|
17521
17521
|
function Th(t, e, n, ...s) {
|
|
17522
|
-
t =
|
|
17523
|
-
const i =
|
|
17522
|
+
t = Ic(t, vc);
|
|
17523
|
+
const i = Ic(t.firestore, Lc), r = fu(i);
|
|
17524
17524
|
let o;
|
|
17525
17525
|
o = "string" == typeof (
|
|
17526
17526
|
// For Compat types, we have to "extract" the underlying types before
|
|
17527
17527
|
// performing validation.
|
|
17528
17528
|
e = p(e)) || e instanceof eu ? Eu(r, "updateDoc", t._key, e, n, s) : Tu(r, "updateDoc", t._key, e);
|
|
17529
|
-
return
|
|
17529
|
+
return bh(i, [ o.toMutation(t._key, Xe.exists(!0)) ]);
|
|
17530
17530
|
}
|
|
17531
17531
|
|
|
17532
17532
|
/**
|
|
@@ -17536,7 +17536,7 @@ function Th(t, e, n, ...s) {
|
|
|
17536
17536
|
* @returns A Promise resolved once the document has been successfully
|
|
17537
17537
|
* deleted from the backend (note that it won't resolve while you're offline).
|
|
17538
17538
|
*/ function Eh(t) {
|
|
17539
|
-
return
|
|
17539
|
+
return bh(Ic(t.firestore, Lc), [ new fn(t._key, Xe.none()) ]);
|
|
17540
17540
|
}
|
|
17541
17541
|
|
|
17542
17542
|
/**
|
|
@@ -17549,8 +17549,8 @@ function Th(t, e, n, ...s) {
|
|
|
17549
17549
|
* newly created document after it has been written to the backend (Note that it
|
|
17550
17550
|
* won't resolve while you're offline).
|
|
17551
17551
|
*/ function Ih(t, e) {
|
|
17552
|
-
const n =
|
|
17553
|
-
return
|
|
17552
|
+
const n = Ic(t.firestore, Lc), s = Nc(t), i = ch(t.converter, e);
|
|
17553
|
+
return bh(n, [ du(fu(t.firestore), "addDoc", s._key, i, null !== t.converter, {}).toMutation(s._key, Xe.exists(!1)) ]).then((() => s));
|
|
17554
17554
|
}
|
|
17555
17555
|
|
|
17556
17556
|
function Ah(t, ...e) {
|
|
@@ -17559,27 +17559,27 @@ function Ah(t, ...e) {
|
|
|
17559
17559
|
let r = {
|
|
17560
17560
|
includeMetadataChanges: !1
|
|
17561
17561
|
}, o = 0;
|
|
17562
|
-
"object" != typeof e[o] ||
|
|
17563
|
-
const
|
|
17562
|
+
"object" != typeof e[o] || Fc(e[o]) || (r = e[o], o++);
|
|
17563
|
+
const a = {
|
|
17564
17564
|
includeMetadataChanges: r.includeMetadataChanges
|
|
17565
17565
|
};
|
|
17566
|
-
if (
|
|
17566
|
+
if (Fc(e[o])) {
|
|
17567
17567
|
const t = e[o];
|
|
17568
17568
|
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),
|
|
17569
17569
|
e[o + 2] = null === (i = t.complete) || void 0 === i ? void 0 : i.bind(t);
|
|
17570
17570
|
}
|
|
17571
|
-
let
|
|
17572
|
-
if (t instanceof
|
|
17571
|
+
let c, u, h;
|
|
17572
|
+
if (t instanceof vc) u = Ic(t.firestore, Lc), h = pe(t._key.path), c = {
|
|
17573
17573
|
next: n => {
|
|
17574
|
-
e[o] && e[o](
|
|
17574
|
+
e[o] && e[o](Ph(u, t, n));
|
|
17575
17575
|
},
|
|
17576
17576
|
error: e[o + 1],
|
|
17577
17577
|
complete: e[o + 2]
|
|
17578
17578
|
}; else {
|
|
17579
|
-
const n =
|
|
17580
|
-
u =
|
|
17579
|
+
const n = Ic(t, Vc);
|
|
17580
|
+
u = Ic(n.firestore, Lc), h = n._query;
|
|
17581
17581
|
const s = new dh(u);
|
|
17582
|
-
|
|
17582
|
+
c = {
|
|
17583
17583
|
next: t => {
|
|
17584
17584
|
e[o] && e[o](new Mu(u, s, n, t));
|
|
17585
17585
|
},
|
|
@@ -17588,15 +17588,15 @@ function Ah(t, ...e) {
|
|
|
17588
17588
|
}, Uu(t._query);
|
|
17589
17589
|
}
|
|
17590
17590
|
return function(t, e, n, s) {
|
|
17591
|
-
const i = new
|
|
17592
|
-
return t.asyncQueue.enqueueAndForget((async () => Qo(await
|
|
17593
|
-
i.
|
|
17591
|
+
const i = new ja(s), r = new Jo(e, i, n);
|
|
17592
|
+
return t.asyncQueue.enqueueAndForget((async () => Qo(await sc(t), r))), () => {
|
|
17593
|
+
i.na(), t.asyncQueue.enqueueAndForget((async () => Wo(await sc(t), r)));
|
|
17594
17594
|
};
|
|
17595
|
-
}(
|
|
17595
|
+
}(qc(u), h, a, c);
|
|
17596
17596
|
}
|
|
17597
17597
|
|
|
17598
17598
|
function Rh(t, e) {
|
|
17599
|
-
return
|
|
17599
|
+
return hc(qc(t = Ic(t, Lc)), Fc(e) ? e : {
|
|
17600
17600
|
next: e
|
|
17601
17601
|
});
|
|
17602
17602
|
}
|
|
@@ -17604,17 +17604,17 @@ function Rh(t, e) {
|
|
|
17604
17604
|
/**
|
|
17605
17605
|
* Locally writes `mutations` on the async queue.
|
|
17606
17606
|
* @internal
|
|
17607
|
-
*/ function
|
|
17607
|
+
*/ function bh(t, e) {
|
|
17608
17608
|
return function(t, e) {
|
|
17609
17609
|
const n = new W;
|
|
17610
|
-
return t.asyncQueue.enqueueAndForget((async () =>
|
|
17611
|
-
}(
|
|
17610
|
+
return t.asyncQueue.enqueueAndForget((async () => ha(await nc(t), e, n))), n.promise;
|
|
17611
|
+
}(qc(t), e);
|
|
17612
17612
|
}
|
|
17613
17613
|
|
|
17614
17614
|
/**
|
|
17615
17615
|
* Converts a {@link ViewSnapshot} that contains the single document specified by `ref`
|
|
17616
17616
|
* to a {@link DocumentSnapshot}.
|
|
17617
|
-
*/ function
|
|
17617
|
+
*/ function Ph(t, e, n) {
|
|
17618
17618
|
const s = n.docs.get(e._key), i = new dh(t);
|
|
17619
17619
|
return new Fu(t, i, e._key, s, new $u(n.hasPendingWrites, n.fromCache), e.converter);
|
|
17620
17620
|
}
|
|
@@ -17662,7 +17662,7 @@ function Rh(t, e) {
|
|
|
17662
17662
|
}));
|
|
17663
17663
|
}
|
|
17664
17664
|
set(t, e, n) {
|
|
17665
|
-
const s = lh(t, this._firestore), i =
|
|
17665
|
+
const s = lh(t, this._firestore), i = ch(s.converter, e, n), r = du(this._dataReader, "Transaction.set", s._key, i, null !== s.converter, n);
|
|
17666
17666
|
return this._transaction.set(s._key, r), this;
|
|
17667
17667
|
}
|
|
17668
17668
|
update(t, e, n, ...s) {
|
|
@@ -17719,7 +17719,7 @@ function Rh(t, e) {
|
|
|
17719
17719
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
17720
17720
|
* rejected promise with the corresponding failure error is returned.
|
|
17721
17721
|
*/ function Vh(t, e) {
|
|
17722
|
-
return
|
|
17722
|
+
return lc(qc(t = Ic(t, Lc)), (n => e(new vh(t, n))));
|
|
17723
17723
|
}
|
|
17724
17724
|
|
|
17725
17725
|
/**
|
|
@@ -17834,7 +17834,7 @@ function Rh(t, e) {
|
|
|
17834
17834
|
* @returns A {@link WriteBatch} that can be used to atomically execute multiple
|
|
17835
17835
|
* writes.
|
|
17836
17836
|
*/ function xh(t) {
|
|
17837
|
-
return
|
|
17837
|
+
return qc(t = Ic(t, Lc)), new hh(t, (e => bh(t, e)));
|
|
17838
17838
|
}
|
|
17839
17839
|
|
|
17840
17840
|
/**
|
|
@@ -17856,14 +17856,14 @@ function Rh(t, e) {
|
|
|
17856
17856
|
!function(t) {
|
|
17857
17857
|
N = t;
|
|
17858
17858
|
}(i), n(new r("firestore", ((t, {options: n}) => {
|
|
17859
|
-
const s = t.getProvider("app").getImmediate(), i = new
|
|
17859
|
+
const s = t.getProvider("app").getImmediate(), i = new Lc(s, new J(t.getProvider("auth-internal")), new tt(t.getProvider("app-check-internal")));
|
|
17860
17860
|
return n = Object.assign({
|
|
17861
17861
|
useFetchStreams: e
|
|
17862
17862
|
}, n), i._setSettings(n), i;
|
|
17863
|
-
}), "PUBLIC"
|
|
17863
|
+
}), "PUBLIC")), s(D, "3.4.1-canary.0db840a09", t),
|
|
17864
17864
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
17865
|
-
s(D, "3.4.
|
|
17865
|
+
s(D, "3.4.1-canary.0db840a09", "esm2017");
|
|
17866
17866
|
}("rn", /* useFetchStreams= */ !1);
|
|
17867
17867
|
|
|
17868
|
-
export {
|
|
17868
|
+
export { ah as AbstractUserDataWriter, su as Bytes, Mc as CACHE_SIZE_UNLIMITED, Sc as CollectionReference, vc as DocumentReference, Fu as DocumentSnapshot, eu as FieldPath, iu as FieldValue, Lc as Firestore, Q as FirestoreError, ru as GeoPoint, Oc as LoadBundleTask, Vc as Query, qu as QueryConstraint, Ou as QueryDocumentSnapshot, Mu as QuerySnapshot, $u as SnapshotMetadata, ct as Timestamp, vh as Transaction, hh as WriteBatch, _c as _DatabaseId, Ct as _DocumentKey, et as _EmptyAppCheckTokenProvider, z as _EmptyAuthCredentialsProvider, mt as _FieldPath, Ic as _cast, q as _debugAssert, pt as _isBase64Available, M as _logWarn, yc as _validateIsNotUsedTogether, Ih as addDoc, Nh as arrayRemove, Ch as arrayUnion, Gc as clearIndexedDbPersistence, Dc as collection, Cc as collectionGroup, Pc as connectFirestoreEmulator, Eh as deleteDoc, Sh as deleteField, Jc as disableNetwork, Nc as doc, nu as documentId, jc as enableIndexedDbPersistence, Qc as enableMultiTabIndexedDbPersistence, Hc as enableNetwork, nh as endAt, eh as endBefore, qc as ensureFirestoreConfigured, bh as executeWrite, fh as getDoc, wh as getDocFromCache, _h as getDocFromServer, mh as getDocs, gh as getDocsFromCache, yh as getDocsFromServer, Uc as getFirestore, kh as increment, Bc as initializeFirestore, Hu as limit, Ju as limitToLast, Xc as loadBundle, Zc as namedQuery, Ah as onSnapshot, Rh as onSnapshotsInSync, Gu as orderBy, Ku as query, xc as queryEqual, kc as refEqual, Vh as runTransaction, Dh as serverTimestamp, ph as setDoc, $ as setLogLevel, Bu as snapshotEqual, Zu as startAfter, Xu as startAt, Yc as terminate, Th as updateDoc, zc as waitForPendingWrites, Qu as where, xh as writeBatch };
|
|
17869
17869
|
//# sourceMappingURL=index.rn.js.map
|