@firebase/firestore 3.4.3 → 3.4.4-canary.0482aa5b7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/firestore/src/api/database.d.ts +14 -9
- package/dist/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
- package/dist/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/firestore/src/api.d.ts +2 -1
- package/dist/firestore/src/core/database_info.d.ts +1 -0
- package/dist/firestore/src/core/firestore_client.d.ts +2 -0
- package/dist/firestore/src/core/target.d.ts +34 -5
- package/dist/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/firestore/src/local/index_manager.d.ts +52 -0
- package/dist/firestore/src/local/indexeddb_index_manager.d.ts +11 -0
- package/dist/firestore/src/local/indexeddb_schema.d.ts +121 -7
- package/dist/firestore/src/local/local_serializer.d.ts +1 -1
- package/dist/firestore/src/local/memory_index_manager.d.ts +11 -0
- package/dist/firestore/src/local/remote_document_change_buffer.d.ts +3 -12
- package/dist/firestore/src/model/document.d.ts +7 -0
- package/dist/firestore/src/model/document_key.d.ts +1 -0
- package/dist/firestore/src/model/field_index.d.ts +156 -0
- package/dist/firestore/src/model/values.d.ts +7 -0
- package/dist/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +1 -1
- package/dist/firestore/test/unit/model/field_index.test.d.ts +17 -0
- package/dist/firestore/test/unit/model/target.test.d.ts +17 -0
- package/dist/firestore/test/util/helpers.d.ts +8 -2
- package/dist/index.d.ts +16 -11
- package/dist/index.esm2017.js +2979 -2671
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3036 -2815
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +644 -235
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +644 -236
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +2761 -2449
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +303 -25
- package/dist/lite/firestore/src/api/database.d.ts +14 -9
- package/dist/lite/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
- package/dist/lite/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/lite/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/lite/firestore/src/api.d.ts +2 -1
- package/dist/lite/firestore/src/core/database_info.d.ts +1 -0
- package/dist/lite/firestore/src/core/firestore_client.d.ts +2 -0
- package/dist/lite/firestore/src/core/target.d.ts +34 -5
- package/dist/lite/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/lite/firestore/src/local/index_manager.d.ts +52 -0
- package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +11 -0
- package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +121 -7
- package/dist/lite/firestore/src/local/local_serializer.d.ts +1 -1
- package/dist/lite/firestore/src/local/memory_index_manager.d.ts +11 -0
- package/dist/lite/firestore/src/local/remote_document_change_buffer.d.ts +3 -12
- package/dist/lite/firestore/src/model/document.d.ts +7 -0
- package/dist/lite/firestore/src/model/document_key.d.ts +1 -0
- package/dist/lite/firestore/src/model/field_index.d.ts +156 -0
- package/dist/lite/firestore/src/model/values.d.ts +7 -0
- package/dist/lite/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +1 -1
- package/dist/lite/firestore/test/unit/model/field_index.test.d.ts +17 -0
- package/dist/lite/firestore/test/unit/model/target.test.d.ts +17 -0
- package/dist/lite/firestore/test/util/helpers.d.ts +8 -2
- package/dist/lite/index.browser.esm2017.js +352 -338
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +334 -326
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +53 -34
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +53 -34
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +318 -304
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +11 -2
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +98 -97
- package/dist/lite/packages/firestore/src/api/database.d.ts +14 -9
- package/dist/lite/packages/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
- package/dist/lite/packages/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/lite/packages/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/lite/packages/firestore/src/api.d.ts +2 -1
- package/dist/lite/packages/firestore/src/core/database_info.d.ts +1 -0
- package/dist/lite/packages/firestore/src/core/firestore_client.d.ts +2 -0
- package/dist/lite/packages/firestore/src/core/target.d.ts +34 -5
- package/dist/lite/packages/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/lite/packages/firestore/src/local/index_manager.d.ts +52 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +11 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +121 -7
- package/dist/lite/packages/firestore/src/local/local_serializer.d.ts +1 -1
- package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +11 -0
- package/dist/lite/packages/firestore/src/local/remote_document_change_buffer.d.ts +3 -12
- package/dist/lite/packages/firestore/src/model/document.d.ts +7 -0
- package/dist/lite/packages/firestore/src/model/document_key.d.ts +1 -0
- package/dist/lite/packages/firestore/src/model/field_index.d.ts +156 -0
- package/dist/lite/packages/firestore/src/model/values.d.ts +7 -0
- package/dist/lite/packages/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +1 -1
- package/dist/lite/packages/firestore/test/unit/model/field_index.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/unit/model/target.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/util/helpers.d.ts +8 -2
- package/dist/lite/private.d.ts +9 -2
- package/dist/packages/firestore/dist/index.esm2017.d.ts +214 -191
- package/dist/packages/firestore/src/api/database.d.ts +14 -9
- package/dist/packages/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
- package/dist/packages/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/packages/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/packages/firestore/src/api.d.ts +2 -1
- package/dist/packages/firestore/src/core/database_info.d.ts +1 -0
- package/dist/packages/firestore/src/core/firestore_client.d.ts +2 -0
- package/dist/packages/firestore/src/core/target.d.ts +34 -5
- package/dist/packages/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/packages/firestore/src/local/index_manager.d.ts +52 -0
- package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +11 -0
- package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +121 -7
- package/dist/packages/firestore/src/local/local_serializer.d.ts +1 -1
- package/dist/packages/firestore/src/local/memory_index_manager.d.ts +11 -0
- package/dist/packages/firestore/src/local/remote_document_change_buffer.d.ts +3 -12
- package/dist/packages/firestore/src/model/document.d.ts +7 -0
- package/dist/packages/firestore/src/model/document_key.d.ts +1 -0
- package/dist/packages/firestore/src/model/field_index.d.ts +156 -0
- package/dist/packages/firestore/src/model/values.d.ts +7 -0
- package/dist/packages/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +1 -1
- package/dist/packages/firestore/test/unit/model/field_index.test.d.ts +17 -0
- package/dist/packages/firestore/test/unit/model/target.test.d.ts +17 -0
- package/dist/packages/firestore/test/util/helpers.d.ts +8 -2
- package/dist/private.d.ts +205 -25
- package/package.json +10 -10
|
@@ -63,7 +63,7 @@ l.MOCK_USER = new l("mock-user");
|
|
|
63
63
|
* See the License for the specific language governing permissions and
|
|
64
64
|
* limitations under the License.
|
|
65
65
|
*/
|
|
66
|
-
let f = "9.6.
|
|
66
|
+
let f = "9.6.5-canary.0482aa5b7";
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* @license
|
|
@@ -190,14 +190,14 @@ function p(t, ...n) {
|
|
|
190
190
|
* given message if it did.
|
|
191
191
|
*
|
|
192
192
|
* Messages are stripped in production builds.
|
|
193
|
-
*/ function
|
|
193
|
+
*/ function b(t, n) {
|
|
194
194
|
t || g();
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
/**
|
|
198
198
|
* Casts `obj` to `T`. In non-production builds, verifies that `obj` is an
|
|
199
199
|
* instance of `T` before casting.
|
|
200
|
-
*/ function
|
|
200
|
+
*/ function v(t,
|
|
201
201
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
202
202
|
n) {
|
|
203
203
|
return t;
|
|
@@ -332,7 +332,7 @@ n) {
|
|
|
332
332
|
}));
|
|
333
333
|
}
|
|
334
334
|
getToken() {
|
|
335
|
-
return this.auth ? this.auth.getToken().then((t => t ? (
|
|
335
|
+
return this.auth ? this.auth.getToken().then((t => t ? (b("string" == typeof t.accessToken),
|
|
336
336
|
new j(t.accessToken, new l(this.auth.getUid()))) : null)) : Promise.resolve(null);
|
|
337
337
|
}
|
|
338
338
|
invalidateToken() {}
|
|
@@ -386,7 +386,7 @@ class W {
|
|
|
386
386
|
}));
|
|
387
387
|
}
|
|
388
388
|
getToken() {
|
|
389
|
-
return this.appCheck ? this.appCheck.getToken().then((t => t ? (
|
|
389
|
+
return this.appCheck ? this.appCheck.getToken().then((t => t ? (b("string" == typeof t.token),
|
|
390
390
|
new W(t.token)) : null)) : Promise.resolve(null);
|
|
391
391
|
}
|
|
392
392
|
invalidateToken() {}
|
|
@@ -447,6 +447,9 @@ class K {
|
|
|
447
447
|
constructor(t, n) {
|
|
448
448
|
this.projectId = t, this.database = n || "(default)";
|
|
449
449
|
}
|
|
450
|
+
static empty() {
|
|
451
|
+
return new K("", "");
|
|
452
|
+
}
|
|
450
453
|
get isDefaultDatabase() {
|
|
451
454
|
return "(default)" === this.database;
|
|
452
455
|
}
|
|
@@ -672,6 +675,9 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
672
675
|
static fromName(t) {
|
|
673
676
|
return new nt(X.fromString(t).popFirst(5));
|
|
674
677
|
}
|
|
678
|
+
static empty() {
|
|
679
|
+
return new nt(X.emptyPath());
|
|
680
|
+
}
|
|
675
681
|
/** Returns true if the document is in the specified collectionId. */ hasCollectionId(t) {
|
|
676
682
|
return this.path.length >= 2 && this.path.get(this.path.length - 2) === t;
|
|
677
683
|
}
|
|
@@ -1305,15 +1311,15 @@ class gt {
|
|
|
1305
1311
|
/**
|
|
1306
1312
|
* A version of a document in Firestore. This corresponds to the version
|
|
1307
1313
|
* timestamp, such as update_time or read_time.
|
|
1308
|
-
*/ class
|
|
1314
|
+
*/ class bt {
|
|
1309
1315
|
constructor(t) {
|
|
1310
1316
|
this.timestamp = t;
|
|
1311
1317
|
}
|
|
1312
1318
|
static fromTimestamp(t) {
|
|
1313
|
-
return new
|
|
1319
|
+
return new bt(t);
|
|
1314
1320
|
}
|
|
1315
1321
|
static min() {
|
|
1316
|
-
return new
|
|
1322
|
+
return new bt(new gt(0, 0));
|
|
1317
1323
|
}
|
|
1318
1324
|
compareTo(t) {
|
|
1319
1325
|
return this.timestamp._compareTo(t.timestamp);
|
|
@@ -1348,7 +1354,7 @@ class gt {
|
|
|
1348
1354
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1349
1355
|
* See the License for the specific language governing permissions and
|
|
1350
1356
|
* limitations under the License.
|
|
1351
|
-
*/ function
|
|
1357
|
+
*/ function vt(t) {
|
|
1352
1358
|
let n = 0;
|
|
1353
1359
|
for (const e in t) Object.prototype.hasOwnProperty.call(t, e) && n++;
|
|
1354
1360
|
return n;
|
|
@@ -1534,13 +1540,13 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1534
1540
|
// The json interface (for the browser) will return an iso timestamp string,
|
|
1535
1541
|
// while the proto js library (for node) will return a
|
|
1536
1542
|
// google.protobuf.Timestamp instance.
|
|
1537
|
-
if (
|
|
1543
|
+
if (b(!!t), "string" == typeof t) {
|
|
1538
1544
|
// The date string can have higher precision (nanos) than the Date class
|
|
1539
1545
|
// (millis), so we do some custom parsing here.
|
|
1540
1546
|
// Parse the nanos right out of the string.
|
|
1541
1547
|
let n = 0;
|
|
1542
1548
|
const e = At.exec(t);
|
|
1543
|
-
if (
|
|
1549
|
+
if (b(!!e), e[1]) {
|
|
1544
1550
|
// Pad the fraction out to 9 digits (nanos).
|
|
1545
1551
|
let t = e[1];
|
|
1546
1552
|
t = (t + "000000000").substr(0, 9), n = Number(t);
|
|
@@ -1700,7 +1706,7 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1700
1706
|
case 10 /* ObjectValue */ :
|
|
1701
1707
|
return function(t, n) {
|
|
1702
1708
|
const e = t.mapValue.fields || {}, r = n.mapValue.fields || {};
|
|
1703
|
-
if (
|
|
1709
|
+
if (vt(e) !== vt(r)) return !1;
|
|
1704
1710
|
for (const t in e) if (e.hasOwnProperty(t) && (void 0 === r[t] || !Ft(e[t], r[t]))) return !1;
|
|
1705
1711
|
return !0;
|
|
1706
1712
|
}
|
|
@@ -1989,30 +1995,31 @@ function Ct(t, n) {
|
|
|
1989
1995
|
* applied, `isValidDocument()` returns false and the document should be removed
|
|
1990
1996
|
* from all views.
|
|
1991
1997
|
*/ class zt {
|
|
1992
|
-
constructor(t, n, e, r, s) {
|
|
1993
|
-
this.key = t, this.documentType = n, this.version = e, this.
|
|
1998
|
+
constructor(t, n, e, r, s, i) {
|
|
1999
|
+
this.key = t, this.documentType = n, this.version = e, this.readTime = r, this.data = s,
|
|
2000
|
+
this.documentState = i;
|
|
1994
2001
|
}
|
|
1995
2002
|
/**
|
|
1996
2003
|
* Creates a document with no known version or data, but which can serve as
|
|
1997
2004
|
* base document for mutations.
|
|
1998
2005
|
*/ static newInvalidDocument(t) {
|
|
1999
|
-
return new zt(t, 0 /* INVALID */ ,
|
|
2006
|
+
return new zt(t, 0 /* INVALID */ , bt.min(), bt.min(), Bt.empty(), 0 /* SYNCED */);
|
|
2000
2007
|
}
|
|
2001
2008
|
/**
|
|
2002
2009
|
* Creates a new document that is known to exist with the given data at the
|
|
2003
2010
|
* given version.
|
|
2004
2011
|
*/ static newFoundDocument(t, n, e) {
|
|
2005
|
-
return new zt(t, 1 /* FOUND_DOCUMENT */ , n, e, 0 /* SYNCED */);
|
|
2012
|
+
return new zt(t, 1 /* FOUND_DOCUMENT */ , n, bt.min(), e, 0 /* SYNCED */);
|
|
2006
2013
|
}
|
|
2007
2014
|
/** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, n) {
|
|
2008
|
-
return new zt(t, 2 /* NO_DOCUMENT */ , n, Bt.empty(), 0 /* SYNCED */);
|
|
2015
|
+
return new zt(t, 2 /* NO_DOCUMENT */ , n, bt.min(), Bt.empty(), 0 /* SYNCED */);
|
|
2009
2016
|
}
|
|
2010
2017
|
/**
|
|
2011
2018
|
* Creates a new document that is known to exist at the given version but
|
|
2012
2019
|
* whose data is not known (e.g. a document that was updated without a known
|
|
2013
2020
|
* base document).
|
|
2014
2021
|
*/ static newUnknownDocument(t, n) {
|
|
2015
|
-
return new zt(t, 3 /* UNKNOWN_DOCUMENT */ , n, Bt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
2022
|
+
return new zt(t, 3 /* UNKNOWN_DOCUMENT */ , n, bt.min(), Bt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
2016
2023
|
}
|
|
2017
2024
|
/**
|
|
2018
2025
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -2042,6 +2049,9 @@ function Ct(t, n) {
|
|
|
2042
2049
|
setHasLocalMutations() {
|
|
2043
2050
|
return this.documentState = 1 /* HAS_LOCAL_MUTATIONS */ , this;
|
|
2044
2051
|
}
|
|
2052
|
+
setReadTime(t) {
|
|
2053
|
+
return this.readTime = t, this;
|
|
2054
|
+
}
|
|
2045
2055
|
get hasLocalMutations() {
|
|
2046
2056
|
return 1 /* HAS_LOCAL_MUTATIONS */ === this.documentState;
|
|
2047
2057
|
}
|
|
@@ -2067,7 +2077,7 @@ function Ct(t, n) {
|
|
|
2067
2077
|
return t instanceof zt && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
|
|
2068
2078
|
}
|
|
2069
2079
|
mutableCopy() {
|
|
2070
|
-
return new zt(this.key, this.documentType, this.version, this.data.clone(), this.documentState);
|
|
2080
|
+
return new zt(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState);
|
|
2071
2081
|
}
|
|
2072
2082
|
toString() {
|
|
2073
2083
|
return `Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`;
|
|
@@ -2248,7 +2258,7 @@ function Jt(t, n) {
|
|
|
2248
2258
|
* just after the provided values.
|
|
2249
2259
|
*/ class en {
|
|
2250
2260
|
constructor(t, n) {
|
|
2251
|
-
this.position = t, this.
|
|
2261
|
+
this.position = t, this.inclusive = n;
|
|
2252
2262
|
}
|
|
2253
2263
|
}
|
|
2254
2264
|
|
|
@@ -2267,7 +2277,7 @@ function sn(t, n) {
|
|
|
2267
2277
|
function on(t, n) {
|
|
2268
2278
|
if (null === t) return null === n;
|
|
2269
2279
|
if (null === n) return !1;
|
|
2270
|
-
if (t.
|
|
2280
|
+
if (t.inclusive !== n.inclusive || t.position.length !== n.position.length) return !1;
|
|
2271
2281
|
for (let e = 0; e < t.position.length; e++) {
|
|
2272
2282
|
if (!Ft(t.position[e], n.position[e])) return !1;
|
|
2273
2283
|
}
|
|
@@ -2339,7 +2349,7 @@ function ln(t) {
|
|
|
2339
2349
|
* which can be different from the order by constraints the user provided (e.g.
|
|
2340
2350
|
* the SDK and backend always orders by `__name__`).
|
|
2341
2351
|
*/ function fn(t) {
|
|
2342
|
-
const n =
|
|
2352
|
+
const n = v(t);
|
|
2343
2353
|
if (null === n.$) {
|
|
2344
2354
|
n.$ = [];
|
|
2345
2355
|
const t = hn(n), e = an(n);
|
|
@@ -2364,7 +2374,7 @@ function ln(t) {
|
|
|
2364
2374
|
/**
|
|
2365
2375
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
2366
2376
|
*/ function dn(t) {
|
|
2367
|
-
const n =
|
|
2377
|
+
const n = v(t);
|
|
2368
2378
|
if (!n.S) if ("F" /* First */ === n.limitType) n.S = Qt(n.path, n.collectionGroup, fn(n), n.filters, n.limit, n.startAt, n.endAt); else {
|
|
2369
2379
|
// Flip the orderBy directions since we want the last results
|
|
2370
2380
|
const t = [];
|
|
@@ -2373,7 +2383,7 @@ function ln(t) {
|
|
|
2373
2383
|
t.push(new rn(e.field, n));
|
|
2374
2384
|
}
|
|
2375
2385
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
2376
|
-
const e = n.endAt ? new en(n.endAt.position, !n.endAt.
|
|
2386
|
+
const e = n.endAt ? new en(n.endAt.position, !n.endAt.inclusive) : null, r = n.startAt ? new en(n.startAt.position, !n.startAt.inclusive) : null;
|
|
2377
2387
|
// Now return as a LimitType.First query.
|
|
2378
2388
|
n.S = Qt(n.path, n.collectionGroup, t, n.filters, n.limit, e, r);
|
|
2379
2389
|
}
|
|
@@ -2490,7 +2500,7 @@ function mn(t, n) {
|
|
|
2490
2500
|
* transforms. Converts all field values to integers or doubles, but unlike the
|
|
2491
2501
|
* backend does not cap integer values at 2^63. Instead, JavaScript number
|
|
2492
2502
|
* arithmetic is used and precision loss can occur for values greater than 2^53.
|
|
2493
|
-
*/ class
|
|
2503
|
+
*/ class bn extends pn {
|
|
2494
2504
|
constructor(t, n) {
|
|
2495
2505
|
super(), this.q = t, this.O = n;
|
|
2496
2506
|
}
|
|
@@ -2512,7 +2522,7 @@ function mn(t, n) {
|
|
|
2512
2522
|
* See the License for the specific language governing permissions and
|
|
2513
2523
|
* limitations under the License.
|
|
2514
2524
|
*/
|
|
2515
|
-
/** A field path and the TransformOperation to perform upon it. */ class
|
|
2525
|
+
/** A field path and the TransformOperation to perform upon it. */ class vn {
|
|
2516
2526
|
constructor(t, n) {
|
|
2517
2527
|
this.field = t, this.transform = n;
|
|
2518
2528
|
}
|
|
@@ -2727,7 +2737,7 @@ function Fn(t, n) {
|
|
|
2727
2737
|
}
|
|
2728
2738
|
|
|
2729
2739
|
function xn(t) {
|
|
2730
|
-
return
|
|
2740
|
+
return b(!!t), bt.fromTimestamp(function(t) {
|
|
2731
2741
|
const n = Rt(t);
|
|
2732
2742
|
return new gt(n.seconds, n.nanos);
|
|
2733
2743
|
}(t));
|
|
@@ -2746,11 +2756,11 @@ function On(t, n) {
|
|
|
2746
2756
|
function Cn(t, n) {
|
|
2747
2757
|
const e = function(t) {
|
|
2748
2758
|
const n = X.fromString(t);
|
|
2749
|
-
return
|
|
2759
|
+
return b(Yn(n)), n;
|
|
2750
2760
|
}(n);
|
|
2751
2761
|
if (e.get(1) !== t.databaseId.projectId) throw new U(A, "Tried to deserialize key from different project: " + e.get(1) + " vs " + t.databaseId.projectId);
|
|
2752
2762
|
if (e.get(3) !== t.databaseId.database) throw new U(A, "Tried to deserialize key from different database: " + e.get(3) + " vs " + t.databaseId.database);
|
|
2753
|
-
return new nt((
|
|
2763
|
+
return new nt((b((r = e).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
|
|
2754
2764
|
var r;
|
|
2755
2765
|
/** Creates a Document proto from key and fields (but no create/update time) */}
|
|
2756
2766
|
|
|
@@ -2771,7 +2781,7 @@ function kn(t, n, e) {
|
|
|
2771
2781
|
|
|
2772
2782
|
function jn(t, n) {
|
|
2773
2783
|
return "found" in n ? function(t, n) {
|
|
2774
|
-
|
|
2784
|
+
b(!!n.found), n.found.name, n.found.updateTime;
|
|
2775
2785
|
const e = Cn(t, n.found.name), r = xn(n.found.updateTime), s = new Bt({
|
|
2776
2786
|
mapValue: {
|
|
2777
2787
|
fields: n.found.fields
|
|
@@ -2779,7 +2789,7 @@ function jn(t, n) {
|
|
|
2779
2789
|
});
|
|
2780
2790
|
return zt.newFoundDocument(e, r, s);
|
|
2781
2791
|
}(t, n) : "missing" in n ? function(t, n) {
|
|
2782
|
-
|
|
2792
|
+
b(!!n.missing), b(!!n.readTime);
|
|
2783
2793
|
const e = Cn(t, n.missing), r = xn(n.readTime);
|
|
2784
2794
|
return zt.newNoDocument(e, r);
|
|
2785
2795
|
}(t, n) : g();
|
|
@@ -2793,7 +2803,7 @@ function Mn(t, n) {
|
|
|
2793
2803
|
delete: On(t, n.key)
|
|
2794
2804
|
}; else if (n instanceof An) e = {
|
|
2795
2805
|
update: kn(t, n.key, n.data),
|
|
2796
|
-
updateMask:
|
|
2806
|
+
updateMask: Wn(n.fieldMask)
|
|
2797
2807
|
}; else {
|
|
2798
2808
|
if (!(n instanceof Pn)) return g();
|
|
2799
2809
|
e = {
|
|
@@ -2818,7 +2828,7 @@ function Mn(t, n) {
|
|
|
2818
2828
|
values: e.elements
|
|
2819
2829
|
}
|
|
2820
2830
|
};
|
|
2821
|
-
if (e instanceof
|
|
2831
|
+
if (e instanceof bn) return {
|
|
2822
2832
|
fieldPath: n.field.canonicalString(),
|
|
2823
2833
|
increment: e.O
|
|
2824
2834
|
};
|
|
@@ -2851,34 +2861,34 @@ function Bn(t, n) {
|
|
|
2851
2861
|
if ("==" /* EQUAL */ === t.op) {
|
|
2852
2862
|
if (kt(t.value)) return {
|
|
2853
2863
|
unaryFilter: {
|
|
2854
|
-
field:
|
|
2864
|
+
field: Qn(t.field),
|
|
2855
2865
|
op: "IS_NAN"
|
|
2856
2866
|
}
|
|
2857
2867
|
};
|
|
2858
2868
|
if (Ut(t.value)) return {
|
|
2859
2869
|
unaryFilter: {
|
|
2860
|
-
field:
|
|
2870
|
+
field: Qn(t.field),
|
|
2861
2871
|
op: "IS_NULL"
|
|
2862
2872
|
}
|
|
2863
2873
|
};
|
|
2864
2874
|
} else if ("!=" /* NOT_EQUAL */ === t.op) {
|
|
2865
2875
|
if (kt(t.value)) return {
|
|
2866
2876
|
unaryFilter: {
|
|
2867
|
-
field:
|
|
2877
|
+
field: Qn(t.field),
|
|
2868
2878
|
op: "IS_NOT_NAN"
|
|
2869
2879
|
}
|
|
2870
2880
|
};
|
|
2871
2881
|
if (Ut(t.value)) return {
|
|
2872
2882
|
unaryFilter: {
|
|
2873
|
-
field:
|
|
2883
|
+
field: Qn(t.field),
|
|
2874
2884
|
op: "IS_NOT_NULL"
|
|
2875
2885
|
}
|
|
2876
2886
|
};
|
|
2877
2887
|
}
|
|
2878
2888
|
return {
|
|
2879
2889
|
fieldFilter: {
|
|
2880
|
-
field:
|
|
2881
|
-
op:
|
|
2890
|
+
field: Qn(t.field),
|
|
2891
|
+
op: Gn(t.op),
|
|
2882
2892
|
value: t.value
|
|
2883
2893
|
}
|
|
2884
2894
|
};
|
|
@@ -2898,8 +2908,8 @@ function Bn(t, n) {
|
|
|
2898
2908
|
// visible for testing
|
|
2899
2909
|
function(t) {
|
|
2900
2910
|
return {
|
|
2901
|
-
field:
|
|
2902
|
-
direction:
|
|
2911
|
+
field: Qn(t.field),
|
|
2912
|
+
direction: zn(t.dir)
|
|
2903
2913
|
};
|
|
2904
2914
|
}(t)));
|
|
2905
2915
|
}(n.orderBy);
|
|
@@ -2909,41 +2919,43 @@ function Bn(t, n) {
|
|
|
2909
2919
|
value: n
|
|
2910
2920
|
};
|
|
2911
2921
|
}(t, n.limit);
|
|
2912
|
-
|
|
2913
|
-
|
|
2922
|
+
var u;
|
|
2923
|
+
return null !== o && (e.structuredQuery.limit = o), n.startAt && (e.structuredQuery.startAt = {
|
|
2924
|
+
before: (u = n.startAt).inclusive,
|
|
2925
|
+
values: u.position
|
|
2926
|
+
}), n.endAt && (e.structuredQuery.endAt = function(t) {
|
|
2927
|
+
return {
|
|
2928
|
+
before: !t.inclusive,
|
|
2929
|
+
values: t.position
|
|
2930
|
+
};
|
|
2931
|
+
}
|
|
2932
|
+
// visible for testing
|
|
2933
|
+
(n.endAt)), e;
|
|
2914
2934
|
}
|
|
2915
2935
|
|
|
2916
2936
|
function zn(t) {
|
|
2917
|
-
return {
|
|
2918
|
-
before: t.before,
|
|
2919
|
-
values: t.position
|
|
2920
|
-
};
|
|
2921
|
-
}
|
|
2922
|
-
|
|
2923
|
-
// visible for testing
|
|
2924
|
-
function Gn(t) {
|
|
2925
2937
|
return Vn[t];
|
|
2926
2938
|
}
|
|
2927
2939
|
|
|
2928
2940
|
// visible for testing
|
|
2929
|
-
function
|
|
2941
|
+
function Gn(t) {
|
|
2930
2942
|
return Dn[t];
|
|
2931
2943
|
}
|
|
2932
2944
|
|
|
2933
|
-
function
|
|
2945
|
+
function Qn(t) {
|
|
2934
2946
|
return {
|
|
2935
2947
|
fieldPath: t.canonicalString()
|
|
2936
2948
|
};
|
|
2937
2949
|
}
|
|
2938
2950
|
|
|
2939
|
-
function
|
|
2951
|
+
function Wn(t) {
|
|
2940
2952
|
const n = [];
|
|
2941
2953
|
return t.fields.forEach((t => n.push(t.canonicalString()))), {
|
|
2942
2954
|
fieldPaths: n
|
|
2943
2955
|
};
|
|
2944
2956
|
}
|
|
2945
2957
|
|
|
2946
|
-
function
|
|
2958
|
+
function Yn(t) {
|
|
2947
2959
|
// Resource names have at least 4 components (project ID, database ID)
|
|
2948
2960
|
return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
|
|
2949
2961
|
}
|
|
@@ -2963,7 +2975,7 @@ function Hn(t) {
|
|
|
2963
2975
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2964
2976
|
* See the License for the specific language governing permissions and
|
|
2965
2977
|
* limitations under the License.
|
|
2966
|
-
*/ function
|
|
2978
|
+
*/ function Hn(t) {
|
|
2967
2979
|
return new Nn(t, /* useProto3Json= */ !0);
|
|
2968
2980
|
}
|
|
2969
2981
|
|
|
@@ -2992,7 +3004,7 @@ function Hn(t) {
|
|
|
2992
3004
|
* base delay. This prevents clients from accidentally synchronizing their
|
|
2993
3005
|
* delays causing spikes of load to the backend.
|
|
2994
3006
|
*/
|
|
2995
|
-
class
|
|
3007
|
+
class Kn {
|
|
2996
3008
|
constructor(
|
|
2997
3009
|
/**
|
|
2998
3010
|
* The AsyncQueue to run backoff operations on.
|
|
@@ -3090,7 +3102,7 @@ class Jn {
|
|
|
3090
3102
|
* An implementation of Datastore that exposes additional state for internal
|
|
3091
3103
|
* consumption.
|
|
3092
3104
|
*/
|
|
3093
|
-
class
|
|
3105
|
+
class Jn extends class {} {
|
|
3094
3106
|
constructor(t, n, e, r) {
|
|
3095
3107
|
super(), this.authCredentials = t, this.appCheckCredentials = n, this.K = e, this.q = r,
|
|
3096
3108
|
this.J = !1;
|
|
@@ -3117,15 +3129,15 @@ class Xn extends class {} {
|
|
|
3117
3129
|
|
|
3118
3130
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
3119
3131
|
// firestore-exp client.
|
|
3120
|
-
async function
|
|
3121
|
-
const e =
|
|
3132
|
+
async function Xn(t, n) {
|
|
3133
|
+
const e = v(t), r = Un(e.q) + "/documents", s = {
|
|
3122
3134
|
writes: n.map((t => Mn(e.q, t)))
|
|
3123
3135
|
};
|
|
3124
3136
|
await e.m("Commit", r, s);
|
|
3125
3137
|
}
|
|
3126
3138
|
|
|
3127
|
-
async function
|
|
3128
|
-
const e =
|
|
3139
|
+
async function Zn(t, n) {
|
|
3140
|
+
const e = v(t), r = Un(e.q) + "/documents", s = {
|
|
3129
3141
|
documents: n.map((t => On(e.q, t)))
|
|
3130
3142
|
}, i = await e.T("BatchGetDocuments", r, s), o = new Map;
|
|
3131
3143
|
i.forEach((t => {
|
|
@@ -3135,12 +3147,12 @@ async function te(t, n) {
|
|
|
3135
3147
|
const u = [];
|
|
3136
3148
|
return n.forEach((t => {
|
|
3137
3149
|
const n = o.get(t.toString());
|
|
3138
|
-
|
|
3150
|
+
b(!!n), u.push(n);
|
|
3139
3151
|
})), u;
|
|
3140
3152
|
}
|
|
3141
3153
|
|
|
3142
|
-
async function
|
|
3143
|
-
const e =
|
|
3154
|
+
async function te(t, n) {
|
|
3155
|
+
const e = v(t), r = Bn(e.q, dn(n));
|
|
3144
3156
|
return (await e.T("RunQuery", r.parent, {
|
|
3145
3157
|
structuredQuery: r.structuredQuery
|
|
3146
3158
|
})).filter((t => !!t.document)).map((t => function(t, n, e) {
|
|
@@ -3168,7 +3180,7 @@ async function ne(t, n) {
|
|
|
3168
3180
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3169
3181
|
* See the License for the specific language governing permissions and
|
|
3170
3182
|
* limitations under the License.
|
|
3171
|
-
*/ const
|
|
3183
|
+
*/ const ne = new Map;
|
|
3172
3184
|
|
|
3173
3185
|
/**
|
|
3174
3186
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -3179,17 +3191,17 @@ async function ne(t, n) {
|
|
|
3179
3191
|
* instance. Callers must invoke removeComponents() when the Firestore
|
|
3180
3192
|
* instance is terminated.
|
|
3181
3193
|
*/
|
|
3182
|
-
function
|
|
3194
|
+
function ee(t) {
|
|
3183
3195
|
if (t._terminated) throw new U(S, "The client has already been terminated.");
|
|
3184
|
-
if (!
|
|
3196
|
+
if (!ne.has(t)) {
|
|
3185
3197
|
m("ComponentProvider", "Initializing Datastore");
|
|
3186
3198
|
const i = function(t) {
|
|
3187
3199
|
return new wt(t, fetch.bind(null));
|
|
3188
3200
|
}((n = t._databaseId, e = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
|
|
3189
|
-
new H(n, e, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o =
|
|
3190
|
-
return new
|
|
3201
|
+
new H(n, e, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = Hn(t._databaseId), u = function(t, n, e, r) {
|
|
3202
|
+
return new Jn(t, n, e, r);
|
|
3191
3203
|
}(t._authCredentials, t._appCheckCredentials, i, o);
|
|
3192
|
-
|
|
3204
|
+
ne.set(t, u);
|
|
3193
3205
|
}
|
|
3194
3206
|
var n, e, r, s;
|
|
3195
3207
|
/**
|
|
@@ -3207,7 +3219,7 @@ function re(t) {
|
|
|
3207
3219
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3208
3220
|
* See the License for the specific language governing permissions and
|
|
3209
3221
|
* limitations under the License.
|
|
3210
|
-
*/ return
|
|
3222
|
+
*/ return ne.get(t);
|
|
3211
3223
|
}
|
|
3212
3224
|
|
|
3213
3225
|
/**
|
|
@@ -3219,7 +3231,7 @@ function re(t) {
|
|
|
3219
3231
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
3220
3232
|
* defaults can be supplied and the value can be checked for equality.
|
|
3221
3233
|
*/
|
|
3222
|
-
class
|
|
3234
|
+
class re {
|
|
3223
3235
|
constructor(t) {
|
|
3224
3236
|
var n;
|
|
3225
3237
|
if (void 0 === t.host) {
|
|
@@ -3261,14 +3273,14 @@ class se {
|
|
|
3261
3273
|
* The Cloud Firestore service interface.
|
|
3262
3274
|
*
|
|
3263
3275
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
3264
|
-
*/ class
|
|
3276
|
+
*/ class se {
|
|
3265
3277
|
/** @hideconstructor */
|
|
3266
3278
|
constructor(t, n, e) {
|
|
3267
3279
|
this._authCredentials = n, this._appCheckCredentials = e,
|
|
3268
3280
|
/**
|
|
3269
3281
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
3270
3282
|
*/
|
|
3271
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
3283
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new re({}),
|
|
3272
3284
|
this._settingsFrozen = !1, t instanceof K ? this._databaseId = t : (this._app = t,
|
|
3273
3285
|
this._databaseId = function(t) {
|
|
3274
3286
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(A, '"projectId" not provided in firebase.initializeApp.');
|
|
@@ -3301,13 +3313,13 @@ class se {
|
|
|
3301
3313
|
}
|
|
3302
3314
|
_setSettings(t) {
|
|
3303
3315
|
if (this._settingsFrozen) throw new U(S, "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.");
|
|
3304
|
-
this._settings = new
|
|
3316
|
+
this._settings = new re(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
3305
3317
|
if (!t) return new M;
|
|
3306
3318
|
switch (t.type) {
|
|
3307
3319
|
case "gapi":
|
|
3308
3320
|
const n = t.client;
|
|
3309
3321
|
// Make sure this really is a Gapi client.
|
|
3310
|
-
return
|
|
3322
|
+
return b(!("object" != typeof n || null === n || !n.auth || !n.auth.getAuthHeaderValueForFirstParty)),
|
|
3311
3323
|
new Q(n, t.sessionIndex || "0", t.iamToken || null);
|
|
3312
3324
|
|
|
3313
3325
|
case "provider":
|
|
@@ -3342,13 +3354,13 @@ class se {
|
|
|
3342
3354
|
* Only ever called once.
|
|
3343
3355
|
*/ _terminate() {
|
|
3344
3356
|
return function(t) {
|
|
3345
|
-
const n =
|
|
3346
|
-
n && (m("ComponentProvider", "Removing Datastore"),
|
|
3357
|
+
const n = ne.get(t);
|
|
3358
|
+
n && (m("ComponentProvider", "Removing Datastore"), ne.delete(t), n.terminate());
|
|
3347
3359
|
}(this), Promise.resolve();
|
|
3348
3360
|
}
|
|
3349
3361
|
}
|
|
3350
3362
|
|
|
3351
|
-
function
|
|
3363
|
+
function ie(t, n) {
|
|
3352
3364
|
const e = _getProvider(t, "firestore/lite");
|
|
3353
3365
|
if (e.isInitialized()) throw new U(S, "Firestore can only be initialized once per app.");
|
|
3354
3366
|
return e.initialize({
|
|
@@ -3364,7 +3376,7 @@ function oe(t, n) {
|
|
|
3364
3376
|
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
|
|
3365
3377
|
* instance is associated with.
|
|
3366
3378
|
* @returns The `Firestore` instance of the provided app.
|
|
3367
|
-
*/ function
|
|
3379
|
+
*/ function oe(n = getApp()) {
|
|
3368
3380
|
return _getProvider(n, "firestore/lite").getImmediate();
|
|
3369
3381
|
}
|
|
3370
3382
|
|
|
@@ -3380,9 +3392,9 @@ function oe(t, n) {
|
|
|
3380
3392
|
* @param port - the emulator port (ex: 9000).
|
|
3381
3393
|
* @param options.mockUserToken - the mock auth token to use for unit testing
|
|
3382
3394
|
* Security Rules.
|
|
3383
|
-
*/ function
|
|
3395
|
+
*/ function ue(t, n, e, r = {}) {
|
|
3384
3396
|
var s;
|
|
3385
|
-
const i = (t = ot(t,
|
|
3397
|
+
const i = (t = ot(t, se))._getSettings();
|
|
3386
3398
|
if ("firestore.googleapis.com" !== i.host && i.host !== n && y("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
3387
3399
|
t._setSettings(Object.assign(Object.assign({}, i), {
|
|
3388
3400
|
host: `${n}:${e}`,
|
|
@@ -3420,8 +3432,8 @@ function oe(t, n) {
|
|
|
3420
3432
|
* @param firestore - The `Firestore` instance to terminate.
|
|
3421
3433
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
3422
3434
|
* terminated.
|
|
3423
|
-
*/ function
|
|
3424
|
-
return t = ot(t,
|
|
3435
|
+
*/ function ce(t) {
|
|
3436
|
+
return t = ot(t, se), _removeServiceInstance(t.app, "firestore/lite"), t._delete();
|
|
3425
3437
|
}
|
|
3426
3438
|
|
|
3427
3439
|
/**
|
|
@@ -3461,7 +3473,7 @@ function oe(t, n) {
|
|
|
3461
3473
|
* and can be used to write, read, or listen to the location. The document at
|
|
3462
3474
|
* the referenced location may or may not exist.
|
|
3463
3475
|
*/
|
|
3464
|
-
class
|
|
3476
|
+
class ae {
|
|
3465
3477
|
/** @hideconstructor */
|
|
3466
3478
|
constructor(t,
|
|
3467
3479
|
/**
|
|
@@ -3489,17 +3501,17 @@ class he {
|
|
|
3489
3501
|
/**
|
|
3490
3502
|
* The collection this `DocumentReference` belongs to.
|
|
3491
3503
|
*/ get parent() {
|
|
3492
|
-
return new
|
|
3504
|
+
return new le(this.firestore, this.converter, this._key.path.popLast());
|
|
3493
3505
|
}
|
|
3494
3506
|
withConverter(t) {
|
|
3495
|
-
return new
|
|
3507
|
+
return new ae(this.firestore, t, this._key);
|
|
3496
3508
|
}
|
|
3497
3509
|
}
|
|
3498
3510
|
|
|
3499
3511
|
/**
|
|
3500
3512
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
3501
3513
|
* construct refined `Query` objects by adding filters and ordering.
|
|
3502
|
-
*/ class
|
|
3514
|
+
*/ class he {
|
|
3503
3515
|
// This is the lite version of the Query class in the main SDK.
|
|
3504
3516
|
/** @hideconstructor protected */
|
|
3505
3517
|
constructor(t,
|
|
@@ -3512,14 +3524,14 @@ class he {
|
|
|
3512
3524
|
this.type = "query", this.firestore = t;
|
|
3513
3525
|
}
|
|
3514
3526
|
withConverter(t) {
|
|
3515
|
-
return new
|
|
3527
|
+
return new he(this.firestore, t, this._query);
|
|
3516
3528
|
}
|
|
3517
3529
|
}
|
|
3518
3530
|
|
|
3519
3531
|
/**
|
|
3520
3532
|
* A `CollectionReference` object can be used for adding documents, getting
|
|
3521
3533
|
* document references, and querying for documents (using {@link query}).
|
|
3522
|
-
*/ class
|
|
3534
|
+
*/ class le extends he {
|
|
3523
3535
|
/** @hideconstructor */
|
|
3524
3536
|
constructor(t, n, e) {
|
|
3525
3537
|
super(t, n, new un(e)), this._path = e,
|
|
@@ -3540,23 +3552,23 @@ class he {
|
|
|
3540
3552
|
* subcollection. If this isn't a subcollection, the reference is null.
|
|
3541
3553
|
*/ get parent() {
|
|
3542
3554
|
const t = this._path.popLast();
|
|
3543
|
-
return t.isEmpty() ? null : new
|
|
3555
|
+
return t.isEmpty() ? null : new ae(this.firestore,
|
|
3544
3556
|
/* converter= */ null, new nt(t));
|
|
3545
3557
|
}
|
|
3546
3558
|
withConverter(t) {
|
|
3547
|
-
return new
|
|
3559
|
+
return new le(this.firestore, t, this._path);
|
|
3548
3560
|
}
|
|
3549
3561
|
}
|
|
3550
3562
|
|
|
3551
|
-
function
|
|
3552
|
-
if (t = getModularInstance(t), et("collection", "path", n), t instanceof
|
|
3563
|
+
function fe(t, n, ...e) {
|
|
3564
|
+
if (t = getModularInstance(t), et("collection", "path", n), t instanceof se) {
|
|
3553
3565
|
const r = X.fromString(n, ...e);
|
|
3554
|
-
return st(r), new
|
|
3566
|
+
return st(r), new le(t, /* converter= */ null, r);
|
|
3555
3567
|
}
|
|
3556
3568
|
{
|
|
3557
|
-
if (!(t instanceof
|
|
3569
|
+
if (!(t instanceof ae || t instanceof le)) throw new U(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3558
3570
|
const r = t._path.child(X.fromString(n, ...e));
|
|
3559
|
-
return st(r), new
|
|
3571
|
+
return st(r), new le(t.firestore,
|
|
3560
3572
|
/* converter= */ null, r);
|
|
3561
3573
|
}
|
|
3562
3574
|
}
|
|
@@ -3573,9 +3585,9 @@ function de(t, n, ...e) {
|
|
|
3573
3585
|
* collection or subcollection with this ID as the last segment of its path
|
|
3574
3586
|
* will be included. Cannot contain a slash.
|
|
3575
3587
|
* @returns The created `Query`.
|
|
3576
|
-
*/ function
|
|
3577
|
-
if (t = ot(t,
|
|
3578
|
-
return new
|
|
3588
|
+
*/ function de(t, n) {
|
|
3589
|
+
if (t = ot(t, se), et("collectionGroup", "collection id", n), n.indexOf("/") >= 0) throw new U(A, `Invalid collection ID '${n}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
3590
|
+
return new he(t,
|
|
3579
3591
|
/* converter= */ null,
|
|
3580
3592
|
/**
|
|
3581
3593
|
* Creates a new Query for a collection group query that matches all documents
|
|
@@ -3586,19 +3598,19 @@ function de(t, n, ...e) {
|
|
|
3586
3598
|
}(n));
|
|
3587
3599
|
}
|
|
3588
3600
|
|
|
3589
|
-
function
|
|
3601
|
+
function we(t, n, ...e) {
|
|
3590
3602
|
if (t = getModularInstance(t),
|
|
3591
3603
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
3592
3604
|
// 'undefined' and 'null'.
|
|
3593
|
-
1 === arguments.length && (n = pt.R()), et("doc", "path", n), t instanceof
|
|
3605
|
+
1 === arguments.length && (n = pt.R()), et("doc", "path", n), t instanceof se) {
|
|
3594
3606
|
const r = X.fromString(n, ...e);
|
|
3595
|
-
return rt(r), new
|
|
3607
|
+
return rt(r), new ae(t,
|
|
3596
3608
|
/* converter= */ null, new nt(r));
|
|
3597
3609
|
}
|
|
3598
3610
|
{
|
|
3599
|
-
if (!(t instanceof
|
|
3611
|
+
if (!(t instanceof ae || t instanceof le)) throw new U(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3600
3612
|
const r = t._path.child(X.fromString(n, ...e));
|
|
3601
|
-
return rt(r), new
|
|
3613
|
+
return rt(r), new ae(t.firestore, t instanceof le ? t.converter : null, new nt(r));
|
|
3602
3614
|
}
|
|
3603
3615
|
}
|
|
3604
3616
|
|
|
@@ -3609,8 +3621,8 @@ function me(t, n, ...e) {
|
|
|
3609
3621
|
* @param right - A reference to compare.
|
|
3610
3622
|
* @returns true if the references point to the same location in the same
|
|
3611
3623
|
* Firestore database.
|
|
3612
|
-
*/ function
|
|
3613
|
-
return t = getModularInstance(t), n = getModularInstance(n), (t instanceof
|
|
3624
|
+
*/ function me(t, n) {
|
|
3625
|
+
return t = getModularInstance(t), n = getModularInstance(n), (t instanceof ae || t instanceof le) && (n instanceof ae || n instanceof le) && (t.firestore === n.firestore && t.path === n.path && t.converter === n.converter);
|
|
3614
3626
|
}
|
|
3615
3627
|
|
|
3616
3628
|
/**
|
|
@@ -3621,8 +3633,8 @@ function me(t, n, ...e) {
|
|
|
3621
3633
|
* @param right - A `Query` to compare.
|
|
3622
3634
|
* @returns true if the references point to the same location in the same
|
|
3623
3635
|
* Firestore database.
|
|
3624
|
-
*/ function
|
|
3625
|
-
return t = getModularInstance(t), n = getModularInstance(n), t instanceof
|
|
3636
|
+
*/ function pe(t, n) {
|
|
3637
|
+
return t = getModularInstance(t), n = getModularInstance(n), t instanceof he && n instanceof he && (t.firestore === n.firestore && wn(t._query, n._query) && t.converter === n.converter);
|
|
3626
3638
|
}
|
|
3627
3639
|
|
|
3628
3640
|
/**
|
|
@@ -3648,7 +3660,7 @@ function me(t, n, ...e) {
|
|
|
3648
3660
|
*
|
|
3649
3661
|
* Create a `FieldPath` by providing field names. If more than one field
|
|
3650
3662
|
* name is provided, the path will point to a nested field in a document.
|
|
3651
|
-
*/ class
|
|
3663
|
+
*/ class ye {
|
|
3652
3664
|
/**
|
|
3653
3665
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
3654
3666
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -3672,8 +3684,8 @@ function me(t, n, ...e) {
|
|
|
3672
3684
|
/**
|
|
3673
3685
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
3674
3686
|
* It can be used in queries to sort or filter by the document ID.
|
|
3675
|
-
*/ function
|
|
3676
|
-
return new
|
|
3687
|
+
*/ function _e() {
|
|
3688
|
+
return new ye("__name__");
|
|
3677
3689
|
}
|
|
3678
3690
|
|
|
3679
3691
|
/**
|
|
@@ -3694,7 +3706,7 @@ function me(t, n, ...e) {
|
|
|
3694
3706
|
*/
|
|
3695
3707
|
/**
|
|
3696
3708
|
* An immutable object representing an array of bytes.
|
|
3697
|
-
*/ class
|
|
3709
|
+
*/ class ge {
|
|
3698
3710
|
/** @hideconstructor */
|
|
3699
3711
|
constructor(t) {
|
|
3700
3712
|
this._byteString = t;
|
|
@@ -3706,7 +3718,7 @@ function me(t, n, ...e) {
|
|
|
3706
3718
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
3707
3719
|
*/ static fromBase64String(t) {
|
|
3708
3720
|
try {
|
|
3709
|
-
return new
|
|
3721
|
+
return new ge(It.fromBase64String(t));
|
|
3710
3722
|
} catch (t) {
|
|
3711
3723
|
throw new U(A, "Failed to construct data from Base64 string: " + t);
|
|
3712
3724
|
}
|
|
@@ -3716,7 +3728,7 @@ function me(t, n, ...e) {
|
|
|
3716
3728
|
*
|
|
3717
3729
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
3718
3730
|
*/ static fromUint8Array(t) {
|
|
3719
|
-
return new
|
|
3731
|
+
return new ge(It.fromUint8Array(t));
|
|
3720
3732
|
}
|
|
3721
3733
|
/**
|
|
3722
3734
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -3800,7 +3812,7 @@ function me(t, n, ...e) {
|
|
|
3800
3812
|
*
|
|
3801
3813
|
* Latitude values are in the range of [-90, 90].
|
|
3802
3814
|
* Longitude values are in the range of [-180, 180].
|
|
3803
|
-
*/ class
|
|
3815
|
+
*/ class ve {
|
|
3804
3816
|
/**
|
|
3805
3817
|
* Creates a new immutable `GeoPoint` object with the provided latitude and
|
|
3806
3818
|
* longitude values.
|
|
@@ -3859,9 +3871,9 @@ function me(t, n, ...e) {
|
|
|
3859
3871
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3860
3872
|
* See the License for the specific language governing permissions and
|
|
3861
3873
|
* limitations under the License.
|
|
3862
|
-
*/ const
|
|
3874
|
+
*/ const Ee = /^__.*__$/;
|
|
3863
3875
|
|
|
3864
|
-
/** The result of parsing document data (e.g. for a setData call). */ class
|
|
3876
|
+
/** The result of parsing document data (e.g. for a setData call). */ class Te {
|
|
3865
3877
|
constructor(t, n, e) {
|
|
3866
3878
|
this.data = t, this.fieldMask = n, this.fieldTransforms = e;
|
|
3867
3879
|
}
|
|
@@ -3870,7 +3882,7 @@ function me(t, n, ...e) {
|
|
|
3870
3882
|
}
|
|
3871
3883
|
}
|
|
3872
3884
|
|
|
3873
|
-
/** The result of parsing "update" data (i.e. for an updateData call). */ class
|
|
3885
|
+
/** The result of parsing "update" data (i.e. for an updateData call). */ class Ie {
|
|
3874
3886
|
constructor(t,
|
|
3875
3887
|
// The fieldMask does not include document transforms.
|
|
3876
3888
|
n, e) {
|
|
@@ -3881,7 +3893,7 @@ function me(t, n, ...e) {
|
|
|
3881
3893
|
}
|
|
3882
3894
|
}
|
|
3883
3895
|
|
|
3884
|
-
function
|
|
3896
|
+
function Ae(t) {
|
|
3885
3897
|
switch (t) {
|
|
3886
3898
|
case 0 /* Set */ :
|
|
3887
3899
|
// fall through
|
|
@@ -3899,7 +3911,7 @@ function Re(t) {
|
|
|
3899
3911
|
}
|
|
3900
3912
|
}
|
|
3901
3913
|
|
|
3902
|
-
/** A "context" object passed around while parsing user data. */ class
|
|
3914
|
+
/** A "context" object passed around while parsing user data. */ class Re {
|
|
3903
3915
|
/**
|
|
3904
3916
|
* Initializes a ParseContext with the given source and path.
|
|
3905
3917
|
*
|
|
@@ -3931,7 +3943,7 @@ function Re(t) {
|
|
|
3931
3943
|
return this.settings.tt;
|
|
3932
3944
|
}
|
|
3933
3945
|
/** Returns a new context with the specified settings overwritten. */ nt(t) {
|
|
3934
|
-
return new
|
|
3946
|
+
return new Re(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.q, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
3935
3947
|
}
|
|
3936
3948
|
et(t) {
|
|
3937
3949
|
var n;
|
|
@@ -3958,7 +3970,7 @@ function Re(t) {
|
|
|
3958
3970
|
});
|
|
3959
3971
|
}
|
|
3960
3972
|
ut(t) {
|
|
3961
|
-
return
|
|
3973
|
+
return Qe(t, this.settings.methodName, this.settings.ct || !1, this.path, this.settings.at);
|
|
3962
3974
|
}
|
|
3963
3975
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
3964
3976
|
return void 0 !== this.fieldMask.find((n => t.isPrefixOf(n))) || void 0 !== this.fieldTransforms.find((n => t.isPrefixOf(n.field)));
|
|
@@ -3970,19 +3982,19 @@ function Re(t) {
|
|
|
3970
3982
|
}
|
|
3971
3983
|
st(t) {
|
|
3972
3984
|
if (0 === t.length) throw this.ut("Document fields must not be empty");
|
|
3973
|
-
if (
|
|
3985
|
+
if (Ae(this.tt) && Ee.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
|
|
3974
3986
|
}
|
|
3975
3987
|
}
|
|
3976
3988
|
|
|
3977
3989
|
/**
|
|
3978
3990
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
3979
3991
|
* classes.
|
|
3980
|
-
*/ class
|
|
3992
|
+
*/ class Pe {
|
|
3981
3993
|
constructor(t, n, e) {
|
|
3982
|
-
this.databaseId = t, this.ignoreUndefinedProperties = n, this.q = e ||
|
|
3994
|
+
this.databaseId = t, this.ignoreUndefinedProperties = n, this.q = e || Hn(t);
|
|
3983
3995
|
}
|
|
3984
3996
|
/** Creates a new top-level parse context. */ ht(t, n, e, r = !1) {
|
|
3985
|
-
return new
|
|
3997
|
+
return new Re({
|
|
3986
3998
|
tt: t,
|
|
3987
3999
|
methodName: n,
|
|
3988
4000
|
at: e,
|
|
@@ -3993,29 +4005,29 @@ function Re(t) {
|
|
|
3993
4005
|
}
|
|
3994
4006
|
}
|
|
3995
4007
|
|
|
3996
|
-
function
|
|
3997
|
-
const n = t._freezeSettings(), e =
|
|
3998
|
-
return new
|
|
4008
|
+
function Ve(t) {
|
|
4009
|
+
const n = t._freezeSettings(), e = Hn(t._databaseId);
|
|
4010
|
+
return new Pe(t._databaseId, !!n.ignoreUndefinedProperties, e);
|
|
3999
4011
|
}
|
|
4000
4012
|
|
|
4001
|
-
/** Parse document data from a set() call. */ function
|
|
4013
|
+
/** Parse document data from a set() call. */ function De(t, n, e, r, s, i = {}) {
|
|
4002
4014
|
const o = t.ht(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , n, e, s);
|
|
4003
|
-
|
|
4004
|
-
const u =
|
|
4015
|
+
Me("Data must be an object, but it was:", o, r);
|
|
4016
|
+
const u = ke(r, o);
|
|
4005
4017
|
let c, a;
|
|
4006
4018
|
if (i.merge) c = new Tt(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
|
|
4007
4019
|
const t = [];
|
|
4008
4020
|
for (const r of i.mergeFields) {
|
|
4009
|
-
const s =
|
|
4021
|
+
const s = Be(n, r, e);
|
|
4010
4022
|
if (!o.contains(s)) throw new U(A, `Field '${s}' is specified in your field mask but missing from your input data.`);
|
|
4011
|
-
|
|
4023
|
+
We(t, s) || t.push(s);
|
|
4012
4024
|
}
|
|
4013
4025
|
c = new Tt(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
|
|
4014
4026
|
} else c = null, a = o.fieldTransforms;
|
|
4015
|
-
return new
|
|
4027
|
+
return new Te(new Bt(u), c, a);
|
|
4016
4028
|
}
|
|
4017
4029
|
|
|
4018
|
-
class
|
|
4030
|
+
class Ne extends be {
|
|
4019
4031
|
_toFieldTransform(t) {
|
|
4020
4032
|
if (2 /* MergeSet */ !== t.tt) throw 1 /* Update */ === t.tt ? t.ut(`${this._methodName}() can only appear at the top level of your update data`) : t.ut(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
|
|
4021
4033
|
// No transform to add for a delete, but we need to add it to our
|
|
@@ -4023,7 +4035,7 @@ class $e extends be {
|
|
|
4023
4035
|
return t.fieldMask.push(t.path), null;
|
|
4024
4036
|
}
|
|
4025
4037
|
isEqual(t) {
|
|
4026
|
-
return t instanceof
|
|
4038
|
+
return t instanceof Ne;
|
|
4027
4039
|
}
|
|
4028
4040
|
}
|
|
4029
4041
|
|
|
@@ -4042,8 +4054,8 @@ class $e extends be {
|
|
|
4042
4054
|
* context.
|
|
4043
4055
|
* @param context - The parent context.
|
|
4044
4056
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4045
|
-
*/ function
|
|
4046
|
-
return new
|
|
4057
|
+
*/ function $e(t, n, e) {
|
|
4058
|
+
return new Re({
|
|
4047
4059
|
tt: 3 /* Argument */ ,
|
|
4048
4060
|
at: n.settings.at,
|
|
4049
4061
|
methodName: t._methodName,
|
|
@@ -4051,23 +4063,23 @@ class $e extends be {
|
|
|
4051
4063
|
}, n.databaseId, n.q, n.ignoreUndefinedProperties);
|
|
4052
4064
|
}
|
|
4053
4065
|
|
|
4054
|
-
class
|
|
4066
|
+
class Se extends be {
|
|
4055
4067
|
_toFieldTransform(t) {
|
|
4056
|
-
return new
|
|
4068
|
+
return new vn(t.path, new yn);
|
|
4057
4069
|
}
|
|
4058
4070
|
isEqual(t) {
|
|
4059
|
-
return t instanceof
|
|
4071
|
+
return t instanceof Se;
|
|
4060
4072
|
}
|
|
4061
4073
|
}
|
|
4062
4074
|
|
|
4063
|
-
class
|
|
4075
|
+
class Fe extends be {
|
|
4064
4076
|
constructor(t, n) {
|
|
4065
4077
|
super(t), this.lt = n;
|
|
4066
4078
|
}
|
|
4067
4079
|
_toFieldTransform(t) {
|
|
4068
|
-
const n =
|
|
4069
|
-
/*array=*/ !0), e = this.lt.map((t =>
|
|
4070
|
-
return new
|
|
4080
|
+
const n = $e(this, t,
|
|
4081
|
+
/*array=*/ !0), e = this.lt.map((t => Ue(t, n))), r = new _n(e);
|
|
4082
|
+
return new vn(t.path, r);
|
|
4071
4083
|
}
|
|
4072
4084
|
isEqual(t) {
|
|
4073
4085
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4075,14 +4087,14 @@ class xe extends be {
|
|
|
4075
4087
|
}
|
|
4076
4088
|
}
|
|
4077
4089
|
|
|
4078
|
-
class
|
|
4090
|
+
class xe extends be {
|
|
4079
4091
|
constructor(t, n) {
|
|
4080
4092
|
super(t), this.lt = n;
|
|
4081
4093
|
}
|
|
4082
4094
|
_toFieldTransform(t) {
|
|
4083
|
-
const n =
|
|
4084
|
-
/*array=*/ !0), e = this.lt.map((t =>
|
|
4085
|
-
return new
|
|
4095
|
+
const n = $e(this, t,
|
|
4096
|
+
/*array=*/ !0), e = this.lt.map((t => Ue(t, n))), r = new gn(e);
|
|
4097
|
+
return new vn(t.path, r);
|
|
4086
4098
|
}
|
|
4087
4099
|
isEqual(t) {
|
|
4088
4100
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4090,13 +4102,13 @@ class qe extends be {
|
|
|
4090
4102
|
}
|
|
4091
4103
|
}
|
|
4092
4104
|
|
|
4093
|
-
class
|
|
4105
|
+
class qe extends be {
|
|
4094
4106
|
constructor(t, n) {
|
|
4095
4107
|
super(t), this.ft = n;
|
|
4096
4108
|
}
|
|
4097
4109
|
_toFieldTransform(t) {
|
|
4098
|
-
const n = new
|
|
4099
|
-
return new
|
|
4110
|
+
const n = new bn(t.q, mn(t.q, this.ft));
|
|
4111
|
+
return new vn(t.path, n);
|
|
4100
4112
|
}
|
|
4101
4113
|
isEqual(t) {
|
|
4102
4114
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4104,50 +4116,50 @@ class Oe extends be {
|
|
|
4104
4116
|
}
|
|
4105
4117
|
}
|
|
4106
4118
|
|
|
4107
|
-
/** Parse update data from an update() call. */ function
|
|
4119
|
+
/** Parse update data from an update() call. */ function Oe(t, n, e, r) {
|
|
4108
4120
|
const s = t.ht(1 /* Update */ , n, e);
|
|
4109
|
-
|
|
4121
|
+
Me("Data must be an object, but it was:", s, r);
|
|
4110
4122
|
const i = [], o = Bt.empty();
|
|
4111
4123
|
Et(r, ((t, r) => {
|
|
4112
|
-
const u =
|
|
4124
|
+
const u = Ge(n, t, e);
|
|
4113
4125
|
// For Compat types, we have to "extract" the underlying types before
|
|
4114
4126
|
// performing validation.
|
|
4115
4127
|
r = getModularInstance(r);
|
|
4116
4128
|
const c = s.it(u);
|
|
4117
|
-
if (r instanceof
|
|
4129
|
+
if (r instanceof Ne)
|
|
4118
4130
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4119
4131
|
i.push(u); else {
|
|
4120
|
-
const t =
|
|
4132
|
+
const t = Ue(r, c);
|
|
4121
4133
|
null != t && (i.push(u), o.set(u, t));
|
|
4122
4134
|
}
|
|
4123
4135
|
}));
|
|
4124
4136
|
const u = new Tt(i);
|
|
4125
|
-
return new
|
|
4137
|
+
return new Ie(o, u, s.fieldTransforms);
|
|
4126
4138
|
}
|
|
4127
4139
|
|
|
4128
|
-
/** Parse update data from a list of field/value arguments. */ function
|
|
4129
|
-
const o = t.ht(1 /* Update */ , n, e), u = [
|
|
4140
|
+
/** Parse update data from a list of field/value arguments. */ function Ce(t, n, e, r, s, i) {
|
|
4141
|
+
const o = t.ht(1 /* Update */ , n, e), u = [ Be(n, r, e) ], c = [ s ];
|
|
4130
4142
|
if (i.length % 2 != 0) throw new U(A, `Function ${n}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
4131
|
-
for (let t = 0; t < i.length; t += 2) u.push(
|
|
4143
|
+
for (let t = 0; t < i.length; t += 2) u.push(Be(n, i[t])), c.push(i[t + 1]);
|
|
4132
4144
|
const a = [], l = Bt.empty();
|
|
4133
4145
|
// We iterate in reverse order to pick the last value for a field if the
|
|
4134
4146
|
// user specified the field multiple times.
|
|
4135
|
-
for (let t = u.length - 1; t >= 0; --t) if (!
|
|
4147
|
+
for (let t = u.length - 1; t >= 0; --t) if (!We(a, u[t])) {
|
|
4136
4148
|
const n = u[t];
|
|
4137
4149
|
let e = c[t];
|
|
4138
4150
|
// For Compat types, we have to "extract" the underlying types before
|
|
4139
4151
|
// performing validation.
|
|
4140
4152
|
e = getModularInstance(e);
|
|
4141
4153
|
const r = o.it(n);
|
|
4142
|
-
if (e instanceof
|
|
4154
|
+
if (e instanceof Ne)
|
|
4143
4155
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4144
4156
|
a.push(n); else {
|
|
4145
|
-
const t =
|
|
4157
|
+
const t = Ue(e, r);
|
|
4146
4158
|
null != t && (a.push(n), l.set(n, t));
|
|
4147
4159
|
}
|
|
4148
4160
|
}
|
|
4149
4161
|
const f = new Tt(a);
|
|
4150
|
-
return new
|
|
4162
|
+
return new Ie(l, f, o.fieldTransforms);
|
|
4151
4163
|
}
|
|
4152
4164
|
|
|
4153
4165
|
/**
|
|
@@ -4156,8 +4168,8 @@ class Oe extends be {
|
|
|
4156
4168
|
*
|
|
4157
4169
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
4158
4170
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
4159
|
-
*/ function
|
|
4160
|
-
return
|
|
4171
|
+
*/ function Le(t, n, e, r = !1) {
|
|
4172
|
+
return Ue(e, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , n));
|
|
4161
4173
|
}
|
|
4162
4174
|
|
|
4163
4175
|
/**
|
|
@@ -4168,11 +4180,11 @@ class Oe extends be {
|
|
|
4168
4180
|
* the source of the data being parsed, etc.
|
|
4169
4181
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
4170
4182
|
* that should not be included in the resulting parsed data.
|
|
4171
|
-
*/ function
|
|
4172
|
-
if (
|
|
4183
|
+
*/ function Ue(t, n) {
|
|
4184
|
+
if (je(
|
|
4173
4185
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
4174
4186
|
// from firestore-exp.
|
|
4175
|
-
t = getModularInstance(t))) return
|
|
4187
|
+
t = getModularInstance(t))) return Me("Unsupported field value:", n, t), ke(t, n);
|
|
4176
4188
|
if (t instanceof be)
|
|
4177
4189
|
// FieldValues usually parse into transforms (except deleteField())
|
|
4178
4190
|
// in which case we do not want to include this field in our parsed data
|
|
@@ -4185,7 +4197,7 @@ class Oe extends be {
|
|
|
4185
4197
|
*/
|
|
4186
4198
|
return function(t, n) {
|
|
4187
4199
|
// Sentinels are only supported with writes, and not within arrays.
|
|
4188
|
-
if (!
|
|
4200
|
+
if (!Ae(n.tt)) throw n.ut(`${t._methodName}() can only be used with update() and set()`);
|
|
4189
4201
|
if (!n.path) throw n.ut(`${t._methodName}() is not currently supported inside arrays`);
|
|
4190
4202
|
const e = t._toFieldTransform(n);
|
|
4191
4203
|
e && n.fieldTransforms.push(e);
|
|
@@ -4215,7 +4227,7 @@ class Oe extends be {
|
|
|
4215
4227
|
const e = [];
|
|
4216
4228
|
let r = 0;
|
|
4217
4229
|
for (const s of t) {
|
|
4218
|
-
let t =
|
|
4230
|
+
let t = Ue(s, n.ot(r));
|
|
4219
4231
|
null == t && (
|
|
4220
4232
|
// Just include nulls in the array for fields being replaced with a
|
|
4221
4233
|
// sentinel.
|
|
@@ -4256,16 +4268,16 @@ class Oe extends be {
|
|
|
4256
4268
|
timestampValue: $n(n.q, e)
|
|
4257
4269
|
};
|
|
4258
4270
|
}
|
|
4259
|
-
if (t instanceof
|
|
4271
|
+
if (t instanceof ve) return {
|
|
4260
4272
|
geoPointValue: {
|
|
4261
4273
|
latitude: t.latitude,
|
|
4262
4274
|
longitude: t.longitude
|
|
4263
4275
|
}
|
|
4264
4276
|
};
|
|
4265
|
-
if (t instanceof
|
|
4277
|
+
if (t instanceof ge) return {
|
|
4266
4278
|
bytesValue: Sn(n.q, t._byteString)
|
|
4267
4279
|
};
|
|
4268
|
-
if (t instanceof
|
|
4280
|
+
if (t instanceof ae) {
|
|
4269
4281
|
const e = n.databaseId, r = t.firestore._databaseId;
|
|
4270
4282
|
if (!r.isEqual(e)) throw n.ut(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${e.projectId}/${e.database}`);
|
|
4271
4283
|
return {
|
|
@@ -4283,13 +4295,13 @@ class Oe extends be {
|
|
|
4283
4295
|
*/ (t, n);
|
|
4284
4296
|
}
|
|
4285
4297
|
|
|
4286
|
-
function
|
|
4298
|
+
function ke(t, n) {
|
|
4287
4299
|
const e = {};
|
|
4288
4300
|
return !function(t) {
|
|
4289
4301
|
for (const n in t) if (Object.prototype.hasOwnProperty.call(t, n)) return !1;
|
|
4290
4302
|
return !0;
|
|
4291
4303
|
}(t) ? Et(t, ((t, r) => {
|
|
4292
|
-
const s =
|
|
4304
|
+
const s = Ue(r, n.et(t));
|
|
4293
4305
|
null != s && (e[t] = s);
|
|
4294
4306
|
})) :
|
|
4295
4307
|
// If we encounter an empty object, we explicitly add it to the update
|
|
@@ -4301,12 +4313,12 @@ function je(t, n) {
|
|
|
4301
4313
|
};
|
|
4302
4314
|
}
|
|
4303
4315
|
|
|
4304
|
-
function
|
|
4305
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof
|
|
4316
|
+
function je(t) {
|
|
4317
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof ve || t instanceof ge || t instanceof ae || t instanceof be);
|
|
4306
4318
|
}
|
|
4307
4319
|
|
|
4308
|
-
function
|
|
4309
|
-
if (!
|
|
4320
|
+
function Me(t, n, e) {
|
|
4321
|
+
if (!je(e) || !function(t) {
|
|
4310
4322
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
4311
4323
|
}(e)) {
|
|
4312
4324
|
const r = it(e);
|
|
@@ -4316,20 +4328,20 @@ function Be(t, n, e) {
|
|
|
4316
4328
|
|
|
4317
4329
|
/**
|
|
4318
4330
|
* Helper that calls fromDotSeparatedString() but wraps any error thrown.
|
|
4319
|
-
*/ function
|
|
4331
|
+
*/ function Be(t, n, e) {
|
|
4320
4332
|
if ((
|
|
4321
4333
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
4322
4334
|
// FieldPath.
|
|
4323
|
-
n = getModularInstance(n)) instanceof
|
|
4324
|
-
if ("string" == typeof n) return
|
|
4325
|
-
throw
|
|
4335
|
+
n = getModularInstance(n)) instanceof ye) return n._internalPath;
|
|
4336
|
+
if ("string" == typeof n) return Ge(t, n);
|
|
4337
|
+
throw Qe("Field path arguments must be of type string or ", t,
|
|
4326
4338
|
/* hasConverter= */ !1,
|
|
4327
4339
|
/* path= */ void 0, e);
|
|
4328
4340
|
}
|
|
4329
4341
|
|
|
4330
4342
|
/**
|
|
4331
4343
|
* Matches any characters in a field path string that are reserved.
|
|
4332
|
-
*/ const
|
|
4344
|
+
*/ const ze = new RegExp("[~\\*/\\[\\]]");
|
|
4333
4345
|
|
|
4334
4346
|
/**
|
|
4335
4347
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -4339,20 +4351,20 @@ function Be(t, n, e) {
|
|
|
4339
4351
|
* split on dots.
|
|
4340
4352
|
* @param targetDoc - The document against which the field path will be
|
|
4341
4353
|
* evaluated.
|
|
4342
|
-
*/ function
|
|
4343
|
-
if (n.search(
|
|
4354
|
+
*/ function Ge(t, n, e) {
|
|
4355
|
+
if (n.search(ze) >= 0) throw Qe(`Invalid field path (${n}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
|
|
4344
4356
|
/* hasConverter= */ !1,
|
|
4345
4357
|
/* path= */ void 0, e);
|
|
4346
4358
|
try {
|
|
4347
|
-
return new
|
|
4359
|
+
return new ye(...n.split("."))._internalPath;
|
|
4348
4360
|
} catch (r) {
|
|
4349
|
-
throw
|
|
4361
|
+
throw Qe(`Invalid field path (${n}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
|
|
4350
4362
|
/* hasConverter= */ !1,
|
|
4351
4363
|
/* path= */ void 0, e);
|
|
4352
4364
|
}
|
|
4353
4365
|
}
|
|
4354
4366
|
|
|
4355
|
-
function
|
|
4367
|
+
function Qe(t, n, e, r, s) {
|
|
4356
4368
|
const i = r && !r.isEmpty(), o = void 0 !== s;
|
|
4357
4369
|
let u = `Function ${n}() called with invalid data`;
|
|
4358
4370
|
e && (u += " (via `toFirestore()`)"), u += ". ";
|
|
@@ -4361,7 +4373,7 @@ function We(t, n, e, r, s) {
|
|
|
4361
4373
|
c += ")"), new U(A, u + t + c);
|
|
4362
4374
|
}
|
|
4363
4375
|
|
|
4364
|
-
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function
|
|
4376
|
+
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function We(t, n) {
|
|
4365
4377
|
return t.some((t => t.isEqual(n)));
|
|
4366
4378
|
}
|
|
4367
4379
|
|
|
@@ -4389,7 +4401,7 @@ function We(t, n, e, r, s) {
|
|
|
4389
4401
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
4390
4402
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
4391
4403
|
* explicitly verify a document's existence.
|
|
4392
|
-
*/ class
|
|
4404
|
+
*/ class Ye {
|
|
4393
4405
|
// Note: This class is stripped down version of the DocumentSnapshot in
|
|
4394
4406
|
// the legacy SDK. The changes are:
|
|
4395
4407
|
// - No support for SnapshotMetadata.
|
|
@@ -4405,7 +4417,7 @@ function We(t, n, e, r, s) {
|
|
|
4405
4417
|
/**
|
|
4406
4418
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
4407
4419
|
*/ get ref() {
|
|
4408
|
-
return new
|
|
4420
|
+
return new ae(this._firestore, this._converter, this._key);
|
|
4409
4421
|
}
|
|
4410
4422
|
/**
|
|
4411
4423
|
* Signals whether or not the document at the snapshot's location exists.
|
|
@@ -4425,7 +4437,7 @@ function We(t, n, e, r, s) {
|
|
|
4425
4437
|
if (this._converter) {
|
|
4426
4438
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
4427
4439
|
// if a converter has been provided.
|
|
4428
|
-
const t = new
|
|
4440
|
+
const t = new He(this._firestore, this._userDataWriter, this._key, this._document,
|
|
4429
4441
|
/* converter= */ null);
|
|
4430
4442
|
return this._converter.fromFirestore(t);
|
|
4431
4443
|
}
|
|
@@ -4445,7 +4457,7 @@ function We(t, n, e, r, s) {
|
|
|
4445
4457
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4446
4458
|
get(t) {
|
|
4447
4459
|
if (this._document) {
|
|
4448
|
-
const n = this._document.data.field(
|
|
4460
|
+
const n = this._document.data.field(Xe("DocumentSnapshot.get", t));
|
|
4449
4461
|
if (null !== n) return this._userDataWriter.convertValue(n);
|
|
4450
4462
|
}
|
|
4451
4463
|
}
|
|
@@ -4461,7 +4473,7 @@ function We(t, n, e, r, s) {
|
|
|
4461
4473
|
* `DocumentSnapshot`. Since query results contain only existing documents, the
|
|
4462
4474
|
* `exists` property will always be true and `data()` will never return
|
|
4463
4475
|
* 'undefined'.
|
|
4464
|
-
*/ class
|
|
4476
|
+
*/ class He extends Ye {
|
|
4465
4477
|
/**
|
|
4466
4478
|
* Retrieves all fields in the document as an `Object`.
|
|
4467
4479
|
*
|
|
@@ -4479,7 +4491,7 @@ function We(t, n, e, r, s) {
|
|
|
4479
4491
|
* array via the `docs` property or enumerated using the `forEach` method. The
|
|
4480
4492
|
* number of documents can be determined via the `empty` and `size`
|
|
4481
4493
|
* properties.
|
|
4482
|
-
*/ class
|
|
4494
|
+
*/ class Ke {
|
|
4483
4495
|
/** @hideconstructor */
|
|
4484
4496
|
constructor(t, n) {
|
|
4485
4497
|
this._docs = n, this.query = t;
|
|
@@ -4510,14 +4522,14 @@ function We(t, n, e, r, s) {
|
|
|
4510
4522
|
* @param left - A snapshot to compare.
|
|
4511
4523
|
* @param right - A snapshot to compare.
|
|
4512
4524
|
* @returns true if the snapshots are equal.
|
|
4513
|
-
*/ function
|
|
4514
|
-
return t = getModularInstance(t), n = getModularInstance(n), t instanceof
|
|
4525
|
+
*/ function Je(t, n) {
|
|
4526
|
+
return t = getModularInstance(t), n = getModularInstance(n), t instanceof Ye && n instanceof Ye ? t._firestore === n._firestore && t._key.isEqual(n._key) && (null === t._document ? null === n._document : t._document.isEqual(n._document)) && t._converter === n._converter : t instanceof Ke && n instanceof Ke && (pe(t.query, n.query) && _t(t.docs, n.docs, Je));
|
|
4515
4527
|
}
|
|
4516
4528
|
|
|
4517
4529
|
/**
|
|
4518
4530
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
4519
|
-
*/ function
|
|
4520
|
-
return "string" == typeof n ?
|
|
4531
|
+
*/ function Xe(t, n) {
|
|
4532
|
+
return "string" == typeof n ? Ge(t, n) : n instanceof ye ? n._internalPath : n._delegate._internalPath;
|
|
4521
4533
|
}
|
|
4522
4534
|
|
|
4523
4535
|
/**
|
|
@@ -4544,7 +4556,7 @@ function We(t, n, e, r, s) {
|
|
|
4544
4556
|
* can then be passed to {@link query} to create a new query instance that
|
|
4545
4557
|
* also contains this `QueryConstraint`.
|
|
4546
4558
|
*/
|
|
4547
|
-
class
|
|
4559
|
+
class Ze {}
|
|
4548
4560
|
|
|
4549
4561
|
/**
|
|
4550
4562
|
* Creates a new immutable instance of {@link Query} that is extended to also include
|
|
@@ -4554,32 +4566,32 @@ class tr {}
|
|
|
4554
4566
|
* @param queryConstraints - The list of {@link QueryConstraint}s to apply.
|
|
4555
4567
|
* @throws if any of the provided query constraints cannot be combined with the
|
|
4556
4568
|
* existing or new constraints.
|
|
4557
|
-
*/ function
|
|
4569
|
+
*/ function tr(t, ...n) {
|
|
4558
4570
|
for (const e of n) t = e._apply(t);
|
|
4559
4571
|
return t;
|
|
4560
4572
|
}
|
|
4561
4573
|
|
|
4562
|
-
class
|
|
4574
|
+
class nr extends Ze {
|
|
4563
4575
|
constructor(t, n, e) {
|
|
4564
4576
|
super(), this.dt = t, this.wt = n, this.yt = e, this.type = "where";
|
|
4565
4577
|
}
|
|
4566
4578
|
_apply(t) {
|
|
4567
|
-
const n =
|
|
4579
|
+
const n = Ve(t.firestore), e = function(t, n, e, r, s, i, o) {
|
|
4568
4580
|
let u;
|
|
4569
4581
|
if (s.isKeyField()) {
|
|
4570
4582
|
if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new U(A, `Invalid Query. You can't perform '${i}' queries on documentId().`);
|
|
4571
4583
|
if ("in" /* IN */ === i || "not-in" /* NOT_IN */ === i) {
|
|
4572
|
-
|
|
4584
|
+
pr(o, i);
|
|
4573
4585
|
const n = [];
|
|
4574
|
-
for (const e of o) n.push(
|
|
4586
|
+
for (const e of o) n.push(mr(r, t, e));
|
|
4575
4587
|
u = {
|
|
4576
4588
|
arrayValue: {
|
|
4577
4589
|
values: n
|
|
4578
4590
|
}
|
|
4579
4591
|
};
|
|
4580
|
-
} else u =
|
|
4581
|
-
} else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i ||
|
|
4582
|
-
u =
|
|
4592
|
+
} else u = mr(r, t, o);
|
|
4593
|
+
} else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || pr(o, i),
|
|
4594
|
+
u = Le(e, n, o,
|
|
4583
4595
|
/* allowArrays= */ "in" /* IN */ === i || "not-in" /* NOT_IN */ === i);
|
|
4584
4596
|
const c = Wt.create(s, i, u);
|
|
4585
4597
|
return function(t, n) {
|
|
@@ -4587,7 +4599,7 @@ class er extends tr {
|
|
|
4587
4599
|
const e = hn(t);
|
|
4588
4600
|
if (null !== e && !e.isEqual(n.field)) throw new U(A, `Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${e.toString()}' and '${n.field.toString()}'`);
|
|
4589
4601
|
const r = an(t);
|
|
4590
|
-
null !== r &&
|
|
4602
|
+
null !== r && yr(t, n.field, r);
|
|
4591
4603
|
}
|
|
4592
4604
|
const e = function(t, n) {
|
|
4593
4605
|
for (const e of t.filters) if (n.indexOf(e.op) >= 0) return e.op;
|
|
@@ -4631,7 +4643,7 @@ class er extends tr {
|
|
|
4631
4643
|
throw e === n.op ? new U(A, `Invalid query. You cannot use more than one '${n.op.toString()}' filter.`) : new U(A, `Invalid query. You cannot use '${n.op.toString()}' filters with '${e.toString()}' filters.`);
|
|
4632
4644
|
}(t, c), c;
|
|
4633
4645
|
}(t._query, "where", n, t.firestore._databaseId, this.dt, this.wt, this.yt);
|
|
4634
|
-
return new
|
|
4646
|
+
return new he(t.firestore, t.converter, function(t, n) {
|
|
4635
4647
|
const e = t.filters.concat([ n ]);
|
|
4636
4648
|
return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), e, t.limit, t.limitType, t.startAt, t.endAt);
|
|
4637
4649
|
}(t._query, e));
|
|
@@ -4648,12 +4660,12 @@ class er extends tr {
|
|
|
4648
4660
|
* "<=", "!=").
|
|
4649
4661
|
* @param value - The value for comparison
|
|
4650
4662
|
* @returns The created {@link Query}.
|
|
4651
|
-
*/ function
|
|
4652
|
-
const r = n, s =
|
|
4653
|
-
return new
|
|
4663
|
+
*/ function er(t, n, e) {
|
|
4664
|
+
const r = n, s = Xe("where", t);
|
|
4665
|
+
return new nr(s, r, e);
|
|
4654
4666
|
}
|
|
4655
4667
|
|
|
4656
|
-
class
|
|
4668
|
+
class rr extends Ze {
|
|
4657
4669
|
constructor(t, n) {
|
|
4658
4670
|
super(), this.dt = t, this._t = n, this.type = "orderBy";
|
|
4659
4671
|
}
|
|
@@ -4666,7 +4678,7 @@ class sr extends tr {
|
|
|
4666
4678
|
if (null === an(t)) {
|
|
4667
4679
|
// This is the first order by. It must match any inequality.
|
|
4668
4680
|
const e = hn(t);
|
|
4669
|
-
null !== e &&
|
|
4681
|
+
null !== e && yr(t, e, n.field);
|
|
4670
4682
|
}
|
|
4671
4683
|
}(t, r), r;
|
|
4672
4684
|
}
|
|
@@ -4681,7 +4693,7 @@ class sr extends tr {
|
|
|
4681
4693
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
4682
4694
|
* server timestamp.
|
|
4683
4695
|
*/ (t._query, this.dt, this._t);
|
|
4684
|
-
return new
|
|
4696
|
+
return new he(t.firestore, t.converter, function(t, n) {
|
|
4685
4697
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
4686
4698
|
const e = t.explicitOrderBy.concat([ n ]);
|
|
4687
4699
|
return new un(t.path, t.collectionGroup, e, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -4697,19 +4709,19 @@ class sr extends tr {
|
|
|
4697
4709
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
4698
4710
|
* not specified, order will be ascending.
|
|
4699
4711
|
* @returns The created {@link Query}.
|
|
4700
|
-
*/ function
|
|
4701
|
-
const e = n, r =
|
|
4702
|
-
return new
|
|
4712
|
+
*/ function sr(t, n = "asc") {
|
|
4713
|
+
const e = n, r = Xe("orderBy", t);
|
|
4714
|
+
return new rr(r, e);
|
|
4703
4715
|
}
|
|
4704
4716
|
|
|
4705
|
-
class
|
|
4717
|
+
class ir extends Ze {
|
|
4706
4718
|
constructor(t, n, e) {
|
|
4707
|
-
super(), this.type = t, this.gt = n, this.
|
|
4719
|
+
super(), this.type = t, this.gt = n, this.bt = e;
|
|
4708
4720
|
}
|
|
4709
4721
|
_apply(t) {
|
|
4710
|
-
return new
|
|
4722
|
+
return new he(t.firestore, t.converter, function(t, n, e) {
|
|
4711
4723
|
return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), n, e, t.startAt, t.endAt);
|
|
4712
|
-
}(t._query, this.gt, this.
|
|
4724
|
+
}(t._query, this.gt, this.bt));
|
|
4713
4725
|
}
|
|
4714
4726
|
}
|
|
4715
4727
|
|
|
@@ -4718,8 +4730,8 @@ class or extends tr {
|
|
|
4718
4730
|
*
|
|
4719
4731
|
* @param limit - The maximum number of items to return.
|
|
4720
4732
|
* @returns The created {@link Query}.
|
|
4721
|
-
*/ function
|
|
4722
|
-
return ut("limit", t), new
|
|
4733
|
+
*/ function or(t) {
|
|
4734
|
+
return ut("limit", t), new ir("limit", t, "F" /* First */);
|
|
4723
4735
|
}
|
|
4724
4736
|
|
|
4725
4737
|
/**
|
|
@@ -4730,53 +4742,55 @@ class or extends tr {
|
|
|
4730
4742
|
*
|
|
4731
4743
|
* @param limit - The maximum number of items to return.
|
|
4732
4744
|
* @returns The created {@link Query}.
|
|
4733
|
-
*/ function
|
|
4734
|
-
return ut("limitToLast", t), new
|
|
4745
|
+
*/ function ur(t) {
|
|
4746
|
+
return ut("limitToLast", t), new ir("limitToLast", t, "L" /* Last */);
|
|
4735
4747
|
}
|
|
4736
4748
|
|
|
4737
|
-
class
|
|
4749
|
+
class cr extends Ze {
|
|
4738
4750
|
constructor(t, n, e) {
|
|
4739
|
-
super(), this.type = t, this.
|
|
4751
|
+
super(), this.type = t, this.vt = n, this.Et = e;
|
|
4740
4752
|
}
|
|
4741
4753
|
_apply(t) {
|
|
4742
|
-
const n =
|
|
4743
|
-
return new
|
|
4754
|
+
const n = wr(t, this.type, this.vt, this.Et);
|
|
4755
|
+
return new he(t.firestore, t.converter, function(t, n) {
|
|
4744
4756
|
return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, n, t.endAt);
|
|
4745
4757
|
}(t._query, n));
|
|
4746
4758
|
}
|
|
4747
4759
|
}
|
|
4748
4760
|
|
|
4749
|
-
function
|
|
4750
|
-
return new
|
|
4761
|
+
function ar(...t) {
|
|
4762
|
+
return new cr("startAt", t,
|
|
4763
|
+
/*inclusive=*/ !0);
|
|
4751
4764
|
}
|
|
4752
4765
|
|
|
4753
|
-
function
|
|
4754
|
-
return new
|
|
4755
|
-
/*
|
|
4766
|
+
function hr(...t) {
|
|
4767
|
+
return new cr("startAfter", t,
|
|
4768
|
+
/*inclusive=*/ !1);
|
|
4756
4769
|
}
|
|
4757
4770
|
|
|
4758
|
-
class
|
|
4771
|
+
class lr extends Ze {
|
|
4759
4772
|
constructor(t, n, e) {
|
|
4760
|
-
super(), this.type = t, this.
|
|
4773
|
+
super(), this.type = t, this.vt = n, this.Et = e;
|
|
4761
4774
|
}
|
|
4762
4775
|
_apply(t) {
|
|
4763
|
-
const n =
|
|
4764
|
-
return new
|
|
4776
|
+
const n = wr(t, this.type, this.vt, this.Et);
|
|
4777
|
+
return new he(t.firestore, t.converter, function(t, n) {
|
|
4765
4778
|
return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, n);
|
|
4766
4779
|
}(t._query, n));
|
|
4767
4780
|
}
|
|
4768
4781
|
}
|
|
4769
4782
|
|
|
4770
|
-
function
|
|
4771
|
-
return new
|
|
4783
|
+
function fr(...t) {
|
|
4784
|
+
return new lr("endBefore", t,
|
|
4785
|
+
/*inclusive=*/ !1);
|
|
4772
4786
|
}
|
|
4773
4787
|
|
|
4774
|
-
function
|
|
4775
|
-
return new
|
|
4788
|
+
function dr(...t) {
|
|
4789
|
+
return new lr("endAt", t, /*inclusive=*/ !0);
|
|
4776
4790
|
}
|
|
4777
4791
|
|
|
4778
|
-
/** Helper function to create a bound from a document or fields */ function
|
|
4779
|
-
if (e[0] = getModularInstance(e[0]), e[0] instanceof
|
|
4792
|
+
/** Helper function to create a bound from a document or fields */ function wr(t, n, e, r) {
|
|
4793
|
+
if (e[0] = getModularInstance(e[0]), e[0] instanceof Ye) return function(t, n, e, r, s) {
|
|
4780
4794
|
if (!r) throw new U(P, `Can't use a DocumentSnapshot that doesn't exist for ${e}().`);
|
|
4781
4795
|
const i = [];
|
|
4782
4796
|
// Because people expect to continue/end a query at the exact document
|
|
@@ -4801,7 +4815,7 @@ function wr(...t) {
|
|
|
4801
4815
|
* Converts a list of field values to a `Bound` for the given query.
|
|
4802
4816
|
*/ (t._query, t.firestore._databaseId, n, e[0]._document, r);
|
|
4803
4817
|
{
|
|
4804
|
-
const s =
|
|
4818
|
+
const s = Ve(t.firestore);
|
|
4805
4819
|
return function(t, n, e, r, s, i) {
|
|
4806
4820
|
// Use explicit order by's because it has to match the query the user made
|
|
4807
4821
|
const o = t.explicitOrderBy;
|
|
@@ -4817,7 +4831,7 @@ function wr(...t) {
|
|
|
4817
4831
|
const s = new nt(e);
|
|
4818
4832
|
u.push(Ct(n, s));
|
|
4819
4833
|
} else {
|
|
4820
|
-
const t =
|
|
4834
|
+
const t = Le(e, r, c);
|
|
4821
4835
|
u.push(t);
|
|
4822
4836
|
}
|
|
4823
4837
|
}
|
|
@@ -4831,7 +4845,7 @@ function wr(...t) {
|
|
|
4831
4845
|
}
|
|
4832
4846
|
}
|
|
4833
4847
|
|
|
4834
|
-
function
|
|
4848
|
+
function mr(t, n, e) {
|
|
4835
4849
|
if ("string" == typeof (e = getModularInstance(e))) {
|
|
4836
4850
|
if ("" === e) throw new U(A, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
4837
4851
|
if (!ln(n) && -1 !== e.indexOf("/")) throw new U(A, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${e}' contains a '/' character.`);
|
|
@@ -4839,19 +4853,19 @@ function pr(t, n, e) {
|
|
|
4839
4853
|
if (!nt.isDocumentKey(r)) throw new U(A, `Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);
|
|
4840
4854
|
return Ct(t, new nt(r));
|
|
4841
4855
|
}
|
|
4842
|
-
if (e instanceof
|
|
4856
|
+
if (e instanceof ae) return Ct(t, e._key);
|
|
4843
4857
|
throw new U(A, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${it(e)}.`);
|
|
4844
4858
|
}
|
|
4845
4859
|
|
|
4846
4860
|
/**
|
|
4847
4861
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
4848
4862
|
* array requirements.
|
|
4849
|
-
*/ function
|
|
4863
|
+
*/ function pr(t, n) {
|
|
4850
4864
|
if (!Array.isArray(t) || 0 === t.length) throw new U(A, `Invalid Query. A non-empty array is required for '${n.toString()}' filters.`);
|
|
4851
4865
|
if (t.length > 10) throw new U(A, `Invalid Query. '${n.toString()}' filters support a maximum of 10 elements in the value array.`);
|
|
4852
4866
|
}
|
|
4853
4867
|
|
|
4854
|
-
function
|
|
4868
|
+
function yr(t, n, e) {
|
|
4855
4869
|
if (!e.isEqual(n)) throw new U(A, `Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${n.toString()}' and so you must also use '${n.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${e.toString()}' instead.`);
|
|
4856
4870
|
}
|
|
4857
4871
|
|
|
@@ -4902,7 +4916,7 @@ function _r(t, n, e) {
|
|
|
4902
4916
|
* their `set()` or fails due to invalid data originating from a `toFirestore()`
|
|
4903
4917
|
* call.
|
|
4904
4918
|
*/
|
|
4905
|
-
function
|
|
4919
|
+
function _r(t, n, e) {
|
|
4906
4920
|
let r;
|
|
4907
4921
|
// Cast to `any` in order to satisfy the union type constraint on
|
|
4908
4922
|
// toFirestore().
|
|
@@ -4911,7 +4925,7 @@ function gr(t, n, e) {
|
|
|
4911
4925
|
r;
|
|
4912
4926
|
}
|
|
4913
4927
|
|
|
4914
|
-
class
|
|
4928
|
+
class gr extends class {
|
|
4915
4929
|
convertValue(t, n = "none") {
|
|
4916
4930
|
switch (St(t)) {
|
|
4917
4931
|
case 0 /* NullValue */ :
|
|
@@ -4958,7 +4972,7 @@ class vr extends class {
|
|
|
4958
4972
|
})), e;
|
|
4959
4973
|
}
|
|
4960
4974
|
convertGeoPoint(t) {
|
|
4961
|
-
return new
|
|
4975
|
+
return new ve(Pt(t.latitude), Pt(t.longitude));
|
|
4962
4976
|
}
|
|
4963
4977
|
convertArray(t, n) {
|
|
4964
4978
|
return (t.values || []).map((t => this.convertValue(t, n)));
|
|
@@ -4982,7 +4996,7 @@ class vr extends class {
|
|
|
4982
4996
|
}
|
|
4983
4997
|
convertDocumentKey(t, n) {
|
|
4984
4998
|
const e = X.fromString(t);
|
|
4985
|
-
|
|
4999
|
+
b(Yn(e));
|
|
4986
5000
|
const r = new K(e.get(1), e.get(3)), s = new nt(e.popFirst(5));
|
|
4987
5001
|
return r.isEqual(n) ||
|
|
4988
5002
|
// TODO(b/64130202): Somehow support foreign references.
|
|
@@ -4994,11 +5008,11 @@ class vr extends class {
|
|
|
4994
5008
|
super(), this.firestore = t;
|
|
4995
5009
|
}
|
|
4996
5010
|
convertBytes(t) {
|
|
4997
|
-
return new
|
|
5011
|
+
return new ge(t);
|
|
4998
5012
|
}
|
|
4999
5013
|
convertReference(t) {
|
|
5000
5014
|
const n = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
5001
|
-
return new
|
|
5015
|
+
return new ae(this.firestore, /* converter= */ null, n);
|
|
5002
5016
|
}
|
|
5003
5017
|
}
|
|
5004
5018
|
|
|
@@ -5015,11 +5029,11 @@ class vr extends class {
|
|
|
5015
5029
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
5016
5030
|
* document contents.
|
|
5017
5031
|
*/ function br(t) {
|
|
5018
|
-
const n =
|
|
5019
|
-
return
|
|
5020
|
-
|
|
5032
|
+
const n = ee((t = ot(t, ae)).firestore), e = new gr(t.firestore);
|
|
5033
|
+
return Zn(n, [ t._key ]).then((n => {
|
|
5034
|
+
b(1 === n.length);
|
|
5021
5035
|
const r = n[0];
|
|
5022
|
-
return new
|
|
5036
|
+
return new Ye(t.firestore, e, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
5023
5037
|
}));
|
|
5024
5038
|
}
|
|
5025
5039
|
|
|
@@ -5034,33 +5048,33 @@ class vr extends class {
|
|
|
5034
5048
|
*
|
|
5035
5049
|
* @param query - The `Query` to execute.
|
|
5036
5050
|
* @returns A Promise that will be resolved with the results of the query.
|
|
5037
|
-
*/ function
|
|
5051
|
+
*/ function vr(t) {
|
|
5038
5052
|
!function(t) {
|
|
5039
5053
|
if (cn(t) && 0 === t.explicitOrderBy.length) throw new U(q, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
5040
|
-
}((t = ot(t,
|
|
5041
|
-
const n =
|
|
5042
|
-
return
|
|
5043
|
-
const r = n.map((n => new
|
|
5054
|
+
}((t = ot(t, he))._query);
|
|
5055
|
+
const n = ee(t.firestore), e = new gr(t.firestore);
|
|
5056
|
+
return te(n, t._query).then((n => {
|
|
5057
|
+
const r = n.map((n => new He(t.firestore, e, n.key, n, t.converter)));
|
|
5044
5058
|
return cn(t._query) &&
|
|
5045
5059
|
// Limit to last queries reverse the orderBy constraint that was
|
|
5046
5060
|
// specified by the user. As such, we need to reverse the order of the
|
|
5047
5061
|
// results to return the documents in the expected order.
|
|
5048
|
-
r.reverse(), new
|
|
5062
|
+
r.reverse(), new Ke(t, r);
|
|
5049
5063
|
}));
|
|
5050
5064
|
}
|
|
5051
5065
|
|
|
5052
|
-
function
|
|
5053
|
-
const r =
|
|
5054
|
-
return
|
|
5066
|
+
function Er(t, n, e) {
|
|
5067
|
+
const r = _r((t = ot(t, ae)).converter, n, e), s = De(Ve(t.firestore), "setDoc", t._key, r, null !== t.converter, e);
|
|
5068
|
+
return Xn(ee(t.firestore), [ s.toMutation(t._key, En.none()) ]);
|
|
5055
5069
|
}
|
|
5056
5070
|
|
|
5057
|
-
function
|
|
5058
|
-
const s =
|
|
5071
|
+
function Tr(t, n, e, ...r) {
|
|
5072
|
+
const s = Ve((t = ot(t, ae)).firestore);
|
|
5059
5073
|
// For Compat types, we have to "extract" the underlying types before
|
|
5060
5074
|
// performing validation.
|
|
5061
5075
|
let i;
|
|
5062
|
-
i = "string" == typeof (n = getModularInstance(n)) || n instanceof
|
|
5063
|
-
return
|
|
5076
|
+
i = "string" == typeof (n = getModularInstance(n)) || n instanceof ye ? Ce(s, "updateDoc", t._key, n, e, r) : Oe(s, "updateDoc", t._key, n);
|
|
5077
|
+
return Xn(ee(t.firestore), [ i.toMutation(t._key, En.exists(!0)) ]);
|
|
5064
5078
|
}
|
|
5065
5079
|
|
|
5066
5080
|
/**
|
|
@@ -5074,8 +5088,8 @@ function Ir(t, n, e, ...r) {
|
|
|
5074
5088
|
* @param reference - A reference to the document to delete.
|
|
5075
5089
|
* @returns A `Promise` resolved once the document has been successfully
|
|
5076
5090
|
* deleted from the backend.
|
|
5077
|
-
*/ function
|
|
5078
|
-
return
|
|
5091
|
+
*/ function Ir(t) {
|
|
5092
|
+
return Xn(ee((t = ot(t, ae)).firestore), [ new Rn(t._key, En.none()) ]);
|
|
5079
5093
|
}
|
|
5080
5094
|
|
|
5081
5095
|
/**
|
|
@@ -5092,9 +5106,9 @@ function Ir(t, n, e, ...r) {
|
|
|
5092
5106
|
* @throws Error - If the provided input is not a valid Firestore document.
|
|
5093
5107
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
5094
5108
|
* newly created document after it has been written to the backend.
|
|
5095
|
-
*/ function
|
|
5096
|
-
const e =
|
|
5097
|
-
return
|
|
5109
|
+
*/ function Ar(t, n) {
|
|
5110
|
+
const e = we(t = ot(t, le)), r = _r(t.converter, n), s = De(Ve(t.firestore), "addDoc", e._key, r, null !== e.converter, {});
|
|
5111
|
+
return Xn(ee(t.firestore), [ s.toMutation(e._key, En.exists(!1)) ]).then((() => e));
|
|
5098
5112
|
}
|
|
5099
5113
|
|
|
5100
5114
|
/**
|
|
@@ -5116,15 +5130,15 @@ function Ir(t, n, e, ...r) {
|
|
|
5116
5130
|
/**
|
|
5117
5131
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
5118
5132
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
5119
|
-
*/ function
|
|
5120
|
-
return new
|
|
5133
|
+
*/ function Rr() {
|
|
5134
|
+
return new Ne("deleteField");
|
|
5121
5135
|
}
|
|
5122
5136
|
|
|
5123
5137
|
/**
|
|
5124
5138
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
5125
5139
|
* include a server-generated timestamp in the written data.
|
|
5126
|
-
*/ function
|
|
5127
|
-
return new
|
|
5140
|
+
*/ function Pr() {
|
|
5141
|
+
return new Se("serverTimestamp");
|
|
5128
5142
|
}
|
|
5129
5143
|
|
|
5130
5144
|
/**
|
|
@@ -5138,10 +5152,10 @@ function Ir(t, n, e, ...r) {
|
|
|
5138
5152
|
* @param elements - The elements to union into the array.
|
|
5139
5153
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5140
5154
|
* `updateDoc()`.
|
|
5141
|
-
*/ function
|
|
5155
|
+
*/ function Vr(...t) {
|
|
5142
5156
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5143
5157
|
// update() since we'd need the Firestore instance to do this.
|
|
5144
|
-
return new
|
|
5158
|
+
return new Fe("arrayUnion", t);
|
|
5145
5159
|
}
|
|
5146
5160
|
|
|
5147
5161
|
/**
|
|
@@ -5154,10 +5168,10 @@ function Ir(t, n, e, ...r) {
|
|
|
5154
5168
|
* @param elements - The elements to remove from the array.
|
|
5155
5169
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5156
5170
|
* `updateDoc()`
|
|
5157
|
-
*/ function
|
|
5171
|
+
*/ function Dr(...t) {
|
|
5158
5172
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5159
5173
|
// update() since we'd need the Firestore instance to do this.
|
|
5160
|
-
return new
|
|
5174
|
+
return new xe("arrayRemove", t);
|
|
5161
5175
|
}
|
|
5162
5176
|
|
|
5163
5177
|
/**
|
|
@@ -5178,8 +5192,8 @@ function Ir(t, n, e, ...r) {
|
|
|
5178
5192
|
* @param n - The value to increment by.
|
|
5179
5193
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5180
5194
|
* `updateDoc()`
|
|
5181
|
-
*/ function
|
|
5182
|
-
return new
|
|
5195
|
+
*/ function Nr(t) {
|
|
5196
|
+
return new qe("increment", t);
|
|
5183
5197
|
}
|
|
5184
5198
|
|
|
5185
5199
|
/**
|
|
@@ -5205,24 +5219,24 @@ function Ir(t, n, e, ...r) {
|
|
|
5205
5219
|
* provides methods for adding writes to the write batch. None of the writes
|
|
5206
5220
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
5207
5221
|
* called.
|
|
5208
|
-
*/ class
|
|
5222
|
+
*/ class $r {
|
|
5209
5223
|
/** @hideconstructor */
|
|
5210
5224
|
constructor(t, n) {
|
|
5211
5225
|
this._firestore = t, this._commitHandler = n, this._mutations = [], this._committed = !1,
|
|
5212
|
-
this._dataReader =
|
|
5226
|
+
this._dataReader = Ve(t);
|
|
5213
5227
|
}
|
|
5214
5228
|
set(t, n, e) {
|
|
5215
5229
|
this._verifyNotCommitted();
|
|
5216
|
-
const r =
|
|
5230
|
+
const r = Sr(t, this._firestore), s = _r(r.converter, n, e), i = De(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, e);
|
|
5217
5231
|
return this._mutations.push(i.toMutation(r._key, En.none())), this;
|
|
5218
5232
|
}
|
|
5219
5233
|
update(t, n, e, ...r) {
|
|
5220
5234
|
this._verifyNotCommitted();
|
|
5221
|
-
const s =
|
|
5235
|
+
const s = Sr(t, this._firestore);
|
|
5222
5236
|
// For Compat types, we have to "extract" the underlying types before
|
|
5223
5237
|
// performing validation.
|
|
5224
5238
|
let i;
|
|
5225
|
-
return i = "string" == typeof (n = getModularInstance(n)) || n instanceof
|
|
5239
|
+
return i = "string" == typeof (n = getModularInstance(n)) || n instanceof ye ? Ce(this._dataReader, "WriteBatch.update", s._key, n, e, r) : Oe(this._dataReader, "WriteBatch.update", s._key, n),
|
|
5226
5240
|
this._mutations.push(i.toMutation(s._key, En.exists(!0))), this;
|
|
5227
5241
|
}
|
|
5228
5242
|
/**
|
|
@@ -5232,7 +5246,7 @@ function Ir(t, n, e, ...r) {
|
|
|
5232
5246
|
* @returns This `WriteBatch` instance. Used for chaining method calls.
|
|
5233
5247
|
*/ delete(t) {
|
|
5234
5248
|
this._verifyNotCommitted();
|
|
5235
|
-
const n =
|
|
5249
|
+
const n = Sr(t, this._firestore);
|
|
5236
5250
|
return this._mutations = this._mutations.concat(new Rn(n._key, En.none())), this;
|
|
5237
5251
|
}
|
|
5238
5252
|
/**
|
|
@@ -5254,7 +5268,7 @@ function Ir(t, n, e, ...r) {
|
|
|
5254
5268
|
}
|
|
5255
5269
|
}
|
|
5256
5270
|
|
|
5257
|
-
function
|
|
5271
|
+
function Sr(t, n) {
|
|
5258
5272
|
if ((t = getModularInstance(t)).firestore !== n) throw new U(A, "Provided document reference is from a different Firestore instance.");
|
|
5259
5273
|
return t;
|
|
5260
5274
|
}
|
|
@@ -5271,9 +5285,9 @@ function Fr(t, n) {
|
|
|
5271
5285
|
*
|
|
5272
5286
|
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
5273
5287
|
* writes.
|
|
5274
|
-
*/ function
|
|
5275
|
-
const n =
|
|
5276
|
-
return new
|
|
5288
|
+
*/ function Fr(t) {
|
|
5289
|
+
const n = ee(t = ot(t, se));
|
|
5290
|
+
return new $r(t, (t => Xn(n, t)));
|
|
5277
5291
|
}
|
|
5278
5292
|
|
|
5279
5293
|
/**
|
|
@@ -5295,7 +5309,7 @@ function Fr(t, n) {
|
|
|
5295
5309
|
/**
|
|
5296
5310
|
* Internal transaction object responsible for accumulating the mutations to
|
|
5297
5311
|
* perform and the base versions for any documents read.
|
|
5298
|
-
*/ class
|
|
5312
|
+
*/ class xr {
|
|
5299
5313
|
constructor(t) {
|
|
5300
5314
|
this.datastore = t,
|
|
5301
5315
|
// The version of each document that was read during this transaction.
|
|
@@ -5315,7 +5329,7 @@ function Fr(t, n) {
|
|
|
5315
5329
|
}
|
|
5316
5330
|
async lookup(t) {
|
|
5317
5331
|
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(A, "Firestore transactions require all reads to be executed before all writes.");
|
|
5318
|
-
const n = await
|
|
5332
|
+
const n = await Zn(this.datastore, t);
|
|
5319
5333
|
return n.forEach((t => this.recordVersion(t))), n;
|
|
5320
5334
|
}
|
|
5321
5335
|
set(t, n) {
|
|
@@ -5344,14 +5358,14 @@ function Fr(t, n) {
|
|
|
5344
5358
|
t.forEach(((t, n) => {
|
|
5345
5359
|
const e = nt.fromPath(n);
|
|
5346
5360
|
this.mutations.push(new Pn(e, this.precondition(e)));
|
|
5347
|
-
})), await
|
|
5361
|
+
})), await Xn(this.datastore, this.mutations), this.committed = !0;
|
|
5348
5362
|
}
|
|
5349
5363
|
recordVersion(t) {
|
|
5350
5364
|
let n;
|
|
5351
5365
|
if (t.isFoundDocument()) n = t.version; else {
|
|
5352
5366
|
if (!t.isNoDocument()) throw g();
|
|
5353
5367
|
// For deleted docs, we must use baseVersion 0 when we overwrite them.
|
|
5354
|
-
n =
|
|
5368
|
+
n = bt.min();
|
|
5355
5369
|
}
|
|
5356
5370
|
const e = this.readVersions.get(t.key.toString());
|
|
5357
5371
|
if (e) {
|
|
@@ -5374,7 +5388,7 @@ function Fr(t, n) {
|
|
|
5374
5388
|
// The first time a document is written, we want to take into account the
|
|
5375
5389
|
// read time and existence
|
|
5376
5390
|
if (!this.writtenDocs.has(t.toString()) && n) {
|
|
5377
|
-
if (n.isEqual(
|
|
5391
|
+
if (n.isEqual(bt.min()))
|
|
5378
5392
|
// The document doesn't exist, so fail the transaction.
|
|
5379
5393
|
// This has to be validated locally because you can't send a
|
|
5380
5394
|
// precondition that a document does not exist without changing the
|
|
@@ -5418,17 +5432,17 @@ function Fr(t, n) {
|
|
|
5418
5432
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
5419
5433
|
* with backoff.
|
|
5420
5434
|
*/
|
|
5421
|
-
class
|
|
5435
|
+
class qr {
|
|
5422
5436
|
constructor(t, n, e, r) {
|
|
5423
5437
|
this.asyncQueue = t, this.datastore = n, this.updateFunction = e, this.deferred = r,
|
|
5424
|
-
this.Tt = 5, this.It = new
|
|
5438
|
+
this.Tt = 5, this.It = new Kn(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
5425
5439
|
}
|
|
5426
5440
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
5427
5441
|
this.Tt -= 1, this.At();
|
|
5428
5442
|
}
|
|
5429
5443
|
At() {
|
|
5430
5444
|
this.It.W((async () => {
|
|
5431
|
-
const t = new
|
|
5445
|
+
const t = new xr(this.datastore), n = this.Rt(t);
|
|
5432
5446
|
n && n.then((n => {
|
|
5433
5447
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
5434
5448
|
this.deferred.resolve(n);
|
|
@@ -5518,7 +5532,7 @@ class Or {
|
|
|
5518
5532
|
* See the License for the specific language governing permissions and
|
|
5519
5533
|
* limitations under the License.
|
|
5520
5534
|
*/
|
|
5521
|
-
/** The Platform's 'document' implementation or null if not available. */ function
|
|
5535
|
+
/** The Platform's 'document' implementation or null if not available. */ function Or() {
|
|
5522
5536
|
// `document` is not always available, e.g. in ReactNative and WebWorkers.
|
|
5523
5537
|
// eslint-disable-next-line no-restricted-globals
|
|
5524
5538
|
return "undefined" != typeof document ? document : null;
|
|
@@ -5550,7 +5564,7 @@ class Or {
|
|
|
5550
5564
|
* Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
|
|
5551
5565
|
* in newer versions of TypeScript defines `finally`, which is not available in
|
|
5552
5566
|
* IE.
|
|
5553
|
-
*/ class
|
|
5567
|
+
*/ class Cr {
|
|
5554
5568
|
constructor(t, n, e, r, s) {
|
|
5555
5569
|
this.asyncQueue = t, this.timerId = n, this.targetTimeMs = e, this.op = r, this.removalCallback = s,
|
|
5556
5570
|
this.deferred = new k, this.then = this.deferred.promise.then.bind(this.deferred.promise),
|
|
@@ -5573,7 +5587,7 @@ class Or {
|
|
|
5573
5587
|
* PORTING NOTE: This exists to prevent making removeDelayedOperation() and
|
|
5574
5588
|
* the DelayedOperation class public.
|
|
5575
5589
|
*/ static createAndSchedule(t, n, e, r, s) {
|
|
5576
|
-
const i = Date.now() + e, o = new
|
|
5590
|
+
const i = Date.now() + e, o = new Cr(t, n, i, r, s);
|
|
5577
5591
|
return o.start(e), o;
|
|
5578
5592
|
}
|
|
5579
5593
|
/**
|
|
@@ -5622,7 +5636,7 @@ class Or {
|
|
|
5622
5636
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5623
5637
|
* See the License for the specific language governing permissions and
|
|
5624
5638
|
* limitations under the License.
|
|
5625
|
-
*/ class
|
|
5639
|
+
*/ class Lr {
|
|
5626
5640
|
constructor() {
|
|
5627
5641
|
// The last promise in the queue.
|
|
5628
5642
|
this.Dt = Promise.resolve(),
|
|
@@ -5645,15 +5659,15 @@ class Or {
|
|
|
5645
5659
|
// List of TimerIds to fast-forward delays for.
|
|
5646
5660
|
this.Ot = [],
|
|
5647
5661
|
// Backoff timer used to schedule retries for retryable operations
|
|
5648
|
-
this.It = new
|
|
5662
|
+
this.It = new Kn(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
5649
5663
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
5650
5664
|
// operations. Meant to speed up recovery when we regain file system access
|
|
5651
5665
|
// after page comes into foreground.
|
|
5652
5666
|
this.Ct = () => {
|
|
5653
|
-
const t =
|
|
5667
|
+
const t = Or();
|
|
5654
5668
|
t && m("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.It.H();
|
|
5655
5669
|
};
|
|
5656
|
-
const t =
|
|
5670
|
+
const t = Or();
|
|
5657
5671
|
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Ct);
|
|
5658
5672
|
}
|
|
5659
5673
|
get isShuttingDown() {
|
|
@@ -5674,7 +5688,7 @@ class Or {
|
|
|
5674
5688
|
enterRestrictedMode(t) {
|
|
5675
5689
|
if (!this.$t) {
|
|
5676
5690
|
this.$t = !0, this.qt = t || !1;
|
|
5677
|
-
const n =
|
|
5691
|
+
const n = Or();
|
|
5678
5692
|
n && "function" == typeof n.removeEventListener && n.removeEventListener("visibilitychange", this.Ct);
|
|
5679
5693
|
}
|
|
5680
5694
|
}
|
|
@@ -5806,7 +5820,7 @@ class Or {
|
|
|
5806
5820
|
this.Lt(),
|
|
5807
5821
|
// Fast-forward delays for timerIds that have been overriden.
|
|
5808
5822
|
this.Ot.indexOf(t) > -1 && (n = 0);
|
|
5809
|
-
const r =
|
|
5823
|
+
const r = Cr.createAndSchedule(this, t, n, e, (t => this.jt(t)));
|
|
5810
5824
|
return this.St.push(r), r;
|
|
5811
5825
|
}
|
|
5812
5826
|
Lt() {
|
|
@@ -5860,10 +5874,10 @@ class Or {
|
|
|
5860
5874
|
}
|
|
5861
5875
|
}
|
|
5862
5876
|
|
|
5863
|
-
class
|
|
5877
|
+
class Ur {
|
|
5864
5878
|
/** @hideconstructor */
|
|
5865
5879
|
constructor(t, n) {
|
|
5866
|
-
this._firestore = t, this._transaction = n, this._dataReader =
|
|
5880
|
+
this._firestore = t, this._transaction = n, this._dataReader = Ve(t);
|
|
5867
5881
|
}
|
|
5868
5882
|
/**
|
|
5869
5883
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
@@ -5871,25 +5885,25 @@ class kr {
|
|
|
5871
5885
|
* @param documentRef - A reference to the document to be read.
|
|
5872
5886
|
* @returns A `DocumentSnapshot` with the read data.
|
|
5873
5887
|
*/ get(t) {
|
|
5874
|
-
const n =
|
|
5888
|
+
const n = Sr(t, this._firestore), e = new gr(this._firestore);
|
|
5875
5889
|
return this._transaction.lookup([ n._key ]).then((t => {
|
|
5876
5890
|
if (!t || 1 !== t.length) return g();
|
|
5877
5891
|
const r = t[0];
|
|
5878
|
-
if (r.isFoundDocument()) return new
|
|
5879
|
-
if (r.isNoDocument()) return new
|
|
5892
|
+
if (r.isFoundDocument()) return new Ye(this._firestore, e, r.key, r, n.converter);
|
|
5893
|
+
if (r.isNoDocument()) return new Ye(this._firestore, e, n._key, null, n.converter);
|
|
5880
5894
|
throw g();
|
|
5881
5895
|
}));
|
|
5882
5896
|
}
|
|
5883
5897
|
set(t, n, e) {
|
|
5884
|
-
const r =
|
|
5898
|
+
const r = Sr(t, this._firestore), s = _r(r.converter, n, e), i = De(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, e);
|
|
5885
5899
|
return this._transaction.set(r._key, i), this;
|
|
5886
5900
|
}
|
|
5887
5901
|
update(t, n, e, ...r) {
|
|
5888
|
-
const s =
|
|
5902
|
+
const s = Sr(t, this._firestore);
|
|
5889
5903
|
// For Compat types, we have to "extract" the underlying types before
|
|
5890
5904
|
// performing validation.
|
|
5891
5905
|
let i;
|
|
5892
|
-
return i = "string" == typeof (n = getModularInstance(n)) || n instanceof
|
|
5906
|
+
return i = "string" == typeof (n = getModularInstance(n)) || n instanceof ye ? Ce(this._dataReader, "Transaction.update", s._key, n, e, r) : Oe(this._dataReader, "Transaction.update", s._key, n),
|
|
5893
5907
|
this._transaction.update(s._key, i), this;
|
|
5894
5908
|
}
|
|
5895
5909
|
/**
|
|
@@ -5898,7 +5912,7 @@ class kr {
|
|
|
5898
5912
|
* @param documentRef - A reference to the document to be deleted.
|
|
5899
5913
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
5900
5914
|
*/ delete(t) {
|
|
5901
|
-
const n =
|
|
5915
|
+
const n = Sr(t, this._firestore);
|
|
5902
5916
|
return this._transaction.delete(n._key), this;
|
|
5903
5917
|
}
|
|
5904
5918
|
}
|
|
@@ -5919,9 +5933,9 @@ class kr {
|
|
|
5919
5933
|
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
5920
5934
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
5921
5935
|
* rejected promise with the corresponding failure error is returned.
|
|
5922
|
-
*/ function
|
|
5923
|
-
const e =
|
|
5924
|
-
return new
|
|
5936
|
+
*/ function kr(t, n) {
|
|
5937
|
+
const e = ee(t = ot(t, se)), r = new k;
|
|
5938
|
+
return new qr(new Lr, e, (e => n(new Ur(t, e))), r).run(), r.promise;
|
|
5925
5939
|
}
|
|
5926
5940
|
|
|
5927
5941
|
/**
|
|
@@ -5934,11 +5948,11 @@ class kr {
|
|
|
5934
5948
|
*/ !function(t) {
|
|
5935
5949
|
f = t;
|
|
5936
5950
|
}(`${SDK_VERSION}_lite`), _registerComponent(new Component("firestore/lite", ((t, {options: n}) => {
|
|
5937
|
-
const e = t.getProvider("app").getImmediate(), r = new
|
|
5951
|
+
const e = t.getProvider("app").getImmediate(), r = new se(e, new z(t.getProvider("auth-internal")), new Y(t.getProvider("app-check-internal")));
|
|
5938
5952
|
return n && r._setSettings(n), r;
|
|
5939
5953
|
}), "PUBLIC")),
|
|
5940
5954
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5941
|
-
registerVersion("firestore-lite", "3.4.
|
|
5955
|
+
registerVersion("firestore-lite", "3.4.4-canary.0482aa5b7", ""), registerVersion("firestore-lite", "3.4.4-canary.0482aa5b7", "esm2017");
|
|
5942
5956
|
|
|
5943
|
-
export {
|
|
5957
|
+
export { ge as Bytes, le as CollectionReference, ae as DocumentReference, Ye as DocumentSnapshot, ye as FieldPath, be as FieldValue, se as Firestore, U as FirestoreError, ve as GeoPoint, he as Query, Ze as QueryConstraint, He as QueryDocumentSnapshot, Ke as QuerySnapshot, gt as Timestamp, Ur as Transaction, $r as WriteBatch, Ar as addDoc, Dr as arrayRemove, Vr as arrayUnion, fe as collection, de as collectionGroup, ue as connectFirestoreEmulator, Ir as deleteDoc, Rr as deleteField, we as doc, _e as documentId, dr as endAt, fr as endBefore, br as getDoc, vr as getDocs, oe as getFirestore, Nr as increment, ie as initializeFirestore, or as limit, ur as limitToLast, sr as orderBy, tr as query, pe as queryEqual, me as refEqual, kr as runTransaction, Pr as serverTimestamp, Er as setDoc, w as setLogLevel, Je as snapshotEqual, hr as startAfter, ar as startAt, ce as terminate, Tr as updateDoc, er as where, Fr as writeBatch };
|
|
5944
5958
|
//# sourceMappingURL=index.browser.esm2017.js.map
|