@firebase/firestore 3.0.2-canary.456d664ae → 3.0.2-canary.46d26ff96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/firestore/compat/api/database.d.ts +0 -9
- package/dist/firestore/compat/index.console.d.ts +10 -1
- package/dist/index.esm2017.js +2 -2
- package/dist/index.esm5.js +2 -2
- package/dist/index.node.cjs.esm2017.js +2 -2
- package/dist/index.node.cjs.js +2 -2
- package/dist/index.rn.js +708 -708
- package/dist/index.rn.js.map +1 -1
- package/dist/lite/firestore/compat/api/database.d.ts +0 -9
- package/dist/lite/firestore/compat/index.console.d.ts +10 -1
- package/dist/lite/index.browser.esm2017.js +2 -2
- package/dist/lite/index.browser.esm5.js +2 -2
- package/dist/lite/index.node.cjs.js +2 -2
- package/dist/lite/index.node.esm2017.js +2 -2
- package/dist/lite/index.rn.esm2017.js +2 -2
- package/dist/lite/packages/firestore/compat/api/database.d.ts +0 -9
- package/dist/lite/packages/firestore/compat/index.console.d.ts +10 -1
- package/dist/packages/firestore/compat/api/database.d.ts +0 -9
- package/dist/packages/firestore/compat/index.console.d.ts +10 -1
- package/package.json +9 -9
|
@@ -30,15 +30,6 @@ export interface PersistenceProvider {
|
|
|
30
30
|
enableMultiTabIndexedDbPersistence(firestore: Firestore): Promise<void>;
|
|
31
31
|
clearIndexedDbPersistence(firestore: Firestore): Promise<void>;
|
|
32
32
|
}
|
|
33
|
-
/**
|
|
34
|
-
* The persistence provider included with the memory-only SDK. This provider
|
|
35
|
-
* errors for all attempts to access persistence.
|
|
36
|
-
*/
|
|
37
|
-
export declare class MemoryPersistenceProvider implements PersistenceProvider {
|
|
38
|
-
enableIndexedDbPersistence(firestore: Firestore, forceOwnership: boolean): Promise<void>;
|
|
39
|
-
enableMultiTabIndexedDbPersistence(firestore: Firestore): Promise<void>;
|
|
40
|
-
clearIndexedDbPersistence(firestore: Firestore): Promise<void>;
|
|
41
|
-
}
|
|
42
33
|
/**
|
|
43
34
|
* The persistence provider included with the full Firestore SDK.
|
|
44
35
|
*/
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
|
|
18
18
|
import { Provider } from '@firebase/component';
|
|
19
|
-
import { Firestore as FirestoreCompat } from './api/database';
|
|
19
|
+
import { Firestore as FirestoreCompat, PersistenceProvider } from './api/database';
|
|
20
20
|
export { CollectionReference, DocumentReference, DocumentSnapshot, QuerySnapshot } from './api/database';
|
|
21
21
|
export { Blob } from './api/blob';
|
|
22
22
|
export { GeoPoint } from './api/geo_point';
|
|
@@ -27,6 +27,15 @@ export interface FirestoreDatabase {
|
|
|
27
27
|
projectId: string;
|
|
28
28
|
database?: string;
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* The persistence provider included with the memory-only SDK. This provider
|
|
32
|
+
* errors for all attempts to access persistence.
|
|
33
|
+
*/
|
|
34
|
+
export declare class MemoryPersistenceProvider implements PersistenceProvider {
|
|
35
|
+
enableIndexedDbPersistence(firestore: FirestoreCompat, forceOwnership: boolean): Promise<void>;
|
|
36
|
+
enableMultiTabIndexedDbPersistence(firestore: Firestore): Promise<void>;
|
|
37
|
+
clearIndexedDbPersistence(firestore: Firestore): Promise<void>;
|
|
38
|
+
}
|
|
30
39
|
/** Firestore class that exposes the constructor expected by the Console. */
|
|
31
40
|
export declare class Firestore extends FirestoreCompat {
|
|
32
41
|
constructor(firestoreDatabase: FirestoreDatabase, authProvider: Provider<FirebaseAuthInternalName>);
|
package/dist/index.esm2017.js
CHANGED
|
@@ -68,7 +68,7 @@ V.MOCK_USER = new V("mock-user");
|
|
|
68
68
|
* See the License for the specific language governing permissions and
|
|
69
69
|
* limitations under the License.
|
|
70
70
|
*/
|
|
71
|
-
let S = "9.0.2-canary.
|
|
71
|
+
let S = "9.0.2-canary.46d26ff96";
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* @license
|
|
@@ -17780,7 +17780,7 @@ function gh(t, e) {
|
|
|
17780
17780
|
return e = Object.assign({
|
|
17781
17781
|
useFetchStreams: !0
|
|
17782
17782
|
}, e), s._setSettings(e), s;
|
|
17783
|
-
}), "PUBLIC" /* PUBLIC */)), s("@firebase/firestore", "3.0.2-canary.
|
|
17783
|
+
}), "PUBLIC" /* PUBLIC */)), s("@firebase/firestore", "3.0.2-canary.46d26ff96", Vh);
|
|
17784
17784
|
|
|
17785
17785
|
export { th as AbstractUserDataWriter, Jc as Bytes, Cc as CACHE_SIZE_UNLIMITED, Ic as CollectionReference, Ec as DocumentReference, Su as DocumentSnapshot, zc as FieldPath, Yc as FieldValue, Nc as Firestore, q as FirestoreError, Xc as GeoPoint, Dc as LoadBundleTask, Tc as Query, $u as QueryConstraint, Du as QueryDocumentSnapshot, Cu as QuerySnapshot, Vu as SnapshotMetadata, nt as Timestamp, Eh as Transaction, sh as WriteBatch, cc as _DatabaseId, Rt as _DocumentKey, Q as _EmptyCredentialsProvider, ht as _FieldPath, _c as _cast, L as _debugAssert, ft as _isBase64Available, $ as _logWarn, lc as _validateIsNotUsedTogether, _h as addDoc, bh as arrayRemove, Rh as arrayUnion, Bc as clearIndexedDbPersistence, Ac as collection, Rc as collectionGroup, pc as connectFirestoreEmulator, wh as deleteDoc, Ih as deleteField, Kc as disableNetwork, bc as doc, Hc as documentId, Fc as enableIndexedDbPersistence, Mc as enableMultiTabIndexedDbPersistence, qc as enableNetwork, Hu as endAt, zu as endBefore, $c as ensureFirestoreConfigured, yh as executeWrite, rh as getDoc, ah as getDocFromCache, ch as getDocFromServer, uh as getDocs, hh as getDocsFromCache, lh as getDocsFromServer, kc as getFirestore, Ph as increment, xc as initializeFirestore, qu as limit, Ku as limitToLast, Qc as loadBundle, Wc as namedQuery, mh as onSnapshot, gh as onSnapshotsInSync, Bu as orderBy, Ou as query, vc as queryEqual, Pc as refEqual, Th as runTransaction, Ah as serverTimestamp, fh as setDoc, N as setLogLevel, xu as snapshotEqual, Wu as startAfter, Qu as startAt, jc as terminate, dh as updateDoc, Uc as waitForPendingWrites, Mu as where, vh as writeBatch };
|
|
17786
17786
|
//# sourceMappingURL=index.esm2017.js.map
|
package/dist/index.esm5.js
CHANGED
|
@@ -69,7 +69,7 @@ L.MOCK_USER = new L("mock-user");
|
|
|
69
69
|
* See the License for the specific language governing permissions and
|
|
70
70
|
* limitations under the License.
|
|
71
71
|
*/
|
|
72
|
-
var R = "9.0.2-canary.
|
|
72
|
+
var R = "9.0.2-canary.46d26ff96", O = new h("@firebase/firestore");
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* @license
|
|
@@ -18379,7 +18379,7 @@ R = i, o(new c("firestore", (function(t, e) {
|
|
|
18379
18379
|
return n = Object.assign({
|
|
18380
18380
|
useFetchStreams: !0
|
|
18381
18381
|
}, n), i._setSettings(n), i;
|
|
18382
|
-
}), "PUBLIC" /* PUBLIC */)), s("@firebase/firestore", "3.0.2-canary.
|
|
18382
|
+
}), "PUBLIC" /* PUBLIC */)), s("@firebase/firestore", "3.0.2-canary.46d26ff96", undefined);
|
|
18383
18383
|
|
|
18384
18384
|
export { Bc as AbstractUserDataWriter, Mu as Bytes, gu as CACHE_SIZE_UNLIMITED, cu as CollectionReference, au as DocumentReference, vc as DocumentSnapshot, Pu as FieldPath, Vu as FieldValue, wu as Firestore, Q as FirestoreError, qu as GeoPoint, mu as LoadBundleTask, uu as Query, Tc as QueryConstraint, mc as QueryDocumentSnapshot, gc as QuerySnapshot, yc as SnapshotMetadata, st as Timestamp, ah as Transaction, zc as WriteBatch, Ya as _DatabaseId, At as _DocumentKey, Y as _EmptyCredentialsProvider, pt as _FieldPath, nu as _cast, j as _debugAssert, vt as _isBase64Available, q as _logWarn, $a as _validateIsNotUsedTogether, nh as addDoc, lh as arrayRemove, fh as arrayUnion, Du as clearIndexedDbPersistence, hu as collection, fu as collectionGroup, su as connectFirestoreEmulator, eh as deleteDoc, ch as deleteField, Cu as disableNetwork, lu as doc, Fu as documentId, Su as enableIndexedDbPersistence, Nu as enableMultiTabIndexedDbPersistence, ku as enableNetwork, Fc as endAt, Pc as endBefore, Tu as ensureFirestoreConfigured, oh as executeWrite, Qc as getDoc, Wc as getDocFromCache, Yc as getDocFromServer, Jc as getDocs, Xc as getDocsFromCache, $c as getDocsFromServer, Iu as getFirestore, dh as increment, bu as initializeFirestore, kc as limit, Cc as limitToLast, Lu as loadBundle, Ru as namedQuery, rh as onSnapshot, ih as onSnapshotsInSync, Dc as orderBy, Ec as query, pu as queryEqual, du as refEqual, uh as runTransaction, hh as serverTimestamp, Zc as setDoc, F as setLogLevel, bc as snapshotEqual, Rc as startAfter, Lc as startAt, xu as terminate, th as updateDoc, Au as waitForPendingWrites, Nc as where, ph as writeBatch };
|
|
18385
18385
|
//# sourceMappingURL=index.esm5.js.map
|
|
@@ -10,7 +10,7 @@ import { resolve, join } from 'path';
|
|
|
10
10
|
import { loadSync } from '@grpc/proto-loader';
|
|
11
11
|
|
|
12
12
|
const name = "@firebase/firestore";
|
|
13
|
-
const version$1 = "3.0.2-canary.
|
|
13
|
+
const version$1 = "3.0.2-canary.46d26ff96";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @license
|
|
@@ -63,7 +63,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
|
|
|
63
63
|
User.FIRST_PARTY = new User('first-party-uid');
|
|
64
64
|
User.MOCK_USER = new User('mock-user');
|
|
65
65
|
|
|
66
|
-
const version = "9.0.2-canary.
|
|
66
|
+
const version = "9.0.2-canary.46d26ff96";
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* @license
|
package/dist/index.node.cjs.js
CHANGED
|
@@ -15,7 +15,7 @@ var path = require('path');
|
|
|
15
15
|
var protoLoader = require('@grpc/proto-loader');
|
|
16
16
|
|
|
17
17
|
var name = "@firebase/firestore";
|
|
18
|
-
var version$1 = "3.0.2-canary.
|
|
18
|
+
var version$1 = "3.0.2-canary.46d26ff96";
|
|
19
19
|
/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
@@ -67,7 +67,7 @@ User.UNAUTHENTICATED = new User(null);
|
|
|
67
67
|
User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
|
|
68
68
|
User.FIRST_PARTY = new User('first-party-uid');
|
|
69
69
|
User.MOCK_USER = new User('mock-user');
|
|
70
|
-
var version = "9.0.2-canary.
|
|
70
|
+
var version = "9.0.2-canary.46d26ff96";
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
73
73
|
* Copyright 2017 Google LLC
|
package/dist/index.rn.js
CHANGED
|
@@ -2,9 +2,9 @@ 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 c } from "@firebase/logger";
|
|
6
6
|
|
|
7
|
-
import { base64 as
|
|
7
|
+
import { base64 as a, getUA as u, isSafari as h, isMobileCordova as l, isReactNative as f, isElectron as d, isIE as w, isUWP as _, isBrowserExtension as m, createMockUserToken as g, getModularInstance as y, deepEqual as p } from "@firebase/util";
|
|
8
8
|
|
|
9
9
|
import { XhrIo as E, EventType as T, ErrorCode as I, createWebChannelTransport as A, getStatEventTarget as R, FetchXmlHttpFactory as b, WebChannel as P, Event as v, Stat as V } from "@firebase/webchannel-wrapper";
|
|
10
10
|
|
|
@@ -68,7 +68,7 @@ S.MOCK_USER = new S("mock-user");
|
|
|
68
68
|
* See the License for the specific language governing permissions and
|
|
69
69
|
* limitations under the License.
|
|
70
70
|
*/
|
|
71
|
-
let D = "9.0.2-canary.
|
|
71
|
+
let D = "9.0.2-canary.46d26ff96";
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* @license
|
|
@@ -110,14 +110,14 @@ function N() {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
function k(t, ...e) {
|
|
113
|
-
if (C.logLevel <=
|
|
113
|
+
if (C.logLevel <= c.DEBUG) {
|
|
114
114
|
const n = e.map(F);
|
|
115
115
|
C.debug(`Firestore (${D}): ${t}`, ...n);
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
function $(t, ...e) {
|
|
120
|
-
if (C.logLevel <=
|
|
120
|
+
if (C.logLevel <= c.ERROR) {
|
|
121
121
|
const n = e.map(F);
|
|
122
122
|
C.error(`Firestore (${D}): ${t}`, ...n);
|
|
123
123
|
}
|
|
@@ -126,7 +126,7 @@ function $(t, ...e) {
|
|
|
126
126
|
/**
|
|
127
127
|
* @internal
|
|
128
128
|
*/ function O(t, ...e) {
|
|
129
|
-
if (C.logLevel <=
|
|
129
|
+
if (C.logLevel <= c.WARN) {
|
|
130
130
|
const n = e.map(F);
|
|
131
131
|
C.warn(`Firestore (${D}): ${t}`, ...n);
|
|
132
132
|
}
|
|
@@ -910,7 +910,7 @@ function ot(t, e) {
|
|
|
910
910
|
for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e(n, t[n]);
|
|
911
911
|
}
|
|
912
912
|
|
|
913
|
-
function
|
|
913
|
+
function ct(t) {
|
|
914
914
|
for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
|
|
915
915
|
return !0;
|
|
916
916
|
}
|
|
@@ -934,7 +934,7 @@ function at(t) {
|
|
|
934
934
|
/**
|
|
935
935
|
* Path represents an ordered sequence of string segments.
|
|
936
936
|
*/
|
|
937
|
-
class
|
|
937
|
+
class at {
|
|
938
938
|
constructor(t, e, n) {
|
|
939
939
|
void 0 === e ? e = 0 : e > t.length && M(), void 0 === n ? n = t.length - e : n > t.length - e && M(),
|
|
940
940
|
this.segments = t, this.offset = e, this.len = n;
|
|
@@ -943,11 +943,11 @@ class ct {
|
|
|
943
943
|
return this.len;
|
|
944
944
|
}
|
|
945
945
|
isEqual(t) {
|
|
946
|
-
return 0 ===
|
|
946
|
+
return 0 === at.comparator(this, t);
|
|
947
947
|
}
|
|
948
948
|
child(t) {
|
|
949
949
|
const e = this.segments.slice(this.offset, this.limit());
|
|
950
|
-
return t instanceof
|
|
950
|
+
return t instanceof at ? t.forEach((t => {
|
|
951
951
|
e.push(t);
|
|
952
952
|
})) : e.push(t), this.construct(e);
|
|
953
953
|
}
|
|
@@ -1004,7 +1004,7 @@ class ct {
|
|
|
1004
1004
|
* within Firestore.
|
|
1005
1005
|
*
|
|
1006
1006
|
* @internal
|
|
1007
|
-
*/ class ut extends
|
|
1007
|
+
*/ class ut extends at {
|
|
1008
1008
|
construct(t, e, n) {
|
|
1009
1009
|
return new ut(t, e, n);
|
|
1010
1010
|
}
|
|
@@ -1043,7 +1043,7 @@ const ht = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
1043
1043
|
/**
|
|
1044
1044
|
* A dot-separated path for navigating sub-objects within a document.
|
|
1045
1045
|
* @internal
|
|
1046
|
-
*/ class lt extends
|
|
1046
|
+
*/ class lt extends at {
|
|
1047
1047
|
construct(t, e, n) {
|
|
1048
1048
|
return new lt(t, e, n);
|
|
1049
1049
|
}
|
|
@@ -1174,7 +1174,7 @@ function dt(t) {
|
|
|
1174
1174
|
// We use `decodeStringToByteArray()` instead of `decodeString()` since
|
|
1175
1175
|
// `decodeString()` returns Unicode strings, which doesn't match the values
|
|
1176
1176
|
// returned by `atob()`'s Latin1 representation.
|
|
1177
|
-
|
|
1177
|
+
a.decodeStringToByteArray(t, false));
|
|
1178
1178
|
}
|
|
1179
1179
|
|
|
1180
1180
|
/** Converts a binary string to a Base64 encoded string. */
|
|
@@ -1234,7 +1234,7 @@ function wt() {
|
|
|
1234
1234
|
return function(t) {
|
|
1235
1235
|
const e = [];
|
|
1236
1236
|
for (let n = 0; n < t.length; n++) e[n] = t.charCodeAt(n);
|
|
1237
|
-
return
|
|
1237
|
+
return a.encodeByteArray(e, !1);
|
|
1238
1238
|
}(this.binaryString);
|
|
1239
1239
|
}
|
|
1240
1240
|
toUint8Array() {
|
|
@@ -2019,7 +2019,7 @@ function Wt(t) {
|
|
|
2019
2019
|
// TODO(b/29183165): Make this collision robust.
|
|
2020
2020
|
return t.field.canonicalString() + t.dir;
|
|
2021
2021
|
}(t))).join(","), At(e.limit) || (t += "|l:", t += e.limit), e.startAt && (t += "|lb:",
|
|
2022
|
-
t +=
|
|
2022
|
+
t += ce(e.startAt)), e.endAt && (t += "|ub:", t += ce(e.endAt)), e.A = t;
|
|
2023
2023
|
}
|
|
2024
2024
|
return e.A;
|
|
2025
2025
|
}
|
|
@@ -2034,7 +2034,7 @@ function Gt(t) {
|
|
|
2034
2034
|
/** Filter that matches on key fields (i.e. '__name__'). */ })).join(", ")}]`),
|
|
2035
2035
|
At(t.limit) || (e += ", limit: " + t.limit), t.orderBy.length > 0 && (e += `, orderBy: [${t.orderBy.map((t => function(t) {
|
|
2036
2036
|
return `${t.field.canonicalString()} (${t.dir})`;
|
|
2037
|
-
}(t))).join(", ")}]`), t.startAt && (e += ", startAt: " +
|
|
2037
|
+
}(t))).join(", ")}]`), t.startAt && (e += ", startAt: " + ce(t.startAt)), t.endAt && (e += ", endAt: " + ce(t.endAt)),
|
|
2038
2038
|
`Target(${e})`;
|
|
2039
2039
|
}
|
|
2040
2040
|
|
|
@@ -2202,14 +2202,14 @@ function ee(t, e) {
|
|
|
2202
2202
|
}
|
|
2203
2203
|
}
|
|
2204
2204
|
|
|
2205
|
-
function
|
|
2205
|
+
function ce(t) {
|
|
2206
2206
|
// TODO(b/29183165): Make this collision robust.
|
|
2207
2207
|
return `${t.before ? "b" : "a"}:${t.position.map((t => Nt(t))).join(",")}`;
|
|
2208
2208
|
}
|
|
2209
2209
|
|
|
2210
2210
|
/**
|
|
2211
2211
|
* An ordering on a field, in some Direction. Direction defaults to ASCENDING.
|
|
2212
|
-
*/ class
|
|
2212
|
+
*/ class ae {
|
|
2213
2213
|
constructor(t, e = "asc" /* ASCENDING */) {
|
|
2214
2214
|
this.field = t, this.dir = e;
|
|
2215
2215
|
}
|
|
@@ -2271,16 +2271,16 @@ function le(t, e) {
|
|
|
2271
2271
|
* Initializes a Query with a path and optional additional query constraints.
|
|
2272
2272
|
* Path must currently be empty if this is a collection group query.
|
|
2273
2273
|
*/
|
|
2274
|
-
constructor(t, e = null, n = [], s = [], i = null, r = "F" /* First */ , o = null,
|
|
2274
|
+
constructor(t, e = null, n = [], s = [], i = null, r = "F" /* First */ , o = null, c = null) {
|
|
2275
2275
|
this.path = t, this.collectionGroup = e, this.explicitOrderBy = n, this.filters = s,
|
|
2276
|
-
this.limit = i, this.limitType = r, this.startAt = o, this.endAt =
|
|
2276
|
+
this.limit = i, this.limitType = r, this.startAt = o, this.endAt = c, this.V = null,
|
|
2277
2277
|
// The corresponding `Target` of this `Query` instance.
|
|
2278
2278
|
this.S = null, this.startAt, this.endAt;
|
|
2279
2279
|
}
|
|
2280
2280
|
}
|
|
2281
2281
|
|
|
2282
|
-
/** Creates a new Query instance with the options provided. */ function de(t, e, n, s, i, r, o,
|
|
2283
|
-
return new fe(t, e, n, s, i, r, o,
|
|
2282
|
+
/** Creates a new Query instance with the options provided. */ function de(t, e, n, s, i, r, o, c) {
|
|
2283
|
+
return new fe(t, e, n, s, i, r, o, c);
|
|
2284
2284
|
}
|
|
2285
2285
|
|
|
2286
2286
|
/** Creates a new Query for a query that matches all documents at `path` */ function we(t) {
|
|
@@ -2334,14 +2334,14 @@ function pe(t) {
|
|
|
2334
2334
|
// In order to implicitly add key ordering, we must also add the
|
|
2335
2335
|
// inequality filter field for it to be a valid query.
|
|
2336
2336
|
// Note that the default inequality field and key ordering is ascending.
|
|
2337
|
-
t.isKeyField() || e.V.push(new
|
|
2337
|
+
t.isKeyField() || e.V.push(new ae(t)), e.V.push(new ae(lt.keyField(), "asc" /* ASCENDING */)); else {
|
|
2338
2338
|
let t = !1;
|
|
2339
2339
|
for (const n of e.explicitOrderBy) e.V.push(n), n.field.isKeyField() && (t = !0);
|
|
2340
2340
|
if (!t) {
|
|
2341
2341
|
// The order of the implicit key ordering always matches the last
|
|
2342
2342
|
// explicit order by
|
|
2343
2343
|
const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
|
|
2344
|
-
e.V.push(new
|
|
2344
|
+
e.V.push(new ae(lt.keyField(), t));
|
|
2345
2345
|
}
|
|
2346
2346
|
}
|
|
2347
2347
|
}
|
|
@@ -2357,7 +2357,7 @@ function pe(t) {
|
|
|
2357
2357
|
const t = [];
|
|
2358
2358
|
for (const n of Ee(e)) {
|
|
2359
2359
|
const e = "desc" /* DESCENDING */ === n.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
|
|
2360
|
-
t.push(new
|
|
2360
|
+
t.push(new ae(n.field, e));
|
|
2361
2361
|
}
|
|
2362
2362
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
2363
2363
|
const n = e.endAt ? new oe(e.endAt.position, !e.endAt.before) : null, s = e.startAt ? new oe(e.startAt.position, !e.startAt.before) : null;
|
|
@@ -2934,8 +2934,8 @@ function sn(t) {
|
|
|
2934
2934
|
const s = new Map;
|
|
2935
2935
|
L(t.length === n.length);
|
|
2936
2936
|
for (let i = 0; i < n.length; i++) {
|
|
2937
|
-
const r = t[i], o = r.transform,
|
|
2938
|
-
s.set(r.field, ke(o,
|
|
2937
|
+
const r = t[i], o = r.transform, c = e.data.field(r.field);
|
|
2938
|
+
s.set(r.field, ke(o, c, n[i]));
|
|
2939
2939
|
}
|
|
2940
2940
|
return s;
|
|
2941
2941
|
}
|
|
@@ -2960,13 +2960,13 @@ function sn(t) {
|
|
|
2960
2960
|
return s;
|
|
2961
2961
|
}
|
|
2962
2962
|
|
|
2963
|
-
/** A mutation that deletes the document at the given key. */ class
|
|
2963
|
+
/** A mutation that deletes the document at the given key. */ class cn extends He {
|
|
2964
2964
|
constructor(t, e) {
|
|
2965
2965
|
super(), this.key = t, this.precondition = e, this.type = 2 /* Delete */ , this.fieldTransforms = [];
|
|
2966
2966
|
}
|
|
2967
2967
|
}
|
|
2968
2968
|
|
|
2969
|
-
class
|
|
2969
|
+
class an extends He {
|
|
2970
2970
|
constructor(t, e) {
|
|
2971
2971
|
super(), this.key = t, this.precondition = e, this.type = 3 /* Verify */ , this.fieldTransforms = [];
|
|
2972
2972
|
}
|
|
@@ -3951,10 +3951,10 @@ class $n {
|
|
|
3951
3951
|
/**
|
|
3952
3952
|
* Processes and adds the DocumentWatchChange to the current set of changes.
|
|
3953
3953
|
*/ rt(t) {
|
|
3954
|
-
for (const e of t.k) t.$ && t.$.isFoundDocument() ? this.ot(e, t.$) : this.
|
|
3955
|
-
for (const e of t.removedTargetIds) this.
|
|
3954
|
+
for (const e of t.k) t.$ && t.$.isFoundDocument() ? this.ot(e, t.$) : this.ct(e, t.key, t.$);
|
|
3955
|
+
for (const e of t.removedTargetIds) this.ct(e, t.key, t.$);
|
|
3956
3956
|
}
|
|
3957
|
-
/** Processes and adds the WatchTargetChange to the current set of changes. */
|
|
3957
|
+
/** Processes and adds the WatchTargetChange to the current set of changes. */ at(t) {
|
|
3958
3958
|
this.forEachTarget(t, (e => {
|
|
3959
3959
|
const n = this.ut(e);
|
|
3960
3960
|
switch (t.state) {
|
|
@@ -4022,7 +4022,7 @@ class $n {
|
|
|
4022
4022
|
// until it is resolved, essentially exposing inconsistency between
|
|
4023
4023
|
// queries.
|
|
4024
4024
|
const n = new Pt(t.path);
|
|
4025
|
-
this.
|
|
4025
|
+
this.ct(e, n, Kt.newNoDocument(n, it.min()));
|
|
4026
4026
|
} else L(1 === n); else {
|
|
4027
4027
|
this.wt(e) !== n && (
|
|
4028
4028
|
// Existence filter mismatch: We reset the mapping and raise a new
|
|
@@ -4049,7 +4049,7 @@ class $n {
|
|
|
4049
4049
|
// instead resulting in an explicit delete message and we could
|
|
4050
4050
|
// remove this special logic.
|
|
4051
4051
|
const e = new Pt(i.target.path);
|
|
4052
|
-
null !== this.nt.get(e) || this.gt(s, e) || this.
|
|
4052
|
+
null !== this.nt.get(e) || this.gt(s, e) || this.ct(s, e, Kt.newNoDocument(e, t));
|
|
4053
4053
|
}
|
|
4054
4054
|
n.K && (e.set(s, n.W()), n.G());
|
|
4055
4055
|
}
|
|
@@ -4088,7 +4088,7 @@ class $n {
|
|
|
4088
4088
|
* to update the remote document cache.
|
|
4089
4089
|
*/
|
|
4090
4090
|
// Visible for testing.
|
|
4091
|
-
|
|
4091
|
+
ct(t, e, n) {
|
|
4092
4092
|
if (!this.ht(t)) return;
|
|
4093
4093
|
const s = this.ut(t);
|
|
4094
4094
|
this.gt(t, e) ? s.H(e, 1 /* Removed */) :
|
|
@@ -4143,7 +4143,7 @@ class $n {
|
|
|
4143
4143
|
*/ lt(t) {
|
|
4144
4144
|
this.et.set(t, new kn);
|
|
4145
4145
|
this.tt.getRemoteKeysForTarget(t).forEach((e => {
|
|
4146
|
-
this.
|
|
4146
|
+
this.ct(t, e, /*updatedDocument=*/ null);
|
|
4147
4147
|
}));
|
|
4148
4148
|
}
|
|
4149
4149
|
/**
|
|
@@ -4340,7 +4340,7 @@ function ns(t, e) {
|
|
|
4340
4340
|
}(e.targetChange.targetChangeType || "NO_CHANGE"), i = e.targetChange.targetIds || [], r = function(t, e) {
|
|
4341
4341
|
return t.D ? (L(void 0 === e || "string" == typeof e), _t.fromBase64String(e || "")) : (L(void 0 === e || e instanceof Uint8Array),
|
|
4342
4342
|
_t.fromUint8Array(e || new Uint8Array));
|
|
4343
|
-
}(t, e.targetChange.resumeToken), o = e.targetChange.cause,
|
|
4343
|
+
}(t, e.targetChange.resumeToken), o = e.targetChange.cause, c = o && function(t) {
|
|
4344
4344
|
const e = void 0 === t.code ? q.UNKNOWN : dn(t.code);
|
|
4345
4345
|
return new K(e, t.message || "");
|
|
4346
4346
|
}
|
|
@@ -4352,7 +4352,7 @@ function ns(t, e) {
|
|
|
4352
4352
|
* our generated proto interfaces say Int32Value must be. But GRPC actually
|
|
4353
4353
|
* expects a { value: <number> } struct.
|
|
4354
4354
|
*/ (o);
|
|
4355
|
-
n = new xn(s, i, r,
|
|
4355
|
+
n = new xn(s, i, r, c || null);
|
|
4356
4356
|
} else if ("documentChange" in e) {
|
|
4357
4357
|
e.documentChange;
|
|
4358
4358
|
const s = e.documentChange;
|
|
@@ -4361,14 +4361,14 @@ function ns(t, e) {
|
|
|
4361
4361
|
mapValue: {
|
|
4362
4362
|
fields: s.document.fields
|
|
4363
4363
|
}
|
|
4364
|
-
}),
|
|
4365
|
-
n = new Cn(
|
|
4364
|
+
}), c = Kt.newFoundDocument(i, r, o), a = s.targetIds || [], u = s.removedTargetIds || [];
|
|
4365
|
+
n = new Cn(a, u, c.key, c);
|
|
4366
4366
|
} else if ("documentDelete" in e) {
|
|
4367
4367
|
e.documentDelete;
|
|
4368
4368
|
const s = e.documentDelete;
|
|
4369
4369
|
s.document;
|
|
4370
|
-
const i = zn(t, s.document), r = s.readTime ? jn(s.readTime) : it.min(), o = Kt.newNoDocument(i, r),
|
|
4371
|
-
n = new Cn([],
|
|
4370
|
+
const i = zn(t, s.document), r = s.readTime ? jn(s.readTime) : it.min(), o = Kt.newNoDocument(i, r), c = s.removedTargetIds || [];
|
|
4371
|
+
n = new Cn([], c, o.key, o);
|
|
4372
4372
|
} else if ("documentRemove" in e) {
|
|
4373
4373
|
e.documentRemove;
|
|
4374
4374
|
const s = e.documentRemove;
|
|
@@ -4392,13 +4392,13 @@ function ss(t, e) {
|
|
|
4392
4392
|
let n;
|
|
4393
4393
|
if (e instanceof en) n = {
|
|
4394
4394
|
update: Zn(t, e.key, e.value)
|
|
4395
|
-
}; else if (e instanceof
|
|
4395
|
+
}; else if (e instanceof cn) n = {
|
|
4396
4396
|
delete: Gn(t, e.key)
|
|
4397
4397
|
}; else if (e instanceof nn) n = {
|
|
4398
4398
|
update: Zn(t, e.key, e.data),
|
|
4399
4399
|
updateMask: ps(e.fieldMask)
|
|
4400
4400
|
}; else {
|
|
4401
|
-
if (!(e instanceof
|
|
4401
|
+
if (!(e instanceof an)) return M();
|
|
4402
4402
|
n = {
|
|
4403
4403
|
verify: Gn(t, e.key)
|
|
4404
4404
|
};
|
|
@@ -4468,11 +4468,11 @@ function is(t, e) {
|
|
|
4468
4468
|
}
|
|
4469
4469
|
if (e.delete) {
|
|
4470
4470
|
const s = zn(t, e.delete);
|
|
4471
|
-
return new
|
|
4471
|
+
return new cn(s, n);
|
|
4472
4472
|
}
|
|
4473
4473
|
if (e.verify) {
|
|
4474
4474
|
const s = zn(t, e.verify);
|
|
4475
|
-
return new
|
|
4475
|
+
return new an(s, n);
|
|
4476
4476
|
}
|
|
4477
4477
|
return M();
|
|
4478
4478
|
}
|
|
@@ -4497,7 +4497,7 @@ function os(t, e) {
|
|
|
4497
4497
|
};
|
|
4498
4498
|
}
|
|
4499
4499
|
|
|
4500
|
-
function
|
|
4500
|
+
function cs(t, e) {
|
|
4501
4501
|
// Dissect the path into parent, collectionId, and optional key filter.
|
|
4502
4502
|
const n = {
|
|
4503
4503
|
structuredQuery: {}
|
|
@@ -4581,7 +4581,7 @@ function as(t, e) {
|
|
|
4581
4581
|
e.endAt && (n.structuredQuery.endAt = ls(e.endAt)), n;
|
|
4582
4582
|
}
|
|
4583
4583
|
|
|
4584
|
-
function
|
|
4584
|
+
function as(t) {
|
|
4585
4585
|
let e = Jn(t.parent);
|
|
4586
4586
|
const n = t.structuredQuery, s = n.from ? n.from.length : 0;
|
|
4587
4587
|
let i = null;
|
|
@@ -4594,7 +4594,7 @@ function cs(t) {
|
|
|
4594
4594
|
n.where && (r = hs(n.where));
|
|
4595
4595
|
let o = [];
|
|
4596
4596
|
n.orderBy && (o = n.orderBy.map((t => function(t) {
|
|
4597
|
-
return new
|
|
4597
|
+
return new ae(ms(t.field),
|
|
4598
4598
|
// visible for testing
|
|
4599
4599
|
function(t) {
|
|
4600
4600
|
switch (t) {
|
|
@@ -4611,15 +4611,15 @@ function cs(t) {
|
|
|
4611
4611
|
// visible for testing
|
|
4612
4612
|
(t.direction));
|
|
4613
4613
|
}(t))));
|
|
4614
|
-
let
|
|
4615
|
-
n.limit && (
|
|
4614
|
+
let c = null;
|
|
4615
|
+
n.limit && (c = function(t) {
|
|
4616
4616
|
let e;
|
|
4617
4617
|
return e = "object" == typeof t ? t.value : t, At(e) ? null : e;
|
|
4618
4618
|
}(n.limit));
|
|
4619
|
-
let
|
|
4620
|
-
n.startAt && (
|
|
4619
|
+
let a = null;
|
|
4620
|
+
n.startAt && (a = fs(n.startAt));
|
|
4621
4621
|
let u = null;
|
|
4622
|
-
return n.endAt && (u = fs(n.endAt)), de(e, i, o, r,
|
|
4622
|
+
return n.endAt && (u = fs(n.endAt)), de(e, i, o, r, c, "F" /* First */ , a, u);
|
|
4623
4623
|
}
|
|
4624
4624
|
|
|
4625
4625
|
function us(t, e) {
|
|
@@ -6219,8 +6219,8 @@ function ei(t, e) {
|
|
|
6219
6219
|
return M();
|
|
6220
6220
|
}
|
|
6221
6221
|
|
|
6222
|
-
/** Encodes a document for storage locally. */ function
|
|
6223
|
-
const s =
|
|
6222
|
+
/** Encodes a document for storage locally. */ function ci(t, e, n) {
|
|
6223
|
+
const s = ai(n), i = e.key.path.popLast().toArray();
|
|
6224
6224
|
if (e.isFoundDocument()) {
|
|
6225
6225
|
const n = function(t, e) {
|
|
6226
6226
|
return {
|
|
@@ -6249,7 +6249,7 @@ function ei(t, e) {
|
|
|
6249
6249
|
return M();
|
|
6250
6250
|
}
|
|
6251
6251
|
|
|
6252
|
-
function
|
|
6252
|
+
function ai(t) {
|
|
6253
6253
|
const e = t.toTimestamp();
|
|
6254
6254
|
return [ e.seconds, e.nanoseconds ];
|
|
6255
6255
|
}
|
|
@@ -6296,14 +6296,14 @@ function fi(t, e) {
|
|
|
6296
6296
|
var i;
|
|
6297
6297
|
return void 0 !== t.query.documents ? (L(1 === (i = t.query).documents.length),
|
|
6298
6298
|
s = Te(we(Jn(i.documents[0])))) : s = function(t) {
|
|
6299
|
-
return Te(
|
|
6299
|
+
return Te(as(t));
|
|
6300
6300
|
}(t.query), new ii(s, t.targetId, 0 /* Listen */ , t.lastListenSequenceNumber, e, n, _t.fromBase64String(t.resumeToken));
|
|
6301
6301
|
}
|
|
6302
6302
|
|
|
6303
6303
|
/** Encodes TargetData into a DbTarget for storage locally. */ function wi(t, e) {
|
|
6304
6304
|
const n = hi(e.snapshotVersion), s = hi(e.lastLimboFreeSnapshotVersion);
|
|
6305
6305
|
let i;
|
|
6306
|
-
i = Ht(e.target) ? os(t.Wt, e.target) :
|
|
6306
|
+
i = Ht(e.target) ? os(t.Wt, e.target) : cs(t.Wt, e.target);
|
|
6307
6307
|
// We can't store the resumeToken as a ByteString in IndexedDb, so we
|
|
6308
6308
|
// convert it to a base64 string for storage.
|
|
6309
6309
|
const r = e.resumeToken.toBase64();
|
|
@@ -6321,7 +6321,7 @@ function fi(t, e) {
|
|
|
6321
6321
|
* including features exists only in SDKs (for example: limit-to-last).
|
|
6322
6322
|
*/
|
|
6323
6323
|
function _i(t) {
|
|
6324
|
-
const e =
|
|
6324
|
+
const e = as({
|
|
6325
6325
|
parent: t.parent,
|
|
6326
6326
|
structuredQuery: t.structuredQuery
|
|
6327
6327
|
});
|
|
@@ -6587,12 +6587,12 @@ class Ri {
|
|
|
6587
6587
|
*/
|
|
6588
6588
|
function bi(t, e, n) {
|
|
6589
6589
|
const s = t.store(Vs.store), i = t.store(Ss.store), r = [], o = IDBKeyRange.only(n.batchId);
|
|
6590
|
-
let
|
|
6591
|
-
const
|
|
6590
|
+
let c = 0;
|
|
6591
|
+
const a = s.Kt({
|
|
6592
6592
|
range: o
|
|
6593
|
-
}, ((t, e, n) => (
|
|
6594
|
-
r.push(
|
|
6595
|
-
L(1 ===
|
|
6593
|
+
}, ((t, e, n) => (c++, n.delete())));
|
|
6594
|
+
r.push(a.next((() => {
|
|
6595
|
+
L(1 === c);
|
|
6596
6596
|
})));
|
|
6597
6597
|
const u = [];
|
|
6598
6598
|
for (const t of n.mutations) {
|
|
@@ -6692,20 +6692,20 @@ class vi {
|
|
|
6692
6692
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6693
6693
|
return r.add({}).next((o => {
|
|
6694
6694
|
L("number" == typeof o);
|
|
6695
|
-
const
|
|
6695
|
+
const c = new ni(o, e, n, s), a = function(t, e, n) {
|
|
6696
6696
|
const s = n.baseMutations.map((e => ss(t.Wt, e))), i = n.mutations.map((e => ss(t.Wt, e)));
|
|
6697
6697
|
return new Vs(e, n.batchId, n.localWriteTime.toMillis(), s, i);
|
|
6698
|
-
}(this.N, this.userId,
|
|
6698
|
+
}(this.N, this.userId, c), u = [];
|
|
6699
6699
|
let h = new gn(((t, e) => tt(t.canonicalString(), e.canonicalString())));
|
|
6700
6700
|
for (const t of s) {
|
|
6701
6701
|
const e = Ss.key(this.userId, t.key.path, o);
|
|
6702
|
-
h = h.add(t.key.path.popLast()), u.push(r.put(
|
|
6702
|
+
h = h.add(t.key.path.popLast()), u.push(r.put(a)), u.push(i.put(e, Ss.PLACEHOLDER));
|
|
6703
6703
|
}
|
|
6704
6704
|
return h.forEach((e => {
|
|
6705
6705
|
u.push(this.Ht.addToCollectionParentIndex(t, e));
|
|
6706
6706
|
})), t.addOnCommittedListener((() => {
|
|
6707
|
-
this.Jt[o] =
|
|
6708
|
-
})), js.waitFor(u).next((() =>
|
|
6707
|
+
this.Jt[o] = c.keys();
|
|
6708
|
+
})), js.waitFor(u).next((() => c));
|
|
6709
6709
|
}));
|
|
6710
6710
|
}
|
|
6711
6711
|
lookupMutationBatch(t, e) {
|
|
@@ -6759,7 +6759,7 @@ class vi {
|
|
|
6759
6759
|
return Di(t).Kt({
|
|
6760
6760
|
range: s
|
|
6761
6761
|
}, ((n, s, r) => {
|
|
6762
|
-
const [o,
|
|
6762
|
+
const [o, c, a] = n, u = Rs(c);
|
|
6763
6763
|
// Only consider rows matching exactly the specific key of
|
|
6764
6764
|
// interest. Note that because we order by path first, and we
|
|
6765
6765
|
// order terminators before path separators, we'll encounter all
|
|
@@ -6769,7 +6769,7 @@ class vi {
|
|
|
6769
6769
|
// can stop as soon as we hit any such row.
|
|
6770
6770
|
if (o === this.userId && e.path.isEqual(u))
|
|
6771
6771
|
// Look up the mutation batch in the store.
|
|
6772
|
-
return Si(t).get(
|
|
6772
|
+
return Si(t).get(a).next((t => {
|
|
6773
6773
|
if (!t) throw M();
|
|
6774
6774
|
L(t.userId === this.userId), i.push(fi(this.N, t));
|
|
6775
6775
|
}));
|
|
@@ -6783,7 +6783,7 @@ class vi {
|
|
|
6783
6783
|
const i = Ss.prefixForPath(this.userId, e.path), r = IDBKeyRange.lowerBound(i), o = Di(t).Kt({
|
|
6784
6784
|
range: r
|
|
6785
6785
|
}, ((t, s, i) => {
|
|
6786
|
-
const [r, o,
|
|
6786
|
+
const [r, o, c] = t, a = Rs(o);
|
|
6787
6787
|
// Only consider rows matching exactly the specific key of
|
|
6788
6788
|
// interest. Note that because we order by path first, and we
|
|
6789
6789
|
// order terminators before path separators, we'll encounter all
|
|
@@ -6791,7 +6791,7 @@ class vi {
|
|
|
6791
6791
|
// the rows for documentKey will occur before any rows for
|
|
6792
6792
|
// documents nested in a subcollection beneath documentKey so we
|
|
6793
6793
|
// can stop as soon as we hit any such row.
|
|
6794
|
-
r === this.userId && e.path.isEqual(
|
|
6794
|
+
r === this.userId && e.path.isEqual(a) ? n = n.add(c) : i.done();
|
|
6795
6795
|
}));
|
|
6796
6796
|
s.push(o);
|
|
6797
6797
|
})), js.waitFor(s).next((() => this.Zt(t, n)));
|
|
@@ -6805,14 +6805,14 @@ class vi {
|
|
|
6805
6805
|
return Di(t).Kt({
|
|
6806
6806
|
range: r
|
|
6807
6807
|
}, ((t, e, i) => {
|
|
6808
|
-
const [r,
|
|
6808
|
+
const [r, c, a] = t, u = Rs(c);
|
|
6809
6809
|
r === this.userId && n.isPrefixOf(u) ?
|
|
6810
6810
|
// Rows with document keys more than one segment longer than the
|
|
6811
6811
|
// query path can't be matches. For example, a query on 'rooms'
|
|
6812
6812
|
// can't match the document /rooms/abc/messages/xyx.
|
|
6813
6813
|
// TODO(mcg): we'll need a different scanner when we implement
|
|
6814
6814
|
// ancestor queries.
|
|
6815
|
-
u.length === s && (o = o.add(
|
|
6815
|
+
u.length === s && (o = o.add(a)) : i.done();
|
|
6816
6816
|
})).next((() => this.Zt(t, o)));
|
|
6817
6817
|
}
|
|
6818
6818
|
Zt(t, e) {
|
|
@@ -6881,8 +6881,8 @@ class vi {
|
|
|
6881
6881
|
range: r,
|
|
6882
6882
|
qt: !0
|
|
6883
6883
|
}, ((t, n, s) => {
|
|
6884
|
-
const [r,
|
|
6885
|
-
r === e &&
|
|
6884
|
+
const [r, c, /*batchID*/ a] = t;
|
|
6885
|
+
r === e && c === i && (o = !0), s.done();
|
|
6886
6886
|
})).next((() => o));
|
|
6887
6887
|
}
|
|
6888
6888
|
|
|
@@ -6999,11 +6999,11 @@ class Ni {
|
|
|
6999
6999
|
e > s.highestListenSequenceNumber && (s.highestListenSequenceNumber = e), this.oe(t, s))));
|
|
7000
7000
|
}
|
|
7001
7001
|
addTargetData(t, e) {
|
|
7002
|
-
return this.
|
|
7002
|
+
return this.ce(t, e).next((() => this.re(t).next((n => (n.targetCount += 1, this.ae(e, n),
|
|
7003
7003
|
this.oe(t, n))))));
|
|
7004
7004
|
}
|
|
7005
7005
|
updateTargetData(t, e) {
|
|
7006
|
-
return this.
|
|
7006
|
+
return this.ce(t, e);
|
|
7007
7007
|
}
|
|
7008
7008
|
removeTargetData(t, e) {
|
|
7009
7009
|
return this.removeMatchingKeysForTargetId(t, e.targetId).next((() => ki(t).delete(e.targetId))).next((() => this.re(t))).next((e => (L(e.targetCount > 0),
|
|
@@ -7017,8 +7017,8 @@ class Ni {
|
|
|
7017
7017
|
let s = 0;
|
|
7018
7018
|
const i = [];
|
|
7019
7019
|
return ki(t).Kt(((r, o) => {
|
|
7020
|
-
const
|
|
7021
|
-
|
|
7020
|
+
const c = di(o);
|
|
7021
|
+
c.sequenceNumber <= e && null === n.get(c.targetId) && (s++, i.push(this.removeTargetData(t, c)));
|
|
7022
7022
|
})).next((() => js.waitFor(i))).next((() => s));
|
|
7023
7023
|
}
|
|
7024
7024
|
/**
|
|
@@ -7035,14 +7035,14 @@ class Ni {
|
|
|
7035
7035
|
oe(t, e) {
|
|
7036
7036
|
return $i(t).put(Os.key, e);
|
|
7037
7037
|
}
|
|
7038
|
-
|
|
7038
|
+
ce(t, e) {
|
|
7039
7039
|
return ki(t).put(wi(this.N, e));
|
|
7040
7040
|
}
|
|
7041
7041
|
/**
|
|
7042
7042
|
* In-place updates the provided metadata to account for values in the given
|
|
7043
7043
|
* TargetData. Saving is done separately. Returns true if there were any
|
|
7044
7044
|
* changes to the metadata.
|
|
7045
|
-
*/
|
|
7045
|
+
*/ ae(t, e) {
|
|
7046
7046
|
let n = !1;
|
|
7047
7047
|
return t.targetId > e.highestTargetId && (e.highestTargetId = t.targetId, n = !0),
|
|
7048
7048
|
t.sequenceNumber > e.highestListenSequenceNumber && (e.highestListenSequenceNumber = t.sequenceNumber,
|
|
@@ -7287,16 +7287,16 @@ class Ni {
|
|
|
7287
7287
|
return this.me.getCacheSize(t);
|
|
7288
7288
|
}
|
|
7289
7289
|
pe(t, e) {
|
|
7290
|
-
let n, s, i, r, o,
|
|
7290
|
+
let n, s, i, r, o, a, u;
|
|
7291
7291
|
const h = Date.now();
|
|
7292
7292
|
return this.calculateTargetCount(t, this.params.percentileToCollect).next((e => (
|
|
7293
7293
|
// Cap at the configured max
|
|
7294
7294
|
e > this.params.maximumSequenceNumbersToCollect ? (k("LruGarbageCollector", `Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${e}`),
|
|
7295
7295
|
s = this.params.maximumSequenceNumbersToCollect) : s = e, r = Date.now(), this.nthSequenceNumber(t, s)))).next((s => (n = s,
|
|
7296
|
-
o = Date.now(), this.removeTargets(t, n, e)))).next((e => (i = e,
|
|
7296
|
+
o = Date.now(), this.removeTargets(t, n, e)))).next((e => (i = e, a = Date.now(),
|
|
7297
7297
|
this.removeOrphanedDocuments(t, n)))).next((t => {
|
|
7298
|
-
if (u = Date.now(), N() <=
|
|
7299
|
-
k("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 ` + (
|
|
7298
|
+
if (u = Date.now(), N() <= c.DEBUG) {
|
|
7299
|
+
k("LruGarbageCollector", `LRU Garbage Collection\n\tCounted targets in ${r - h}ms\n\tDetermined least recently used ${s} in ` + (o - r) + "ms\n" + `\tRemoved ${i} targets in ` + (a - o) + "ms\n" + `\tRemoved ${t} documents in ` + (u - a) + "ms\n" + `Total Duration: ${u - h}ms`);
|
|
7300
7300
|
}
|
|
7301
7301
|
return js.resolve({
|
|
7302
7302
|
didRun: !0,
|
|
@@ -7499,7 +7499,7 @@ function Ki(t, e) {
|
|
|
7499
7499
|
}));
|
|
7500
7500
|
}
|
|
7501
7501
|
isEmpty() {
|
|
7502
|
-
return
|
|
7502
|
+
return ct(this.inner);
|
|
7503
7503
|
}
|
|
7504
7504
|
}
|
|
7505
7505
|
|
|
@@ -7722,7 +7722,7 @@ function Ki(t, e) {
|
|
|
7722
7722
|
// Execute an index-free query and filter by read time. This is safe
|
|
7723
7723
|
// since all document changes to queries that have a
|
|
7724
7724
|
// lastLimboFreeSnapshotVersion (`sinceReadTime`) have a read time set.
|
|
7725
|
-
const t = e.path.toArray(), s =
|
|
7725
|
+
const t = e.path.toArray(), s = ai(n);
|
|
7726
7726
|
r.range = IDBKeyRange.lowerBound([ t, s ],
|
|
7727
7727
|
/* open= */ !0), r.index = Ns.collectionReadTimeIndex;
|
|
7728
7728
|
}
|
|
@@ -7793,16 +7793,16 @@ class Gi extends Qi {
|
|
|
7793
7793
|
return this.changes.forEach(((i, r) => {
|
|
7794
7794
|
const o = this.De.get(i);
|
|
7795
7795
|
if (r.document.isValidDocument()) {
|
|
7796
|
-
const
|
|
7796
|
+
const c = ci(this.Se.N, r.document, this.getReadTime(i));
|
|
7797
7797
|
s = s.add(i.path.popLast());
|
|
7798
|
-
const
|
|
7799
|
-
n +=
|
|
7798
|
+
const a = Pi(c);
|
|
7799
|
+
n += a - o, e.push(this.Se.addEntry(t, i, c));
|
|
7800
7800
|
} else if (n -= o, this.trackRemovals) {
|
|
7801
7801
|
// In order to track removals, we store a "sentinel delete" in the
|
|
7802
7802
|
// RemoteDocumentCache. This entry is represented by a NoDocument
|
|
7803
7803
|
// with a version of 0 and ignored by `maybeDecodeDocument()` but
|
|
7804
7804
|
// preserved in `getNewDocumentChanges()`.
|
|
7805
|
-
const n =
|
|
7805
|
+
const n = ci(this.Se.N, Kt.newNoDocument(i, it.min()), this.getReadTime(i));
|
|
7806
7806
|
e.push(this.Se.addEntry(t, i, n));
|
|
7807
7807
|
} else e.push(this.Se.removeEntry(t, i));
|
|
7808
7808
|
})), s.forEach((n => {
|
|
@@ -8126,14 +8126,14 @@ class tr {
|
|
|
8126
8126
|
* Whether to synchronize the in-memory state of multiple tabs and share
|
|
8127
8127
|
* access to local persistence.
|
|
8128
8128
|
*/
|
|
8129
|
-
t, e, n, s, i, r, o,
|
|
8129
|
+
t, e, n, s, i, r, o, c, a,
|
|
8130
8130
|
/**
|
|
8131
8131
|
* If set to true, forcefully obtains database access. Existing tabs will
|
|
8132
8132
|
* no longer be able to access IndexedDB.
|
|
8133
8133
|
*/
|
|
8134
8134
|
u) {
|
|
8135
8135
|
if (this.allowTabSynchronization = t, this.persistenceKey = e, this.clientId = n,
|
|
8136
|
-
this.Oe = i, this.window = r, this.document = o, this.Fe =
|
|
8136
|
+
this.Oe = i, this.window = r, this.document = o, this.Fe = a, this.Me = u, this.Le = null,
|
|
8137
8137
|
this.Be = !1, this.isPrimary = !1, this.networkEnabled = !0,
|
|
8138
8138
|
/** Our window.unload handler, if registered. */
|
|
8139
8139
|
this.Ue = null, this.inForeground = !1,
|
|
@@ -8145,7 +8145,7 @@ class tr {
|
|
|
8145
8145
|
this.je = Number.NEGATIVE_INFINITY,
|
|
8146
8146
|
/** A listener to notify on primary state changes. */
|
|
8147
8147
|
this.Qe = t => Promise.resolve(), !tr.bt()) throw new K(q.UNIMPLEMENTED, "This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");
|
|
8148
|
-
this.referenceDelegate = new qi(this, s), this.We = e + "main", this.N = new ri(
|
|
8148
|
+
this.referenceDelegate = new qi(this, s), this.We = e + "main", this.N = new ri(c),
|
|
8149
8149
|
this.Ge = new Ws(this.We, 11, new Yi(this.N)), this.ze = new xi(this.referenceDelegate, this.N),
|
|
8150
8150
|
this.Ht = new Ti, this.He = function(t, e) {
|
|
8151
8151
|
return new Wi(t, e);
|
|
@@ -8223,7 +8223,7 @@ class tr {
|
|
|
8223
8223
|
if (this.isPrimary) return this.sn(t).next((t => {
|
|
8224
8224
|
t || (this.isPrimary = !1, this.Oe.enqueueRetryable((() => this.Qe(!1))));
|
|
8225
8225
|
}));
|
|
8226
|
-
})).next((() => this.rn(t))).next((e => this.isPrimary && !e ? this.on(t).next((() => !1)) : !!e && this.
|
|
8226
|
+
})).next((() => this.rn(t))).next((e => this.isPrimary && !e ? this.on(t).next((() => !1)) : !!e && this.cn(t).next((() => !0)))))).catch((t => {
|
|
8227
8227
|
if (Hs(t))
|
|
8228
8228
|
// Proceed with the existing state. Any subsequent access to
|
|
8229
8229
|
// IndexedDB will verify the lease.
|
|
@@ -8236,7 +8236,7 @@ class tr {
|
|
|
8236
8236
|
}));
|
|
8237
8237
|
}
|
|
8238
8238
|
sn(t) {
|
|
8239
|
-
return er(t).get(Ps.key).next((t => js.resolve(this.
|
|
8239
|
+
return er(t).get(Ps.key).next((t => js.resolve(this.an(t))));
|
|
8240
8240
|
}
|
|
8241
8241
|
un(t) {
|
|
8242
8242
|
return nr(t).delete(this.clientId);
|
|
@@ -8270,7 +8270,7 @@ class tr {
|
|
|
8270
8270
|
*/ en() {
|
|
8271
8271
|
this.Ke = this.Oe.enqueueAfterDelay("client_metadata_refresh" /* ClientMetadataRefresh */ , 4e3, (() => this.Xe().then((() => this.hn())).then((() => this.en()))));
|
|
8272
8272
|
}
|
|
8273
|
-
/** Checks whether `client` is the local client. */
|
|
8273
|
+
/** Checks whether `client` is the local client. */ an(t) {
|
|
8274
8274
|
return !!t && t.ownerId === this.clientId;
|
|
8275
8275
|
}
|
|
8276
8276
|
/**
|
|
@@ -8292,8 +8292,8 @@ class tr {
|
|
|
8292
8292
|
// the foreground.
|
|
8293
8293
|
// - the `forceOwningTab` setting was passed in.
|
|
8294
8294
|
if (null !== e && this.ln(e.leaseTimestampMs, 5e3) && !this.wn(e.ownerId)) {
|
|
8295
|
-
if (this.
|
|
8296
|
-
if (!this.
|
|
8295
|
+
if (this.an(e) && this.networkEnabled) return !0;
|
|
8296
|
+
if (!this.an(e)) {
|
|
8297
8297
|
if (!e.allowTabSynchronization)
|
|
8298
8298
|
// Fail the `canActAsPrimary` check if the current leaseholder has
|
|
8299
8299
|
// not opted into multi-tab synchronization. If this happens at
|
|
@@ -8379,7 +8379,7 @@ class tr {
|
|
|
8379
8379
|
if (!e) throw $(`Failed to obtain primary lease for action '${t}'.`), this.isPrimary = !1,
|
|
8380
8380
|
this.Oe.enqueueRetryable((() => this.Qe(!1))), new K(q.FAILED_PRECONDITION, qs);
|
|
8381
8381
|
return n(i);
|
|
8382
|
-
})).next((t => this.
|
|
8382
|
+
})).next((t => this.cn(i).next((() => t)))) : this.En(i).next((() => n(i)))))).then((t => (i.raiseOnCommittedEvent(),
|
|
8383
8383
|
t)));
|
|
8384
8384
|
}
|
|
8385
8385
|
/**
|
|
@@ -8390,13 +8390,13 @@ class tr {
|
|
|
8390
8390
|
// be turned off.
|
|
8391
8391
|
En(t) {
|
|
8392
8392
|
return er(t).get(Ps.key).next((t => {
|
|
8393
|
-
if (null !== t && this.ln(t.leaseTimestampMs, 5e3) && !this.wn(t.ownerId) && !this.
|
|
8393
|
+
if (null !== t && this.ln(t.leaseTimestampMs, 5e3) && !this.wn(t.ownerId) && !this.an(t) && !(this.Me || this.allowTabSynchronization && t.allowTabSynchronization)) throw new K(q.FAILED_PRECONDITION, Zi);
|
|
8394
8394
|
}));
|
|
8395
8395
|
}
|
|
8396
8396
|
/**
|
|
8397
8397
|
* Obtains or extends the new primary lease for the local client. This
|
|
8398
8398
|
* method does not verify that the client is eligible for this lease.
|
|
8399
|
-
*/
|
|
8399
|
+
*/ cn(t) {
|
|
8400
8400
|
const e = new Ps(this.clientId, this.allowTabSynchronization, Date.now());
|
|
8401
8401
|
return er(t).put(Ps.key, e);
|
|
8402
8402
|
}
|
|
@@ -8405,7 +8405,7 @@ class tr {
|
|
|
8405
8405
|
}
|
|
8406
8406
|
/** Checks the primary lease and removes it if we are the current primary. */ on(t) {
|
|
8407
8407
|
const e = er(t);
|
|
8408
|
-
return e.get(Ps.key).next((t => this.
|
|
8408
|
+
return e.get(Ps.key).next((t => this.an(t) ? (k("IndexedDbPersistence", "Releasing primary lease."),
|
|
8409
8409
|
e.delete(Ps.key)) : js.resolve()));
|
|
8410
8410
|
}
|
|
8411
8411
|
/** Verifies that `updateTimeMs` is within `maxAgeMs`. */ ln(t, e) {
|
|
@@ -8737,7 +8737,7 @@ class ir {
|
|
|
8737
8737
|
* another document that is in the local cache.
|
|
8738
8738
|
*
|
|
8739
8739
|
* - Queries that have never been CURRENT or free of limbo documents.
|
|
8740
|
-
*/ class
|
|
8740
|
+
*/ class cr {
|
|
8741
8741
|
/** Sets the document view to query against. */
|
|
8742
8742
|
$n(t) {
|
|
8743
8743
|
this.On = t;
|
|
@@ -8750,7 +8750,7 @@ class ir {
|
|
|
8750
8750
|
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());
|
|
8751
8751
|
}(e) || n.isEqual(it.min()) ? this.Fn(t, e) : this.On.Pn(t, s).next((i => {
|
|
8752
8752
|
const r = this.Mn(e, i);
|
|
8753
|
-
return (_e(e) || me(e)) && this.Ln(e.limitType, r, s, n) ? this.Fn(t, e) : (N() <=
|
|
8753
|
+
return (_e(e) || me(e)) && this.Ln(e.limitType, r, s, n) ? this.Fn(t, e) : (N() <= c.DEBUG && k("QueryEngine", "Re-using previous result from %s to execute query: %s", n.toString(), be(e)),
|
|
8754
8754
|
this.On.getDocumentsMatchingQuery(t, e, n).next((t => (
|
|
8755
8755
|
// We merge `previousResults` into `updateResults`, since
|
|
8756
8756
|
// `updateResults` is already a DocumentMap. If a document is
|
|
@@ -8796,7 +8796,7 @@ class ir {
|
|
|
8796
8796
|
return !!i && (i.hasPendingWrites || i.version.compareTo(s) > 0);
|
|
8797
8797
|
}
|
|
8798
8798
|
Fn(t, e) {
|
|
8799
|
-
return N() <=
|
|
8799
|
+
return N() <= c.DEBUG && k("QueryEngine", "Using full collection scan to execute query:", be(e)),
|
|
8800
8800
|
this.On.getDocumentsMatchingQuery(t, e, it.min());
|
|
8801
8801
|
}
|
|
8802
8802
|
}
|
|
@@ -8825,7 +8825,7 @@ class ir {
|
|
|
8825
8825
|
* This is useful to implement optional features (like bundles) in free
|
|
8826
8826
|
* functions, such that they are tree-shakeable.
|
|
8827
8827
|
*/
|
|
8828
|
-
class
|
|
8828
|
+
class ar {
|
|
8829
8829
|
constructor(
|
|
8830
8830
|
/** Manages our in-memory or durable persistence. */
|
|
8831
8831
|
t, e, n, s) {
|
|
@@ -8857,7 +8857,7 @@ class cr {
|
|
|
8857
8857
|
function ur(
|
|
8858
8858
|
/** Manages our in-memory or durable persistence. */
|
|
8859
8859
|
t, e, n, s) {
|
|
8860
|
-
return new
|
|
8860
|
+
return new ar(t, e, n, s);
|
|
8861
8861
|
}
|
|
8862
8862
|
|
|
8863
8863
|
/**
|
|
@@ -8976,16 +8976,16 @@ function fr(t) {
|
|
|
8976
8976
|
i = n.Un;
|
|
8977
8977
|
const o = [];
|
|
8978
8978
|
e.targetChanges.forEach(((e, r) => {
|
|
8979
|
-
const
|
|
8980
|
-
if (!
|
|
8979
|
+
const c = i.get(r);
|
|
8980
|
+
if (!c) return;
|
|
8981
8981
|
// Only update the remote keys if the target is still active. This
|
|
8982
8982
|
// ensures that we can persist the updated target data along with
|
|
8983
8983
|
// the updated assignment.
|
|
8984
8984
|
o.push(n.ze.removeMatchingKeys(t, e.removedDocuments, r).next((() => n.ze.addMatchingKeys(t, e.addedDocuments, r))));
|
|
8985
|
-
const
|
|
8985
|
+
const a = e.resumeToken;
|
|
8986
8986
|
// Update the resume token if the change includes one.
|
|
8987
|
-
if (
|
|
8988
|
-
const u =
|
|
8987
|
+
if (a.approximateByteSize() > 0) {
|
|
8988
|
+
const u = c.withResumeToken(a, s).withSequenceNumber(t.currentSequenceNumber);
|
|
8989
8989
|
i = i.insert(r, u),
|
|
8990
8990
|
// Update the target data if there are target changes (or if
|
|
8991
8991
|
// sufficient time has passed since the last update).
|
|
@@ -9018,10 +9018,10 @@ function fr(t) {
|
|
|
9018
9018
|
}
|
|
9019
9019
|
/**
|
|
9020
9020
|
* Notifies local store of the changed views to locally pin documents.
|
|
9021
|
-
*/ (
|
|
9021
|
+
*/ (c, u, e) && o.push(n.ze.updateTargetData(t, u));
|
|
9022
9022
|
}
|
|
9023
9023
|
}));
|
|
9024
|
-
let
|
|
9024
|
+
let c = En();
|
|
9025
9025
|
// HACK: The only reason we allow a null snapshot version is so that we
|
|
9026
9026
|
// can synthesize remote events when we get permission denied errors while
|
|
9027
9027
|
// trying to resolve the state of a locally cached document that is in
|
|
@@ -9032,12 +9032,12 @@ function fr(t) {
|
|
|
9032
9032
|
// Each loop iteration only affects its "own" doc, so it's safe to get all the remote
|
|
9033
9033
|
// documents in advance in a single call.
|
|
9034
9034
|
o.push(wr(t, r, e.documentUpdates, s, void 0).next((t => {
|
|
9035
|
-
|
|
9035
|
+
c = t;
|
|
9036
9036
|
}))), !s.isEqual(it.min())) {
|
|
9037
9037
|
const e = n.ze.getLastRemoteSnapshotVersion(t).next((e => n.ze.setTargetsMetadata(t, t.currentSequenceNumber, s)));
|
|
9038
9038
|
o.push(e);
|
|
9039
9039
|
}
|
|
9040
|
-
return js.waitFor(o).next((() => r.apply(t))).next((() => n.Qn.vn(t,
|
|
9040
|
+
return js.waitFor(o).next((() => r.apply(t))).next((() => n.Qn.vn(t, c))).next((() => c));
|
|
9041
9041
|
})).then((t => (n.Un = i, t)));
|
|
9042
9042
|
}
|
|
9043
9043
|
|
|
@@ -9064,7 +9064,7 @@ i) {
|
|
|
9064
9064
|
return n.forEach((t => r = r.add(t))), e.getEntries(t, r).next((t => {
|
|
9065
9065
|
let r = En();
|
|
9066
9066
|
return n.forEach(((n, o) => {
|
|
9067
|
-
const
|
|
9067
|
+
const c = t.get(n), a = (null == i ? void 0 : i.get(n)) || s;
|
|
9068
9068
|
// Note: The order of the steps below is important, since we want
|
|
9069
9069
|
// to ensure that rejected limbo resolutions (which fabricate
|
|
9070
9070
|
// NoDocuments with SnapshotVersion.min()) never add documents to
|
|
@@ -9073,8 +9073,8 @@ i) {
|
|
|
9073
9073
|
// NoDocuments with SnapshotVersion.min() are used in manufactured
|
|
9074
9074
|
// events. We remove these documents from cache since we lost
|
|
9075
9075
|
// access.
|
|
9076
|
-
e.removeEntry(n,
|
|
9077
|
-
r = r.insert(n, o)) : k("LocalStore", "Ignoring outdated watch update for ", n, ". Current version:",
|
|
9076
|
+
e.removeEntry(n, a), r = r.insert(n, o)) : !c.isValidDocument() || o.version.compareTo(c.version) > 0 || 0 === o.version.compareTo(c.version) && c.hasPendingWrites ? (e.addEntry(o, a),
|
|
9077
|
+
r = r.insert(n, o)) : k("LocalStore", "Ignoring outdated watch update for ", n, ". Current version:", c.version, " Watch version:", o.version);
|
|
9078
9078
|
})), r;
|
|
9079
9079
|
}));
|
|
9080
9080
|
}
|
|
@@ -9191,11 +9191,11 @@ function Er(t) {
|
|
|
9191
9191
|
const e = U(t);
|
|
9192
9192
|
return e.persistence.runTransaction("Get new document changes", "readonly", (t => function(t, e, n) {
|
|
9193
9193
|
const s = U(t);
|
|
9194
|
-
let i = En(), r =
|
|
9195
|
-
const o = Hi(e),
|
|
9194
|
+
let i = En(), r = ai(n);
|
|
9195
|
+
const o = Hi(e), c = IDBKeyRange.lowerBound(r, !0);
|
|
9196
9196
|
return o.Kt({
|
|
9197
9197
|
index: Ns.readTimeIndex,
|
|
9198
|
-
range:
|
|
9198
|
+
range: c
|
|
9199
9199
|
}, ((t, e) => {
|
|
9200
9200
|
// Unlike `getEntry()` and others, `getNewDocumentChanges()` parses
|
|
9201
9201
|
// the documents directly since we want to keep sentinel deletes.
|
|
@@ -9252,12 +9252,12 @@ async function Tr(t) {
|
|
|
9252
9252
|
*/
|
|
9253
9253
|
async function Ir(t, e, n, s) {
|
|
9254
9254
|
const i = U(t);
|
|
9255
|
-
let r = Pn(), o = En(),
|
|
9255
|
+
let r = Pn(), o = En(), c = Rn();
|
|
9256
9256
|
for (const t of n) {
|
|
9257
9257
|
const n = e.zn(t.metadata.name);
|
|
9258
|
-
t.document && (r = r.add(n)), o = o.insert(n, e.Hn(t)),
|
|
9258
|
+
t.document && (r = r.add(n)), o = o.insert(n, e.Hn(t)), c = c.insert(n, e.Jn(t.metadata.readTime));
|
|
9259
9259
|
}
|
|
9260
|
-
const
|
|
9260
|
+
const a = i.jn.newChangeBuffer({
|
|
9261
9261
|
trackRemovals: !0
|
|
9262
9262
|
}), u = await mr(i, function(t) {
|
|
9263
9263
|
// It is OK that the path used for the query is not valid, because this will
|
|
@@ -9266,7 +9266,7 @@ async function Ir(t, e, n, s) {
|
|
|
9266
9266
|
}(s));
|
|
9267
9267
|
// Allocates a target to hold all document keys from the bundle, such that
|
|
9268
9268
|
// they will not get garbage collected right away.
|
|
9269
|
-
return i.persistence.runTransaction("Apply bundle documents", "readwrite", (t => wr(t,
|
|
9269
|
+
return i.persistence.runTransaction("Apply bundle documents", "readwrite", (t => wr(t, a, o, it.min(), c).next((e => (a.apply(t),
|
|
9270
9270
|
e))).next((e => i.ze.removeMatchingKeysForTargetId(t, u.targetId).next((() => i.ze.addMatchingKeys(t, r, u.targetId))).next((() => i.Qn.vn(t, e))).next((() => e))))));
|
|
9271
9271
|
}
|
|
9272
9272
|
|
|
@@ -9769,16 +9769,16 @@ class Sr extends Qi {
|
|
|
9769
9769
|
return n && (this.lastRemoteSnapshotVersion = n), e > this.Is && (this.Is = e),
|
|
9770
9770
|
js.resolve();
|
|
9771
9771
|
}
|
|
9772
|
-
|
|
9772
|
+
ce(t) {
|
|
9773
9773
|
this.Ts.set(t.target, t);
|
|
9774
9774
|
const e = t.targetId;
|
|
9775
9775
|
e > this.highestTargetId && (this.Rs = new Ni(e), this.highestTargetId = e), t.sequenceNumber > this.Is && (this.Is = t.sequenceNumber);
|
|
9776
9776
|
}
|
|
9777
9777
|
addTargetData(t, e) {
|
|
9778
|
-
return this.
|
|
9778
|
+
return this.ce(e), this.targetCount += 1, js.resolve();
|
|
9779
9779
|
}
|
|
9780
9780
|
updateTargetData(t, e) {
|
|
9781
|
-
return this.
|
|
9781
|
+
return this.ce(e), js.resolve();
|
|
9782
9782
|
}
|
|
9783
9783
|
removeTargetData(t, e) {
|
|
9784
9784
|
return this.Ts.delete(e.target), this.As.cs(e.targetId), this.targetCount -= 1,
|
|
@@ -10321,12 +10321,12 @@ class Ur {
|
|
|
10321
10321
|
if (this.started) {
|
|
10322
10322
|
if (null !== e.key) if (this.Ws.test(e.key)) {
|
|
10323
10323
|
if (null == e.newValue) {
|
|
10324
|
-
const t = this.
|
|
10325
|
-
return this.
|
|
10324
|
+
const t = this.ci(e.key);
|
|
10325
|
+
return this.ai(t, null);
|
|
10326
10326
|
}
|
|
10327
10327
|
{
|
|
10328
10328
|
const t = this.ui(e.key, e.newValue);
|
|
10329
|
-
if (t) return this.
|
|
10329
|
+
if (t) return this.ai(t.clientId, t);
|
|
10330
10330
|
}
|
|
10331
10331
|
} else if (this.Gs.test(e.key)) {
|
|
10332
10332
|
if (null !== e.newValue) {
|
|
@@ -10396,7 +10396,7 @@ class Ur {
|
|
|
10396
10396
|
/**
|
|
10397
10397
|
* Parses a client state key in WebStorage. Returns null if the key does not
|
|
10398
10398
|
* match the expected key format.
|
|
10399
|
-
*/
|
|
10399
|
+
*/ ci(t) {
|
|
10400
10400
|
const e = this.Ws.exec(t);
|
|
10401
10401
|
return e ? e[1] : null;
|
|
10402
10402
|
}
|
|
@@ -10404,7 +10404,7 @@ class Ur {
|
|
|
10404
10404
|
* Parses a client state in WebStorage. Returns 'null' if the value could not
|
|
10405
10405
|
* be parsed.
|
|
10406
10406
|
*/ ui(t, e) {
|
|
10407
|
-
const n = this.
|
|
10407
|
+
const n = this.ci(t);
|
|
10408
10408
|
return Lr.$s(n, e);
|
|
10409
10409
|
}
|
|
10410
10410
|
/**
|
|
@@ -10434,7 +10434,7 @@ class Ur {
|
|
|
10434
10434
|
di(t) {
|
|
10435
10435
|
return this.syncEngine.mi(t.targetId, t.state, t.error);
|
|
10436
10436
|
}
|
|
10437
|
-
|
|
10437
|
+
ai(t, e) {
|
|
10438
10438
|
const n = e ? this.qs.insert(t, e) : this.qs.remove(t), s = this.ti(this.qs), i = this.ti(n), r = [], o = [];
|
|
10439
10439
|
return i.forEach((t => {
|
|
10440
10440
|
s.has(t) || r.push(t);
|
|
@@ -10760,8 +10760,8 @@ class {
|
|
|
10760
10760
|
k("Connection", 'RPC "' + t + '" completed.');
|
|
10761
10761
|
}
|
|
10762
10762
|
}));
|
|
10763
|
-
const
|
|
10764
|
-
o.send(e, "POST",
|
|
10763
|
+
const c = JSON.stringify(s);
|
|
10764
|
+
o.send(e, "POST", c, n, 15);
|
|
10765
10765
|
}));
|
|
10766
10766
|
}
|
|
10767
10767
|
ji(t, e) {
|
|
@@ -10808,22 +10808,22 @@ class {
|
|
|
10808
10808
|
l() || f() || d() || w() || _() || m() || (r.httpHeadersOverwriteParam = "$httpHeaders");
|
|
10809
10809
|
const o = n.join("");
|
|
10810
10810
|
k("Connection", "Creating WebChannel: " + o, r);
|
|
10811
|
-
const
|
|
10811
|
+
const c = s.createWebChannel(o, r);
|
|
10812
10812
|
// WebChannel supports sending the first message with the handshake - saving
|
|
10813
10813
|
// a network round trip. However, it will have to call send in the same
|
|
10814
10814
|
// JS event loop as open. In order to enforce this, we delay actually
|
|
10815
10815
|
// opening the WebChannel until send is called. Whether we have called
|
|
10816
10816
|
// open is tracked with this variable.
|
|
10817
|
-
let
|
|
10817
|
+
let a = !1, u = !1;
|
|
10818
10818
|
// A flag to determine whether the stream was closed (by us or through an
|
|
10819
10819
|
// error/close event) to avoid delivering multiple close events or sending
|
|
10820
10820
|
// on a closed stream
|
|
10821
10821
|
const h = new Gr({
|
|
10822
10822
|
vi: t => {
|
|
10823
|
-
u ? k("Connection", "Not sending because WebChannel is closed:", t) : (
|
|
10824
|
-
|
|
10823
|
+
u ? k("Connection", "Not sending because WebChannel is closed:", t) : (a || (k("Connection", "Opening WebChannel transport."),
|
|
10824
|
+
c.open(), a = !0), k("Connection", "WebChannel sending:", t), c.send(t));
|
|
10825
10825
|
},
|
|
10826
|
-
Vi: () =>
|
|
10826
|
+
Vi: () => c.close()
|
|
10827
10827
|
}), g = (t, e, n) => {
|
|
10828
10828
|
// TODO(dimond): closure typing seems broken because WebChannel does
|
|
10829
10829
|
// not implement goog.events.Listenable
|
|
@@ -10841,13 +10841,13 @@ class {
|
|
|
10841
10841
|
// exception and rethrow using a setTimeout so they become visible again.
|
|
10842
10842
|
// Note that eventually this function could go away if we are confident
|
|
10843
10843
|
// enough the code is exception free.
|
|
10844
|
-
return g(
|
|
10844
|
+
return g(c, P.EventType.OPEN, (() => {
|
|
10845
10845
|
u || k("Connection", "WebChannel transport opened.");
|
|
10846
|
-
})), g(
|
|
10846
|
+
})), g(c, P.EventType.CLOSE, (() => {
|
|
10847
10847
|
u || (u = !0, k("Connection", "WebChannel transport closed"), h.$i());
|
|
10848
|
-
})), g(
|
|
10848
|
+
})), g(c, P.EventType.ERROR, (t => {
|
|
10849
10849
|
u || (u = !0, O("Connection", "WebChannel transport errored:", t), h.$i(new K(q.UNAVAILABLE, "The operation could not be completed")));
|
|
10850
|
-
})), g(
|
|
10850
|
+
})), g(c, P.EventType.MESSAGE, (t => {
|
|
10851
10851
|
var e;
|
|
10852
10852
|
if (!u) {
|
|
10853
10853
|
const n = t.data[0];
|
|
@@ -10877,7 +10877,7 @@ class {
|
|
|
10877
10877
|
}(t), n = i.message;
|
|
10878
10878
|
void 0 === e && (e = q.INTERNAL, n = "Unknown error status: " + t + " with message " + i.message),
|
|
10879
10879
|
// Mark closed so no further events are propagated
|
|
10880
|
-
u = !0, h.$i(new K(e, n)),
|
|
10880
|
+
u = !0, h.$i(new K(e, n)), c.close();
|
|
10881
10881
|
} else k("Connection", "WebChannel received:", n), h.Oi(n);
|
|
10882
10882
|
}
|
|
10883
10883
|
})), g(i, v.STAT_EVENT, (t => {
|
|
@@ -11108,13 +11108,13 @@ class Zr {
|
|
|
11108
11108
|
* encompasses respecting backoff, getting auth tokens, and starting the
|
|
11109
11109
|
* actual RPC). Use isOpen() to determine if the stream is open and ready for
|
|
11110
11110
|
* outbound requests.
|
|
11111
|
-
*/
|
|
11111
|
+
*/ cr() {
|
|
11112
11112
|
return 1 /* Starting */ === this.state || 2 /* Open */ === this.state || 4 /* Backoff */ === this.state;
|
|
11113
11113
|
}
|
|
11114
11114
|
/**
|
|
11115
11115
|
* Returns true if the underlying RPC is open (the onOpen() listener has been
|
|
11116
11116
|
* called) and the stream is ready for outbound requests.
|
|
11117
|
-
*/
|
|
11117
|
+
*/ ar() {
|
|
11118
11118
|
return 2 /* Open */ === this.state;
|
|
11119
11119
|
}
|
|
11120
11120
|
/**
|
|
@@ -11132,7 +11132,7 @@ class Zr {
|
|
|
11132
11132
|
*
|
|
11133
11133
|
* When stop returns, isStarted() and isOpen() will both return false.
|
|
11134
11134
|
*/ async stop() {
|
|
11135
|
-
this.
|
|
11135
|
+
this.cr() && await this.close(0 /* Initial */);
|
|
11136
11136
|
}
|
|
11137
11137
|
/**
|
|
11138
11138
|
* After an error the stream will usually back off on the next attempt to
|
|
@@ -11156,13 +11156,13 @@ class Zr {
|
|
|
11156
11156
|
*/ lr() {
|
|
11157
11157
|
// Starts the idle time if we are in state 'Open' and are not yet already
|
|
11158
11158
|
// running a timer (in which case the previous idle timeout still applies).
|
|
11159
|
-
this.
|
|
11159
|
+
this.ar() && null === this.ir && (this.ir = this.Oe.enqueueAfterDelay(this.er, 6e4, (() => this.dr())));
|
|
11160
11160
|
}
|
|
11161
11161
|
/** Sends a message to the underlying stream. */ wr(t) {
|
|
11162
11162
|
this._r(), this.stream.send(t);
|
|
11163
11163
|
}
|
|
11164
11164
|
/** Called by the idle timer when the stream should close due to inactivity. */ async dr() {
|
|
11165
|
-
if (this.
|
|
11165
|
+
if (this.ar())
|
|
11166
11166
|
// When timing out an idle stream there's no reason to force the stream into backoff when
|
|
11167
11167
|
// it restarts so set the stream state to Initial instead of Error.
|
|
11168
11168
|
return this.close(0 /* Initial */);
|
|
@@ -11305,7 +11305,7 @@ class Zr {
|
|
|
11305
11305
|
return n = Ht(s) ? {
|
|
11306
11306
|
documents: os(t, s)
|
|
11307
11307
|
} : {
|
|
11308
|
-
query:
|
|
11308
|
+
query: cs(t, s)
|
|
11309
11309
|
}, n.targetId = e.targetId, e.resumeToken.approximateByteSize() > 0 ? n.resumeToken = qn(t, e.resumeToken) : e.snapshotVersion.compareTo(it.min()) > 0 && (
|
|
11310
11310
|
// TODO(wuandy): Consider removing above check because it is most likely true.
|
|
11311
11311
|
// Right now, many tests depend on this behaviour though (leaving min() out
|
|
@@ -11620,21 +11620,21 @@ async function ro(t) {
|
|
|
11620
11620
|
* Starts new listen for the given target. Uses resume token if provided. It
|
|
11621
11621
|
* is a no-op if the target of given `TargetData` is already being listened to.
|
|
11622
11622
|
*/
|
|
11623
|
-
function
|
|
11623
|
+
function co(t, e) {
|
|
11624
11624
|
const n = U(t);
|
|
11625
11625
|
n.qr.has(e.targetId) || (
|
|
11626
11626
|
// Mark this as something the client is currently listening for.
|
|
11627
11627
|
n.qr.set(e.targetId, e), fo(n) ?
|
|
11628
11628
|
// The listen will be sent in onWatchStreamOpen
|
|
11629
|
-
lo(n) : Co(n).
|
|
11629
|
+
lo(n) : Co(n).ar() && uo(n, e));
|
|
11630
11630
|
}
|
|
11631
11631
|
|
|
11632
11632
|
/**
|
|
11633
11633
|
* Removes the listen from server. It is a no-op if the given target id is
|
|
11634
11634
|
* not being listened to.
|
|
11635
|
-
*/ function
|
|
11635
|
+
*/ function ao(t, e) {
|
|
11636
11636
|
const n = U(t), s = Co(n);
|
|
11637
|
-
n.qr.delete(e), s.
|
|
11637
|
+
n.qr.delete(e), s.ar() && ho(n, e), 0 === n.qr.size && (s.ar() ? s.lr() : wo(n) &&
|
|
11638
11638
|
// Revert to OnlineState.Unknown if the watch stream is not open and we
|
|
11639
11639
|
// have no listeners, since without any listens to send we cannot
|
|
11640
11640
|
// confirm if the stream is healthy and upgrade to OnlineState.Online.
|
|
@@ -11667,7 +11667,7 @@ function lo(t) {
|
|
|
11667
11667
|
* Returns whether the watch stream should be started because it's necessary
|
|
11668
11668
|
* and has not yet been started.
|
|
11669
11669
|
*/ function fo(t) {
|
|
11670
|
-
return wo(t) && !Co(t).
|
|
11670
|
+
return wo(t) && !Co(t).cr() && t.qr.size > 0;
|
|
11671
11671
|
}
|
|
11672
11672
|
|
|
11673
11673
|
function wo(t) {
|
|
@@ -11720,7 +11720,7 @@ async function yo(t, e, n) {
|
|
|
11720
11720
|
} catch (n) {
|
|
11721
11721
|
k("RemoteStore", "Failed to remove targets %s: %s ", e.targetIds.join(","), n),
|
|
11722
11722
|
await po(t, n);
|
|
11723
|
-
} else if (e instanceof Cn ? t.Gr.rt(e) : e instanceof Nn ? t.Gr.ft(e) : t.Gr.
|
|
11723
|
+
} else if (e instanceof Cn ? t.Gr.rt(e) : e instanceof Nn ? t.Gr.ft(e) : t.Gr.at(e),
|
|
11724
11724
|
!n.isEqual(it.min())) try {
|
|
11725
11725
|
const e = await fr(t.localStore);
|
|
11726
11726
|
n.compareTo(e) >= 0 &&
|
|
@@ -11829,11 +11829,11 @@ async function To(t) {
|
|
|
11829
11829
|
*/ function Ao(t, e) {
|
|
11830
11830
|
t.Ur.push(e);
|
|
11831
11831
|
const n = No(t);
|
|
11832
|
-
n.
|
|
11832
|
+
n.ar() && n.br && n.Pr(e.mutations);
|
|
11833
11833
|
}
|
|
11834
11834
|
|
|
11835
11835
|
function Ro(t) {
|
|
11836
|
-
return wo(t) && !No(t).
|
|
11836
|
+
return wo(t) && !No(t).cr() && t.Ur.length > 0;
|
|
11837
11837
|
}
|
|
11838
11838
|
|
|
11839
11839
|
function bo(t) {
|
|
@@ -12206,9 +12206,9 @@ class xo {
|
|
|
12206
12206
|
}
|
|
12207
12207
|
|
|
12208
12208
|
class Fo {
|
|
12209
|
-
constructor(t, e, n, s, i, r, o,
|
|
12209
|
+
constructor(t, e, n, s, i, r, o, c) {
|
|
12210
12210
|
this.query = t, this.docs = e, this.oldDocs = n, this.docChanges = s, this.mutatedKeys = i,
|
|
12211
|
-
this.fromCache = r, this.syncStateChanged = o, this.excludesMetadataChanges =
|
|
12211
|
+
this.fromCache = r, this.syncStateChanged = o, this.excludesMetadataChanges = c;
|
|
12212
12212
|
}
|
|
12213
12213
|
/** Returns a view snapshot as if all documents in the snapshot were added. */ static fromInitialDocuments(t, e, n, s) {
|
|
12214
12214
|
const i = [];
|
|
@@ -12348,7 +12348,7 @@ function jo(t) {
|
|
|
12348
12348
|
/* excludesMetadataChanges= */ !0);
|
|
12349
12349
|
}
|
|
12350
12350
|
let e = !1;
|
|
12351
|
-
return this.io ? this.oo(t) && (this.so.next(t), e = !0) : this.
|
|
12351
|
+
return this.io ? this.oo(t) && (this.so.next(t), e = !0) : this.co(t, this.onlineState) && (this.ao(t),
|
|
12352
12352
|
e = !0), this.ro = t, e;
|
|
12353
12353
|
}
|
|
12354
12354
|
onError(t) {
|
|
@@ -12357,10 +12357,10 @@ function jo(t) {
|
|
|
12357
12357
|
/** Returns whether a snapshot was raised. */ eo(t) {
|
|
12358
12358
|
this.onlineState = t;
|
|
12359
12359
|
let e = !1;
|
|
12360
|
-
return this.ro && !this.io && this.
|
|
12360
|
+
return this.ro && !this.io && this.co(this.ro, t) && (this.ao(this.ro), e = !0),
|
|
12361
12361
|
e;
|
|
12362
12362
|
}
|
|
12363
|
-
|
|
12363
|
+
co(t, e) {
|
|
12364
12364
|
// Always raise the first event when we're synced
|
|
12365
12365
|
if (!t.fromCache) return !0;
|
|
12366
12366
|
// NOTE: We consider OnlineState.Unknown as online (it should become Offline
|
|
@@ -12383,7 +12383,7 @@ function jo(t) {
|
|
|
12383
12383
|
// to get here if there were only metadata docChanges and they got
|
|
12384
12384
|
// stripped out.
|
|
12385
12385
|
}
|
|
12386
|
-
|
|
12386
|
+
ao(t) {
|
|
12387
12387
|
t = Fo.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache), this.io = !0,
|
|
12388
12388
|
this.so.next(t);
|
|
12389
12389
|
}
|
|
@@ -12591,7 +12591,7 @@ class Yo {
|
|
|
12591
12591
|
// deletes. So we keep this doc at the old limit to compare the updates to.
|
|
12592
12592
|
// Note that this should never get used in a refill (when previousChanges is
|
|
12593
12593
|
// set), because there will only be adds -- no deletes or updates.
|
|
12594
|
-
const
|
|
12594
|
+
const c = _e(this.query) && s.size === this.query.limit ? s.last() : null, a = me(this.query) && s.size === this.query.limit ? s.first() : null;
|
|
12595
12595
|
// Drop documents out to meet limit/limitToLast requirement.
|
|
12596
12596
|
if (t.inorderTraversal(((t, e) => {
|
|
12597
12597
|
const u = s.get(t), h = Pe(this.query, e) ? e : null, l = !!u && this.mutatedKeys.has(u.key), f = !!h && (h.hasLocalMutations ||
|
|
@@ -12607,7 +12607,7 @@ class Yo {
|
|
|
12607
12607
|
}), d = !0) : this.Ro(u, h) || (n.track({
|
|
12608
12608
|
type: 2 /* Modified */ ,
|
|
12609
12609
|
doc: h
|
|
12610
|
-
}), d = !0, (
|
|
12610
|
+
}), d = !0, (c && this.po(h, c) > 0 || a && this.po(h, a) < 0) && (
|
|
12611
12611
|
// This doc moved from inside the limit to outside the limit.
|
|
12612
12612
|
// That means there may be some other doc in the local cache
|
|
12613
12613
|
// that should be included instead.
|
|
@@ -12618,7 +12618,7 @@ class Yo {
|
|
|
12618
12618
|
}), d = !0) : u && !h && (n.track({
|
|
12619
12619
|
type: 1 /* Removed */ ,
|
|
12620
12620
|
doc: u
|
|
12621
|
-
}), d = !0, (
|
|
12621
|
+
}), d = !0, (c || a) && (
|
|
12622
12622
|
// A doc was removed from a full limit query. We'll need to
|
|
12623
12623
|
// requery from the local cache to see if we know about some other
|
|
12624
12624
|
// doc that should be in the results.
|
|
@@ -12702,10 +12702,10 @@ class Yo {
|
|
|
12702
12702
|
* See the License for the specific language governing permissions and
|
|
12703
12703
|
* limitations under the License.
|
|
12704
12704
|
*/ (t.type, e.type) || this.po(t.doc, e.doc))), this.bo(n);
|
|
12705
|
-
const r = e ? this.Po() : [], o = 0 === this.yo.size && this.current ? 1 /* Synced */ : 0 /* Local */ ,
|
|
12706
|
-
if (this.mo = o, 0 !== i.length ||
|
|
12705
|
+
const r = e ? this.Po() : [], o = 0 === this.yo.size && this.current ? 1 /* Synced */ : 0 /* Local */ , c = o !== this.mo;
|
|
12706
|
+
if (this.mo = o, 0 !== i.length || c) {
|
|
12707
12707
|
return {
|
|
12708
|
-
snapshot: new Fo(this.query, t.Eo, s, i, t.mutatedKeys, 0 /* Local */ === o,
|
|
12708
|
+
snapshot: new Fo(this.query, t.Eo, s, i, t.mutatedKeys, 0 /* Local */ === o, c,
|
|
12709
12709
|
/* excludesMetadataChanges= */ !1),
|
|
12710
12710
|
vo: r
|
|
12711
12711
|
};
|
|
@@ -12828,7 +12828,7 @@ class Zo {
|
|
|
12828
12828
|
}
|
|
12829
12829
|
}
|
|
12830
12830
|
|
|
12831
|
-
/** Tracks a limbo resolution. */ class
|
|
12831
|
+
/** Tracks a limbo resolution. */ class tc {
|
|
12832
12832
|
constructor(t) {
|
|
12833
12833
|
this.key = t,
|
|
12834
12834
|
/**
|
|
@@ -12853,7 +12853,7 @@ class Zo {
|
|
|
12853
12853
|
* the class is not exported so they are only accessible from this module.
|
|
12854
12854
|
* This is useful to implement optional features (like bundles) in free
|
|
12855
12855
|
* functions, such that they are tree-shakeable.
|
|
12856
|
-
*/ class
|
|
12856
|
+
*/ class ec {
|
|
12857
12857
|
constructor(t, e, n,
|
|
12858
12858
|
// PORTING NOTE: Manages state synchronization in multi-tab environments.
|
|
12859
12859
|
s, i, r) {
|
|
@@ -12899,8 +12899,8 @@ class Zo {
|
|
|
12899
12899
|
* server. All the subsequent view snapshots or errors are sent to the
|
|
12900
12900
|
* subscribed handlers. Returns the initial snapshot.
|
|
12901
12901
|
*/
|
|
12902
|
-
async function
|
|
12903
|
-
const n =
|
|
12902
|
+
async function nc(t, e) {
|
|
12903
|
+
const n = Cc(t);
|
|
12904
12904
|
let s, i;
|
|
12905
12905
|
const r = n.xo.get(e);
|
|
12906
12906
|
if (r)
|
|
@@ -12912,7 +12912,7 @@ async function na(t, e) {
|
|
|
12912
12912
|
// case and calls `listen` to obtain this ID.
|
|
12913
12913
|
s = r.targetId, n.sharedClientState.addLocalQueryTarget(s), i = r.view.Do(); else {
|
|
12914
12914
|
const t = await mr(n.localStore, Te(e)), r = n.sharedClientState.addLocalQueryTarget(t.targetId);
|
|
12915
|
-
s = t.targetId, i = await
|
|
12915
|
+
s = t.targetId, i = await sc(n, e, s, "current" === r), n.isPrimaryClient && co(n.remoteStore, t);
|
|
12916
12916
|
}
|
|
12917
12917
|
return i;
|
|
12918
12918
|
}
|
|
@@ -12920,7 +12920,7 @@ async function na(t, e) {
|
|
|
12920
12920
|
/**
|
|
12921
12921
|
* Registers a view for a previously unknown query and computes its initial
|
|
12922
12922
|
* snapshot.
|
|
12923
|
-
*/ async function
|
|
12923
|
+
*/ async function sc(t, e, n, s) {
|
|
12924
12924
|
// PORTING NOTE: On Web only, we inject the code that registers new Limbo
|
|
12925
12925
|
// targets based on view changes. This allows us to only depend on Limbo
|
|
12926
12926
|
// changes when user code includes queries.
|
|
@@ -12934,17 +12934,17 @@ async function na(t, e) {
|
|
|
12934
12934
|
/* usePreviousResults= */ !1).then((({documents: t}) => e.view.Io(t, i))));
|
|
12935
12935
|
const r = s && s.targetChanges.get(e.targetId), o = e.view.applyChanges(i,
|
|
12936
12936
|
/* updateLimboDocuments= */ t.isPrimaryClient, r);
|
|
12937
|
-
return
|
|
12937
|
+
return mc(t, e.targetId, o.vo), o.snapshot;
|
|
12938
12938
|
}(t, e, n, s);
|
|
12939
12939
|
const i = await yr(t.localStore, e,
|
|
12940
|
-
/* usePreviousResults= */ !0), r = new Xo(e, i.Gn), o = r.Io(i.documents),
|
|
12941
|
-
/* updateLimboDocuments= */ t.isPrimaryClient,
|
|
12942
|
-
|
|
12940
|
+
/* usePreviousResults= */ !0), r = new Xo(e, i.Gn), o = r.Io(i.documents), c = Dn.createSynthesizedTargetChangeForCurrentChange(n, s && "Offline" /* Offline */ !== t.onlineState), a = r.applyChanges(o,
|
|
12941
|
+
/* updateLimboDocuments= */ t.isPrimaryClient, c);
|
|
12942
|
+
mc(t, n, a.vo);
|
|
12943
12943
|
const u = new Zo(e, n, r);
|
|
12944
|
-
return t.xo.set(e, u), t.ko.has(n) ? t.ko.get(n).push(e) : t.ko.set(n, [ e ]),
|
|
12944
|
+
return t.xo.set(e, u), t.ko.has(n) ? t.ko.get(n).push(e) : t.ko.set(n, [ e ]), a.snapshot;
|
|
12945
12945
|
}
|
|
12946
12946
|
|
|
12947
|
-
/** Stops listening to the query. */ async function
|
|
12947
|
+
/** Stops listening to the query. */ async function ic(t, e) {
|
|
12948
12948
|
const n = U(t), s = n.xo.get(e), i = n.ko.get(s.targetId);
|
|
12949
12949
|
if (i.length > 1) return n.ko.set(s.targetId, i.filter((t => !Ae(t, e)))), void n.xo.delete(e);
|
|
12950
12950
|
// No other queries are mapped to the target, clean up the query and the target.
|
|
@@ -12954,10 +12954,10 @@ async function na(t, e) {
|
|
|
12954
12954
|
n.sharedClientState.removeLocalQueryTarget(s.targetId);
|
|
12955
12955
|
n.sharedClientState.isActiveQueryTarget(s.targetId) || await gr(n.localStore, s.targetId,
|
|
12956
12956
|
/*keepPersistedTargetData=*/ !1).then((() => {
|
|
12957
|
-
n.sharedClientState.clearQueryState(s.targetId),
|
|
12958
|
-
|
|
12957
|
+
n.sharedClientState.clearQueryState(s.targetId), ao(n.remoteStore, s.targetId),
|
|
12958
|
+
wc(n, s.targetId);
|
|
12959
12959
|
})).catch(Fi);
|
|
12960
|
-
} else
|
|
12960
|
+
} else wc(n, s.targetId), await gr(n.localStore, s.targetId,
|
|
12961
12961
|
/*keepPersistedTargetData=*/ !0);
|
|
12962
12962
|
}
|
|
12963
12963
|
|
|
@@ -12970,8 +12970,8 @@ async function na(t, e) {
|
|
|
12970
12970
|
* have completed, *not* when the write was acked by the backend. The
|
|
12971
12971
|
* userCallback is resolved once the write was acked/rejected by the
|
|
12972
12972
|
* backend (or failed locally for any other reason).
|
|
12973
|
-
*/ async function
|
|
12974
|
-
const s =
|
|
12973
|
+
*/ async function rc(t, e, n) {
|
|
12974
|
+
const s = Nc(t);
|
|
12975
12975
|
try {
|
|
12976
12976
|
const t = await function(t, e) {
|
|
12977
12977
|
const n = U(t), s = st.now(), i = e.reduce(((t, e) => t.add(e.key)), Pn());
|
|
@@ -13006,7 +13006,7 @@ async function na(t, e) {
|
|
|
13006
13006
|
/**
|
|
13007
13007
|
* Resolves or rejects the user callback for the given batch and then discards
|
|
13008
13008
|
* it.
|
|
13009
|
-
*/ (s, t.batchId, n), await
|
|
13009
|
+
*/ (s, t.batchId, n), await pc(s, t.changes), await To(s.remoteStore);
|
|
13010
13010
|
} catch (t) {
|
|
13011
13011
|
// If we can't persist the mutation, we reject the user callback and
|
|
13012
13012
|
// don't send the mutation. The user can then retry the write.
|
|
@@ -13019,7 +13019,7 @@ async function na(t, e) {
|
|
|
13019
13019
|
* Applies one remote event to the sync engine, notifying any views of the
|
|
13020
13020
|
* changes, and releasing any pending mutation batches that would become
|
|
13021
13021
|
* visible because of the snapshot version the remote event contains.
|
|
13022
|
-
*/ async function
|
|
13022
|
+
*/ async function oc(t, e) {
|
|
13023
13023
|
const n = U(t);
|
|
13024
13024
|
try {
|
|
13025
13025
|
const t = await dr(n.localStore, e);
|
|
@@ -13032,7 +13032,7 @@ async function na(t, e) {
|
|
|
13032
13032
|
L(t.addedDocuments.size + t.modifiedDocuments.size + t.removedDocuments.size <= 1),
|
|
13033
13033
|
t.addedDocuments.size > 0 ? s.Co = !0 : t.modifiedDocuments.size > 0 ? L(s.Co) : t.removedDocuments.size > 0 && (L(s.Co),
|
|
13034
13034
|
s.Co = !1));
|
|
13035
|
-
})), await
|
|
13035
|
+
})), await pc(n, t, e);
|
|
13036
13036
|
} catch (t) {
|
|
13037
13037
|
await Fi(t);
|
|
13038
13038
|
}
|
|
@@ -13041,7 +13041,7 @@ async function na(t, e) {
|
|
|
13041
13041
|
/**
|
|
13042
13042
|
* Applies an OnlineState change to the sync engine and notifies any views of
|
|
13043
13043
|
* the change.
|
|
13044
|
-
*/ function
|
|
13044
|
+
*/ function cc(t, e, n) {
|
|
13045
13045
|
const s = U(t);
|
|
13046
13046
|
// If we are the secondary client, we explicitly ignore the remote store's
|
|
13047
13047
|
// online state (the local client may go offline, even though the primary
|
|
@@ -13075,7 +13075,7 @@ async function na(t, e) {
|
|
|
13075
13075
|
* @param err - A description of the condition that has forced the rejection.
|
|
13076
13076
|
* Nearly always this will be an indication that the user is no longer
|
|
13077
13077
|
* authorized to see the data matching the target.
|
|
13078
|
-
*/ async function
|
|
13078
|
+
*/ async function ac(t, e, n) {
|
|
13079
13079
|
const s = U(t);
|
|
13080
13080
|
// PORTING NOTE: Multi-tab only.
|
|
13081
13081
|
s.sharedClientState.updateQueryState(e, "rejected", n);
|
|
@@ -13092,18 +13092,18 @@ async function na(t, e) {
|
|
|
13092
13092
|
const n = Pn().add(r), i = new Sn(it.min(),
|
|
13093
13093
|
/* targetChanges= */ new Map,
|
|
13094
13094
|
/* targetMismatches= */ new gn(tt), t, n);
|
|
13095
|
-
await
|
|
13095
|
+
await oc(s, i),
|
|
13096
13096
|
// Since this query failed, we won't want to manually unlisten to it.
|
|
13097
13097
|
// We only remove it from bookkeeping after we successfully applied the
|
|
13098
13098
|
// RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to
|
|
13099
13099
|
// this query when the RemoteStore restarts the Watch stream, which should
|
|
13100
13100
|
// re-trigger the target failure.
|
|
13101
|
-
s.Oo = s.Oo.remove(r), s.Fo.delete(e),
|
|
13101
|
+
s.Oo = s.Oo.remove(r), s.Fo.delete(e), yc(s);
|
|
13102
13102
|
} else await gr(s.localStore, e,
|
|
13103
|
-
/* keepPersistedTargetData */ !1).then((() =>
|
|
13103
|
+
/* keepPersistedTargetData */ !1).then((() => wc(s, e, n))).catch(Fi);
|
|
13104
13104
|
}
|
|
13105
13105
|
|
|
13106
|
-
async function
|
|
13106
|
+
async function uc(t, e) {
|
|
13107
13107
|
const n = U(t), s = e.batch.batchId;
|
|
13108
13108
|
try {
|
|
13109
13109
|
const t = await lr(n.localStore, e);
|
|
@@ -13111,14 +13111,14 @@ async function ua(t, e) {
|
|
|
13111
13111
|
// raise events immediately (depending on whether the watcher is caught
|
|
13112
13112
|
// up), so we raise user callbacks first so that they consistently happen
|
|
13113
13113
|
// before listen events.
|
|
13114
|
-
|
|
13115
|
-
await
|
|
13114
|
+
dc(n, s, /*error=*/ null), fc(n, s), n.sharedClientState.updateMutationState(s, "acknowledged"),
|
|
13115
|
+
await pc(n, t);
|
|
13116
13116
|
} catch (t) {
|
|
13117
13117
|
await Fi(t);
|
|
13118
13118
|
}
|
|
13119
13119
|
}
|
|
13120
13120
|
|
|
13121
|
-
async function
|
|
13121
|
+
async function hc(t, e, n) {
|
|
13122
13122
|
const s = U(t);
|
|
13123
13123
|
try {
|
|
13124
13124
|
const t = await function(t, e) {
|
|
@@ -13138,8 +13138,8 @@ async function ha(t, e, n) {
|
|
|
13138
13138
|
// raise events immediately (depending on whether the watcher is caught up),
|
|
13139
13139
|
// so we raise user callbacks first so that they consistently happen before
|
|
13140
13140
|
// listen events.
|
|
13141
|
-
|
|
13142
|
-
await
|
|
13141
|
+
dc(s, e, n), fc(s, e), s.sharedClientState.updateMutationState(e, "rejected", n),
|
|
13142
|
+
await pc(s, t);
|
|
13143
13143
|
} catch (n) {
|
|
13144
13144
|
await Fi(n);
|
|
13145
13145
|
}
|
|
@@ -13148,7 +13148,7 @@ async function ha(t, e, n) {
|
|
|
13148
13148
|
/**
|
|
13149
13149
|
* Registers a user callback that resolves when all pending mutations at the moment of calling
|
|
13150
13150
|
* are acknowledged .
|
|
13151
|
-
*/ async function
|
|
13151
|
+
*/ async function lc(t, e) {
|
|
13152
13152
|
const n = U(t);
|
|
13153
13153
|
wo(n.remoteStore) || k("SyncEngine", "The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled.");
|
|
13154
13154
|
try {
|
|
@@ -13170,13 +13170,13 @@ async function ha(t, e, n) {
|
|
|
13170
13170
|
/**
|
|
13171
13171
|
* Triggers the callbacks that are waiting for this batch id to get acknowledged by server,
|
|
13172
13172
|
* if there are any.
|
|
13173
|
-
*/ function
|
|
13173
|
+
*/ function fc(t, e) {
|
|
13174
13174
|
(t.Bo.get(e) || []).forEach((t => {
|
|
13175
13175
|
t.resolve();
|
|
13176
13176
|
})), t.Bo.delete(e);
|
|
13177
13177
|
}
|
|
13178
13178
|
|
|
13179
|
-
/** Reject all outstanding callbacks waiting for pending writes to complete. */ function
|
|
13179
|
+
/** Reject all outstanding callbacks waiting for pending writes to complete. */ function dc(t, e, n) {
|
|
13180
13180
|
const s = U(t);
|
|
13181
13181
|
let i = s.Lo[s.currentUser.toKey()];
|
|
13182
13182
|
// NOTE: Mutations restored from persistence won't have callbacks, so it's
|
|
@@ -13187,39 +13187,39 @@ async function ha(t, e, n) {
|
|
|
13187
13187
|
}
|
|
13188
13188
|
}
|
|
13189
13189
|
|
|
13190
|
-
function
|
|
13190
|
+
function wc(t, e, n = null) {
|
|
13191
13191
|
t.sharedClientState.removeLocalQueryTarget(e);
|
|
13192
13192
|
for (const s of t.ko.get(e)) t.xo.delete(s), n && t.No.jo(s, n);
|
|
13193
13193
|
if (t.ko.delete(e), t.isPrimaryClient) {
|
|
13194
13194
|
t.Mo.cs(e).forEach((e => {
|
|
13195
13195
|
t.Mo.containsKey(e) ||
|
|
13196
13196
|
// We removed the last reference for this key
|
|
13197
|
-
|
|
13197
|
+
_c(t, e);
|
|
13198
13198
|
}));
|
|
13199
13199
|
}
|
|
13200
13200
|
}
|
|
13201
13201
|
|
|
13202
|
-
function
|
|
13202
|
+
function _c(t, e) {
|
|
13203
13203
|
t.$o.delete(e.path.canonicalString());
|
|
13204
13204
|
// It's possible that the target already got removed because the query failed. In that case,
|
|
13205
13205
|
// the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.
|
|
13206
13206
|
const n = t.Oo.get(e);
|
|
13207
|
-
null !== n && (
|
|
13207
|
+
null !== n && (ao(t.remoteStore, n), t.Oo = t.Oo.remove(e), t.Fo.delete(n), yc(t));
|
|
13208
13208
|
}
|
|
13209
13209
|
|
|
13210
|
-
function
|
|
13211
|
-
for (const s of n) if (s instanceof Jo) t.Mo.addReference(s.key, e),
|
|
13210
|
+
function mc(t, e, n) {
|
|
13211
|
+
for (const s of n) if (s instanceof Jo) t.Mo.addReference(s.key, e), gc(t, s); else if (s instanceof Yo) {
|
|
13212
13212
|
k("SyncEngine", "Document no longer in limbo: " + s.key), t.Mo.removeReference(s.key, e);
|
|
13213
13213
|
t.Mo.containsKey(s.key) ||
|
|
13214
13214
|
// We removed the last reference for this key
|
|
13215
|
-
|
|
13215
|
+
_c(t, s.key);
|
|
13216
13216
|
} else M();
|
|
13217
13217
|
}
|
|
13218
13218
|
|
|
13219
|
-
function
|
|
13219
|
+
function gc(t, e) {
|
|
13220
13220
|
const n = e.key, s = n.path.canonicalString();
|
|
13221
13221
|
t.Oo.get(n) || t.$o.has(s) || (k("SyncEngine", "New document in limbo: " + n), t.$o.add(s),
|
|
13222
|
-
|
|
13222
|
+
yc(t));
|
|
13223
13223
|
}
|
|
13224
13224
|
|
|
13225
13225
|
/**
|
|
@@ -13229,23 +13229,23 @@ function ga(t, e) {
|
|
|
13229
13229
|
* Without bounding the number of concurrent resolutions, the server can fail
|
|
13230
13230
|
* with "resource exhausted" errors which can lead to pathological client
|
|
13231
13231
|
* behavior as seen in https://github.com/firebase/firebase-js-sdk/issues/2683.
|
|
13232
|
-
*/ function
|
|
13232
|
+
*/ function yc(t) {
|
|
13233
13233
|
for (;t.$o.size > 0 && t.Oo.size < t.maxConcurrentLimboResolutions; ) {
|
|
13234
13234
|
const e = t.$o.values().next().value;
|
|
13235
13235
|
t.$o.delete(e);
|
|
13236
13236
|
const n = new Pt(ut.fromString(e)), s = t.Uo.next();
|
|
13237
|
-
t.Fo.set(s, new
|
|
13237
|
+
t.Fo.set(s, new tc(n)), t.Oo = t.Oo.insert(n, s), co(t.remoteStore, new ii(Te(we(n.path)), s, 2 /* LimboResolution */ , Y.T));
|
|
13238
13238
|
}
|
|
13239
13239
|
}
|
|
13240
13240
|
|
|
13241
|
-
async function
|
|
13241
|
+
async function pc(t, e, n) {
|
|
13242
13242
|
const s = U(t), i = [], r = [], o = [];
|
|
13243
|
-
s.xo.isEmpty() || (s.xo.forEach(((t,
|
|
13244
|
-
o.push(s.Ko(
|
|
13243
|
+
s.xo.isEmpty() || (s.xo.forEach(((t, c) => {
|
|
13244
|
+
o.push(s.Ko(c, e, n).then((t => {
|
|
13245
13245
|
if (t) {
|
|
13246
|
-
s.isPrimaryClient && s.sharedClientState.updateQueryState(
|
|
13246
|
+
s.isPrimaryClient && s.sharedClientState.updateQueryState(c.targetId, t.fromCache ? "not-current" : "current"),
|
|
13247
13247
|
i.push(t);
|
|
13248
|
-
const e = or.kn(
|
|
13248
|
+
const e = or.kn(c.targetId, t);
|
|
13249
13249
|
r.push(e);
|
|
13250
13250
|
}
|
|
13251
13251
|
})));
|
|
@@ -13272,7 +13272,7 @@ async function pa(t, e, n) {
|
|
|
13272
13272
|
}(s.localStore, r));
|
|
13273
13273
|
}
|
|
13274
13274
|
|
|
13275
|
-
async function
|
|
13275
|
+
async function Ec(t, e) {
|
|
13276
13276
|
const n = U(t);
|
|
13277
13277
|
if (!n.currentUser.isEqual(e)) {
|
|
13278
13278
|
k("SyncEngine", "User change. New user:", e.toKey());
|
|
@@ -13287,11 +13287,11 @@ async function Ea(t, e) {
|
|
|
13287
13287
|
})), t.Bo.clear();
|
|
13288
13288
|
}(n, "'waitForPendingWrites' promise is rejected due to a user change."),
|
|
13289
13289
|
// TODO(b/114226417): Consider calling this only in the primary tab.
|
|
13290
|
-
n.sharedClientState.handleUserChange(e, t.removedBatchIds, t.addedBatchIds), await
|
|
13290
|
+
n.sharedClientState.handleUserChange(e, t.removedBatchIds, t.addedBatchIds), await pc(n, t.Wn);
|
|
13291
13291
|
}
|
|
13292
13292
|
}
|
|
13293
13293
|
|
|
13294
|
-
function
|
|
13294
|
+
function Tc(t, e) {
|
|
13295
13295
|
const n = U(t), s = n.Fo.get(e);
|
|
13296
13296
|
if (s && s.Co) return Pn().add(s.key);
|
|
13297
13297
|
{
|
|
@@ -13309,10 +13309,10 @@ function Ta(t, e) {
|
|
|
13309
13309
|
/**
|
|
13310
13310
|
* Reconcile the list of synced documents in an existing view with those
|
|
13311
13311
|
* from persistence.
|
|
13312
|
-
*/ async function
|
|
13312
|
+
*/ async function Ic(t, e) {
|
|
13313
13313
|
const n = U(t), s = await yr(n.localStore, e.query,
|
|
13314
13314
|
/* usePreviousResults= */ !0), i = e.view.So(s);
|
|
13315
|
-
return n.isPrimaryClient &&
|
|
13315
|
+
return n.isPrimaryClient && mc(n, e.targetId, i.vo), i;
|
|
13316
13316
|
}
|
|
13317
13317
|
|
|
13318
13318
|
/**
|
|
@@ -13320,14 +13320,14 @@ function Ta(t, e) {
|
|
|
13320
13320
|
* snapshots if needed.
|
|
13321
13321
|
*/
|
|
13322
13322
|
// PORTING NOTE: Multi-Tab only.
|
|
13323
|
-
async function
|
|
13323
|
+
async function Ac(t) {
|
|
13324
13324
|
const e = U(t);
|
|
13325
|
-
return Er(e.localStore).then((t =>
|
|
13325
|
+
return Er(e.localStore).then((t => pc(e, t)));
|
|
13326
13326
|
}
|
|
13327
13327
|
|
|
13328
13328
|
/** Applies a mutation state to an existing batch. */
|
|
13329
13329
|
// PORTING NOTE: Multi-Tab only.
|
|
13330
|
-
async function
|
|
13330
|
+
async function Rc(t, e, n, s) {
|
|
13331
13331
|
const i = U(t), r = await function(t, e) {
|
|
13332
13332
|
const n = U(t), s = U(n.In);
|
|
13333
13333
|
return n.persistence.runTransaction("Lookup mutation documents", "readonly", (t => s.Xt(t, e).next((e => e ? n.Qn.Pn(t, e) : js.resolve(null)))));
|
|
@@ -13341,11 +13341,11 @@ async function Ra(t, e, n, s) {
|
|
|
13341
13341
|
await To(i.remoteStore) : "acknowledged" === n || "rejected" === n ? (
|
|
13342
13342
|
// NOTE: Both these methods are no-ops for batches that originated from
|
|
13343
13343
|
// other clients.
|
|
13344
|
-
|
|
13344
|
+
dc(i, e, s || null), fc(i, e), function(t, e) {
|
|
13345
13345
|
U(U(t).In).te(e);
|
|
13346
13346
|
}
|
|
13347
13347
|
// PORTING NOTE: Multi-Tab only.
|
|
13348
|
-
(i.localStore, e)) : M(), await
|
|
13348
|
+
(i.localStore, e)) : M(), await pc(i, r)) :
|
|
13349
13349
|
// A throttled tab may not have seen the mutation before it was completed
|
|
13350
13350
|
// and removed from the mutation queue, in which case we won't have cached
|
|
13351
13351
|
// the affected documents. In this case we can safely ignore the update
|
|
@@ -13358,31 +13358,31 @@ async function Ra(t, e, n, s) {
|
|
|
13358
13358
|
|
|
13359
13359
|
/** Applies a query target change from a different tab. */
|
|
13360
13360
|
// PORTING NOTE: Multi-Tab only.
|
|
13361
|
-
async function
|
|
13361
|
+
async function bc(t, e) {
|
|
13362
13362
|
const n = U(t);
|
|
13363
|
-
if (
|
|
13363
|
+
if (Cc(n), Nc(n), !0 === e && !0 !== n.qo) {
|
|
13364
13364
|
// Secondary tabs only maintain Views for their local listeners and the
|
|
13365
13365
|
// Views internal state may not be 100% populated (in particular
|
|
13366
13366
|
// secondary tabs don't track syncedDocuments, the set of documents the
|
|
13367
13367
|
// server considers to be in the target). So when a secondary becomes
|
|
13368
13368
|
// primary, we need to need to make sure that all views for all targets
|
|
13369
13369
|
// match the state on disk.
|
|
13370
|
-
const t = n.sharedClientState.getAllActiveQueryTargets(), e = await
|
|
13370
|
+
const t = n.sharedClientState.getAllActiveQueryTargets(), e = await Pc(n, t.toArray());
|
|
13371
13371
|
n.qo = !0, await Do(n.remoteStore, !0);
|
|
13372
|
-
for (const t of e)
|
|
13372
|
+
for (const t of e) co(n.remoteStore, t);
|
|
13373
13373
|
} else if (!1 === e && !1 !== n.qo) {
|
|
13374
13374
|
const t = [];
|
|
13375
13375
|
let e = Promise.resolve();
|
|
13376
13376
|
n.ko.forEach(((s, i) => {
|
|
13377
|
-
n.sharedClientState.isLocalQueryTarget(i) ? t.push(i) : e = e.then((() => (
|
|
13377
|
+
n.sharedClientState.isLocalQueryTarget(i) ? t.push(i) : e = e.then((() => (wc(n, i),
|
|
13378
13378
|
gr(n.localStore, i,
|
|
13379
|
-
/*keepPersistedTargetData=*/ !0)))),
|
|
13380
|
-
})), await e, await
|
|
13379
|
+
/*keepPersistedTargetData=*/ !0)))), ao(n.remoteStore, i);
|
|
13380
|
+
})), await e, await Pc(n, t),
|
|
13381
13381
|
// PORTING NOTE: Multi-Tab only.
|
|
13382
13382
|
function(t) {
|
|
13383
13383
|
const e = U(t);
|
|
13384
13384
|
e.Fo.forEach(((t, n) => {
|
|
13385
|
-
|
|
13385
|
+
ao(e.remoteStore, n);
|
|
13386
13386
|
})), e.Mo.us(), e.Fo = new Map, e.Oo = new wn(Pt.comparator);
|
|
13387
13387
|
}
|
|
13388
13388
|
/**
|
|
@@ -13400,7 +13400,7 @@ async function ba(t, e) {
|
|
|
13400
13400
|
}
|
|
13401
13401
|
}
|
|
13402
13402
|
|
|
13403
|
-
async function
|
|
13403
|
+
async function Pc(t, e, n) {
|
|
13404
13404
|
const s = U(t), i = [], r = [];
|
|
13405
13405
|
for (const t of e) {
|
|
13406
13406
|
let e;
|
|
@@ -13412,14 +13412,14 @@ async function Pa(t, e, n) {
|
|
|
13412
13412
|
// state (the list of syncedDocuments may have gotten out of sync).
|
|
13413
13413
|
e = await mr(s.localStore, Te(n[0]));
|
|
13414
13414
|
for (const t of n) {
|
|
13415
|
-
const e = s.xo.get(t), n = await
|
|
13415
|
+
const e = s.xo.get(t), n = await Ic(s, e);
|
|
13416
13416
|
n.snapshot && r.push(n.snapshot);
|
|
13417
13417
|
}
|
|
13418
13418
|
} else {
|
|
13419
13419
|
// For queries that never executed on this client, we need to
|
|
13420
13420
|
// allocate the target in LocalStore and initialize a new View.
|
|
13421
13421
|
const n = await pr(s.localStore, t);
|
|
13422
|
-
e = await mr(s.localStore, n), await
|
|
13422
|
+
e = await mr(s.localStore, n), await sc(s, vc(n), t,
|
|
13423
13423
|
/*current=*/ !1);
|
|
13424
13424
|
}
|
|
13425
13425
|
i.push(e);
|
|
@@ -13438,20 +13438,20 @@ async function Pa(t, e, n) {
|
|
|
13438
13438
|
* difference will not cause issues.
|
|
13439
13439
|
*/
|
|
13440
13440
|
// PORTING NOTE: Multi-Tab only.
|
|
13441
|
-
function
|
|
13441
|
+
function vc(t) {
|
|
13442
13442
|
return de(t.path, t.collectionGroup, t.orderBy, t.filters, t.limit, "F" /* First */ , t.startAt, t.endAt);
|
|
13443
13443
|
}
|
|
13444
13444
|
|
|
13445
13445
|
/** Returns the IDs of the clients that are currently active. */
|
|
13446
13446
|
// PORTING NOTE: Multi-Tab only.
|
|
13447
|
-
function
|
|
13447
|
+
function Vc(t) {
|
|
13448
13448
|
const e = U(t);
|
|
13449
13449
|
return U(U(e.localStore).persistence).pn();
|
|
13450
13450
|
}
|
|
13451
13451
|
|
|
13452
13452
|
/** Applies a query target change from a different tab. */
|
|
13453
13453
|
// PORTING NOTE: Multi-Tab only.
|
|
13454
|
-
async function
|
|
13454
|
+
async function Sc(t, e, n, s) {
|
|
13455
13455
|
const i = U(t);
|
|
13456
13456
|
if (i.qo)
|
|
13457
13457
|
// If we receive a target state notification via WebStorage, we are
|
|
@@ -13461,13 +13461,13 @@ async function Sa(t, e, n, s) {
|
|
|
13461
13461
|
case "not-current":
|
|
13462
13462
|
{
|
|
13463
13463
|
const t = await Er(i.localStore), s = Sn.createSynthesizedRemoteEventForCurrentChange(e, "current" === n);
|
|
13464
|
-
await
|
|
13464
|
+
await pc(i, t, s);
|
|
13465
13465
|
break;
|
|
13466
13466
|
}
|
|
13467
13467
|
|
|
13468
13468
|
case "rejected":
|
|
13469
13469
|
await gr(i.localStore, e,
|
|
13470
|
-
/* keepPersistedTargetData */ !0),
|
|
13470
|
+
/* keepPersistedTargetData */ !0), wc(i, e, s);
|
|
13471
13471
|
break;
|
|
13472
13472
|
|
|
13473
13473
|
default:
|
|
@@ -13475,8 +13475,8 @@ async function Sa(t, e, n, s) {
|
|
|
13475
13475
|
}
|
|
13476
13476
|
}
|
|
13477
13477
|
|
|
13478
|
-
/** Adds or removes Watch targets for queries from different tabs. */ async function
|
|
13479
|
-
const s =
|
|
13478
|
+
/** Adds or removes Watch targets for queries from different tabs. */ async function Dc(t, e, n) {
|
|
13479
|
+
const s = Cc(t);
|
|
13480
13480
|
if (s.qo) {
|
|
13481
13481
|
for (const t of e) {
|
|
13482
13482
|
if (s.ko.has(t)) {
|
|
@@ -13485,8 +13485,8 @@ async function Sa(t, e, n, s) {
|
|
|
13485
13485
|
continue;
|
|
13486
13486
|
}
|
|
13487
13487
|
const e = await pr(s.localStore, t), n = await mr(s.localStore, e);
|
|
13488
|
-
await
|
|
13489
|
-
/*current=*/ !1),
|
|
13488
|
+
await sc(s, vc(e), n.targetId,
|
|
13489
|
+
/*current=*/ !1), co(s.remoteStore, n);
|
|
13490
13490
|
}
|
|
13491
13491
|
for (const t of n)
|
|
13492
13492
|
// Check that the target is still active since the target might have been
|
|
@@ -13495,21 +13495,21 @@ async function Sa(t, e, n, s) {
|
|
|
13495
13495
|
// Release queries that are still active.
|
|
13496
13496
|
await gr(s.localStore, t,
|
|
13497
13497
|
/* keepPersistedTargetData */ !1).then((() => {
|
|
13498
|
-
|
|
13498
|
+
ao(s.remoteStore, t), wc(s, t);
|
|
13499
13499
|
})).catch(Fi);
|
|
13500
13500
|
}
|
|
13501
13501
|
}
|
|
13502
13502
|
|
|
13503
|
-
function
|
|
13503
|
+
function Cc(t) {
|
|
13504
13504
|
const e = U(t);
|
|
13505
|
-
return e.remoteStore.remoteSyncer.applyRemoteEvent =
|
|
13506
|
-
e.remoteStore.remoteSyncer.rejectListen =
|
|
13505
|
+
return e.remoteStore.remoteSyncer.applyRemoteEvent = oc.bind(null, e), e.remoteStore.remoteSyncer.getRemoteKeysForTarget = Tc.bind(null, e),
|
|
13506
|
+
e.remoteStore.remoteSyncer.rejectListen = ac.bind(null, e), e.No.Tr = qo.bind(null, e.eventManager),
|
|
13507
13507
|
e.No.jo = Ko.bind(null, e.eventManager), e;
|
|
13508
13508
|
}
|
|
13509
13509
|
|
|
13510
|
-
function
|
|
13510
|
+
function Nc(t) {
|
|
13511
13511
|
const e = U(t);
|
|
13512
|
-
return e.remoteStore.remoteSyncer.applySuccessfulWrite =
|
|
13512
|
+
return e.remoteStore.remoteSyncer.applySuccessfulWrite = uc.bind(null, e), e.remoteStore.remoteSyncer.rejectFailedWrite = hc.bind(null, e),
|
|
13513
13513
|
e;
|
|
13514
13514
|
}
|
|
13515
13515
|
|
|
@@ -13520,7 +13520,7 @@ function Na(t) {
|
|
|
13520
13520
|
* @param syncEngine - SyncEngine to use.
|
|
13521
13521
|
* @param bundleReader - Bundle to load into the SDK.
|
|
13522
13522
|
* @param task - LoadBundleTask used to update the loading progress to public API.
|
|
13523
|
-
*/ function
|
|
13523
|
+
*/ function xc(t, e, n) {
|
|
13524
13524
|
const s = U(t);
|
|
13525
13525
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
13526
13526
|
(async function(t, e, n) {
|
|
@@ -13552,7 +13552,7 @@ function Na(t) {
|
|
|
13552
13552
|
// TODO(b/160876443): This currently raises snapshots with
|
|
13553
13553
|
// `fromCache=false` if users already listen to some queries and bundles
|
|
13554
13554
|
// has newer version.
|
|
13555
|
-
await
|
|
13555
|
+
await pc(t, o.Tn,
|
|
13556
13556
|
/* remoteEvent */ void 0),
|
|
13557
13557
|
// Save metadata, so loading the same bundle will skip.
|
|
13558
13558
|
await function(t, e) {
|
|
@@ -13591,7 +13591,7 @@ function Na(t) {
|
|
|
13591
13591
|
}));
|
|
13592
13592
|
}
|
|
13593
13593
|
|
|
13594
|
-
class
|
|
13594
|
+
class kc {
|
|
13595
13595
|
constructor() {
|
|
13596
13596
|
this.synchronizeTabs = !1;
|
|
13597
13597
|
}
|
|
@@ -13603,7 +13603,7 @@ class ka {
|
|
|
13603
13603
|
return null;
|
|
13604
13604
|
}
|
|
13605
13605
|
Ho(t) {
|
|
13606
|
-
return ur(this.persistence, new
|
|
13606
|
+
return ur(this.persistence, new cr, t.initialUser, this.N);
|
|
13607
13607
|
}
|
|
13608
13608
|
Go(t) {
|
|
13609
13609
|
return new Cr(xr.Ns, this.N);
|
|
@@ -13619,21 +13619,21 @@ class ka {
|
|
|
13619
13619
|
|
|
13620
13620
|
/**
|
|
13621
13621
|
* Provides all components needed for Firestore with IndexedDB persistence.
|
|
13622
|
-
*/ class $
|
|
13622
|
+
*/ class $c extends kc {
|
|
13623
13623
|
constructor(t, e, n) {
|
|
13624
13624
|
super(), this.Jo = t, this.cacheSizeBytes = e, this.forceOwnership = n, this.synchronizeTabs = !1;
|
|
13625
13625
|
}
|
|
13626
13626
|
async initialize(t) {
|
|
13627
13627
|
await super.initialize(t), await Tr(this.localStore), await this.Jo.initialize(this, t),
|
|
13628
13628
|
// Enqueue writes from a previous session
|
|
13629
|
-
await
|
|
13629
|
+
await Nc(this.Jo.syncEngine), await To(this.Jo.remoteStore),
|
|
13630
13630
|
// NOTE: This will immediately call the listener, so we make sure to
|
|
13631
13631
|
// set it after localStore / remoteStore are started.
|
|
13632
13632
|
await this.persistence.nn((() => (this.gcScheduler && !this.gcScheduler.started && this.gcScheduler.start(this.localStore),
|
|
13633
13633
|
Promise.resolve())));
|
|
13634
13634
|
}
|
|
13635
13635
|
Ho(t) {
|
|
13636
|
-
return ur(this.persistence, new
|
|
13636
|
+
return ur(this.persistence, new cr, t.initialUser, this.N);
|
|
13637
13637
|
}
|
|
13638
13638
|
zo(t) {
|
|
13639
13639
|
const e = this.persistence.referenceDelegate.garbageCollector;
|
|
@@ -13655,7 +13655,7 @@ class ka {
|
|
|
13655
13655
|
* In the legacy client, this provider is used to provide both multi-tab and
|
|
13656
13656
|
* non-multi-tab persistence since we cannot tell at build time whether
|
|
13657
13657
|
* `synchronizeTabs` will be enabled.
|
|
13658
|
-
*/ class
|
|
13658
|
+
*/ class Oc extends $c {
|
|
13659
13659
|
constructor(t, e) {
|
|
13660
13660
|
super(t, e, /* forceOwnership= */ !1), this.Jo = t, this.cacheSizeBytes = e, this.synchronizeTabs = !0;
|
|
13661
13661
|
}
|
|
@@ -13663,16 +13663,16 @@ class ka {
|
|
|
13663
13663
|
await super.initialize(t);
|
|
13664
13664
|
const e = this.Jo.syncEngine;
|
|
13665
13665
|
this.sharedClientState instanceof qr && (this.sharedClientState.syncEngine = {
|
|
13666
|
-
_i:
|
|
13667
|
-
mi:
|
|
13668
|
-
gi:
|
|
13669
|
-
pn:
|
|
13670
|
-
wi:
|
|
13666
|
+
_i: Rc.bind(null, e),
|
|
13667
|
+
mi: Sc.bind(null, e),
|
|
13668
|
+
gi: Dc.bind(null, e),
|
|
13669
|
+
pn: Vc.bind(null, e),
|
|
13670
|
+
wi: Ac.bind(null, e)
|
|
13671
13671
|
}, await this.sharedClientState.start()),
|
|
13672
13672
|
// NOTE: This will immediately call the listener, so we make sure to
|
|
13673
13673
|
// set it after localStore / remoteStore are started.
|
|
13674
13674
|
await this.persistence.nn((async t => {
|
|
13675
|
-
await
|
|
13675
|
+
await bc(this.Jo.syncEngine, t), this.gcScheduler && (t && !this.gcScheduler.started ? this.gcScheduler.start(this.localStore) : t || this.gcScheduler.stop());
|
|
13676
13676
|
}));
|
|
13677
13677
|
}
|
|
13678
13678
|
Wo(t) {
|
|
@@ -13686,13 +13686,13 @@ class ka {
|
|
|
13686
13686
|
/**
|
|
13687
13687
|
* Initializes and wires the components that are needed to interface with the
|
|
13688
13688
|
* network.
|
|
13689
|
-
*/ class
|
|
13689
|
+
*/ class Fc {
|
|
13690
13690
|
async initialize(t, e) {
|
|
13691
13691
|
this.localStore || (this.localStore = t.localStore, this.sharedClientState = t.sharedClientState,
|
|
13692
13692
|
this.datastore = this.createDatastore(e), this.remoteStore = this.createRemoteStore(e),
|
|
13693
13693
|
this.eventManager = this.createEventManager(e), this.syncEngine = this.createSyncEngine(e,
|
|
13694
|
-
/* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t =>
|
|
13695
|
-
this.remoteStore.remoteSyncer.handleCredentialChange =
|
|
13694
|
+
/* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t => cc(this.syncEngine, t, 1 /* SharedClientState */),
|
|
13695
|
+
this.remoteStore.remoteSyncer.handleCredentialChange = Ec.bind(null, this.syncEngine),
|
|
13696
13696
|
await Do(this.remoteStore, this.syncEngine.isPrimaryClient));
|
|
13697
13697
|
}
|
|
13698
13698
|
createEventManager(t) {
|
|
@@ -13706,7 +13706,7 @@ class ka {
|
|
|
13706
13706
|
}(t.credentials, n, e);
|
|
13707
13707
|
}
|
|
13708
13708
|
createRemoteStore(t) {
|
|
13709
|
-
return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t =>
|
|
13709
|
+
return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t => cc(this.syncEngine, t, 0 /* RemoteStore */),
|
|
13710
13710
|
r = Qr.bt() ? new Qr : new jr, new io(e, n, s, i, r);
|
|
13711
13711
|
var e, n, s, i, r;
|
|
13712
13712
|
/** Re-enables the network. Idempotent. */ }
|
|
@@ -13714,8 +13714,8 @@ class ka {
|
|
|
13714
13714
|
return function(t, e, n,
|
|
13715
13715
|
// PORTING NOTE: Manages state synchronization in multi-tab environments.
|
|
13716
13716
|
s, i, r, o) {
|
|
13717
|
-
const
|
|
13718
|
-
return o && (
|
|
13717
|
+
const c = new ec(t, e, n, s, i, r);
|
|
13718
|
+
return o && (c.qo = !0), c;
|
|
13719
13719
|
}(this.localStore, this.remoteStore, this.eventManager, this.sharedClientState, t.initialUser, t.maxConcurrentLimboResolutions, e);
|
|
13720
13720
|
}
|
|
13721
13721
|
terminate() {
|
|
@@ -13757,7 +13757,7 @@ class ka {
|
|
|
13757
13757
|
* @param bytesPerRead - How many bytes each `read()` from the returned reader
|
|
13758
13758
|
* will read.
|
|
13759
13759
|
*/
|
|
13760
|
-
function
|
|
13760
|
+
function Mc(t, e = 10240) {
|
|
13761
13761
|
let n = 0;
|
|
13762
13762
|
// The TypeScript definition for ReadableStreamReader changed. We use
|
|
13763
13763
|
// `any` here to allow this code to compile with different versions.
|
|
@@ -13823,7 +13823,7 @@ function Ma(t, e = 10240) {
|
|
|
13823
13823
|
* asynchronously. To allow immediate silencing, a mute call is added which
|
|
13824
13824
|
* causes events scheduled to no longer be raised.
|
|
13825
13825
|
*/
|
|
13826
|
-
class
|
|
13826
|
+
class Lc {
|
|
13827
13827
|
constructor(t) {
|
|
13828
13828
|
this.observer = t,
|
|
13829
13829
|
/**
|
|
@@ -13869,7 +13869,7 @@ class La {
|
|
|
13869
13869
|
*
|
|
13870
13870
|
* Takes a bundle stream or buffer, and presents abstractions to read bundled
|
|
13871
13871
|
* elements out of the underlying content.
|
|
13872
|
-
*/ class
|
|
13872
|
+
*/ class Bc {
|
|
13873
13873
|
constructor(
|
|
13874
13874
|
/** The reader to read from underlying binary bundle data source. */
|
|
13875
13875
|
t, e) {
|
|
@@ -13880,9 +13880,9 @@ class La {
|
|
|
13880
13880
|
* Internal buffer to hold bundle content, accumulating incomplete element
|
|
13881
13881
|
* content.
|
|
13882
13882
|
*/
|
|
13883
|
-
this.buffer = new Uint8Array, this.
|
|
13883
|
+
this.buffer = new Uint8Array, this.tc = new TextDecoder("utf-8"),
|
|
13884
13884
|
// Read the metadata (which is the first element).
|
|
13885
|
-
this.
|
|
13885
|
+
this.ec().then((t => {
|
|
13886
13886
|
t && t.ho() ? 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)}`));
|
|
13887
13887
|
}), (t => this.metadata.reject(t)));
|
|
13888
13888
|
}
|
|
@@ -13894,7 +13894,7 @@ class La {
|
|
|
13894
13894
|
}
|
|
13895
13895
|
async Qo() {
|
|
13896
13896
|
// Makes sure metadata is read before proceeding.
|
|
13897
|
-
return await this.getMetadata(), this.
|
|
13897
|
+
return await this.getMetadata(), this.ec();
|
|
13898
13898
|
}
|
|
13899
13899
|
/**
|
|
13900
13900
|
* Reads from the head of internal buffer, and pulling more data from
|
|
@@ -13905,15 +13905,15 @@ class La {
|
|
|
13905
13905
|
*
|
|
13906
13906
|
* Returns either the bundled element, or null if we have reached the end of
|
|
13907
13907
|
* the stream.
|
|
13908
|
-
*/ async
|
|
13909
|
-
const t = await this.
|
|
13908
|
+
*/ async ec() {
|
|
13909
|
+
const t = await this.nc();
|
|
13910
13910
|
if (null === t) return null;
|
|
13911
|
-
const e = this.
|
|
13912
|
-
isNaN(n) && this.
|
|
13913
|
-
const s = await this.
|
|
13911
|
+
const e = this.tc.decode(t), n = Number(e);
|
|
13912
|
+
isNaN(n) && this.sc(`length string (${e}) is not valid number`);
|
|
13913
|
+
const s = await this.ic(n);
|
|
13914
13914
|
return new Wo(JSON.parse(s), t.length + n);
|
|
13915
13915
|
}
|
|
13916
|
-
/** First index of '{' from the underlying buffer. */
|
|
13916
|
+
/** First index of '{' from the underlying buffer. */ rc() {
|
|
13917
13917
|
return this.buffer.findIndex((t => t === "{".charCodeAt(0)));
|
|
13918
13918
|
}
|
|
13919
13919
|
/**
|
|
@@ -13921,17 +13921,17 @@ class La {
|
|
|
13921
13921
|
* return the content.
|
|
13922
13922
|
*
|
|
13923
13923
|
* If reached end of the stream, returns a null.
|
|
13924
|
-
*/ async
|
|
13925
|
-
for (;this.
|
|
13926
|
-
if (await this.
|
|
13924
|
+
*/ async nc() {
|
|
13925
|
+
for (;this.rc() < 0; ) {
|
|
13926
|
+
if (await this.oc()) break;
|
|
13927
13927
|
}
|
|
13928
13928
|
// Broke out of the loop because underlying stream is closed, and there
|
|
13929
13929
|
// happens to be no more data to process.
|
|
13930
13930
|
if (0 === this.buffer.length) return null;
|
|
13931
|
-
const t = this.
|
|
13931
|
+
const t = this.rc();
|
|
13932
13932
|
// Broke out of the loop because underlying stream is closed, but still
|
|
13933
13933
|
// cannot find an open bracket.
|
|
13934
|
-
t < 0 && this.
|
|
13934
|
+
t < 0 && this.sc("Reached the end of bundle when a length string is expected.");
|
|
13935
13935
|
const e = this.buffer.slice(0, t);
|
|
13936
13936
|
// Update the internal buffer to drop the read length.
|
|
13937
13937
|
return this.buffer = this.buffer.slice(t), e;
|
|
@@ -13941,22 +13941,22 @@ class La {
|
|
|
13941
13941
|
* number of bytes, pulling more data from the underlying stream if needed.
|
|
13942
13942
|
*
|
|
13943
13943
|
* Returns a string decoded from the read bytes.
|
|
13944
|
-
*/ async
|
|
13944
|
+
*/ async ic(t) {
|
|
13945
13945
|
for (;this.buffer.length < t; ) {
|
|
13946
|
-
await this.
|
|
13946
|
+
await this.oc() && this.sc("Reached the end of bundle when more is expected.");
|
|
13947
13947
|
}
|
|
13948
|
-
const e = this.
|
|
13948
|
+
const e = this.tc.decode(this.buffer.slice(0, t));
|
|
13949
13949
|
// Update the internal buffer to drop the read json string.
|
|
13950
13950
|
return this.buffer = this.buffer.slice(t), e;
|
|
13951
13951
|
}
|
|
13952
|
-
|
|
13952
|
+
sc(t) {
|
|
13953
13953
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
13954
13954
|
throw this.Zo.cancel(), new Error(`Invalid bundle format: ${t}`);
|
|
13955
13955
|
}
|
|
13956
13956
|
/**
|
|
13957
13957
|
* Pulls more data from underlying stream to internal buffer.
|
|
13958
13958
|
* Returns a boolean indicating whether the stream is finished.
|
|
13959
|
-
*/ async
|
|
13959
|
+
*/ async oc() {
|
|
13960
13960
|
const t = await this.Zo.read();
|
|
13961
13961
|
if (!t.done) {
|
|
13962
13962
|
const e = new Uint8Array(this.buffer.length + t.value.length);
|
|
@@ -13986,7 +13986,7 @@ class La {
|
|
|
13986
13986
|
* Internal transaction object responsible for accumulating the mutations to
|
|
13987
13987
|
* perform and the base versions for any documents read.
|
|
13988
13988
|
*/
|
|
13989
|
-
class
|
|
13989
|
+
class Uc {
|
|
13990
13990
|
constructor(t) {
|
|
13991
13991
|
this.datastore = t,
|
|
13992
13992
|
// The version of each document that was read during this transaction.
|
|
@@ -14014,11 +14014,11 @@ class Ua {
|
|
|
14014
14014
|
const e = es(n.N, t);
|
|
14015
14015
|
o.set(e.key.toString(), e);
|
|
14016
14016
|
}));
|
|
14017
|
-
const
|
|
14017
|
+
const c = [];
|
|
14018
14018
|
return e.forEach((t => {
|
|
14019
14019
|
const e = o.get(t.toString());
|
|
14020
|
-
L(!!e),
|
|
14021
|
-
})),
|
|
14020
|
+
L(!!e), c.push(e);
|
|
14021
|
+
})), c;
|
|
14022
14022
|
}(this.datastore, t);
|
|
14023
14023
|
return e.forEach((t => this.recordVersion(t))), e;
|
|
14024
14024
|
}
|
|
@@ -14034,7 +14034,7 @@ class Ua {
|
|
|
14034
14034
|
this.writtenDocs.add(t.toString());
|
|
14035
14035
|
}
|
|
14036
14036
|
delete(t) {
|
|
14037
|
-
this.write(new
|
|
14037
|
+
this.write(new cn(t, this.precondition(t))), this.writtenDocs.add(t.toString());
|
|
14038
14038
|
}
|
|
14039
14039
|
async commit() {
|
|
14040
14040
|
if (this.ensureCommitNotCalled(), this.lastWriteError) throw this.lastWriteError;
|
|
@@ -14047,7 +14047,7 @@ class Ua {
|
|
|
14047
14047
|
// a `verify` operation.
|
|
14048
14048
|
t.forEach(((t, e) => {
|
|
14049
14049
|
const n = Pt.fromPath(e);
|
|
14050
|
-
this.mutations.push(new
|
|
14050
|
+
this.mutations.push(new an(n, this.precondition(n)));
|
|
14051
14051
|
})), await async function(t, e) {
|
|
14052
14052
|
const n = U(t), s = Yn(n.N) + "/documents", i = {
|
|
14053
14053
|
writes: e.map((t => ss(n.N, t)))
|
|
@@ -14127,29 +14127,29 @@ class Ua {
|
|
|
14127
14127
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
14128
14128
|
* with backoff.
|
|
14129
14129
|
*/
|
|
14130
|
-
class
|
|
14130
|
+
class qc {
|
|
14131
14131
|
constructor(t, e, n, s) {
|
|
14132
14132
|
this.asyncQueue = t, this.datastore = e, this.updateFunction = n, this.deferred = s,
|
|
14133
|
-
this.
|
|
14133
|
+
this.cc = 5, this.rr = new Xr(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
14134
14134
|
}
|
|
14135
14135
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
14136
|
-
this.
|
|
14136
|
+
this.cc -= 1, this.ac();
|
|
14137
14137
|
}
|
|
14138
|
-
|
|
14138
|
+
ac() {
|
|
14139
14139
|
this.rr.Xi((async () => {
|
|
14140
|
-
const t = new
|
|
14140
|
+
const t = new Uc(this.datastore), e = this.uc(t);
|
|
14141
14141
|
e && e.then((e => {
|
|
14142
14142
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
14143
14143
|
this.deferred.resolve(e);
|
|
14144
14144
|
})).catch((t => {
|
|
14145
|
-
this.
|
|
14145
|
+
this.hc(t);
|
|
14146
14146
|
}))));
|
|
14147
14147
|
})).catch((t => {
|
|
14148
|
-
this.
|
|
14148
|
+
this.hc(t);
|
|
14149
14149
|
}));
|
|
14150
14150
|
}));
|
|
14151
14151
|
}
|
|
14152
|
-
|
|
14152
|
+
uc(t) {
|
|
14153
14153
|
try {
|
|
14154
14154
|
const e = this.updateFunction(t);
|
|
14155
14155
|
return !At(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
@@ -14159,11 +14159,11 @@ class qa {
|
|
|
14159
14159
|
return this.deferred.reject(t), null;
|
|
14160
14160
|
}
|
|
14161
14161
|
}
|
|
14162
|
-
|
|
14163
|
-
this.
|
|
14162
|
+
hc(t) {
|
|
14163
|
+
this.cc > 0 && this.lc(t) ? (this.cc -= 1, this.asyncQueue.enqueueAndForget((() => (this.ac(),
|
|
14164
14164
|
Promise.resolve())))) : this.deferred.reject(t);
|
|
14165
14165
|
}
|
|
14166
|
-
|
|
14166
|
+
lc(t) {
|
|
14167
14167
|
if ("FirebaseError" === t.name) {
|
|
14168
14168
|
// In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
|
|
14169
14169
|
// non-matching document versions with ABORTED. These errors should be retried.
|
|
@@ -14195,7 +14195,7 @@ class qa {
|
|
|
14195
14195
|
* pieces of the client SDK architecture. It is responsible for creating the
|
|
14196
14196
|
* async queue that is shared by all of the other components in the system.
|
|
14197
14197
|
*/
|
|
14198
|
-
class
|
|
14198
|
+
class Kc {
|
|
14199
14199
|
constructor(t,
|
|
14200
14200
|
/**
|
|
14201
14201
|
* Asynchronous queue responsible for all of our internal processing. When
|
|
@@ -14249,7 +14249,7 @@ class Ka {
|
|
|
14249
14249
|
}
|
|
14250
14250
|
}
|
|
14251
14251
|
|
|
14252
|
-
async function
|
|
14252
|
+
async function jc(t, e) {
|
|
14253
14253
|
t.asyncQueue.verifyOperationInProgress(), k("FirestoreClient", "Initializing OfflineComponentProvider");
|
|
14254
14254
|
const n = await t.getConfiguration();
|
|
14255
14255
|
await e.initialize(n);
|
|
@@ -14262,9 +14262,9 @@ async function ja(t, e) {
|
|
|
14262
14262
|
e.persistence.setDatabaseDeletedListener((() => t.terminate())), t.offlineComponents = e;
|
|
14263
14263
|
}
|
|
14264
14264
|
|
|
14265
|
-
async function
|
|
14265
|
+
async function Qc(t, e) {
|
|
14266
14266
|
t.asyncQueue.verifyOperationInProgress();
|
|
14267
|
-
const n = await
|
|
14267
|
+
const n = await Wc(t);
|
|
14268
14268
|
k("FirestoreClient", "Initializing OnlineComponentProvider");
|
|
14269
14269
|
const s = await t.getConfiguration();
|
|
14270
14270
|
await e.initialize(n, s),
|
|
@@ -14284,41 +14284,41 @@ async function Qa(t, e) {
|
|
|
14284
14284
|
}(e.remoteStore, t))), t.onlineComponents = e;
|
|
14285
14285
|
}
|
|
14286
14286
|
|
|
14287
|
-
async function
|
|
14287
|
+
async function Wc(t) {
|
|
14288
14288
|
return t.offlineComponents || (k("FirestoreClient", "Using default OfflineComponentProvider"),
|
|
14289
|
-
await
|
|
14289
|
+
await jc(t, new kc)), t.offlineComponents;
|
|
14290
14290
|
}
|
|
14291
14291
|
|
|
14292
|
-
async function
|
|
14292
|
+
async function Gc(t) {
|
|
14293
14293
|
return t.onlineComponents || (k("FirestoreClient", "Using default OnlineComponentProvider"),
|
|
14294
|
-
await
|
|
14294
|
+
await Qc(t, new Fc)), t.onlineComponents;
|
|
14295
14295
|
}
|
|
14296
14296
|
|
|
14297
|
-
function
|
|
14298
|
-
return
|
|
14297
|
+
function zc(t) {
|
|
14298
|
+
return Wc(t).then((t => t.persistence));
|
|
14299
14299
|
}
|
|
14300
14300
|
|
|
14301
|
-
function
|
|
14302
|
-
return
|
|
14301
|
+
function Hc(t) {
|
|
14302
|
+
return Wc(t).then((t => t.localStore));
|
|
14303
14303
|
}
|
|
14304
14304
|
|
|
14305
|
-
function
|
|
14306
|
-
return
|
|
14305
|
+
function Jc(t) {
|
|
14306
|
+
return Gc(t).then((t => t.remoteStore));
|
|
14307
14307
|
}
|
|
14308
14308
|
|
|
14309
|
-
function
|
|
14310
|
-
return
|
|
14309
|
+
function Yc(t) {
|
|
14310
|
+
return Gc(t).then((t => t.syncEngine));
|
|
14311
14311
|
}
|
|
14312
14312
|
|
|
14313
|
-
async function
|
|
14314
|
-
const e = await
|
|
14315
|
-
return n.onListen =
|
|
14313
|
+
async function Xc(t) {
|
|
14314
|
+
const e = await Gc(t), n = e.eventManager;
|
|
14315
|
+
return n.onListen = nc.bind(null, e.syncEngine), n.onUnlisten = ic.bind(null, e.syncEngine),
|
|
14316
14316
|
n;
|
|
14317
14317
|
}
|
|
14318
14318
|
|
|
14319
|
-
/** Enables the network connection and re-enqueues all pending operations. */ function
|
|
14319
|
+
/** Enables the network connection and re-enqueues all pending operations. */ function Zc(t) {
|
|
14320
14320
|
return t.asyncQueue.enqueue((async () => {
|
|
14321
|
-
const e = await
|
|
14321
|
+
const e = await zc(t), n = await Jc(t);
|
|
14322
14322
|
return e.setNetworkEnabled(!0), function(t) {
|
|
14323
14323
|
const e = U(t);
|
|
14324
14324
|
return e.Kr.delete(0 /* UserDisabled */), ro(e);
|
|
@@ -14326,9 +14326,9 @@ async function Xa(t) {
|
|
|
14326
14326
|
}));
|
|
14327
14327
|
}
|
|
14328
14328
|
|
|
14329
|
-
/** Disables the network connection. Pending operations will not complete. */ function
|
|
14329
|
+
/** Disables the network connection. Pending operations will not complete. */ function ta(t) {
|
|
14330
14330
|
return t.asyncQueue.enqueue((async () => {
|
|
14331
|
-
const e = await
|
|
14331
|
+
const e = await zc(t), n = await Jc(t);
|
|
14332
14332
|
return e.setNetworkEnabled(!1), async function(t) {
|
|
14333
14333
|
const e = U(t);
|
|
14334
14334
|
e.Kr.add(0 /* UserDisabled */), await oo(e),
|
|
@@ -14342,7 +14342,7 @@ async function Xa(t) {
|
|
|
14342
14342
|
* Returns a Promise that resolves when all writes that were pending at the time
|
|
14343
14343
|
* this method was called received server acknowledgement. An acknowledgement
|
|
14344
14344
|
* can be either acceptance or rejection.
|
|
14345
|
-
*/ function
|
|
14345
|
+
*/ function ea(t, e) {
|
|
14346
14346
|
const n = new j;
|
|
14347
14347
|
return t.asyncQueue.enqueueAndForget((async () => async function(t, e, n) {
|
|
14348
14348
|
try {
|
|
@@ -14359,19 +14359,19 @@ async function Xa(t) {
|
|
|
14359
14359
|
/**
|
|
14360
14360
|
* Retrieves a latency-compensated document from the backend via a
|
|
14361
14361
|
* SnapshotListener.
|
|
14362
|
-
*/ (await
|
|
14362
|
+
*/ (await Hc(t), e, n))), n.promise;
|
|
14363
14363
|
}
|
|
14364
14364
|
|
|
14365
|
-
function
|
|
14365
|
+
function na(t, e, n = {}) {
|
|
14366
14366
|
const s = new j;
|
|
14367
14367
|
return t.asyncQueue.enqueueAndForget((async () => function(t, e, n, s, i) {
|
|
14368
|
-
const r = new
|
|
14368
|
+
const r = new Lc({
|
|
14369
14369
|
next: r => {
|
|
14370
14370
|
// Remove query first before passing event to user to avoid
|
|
14371
14371
|
// user actions affecting the now stale query.
|
|
14372
14372
|
e.enqueueAndForget((() => Uo(t, o)));
|
|
14373
|
-
const
|
|
14374
|
-
!
|
|
14373
|
+
const c = r.docs.has(n);
|
|
14374
|
+
!c && r.fromCache ?
|
|
14375
14375
|
// TODO(dimond): If we're online and the document doesn't
|
|
14376
14376
|
// exist then we resolve with a doc.exists set to false. If
|
|
14377
14377
|
// we're offline however, we reject the Promise in this
|
|
@@ -14379,7 +14379,7 @@ function nc(t, e, n = {}) {
|
|
|
14379
14379
|
// the server so we can deliver that even when you're
|
|
14380
14380
|
// offline 2) Actually reject the Promise in the online case
|
|
14381
14381
|
// if the document doesn't exist.
|
|
14382
|
-
i.reject(new K(q.UNAVAILABLE, "Failed to get document because the client is offline.")) :
|
|
14382
|
+
i.reject(new K(q.UNAVAILABLE, "Failed to get document because the client is offline.")) : c && r.fromCache && s && "server" === s.source ? i.reject(new K(q.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);
|
|
14383
14383
|
},
|
|
14384
14384
|
error: t => i.reject(t)
|
|
14385
14385
|
}), o = new Qo(we(n.path), r, {
|
|
@@ -14387,10 +14387,10 @@ function nc(t, e, n = {}) {
|
|
|
14387
14387
|
uo: !0
|
|
14388
14388
|
});
|
|
14389
14389
|
return Bo(t, o);
|
|
14390
|
-
}(await
|
|
14390
|
+
}(await Xc(t), t.asyncQueue, e, n, s))), s.promise;
|
|
14391
14391
|
}
|
|
14392
14392
|
|
|
14393
|
-
function
|
|
14393
|
+
function sa(t, e) {
|
|
14394
14394
|
const n = new j;
|
|
14395
14395
|
return t.asyncQueue.enqueueAndForget((async () => async function(t, e, n) {
|
|
14396
14396
|
try {
|
|
@@ -14406,13 +14406,13 @@ function sc(t, e) {
|
|
|
14406
14406
|
/**
|
|
14407
14407
|
* Retrieves a latency-compensated query snapshot from the backend via a
|
|
14408
14408
|
* SnapshotListener.
|
|
14409
|
-
*/ (await
|
|
14409
|
+
*/ (await Hc(t), e, n))), n.promise;
|
|
14410
14410
|
}
|
|
14411
14411
|
|
|
14412
|
-
function
|
|
14412
|
+
function ia(t, e, n = {}) {
|
|
14413
14413
|
const s = new j;
|
|
14414
14414
|
return t.asyncQueue.enqueueAndForget((async () => function(t, e, n, s, i) {
|
|
14415
|
-
const r = new
|
|
14415
|
+
const r = new Lc({
|
|
14416
14416
|
next: n => {
|
|
14417
14417
|
// Remove query first before passing event to user to avoid
|
|
14418
14418
|
// user actions affecting the now stale query.
|
|
@@ -14424,20 +14424,20 @@ function ic(t, e, n = {}) {
|
|
|
14424
14424
|
uo: !0
|
|
14425
14425
|
});
|
|
14426
14426
|
return Bo(t, o);
|
|
14427
|
-
}(await
|
|
14427
|
+
}(await Xc(t), t.asyncQueue, e, n, s))), s.promise;
|
|
14428
14428
|
}
|
|
14429
14429
|
|
|
14430
|
-
function
|
|
14431
|
-
const n = new
|
|
14430
|
+
function ra(t, e) {
|
|
14431
|
+
const n = new Lc(e);
|
|
14432
14432
|
return t.asyncQueue.enqueueAndForget((async () => function(t, e) {
|
|
14433
14433
|
U(t).Zr.add(e),
|
|
14434
14434
|
// Immediately fire an initial event, indicating all existing listeners
|
|
14435
14435
|
// are in-sync.
|
|
14436
14436
|
e.next();
|
|
14437
|
-
}(await
|
|
14437
|
+
}(await Xc(t), n))), () => {
|
|
14438
14438
|
n.Xo(), t.asyncQueue.enqueueAndForget((async () => function(t, e) {
|
|
14439
14439
|
U(t).Zr.delete(e);
|
|
14440
|
-
}(await
|
|
14440
|
+
}(await Xc(t), n)));
|
|
14441
14441
|
};
|
|
14442
14442
|
}
|
|
14443
14443
|
|
|
@@ -14455,25 +14455,25 @@ function rc(t, e) {
|
|
|
14455
14455
|
* accessed with the transaction will not reflect local changes that have not
|
|
14456
14456
|
* been committed. For this reason, it is required that all reads are
|
|
14457
14457
|
* performed before any writes. Transactions must be performed while online.
|
|
14458
|
-
*/ function
|
|
14458
|
+
*/ function oa(t, e) {
|
|
14459
14459
|
const n = new j;
|
|
14460
14460
|
return t.asyncQueue.enqueueAndForget((async () => {
|
|
14461
14461
|
const s = await function(t) {
|
|
14462
|
-
return
|
|
14462
|
+
return Gc(t).then((t => t.datastore));
|
|
14463
14463
|
}(t);
|
|
14464
|
-
new
|
|
14464
|
+
new qc(t.asyncQueue, s, e, n).run();
|
|
14465
14465
|
})), n.promise;
|
|
14466
14466
|
}
|
|
14467
14467
|
|
|
14468
|
-
function
|
|
14468
|
+
function ca(t, e, n, s) {
|
|
14469
14469
|
const i = function(t, e) {
|
|
14470
14470
|
let n;
|
|
14471
14471
|
n = "string" == typeof t ? (new TextEncoder).encode(t) : t;
|
|
14472
14472
|
return function(t, e) {
|
|
14473
|
-
return new
|
|
14473
|
+
return new Bc(t, e);
|
|
14474
14474
|
}(function(t, e) {
|
|
14475
|
-
if (t instanceof Uint8Array) return
|
|
14476
|
-
if (t instanceof ArrayBuffer) return
|
|
14475
|
+
if (t instanceof Uint8Array) return Mc(t, e);
|
|
14476
|
+
if (t instanceof ArrayBuffer) return Mc(new Uint8Array(t), e);
|
|
14477
14477
|
if (t instanceof ReadableStream) return t.getReader();
|
|
14478
14478
|
throw new Error("Source of `toByteStreamReader` has to be a ArrayBuffer or ReadableStream");
|
|
14479
14479
|
}(n), e);
|
|
@@ -14495,18 +14495,18 @@ function ac(t, e, n, s) {
|
|
|
14495
14495
|
* limitations under the License.
|
|
14496
14496
|
*/ (n, Yr(e));
|
|
14497
14497
|
t.asyncQueue.enqueueAndForget((async () => {
|
|
14498
|
-
|
|
14498
|
+
xc(await Yc(t), i, s);
|
|
14499
14499
|
}));
|
|
14500
14500
|
}
|
|
14501
14501
|
|
|
14502
|
-
function
|
|
14502
|
+
function aa(t, e) {
|
|
14503
14503
|
return t.asyncQueue.enqueue((async () => function(t, e) {
|
|
14504
14504
|
const n = U(t);
|
|
14505
14505
|
return n.persistence.runTransaction("Get named query", "readonly", (t => n.Je.getNamedQuery(t, e)));
|
|
14506
|
-
}(await
|
|
14506
|
+
}(await Hc(t), e)));
|
|
14507
14507
|
}
|
|
14508
14508
|
|
|
14509
|
-
class
|
|
14509
|
+
class ua {
|
|
14510
14510
|
/**
|
|
14511
14511
|
* Constructs a DatabaseInfo using the provided host, databaseId and
|
|
14512
14512
|
* persistenceKey.
|
|
@@ -14524,9 +14524,9 @@ class uc {
|
|
|
14524
14524
|
* @param useFetchStreams Whether to use the Fetch API instead of
|
|
14525
14525
|
* XMLHTTPRequest
|
|
14526
14526
|
*/
|
|
14527
|
-
constructor(t, e, n, s, i, r, o,
|
|
14527
|
+
constructor(t, e, n, s, i, r, o, c) {
|
|
14528
14528
|
this.databaseId = t, this.appId = e, this.persistenceKey = n, this.host = s, this.ssl = i,
|
|
14529
|
-
this.forceLongPolling = r, this.autoDetectLongPolling = o, this.useFetchStreams =
|
|
14529
|
+
this.forceLongPolling = r, this.autoDetectLongPolling = o, this.useFetchStreams = c;
|
|
14530
14530
|
}
|
|
14531
14531
|
}
|
|
14532
14532
|
|
|
@@ -14535,7 +14535,7 @@ class uc {
|
|
|
14535
14535
|
* Represents the database ID a Firestore client is associated with.
|
|
14536
14536
|
* @internal
|
|
14537
14537
|
*/
|
|
14538
|
-
class
|
|
14538
|
+
class ha {
|
|
14539
14539
|
constructor(t, e) {
|
|
14540
14540
|
this.projectId = t, this.database = e || "(default)";
|
|
14541
14541
|
}
|
|
@@ -14543,7 +14543,7 @@ class hc {
|
|
|
14543
14543
|
return "(default)" === this.database;
|
|
14544
14544
|
}
|
|
14545
14545
|
isEqual(t) {
|
|
14546
|
-
return t instanceof
|
|
14546
|
+
return t instanceof ha && t.projectId === this.projectId && t.database === this.database;
|
|
14547
14547
|
}
|
|
14548
14548
|
}
|
|
14549
14549
|
|
|
@@ -14562,7 +14562,7 @@ class hc {
|
|
|
14562
14562
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14563
14563
|
* See the License for the specific language governing permissions and
|
|
14564
14564
|
* limitations under the License.
|
|
14565
|
-
*/ const
|
|
14565
|
+
*/ const la = new Map;
|
|
14566
14566
|
|
|
14567
14567
|
/**
|
|
14568
14568
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -14584,28 +14584,28 @@ class hc {
|
|
|
14584
14584
|
* See the License for the specific language governing permissions and
|
|
14585
14585
|
* limitations under the License.
|
|
14586
14586
|
*/
|
|
14587
|
-
function
|
|
14587
|
+
function fa(t, e, n) {
|
|
14588
14588
|
if (!n) throw new K(q.INVALID_ARGUMENT, `Function ${t}() cannot be called with an empty ${e}.`);
|
|
14589
14589
|
}
|
|
14590
14590
|
|
|
14591
14591
|
/**
|
|
14592
14592
|
* Validates that two boolean options are not set at the same time.
|
|
14593
14593
|
* @internal
|
|
14594
|
-
*/ function
|
|
14594
|
+
*/ function da(t, e, n, s) {
|
|
14595
14595
|
if (!0 === e && !0 === s) throw new K(q.INVALID_ARGUMENT, `${t} and ${n} cannot be used together.`);
|
|
14596
14596
|
}
|
|
14597
14597
|
|
|
14598
14598
|
/**
|
|
14599
14599
|
* Validates that `path` refers to a document (indicated by the fact it contains
|
|
14600
14600
|
* an even numbers of segments).
|
|
14601
|
-
*/ function
|
|
14601
|
+
*/ function wa(t) {
|
|
14602
14602
|
if (!Pt.isDocumentKey(t)) throw new K(q.INVALID_ARGUMENT, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
|
|
14603
14603
|
}
|
|
14604
14604
|
|
|
14605
14605
|
/**
|
|
14606
14606
|
* Validates that `path` refers to a collection (indicated by the fact it
|
|
14607
14607
|
* contains an odd numbers of segments).
|
|
14608
|
-
*/ function
|
|
14608
|
+
*/ function _a(t) {
|
|
14609
14609
|
if (Pt.isDocumentKey(t)) throw new K(q.INVALID_ARGUMENT, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
|
|
14610
14610
|
}
|
|
14611
14611
|
|
|
@@ -14614,7 +14614,7 @@ function fc(t, e, n) {
|
|
|
14614
14614
|
* (i.e. excludes Array, Date, etc.).
|
|
14615
14615
|
*/
|
|
14616
14616
|
/** Returns a string describing the type / value of the provided input. */
|
|
14617
|
-
function
|
|
14617
|
+
function ma(t) {
|
|
14618
14618
|
if (void 0 === t) return "undefined";
|
|
14619
14619
|
if (null === t) return "null";
|
|
14620
14620
|
if ("string" == typeof t) return t.length > 20 && (t = `${t.substring(0, 20)}...`),
|
|
@@ -14646,7 +14646,7 @@ function mc(t) {
|
|
|
14646
14646
|
return "function" == typeof t ? "a function" : M();
|
|
14647
14647
|
}
|
|
14648
14648
|
|
|
14649
|
-
function
|
|
14649
|
+
function ga(t,
|
|
14650
14650
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14651
14651
|
e) {
|
|
14652
14652
|
if ("_delegate" in t && (
|
|
@@ -14655,14 +14655,14 @@ e) {
|
|
|
14655
14655
|
t = t._delegate), !(t instanceof e)) {
|
|
14656
14656
|
if (e.name === t.constructor.name) throw new K(q.INVALID_ARGUMENT, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
|
|
14657
14657
|
{
|
|
14658
|
-
const n =
|
|
14658
|
+
const n = ma(t);
|
|
14659
14659
|
throw new K(q.INVALID_ARGUMENT, `Expected type '${e.name}', but it was: ${n}`);
|
|
14660
14660
|
}
|
|
14661
14661
|
}
|
|
14662
14662
|
return t;
|
|
14663
14663
|
}
|
|
14664
14664
|
|
|
14665
|
-
function
|
|
14665
|
+
function ya(t, e) {
|
|
14666
14666
|
if (e <= 0) throw new K(q.INVALID_ARGUMENT, `Function ${t}() requires a positive number, but it was: ${e}.`);
|
|
14667
14667
|
}
|
|
14668
14668
|
|
|
@@ -14688,7 +14688,7 @@ function yc(t, e) {
|
|
|
14688
14688
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
14689
14689
|
* defaults can be supplied and the value can be checked for equality.
|
|
14690
14690
|
*/
|
|
14691
|
-
class
|
|
14691
|
+
class pa {
|
|
14692
14692
|
constructor(t) {
|
|
14693
14693
|
var e;
|
|
14694
14694
|
if (void 0 === t.host) {
|
|
@@ -14701,7 +14701,7 @@ class pc {
|
|
|
14701
14701
|
this.cacheSizeBytes = t.cacheSizeBytes;
|
|
14702
14702
|
}
|
|
14703
14703
|
this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
|
|
14704
|
-
this.useFetchStreams = !!t.useFetchStreams,
|
|
14704
|
+
this.useFetchStreams = !!t.useFetchStreams, da("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
|
|
14705
14705
|
}
|
|
14706
14706
|
isEqual(t) {
|
|
14707
14707
|
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;
|
|
@@ -14728,18 +14728,18 @@ class pc {
|
|
|
14728
14728
|
* The Cloud Firestore service interface.
|
|
14729
14729
|
*
|
|
14730
14730
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
14731
|
-
*/ class
|
|
14731
|
+
*/ class Ea {
|
|
14732
14732
|
/** @hideconstructor */
|
|
14733
14733
|
constructor(t, e) {
|
|
14734
14734
|
this._credentials = e,
|
|
14735
14735
|
/**
|
|
14736
14736
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
14737
14737
|
*/
|
|
14738
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
14739
|
-
this._settingsFrozen = !1, t instanceof
|
|
14738
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new pa({}),
|
|
14739
|
+
this._settingsFrozen = !1, t instanceof ha ? this._databaseId = t : (this._app = t,
|
|
14740
14740
|
this._databaseId = function(t) {
|
|
14741
14741
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new K(q.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
|
|
14742
|
-
return new
|
|
14742
|
+
return new ha(t.options.projectId);
|
|
14743
14743
|
}
|
|
14744
14744
|
/**
|
|
14745
14745
|
* Modify this instance to communicate with the Cloud Firestore emulator.
|
|
@@ -14770,7 +14770,7 @@ class pc {
|
|
|
14770
14770
|
}
|
|
14771
14771
|
_setSettings(t) {
|
|
14772
14772
|
if (this._settingsFrozen) throw new K(q.FAILED_PRECONDITION, "Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");
|
|
14773
|
-
this._settings = new
|
|
14773
|
+
this._settings = new pa(t), void 0 !== t.credentials && (this._credentials = function(t) {
|
|
14774
14774
|
if (!t) return new W;
|
|
14775
14775
|
switch (t.type) {
|
|
14776
14776
|
case "gapi":
|
|
@@ -14815,15 +14815,15 @@ class pc {
|
|
|
14815
14815
|
* when the `Firestore` instance is terminated.
|
|
14816
14816
|
*/
|
|
14817
14817
|
return function(t) {
|
|
14818
|
-
const e =
|
|
14819
|
-
e && (k("ComponentProvider", "Removing Datastore"),
|
|
14818
|
+
const e = la.get(t);
|
|
14819
|
+
e && (k("ComponentProvider", "Removing Datastore"), la.delete(t), e.terminate());
|
|
14820
14820
|
}(this), Promise.resolve();
|
|
14821
14821
|
}
|
|
14822
14822
|
}
|
|
14823
14823
|
|
|
14824
|
-
function
|
|
14824
|
+
function Ta(t, e, n, s = {}) {
|
|
14825
14825
|
var i;
|
|
14826
|
-
const r = (t =
|
|
14826
|
+
const r = (t = ga(t, Ea))._getSettings();
|
|
14827
14827
|
if ("firestore.googleapis.com" !== r.host && r.host !== e && O("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
14828
14828
|
t._setSettings(Object.assign(Object.assign({}, r), {
|
|
14829
14829
|
host: `${e}:${n}`,
|
|
@@ -14862,7 +14862,7 @@ function Tc(t, e, n, s = {}) {
|
|
|
14862
14862
|
* A `DocumentReference` refers to a document location in a Firestore database
|
|
14863
14863
|
* and can be used to write, read, or listen to the location. The document at
|
|
14864
14864
|
* the referenced location may or may not exist.
|
|
14865
|
-
*/ class
|
|
14865
|
+
*/ class Ia {
|
|
14866
14866
|
/** @hideconstructor */
|
|
14867
14867
|
constructor(t,
|
|
14868
14868
|
/**
|
|
@@ -14890,17 +14890,17 @@ function Tc(t, e, n, s = {}) {
|
|
|
14890
14890
|
/**
|
|
14891
14891
|
* The collection this `DocumentReference` belongs to.
|
|
14892
14892
|
*/ get parent() {
|
|
14893
|
-
return new
|
|
14893
|
+
return new Ra(this.firestore, this.converter, this._key.path.popLast());
|
|
14894
14894
|
}
|
|
14895
14895
|
withConverter(t) {
|
|
14896
|
-
return new
|
|
14896
|
+
return new Ia(this.firestore, t, this._key);
|
|
14897
14897
|
}
|
|
14898
14898
|
}
|
|
14899
14899
|
|
|
14900
14900
|
/**
|
|
14901
14901
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
14902
14902
|
* construct refined `Query` objects by adding filters and ordering.
|
|
14903
|
-
*/ class
|
|
14903
|
+
*/ class Aa {
|
|
14904
14904
|
// This is the lite version of the Query class in the main SDK.
|
|
14905
14905
|
/** @hideconstructor protected */
|
|
14906
14906
|
constructor(t,
|
|
@@ -14913,14 +14913,14 @@ function Tc(t, e, n, s = {}) {
|
|
|
14913
14913
|
this.type = "query", this.firestore = t;
|
|
14914
14914
|
}
|
|
14915
14915
|
withConverter(t) {
|
|
14916
|
-
return new
|
|
14916
|
+
return new Aa(this.firestore, t, this._query);
|
|
14917
14917
|
}
|
|
14918
14918
|
}
|
|
14919
14919
|
|
|
14920
14920
|
/**
|
|
14921
14921
|
* A `CollectionReference` object can be used for adding documents, getting
|
|
14922
14922
|
* document references, and querying for documents (using {@link query}).
|
|
14923
|
-
*/ class
|
|
14923
|
+
*/ class Ra extends Aa {
|
|
14924
14924
|
/** @hideconstructor */
|
|
14925
14925
|
constructor(t, e, n) {
|
|
14926
14926
|
super(t, e, we(n)), this._path = n,
|
|
@@ -14941,23 +14941,23 @@ function Tc(t, e, n, s = {}) {
|
|
|
14941
14941
|
* subcollection. If this isn't a subcollection, the reference is null.
|
|
14942
14942
|
*/ get parent() {
|
|
14943
14943
|
const t = this._path.popLast();
|
|
14944
|
-
return t.isEmpty() ? null : new
|
|
14944
|
+
return t.isEmpty() ? null : new Ia(this.firestore,
|
|
14945
14945
|
/* converter= */ null, new Pt(t));
|
|
14946
14946
|
}
|
|
14947
14947
|
withConverter(t) {
|
|
14948
|
-
return new
|
|
14948
|
+
return new Ra(this.firestore, t, this._path);
|
|
14949
14949
|
}
|
|
14950
14950
|
}
|
|
14951
14951
|
|
|
14952
|
-
function
|
|
14953
|
-
if (t = y(t),
|
|
14952
|
+
function ba(t, e, ...n) {
|
|
14953
|
+
if (t = y(t), fa("collection", "path", e), t instanceof Ea) {
|
|
14954
14954
|
const s = ut.fromString(e, ...n);
|
|
14955
|
-
return
|
|
14955
|
+
return _a(s), new Ra(t, /* converter= */ null, s);
|
|
14956
14956
|
}
|
|
14957
14957
|
{
|
|
14958
|
-
if (!(t instanceof
|
|
14958
|
+
if (!(t instanceof Ia || t instanceof Ra)) throw new K(q.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
14959
14959
|
const s = t._path.child(ut.fromString(e, ...n));
|
|
14960
|
-
return
|
|
14960
|
+
return _a(s), new Ra(t.firestore,
|
|
14961
14961
|
/* converter= */ null, s);
|
|
14962
14962
|
}
|
|
14963
14963
|
}
|
|
@@ -14974,9 +14974,9 @@ function bc(t, e, ...n) {
|
|
|
14974
14974
|
* collection or subcollection with this ID as the last segment of its path
|
|
14975
14975
|
* will be included. Cannot contain a slash.
|
|
14976
14976
|
* @returns The created `Query`.
|
|
14977
|
-
*/ function
|
|
14978
|
-
if (t =
|
|
14979
|
-
return new
|
|
14977
|
+
*/ function Pa(t, e) {
|
|
14978
|
+
if (t = ga(t, Ea), fa("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new K(q.INVALID_ARGUMENT, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
14979
|
+
return new Aa(t,
|
|
14980
14980
|
/* converter= */ null,
|
|
14981
14981
|
/**
|
|
14982
14982
|
* Creates a new Query for a collection group query that matches all documents
|
|
@@ -14987,19 +14987,19 @@ function bc(t, e, ...n) {
|
|
|
14987
14987
|
}(e));
|
|
14988
14988
|
}
|
|
14989
14989
|
|
|
14990
|
-
function
|
|
14990
|
+
function va(t, e, ...n) {
|
|
14991
14991
|
if (t = y(t),
|
|
14992
14992
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
14993
14993
|
// 'undefined' and 'null'.
|
|
14994
|
-
1 === arguments.length && (e = Z.I()),
|
|
14994
|
+
1 === arguments.length && (e = Z.I()), fa("doc", "path", e), t instanceof Ea) {
|
|
14995
14995
|
const s = ut.fromString(e, ...n);
|
|
14996
|
-
return
|
|
14996
|
+
return wa(s), new Ia(t,
|
|
14997
14997
|
/* converter= */ null, new Pt(s));
|
|
14998
14998
|
}
|
|
14999
14999
|
{
|
|
15000
|
-
if (!(t instanceof
|
|
15000
|
+
if (!(t instanceof Ia || t instanceof Ra)) throw new K(q.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
15001
15001
|
const s = t._path.child(ut.fromString(e, ...n));
|
|
15002
|
-
return
|
|
15002
|
+
return wa(s), new Ia(t.firestore, t instanceof Ra ? t.converter : null, new Pt(s));
|
|
15003
15003
|
}
|
|
15004
15004
|
}
|
|
15005
15005
|
|
|
@@ -15010,8 +15010,8 @@ function vc(t, e, ...n) {
|
|
|
15010
15010
|
* @param right - A reference to compare.
|
|
15011
15011
|
* @returns true if the references point to the same location in the same
|
|
15012
15012
|
* Firestore database.
|
|
15013
|
-
*/ function
|
|
15014
|
-
return t = y(t), e = y(e), (t instanceof
|
|
15013
|
+
*/ function Va(t, e) {
|
|
15014
|
+
return t = y(t), e = y(e), (t instanceof Ia || t instanceof Ra) && (e instanceof Ia || e instanceof Ra) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
|
|
15015
15015
|
}
|
|
15016
15016
|
|
|
15017
15017
|
/**
|
|
@@ -15022,8 +15022,8 @@ function vc(t, e, ...n) {
|
|
|
15022
15022
|
* @param right - A `Query` to compare.
|
|
15023
15023
|
* @returns true if the references point to the same location in the same
|
|
15024
15024
|
* Firestore database.
|
|
15025
|
-
*/ function
|
|
15026
|
-
return t = y(t), e = y(e), t instanceof
|
|
15025
|
+
*/ function Sa(t, e) {
|
|
15026
|
+
return t = y(t), e = y(e), t instanceof Aa && e instanceof Aa && (t.firestore === e.firestore && Ae(t._query, e._query) && t.converter === e.converter);
|
|
15027
15027
|
}
|
|
15028
15028
|
|
|
15029
15029
|
/**
|
|
@@ -15041,42 +15041,42 @@ function vc(t, e, ...n) {
|
|
|
15041
15041
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15042
15042
|
* See the License for the specific language governing permissions and
|
|
15043
15043
|
* limitations under the License.
|
|
15044
|
-
*/ class
|
|
15044
|
+
*/ class Da {
|
|
15045
15045
|
constructor() {
|
|
15046
15046
|
// The last promise in the queue.
|
|
15047
|
-
this.
|
|
15047
|
+
this.fc = Promise.resolve(),
|
|
15048
15048
|
// A list of retryable operations. Retryable operations are run in order and
|
|
15049
15049
|
// retried with backoff.
|
|
15050
|
-
this.
|
|
15050
|
+
this.dc = [],
|
|
15051
15051
|
// Is this AsyncQueue being shut down? Once it is set to true, it will not
|
|
15052
15052
|
// be changed again.
|
|
15053
|
-
this.
|
|
15053
|
+
this.wc = !1,
|
|
15054
15054
|
// Operations scheduled to be queued in the future. Operations are
|
|
15055
15055
|
// automatically removed after they are run or canceled.
|
|
15056
|
-
this.
|
|
15056
|
+
this._c = [],
|
|
15057
15057
|
// visible for testing
|
|
15058
|
-
this.
|
|
15058
|
+
this.mc = null,
|
|
15059
15059
|
// Flag set while there's an outstanding AsyncQueue operation, used for
|
|
15060
15060
|
// assertion sanity-checks.
|
|
15061
|
-
this.
|
|
15061
|
+
this.gc = !1,
|
|
15062
15062
|
// Enabled during shutdown on Safari to prevent future access to IndexedDB.
|
|
15063
|
-
this.
|
|
15063
|
+
this.yc = !1,
|
|
15064
15064
|
// List of TimerIds to fast-forward delays for.
|
|
15065
|
-
this.
|
|
15065
|
+
this.Ec = [],
|
|
15066
15066
|
// Backoff timer used to schedule retries for retryable operations
|
|
15067
15067
|
this.rr = new Xr(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
15068
15068
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
15069
15069
|
// operations. Meant to speed up recovery when we regain file system access
|
|
15070
15070
|
// after page comes into foreground.
|
|
15071
|
-
this.
|
|
15071
|
+
this.Tc = () => {
|
|
15072
15072
|
const t = Jr();
|
|
15073
15073
|
t && k("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.rr.tr();
|
|
15074
15074
|
};
|
|
15075
15075
|
const t = Jr();
|
|
15076
|
-
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.
|
|
15076
|
+
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Tc);
|
|
15077
15077
|
}
|
|
15078
15078
|
get isShuttingDown() {
|
|
15079
|
-
return this.
|
|
15079
|
+
return this.wc;
|
|
15080
15080
|
}
|
|
15081
15081
|
/**
|
|
15082
15082
|
* Adds a new operation to the queue without waiting for it to complete (i.e.
|
|
@@ -15086,44 +15086,44 @@ function vc(t, e, ...n) {
|
|
|
15086
15086
|
this.enqueue(t);
|
|
15087
15087
|
}
|
|
15088
15088
|
enqueueAndForgetEvenWhileRestricted(t) {
|
|
15089
|
-
this.
|
|
15089
|
+
this.Ic(),
|
|
15090
15090
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
15091
|
-
this.
|
|
15091
|
+
this.Ac(t);
|
|
15092
15092
|
}
|
|
15093
15093
|
enterRestrictedMode(t) {
|
|
15094
|
-
if (!this.
|
|
15095
|
-
this.
|
|
15094
|
+
if (!this.wc) {
|
|
15095
|
+
this.wc = !0, this.yc = t || !1;
|
|
15096
15096
|
const e = Jr();
|
|
15097
|
-
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.
|
|
15097
|
+
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Tc);
|
|
15098
15098
|
}
|
|
15099
15099
|
}
|
|
15100
15100
|
enqueue(t) {
|
|
15101
|
-
if (this.
|
|
15101
|
+
if (this.Ic(), this.wc)
|
|
15102
15102
|
// Return a Promise which never resolves.
|
|
15103
15103
|
return new Promise((() => {}));
|
|
15104
15104
|
// Create a deferred Promise that we can return to the callee. This
|
|
15105
15105
|
// allows us to return a "hanging Promise" only to the callee and still
|
|
15106
15106
|
// advance the queue even when the operation is not run.
|
|
15107
15107
|
const e = new j;
|
|
15108
|
-
return this.
|
|
15108
|
+
return this.Ac((() => this.wc && this.yc ? Promise.resolve() : (t().then(e.resolve, e.reject),
|
|
15109
15109
|
e.promise))).then((() => e.promise));
|
|
15110
15110
|
}
|
|
15111
15111
|
enqueueRetryable(t) {
|
|
15112
|
-
this.enqueueAndForget((() => (this.
|
|
15112
|
+
this.enqueueAndForget((() => (this.dc.push(t), this.Rc())));
|
|
15113
15113
|
}
|
|
15114
15114
|
/**
|
|
15115
15115
|
* Runs the next operation from the retryable queue. If the operation fails,
|
|
15116
15116
|
* reschedules with backoff.
|
|
15117
|
-
*/ async
|
|
15118
|
-
if (0 !== this.
|
|
15117
|
+
*/ async Rc() {
|
|
15118
|
+
if (0 !== this.dc.length) {
|
|
15119
15119
|
try {
|
|
15120
|
-
await this.
|
|
15120
|
+
await this.dc[0](), this.dc.shift(), this.rr.reset();
|
|
15121
15121
|
} catch (t) {
|
|
15122
15122
|
if (!Hs(t)) throw t;
|
|
15123
15123
|
// Failure will be handled by AsyncQueue
|
|
15124
15124
|
k("AsyncQueue", "Operation failed with retryable error: " + t);
|
|
15125
15125
|
}
|
|
15126
|
-
this.
|
|
15126
|
+
this.dc.length > 0 &&
|
|
15127
15127
|
// If there are additional operations, we re-schedule `retryNextOp()`.
|
|
15128
15128
|
// This is necessary to run retryable operations that failed during
|
|
15129
15129
|
// their initial attempt since we don't know whether they are already
|
|
@@ -15134,12 +15134,12 @@ function vc(t, e, ...n) {
|
|
|
15134
15134
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
15135
15135
|
// new backoff on every call, there is only ever a single additional
|
|
15136
15136
|
// operation in the queue.
|
|
15137
|
-
this.rr.Xi((() => this.
|
|
15137
|
+
this.rr.Xi((() => this.Rc()));
|
|
15138
15138
|
}
|
|
15139
15139
|
}
|
|
15140
|
-
|
|
15141
|
-
const e = this.
|
|
15142
|
-
this.
|
|
15140
|
+
Ac(t) {
|
|
15141
|
+
const e = this.fc.then((() => (this.gc = !0, t().catch((t => {
|
|
15142
|
+
this.mc = t, this.gc = !1;
|
|
15143
15143
|
// Re-throw the error so that this.tail becomes a rejected Promise and
|
|
15144
15144
|
// all further attempts to chain (via .then) will just short-circuit
|
|
15145
15145
|
// and return the rejected Promise.
|
|
@@ -15170,38 +15170,38 @@ function vc(t, e, ...n) {
|
|
|
15170
15170
|
* See the License for the specific language governing permissions and
|
|
15171
15171
|
* limitations under the License.
|
|
15172
15172
|
*/ (t)), t;
|
|
15173
|
-
})).then((t => (this.
|
|
15174
|
-
return this.
|
|
15173
|
+
})).then((t => (this.gc = !1, t))))));
|
|
15174
|
+
return this.fc = e, e;
|
|
15175
15175
|
}
|
|
15176
15176
|
enqueueAfterDelay(t, e, n) {
|
|
15177
|
-
this.
|
|
15177
|
+
this.Ic(),
|
|
15178
15178
|
// Fast-forward delays for timerIds that have been overriden.
|
|
15179
|
-
this.
|
|
15180
|
-
const s = xo.createAndSchedule(this, t, e, n, (t => this.
|
|
15181
|
-
return this.
|
|
15179
|
+
this.Ec.indexOf(t) > -1 && (e = 0);
|
|
15180
|
+
const s = xo.createAndSchedule(this, t, e, n, (t => this.bc(t)));
|
|
15181
|
+
return this._c.push(s), s;
|
|
15182
15182
|
}
|
|
15183
|
-
|
|
15184
|
-
this.
|
|
15183
|
+
Ic() {
|
|
15184
|
+
this.mc && M();
|
|
15185
15185
|
}
|
|
15186
15186
|
verifyOperationInProgress() {}
|
|
15187
15187
|
/**
|
|
15188
15188
|
* Waits until all currently queued tasks are finished executing. Delayed
|
|
15189
15189
|
* operations are not run.
|
|
15190
|
-
*/ async
|
|
15190
|
+
*/ async Pc() {
|
|
15191
15191
|
// Operations in the queue prior to draining may have enqueued additional
|
|
15192
15192
|
// operations. Keep draining the queue until the tail is no longer advanced,
|
|
15193
15193
|
// which indicates that no more new operations were enqueued and that all
|
|
15194
15194
|
// operations were executed.
|
|
15195
15195
|
let t;
|
|
15196
15196
|
do {
|
|
15197
|
-
t = this.
|
|
15198
|
-
} while (t !== this.
|
|
15197
|
+
t = this.fc, await t;
|
|
15198
|
+
} while (t !== this.fc);
|
|
15199
15199
|
}
|
|
15200
15200
|
/**
|
|
15201
15201
|
* For Tests: Determine if a delayed operation with a particular TimerId
|
|
15202
15202
|
* exists.
|
|
15203
|
-
*/
|
|
15204
|
-
for (const e of this.
|
|
15203
|
+
*/ vc(t) {
|
|
15204
|
+
for (const e of this._c) if (e.timerId === t) return !0;
|
|
15205
15205
|
return !1;
|
|
15206
15206
|
}
|
|
15207
15207
|
/**
|
|
@@ -15210,28 +15210,28 @@ function vc(t, e, ...n) {
|
|
|
15210
15210
|
* @param lastTimerId - Delayed operations up to and including this TimerId
|
|
15211
15211
|
* will be drained. Pass TimerId.All to run all delayed operations.
|
|
15212
15212
|
* @returns a Promise that resolves once all operations have been run.
|
|
15213
|
-
*/
|
|
15213
|
+
*/ Vc(t) {
|
|
15214
15214
|
// Note that draining may generate more delayed ops, so we do that first.
|
|
15215
|
-
return this.
|
|
15215
|
+
return this.Pc().then((() => {
|
|
15216
15216
|
// Run ops in the same order they'd run if they ran naturally.
|
|
15217
|
-
this.
|
|
15218
|
-
for (const e of this.
|
|
15219
|
-
return this.
|
|
15217
|
+
this._c.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
|
|
15218
|
+
for (const e of this._c) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
|
|
15219
|
+
return this.Pc();
|
|
15220
15220
|
}));
|
|
15221
15221
|
}
|
|
15222
15222
|
/**
|
|
15223
15223
|
* For Tests: Skip all subsequent delays for a timer id.
|
|
15224
|
-
*/
|
|
15225
|
-
this.
|
|
15224
|
+
*/ Sc(t) {
|
|
15225
|
+
this.Ec.push(t);
|
|
15226
15226
|
}
|
|
15227
|
-
/** Called once a DelayedOperation is run or canceled. */
|
|
15227
|
+
/** Called once a DelayedOperation is run or canceled. */ bc(t) {
|
|
15228
15228
|
// NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
|
|
15229
|
-
const e = this.
|
|
15230
|
-
this.
|
|
15229
|
+
const e = this._c.indexOf(t);
|
|
15230
|
+
this._c.splice(e, 1);
|
|
15231
15231
|
}
|
|
15232
15232
|
}
|
|
15233
15233
|
|
|
15234
|
-
function
|
|
15234
|
+
function Ca(t) {
|
|
15235
15235
|
/**
|
|
15236
15236
|
* Returns true if obj is an object and contains at least one of the specified
|
|
15237
15237
|
* methods.
|
|
@@ -15266,7 +15266,7 @@ function Cc(t) {
|
|
|
15266
15266
|
*/ (t, [ "next", "error", "complete" ]);
|
|
15267
15267
|
}
|
|
15268
15268
|
|
|
15269
|
-
class
|
|
15269
|
+
class Na {
|
|
15270
15270
|
constructor() {
|
|
15271
15271
|
this._progressObserver = {}, this._taskCompletionResolver = new j, this._lastProgress = {
|
|
15272
15272
|
taskState: "Running",
|
|
@@ -15350,27 +15350,27 @@ class Nc {
|
|
|
15350
15350
|
* See the License for the specific language governing permissions and
|
|
15351
15351
|
* limitations under the License.
|
|
15352
15352
|
*/
|
|
15353
|
-
/** DOMException error code constants. */ const
|
|
15353
|
+
/** DOMException error code constants. */ const xa = -1;
|
|
15354
15354
|
|
|
15355
15355
|
/**
|
|
15356
15356
|
* The Cloud Firestore service interface.
|
|
15357
15357
|
*
|
|
15358
15358
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
15359
15359
|
*/
|
|
15360
|
-
class
|
|
15360
|
+
class ka extends Ea {
|
|
15361
15361
|
/** @hideconstructor */
|
|
15362
15362
|
constructor(t, e) {
|
|
15363
15363
|
super(t, e),
|
|
15364
15364
|
/**
|
|
15365
15365
|
* Whether it's a {@link Firestore} or Firestore Lite instance.
|
|
15366
15366
|
*/
|
|
15367
|
-
this.type = "firestore", this._queue = new
|
|
15367
|
+
this.type = "firestore", this._queue = new Da, this._persistenceKey = "name" in t ? t.name : "[DEFAULT]";
|
|
15368
15368
|
}
|
|
15369
15369
|
_terminate() {
|
|
15370
15370
|
return this._firestoreClient ||
|
|
15371
15371
|
// The client must be initialized to ensure that all subsequent API
|
|
15372
15372
|
// usage throws an exception.
|
|
15373
|
-
|
|
15373
|
+
Ma(this), this._firestoreClient.terminate();
|
|
15374
15374
|
}
|
|
15375
15375
|
}
|
|
15376
15376
|
|
|
@@ -15384,7 +15384,7 @@ class kc extends Ec {
|
|
|
15384
15384
|
* be associated.
|
|
15385
15385
|
* @param settings - A settings object to configure the {@link Firestore} instance.
|
|
15386
15386
|
* @returns A newly initialized {@link Firestore} instance.
|
|
15387
|
-
*/ function $
|
|
15387
|
+
*/ function $a(t, e) {
|
|
15388
15388
|
const n = _getProvider(t, "firestore");
|
|
15389
15389
|
if (n.isInitialized()) {
|
|
15390
15390
|
const t = n.getImmediate(), s = n.getOptions();
|
|
@@ -15405,22 +15405,22 @@ class kc extends Ec {
|
|
|
15405
15405
|
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
|
|
15406
15406
|
* instance is associated with.
|
|
15407
15407
|
* @returns The {@link Firestore} instance of the provided app.
|
|
15408
|
-
*/ function
|
|
15408
|
+
*/ function Oa(e = t()) {
|
|
15409
15409
|
return _getProvider(e, "firestore").getImmediate();
|
|
15410
15410
|
}
|
|
15411
15411
|
|
|
15412
15412
|
/**
|
|
15413
15413
|
* @internal
|
|
15414
|
-
*/ function
|
|
15415
|
-
return t._firestoreClient ||
|
|
15414
|
+
*/ function Fa(t) {
|
|
15415
|
+
return t._firestoreClient || Ma(t), t._firestoreClient.verifyNotTerminated(), t._firestoreClient;
|
|
15416
15416
|
}
|
|
15417
15417
|
|
|
15418
|
-
function
|
|
15418
|
+
function Ma(t) {
|
|
15419
15419
|
var e;
|
|
15420
15420
|
const n = t._freezeSettings(), s = function(t, e, n, s) {
|
|
15421
|
-
return new
|
|
15421
|
+
return new ua(t, e, n, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams);
|
|
15422
15422
|
}(t._databaseId, (null === (e = t._app) || void 0 === e ? void 0 : e.options.appId) || "", t._persistenceKey, n);
|
|
15423
|
-
t._firestoreClient = new
|
|
15423
|
+
t._firestoreClient = new Kc(t._credentials, t._queue, s);
|
|
15424
15424
|
}
|
|
15425
15425
|
|
|
15426
15426
|
/**
|
|
@@ -15445,10 +15445,10 @@ function Mc(t) {
|
|
|
15445
15445
|
* @param persistenceSettings - Optional settings object to configure
|
|
15446
15446
|
* persistence.
|
|
15447
15447
|
* @returns A `Promise` that represents successfully enabling persistent storage.
|
|
15448
|
-
*/ function
|
|
15449
|
-
|
|
15450
|
-
const n =
|
|
15451
|
-
return
|
|
15448
|
+
*/ function La(t, e) {
|
|
15449
|
+
Ha(t = ga(t, ka));
|
|
15450
|
+
const n = Fa(t), s = t._freezeSettings(), i = new Fc;
|
|
15451
|
+
return Ua(n, i, new $c(i, s.cacheSizeBytes, null == e ? void 0 : e.forceOwnership));
|
|
15452
15452
|
}
|
|
15453
15453
|
|
|
15454
15454
|
/**
|
|
@@ -15472,10 +15472,10 @@ function Mc(t) {
|
|
|
15472
15472
|
* @param firestore - The {@link Firestore} instance to enable persistence for.
|
|
15473
15473
|
* @returns A `Promise` that represents successfully enabling persistent
|
|
15474
15474
|
* storage.
|
|
15475
|
-
*/ function
|
|
15476
|
-
|
|
15477
|
-
const e =
|
|
15478
|
-
return
|
|
15475
|
+
*/ function Ba(t) {
|
|
15476
|
+
Ha(t = ga(t, ka));
|
|
15477
|
+
const e = Fa(t), n = t._freezeSettings(), s = new Fc;
|
|
15478
|
+
return Ua(e, s, new Oc(s, n.cacheSizeBytes));
|
|
15479
15479
|
}
|
|
15480
15480
|
|
|
15481
15481
|
/**
|
|
@@ -15483,11 +15483,11 @@ function Mc(t) {
|
|
|
15483
15483
|
* If the operation fails with a recoverable error (see
|
|
15484
15484
|
* `canRecoverFromIndexedDbError()` below), the returned Promise is rejected
|
|
15485
15485
|
* but the client remains usable.
|
|
15486
|
-
*/ function
|
|
15486
|
+
*/ function Ua(t, e, n) {
|
|
15487
15487
|
const s = new j;
|
|
15488
15488
|
return t.asyncQueue.enqueue((async () => {
|
|
15489
15489
|
try {
|
|
15490
|
-
await
|
|
15490
|
+
await jc(t, n), await Qc(t, e), s.resolve();
|
|
15491
15491
|
} catch (t) {
|
|
15492
15492
|
if (!
|
|
15493
15493
|
/**
|
|
@@ -15541,7 +15541,7 @@ function Mc(t) {
|
|
|
15541
15541
|
})).then((() => s.promise));
|
|
15542
15542
|
}
|
|
15543
15543
|
|
|
15544
|
-
function
|
|
15544
|
+
function qa(t) {
|
|
15545
15545
|
if (t._initialized && !t._terminated) throw new K(q.FAILED_PRECONDITION, "Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");
|
|
15546
15546
|
const e = new j;
|
|
15547
15547
|
return t._queue.enqueueAndForgetEvenWhileRestricted((async () => {
|
|
@@ -15572,11 +15572,11 @@ function qc(t) {
|
|
|
15572
15572
|
*
|
|
15573
15573
|
* @returns A `Promise` which resolves when all currently pending writes have been
|
|
15574
15574
|
* acknowledged by the backend.
|
|
15575
|
-
*/ function
|
|
15575
|
+
*/ function Ka(t) {
|
|
15576
15576
|
return function(t) {
|
|
15577
15577
|
const e = new j;
|
|
15578
|
-
return t.asyncQueue.enqueueAndForget((async () =>
|
|
15579
|
-
}(
|
|
15578
|
+
return t.asyncQueue.enqueueAndForget((async () => lc(await Yc(t), e))), e.promise;
|
|
15579
|
+
}(Fa(t = ga(t, ka)));
|
|
15580
15580
|
}
|
|
15581
15581
|
|
|
15582
15582
|
/**
|
|
@@ -15584,8 +15584,8 @@ function qc(t) {
|
|
|
15584
15584
|
* call to {@link disableNetwork}.
|
|
15585
15585
|
*
|
|
15586
15586
|
* @returns A `Promise` that is resolved once the network has been enabled.
|
|
15587
|
-
*/ function
|
|
15588
|
-
return
|
|
15587
|
+
*/ function ja(t) {
|
|
15588
|
+
return Zc(Fa(t = ga(t, ka)));
|
|
15589
15589
|
}
|
|
15590
15590
|
|
|
15591
15591
|
/**
|
|
@@ -15595,8 +15595,8 @@ function qc(t) {
|
|
|
15595
15595
|
* operations will be queued until the network is restored.
|
|
15596
15596
|
*
|
|
15597
15597
|
* @returns A `Promise` that is resolved once the network has been disabled.
|
|
15598
|
-
*/ function
|
|
15599
|
-
return
|
|
15598
|
+
*/ function Qa(t) {
|
|
15599
|
+
return ta(Fa(t = ga(t, ka)));
|
|
15600
15600
|
}
|
|
15601
15601
|
|
|
15602
15602
|
/**
|
|
@@ -15620,7 +15620,7 @@ function qc(t) {
|
|
|
15620
15620
|
*
|
|
15621
15621
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
15622
15622
|
* terminated.
|
|
15623
|
-
*/ function
|
|
15623
|
+
*/ function Wa(t) {
|
|
15624
15624
|
return e(t.app, "firestore"), t._delete();
|
|
15625
15625
|
}
|
|
15626
15626
|
|
|
@@ -15634,9 +15634,9 @@ function qc(t) {
|
|
|
15634
15634
|
* @returns
|
|
15635
15635
|
* A `LoadBundleTask` object, which notifies callers with progress updates, and completion
|
|
15636
15636
|
* or error events. It can be used as a `Promise<LoadBundleTaskProgress>`.
|
|
15637
|
-
*/ function
|
|
15638
|
-
const n =
|
|
15639
|
-
return
|
|
15637
|
+
*/ function Ga(t, e) {
|
|
15638
|
+
const n = Fa(t = ga(t, ka)), s = new Na;
|
|
15639
|
+
return ca(n, t._databaseId, e, s), s;
|
|
15640
15640
|
}
|
|
15641
15641
|
|
|
15642
15642
|
/**
|
|
@@ -15645,11 +15645,11 @@ function qc(t) {
|
|
|
15645
15645
|
* The named queries are packaged into bundles on the server side (along
|
|
15646
15646
|
* with resulting documents), and loaded to local cache using `loadBundle`. Once in local
|
|
15647
15647
|
* cache, use this method to extract a {@link Query} by name.
|
|
15648
|
-
*/ function
|
|
15649
|
-
return
|
|
15648
|
+
*/ function za(t, e) {
|
|
15649
|
+
return aa(Fa(t = ga(t, ka)), e).then((e => e ? new Aa(t, null, e.query) : null));
|
|
15650
15650
|
}
|
|
15651
15651
|
|
|
15652
|
-
function
|
|
15652
|
+
function Ha(t) {
|
|
15653
15653
|
if (t._initialized || t._terminated) throw new K(q.FAILED_PRECONDITION, "Firestore has already been started and persistence can no longer be enabled. You can only enable persistence before calling any other methods on a Firestore object.");
|
|
15654
15654
|
}
|
|
15655
15655
|
|
|
@@ -15693,7 +15693,7 @@ function Hc(t) {
|
|
|
15693
15693
|
* Create a `FieldPath` by providing field names. If more than one field
|
|
15694
15694
|
* name is provided, the path will point to a nested field in a document.
|
|
15695
15695
|
*/
|
|
15696
|
-
class
|
|
15696
|
+
class Ja {
|
|
15697
15697
|
/**
|
|
15698
15698
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
15699
15699
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -15717,8 +15717,8 @@ class Jc {
|
|
|
15717
15717
|
/**
|
|
15718
15718
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
15719
15719
|
* It can be used in queries to sort or filter by the document ID.
|
|
15720
|
-
*/ function
|
|
15721
|
-
return new
|
|
15720
|
+
*/ function Ya() {
|
|
15721
|
+
return new Ja("__name__");
|
|
15722
15722
|
}
|
|
15723
15723
|
|
|
15724
15724
|
/**
|
|
@@ -15739,7 +15739,7 @@ class Jc {
|
|
|
15739
15739
|
*/
|
|
15740
15740
|
/**
|
|
15741
15741
|
* An immutable object representing an array of bytes.
|
|
15742
|
-
*/ class
|
|
15742
|
+
*/ class Xa {
|
|
15743
15743
|
/** @hideconstructor */
|
|
15744
15744
|
constructor(t) {
|
|
15745
15745
|
this._byteString = t;
|
|
@@ -15751,7 +15751,7 @@ class Jc {
|
|
|
15751
15751
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
15752
15752
|
*/ static fromBase64String(t) {
|
|
15753
15753
|
try {
|
|
15754
|
-
return new
|
|
15754
|
+
return new Xa(_t.fromBase64String(t));
|
|
15755
15755
|
} catch (t) {
|
|
15756
15756
|
throw new K(q.INVALID_ARGUMENT, "Failed to construct data from Base64 string: " + t);
|
|
15757
15757
|
}
|
|
@@ -15761,7 +15761,7 @@ class Jc {
|
|
|
15761
15761
|
*
|
|
15762
15762
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
15763
15763
|
*/ static fromUint8Array(t) {
|
|
15764
|
-
return new
|
|
15764
|
+
return new Xa(_t.fromUint8Array(t));
|
|
15765
15765
|
}
|
|
15766
15766
|
/**
|
|
15767
15767
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -15813,7 +15813,7 @@ class Jc {
|
|
|
15813
15813
|
/**
|
|
15814
15814
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
15815
15815
|
* or `update()`.
|
|
15816
|
-
*/ class
|
|
15816
|
+
*/ class Za {
|
|
15817
15817
|
/**
|
|
15818
15818
|
* @param _methodName - The public API endpoint that returns this class.
|
|
15819
15819
|
* @hideconstructor
|
|
@@ -15967,55 +15967,55 @@ function iu(t) {
|
|
|
15967
15967
|
this.settings = t, this.databaseId = e, this.N = n, this.ignoreUndefinedProperties = s,
|
|
15968
15968
|
// Minor hack: If fieldTransforms is undefined, we assume this is an
|
|
15969
15969
|
// external call and we need to validate the entire path.
|
|
15970
|
-
void 0 === i && this.
|
|
15970
|
+
void 0 === i && this.Dc(), this.fieldTransforms = i || [], this.fieldMask = r || [];
|
|
15971
15971
|
}
|
|
15972
15972
|
get path() {
|
|
15973
15973
|
return this.settings.path;
|
|
15974
15974
|
}
|
|
15975
|
-
get
|
|
15976
|
-
return this.settings.
|
|
15975
|
+
get Cc() {
|
|
15976
|
+
return this.settings.Cc;
|
|
15977
15977
|
}
|
|
15978
|
-
/** Returns a new context with the specified settings overwritten. */
|
|
15978
|
+
/** Returns a new context with the specified settings overwritten. */ Nc(t) {
|
|
15979
15979
|
return new ru(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.N, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
15980
15980
|
}
|
|
15981
|
-
|
|
15981
|
+
xc(t) {
|
|
15982
15982
|
var e;
|
|
15983
|
-
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.
|
|
15983
|
+
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.Nc({
|
|
15984
15984
|
path: n,
|
|
15985
|
-
|
|
15985
|
+
kc: !1
|
|
15986
15986
|
});
|
|
15987
|
-
return s
|
|
15987
|
+
return s.$c(t), s;
|
|
15988
15988
|
}
|
|
15989
|
-
|
|
15989
|
+
Oc(t) {
|
|
15990
15990
|
var e;
|
|
15991
|
-
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.
|
|
15991
|
+
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.Nc({
|
|
15992
15992
|
path: n,
|
|
15993
|
-
|
|
15993
|
+
kc: !1
|
|
15994
15994
|
});
|
|
15995
|
-
return s.
|
|
15995
|
+
return s.Dc(), s;
|
|
15996
15996
|
}
|
|
15997
|
-
|
|
15997
|
+
Fc(t) {
|
|
15998
15998
|
// TODO(b/34871131): We don't support array paths right now; so make path
|
|
15999
15999
|
// undefined.
|
|
16000
|
-
return this.
|
|
16000
|
+
return this.Nc({
|
|
16001
16001
|
path: void 0,
|
|
16002
|
-
|
|
16002
|
+
kc: !0
|
|
16003
16003
|
});
|
|
16004
16004
|
}
|
|
16005
|
-
|
|
16006
|
-
return bu(t, this.settings.methodName, this.settings.
|
|
16005
|
+
Mc(t) {
|
|
16006
|
+
return bu(t, this.settings.methodName, this.settings.Lc || !1, this.path, this.settings.Bc);
|
|
16007
16007
|
}
|
|
16008
16008
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
16009
16009
|
return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
|
|
16010
16010
|
}
|
|
16011
|
-
|
|
16011
|
+
Dc() {
|
|
16012
16012
|
// TODO(b/34871131): Remove null check once we have proper paths for fields
|
|
16013
16013
|
// within arrays.
|
|
16014
|
-
if (this.path) for (let t = 0; t < this.path.length; t++) this
|
|
16014
|
+
if (this.path) for (let t = 0; t < this.path.length; t++) this.$c(this.path.get(t));
|
|
16015
16015
|
}
|
|
16016
|
-
|
|
16017
|
-
if (0 === t.length) throw this.
|
|
16018
|
-
if (iu(this.
|
|
16016
|
+
$c(t) {
|
|
16017
|
+
if (0 === t.length) throw this.Mc("Document fields must not be empty");
|
|
16018
|
+
if (iu(this.Cc) && eu.test(t)) throw this.Mc('Document fields cannot begin and end with "__"');
|
|
16019
16019
|
}
|
|
16020
16020
|
}
|
|
16021
16021
|
|
|
@@ -16026,43 +16026,43 @@ function iu(t) {
|
|
|
16026
16026
|
constructor(t, e, n) {
|
|
16027
16027
|
this.databaseId = t, this.ignoreUndefinedProperties = e, this.N = n || Yr(t);
|
|
16028
16028
|
}
|
|
16029
|
-
/** Creates a new top-level parse context. */
|
|
16029
|
+
/** Creates a new top-level parse context. */ Uc(t, e, n, s = !1) {
|
|
16030
16030
|
return new ru({
|
|
16031
|
-
|
|
16031
|
+
Cc: t,
|
|
16032
16032
|
methodName: e,
|
|
16033
|
-
|
|
16033
|
+
Bc: n,
|
|
16034
16034
|
path: lt.emptyPath(),
|
|
16035
|
-
|
|
16036
|
-
|
|
16035
|
+
kc: !1,
|
|
16036
|
+
Lc: s
|
|
16037
16037
|
}, this.databaseId, this.N, this.ignoreUndefinedProperties);
|
|
16038
16038
|
}
|
|
16039
16039
|
}
|
|
16040
16040
|
|
|
16041
|
-
function
|
|
16041
|
+
function cu(t) {
|
|
16042
16042
|
const e = t._freezeSettings(), n = Yr(t._databaseId);
|
|
16043
16043
|
return new ou(t._databaseId, !!e.ignoreUndefinedProperties, n);
|
|
16044
16044
|
}
|
|
16045
16045
|
|
|
16046
|
-
/** Parse document data from a set() call. */ function
|
|
16047
|
-
const o = t.
|
|
16046
|
+
/** Parse document data from a set() call. */ function au(t, e, n, s, i, r = {}) {
|
|
16047
|
+
const o = t.Uc(r.merge || r.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
|
|
16048
16048
|
Tu("Data must be an object, but it was:", o, s);
|
|
16049
|
-
const
|
|
16050
|
-
let
|
|
16051
|
-
if (r.merge)
|
|
16049
|
+
const c = pu(s, o);
|
|
16050
|
+
let a, u;
|
|
16051
|
+
if (r.merge) a = new ft(o.fieldMask), u = o.fieldTransforms; else if (r.mergeFields) {
|
|
16052
16052
|
const t = [];
|
|
16053
16053
|
for (const s of r.mergeFields) {
|
|
16054
16054
|
const i = Iu(e, s, n);
|
|
16055
16055
|
if (!o.contains(i)) throw new K(q.INVALID_ARGUMENT, `Field '${i}' is specified in your field mask but missing from your input data.`);
|
|
16056
16056
|
Pu(t, i) || t.push(i);
|
|
16057
16057
|
}
|
|
16058
|
-
|
|
16059
|
-
} else
|
|
16060
|
-
return new nu(new Ut(
|
|
16058
|
+
a = new ft(t), u = o.fieldTransforms.filter((t => a.covers(t.field)));
|
|
16059
|
+
} else a = null, u = o.fieldTransforms;
|
|
16060
|
+
return new nu(new Ut(c), a, u);
|
|
16061
16061
|
}
|
|
16062
16062
|
|
|
16063
|
-
class uu extends
|
|
16063
|
+
class uu extends Za {
|
|
16064
16064
|
_toFieldTransform(t) {
|
|
16065
|
-
if (2 /* MergeSet */ !== t.
|
|
16065
|
+
if (2 /* MergeSet */ !== t.Cc) throw 1 /* Update */ === t.Cc ? t.Mc(`${this._methodName}() can only appear at the top level of your update data`) : t.Mc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
|
|
16066
16066
|
// No transform to add for a delete, but we need to add it to our
|
|
16067
16067
|
// fieldMask so it gets deleted.
|
|
16068
16068
|
return t.fieldMask.push(t.path), null;
|
|
@@ -16089,14 +16089,14 @@ class uu extends Zc {
|
|
|
16089
16089
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
16090
16090
|
*/ function hu(t, e, n) {
|
|
16091
16091
|
return new ru({
|
|
16092
|
-
|
|
16093
|
-
|
|
16092
|
+
Cc: 3 /* Argument */ ,
|
|
16093
|
+
Bc: e.settings.Bc,
|
|
16094
16094
|
methodName: t._methodName,
|
|
16095
|
-
|
|
16095
|
+
kc: n
|
|
16096
16096
|
}, e.databaseId, e.N, e.ignoreUndefinedProperties);
|
|
16097
16097
|
}
|
|
16098
16098
|
|
|
16099
|
-
class lu extends
|
|
16099
|
+
class lu extends Za {
|
|
16100
16100
|
_toFieldTransform(t) {
|
|
16101
16101
|
return new je(t.path, new Oe);
|
|
16102
16102
|
}
|
|
@@ -16105,13 +16105,13 @@ class lu extends Zc {
|
|
|
16105
16105
|
}
|
|
16106
16106
|
}
|
|
16107
16107
|
|
|
16108
|
-
class fu extends
|
|
16108
|
+
class fu extends Za {
|
|
16109
16109
|
constructor(t, e) {
|
|
16110
|
-
super(t), this.
|
|
16110
|
+
super(t), this.qc = e;
|
|
16111
16111
|
}
|
|
16112
16112
|
_toFieldTransform(t) {
|
|
16113
16113
|
const e = hu(this, t,
|
|
16114
|
-
/*array=*/ !0), n = this.
|
|
16114
|
+
/*array=*/ !0), n = this.qc.map((t => yu(t, e))), s = new Fe(n);
|
|
16115
16115
|
return new je(t.path, s);
|
|
16116
16116
|
}
|
|
16117
16117
|
isEqual(t) {
|
|
@@ -16120,13 +16120,13 @@ class fu extends Zc {
|
|
|
16120
16120
|
}
|
|
16121
16121
|
}
|
|
16122
16122
|
|
|
16123
|
-
class du extends
|
|
16123
|
+
class du extends Za {
|
|
16124
16124
|
constructor(t, e) {
|
|
16125
|
-
super(t), this.
|
|
16125
|
+
super(t), this.qc = e;
|
|
16126
16126
|
}
|
|
16127
16127
|
_toFieldTransform(t) {
|
|
16128
16128
|
const e = hu(this, t,
|
|
16129
|
-
/*array=*/ !0), n = this.
|
|
16129
|
+
/*array=*/ !0), n = this.qc.map((t => yu(t, e))), s = new Le(n);
|
|
16130
16130
|
return new je(t.path, s);
|
|
16131
16131
|
}
|
|
16132
16132
|
isEqual(t) {
|
|
@@ -16135,12 +16135,12 @@ class du extends Zc {
|
|
|
16135
16135
|
}
|
|
16136
16136
|
}
|
|
16137
16137
|
|
|
16138
|
-
class wu extends
|
|
16138
|
+
class wu extends Za {
|
|
16139
16139
|
constructor(t, e) {
|
|
16140
|
-
super(t), this.
|
|
16140
|
+
super(t), this.Kc = e;
|
|
16141
16141
|
}
|
|
16142
16142
|
_toFieldTransform(t) {
|
|
16143
|
-
const e = new Ue(t.N, Ce(t.N, this.
|
|
16143
|
+
const e = new Ue(t.N, Ce(t.N, this.Kc));
|
|
16144
16144
|
return new je(t.path, e);
|
|
16145
16145
|
}
|
|
16146
16146
|
isEqual(t) {
|
|
@@ -16150,40 +16150,40 @@ class wu extends Zc {
|
|
|
16150
16150
|
}
|
|
16151
16151
|
|
|
16152
16152
|
/** Parse update data from an update() call. */ function _u(t, e, n, s) {
|
|
16153
|
-
const i = t.
|
|
16153
|
+
const i = t.Uc(1 /* Update */ , e, n);
|
|
16154
16154
|
Tu("Data must be an object, but it was:", i, s);
|
|
16155
16155
|
const r = [], o = Ut.empty();
|
|
16156
16156
|
ot(s, ((t, s) => {
|
|
16157
|
-
const
|
|
16157
|
+
const c = Ru(e, t, n);
|
|
16158
16158
|
// For Compat types, we have to "extract" the underlying types before
|
|
16159
16159
|
// performing validation.
|
|
16160
16160
|
s = y(s);
|
|
16161
|
-
const
|
|
16161
|
+
const a = i.Oc(c);
|
|
16162
16162
|
if (s instanceof uu)
|
|
16163
16163
|
// Add it to the field mask, but don't add anything to updateData.
|
|
16164
|
-
r.push(
|
|
16165
|
-
const t = yu(s,
|
|
16166
|
-
null != t && (r.push(
|
|
16164
|
+
r.push(c); else {
|
|
16165
|
+
const t = yu(s, a);
|
|
16166
|
+
null != t && (r.push(c), o.set(c, t));
|
|
16167
16167
|
}
|
|
16168
16168
|
}));
|
|
16169
|
-
const
|
|
16170
|
-
return new su(o,
|
|
16169
|
+
const c = new ft(r);
|
|
16170
|
+
return new su(o, c, i.fieldTransforms);
|
|
16171
16171
|
}
|
|
16172
16172
|
|
|
16173
16173
|
/** Parse update data from a list of field/value arguments. */ function mu(t, e, n, s, i, r) {
|
|
16174
|
-
const o = t.
|
|
16174
|
+
const o = t.Uc(1 /* Update */ , e, n), c = [ Iu(e, s, n) ], a = [ i ];
|
|
16175
16175
|
if (r.length % 2 != 0) throw new K(q.INVALID_ARGUMENT, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
16176
|
-
for (let t = 0; t < r.length; t += 2)
|
|
16176
|
+
for (let t = 0; t < r.length; t += 2) c.push(Iu(e, r[t])), a.push(r[t + 1]);
|
|
16177
16177
|
const u = [], h = Ut.empty();
|
|
16178
16178
|
// We iterate in reverse order to pick the last value for a field if the
|
|
16179
16179
|
// user specified the field multiple times.
|
|
16180
|
-
for (let t =
|
|
16181
|
-
const e =
|
|
16182
|
-
let n =
|
|
16180
|
+
for (let t = c.length - 1; t >= 0; --t) if (!Pu(u, c[t])) {
|
|
16181
|
+
const e = c[t];
|
|
16182
|
+
let n = a[t];
|
|
16183
16183
|
// For Compat types, we have to "extract" the underlying types before
|
|
16184
16184
|
// performing validation.
|
|
16185
16185
|
n = y(n);
|
|
16186
|
-
const s = o
|
|
16186
|
+
const s = o.Oc(e);
|
|
16187
16187
|
if (n instanceof uu)
|
|
16188
16188
|
// Add it to the field mask, but don't add anything to updateData.
|
|
16189
16189
|
u.push(e); else {
|
|
@@ -16202,7 +16202,7 @@ class wu extends Zc {
|
|
|
16202
16202
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
16203
16203
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
16204
16204
|
*/ function gu(t, e, n, s = !1) {
|
|
16205
|
-
return yu(n, t.
|
|
16205
|
+
return yu(n, t.Uc(s ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
16206
16206
|
}
|
|
16207
16207
|
|
|
16208
16208
|
/**
|
|
@@ -16218,7 +16218,7 @@ class wu extends Zc {
|
|
|
16218
16218
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
16219
16219
|
// from firestore-exp.
|
|
16220
16220
|
t = y(t))) return Tu("Unsupported field value:", e, t), pu(t, e);
|
|
16221
|
-
if (t instanceof
|
|
16221
|
+
if (t instanceof Za)
|
|
16222
16222
|
// FieldValues usually parse into transforms (except FieldValue.delete())
|
|
16223
16223
|
// in which case we do not want to include this field in our parsed data
|
|
16224
16224
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -16230,8 +16230,8 @@ class wu extends Zc {
|
|
|
16230
16230
|
*/
|
|
16231
16231
|
return function(t, e) {
|
|
16232
16232
|
// Sentinels are only supported with writes, and not within arrays.
|
|
16233
|
-
if (!iu(e.
|
|
16234
|
-
if (!e.path) throw e.
|
|
16233
|
+
if (!iu(e.Cc)) throw e.Mc(`${t._methodName}() can only be used with update() and set()`);
|
|
16234
|
+
if (!e.path) throw e.Mc(`${t._methodName}() is not currently supported inside arrays`);
|
|
16235
16235
|
const n = t._toFieldTransform(e);
|
|
16236
16236
|
n && e.fieldTransforms.push(n);
|
|
16237
16237
|
}
|
|
@@ -16255,12 +16255,12 @@ class wu extends Zc {
|
|
|
16255
16255
|
// the set of values to be included for the IN query) that may directly
|
|
16256
16256
|
// contain additional arrays (each representing an individual field
|
|
16257
16257
|
// value), so we disable this validation.
|
|
16258
|
-
if (e.settings.
|
|
16258
|
+
if (e.settings.kc && 4 /* ArrayArgument */ !== e.Cc) throw e.Mc("Nested arrays are not supported");
|
|
16259
16259
|
return function(t, e) {
|
|
16260
16260
|
const n = [];
|
|
16261
16261
|
let s = 0;
|
|
16262
16262
|
for (const i of t) {
|
|
16263
|
-
let t = yu(i, e.
|
|
16263
|
+
let t = yu(i, e.Fc(s));
|
|
16264
16264
|
null == t && (
|
|
16265
16265
|
// Just include nulls in the array for fields being replaced with a
|
|
16266
16266
|
// sentinel.
|
|
@@ -16307,17 +16307,17 @@ class wu extends Zc {
|
|
|
16307
16307
|
longitude: t.longitude
|
|
16308
16308
|
}
|
|
16309
16309
|
};
|
|
16310
|
-
if (t instanceof
|
|
16310
|
+
if (t instanceof Xa) return {
|
|
16311
16311
|
bytesValue: qn(e.N, t._byteString)
|
|
16312
16312
|
};
|
|
16313
|
-
if (t instanceof
|
|
16313
|
+
if (t instanceof Ia) {
|
|
16314
16314
|
const n = e.databaseId, s = t.firestore._databaseId;
|
|
16315
|
-
if (!s.isEqual(n)) throw e.
|
|
16315
|
+
if (!s.isEqual(n)) throw e.Mc(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`);
|
|
16316
16316
|
return {
|
|
16317
16317
|
referenceValue: Qn(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
16318
16318
|
};
|
|
16319
16319
|
}
|
|
16320
|
-
throw e.
|
|
16320
|
+
throw e.Mc(`Unsupported field value: ${ma(t)}`);
|
|
16321
16321
|
}
|
|
16322
16322
|
/**
|
|
16323
16323
|
* Checks whether an object looks like a JSON object that should be converted
|
|
@@ -16330,11 +16330,11 @@ class wu extends Zc {
|
|
|
16330
16330
|
|
|
16331
16331
|
function pu(t, e) {
|
|
16332
16332
|
const n = {};
|
|
16333
|
-
return
|
|
16333
|
+
return ct(t) ?
|
|
16334
16334
|
// If we encounter an empty object, we explicitly add it to the update
|
|
16335
16335
|
// mask to ensure that the server creates a map entry.
|
|
16336
16336
|
e.path && e.path.length > 0 && e.fieldMask.push(e.path) : ot(t, ((t, s) => {
|
|
16337
|
-
const i = yu(s, e.
|
|
16337
|
+
const i = yu(s, e.xc(t));
|
|
16338
16338
|
null != i && (n[t] = i);
|
|
16339
16339
|
})), {
|
|
16340
16340
|
mapValue: {
|
|
@@ -16344,15 +16344,15 @@ function pu(t, e) {
|
|
|
16344
16344
|
}
|
|
16345
16345
|
|
|
16346
16346
|
function Eu(t) {
|
|
16347
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof st || t instanceof tu || t instanceof
|
|
16347
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof st || t instanceof tu || t instanceof Xa || t instanceof Ia || t instanceof Za);
|
|
16348
16348
|
}
|
|
16349
16349
|
|
|
16350
16350
|
function Tu(t, e, n) {
|
|
16351
16351
|
if (!Eu(n) || !function(t) {
|
|
16352
16352
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
16353
16353
|
}(n)) {
|
|
16354
|
-
const s =
|
|
16355
|
-
throw "an object" === s ? e.
|
|
16354
|
+
const s = ma(n);
|
|
16355
|
+
throw "an object" === s ? e.Mc(t + " a custom object") : e.Mc(t + " " + s);
|
|
16356
16356
|
}
|
|
16357
16357
|
}
|
|
16358
16358
|
|
|
@@ -16362,7 +16362,7 @@ function Tu(t, e, n) {
|
|
|
16362
16362
|
if ((
|
|
16363
16363
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
16364
16364
|
// FieldPath.
|
|
16365
|
-
e = y(e)) instanceof
|
|
16365
|
+
e = y(e)) instanceof Ja) return e._internalPath;
|
|
16366
16366
|
if ("string" == typeof e) return Ru(t, e);
|
|
16367
16367
|
throw bu("Field path arguments must be of type string or FieldPath.", t,
|
|
16368
16368
|
/* hasConverter= */ !1,
|
|
@@ -16386,7 +16386,7 @@ function Tu(t, e, n) {
|
|
|
16386
16386
|
/* hasConverter= */ !1,
|
|
16387
16387
|
/* path= */ void 0, n);
|
|
16388
16388
|
try {
|
|
16389
|
-
return new
|
|
16389
|
+
return new Ja(...e.split("."))._internalPath;
|
|
16390
16390
|
} catch (s) {
|
|
16391
16391
|
throw bu(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
|
|
16392
16392
|
/* hasConverter= */ !1,
|
|
@@ -16396,11 +16396,11 @@ function Tu(t, e, n) {
|
|
|
16396
16396
|
|
|
16397
16397
|
function bu(t, e, n, s, i) {
|
|
16398
16398
|
const r = s && !s.isEmpty(), o = void 0 !== i;
|
|
16399
|
-
let
|
|
16400
|
-
n && (
|
|
16401
|
-
let
|
|
16402
|
-
return (r || o) && (
|
|
16403
|
-
|
|
16399
|
+
let c = `Function ${e}() called with invalid data`;
|
|
16400
|
+
n && (c += " (via `toFirestore()`)"), c += ". ";
|
|
16401
|
+
let a = "";
|
|
16402
|
+
return (r || o) && (a += " (found", r && (a += ` in field ${s}`), o && (a += ` in document ${i}`),
|
|
16403
|
+
a += ")"), new K(q.INVALID_ARGUMENT, c + t + a);
|
|
16404
16404
|
}
|
|
16405
16405
|
|
|
16406
16406
|
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Pu(t, e) {
|
|
@@ -16447,7 +16447,7 @@ function bu(t, e, n, s, i) {
|
|
|
16447
16447
|
/**
|
|
16448
16448
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
16449
16449
|
*/ get ref() {
|
|
16450
|
-
return new
|
|
16450
|
+
return new Ia(this._firestore, this._converter, this._key);
|
|
16451
16451
|
}
|
|
16452
16452
|
/**
|
|
16453
16453
|
* Signals whether or not the document at the snapshot's location exists.
|
|
@@ -16518,7 +16518,7 @@ function bu(t, e, n, s, i) {
|
|
|
16518
16518
|
/**
|
|
16519
16519
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
16520
16520
|
*/ function Su(t, e) {
|
|
16521
|
-
return "string" == typeof e ? Ru(t, e) : e instanceof
|
|
16521
|
+
return "string" == typeof e ? Ru(t, e) : e instanceof Ja ? e._internalPath : e._delegate._internalPath;
|
|
16522
16522
|
}
|
|
16523
16523
|
|
|
16524
16524
|
/**
|
|
@@ -16755,7 +16755,7 @@ function ku(t) {
|
|
|
16755
16755
|
* @param right - A snapshot to compare.
|
|
16756
16756
|
* @returns true if the snapshots are equal.
|
|
16757
16757
|
*/ function $u(t, e) {
|
|
16758
|
-
return t instanceof Cu && e instanceof Cu ? 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 xu && e instanceof xu && (t._firestore === e._firestore &&
|
|
16758
|
+
return t instanceof Cu && e instanceof Cu ? 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 xu && e instanceof xu && (t._firestore === e._firestore && Sa(t.query, e.query) && t.metadata.isEqual(e.metadata) && t._snapshot.isEqual(e._snapshot));
|
|
16759
16759
|
}
|
|
16760
16760
|
|
|
16761
16761
|
/**
|
|
@@ -16801,27 +16801,27 @@ function ku(t) {
|
|
|
16801
16801
|
|
|
16802
16802
|
class Lu extends Fu {
|
|
16803
16803
|
constructor(t, e, n) {
|
|
16804
|
-
super(), this.
|
|
16804
|
+
super(), this.jc = t, this.Qc = e, this.Wc = n, this.type = "where";
|
|
16805
16805
|
}
|
|
16806
16806
|
_apply(t) {
|
|
16807
|
-
const e =
|
|
16808
|
-
let
|
|
16807
|
+
const e = cu(t.firestore), n = function(t, e, n, s, i, r, o) {
|
|
16808
|
+
let c;
|
|
16809
16809
|
if (i.isKeyField()) {
|
|
16810
16810
|
if ("array-contains" /* ARRAY_CONTAINS */ === r || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === r) throw new K(q.INVALID_ARGUMENT, `Invalid Query. You can't perform '${r}' queries on FieldPath.documentId().`);
|
|
16811
16811
|
if ("in" /* IN */ === r || "not-in" /* NOT_IN */ === r) {
|
|
16812
16812
|
th(o, r);
|
|
16813
16813
|
const e = [];
|
|
16814
16814
|
for (const n of o) e.push(Zu(s, t, n));
|
|
16815
|
-
|
|
16815
|
+
c = {
|
|
16816
16816
|
arrayValue: {
|
|
16817
16817
|
values: e
|
|
16818
16818
|
}
|
|
16819
16819
|
};
|
|
16820
|
-
} else
|
|
16820
|
+
} else c = Zu(s, t, o);
|
|
16821
16821
|
} else "in" /* IN */ !== r && "not-in" /* NOT_IN */ !== r && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== r || th(o, r),
|
|
16822
|
-
|
|
16822
|
+
c = gu(n, e, o,
|
|
16823
16823
|
/* allowArrays= */ "in" /* IN */ === r || "not-in" /* NOT_IN */ === r);
|
|
16824
|
-
const
|
|
16824
|
+
const a = Jt.create(i, r, c);
|
|
16825
16825
|
return function(t, e) {
|
|
16826
16826
|
if (e.v()) {
|
|
16827
16827
|
const n = ye(t);
|
|
@@ -16869,9 +16869,9 @@ class Lu extends Fu {
|
|
|
16869
16869
|
if (null !== n)
|
|
16870
16870
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
16871
16871
|
throw n === e.op ? new K(q.INVALID_ARGUMENT, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new K(q.INVALID_ARGUMENT, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
16872
|
-
}(t,
|
|
16873
|
-
}(t._query, "where", e, t.firestore._databaseId, this.
|
|
16874
|
-
return new
|
|
16872
|
+
}(t, a), a;
|
|
16873
|
+
}(t._query, "where", e, t.firestore._databaseId, this.jc, this.Qc, this.Wc);
|
|
16874
|
+
return new Aa(t.firestore, t.converter, function(t, e) {
|
|
16875
16875
|
const n = t.filters.concat([ e ]);
|
|
16876
16876
|
return new fe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
16877
16877
|
}(t._query, n));
|
|
@@ -16895,13 +16895,13 @@ class Lu extends Fu {
|
|
|
16895
16895
|
|
|
16896
16896
|
class Uu extends Fu {
|
|
16897
16897
|
constructor(t, e) {
|
|
16898
|
-
super(), this.
|
|
16898
|
+
super(), this.jc = t, this.Gc = e, this.type = "orderBy";
|
|
16899
16899
|
}
|
|
16900
16900
|
_apply(t) {
|
|
16901
16901
|
const e = function(t, e, n) {
|
|
16902
16902
|
if (null !== t.startAt) throw new K(q.INVALID_ARGUMENT, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
16903
16903
|
if (null !== t.endAt) throw new K(q.INVALID_ARGUMENT, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
16904
|
-
const s = new
|
|
16904
|
+
const s = new ae(e, n);
|
|
16905
16905
|
return function(t, e) {
|
|
16906
16906
|
if (null === ge(t)) {
|
|
16907
16907
|
// This is the first order by. It must match any inequality.
|
|
@@ -16920,8 +16920,8 @@ class Uu extends Fu {
|
|
|
16920
16920
|
* Will throw if the document does not contain all fields of the order by
|
|
16921
16921
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
16922
16922
|
* server timestamp.
|
|
16923
|
-
*/ (t._query, this.
|
|
16924
|
-
return new
|
|
16923
|
+
*/ (t._query, this.jc, this.Gc);
|
|
16924
|
+
return new Aa(t.firestore, t.converter, function(t, e) {
|
|
16925
16925
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
16926
16926
|
const n = t.explicitOrderBy.concat([ e ]);
|
|
16927
16927
|
return new fe(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -16944,10 +16944,10 @@ class Uu extends Fu {
|
|
|
16944
16944
|
|
|
16945
16945
|
class Ku extends Fu {
|
|
16946
16946
|
constructor(t, e, n) {
|
|
16947
|
-
super(), this.type = t, this.
|
|
16947
|
+
super(), this.type = t, this.zc = e, this.Hc = n;
|
|
16948
16948
|
}
|
|
16949
16949
|
_apply(t) {
|
|
16950
|
-
return new
|
|
16950
|
+
return new Aa(t.firestore, t.converter, Ie(t._query, this.zc, this.Hc));
|
|
16951
16951
|
}
|
|
16952
16952
|
}
|
|
16953
16953
|
|
|
@@ -16957,7 +16957,7 @@ class Ku extends Fu {
|
|
|
16957
16957
|
* @param limit - The maximum number of items to return.
|
|
16958
16958
|
* @returns The created {@link Query}.
|
|
16959
16959
|
*/ function ju(t) {
|
|
16960
|
-
return
|
|
16960
|
+
return ya("limit", t), new Ku("limit", t, "F" /* First */);
|
|
16961
16961
|
}
|
|
16962
16962
|
|
|
16963
16963
|
/**
|
|
@@ -16969,16 +16969,16 @@ class Ku extends Fu {
|
|
|
16969
16969
|
* @param limit - The maximum number of items to return.
|
|
16970
16970
|
* @returns The created {@link Query}.
|
|
16971
16971
|
*/ function Qu(t) {
|
|
16972
|
-
return
|
|
16972
|
+
return ya("limitToLast", t), new Ku("limitToLast", t, "L" /* Last */);
|
|
16973
16973
|
}
|
|
16974
16974
|
|
|
16975
16975
|
class Wu extends Fu {
|
|
16976
16976
|
constructor(t, e, n) {
|
|
16977
|
-
super(), this.type = t, this.
|
|
16977
|
+
super(), this.type = t, this.Jc = e, this.Yc = n;
|
|
16978
16978
|
}
|
|
16979
16979
|
_apply(t) {
|
|
16980
|
-
const e = Xu(t, this.type, this.
|
|
16981
|
-
return new
|
|
16980
|
+
const e = Xu(t, this.type, this.Jc, this.Yc);
|
|
16981
|
+
return new Aa(t.firestore, t.converter, function(t, e) {
|
|
16982
16982
|
return new fe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
16983
16983
|
}(t._query, e));
|
|
16984
16984
|
}
|
|
@@ -16995,11 +16995,11 @@ function zu(...t) {
|
|
|
16995
16995
|
|
|
16996
16996
|
class Hu extends Fu {
|
|
16997
16997
|
constructor(t, e, n) {
|
|
16998
|
-
super(), this.type = t, this.
|
|
16998
|
+
super(), this.type = t, this.Jc = e, this.Yc = n;
|
|
16999
16999
|
}
|
|
17000
17000
|
_apply(t) {
|
|
17001
|
-
const e = Xu(t, this.type, this.
|
|
17002
|
-
return new
|
|
17001
|
+
const e = Xu(t, this.type, this.Jc, this.Yc);
|
|
17002
|
+
return new Aa(t.firestore, t.converter, function(t, e) {
|
|
17003
17003
|
return new fe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
17004
17004
|
}(t._query, e));
|
|
17005
17005
|
}
|
|
@@ -17039,27 +17039,27 @@ function Yu(...t) {
|
|
|
17039
17039
|
* Converts a list of field values to a `Bound` for the given query.
|
|
17040
17040
|
*/ (t._query, t.firestore._databaseId, e, n[0]._document, s);
|
|
17041
17041
|
{
|
|
17042
|
-
const i =
|
|
17042
|
+
const i = cu(t.firestore);
|
|
17043
17043
|
return function(t, e, n, s, i, r) {
|
|
17044
17044
|
// Use explicit order by's because it has to match the query the user made
|
|
17045
17045
|
const o = t.explicitOrderBy;
|
|
17046
17046
|
if (i.length > o.length) throw new K(q.INVALID_ARGUMENT, `Too many arguments provided to ${s}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
|
|
17047
|
-
const
|
|
17047
|
+
const c = [];
|
|
17048
17048
|
for (let r = 0; r < i.length; r++) {
|
|
17049
|
-
const
|
|
17049
|
+
const a = i[r];
|
|
17050
17050
|
if (o[r].field.isKeyField()) {
|
|
17051
|
-
if ("string" != typeof
|
|
17052
|
-
if (!pe(t) && -1 !==
|
|
17053
|
-
const n = t.path.child(ut.fromString(
|
|
17051
|
+
if ("string" != typeof a) throw new K(q.INVALID_ARGUMENT, `Invalid query. Expected a string for document ID in ${s}(), but got a ${typeof a}`);
|
|
17052
|
+
if (!pe(t) && -1 !== a.indexOf("/")) throw new K(q.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 '${a}' contains a slash.`);
|
|
17053
|
+
const n = t.path.child(ut.fromString(a));
|
|
17054
17054
|
if (!Pt.isDocumentKey(n)) throw new K(q.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.`);
|
|
17055
17055
|
const i = new Pt(n);
|
|
17056
|
-
|
|
17056
|
+
c.push(kt(e, i));
|
|
17057
17057
|
} else {
|
|
17058
|
-
const t = gu(n, s,
|
|
17059
|
-
|
|
17058
|
+
const t = gu(n, s, a);
|
|
17059
|
+
c.push(t);
|
|
17060
17060
|
}
|
|
17061
17061
|
}
|
|
17062
|
-
return new oe(
|
|
17062
|
+
return new oe(c, r);
|
|
17063
17063
|
}
|
|
17064
17064
|
/**
|
|
17065
17065
|
* Parses the given `documentIdValue` into a `ReferenceValue`, throwing
|
|
@@ -17077,8 +17077,8 @@ function Zu(t, e, n) {
|
|
|
17077
17077
|
if (!Pt.isDocumentKey(s)) throw new K(q.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}).`);
|
|
17078
17078
|
return kt(t, new Pt(s));
|
|
17079
17079
|
}
|
|
17080
|
-
if (n instanceof
|
|
17081
|
-
throw new K(q.INVALID_ARGUMENT, `Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: ${
|
|
17080
|
+
if (n instanceof Ia) return kt(t, n._key);
|
|
17081
|
+
throw new K(q.INVALID_ARGUMENT, `Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: ${ma(n)}.`);
|
|
17082
17082
|
}
|
|
17083
17083
|
|
|
17084
17084
|
/**
|
|
@@ -17186,7 +17186,7 @@ function eh(t, e, n) {
|
|
|
17186
17186
|
convertDocumentKey(t, e) {
|
|
17187
17187
|
const n = ut.fromString(t);
|
|
17188
17188
|
L(Es(n));
|
|
17189
|
-
const s = new
|
|
17189
|
+
const s = new ha(n.get(1), n.get(3)), i = new Pt(n.popFirst(5));
|
|
17190
17190
|
return s.isEqual(e) ||
|
|
17191
17191
|
// TODO(b/64130202): Somehow support foreign references.
|
|
17192
17192
|
$(`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.`),
|
|
@@ -17232,11 +17232,11 @@ class ih extends nh {
|
|
|
17232
17232
|
super(), this.firestore = t;
|
|
17233
17233
|
}
|
|
17234
17234
|
convertBytes(t) {
|
|
17235
|
-
return new
|
|
17235
|
+
return new Xa(t);
|
|
17236
17236
|
}
|
|
17237
17237
|
convertReference(t) {
|
|
17238
17238
|
const e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
17239
|
-
return new
|
|
17239
|
+
return new Ia(this.firestore, /* converter= */ null, e);
|
|
17240
17240
|
}
|
|
17241
17241
|
}
|
|
17242
17242
|
|
|
@@ -17267,11 +17267,11 @@ class ih extends nh {
|
|
|
17267
17267
|
/** @hideconstructor */
|
|
17268
17268
|
constructor(t, e) {
|
|
17269
17269
|
this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
|
|
17270
|
-
this._dataReader =
|
|
17270
|
+
this._dataReader = cu(t);
|
|
17271
17271
|
}
|
|
17272
17272
|
set(t, e, n) {
|
|
17273
17273
|
this._verifyNotCommitted();
|
|
17274
|
-
const s = oh(t, this._firestore), i = sh(s.converter, e, n), r =
|
|
17274
|
+
const s = oh(t, this._firestore), i = sh(s.converter, e, n), r = au(this._dataReader, "WriteBatch.set", s._key, i, null !== s.converter, n);
|
|
17275
17275
|
return this._mutations.push(r.toMutation(s._key, Ge.none())), this;
|
|
17276
17276
|
}
|
|
17277
17277
|
update(t, e, n, ...s) {
|
|
@@ -17280,7 +17280,7 @@ class ih extends nh {
|
|
|
17280
17280
|
// For Compat types, we have to "extract" the underlying types before
|
|
17281
17281
|
// performing validation.
|
|
17282
17282
|
let r;
|
|
17283
|
-
return r = "string" == typeof (e = y(e)) || e instanceof
|
|
17283
|
+
return r = "string" == typeof (e = y(e)) || e instanceof Ja ? mu(this._dataReader, "WriteBatch.update", i._key, e, n, s) : _u(this._dataReader, "WriteBatch.update", i._key, e),
|
|
17284
17284
|
this._mutations.push(r.toMutation(i._key, Ge.exists(!0))), this;
|
|
17285
17285
|
}
|
|
17286
17286
|
/**
|
|
@@ -17291,7 +17291,7 @@ class ih extends nh {
|
|
|
17291
17291
|
*/ delete(t) {
|
|
17292
17292
|
this._verifyNotCommitted();
|
|
17293
17293
|
const e = oh(t, this._firestore);
|
|
17294
|
-
return this._mutations = this._mutations.concat(new
|
|
17294
|
+
return this._mutations = this._mutations.concat(new cn(e._key, Ge.none())), this;
|
|
17295
17295
|
}
|
|
17296
17296
|
/**
|
|
17297
17297
|
* Commits all of the writes in this write batch as a single atomic unit.
|
|
@@ -17370,22 +17370,22 @@ function oh(t, e) {
|
|
|
17370
17370
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the
|
|
17371
17371
|
* current document contents.
|
|
17372
17372
|
*/
|
|
17373
|
-
function
|
|
17374
|
-
t =
|
|
17375
|
-
const e =
|
|
17376
|
-
return
|
|
17373
|
+
function ch(t) {
|
|
17374
|
+
t = ga(t, Ia);
|
|
17375
|
+
const e = ga(t.firestore, ka);
|
|
17376
|
+
return na(Fa(e), t._key).then((n => Th(e, t, n)));
|
|
17377
17377
|
}
|
|
17378
17378
|
|
|
17379
|
-
class
|
|
17379
|
+
class ah extends nh {
|
|
17380
17380
|
constructor(t) {
|
|
17381
17381
|
super(), this.firestore = t;
|
|
17382
17382
|
}
|
|
17383
17383
|
convertBytes(t) {
|
|
17384
|
-
return new
|
|
17384
|
+
return new Xa(t);
|
|
17385
17385
|
}
|
|
17386
17386
|
convertReference(t) {
|
|
17387
17387
|
const e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
17388
|
-
return new
|
|
17388
|
+
return new Ia(this.firestore, /* converter= */ null, e);
|
|
17389
17389
|
}
|
|
17390
17390
|
}
|
|
17391
17391
|
|
|
@@ -17396,9 +17396,9 @@ class ch extends nh {
|
|
|
17396
17396
|
* @returns A `Promise` resolved with a `DocumentSnapshot` containing the
|
|
17397
17397
|
* current document contents.
|
|
17398
17398
|
*/ function uh(t) {
|
|
17399
|
-
t =
|
|
17400
|
-
const e =
|
|
17401
|
-
return
|
|
17399
|
+
t = ga(t, Ia);
|
|
17400
|
+
const e = ga(t.firestore, ka), n = Fa(e), s = new ah(e);
|
|
17401
|
+
return ea(n, t._key).then((n => new Cu(e, s, t._key, n, new Du(null !== n && n.hasLocalMutations,
|
|
17402
17402
|
/* fromCache= */ !0), t.converter)));
|
|
17403
17403
|
}
|
|
17404
17404
|
|
|
@@ -17409,9 +17409,9 @@ class ch extends nh {
|
|
|
17409
17409
|
* @returns A `Promise` resolved with a `DocumentSnapshot` containing the
|
|
17410
17410
|
* current document contents.
|
|
17411
17411
|
*/ function hh(t) {
|
|
17412
|
-
t =
|
|
17413
|
-
const e =
|
|
17414
|
-
return
|
|
17412
|
+
t = ga(t, Ia);
|
|
17413
|
+
const e = ga(t.firestore, ka);
|
|
17414
|
+
return na(Fa(e), t._key, {
|
|
17415
17415
|
source: "server"
|
|
17416
17416
|
}).then((n => Th(e, t, n)));
|
|
17417
17417
|
}
|
|
@@ -17426,9 +17426,9 @@ class ch extends nh {
|
|
|
17426
17426
|
*
|
|
17427
17427
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
17428
17428
|
*/ function lh(t) {
|
|
17429
|
-
t =
|
|
17430
|
-
const e =
|
|
17431
|
-
return Ou(t._query),
|
|
17429
|
+
t = ga(t, Aa);
|
|
17430
|
+
const e = ga(t.firestore, ka), n = Fa(e), s = new ah(e);
|
|
17431
|
+
return Ou(t._query), ia(n, t._query).then((n => new xu(e, s, t, n)));
|
|
17432
17432
|
}
|
|
17433
17433
|
|
|
17434
17434
|
/**
|
|
@@ -17437,9 +17437,9 @@ class ch extends nh {
|
|
|
17437
17437
|
*
|
|
17438
17438
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
17439
17439
|
*/ function fh(t) {
|
|
17440
|
-
t =
|
|
17441
|
-
const e =
|
|
17442
|
-
return
|
|
17440
|
+
t = ga(t, Aa);
|
|
17441
|
+
const e = ga(t.firestore, ka), n = Fa(e), s = new ah(e);
|
|
17442
|
+
return sa(n, t._query).then((n => new xu(e, s, t, n)));
|
|
17443
17443
|
}
|
|
17444
17444
|
|
|
17445
17445
|
/**
|
|
@@ -17448,27 +17448,27 @@ class ch extends nh {
|
|
|
17448
17448
|
*
|
|
17449
17449
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
17450
17450
|
*/ function dh(t) {
|
|
17451
|
-
t =
|
|
17452
|
-
const e =
|
|
17453
|
-
return
|
|
17451
|
+
t = ga(t, Aa);
|
|
17452
|
+
const e = ga(t.firestore, ka), n = Fa(e), s = new ah(e);
|
|
17453
|
+
return ia(n, t._query, {
|
|
17454
17454
|
source: "server"
|
|
17455
17455
|
}).then((n => new xu(e, s, t, n)));
|
|
17456
17456
|
}
|
|
17457
17457
|
|
|
17458
17458
|
function wh(t, e, n) {
|
|
17459
|
-
t =
|
|
17460
|
-
const s =
|
|
17461
|
-
return Eh(s, [ cu(
|
|
17459
|
+
t = ga(t, Ia);
|
|
17460
|
+
const s = ga(t.firestore, ka), i = sh(t.converter, e, n);
|
|
17461
|
+
return Eh(s, [ au(cu(s), "setDoc", t._key, i, null !== t.converter, n).toMutation(t._key, Ge.none()) ]);
|
|
17462
17462
|
}
|
|
17463
17463
|
|
|
17464
17464
|
function _h(t, e, n, ...s) {
|
|
17465
|
-
t =
|
|
17466
|
-
const i =
|
|
17465
|
+
t = ga(t, Ia);
|
|
17466
|
+
const i = ga(t.firestore, ka), r = cu(i);
|
|
17467
17467
|
let o;
|
|
17468
17468
|
o = "string" == typeof (
|
|
17469
17469
|
// For Compat types, we have to "extract" the underlying types before
|
|
17470
17470
|
// performing validation.
|
|
17471
|
-
e = y(e)) || e instanceof
|
|
17471
|
+
e = y(e)) || e instanceof Ja ? mu(r, "updateDoc", t._key, e, n, s) : _u(r, "updateDoc", t._key, e);
|
|
17472
17472
|
return Eh(i, [ o.toMutation(t._key, Ge.exists(!0)) ]);
|
|
17473
17473
|
}
|
|
17474
17474
|
|
|
@@ -17479,7 +17479,7 @@ function _h(t, e, n, ...s) {
|
|
|
17479
17479
|
* @returns A Promise resolved once the document has been successfully
|
|
17480
17480
|
* deleted from the backend (note that it won't resolve while you're offline).
|
|
17481
17481
|
*/ function mh(t) {
|
|
17482
|
-
return Eh(
|
|
17482
|
+
return Eh(ga(t.firestore, ka), [ new cn(t._key, Ge.none()) ]);
|
|
17483
17483
|
}
|
|
17484
17484
|
|
|
17485
17485
|
/**
|
|
@@ -17492,8 +17492,8 @@ function _h(t, e, n, ...s) {
|
|
|
17492
17492
|
* newly created document after it has been written to the backend (Note that it
|
|
17493
17493
|
* won't resolve while you're offline).
|
|
17494
17494
|
*/ function gh(t, e) {
|
|
17495
|
-
const n =
|
|
17496
|
-
return Eh(n, [ cu(
|
|
17495
|
+
const n = ga(t.firestore, ka), s = va(t), i = sh(t.converter, e);
|
|
17496
|
+
return Eh(n, [ au(cu(t.firestore), "addDoc", s._key, i, null !== t.converter, {}).toMutation(s._key, Ge.exists(!1)) ]).then((() => s));
|
|
17497
17497
|
}
|
|
17498
17498
|
|
|
17499
17499
|
function yh(t, ...e) {
|
|
@@ -17502,27 +17502,27 @@ function yh(t, ...e) {
|
|
|
17502
17502
|
let r = {
|
|
17503
17503
|
includeMetadataChanges: !1
|
|
17504
17504
|
}, o = 0;
|
|
17505
|
-
"object" != typeof e[o] ||
|
|
17506
|
-
const
|
|
17505
|
+
"object" != typeof e[o] || Ca(e[o]) || (r = e[o], o++);
|
|
17506
|
+
const c = {
|
|
17507
17507
|
includeMetadataChanges: r.includeMetadataChanges
|
|
17508
17508
|
};
|
|
17509
|
-
if (
|
|
17509
|
+
if (Ca(e[o])) {
|
|
17510
17510
|
const t = e[o];
|
|
17511
17511
|
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),
|
|
17512
17512
|
e[o + 2] = null === (i = t.complete) || void 0 === i ? void 0 : i.bind(t);
|
|
17513
17513
|
}
|
|
17514
|
-
let
|
|
17515
|
-
if (t instanceof
|
|
17514
|
+
let a, u, h;
|
|
17515
|
+
if (t instanceof Ia) u = ga(t.firestore, ka), h = we(t._key.path), a = {
|
|
17516
17516
|
next: n => {
|
|
17517
17517
|
e[o] && e[o](Th(u, t, n));
|
|
17518
17518
|
},
|
|
17519
17519
|
error: e[o + 1],
|
|
17520
17520
|
complete: e[o + 2]
|
|
17521
17521
|
}; else {
|
|
17522
|
-
const n =
|
|
17523
|
-
u =
|
|
17524
|
-
const s = new
|
|
17525
|
-
|
|
17522
|
+
const n = ga(t, Aa);
|
|
17523
|
+
u = ga(n.firestore, ka), h = n._query;
|
|
17524
|
+
const s = new ah(u);
|
|
17525
|
+
a = {
|
|
17526
17526
|
next: t => {
|
|
17527
17527
|
e[o] && e[o](new xu(u, s, n, t));
|
|
17528
17528
|
},
|
|
@@ -17531,15 +17531,15 @@ function yh(t, ...e) {
|
|
|
17531
17531
|
}, Ou(t._query);
|
|
17532
17532
|
}
|
|
17533
17533
|
return function(t, e, n, s) {
|
|
17534
|
-
const i = new
|
|
17535
|
-
return t.asyncQueue.enqueueAndForget((async () => Bo(await
|
|
17536
|
-
i.Xo(), t.asyncQueue.enqueueAndForget((async () => Uo(await
|
|
17534
|
+
const i = new Lc(s), r = new Qo(e, i, n);
|
|
17535
|
+
return t.asyncQueue.enqueueAndForget((async () => Bo(await Xc(t), r))), () => {
|
|
17536
|
+
i.Xo(), t.asyncQueue.enqueueAndForget((async () => Uo(await Xc(t), r)));
|
|
17537
17537
|
};
|
|
17538
|
-
}(
|
|
17538
|
+
}(Fa(u), h, c, a);
|
|
17539
17539
|
}
|
|
17540
17540
|
|
|
17541
17541
|
function ph(t, e) {
|
|
17542
|
-
return
|
|
17542
|
+
return ra(Fa(t = ga(t, ka)), Ca(e) ? e : {
|
|
17543
17543
|
next: e
|
|
17544
17544
|
});
|
|
17545
17545
|
}
|
|
@@ -17550,15 +17550,15 @@ function ph(t, e) {
|
|
|
17550
17550
|
*/ function Eh(t, e) {
|
|
17551
17551
|
return function(t, e) {
|
|
17552
17552
|
const n = new j;
|
|
17553
|
-
return t.asyncQueue.enqueueAndForget((async () =>
|
|
17554
|
-
}(
|
|
17553
|
+
return t.asyncQueue.enqueueAndForget((async () => rc(await Yc(t), e, n))), n.promise;
|
|
17554
|
+
}(Fa(t), e);
|
|
17555
17555
|
}
|
|
17556
17556
|
|
|
17557
17557
|
/**
|
|
17558
17558
|
* Converts a {@link ViewSnapshot} that contains the single document specified by `ref`
|
|
17559
17559
|
* to a {@link DocumentSnapshot}.
|
|
17560
17560
|
*/ function Th(t, e, n) {
|
|
17561
|
-
const s = n.docs.get(e._key), i = new
|
|
17561
|
+
const s = n.docs.get(e._key), i = new ah(t);
|
|
17562
17562
|
return new Cu(t, i, e._key, s, new Du(n.hasPendingWrites, n.fromCache), e.converter);
|
|
17563
17563
|
}
|
|
17564
17564
|
|
|
@@ -17587,7 +17587,7 @@ function ph(t, e) {
|
|
|
17587
17587
|
*/ class Ih extends class {
|
|
17588
17588
|
/** @hideconstructor */
|
|
17589
17589
|
constructor(t, e) {
|
|
17590
|
-
this._firestore = t, this._transaction = e, this._dataReader =
|
|
17590
|
+
this._firestore = t, this._transaction = e, this._dataReader = cu(t);
|
|
17591
17591
|
}
|
|
17592
17592
|
/**
|
|
17593
17593
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
@@ -17605,7 +17605,7 @@ function ph(t, e) {
|
|
|
17605
17605
|
}));
|
|
17606
17606
|
}
|
|
17607
17607
|
set(t, e, n) {
|
|
17608
|
-
const s = oh(t, this._firestore), i = sh(s.converter, e, n), r =
|
|
17608
|
+
const s = oh(t, this._firestore), i = sh(s.converter, e, n), r = au(this._dataReader, "Transaction.set", s._key, i, null !== s.converter, n);
|
|
17609
17609
|
return this._transaction.set(s._key, r), this;
|
|
17610
17610
|
}
|
|
17611
17611
|
update(t, e, n, ...s) {
|
|
@@ -17613,7 +17613,7 @@ function ph(t, e) {
|
|
|
17613
17613
|
// For Compat types, we have to "extract" the underlying types before
|
|
17614
17614
|
// performing validation.
|
|
17615
17615
|
let r;
|
|
17616
|
-
return r = "string" == typeof (e = y(e)) || e instanceof
|
|
17616
|
+
return r = "string" == typeof (e = y(e)) || e instanceof Ja ? mu(this._dataReader, "Transaction.update", i._key, e, n, s) : _u(this._dataReader, "Transaction.update", i._key, e),
|
|
17617
17617
|
this._transaction.update(i._key, r), this;
|
|
17618
17618
|
}
|
|
17619
17619
|
/**
|
|
@@ -17638,7 +17638,7 @@ function ph(t, e) {
|
|
|
17638
17638
|
* @param documentRef - A reference to the document to be read.
|
|
17639
17639
|
* @returns A `DocumentSnapshot` with the read data.
|
|
17640
17640
|
*/ get(t) {
|
|
17641
|
-
const e = oh(t, this._firestore), n = new
|
|
17641
|
+
const e = oh(t, this._firestore), n = new ah(this._firestore);
|
|
17642
17642
|
return super.get(t).then((t => new Cu(this._firestore, n, e._key, t._document, new Du(
|
|
17643
17643
|
/* hasPendingWrites= */ !1,
|
|
17644
17644
|
/* fromCache= */ !1), e.converter)));
|
|
@@ -17662,7 +17662,7 @@ function ph(t, e) {
|
|
|
17662
17662
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
17663
17663
|
* rejected promise with the corresponding failure error is returned.
|
|
17664
17664
|
*/ function Ah(t, e) {
|
|
17665
|
-
return
|
|
17665
|
+
return oa(Fa(t), (n => e(new Ih(t, n))));
|
|
17666
17666
|
}
|
|
17667
17667
|
|
|
17668
17668
|
/**
|
|
@@ -17777,7 +17777,7 @@ function ph(t, e) {
|
|
|
17777
17777
|
* @returns A {@link WriteBatch} that can be used to atomically execute multiple
|
|
17778
17778
|
* writes.
|
|
17779
17779
|
*/ function Sh(t) {
|
|
17780
|
-
return
|
|
17780
|
+
return Fa(t = ga(t, ka)), new rh(t, (e => Eh(t, e)));
|
|
17781
17781
|
}
|
|
17782
17782
|
|
|
17783
17783
|
/**
|
|
@@ -17800,11 +17800,11 @@ function ph(t, e) {
|
|
|
17800
17800
|
Dh = "rn", function(t) {
|
|
17801
17801
|
D = t;
|
|
17802
17802
|
}(i), n(new r("firestore", ((t, {options: e}) => {
|
|
17803
|
-
const n = t.getProvider("app").getImmediate(), s = new
|
|
17803
|
+
const n = t.getProvider("app").getImmediate(), s = new ka(n, new z(t.getProvider("auth-internal")));
|
|
17804
17804
|
return e = Object.assign({
|
|
17805
17805
|
useFetchStreams: !0
|
|
17806
17806
|
}, e), s._setSettings(e), s;
|
|
17807
|
-
}), "PUBLIC" /* PUBLIC */)), s("@firebase/firestore", "3.0.2-canary.
|
|
17807
|
+
}), "PUBLIC" /* PUBLIC */)), s("@firebase/firestore", "3.0.2-canary.46d26ff96", Dh);
|
|
17808
17808
|
|
|
17809
|
-
export { nh as AbstractUserDataWriter,
|
|
17809
|
+
export { nh as AbstractUserDataWriter, Xa as Bytes, xa as CACHE_SIZE_UNLIMITED, Ra as CollectionReference, Ia as DocumentReference, Cu as DocumentSnapshot, Ja as FieldPath, Za as FieldValue, ka as Firestore, K as FirestoreError, tu as GeoPoint, Na as LoadBundleTask, Aa as Query, Fu as QueryConstraint, Nu as QueryDocumentSnapshot, xu as QuerySnapshot, Du as SnapshotMetadata, st as Timestamp, Ih as Transaction, rh as WriteBatch, ha as _DatabaseId, Pt as _DocumentKey, W as _EmptyCredentialsProvider, lt as _FieldPath, ga as _cast, B as _debugAssert, wt as _isBase64Available, O as _logWarn, da as _validateIsNotUsedTogether, gh as addDoc, vh as arrayRemove, Ph as arrayUnion, qa as clearIndexedDbPersistence, ba as collection, Pa as collectionGroup, Ta as connectFirestoreEmulator, mh as deleteDoc, Rh as deleteField, Qa as disableNetwork, va as doc, Ya as documentId, La as enableIndexedDbPersistence, Ba as enableMultiTabIndexedDbPersistence, ja as enableNetwork, Yu as endAt, Ju as endBefore, Fa as ensureFirestoreConfigured, Eh as executeWrite, ch as getDoc, uh as getDocFromCache, hh as getDocFromServer, lh as getDocs, fh as getDocsFromCache, dh as getDocsFromServer, Oa as getFirestore, Vh as increment, $a as initializeFirestore, ju as limit, Qu as limitToLast, Ga as loadBundle, za as namedQuery, yh as onSnapshot, ph as onSnapshotsInSync, qu as orderBy, Mu as query, Sa as queryEqual, Va as refEqual, Ah as runTransaction, bh as serverTimestamp, wh as setDoc, x as setLogLevel, $u as snapshotEqual, zu as startAfter, Gu as startAt, Wa as terminate, _h as updateDoc, Ka as waitForPendingWrites, Bu as where, Sh as writeBatch };
|
|
17810
17810
|
//# sourceMappingURL=index.rn.js.map
|