@firebase/firestore 3.4.4-canary.dd86989b3 → 3.4.4-canary.e8972ef49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
- package/dist/firestore/src/api.d.ts +1 -1
- package/dist/firestore/src/core/database_info.d.ts +1 -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/memory_index_manager.d.ts +11 -0
- package/dist/firestore/src/model/field_index.d.ts +4 -0
- package/dist/firestore/src/model/values.d.ts +7 -0
- package/dist/firestore/test/unit/model/target.test.d.ts +17 -0
- package/dist/firestore/test/util/helpers.d.ts +2 -2
- package/dist/index.esm2017.js +2626 -2469
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +2627 -2547
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +456 -279
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +456 -279
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +2652 -2491
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +171 -2
- package/dist/lite/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
- package/dist/lite/firestore/src/api.d.ts +1 -1
- package/dist/lite/firestore/src/core/database_info.d.ts +1 -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/memory_index_manager.d.ts +11 -0
- package/dist/lite/firestore/src/model/field_index.d.ts +4 -0
- package/dist/lite/firestore/src/model/values.d.ts +7 -0
- package/dist/lite/firestore/test/unit/model/target.test.d.ts +17 -0
- package/dist/lite/firestore/test/util/helpers.d.ts +2 -2
- package/dist/lite/index.browser.esm2017.js +1159 -1152
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +311 -308
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +39 -28
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +39 -28
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +360 -353
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +3 -2
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +125 -124
- package/dist/lite/packages/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
- package/dist/lite/packages/firestore/src/api.d.ts +1 -1
- package/dist/lite/packages/firestore/src/core/database_info.d.ts +1 -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/memory_index_manager.d.ts +11 -0
- package/dist/lite/packages/firestore/src/model/field_index.d.ts +4 -0
- package/dist/lite/packages/firestore/src/model/values.d.ts +7 -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 +2 -2
- package/dist/lite/private.d.ts +2 -2
- package/dist/packages/firestore/dist/index.esm2017.d.ts +148 -147
- package/dist/packages/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
- package/dist/packages/firestore/src/api.d.ts +1 -1
- package/dist/packages/firestore/src/core/database_info.d.ts +1 -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/memory_index_manager.d.ts +11 -0
- package/dist/packages/firestore/src/model/field_index.d.ts +4 -0
- package/dist/packages/firestore/src/model/values.d.ts +7 -0
- package/dist/packages/firestore/test/unit/model/target.test.d.ts +17 -0
- package/dist/packages/firestore/test/util/helpers.d.ts +2 -2
- package/dist/private.d.ts +170 -2
- package/package.json +9 -9
|
@@ -66,7 +66,7 @@ f.MOCK_USER = new f("mock-user");
|
|
|
66
66
|
* See the License for the specific language governing permissions and
|
|
67
67
|
* limitations under the License.
|
|
68
68
|
*/
|
|
69
|
-
let d = "9.6.5-canary.
|
|
69
|
+
let d = "9.6.5-canary.e8972ef49";
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
@@ -178,7 +178,7 @@ function y(t, ...n) {
|
|
|
178
178
|
* Returns `never` and can be used in expressions:
|
|
179
179
|
* @example
|
|
180
180
|
* let futureVar = fail('not implemented yet');
|
|
181
|
-
*/ function
|
|
181
|
+
*/ function v(t = "Unexpected state") {
|
|
182
182
|
// Log the failure in addition to throw an exception, just in case the
|
|
183
183
|
// exception is swallowed.
|
|
184
184
|
const n = `FIRESTORE (${d}) INTERNAL ASSERTION FAILED: ` + t;
|
|
@@ -193,8 +193,8 @@ function y(t, ...n) {
|
|
|
193
193
|
* given message if it did.
|
|
194
194
|
*
|
|
195
195
|
* Messages are stripped in production builds.
|
|
196
|
-
*/ function
|
|
197
|
-
t ||
|
|
196
|
+
*/ function b(t, n) {
|
|
197
|
+
t || v();
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
/**
|
|
@@ -335,7 +335,7 @@ n) {
|
|
|
335
335
|
}));
|
|
336
336
|
}
|
|
337
337
|
getToken() {
|
|
338
|
-
return this.auth ? this.auth.getToken().then((t => t ? (
|
|
338
|
+
return this.auth ? this.auth.getToken().then((t => t ? (b("string" == typeof t.accessToken),
|
|
339
339
|
new M(t.accessToken, new f(this.auth.getUid()))) : null)) : Promise.resolve(null);
|
|
340
340
|
}
|
|
341
341
|
invalidateToken() {}
|
|
@@ -389,7 +389,7 @@ class Y {
|
|
|
389
389
|
}));
|
|
390
390
|
}
|
|
391
391
|
getToken() {
|
|
392
|
-
return this.appCheck ? this.appCheck.getToken().then((t => t ? (
|
|
392
|
+
return this.appCheck ? this.appCheck.getToken().then((t => t ? (b("string" == typeof t.token),
|
|
393
393
|
new Y(t.token)) : null)) : Promise.resolve(null);
|
|
394
394
|
}
|
|
395
395
|
invalidateToken() {}
|
|
@@ -450,6 +450,9 @@ class J {
|
|
|
450
450
|
constructor(t, n) {
|
|
451
451
|
this.projectId = t, this.database = n || "(default)";
|
|
452
452
|
}
|
|
453
|
+
static empty() {
|
|
454
|
+
return new J("", "");
|
|
455
|
+
}
|
|
453
456
|
get isDefaultDatabase() {
|
|
454
457
|
return "(default)" === this.database;
|
|
455
458
|
}
|
|
@@ -479,7 +482,7 @@ class J {
|
|
|
479
482
|
*/
|
|
480
483
|
class X {
|
|
481
484
|
constructor(t, n, e) {
|
|
482
|
-
void 0 === n ? n = 0 : n > t.length &&
|
|
485
|
+
void 0 === n ? n = 0 : n > t.length && v(), void 0 === e ? e = t.length - n : e > t.length - n && v(),
|
|
483
486
|
this.segments = t, this.offset = n, this.len = e;
|
|
484
487
|
}
|
|
485
488
|
get length() {
|
|
@@ -772,7 +775,7 @@ function ot(t) {
|
|
|
772
775
|
return n ? `a custom ${n} object` : "an object";
|
|
773
776
|
}
|
|
774
777
|
}
|
|
775
|
-
return "function" == typeof t ? "a function" :
|
|
778
|
+
return "function" == typeof t ? "a function" : v();
|
|
776
779
|
}
|
|
777
780
|
|
|
778
781
|
function ut(t,
|
|
@@ -1181,7 +1184,7 @@ function _t(t, n) {
|
|
|
1181
1184
|
* For examples and further specifications, refer to the
|
|
1182
1185
|
* {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}.
|
|
1183
1186
|
*/
|
|
1184
|
-
class
|
|
1187
|
+
class vt {
|
|
1185
1188
|
/**
|
|
1186
1189
|
* Creates a new timestamp.
|
|
1187
1190
|
*
|
|
@@ -1213,7 +1216,7 @@ class bt {
|
|
|
1213
1216
|
*
|
|
1214
1217
|
* @returns a new timestamp representing the current date.
|
|
1215
1218
|
*/ static now() {
|
|
1216
|
-
return
|
|
1219
|
+
return vt.fromMillis(Date.now());
|
|
1217
1220
|
}
|
|
1218
1221
|
/**
|
|
1219
1222
|
* Creates a new timestamp from the given date.
|
|
@@ -1222,7 +1225,7 @@ class bt {
|
|
|
1222
1225
|
* @returns A new `Timestamp` representing the same point in time as the given
|
|
1223
1226
|
* date.
|
|
1224
1227
|
*/ static fromDate(t) {
|
|
1225
|
-
return
|
|
1228
|
+
return vt.fromMillis(t.getTime());
|
|
1226
1229
|
}
|
|
1227
1230
|
/**
|
|
1228
1231
|
* Creates a new timestamp from the given number of milliseconds.
|
|
@@ -1233,7 +1236,7 @@ class bt {
|
|
|
1233
1236
|
* number of milliseconds.
|
|
1234
1237
|
*/ static fromMillis(t) {
|
|
1235
1238
|
const n = Math.floor(t / 1e3), e = Math.floor(1e6 * (t - 1e3 * n));
|
|
1236
|
-
return new
|
|
1239
|
+
return new vt(n, e);
|
|
1237
1240
|
}
|
|
1238
1241
|
/**
|
|
1239
1242
|
* Converts a `Timestamp` to a JavaScript `Date` object. This conversion
|
|
@@ -1311,15 +1314,15 @@ class bt {
|
|
|
1311
1314
|
/**
|
|
1312
1315
|
* A version of a document in Firestore. This corresponds to the version
|
|
1313
1316
|
* timestamp, such as update_time or read_time.
|
|
1314
|
-
*/ class
|
|
1317
|
+
*/ class bt {
|
|
1315
1318
|
constructor(t) {
|
|
1316
1319
|
this.timestamp = t;
|
|
1317
1320
|
}
|
|
1318
1321
|
static fromTimestamp(t) {
|
|
1319
|
-
return new
|
|
1322
|
+
return new bt(t);
|
|
1320
1323
|
}
|
|
1321
1324
|
static min() {
|
|
1322
|
-
return new
|
|
1325
|
+
return new bt(new vt(0, 0));
|
|
1323
1326
|
}
|
|
1324
1327
|
compareTo(t) {
|
|
1325
1328
|
return this.timestamp._compareTo(t.timestamp);
|
|
@@ -1553,13 +1556,13 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1553
1556
|
// The json interface (for the browser) will return an iso timestamp string,
|
|
1554
1557
|
// while the proto js library (for node) will return a
|
|
1555
1558
|
// google.protobuf.Timestamp instance.
|
|
1556
|
-
if (
|
|
1559
|
+
if (b(!!t), "string" == typeof t) {
|
|
1557
1560
|
// The date string can have higher precision (nanos) than the Date class
|
|
1558
1561
|
// (millis), so we do some custom parsing here.
|
|
1559
1562
|
// Parse the nanos right out of the string.
|
|
1560
1563
|
let n = 0;
|
|
1561
1564
|
const e = Pt.exec(t);
|
|
1562
|
-
if (
|
|
1565
|
+
if (b(!!e), e[1]) {
|
|
1563
1566
|
// Pad the fraction out to 9 digits (nanos).
|
|
1564
1567
|
let t = e[1];
|
|
1565
1568
|
t = (t + "000000000").substr(0, 9), n = Number(t);
|
|
@@ -1641,7 +1644,7 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1641
1644
|
* Returns the local time at which this timestamp was first set.
|
|
1642
1645
|
*/ function Ft(t) {
|
|
1643
1646
|
const n = Vt(t.mapValue.fields.__local_write_time__.timestampValue);
|
|
1644
|
-
return new
|
|
1647
|
+
return new vt(n.seconds, n.nanos);
|
|
1645
1648
|
}
|
|
1646
1649
|
|
|
1647
1650
|
/**
|
|
@@ -1661,7 +1664,7 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1661
1664
|
* limitations under the License.
|
|
1662
1665
|
*/
|
|
1663
1666
|
/** Extracts the backend's type order for the provided value. */ function xt(t) {
|
|
1664
|
-
return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? $t(t) ? 4 /* ServerTimestampValue */ : 10 /* ObjectValue */ :
|
|
1667
|
+
return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? $t(t) ? 4 /* ServerTimestampValue */ : 10 /* ObjectValue */ : v();
|
|
1665
1668
|
}
|
|
1666
1669
|
|
|
1667
1670
|
/** Tests `left` and `right` for equality based on the backend semantics. */ function qt(t, n) {
|
|
@@ -1726,7 +1729,7 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1726
1729
|
/** Returns true if the ArrayValue contains the specified element. */ (t, n);
|
|
1727
1730
|
|
|
1728
1731
|
default:
|
|
1729
|
-
return
|
|
1732
|
+
return v();
|
|
1730
1733
|
}
|
|
1731
1734
|
}
|
|
1732
1735
|
|
|
@@ -1814,7 +1817,7 @@ function Ct(t, n) {
|
|
|
1814
1817
|
/** Returns a reference value for the provided database and key. */ (t.mapValue, n.mapValue);
|
|
1815
1818
|
|
|
1816
1819
|
default:
|
|
1817
|
-
throw
|
|
1820
|
+
throw v();
|
|
1818
1821
|
}
|
|
1819
1822
|
}
|
|
1820
1823
|
|
|
@@ -2016,23 +2019,23 @@ function kt(t, n) {
|
|
|
2016
2019
|
* Creates a document with no known version or data, but which can serve as
|
|
2017
2020
|
* base document for mutations.
|
|
2018
2021
|
*/ static newInvalidDocument(t) {
|
|
2019
|
-
return new Gt(t, 0 /* INVALID */ ,
|
|
2022
|
+
return new Gt(t, 0 /* INVALID */ , bt.min(), bt.min(), Qt.empty(), 0 /* SYNCED */);
|
|
2020
2023
|
}
|
|
2021
2024
|
/**
|
|
2022
2025
|
* Creates a new document that is known to exist with the given data at the
|
|
2023
2026
|
* given version.
|
|
2024
2027
|
*/ static newFoundDocument(t, n, e) {
|
|
2025
|
-
return new Gt(t, 1 /* FOUND_DOCUMENT */ , n,
|
|
2028
|
+
return new Gt(t, 1 /* FOUND_DOCUMENT */ , n, bt.min(), e, 0 /* SYNCED */);
|
|
2026
2029
|
}
|
|
2027
2030
|
/** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, n) {
|
|
2028
|
-
return new Gt(t, 2 /* NO_DOCUMENT */ , n,
|
|
2031
|
+
return new Gt(t, 2 /* NO_DOCUMENT */ , n, bt.min(), Qt.empty(), 0 /* SYNCED */);
|
|
2029
2032
|
}
|
|
2030
2033
|
/**
|
|
2031
2034
|
* Creates a new document that is known to exist at the given version but
|
|
2032
2035
|
* whose data is not known (e.g. a document that was updated without a known
|
|
2033
2036
|
* base document).
|
|
2034
2037
|
*/ static newUnknownDocument(t, n) {
|
|
2035
|
-
return new Gt(t, 3 /* UNKNOWN_DOCUMENT */ , n,
|
|
2038
|
+
return new Gt(t, 3 /* UNKNOWN_DOCUMENT */ , n, bt.min(), Qt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
2036
2039
|
}
|
|
2037
2040
|
/**
|
|
2038
2041
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -2171,7 +2174,7 @@ class Ht extends class {} {
|
|
|
2171
2174
|
return t >= 0;
|
|
2172
2175
|
|
|
2173
2176
|
default:
|
|
2174
|
-
return
|
|
2177
|
+
return v();
|
|
2175
2178
|
}
|
|
2176
2179
|
}
|
|
2177
2180
|
D() {
|
|
@@ -2271,7 +2274,7 @@ function Zt(t, n) {
|
|
|
2271
2274
|
* just after the provided values.
|
|
2272
2275
|
*/ class sn {
|
|
2273
2276
|
constructor(t, n) {
|
|
2274
|
-
this.position = t, this.
|
|
2277
|
+
this.position = t, this.inclusive = n;
|
|
2275
2278
|
}
|
|
2276
2279
|
}
|
|
2277
2280
|
|
|
@@ -2290,7 +2293,7 @@ function un(t, n) {
|
|
|
2290
2293
|
function cn(t, n) {
|
|
2291
2294
|
if (null === t) return null === n;
|
|
2292
2295
|
if (null === n) return !1;
|
|
2293
|
-
if (t.
|
|
2296
|
+
if (t.inclusive !== n.inclusive || t.position.length !== n.position.length) return !1;
|
|
2294
2297
|
for (let e = 0; e < t.position.length; e++) {
|
|
2295
2298
|
if (!qt(t.position[e], n.position[e])) return !1;
|
|
2296
2299
|
}
|
|
@@ -2396,7 +2399,7 @@ function dn(t) {
|
|
|
2396
2399
|
t.push(new on(e.field, n));
|
|
2397
2400
|
}
|
|
2398
2401
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
2399
|
-
const e = n.endAt ? new sn(n.endAt.position, !n.endAt.
|
|
2402
|
+
const e = n.endAt ? new sn(n.endAt.position, !n.endAt.inclusive) : null, r = n.startAt ? new sn(n.startAt.position, !n.startAt.inclusive) : null;
|
|
2400
2403
|
// Now return as a LimitType.First query.
|
|
2401
2404
|
n.S = Yt(n.path, n.collectionGroup, t, n.filters, n.limit, e, r);
|
|
2402
2405
|
}
|
|
@@ -2496,13 +2499,13 @@ function yn(t, n) {
|
|
|
2496
2499
|
|
|
2497
2500
|
/** Transforms a value into a server-generated timestamp. */ class gn extends _n {}
|
|
2498
2501
|
|
|
2499
|
-
/** Transforms an array value via a union operation. */ class
|
|
2502
|
+
/** Transforms an array value via a union operation. */ class vn extends _n {
|
|
2500
2503
|
constructor(t) {
|
|
2501
2504
|
super(), this.elements = t;
|
|
2502
2505
|
}
|
|
2503
2506
|
}
|
|
2504
2507
|
|
|
2505
|
-
/** Transforms an array value via a remove operation. */ class
|
|
2508
|
+
/** Transforms an array value via a remove operation. */ class bn extends _n {
|
|
2506
2509
|
constructor(t) {
|
|
2507
2510
|
super(), this.elements = t;
|
|
2508
2511
|
}
|
|
@@ -2750,9 +2753,9 @@ function qn(t, n) {
|
|
|
2750
2753
|
}
|
|
2751
2754
|
|
|
2752
2755
|
function On(t) {
|
|
2753
|
-
return
|
|
2756
|
+
return b(!!t), bt.fromTimestamp(function(t) {
|
|
2754
2757
|
const n = Vt(t);
|
|
2755
|
-
return new
|
|
2758
|
+
return new vt(n.seconds, n.nanos);
|
|
2756
2759
|
}(t));
|
|
2757
2760
|
}
|
|
2758
2761
|
|
|
@@ -2769,11 +2772,11 @@ function Ln(t, n) {
|
|
|
2769
2772
|
function kn(t, n) {
|
|
2770
2773
|
const e = function(t) {
|
|
2771
2774
|
const n = Z.fromString(t);
|
|
2772
|
-
return
|
|
2775
|
+
return b(Kn(n)), n;
|
|
2773
2776
|
}(n);
|
|
2774
2777
|
if (e.get(1) !== t.databaseId.projectId) throw new U(R, "Tried to deserialize key from different project: " + e.get(1) + " vs " + t.databaseId.projectId);
|
|
2775
2778
|
if (e.get(3) !== t.databaseId.database) throw new U(R, "Tried to deserialize key from different database: " + e.get(3) + " vs " + t.databaseId.database);
|
|
2776
|
-
return new et((
|
|
2779
|
+
return new et((b((r = e).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
|
|
2777
2780
|
var r;
|
|
2778
2781
|
/** Creates a Document proto from key and fields (but no create/update time) */}
|
|
2779
2782
|
|
|
@@ -2794,7 +2797,7 @@ function Mn(t, n, e) {
|
|
|
2794
2797
|
|
|
2795
2798
|
function Bn(t, n) {
|
|
2796
2799
|
return "found" in n ? function(t, n) {
|
|
2797
|
-
|
|
2800
|
+
b(!!n.found), n.found.name, n.found.updateTime;
|
|
2798
2801
|
const e = kn(t, n.found.name), r = On(n.found.updateTime), s = new Qt({
|
|
2799
2802
|
mapValue: {
|
|
2800
2803
|
fields: n.found.fields
|
|
@@ -2802,10 +2805,10 @@ function Bn(t, n) {
|
|
|
2802
2805
|
});
|
|
2803
2806
|
return Gt.newFoundDocument(e, r, s);
|
|
2804
2807
|
}(t, n) : "missing" in n ? function(t, n) {
|
|
2805
|
-
|
|
2808
|
+
b(!!n.missing), b(!!n.readTime);
|
|
2806
2809
|
const e = kn(t, n.missing), r = On(n.readTime);
|
|
2807
2810
|
return Gt.newNoDocument(e, r);
|
|
2808
|
-
}(t, n) :
|
|
2811
|
+
}(t, n) : v();
|
|
2809
2812
|
}
|
|
2810
2813
|
|
|
2811
2814
|
function zn(t, n) {
|
|
@@ -2816,9 +2819,9 @@ function zn(t, n) {
|
|
|
2816
2819
|
delete: Ln(t, n.key)
|
|
2817
2820
|
}; else if (n instanceof Pn) e = {
|
|
2818
2821
|
update: Mn(t, n.key, n.data),
|
|
2819
|
-
updateMask:
|
|
2822
|
+
updateMask: Hn(n.fieldMask)
|
|
2820
2823
|
}; else {
|
|
2821
|
-
if (!(n instanceof Nn)) return
|
|
2824
|
+
if (!(n instanceof Nn)) return v();
|
|
2822
2825
|
e = {
|
|
2823
2826
|
verify: Ln(t, n.key)
|
|
2824
2827
|
};
|
|
@@ -2829,13 +2832,13 @@ function zn(t, n) {
|
|
|
2829
2832
|
fieldPath: n.field.canonicalString(),
|
|
2830
2833
|
setToServerValue: "REQUEST_TIME"
|
|
2831
2834
|
};
|
|
2832
|
-
if (e instanceof
|
|
2835
|
+
if (e instanceof vn) return {
|
|
2833
2836
|
fieldPath: n.field.canonicalString(),
|
|
2834
2837
|
appendMissingElements: {
|
|
2835
2838
|
values: e.elements
|
|
2836
2839
|
}
|
|
2837
2840
|
};
|
|
2838
|
-
if (e instanceof
|
|
2841
|
+
if (e instanceof bn) return {
|
|
2839
2842
|
fieldPath: n.field.canonicalString(),
|
|
2840
2843
|
removeAllFromArray: {
|
|
2841
2844
|
values: e.elements
|
|
@@ -2845,13 +2848,13 @@ function zn(t, n) {
|
|
|
2845
2848
|
fieldPath: n.field.canonicalString(),
|
|
2846
2849
|
increment: e.O
|
|
2847
2850
|
};
|
|
2848
|
-
throw
|
|
2851
|
+
throw v();
|
|
2849
2852
|
}(0, t)))), n.precondition.isNone || (e.currentDocument = function(t, n) {
|
|
2850
2853
|
return void 0 !== n.updateTime ? {
|
|
2851
2854
|
updateTime: qn(t, n.updateTime)
|
|
2852
2855
|
} : void 0 !== n.exists ? {
|
|
2853
2856
|
exists: n.exists
|
|
2854
|
-
} :
|
|
2857
|
+
} : v();
|
|
2855
2858
|
}(t, n.precondition)), e;
|
|
2856
2859
|
}
|
|
2857
2860
|
|
|
@@ -2874,34 +2877,34 @@ function Qn(t, n) {
|
|
|
2874
2877
|
if ("==" /* EQUAL */ === t.op) {
|
|
2875
2878
|
if (Mt(t.value)) return {
|
|
2876
2879
|
unaryFilter: {
|
|
2877
|
-
field:
|
|
2880
|
+
field: Yn(t.field),
|
|
2878
2881
|
op: "IS_NAN"
|
|
2879
2882
|
}
|
|
2880
2883
|
};
|
|
2881
2884
|
if (jt(t.value)) return {
|
|
2882
2885
|
unaryFilter: {
|
|
2883
|
-
field:
|
|
2886
|
+
field: Yn(t.field),
|
|
2884
2887
|
op: "IS_NULL"
|
|
2885
2888
|
}
|
|
2886
2889
|
};
|
|
2887
2890
|
} else if ("!=" /* NOT_EQUAL */ === t.op) {
|
|
2888
2891
|
if (Mt(t.value)) return {
|
|
2889
2892
|
unaryFilter: {
|
|
2890
|
-
field:
|
|
2893
|
+
field: Yn(t.field),
|
|
2891
2894
|
op: "IS_NOT_NAN"
|
|
2892
2895
|
}
|
|
2893
2896
|
};
|
|
2894
2897
|
if (jt(t.value)) return {
|
|
2895
2898
|
unaryFilter: {
|
|
2896
|
-
field:
|
|
2899
|
+
field: Yn(t.field),
|
|
2897
2900
|
op: "IS_NOT_NULL"
|
|
2898
2901
|
}
|
|
2899
2902
|
};
|
|
2900
2903
|
}
|
|
2901
2904
|
return {
|
|
2902
2905
|
fieldFilter: {
|
|
2903
|
-
field:
|
|
2904
|
-
op:
|
|
2906
|
+
field: Yn(t.field),
|
|
2907
|
+
op: Wn(t.op),
|
|
2905
2908
|
value: t.value
|
|
2906
2909
|
}
|
|
2907
2910
|
};
|
|
@@ -2921,8 +2924,8 @@ function Qn(t, n) {
|
|
|
2921
2924
|
// visible for testing
|
|
2922
2925
|
function(t) {
|
|
2923
2926
|
return {
|
|
2924
|
-
field:
|
|
2925
|
-
direction:
|
|
2927
|
+
field: Yn(t.field),
|
|
2928
|
+
direction: Gn(t.dir)
|
|
2926
2929
|
};
|
|
2927
2930
|
}(t)));
|
|
2928
2931
|
}(n.orderBy);
|
|
@@ -2932,41 +2935,43 @@ function Qn(t, n) {
|
|
|
2932
2935
|
value: n
|
|
2933
2936
|
};
|
|
2934
2937
|
}(t, n.limit);
|
|
2935
|
-
|
|
2936
|
-
|
|
2938
|
+
var u;
|
|
2939
|
+
return null !== o && (e.structuredQuery.limit = o), n.startAt && (e.structuredQuery.startAt = {
|
|
2940
|
+
before: (u = n.startAt).inclusive,
|
|
2941
|
+
values: u.position
|
|
2942
|
+
}), n.endAt && (e.structuredQuery.endAt = function(t) {
|
|
2943
|
+
return {
|
|
2944
|
+
before: !t.inclusive,
|
|
2945
|
+
values: t.position
|
|
2946
|
+
};
|
|
2947
|
+
}
|
|
2948
|
+
// visible for testing
|
|
2949
|
+
(n.endAt)), e;
|
|
2937
2950
|
}
|
|
2938
2951
|
|
|
2939
2952
|
function Gn(t) {
|
|
2940
|
-
return {
|
|
2941
|
-
before: t.before,
|
|
2942
|
-
values: t.position
|
|
2943
|
-
};
|
|
2944
|
-
}
|
|
2945
|
-
|
|
2946
|
-
// visible for testing
|
|
2947
|
-
function Wn(t) {
|
|
2948
2953
|
return Dn[t];
|
|
2949
2954
|
}
|
|
2950
2955
|
|
|
2951
2956
|
// visible for testing
|
|
2952
|
-
function
|
|
2957
|
+
function Wn(t) {
|
|
2953
2958
|
return $n[t];
|
|
2954
2959
|
}
|
|
2955
2960
|
|
|
2956
|
-
function
|
|
2961
|
+
function Yn(t) {
|
|
2957
2962
|
return {
|
|
2958
2963
|
fieldPath: t.canonicalString()
|
|
2959
2964
|
};
|
|
2960
2965
|
}
|
|
2961
2966
|
|
|
2962
|
-
function
|
|
2967
|
+
function Hn(t) {
|
|
2963
2968
|
const n = [];
|
|
2964
2969
|
return t.fields.forEach((t => n.push(t.canonicalString()))), {
|
|
2965
2970
|
fieldPaths: n
|
|
2966
2971
|
};
|
|
2967
2972
|
}
|
|
2968
2973
|
|
|
2969
|
-
function
|
|
2974
|
+
function Kn(t) {
|
|
2970
2975
|
// Resource names have at least 4 components (project ID, database ID)
|
|
2971
2976
|
return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
|
|
2972
2977
|
}
|
|
@@ -2986,7 +2991,7 @@ function Jn(t) {
|
|
|
2986
2991
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2987
2992
|
* See the License for the specific language governing permissions and
|
|
2988
2993
|
* limitations under the License.
|
|
2989
|
-
*/ function
|
|
2994
|
+
*/ function Jn(t) {
|
|
2990
2995
|
return new Sn(t, /* useProto3Json= */ !0);
|
|
2991
2996
|
}
|
|
2992
2997
|
|
|
@@ -3015,7 +3020,7 @@ function Jn(t) {
|
|
|
3015
3020
|
* base delay. This prevents clients from accidentally synchronizing their
|
|
3016
3021
|
* delays causing spikes of load to the backend.
|
|
3017
3022
|
*/
|
|
3018
|
-
class
|
|
3023
|
+
class Xn {
|
|
3019
3024
|
constructor(
|
|
3020
3025
|
/**
|
|
3021
3026
|
* The AsyncQueue to run backoff operations on.
|
|
@@ -3113,7 +3118,7 @@ class Zn {
|
|
|
3113
3118
|
* An implementation of Datastore that exposes additional state for internal
|
|
3114
3119
|
* consumption.
|
|
3115
3120
|
*/
|
|
3116
|
-
class
|
|
3121
|
+
class Zn extends class {} {
|
|
3117
3122
|
constructor(t, n, e, r) {
|
|
3118
3123
|
super(), this.authCredentials = t, this.appCheckCredentials = n, this.K = e, this.q = r,
|
|
3119
3124
|
this.J = !1;
|
|
@@ -3140,14 +3145,14 @@ class te extends class {} {
|
|
|
3140
3145
|
|
|
3141
3146
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
3142
3147
|
// firestore-exp client.
|
|
3143
|
-
async function
|
|
3148
|
+
async function te(t, n) {
|
|
3144
3149
|
const e = E(t), r = jn(e.q) + "/documents", s = {
|
|
3145
3150
|
writes: n.map((t => zn(e.q, t)))
|
|
3146
3151
|
};
|
|
3147
3152
|
await e.m("Commit", r, s);
|
|
3148
3153
|
}
|
|
3149
3154
|
|
|
3150
|
-
async function
|
|
3155
|
+
async function ne(t, n) {
|
|
3151
3156
|
const e = E(t), r = jn(e.q) + "/documents", s = {
|
|
3152
3157
|
documents: n.map((t => Ln(e.q, t)))
|
|
3153
3158
|
}, i = await e.T("BatchGetDocuments", r, s), o = new Map;
|
|
@@ -3158,11 +3163,11 @@ async function ee(t, n) {
|
|
|
3158
3163
|
const u = [];
|
|
3159
3164
|
return n.forEach((t => {
|
|
3160
3165
|
const n = o.get(t.toString());
|
|
3161
|
-
|
|
3166
|
+
b(!!n), u.push(n);
|
|
3162
3167
|
})), u;
|
|
3163
3168
|
}
|
|
3164
3169
|
|
|
3165
|
-
async function
|
|
3170
|
+
async function ee(t, n) {
|
|
3166
3171
|
const e = E(t), r = Qn(e.q, mn(n));
|
|
3167
3172
|
return (await e.T("RunQuery", r.parent, {
|
|
3168
3173
|
structuredQuery: r.structuredQuery
|
|
@@ -3191,7 +3196,7 @@ async function re(t, n) {
|
|
|
3191
3196
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3192
3197
|
* See the License for the specific language governing permissions and
|
|
3193
3198
|
* limitations under the License.
|
|
3194
|
-
*/ const
|
|
3199
|
+
*/ const re = new Map;
|
|
3195
3200
|
|
|
3196
3201
|
/**
|
|
3197
3202
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -3202,17 +3207,17 @@ async function re(t, n) {
|
|
|
3202
3207
|
* instance. Callers must invoke removeComponents() when the Firestore
|
|
3203
3208
|
* instance is terminated.
|
|
3204
3209
|
*/
|
|
3205
|
-
function
|
|
3210
|
+
function se(t) {
|
|
3206
3211
|
if (t._terminated) throw new U(F, "The client has already been terminated.");
|
|
3207
|
-
if (!
|
|
3212
|
+
if (!re.has(t)) {
|
|
3208
3213
|
p("ComponentProvider", "Initializing Datastore");
|
|
3209
3214
|
const i = function(t) {
|
|
3210
3215
|
return new mt(t, fetch.bind(null));
|
|
3211
3216
|
}((n = t._databaseId, e = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
|
|
3212
|
-
new K(n, e, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o =
|
|
3213
|
-
return new
|
|
3217
|
+
new K(n, e, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = Jn(t._databaseId), u = function(t, n, e, r) {
|
|
3218
|
+
return new Zn(t, n, e, r);
|
|
3214
3219
|
}(t._authCredentials, t._appCheckCredentials, i, o);
|
|
3215
|
-
|
|
3220
|
+
re.set(t, u);
|
|
3216
3221
|
}
|
|
3217
3222
|
var n, e, r, s;
|
|
3218
3223
|
/**
|
|
@@ -3230,7 +3235,7 @@ function ie(t) {
|
|
|
3230
3235
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3231
3236
|
* See the License for the specific language governing permissions and
|
|
3232
3237
|
* limitations under the License.
|
|
3233
|
-
*/ return
|
|
3238
|
+
*/ return re.get(t);
|
|
3234
3239
|
}
|
|
3235
3240
|
|
|
3236
3241
|
/**
|
|
@@ -3242,7 +3247,7 @@ function ie(t) {
|
|
|
3242
3247
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
3243
3248
|
* defaults can be supplied and the value can be checked for equality.
|
|
3244
3249
|
*/
|
|
3245
|
-
class
|
|
3250
|
+
class ie {
|
|
3246
3251
|
constructor(t) {
|
|
3247
3252
|
var n;
|
|
3248
3253
|
if (void 0 === t.host) {
|
|
@@ -3284,14 +3289,14 @@ class oe {
|
|
|
3284
3289
|
* The Cloud Firestore service interface.
|
|
3285
3290
|
*
|
|
3286
3291
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
3287
|
-
*/ class
|
|
3292
|
+
*/ class oe {
|
|
3288
3293
|
/** @hideconstructor */
|
|
3289
3294
|
constructor(t, n, e) {
|
|
3290
3295
|
this._authCredentials = n, this._appCheckCredentials = e,
|
|
3291
3296
|
/**
|
|
3292
3297
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
3293
3298
|
*/
|
|
3294
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
3299
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new ie({}),
|
|
3295
3300
|
this._settingsFrozen = !1, t instanceof J ? this._databaseId = t : (this._app = t,
|
|
3296
3301
|
this._databaseId = function(t) {
|
|
3297
3302
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(R, '"projectId" not provided in firebase.initializeApp.');
|
|
@@ -3324,13 +3329,13 @@ class oe {
|
|
|
3324
3329
|
}
|
|
3325
3330
|
_setSettings(t) {
|
|
3326
3331
|
if (this._settingsFrozen) throw new U(F, "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.");
|
|
3327
|
-
this._settings = new
|
|
3332
|
+
this._settings = new ie(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
3328
3333
|
if (!t) return new B;
|
|
3329
3334
|
switch (t.type) {
|
|
3330
3335
|
case "gapi":
|
|
3331
3336
|
const n = t.client;
|
|
3332
3337
|
// Make sure this really is a Gapi client.
|
|
3333
|
-
return
|
|
3338
|
+
return b(!("object" != typeof n || null === n || !n.auth || !n.auth.getAuthHeaderValueForFirstParty)),
|
|
3334
3339
|
new W(n, t.sessionIndex || "0", t.iamToken || null);
|
|
3335
3340
|
|
|
3336
3341
|
case "provider":
|
|
@@ -3365,13 +3370,13 @@ class oe {
|
|
|
3365
3370
|
* Only ever called once.
|
|
3366
3371
|
*/ _terminate() {
|
|
3367
3372
|
return function(t) {
|
|
3368
|
-
const n =
|
|
3369
|
-
n && (p("ComponentProvider", "Removing Datastore"),
|
|
3373
|
+
const n = re.get(t);
|
|
3374
|
+
n && (p("ComponentProvider", "Removing Datastore"), re.delete(t), n.terminate());
|
|
3370
3375
|
}(this), Promise.resolve();
|
|
3371
3376
|
}
|
|
3372
3377
|
}
|
|
3373
3378
|
|
|
3374
|
-
function
|
|
3379
|
+
function ue(t, n) {
|
|
3375
3380
|
const e = _getProvider(t, "firestore/lite");
|
|
3376
3381
|
if (e.isInitialized()) throw new U(F, "Firestore can only be initialized once per app.");
|
|
3377
3382
|
return e.initialize({
|
|
@@ -3387,7 +3392,7 @@ function ce(t, n) {
|
|
|
3387
3392
|
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
|
|
3388
3393
|
* instance is associated with.
|
|
3389
3394
|
* @returns The `Firestore` instance of the provided app.
|
|
3390
|
-
*/ function
|
|
3395
|
+
*/ function ce(n = t()) {
|
|
3391
3396
|
return _getProvider(n, "firestore/lite").getImmediate();
|
|
3392
3397
|
}
|
|
3393
3398
|
|
|
@@ -3403,9 +3408,9 @@ function ce(t, n) {
|
|
|
3403
3408
|
* @param port - the emulator port (ex: 9000).
|
|
3404
3409
|
* @param options.mockUserToken - the mock auth token to use for unit testing
|
|
3405
3410
|
* Security Rules.
|
|
3406
|
-
*/ function
|
|
3411
|
+
*/ function ae(t, n, e, r = {}) {
|
|
3407
3412
|
var s;
|
|
3408
|
-
const i = (t = ut(t,
|
|
3413
|
+
const i = (t = ut(t, oe))._getSettings();
|
|
3409
3414
|
if ("firestore.googleapis.com" !== i.host && i.host !== n && _("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
3410
3415
|
t._setSettings(Object.assign(Object.assign({}, i), {
|
|
3411
3416
|
host: `${n}:${e}`,
|
|
@@ -3443,8 +3448,8 @@ function ce(t, n) {
|
|
|
3443
3448
|
* @param firestore - The `Firestore` instance to terminate.
|
|
3444
3449
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
3445
3450
|
* terminated.
|
|
3446
|
-
*/ function
|
|
3447
|
-
return t = ut(t,
|
|
3451
|
+
*/ function he(t) {
|
|
3452
|
+
return t = ut(t, oe), n(t.app, "firestore/lite"), t._delete();
|
|
3448
3453
|
}
|
|
3449
3454
|
|
|
3450
3455
|
/**
|
|
@@ -3484,7 +3489,7 @@ function ce(t, n) {
|
|
|
3484
3489
|
* and can be used to write, read, or listen to the location. The document at
|
|
3485
3490
|
* the referenced location may or may not exist.
|
|
3486
3491
|
*/
|
|
3487
|
-
class
|
|
3492
|
+
class le {
|
|
3488
3493
|
/** @hideconstructor */
|
|
3489
3494
|
constructor(t,
|
|
3490
3495
|
/**
|
|
@@ -3512,17 +3517,17 @@ class fe {
|
|
|
3512
3517
|
/**
|
|
3513
3518
|
* The collection this `DocumentReference` belongs to.
|
|
3514
3519
|
*/ get parent() {
|
|
3515
|
-
return new
|
|
3520
|
+
return new de(this.firestore, this.converter, this._key.path.popLast());
|
|
3516
3521
|
}
|
|
3517
3522
|
withConverter(t) {
|
|
3518
|
-
return new
|
|
3523
|
+
return new le(this.firestore, t, this._key);
|
|
3519
3524
|
}
|
|
3520
3525
|
}
|
|
3521
3526
|
|
|
3522
3527
|
/**
|
|
3523
3528
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
3524
3529
|
* construct refined `Query` objects by adding filters and ordering.
|
|
3525
|
-
*/ class
|
|
3530
|
+
*/ class fe {
|
|
3526
3531
|
// This is the lite version of the Query class in the main SDK.
|
|
3527
3532
|
/** @hideconstructor protected */
|
|
3528
3533
|
constructor(t,
|
|
@@ -3535,14 +3540,14 @@ class fe {
|
|
|
3535
3540
|
this.type = "query", this.firestore = t;
|
|
3536
3541
|
}
|
|
3537
3542
|
withConverter(t) {
|
|
3538
|
-
return new
|
|
3543
|
+
return new fe(this.firestore, t, this._query);
|
|
3539
3544
|
}
|
|
3540
3545
|
}
|
|
3541
3546
|
|
|
3542
3547
|
/**
|
|
3543
3548
|
* A `CollectionReference` object can be used for adding documents, getting
|
|
3544
3549
|
* document references, and querying for documents (using {@link query}).
|
|
3545
|
-
*/ class
|
|
3550
|
+
*/ class de extends fe {
|
|
3546
3551
|
/** @hideconstructor */
|
|
3547
3552
|
constructor(t, n, e) {
|
|
3548
3553
|
super(t, n, new an(e)), this._path = e,
|
|
@@ -3563,23 +3568,23 @@ class fe {
|
|
|
3563
3568
|
* subcollection. If this isn't a subcollection, the reference is null.
|
|
3564
3569
|
*/ get parent() {
|
|
3565
3570
|
const t = this._path.popLast();
|
|
3566
|
-
return t.isEmpty() ? null : new
|
|
3571
|
+
return t.isEmpty() ? null : new le(this.firestore,
|
|
3567
3572
|
/* converter= */ null, new et(t));
|
|
3568
3573
|
}
|
|
3569
3574
|
withConverter(t) {
|
|
3570
|
-
return new
|
|
3575
|
+
return new de(this.firestore, t, this._path);
|
|
3571
3576
|
}
|
|
3572
3577
|
}
|
|
3573
3578
|
|
|
3574
|
-
function
|
|
3575
|
-
if (t = l(t), rt("collection", "path", n), t instanceof
|
|
3579
|
+
function we(t, n, ...e) {
|
|
3580
|
+
if (t = l(t), rt("collection", "path", n), t instanceof oe) {
|
|
3576
3581
|
const r = Z.fromString(n, ...e);
|
|
3577
|
-
return it(r), new
|
|
3582
|
+
return it(r), new de(t, /* converter= */ null, r);
|
|
3578
3583
|
}
|
|
3579
3584
|
{
|
|
3580
|
-
if (!(t instanceof
|
|
3585
|
+
if (!(t instanceof le || t instanceof de)) throw new U(R, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3581
3586
|
const r = t._path.child(Z.fromString(n, ...e));
|
|
3582
|
-
return it(r), new
|
|
3587
|
+
return it(r), new de(t.firestore,
|
|
3583
3588
|
/* converter= */ null, r);
|
|
3584
3589
|
}
|
|
3585
3590
|
}
|
|
@@ -3596,9 +3601,9 @@ function me(t, n, ...e) {
|
|
|
3596
3601
|
* collection or subcollection with this ID as the last segment of its path
|
|
3597
3602
|
* will be included. Cannot contain a slash.
|
|
3598
3603
|
* @returns The created `Query`.
|
|
3599
|
-
*/ function
|
|
3600
|
-
if (t = ut(t,
|
|
3601
|
-
return new
|
|
3604
|
+
*/ function me(t, n) {
|
|
3605
|
+
if (t = ut(t, oe), rt("collectionGroup", "collection id", n), n.indexOf("/") >= 0) throw new U(R, `Invalid collection ID '${n}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
3606
|
+
return new fe(t,
|
|
3602
3607
|
/* converter= */ null,
|
|
3603
3608
|
/**
|
|
3604
3609
|
* Creates a new Query for a collection group query that matches all documents
|
|
@@ -3609,19 +3614,19 @@ function me(t, n, ...e) {
|
|
|
3609
3614
|
}(n));
|
|
3610
3615
|
}
|
|
3611
3616
|
|
|
3612
|
-
function
|
|
3617
|
+
function pe(t, n, ...e) {
|
|
3613
3618
|
if (t = l(t),
|
|
3614
3619
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
3615
3620
|
// 'undefined' and 'null'.
|
|
3616
|
-
1 === arguments.length && (n = yt.R()), rt("doc", "path", n), t instanceof
|
|
3621
|
+
1 === arguments.length && (n = yt.R()), rt("doc", "path", n), t instanceof oe) {
|
|
3617
3622
|
const r = Z.fromString(n, ...e);
|
|
3618
|
-
return st(r), new
|
|
3623
|
+
return st(r), new le(t,
|
|
3619
3624
|
/* converter= */ null, new et(r));
|
|
3620
3625
|
}
|
|
3621
3626
|
{
|
|
3622
|
-
if (!(t instanceof
|
|
3627
|
+
if (!(t instanceof le || t instanceof de)) throw new U(R, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3623
3628
|
const r = t._path.child(Z.fromString(n, ...e));
|
|
3624
|
-
return st(r), new
|
|
3629
|
+
return st(r), new le(t.firestore, t instanceof de ? t.converter : null, new et(r));
|
|
3625
3630
|
}
|
|
3626
3631
|
}
|
|
3627
3632
|
|
|
@@ -3632,8 +3637,8 @@ function ye(t, n, ...e) {
|
|
|
3632
3637
|
* @param right - A reference to compare.
|
|
3633
3638
|
* @returns true if the references point to the same location in the same
|
|
3634
3639
|
* Firestore database.
|
|
3635
|
-
*/ function
|
|
3636
|
-
return t = l(t), n = l(n), (t instanceof
|
|
3640
|
+
*/ function ye(t, n) {
|
|
3641
|
+
return t = l(t), n = l(n), (t instanceof le || t instanceof de) && (n instanceof le || n instanceof de) && (t.firestore === n.firestore && t.path === n.path && t.converter === n.converter);
|
|
3637
3642
|
}
|
|
3638
3643
|
|
|
3639
3644
|
/**
|
|
@@ -3644,8 +3649,8 @@ function ye(t, n, ...e) {
|
|
|
3644
3649
|
* @param right - A `Query` to compare.
|
|
3645
3650
|
* @returns true if the references point to the same location in the same
|
|
3646
3651
|
* Firestore database.
|
|
3647
|
-
*/ function
|
|
3648
|
-
return t = l(t), n = l(n), t instanceof
|
|
3652
|
+
*/ function _e(t, n) {
|
|
3653
|
+
return t = l(t), n = l(n), t instanceof fe && n instanceof fe && (t.firestore === n.firestore && pn(t._query, n._query) && t.converter === n.converter);
|
|
3649
3654
|
}
|
|
3650
3655
|
|
|
3651
3656
|
/**
|
|
@@ -3671,7 +3676,7 @@ function ye(t, n, ...e) {
|
|
|
3671
3676
|
*
|
|
3672
3677
|
* Create a `FieldPath` by providing field names. If more than one field
|
|
3673
3678
|
* name is provided, the path will point to a nested field in a document.
|
|
3674
|
-
*/ class
|
|
3679
|
+
*/ class ge {
|
|
3675
3680
|
/**
|
|
3676
3681
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
3677
3682
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -3696,7 +3701,7 @@ function ye(t, n, ...e) {
|
|
|
3696
3701
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
3697
3702
|
* It can be used in queries to sort or filter by the document ID.
|
|
3698
3703
|
*/ function ve() {
|
|
3699
|
-
return new
|
|
3704
|
+
return new ge("__name__");
|
|
3700
3705
|
}
|
|
3701
3706
|
|
|
3702
3707
|
/**
|
|
@@ -3717,7 +3722,7 @@ function ye(t, n, ...e) {
|
|
|
3717
3722
|
*/
|
|
3718
3723
|
/**
|
|
3719
3724
|
* An immutable object representing an array of bytes.
|
|
3720
|
-
*/ class
|
|
3725
|
+
*/ class be {
|
|
3721
3726
|
/** @hideconstructor */
|
|
3722
3727
|
constructor(t) {
|
|
3723
3728
|
this._byteString = t;
|
|
@@ -3729,7 +3734,7 @@ function ye(t, n, ...e) {
|
|
|
3729
3734
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
3730
3735
|
*/ static fromBase64String(t) {
|
|
3731
3736
|
try {
|
|
3732
|
-
return new
|
|
3737
|
+
return new be(Rt.fromBase64String(t));
|
|
3733
3738
|
} catch (t) {
|
|
3734
3739
|
throw new U(R, "Failed to construct data from Base64 string: " + t);
|
|
3735
3740
|
}
|
|
@@ -3739,7 +3744,7 @@ function ye(t, n, ...e) {
|
|
|
3739
3744
|
*
|
|
3740
3745
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
3741
3746
|
*/ static fromUint8Array(t) {
|
|
3742
|
-
return new
|
|
3747
|
+
return new be(Rt.fromUint8Array(t));
|
|
3743
3748
|
}
|
|
3744
3749
|
/**
|
|
3745
3750
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -3791,7 +3796,7 @@ function ye(t, n, ...e) {
|
|
|
3791
3796
|
/**
|
|
3792
3797
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
3793
3798
|
* or `update()`.
|
|
3794
|
-
*/ class
|
|
3799
|
+
*/ class Ee {
|
|
3795
3800
|
/**
|
|
3796
3801
|
* @param _methodName - The public API endpoint that returns this class.
|
|
3797
3802
|
* @hideconstructor
|
|
@@ -3823,7 +3828,7 @@ function ye(t, n, ...e) {
|
|
|
3823
3828
|
*
|
|
3824
3829
|
* Latitude values are in the range of [-90, 90].
|
|
3825
3830
|
* Longitude values are in the range of [-180, 180].
|
|
3826
|
-
*/ class
|
|
3831
|
+
*/ class Te {
|
|
3827
3832
|
/**
|
|
3828
3833
|
* Creates a new immutable `GeoPoint` object with the provided latitude and
|
|
3829
3834
|
* longitude values.
|
|
@@ -3882,9 +3887,9 @@ function ye(t, n, ...e) {
|
|
|
3882
3887
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3883
3888
|
* See the License for the specific language governing permissions and
|
|
3884
3889
|
* limitations under the License.
|
|
3885
|
-
*/ const
|
|
3890
|
+
*/ const Ie = /^__.*__$/;
|
|
3886
3891
|
|
|
3887
|
-
/** The result of parsing document data (e.g. for a setData call). */ class
|
|
3892
|
+
/** The result of parsing document data (e.g. for a setData call). */ class Ae {
|
|
3888
3893
|
constructor(t, n, e) {
|
|
3889
3894
|
this.data = t, this.fieldMask = n, this.fieldTransforms = e;
|
|
3890
3895
|
}
|
|
@@ -3893,7 +3898,7 @@ function ye(t, n, ...e) {
|
|
|
3893
3898
|
}
|
|
3894
3899
|
}
|
|
3895
3900
|
|
|
3896
|
-
/** The result of parsing "update" data (i.e. for an updateData call). */ class
|
|
3901
|
+
/** The result of parsing "update" data (i.e. for an updateData call). */ class Re {
|
|
3897
3902
|
constructor(t,
|
|
3898
3903
|
// The fieldMask does not include document transforms.
|
|
3899
3904
|
n, e) {
|
|
@@ -3904,7 +3909,7 @@ function ye(t, n, ...e) {
|
|
|
3904
3909
|
}
|
|
3905
3910
|
}
|
|
3906
3911
|
|
|
3907
|
-
function
|
|
3912
|
+
function Pe(t) {
|
|
3908
3913
|
switch (t) {
|
|
3909
3914
|
case 0 /* Set */ :
|
|
3910
3915
|
// fall through
|
|
@@ -3918,11 +3923,11 @@ function Ve(t) {
|
|
|
3918
3923
|
return !1;
|
|
3919
3924
|
|
|
3920
3925
|
default:
|
|
3921
|
-
throw
|
|
3926
|
+
throw v();
|
|
3922
3927
|
}
|
|
3923
3928
|
}
|
|
3924
3929
|
|
|
3925
|
-
/** A "context" object passed around while parsing user data. */ class
|
|
3930
|
+
/** A "context" object passed around while parsing user data. */ class Ve {
|
|
3926
3931
|
/**
|
|
3927
3932
|
* Initializes a ParseContext with the given source and path.
|
|
3928
3933
|
*
|
|
@@ -3954,7 +3959,7 @@ function Ve(t) {
|
|
|
3954
3959
|
return this.settings.tt;
|
|
3955
3960
|
}
|
|
3956
3961
|
/** Returns a new context with the specified settings overwritten. */ nt(t) {
|
|
3957
|
-
return new
|
|
3962
|
+
return new Ve(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.q, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
3958
3963
|
}
|
|
3959
3964
|
et(t) {
|
|
3960
3965
|
var n;
|
|
@@ -3981,7 +3986,7 @@ function Ve(t) {
|
|
|
3981
3986
|
});
|
|
3982
3987
|
}
|
|
3983
3988
|
ut(t) {
|
|
3984
|
-
return
|
|
3989
|
+
return Ye(t, this.settings.methodName, this.settings.ct || !1, this.path, this.settings.at);
|
|
3985
3990
|
}
|
|
3986
3991
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
3987
3992
|
return void 0 !== this.fieldMask.find((n => t.isPrefixOf(n))) || void 0 !== this.fieldTransforms.find((n => t.isPrefixOf(n.field)));
|
|
@@ -3993,19 +3998,19 @@ function Ve(t) {
|
|
|
3993
3998
|
}
|
|
3994
3999
|
st(t) {
|
|
3995
4000
|
if (0 === t.length) throw this.ut("Document fields must not be empty");
|
|
3996
|
-
if (
|
|
4001
|
+
if (Pe(this.tt) && Ie.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
|
|
3997
4002
|
}
|
|
3998
4003
|
}
|
|
3999
4004
|
|
|
4000
4005
|
/**
|
|
4001
4006
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
4002
4007
|
* classes.
|
|
4003
|
-
*/ class
|
|
4008
|
+
*/ class Ne {
|
|
4004
4009
|
constructor(t, n, e) {
|
|
4005
|
-
this.databaseId = t, this.ignoreUndefinedProperties = n, this.q = e ||
|
|
4010
|
+
this.databaseId = t, this.ignoreUndefinedProperties = n, this.q = e || Jn(t);
|
|
4006
4011
|
}
|
|
4007
4012
|
/** Creates a new top-level parse context. */ ht(t, n, e, r = !1) {
|
|
4008
|
-
return new
|
|
4013
|
+
return new Ve({
|
|
4009
4014
|
tt: t,
|
|
4010
4015
|
methodName: n,
|
|
4011
4016
|
at: e,
|
|
@@ -4016,29 +4021,29 @@ function Ve(t) {
|
|
|
4016
4021
|
}
|
|
4017
4022
|
}
|
|
4018
4023
|
|
|
4019
|
-
function
|
|
4020
|
-
const n = t._freezeSettings(), e =
|
|
4021
|
-
return new
|
|
4024
|
+
function De(t) {
|
|
4025
|
+
const n = t._freezeSettings(), e = Jn(t._databaseId);
|
|
4026
|
+
return new Ne(t._databaseId, !!n.ignoreUndefinedProperties, e);
|
|
4022
4027
|
}
|
|
4023
4028
|
|
|
4024
|
-
/** Parse document data from a set() call. */ function
|
|
4029
|
+
/** Parse document data from a set() call. */ function $e(t, n, e, r, s, i = {}) {
|
|
4025
4030
|
const o = t.ht(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , n, e, s);
|
|
4026
|
-
|
|
4027
|
-
const u =
|
|
4031
|
+
ze("Data must be an object, but it was:", o, r);
|
|
4032
|
+
const u = Me(r, o);
|
|
4028
4033
|
let c, a;
|
|
4029
4034
|
if (i.merge) c = new It(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
|
|
4030
4035
|
const t = [];
|
|
4031
4036
|
for (const r of i.mergeFields) {
|
|
4032
|
-
const s =
|
|
4037
|
+
const s = Qe(n, r, e);
|
|
4033
4038
|
if (!o.contains(s)) throw new U(R, `Field '${s}' is specified in your field mask but missing from your input data.`);
|
|
4034
|
-
|
|
4039
|
+
He(t, s) || t.push(s);
|
|
4035
4040
|
}
|
|
4036
4041
|
c = new It(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
|
|
4037
4042
|
} else c = null, a = o.fieldTransforms;
|
|
4038
|
-
return new
|
|
4043
|
+
return new Ae(new Qt(u), c, a);
|
|
4039
4044
|
}
|
|
4040
4045
|
|
|
4041
|
-
class
|
|
4046
|
+
class Se extends Ee {
|
|
4042
4047
|
_toFieldTransform(t) {
|
|
4043
4048
|
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}`);
|
|
4044
4049
|
// No transform to add for a delete, but we need to add it to our
|
|
@@ -4046,7 +4051,7 @@ class Fe extends Te {
|
|
|
4046
4051
|
return t.fieldMask.push(t.path), null;
|
|
4047
4052
|
}
|
|
4048
4053
|
isEqual(t) {
|
|
4049
|
-
return t instanceof
|
|
4054
|
+
return t instanceof Se;
|
|
4050
4055
|
}
|
|
4051
4056
|
}
|
|
4052
4057
|
|
|
@@ -4065,8 +4070,8 @@ class Fe extends Te {
|
|
|
4065
4070
|
* context.
|
|
4066
4071
|
* @param context - The parent context.
|
|
4067
4072
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4068
|
-
*/ function
|
|
4069
|
-
return new
|
|
4073
|
+
*/ function Fe(t, n, e) {
|
|
4074
|
+
return new Ve({
|
|
4070
4075
|
tt: 3 /* Argument */ ,
|
|
4071
4076
|
at: n.settings.at,
|
|
4072
4077
|
methodName: t._methodName,
|
|
@@ -4074,22 +4079,22 @@ class Fe extends Te {
|
|
|
4074
4079
|
}, n.databaseId, n.q, n.ignoreUndefinedProperties);
|
|
4075
4080
|
}
|
|
4076
4081
|
|
|
4077
|
-
class
|
|
4082
|
+
class xe extends Ee {
|
|
4078
4083
|
_toFieldTransform(t) {
|
|
4079
4084
|
return new Tn(t.path, new gn);
|
|
4080
4085
|
}
|
|
4081
4086
|
isEqual(t) {
|
|
4082
|
-
return t instanceof
|
|
4087
|
+
return t instanceof xe;
|
|
4083
4088
|
}
|
|
4084
4089
|
}
|
|
4085
4090
|
|
|
4086
|
-
class
|
|
4091
|
+
class qe extends Ee {
|
|
4087
4092
|
constructor(t, n) {
|
|
4088
4093
|
super(t), this.lt = n;
|
|
4089
4094
|
}
|
|
4090
4095
|
_toFieldTransform(t) {
|
|
4091
|
-
const n =
|
|
4092
|
-
/*array=*/ !0), e = this.lt.map((t =>
|
|
4096
|
+
const n = Fe(this, t,
|
|
4097
|
+
/*array=*/ !0), e = this.lt.map((t => je(t, n))), r = new vn(e);
|
|
4093
4098
|
return new Tn(t.path, r);
|
|
4094
4099
|
}
|
|
4095
4100
|
isEqual(t) {
|
|
@@ -4098,13 +4103,13 @@ class Oe extends Te {
|
|
|
4098
4103
|
}
|
|
4099
4104
|
}
|
|
4100
4105
|
|
|
4101
|
-
class
|
|
4106
|
+
class Oe extends Ee {
|
|
4102
4107
|
constructor(t, n) {
|
|
4103
4108
|
super(t), this.lt = n;
|
|
4104
4109
|
}
|
|
4105
4110
|
_toFieldTransform(t) {
|
|
4106
|
-
const n =
|
|
4107
|
-
/*array=*/ !0), e = this.lt.map((t =>
|
|
4111
|
+
const n = Fe(this, t,
|
|
4112
|
+
/*array=*/ !0), e = this.lt.map((t => je(t, n))), r = new bn(e);
|
|
4108
4113
|
return new Tn(t.path, r);
|
|
4109
4114
|
}
|
|
4110
4115
|
isEqual(t) {
|
|
@@ -4113,7 +4118,7 @@ class Ce extends Te {
|
|
|
4113
4118
|
}
|
|
4114
4119
|
}
|
|
4115
4120
|
|
|
4116
|
-
class
|
|
4121
|
+
class Ce extends Ee {
|
|
4117
4122
|
constructor(t, n) {
|
|
4118
4123
|
super(t), this.ft = n;
|
|
4119
4124
|
}
|
|
@@ -4127,50 +4132,50 @@ class Le extends Te {
|
|
|
4127
4132
|
}
|
|
4128
4133
|
}
|
|
4129
4134
|
|
|
4130
|
-
/** Parse update data from an update() call. */ function
|
|
4135
|
+
/** Parse update data from an update() call. */ function Le(t, n, e, r) {
|
|
4131
4136
|
const s = t.ht(1 /* Update */ , n, e);
|
|
4132
|
-
|
|
4137
|
+
ze("Data must be an object, but it was:", s, r);
|
|
4133
4138
|
const i = [], o = Qt.empty();
|
|
4134
4139
|
Tt(r, ((t, r) => {
|
|
4135
|
-
const u =
|
|
4140
|
+
const u = We(n, t, e);
|
|
4136
4141
|
// For Compat types, we have to "extract" the underlying types before
|
|
4137
4142
|
// performing validation.
|
|
4138
4143
|
r = l(r);
|
|
4139
4144
|
const c = s.it(u);
|
|
4140
|
-
if (r instanceof
|
|
4145
|
+
if (r instanceof Se)
|
|
4141
4146
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4142
4147
|
i.push(u); else {
|
|
4143
|
-
const t =
|
|
4148
|
+
const t = je(r, c);
|
|
4144
4149
|
null != t && (i.push(u), o.set(u, t));
|
|
4145
4150
|
}
|
|
4146
4151
|
}));
|
|
4147
4152
|
const u = new It(i);
|
|
4148
|
-
return new
|
|
4153
|
+
return new Re(o, u, s.fieldTransforms);
|
|
4149
4154
|
}
|
|
4150
4155
|
|
|
4151
|
-
/** Parse update data from a list of field/value arguments. */ function
|
|
4152
|
-
const o = t.ht(1 /* Update */ , n, e), u = [
|
|
4156
|
+
/** Parse update data from a list of field/value arguments. */ function ke(t, n, e, r, s, i) {
|
|
4157
|
+
const o = t.ht(1 /* Update */ , n, e), u = [ Qe(n, r, e) ], c = [ s ];
|
|
4153
4158
|
if (i.length % 2 != 0) throw new U(R, `Function ${n}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
4154
|
-
for (let t = 0; t < i.length; t += 2) u.push(
|
|
4159
|
+
for (let t = 0; t < i.length; t += 2) u.push(Qe(n, i[t])), c.push(i[t + 1]);
|
|
4155
4160
|
const a = [], h = Qt.empty();
|
|
4156
4161
|
// We iterate in reverse order to pick the last value for a field if the
|
|
4157
4162
|
// user specified the field multiple times.
|
|
4158
|
-
for (let t = u.length - 1; t >= 0; --t) if (!
|
|
4163
|
+
for (let t = u.length - 1; t >= 0; --t) if (!He(a, u[t])) {
|
|
4159
4164
|
const n = u[t];
|
|
4160
4165
|
let e = c[t];
|
|
4161
4166
|
// For Compat types, we have to "extract" the underlying types before
|
|
4162
4167
|
// performing validation.
|
|
4163
4168
|
e = l(e);
|
|
4164
4169
|
const r = o.it(n);
|
|
4165
|
-
if (e instanceof
|
|
4170
|
+
if (e instanceof Se)
|
|
4166
4171
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4167
4172
|
a.push(n); else {
|
|
4168
|
-
const t =
|
|
4173
|
+
const t = je(e, r);
|
|
4169
4174
|
null != t && (a.push(n), h.set(n, t));
|
|
4170
4175
|
}
|
|
4171
4176
|
}
|
|
4172
4177
|
const f = new It(a);
|
|
4173
|
-
return new
|
|
4178
|
+
return new Re(h, f, o.fieldTransforms);
|
|
4174
4179
|
}
|
|
4175
4180
|
|
|
4176
4181
|
/**
|
|
@@ -4179,8 +4184,8 @@ class Le extends Te {
|
|
|
4179
4184
|
*
|
|
4180
4185
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
4181
4186
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
4182
|
-
*/ function
|
|
4183
|
-
return
|
|
4187
|
+
*/ function Ue(t, n, e, r = !1) {
|
|
4188
|
+
return je(e, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , n));
|
|
4184
4189
|
}
|
|
4185
4190
|
|
|
4186
4191
|
/**
|
|
@@ -4191,12 +4196,12 @@ class Le extends Te {
|
|
|
4191
4196
|
* the source of the data being parsed, etc.
|
|
4192
4197
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
4193
4198
|
* that should not be included in the resulting parsed data.
|
|
4194
|
-
*/ function
|
|
4195
|
-
if (
|
|
4199
|
+
*/ function je(t, n) {
|
|
4200
|
+
if (Be(
|
|
4196
4201
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
4197
4202
|
// from firestore-exp.
|
|
4198
|
-
t = l(t))) return
|
|
4199
|
-
if (t instanceof
|
|
4203
|
+
t = l(t))) return ze("Unsupported field value:", n, t), Me(t, n);
|
|
4204
|
+
if (t instanceof Ee)
|
|
4200
4205
|
// FieldValues usually parse into transforms (except deleteField())
|
|
4201
4206
|
// in which case we do not want to include this field in our parsed data
|
|
4202
4207
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -4208,7 +4213,7 @@ class Le extends Te {
|
|
|
4208
4213
|
*/
|
|
4209
4214
|
return function(t, n) {
|
|
4210
4215
|
// Sentinels are only supported with writes, and not within arrays.
|
|
4211
|
-
if (!
|
|
4216
|
+
if (!Pe(n.tt)) throw n.ut(`${t._methodName}() can only be used with update() and set()`);
|
|
4212
4217
|
if (!n.path) throw n.ut(`${t._methodName}() is not currently supported inside arrays`);
|
|
4213
4218
|
const e = t._toFieldTransform(n);
|
|
4214
4219
|
e && n.fieldTransforms.push(e);
|
|
@@ -4238,7 +4243,7 @@ class Le extends Te {
|
|
|
4238
4243
|
const e = [];
|
|
4239
4244
|
let r = 0;
|
|
4240
4245
|
for (const s of t) {
|
|
4241
|
-
let t =
|
|
4246
|
+
let t = je(s, n.ot(r));
|
|
4242
4247
|
null == t && (
|
|
4243
4248
|
// Just include nulls in the array for fields being replaced with a
|
|
4244
4249
|
// sentinel.
|
|
@@ -4265,30 +4270,30 @@ class Le extends Te {
|
|
|
4265
4270
|
stringValue: t
|
|
4266
4271
|
};
|
|
4267
4272
|
if (t instanceof Date) {
|
|
4268
|
-
const e =
|
|
4273
|
+
const e = vt.fromDate(t);
|
|
4269
4274
|
return {
|
|
4270
4275
|
timestampValue: Fn(n.q, e)
|
|
4271
4276
|
};
|
|
4272
4277
|
}
|
|
4273
|
-
if (t instanceof
|
|
4278
|
+
if (t instanceof vt) {
|
|
4274
4279
|
// Firestore backend truncates precision down to microseconds. To ensure
|
|
4275
4280
|
// offline mode works the same with regards to truncation, perform the
|
|
4276
4281
|
// truncation immediately without waiting for the backend to do that.
|
|
4277
|
-
const e = new
|
|
4282
|
+
const e = new vt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
4278
4283
|
return {
|
|
4279
4284
|
timestampValue: Fn(n.q, e)
|
|
4280
4285
|
};
|
|
4281
4286
|
}
|
|
4282
|
-
if (t instanceof
|
|
4287
|
+
if (t instanceof Te) return {
|
|
4283
4288
|
geoPointValue: {
|
|
4284
4289
|
latitude: t.latitude,
|
|
4285
4290
|
longitude: t.longitude
|
|
4286
4291
|
}
|
|
4287
4292
|
};
|
|
4288
|
-
if (t instanceof
|
|
4293
|
+
if (t instanceof be) return {
|
|
4289
4294
|
bytesValue: xn(n.q, t._byteString)
|
|
4290
4295
|
};
|
|
4291
|
-
if (t instanceof
|
|
4296
|
+
if (t instanceof le) {
|
|
4292
4297
|
const e = n.databaseId, r = t.firestore._databaseId;
|
|
4293
4298
|
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}`);
|
|
4294
4299
|
return {
|
|
@@ -4306,13 +4311,13 @@ class Le extends Te {
|
|
|
4306
4311
|
*/ (t, n);
|
|
4307
4312
|
}
|
|
4308
4313
|
|
|
4309
|
-
function
|
|
4314
|
+
function Me(t, n) {
|
|
4310
4315
|
const e = {};
|
|
4311
4316
|
return !function(t) {
|
|
4312
4317
|
for (const n in t) if (Object.prototype.hasOwnProperty.call(t, n)) return !1;
|
|
4313
4318
|
return !0;
|
|
4314
4319
|
}(t) ? Tt(t, ((t, r) => {
|
|
4315
|
-
const s =
|
|
4320
|
+
const s = je(r, n.et(t));
|
|
4316
4321
|
null != s && (e[t] = s);
|
|
4317
4322
|
})) :
|
|
4318
4323
|
// If we encounter an empty object, we explicitly add it to the update
|
|
@@ -4324,12 +4329,12 @@ function Be(t, n) {
|
|
|
4324
4329
|
};
|
|
4325
4330
|
}
|
|
4326
4331
|
|
|
4327
|
-
function
|
|
4328
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof
|
|
4332
|
+
function Be(t) {
|
|
4333
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof vt || t instanceof Te || t instanceof be || t instanceof le || t instanceof Ee);
|
|
4329
4334
|
}
|
|
4330
4335
|
|
|
4331
|
-
function
|
|
4332
|
-
if (!
|
|
4336
|
+
function ze(t, n, e) {
|
|
4337
|
+
if (!Be(e) || !function(t) {
|
|
4333
4338
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
4334
4339
|
}(e)) {
|
|
4335
4340
|
const r = ot(e);
|
|
@@ -4339,20 +4344,20 @@ function Qe(t, n, e) {
|
|
|
4339
4344
|
|
|
4340
4345
|
/**
|
|
4341
4346
|
* Helper that calls fromDotSeparatedString() but wraps any error thrown.
|
|
4342
|
-
*/ function
|
|
4347
|
+
*/ function Qe(t, n, e) {
|
|
4343
4348
|
if ((
|
|
4344
4349
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
4345
4350
|
// FieldPath.
|
|
4346
|
-
n = l(n)) instanceof
|
|
4347
|
-
if ("string" == typeof n) return
|
|
4348
|
-
throw
|
|
4351
|
+
n = l(n)) instanceof ge) return n._internalPath;
|
|
4352
|
+
if ("string" == typeof n) return We(t, n);
|
|
4353
|
+
throw Ye("Field path arguments must be of type string or ", t,
|
|
4349
4354
|
/* hasConverter= */ !1,
|
|
4350
4355
|
/* path= */ void 0, e);
|
|
4351
4356
|
}
|
|
4352
4357
|
|
|
4353
4358
|
/**
|
|
4354
4359
|
* Matches any characters in a field path string that are reserved.
|
|
4355
|
-
*/ const
|
|
4360
|
+
*/ const Ge = new RegExp("[~\\*/\\[\\]]");
|
|
4356
4361
|
|
|
4357
4362
|
/**
|
|
4358
4363
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -4362,20 +4367,20 @@ function Qe(t, n, e) {
|
|
|
4362
4367
|
* split on dots.
|
|
4363
4368
|
* @param targetDoc - The document against which the field path will be
|
|
4364
4369
|
* evaluated.
|
|
4365
|
-
*/ function
|
|
4366
|
-
if (n.search(
|
|
4370
|
+
*/ function We(t, n, e) {
|
|
4371
|
+
if (n.search(Ge) >= 0) throw Ye(`Invalid field path (${n}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
|
|
4367
4372
|
/* hasConverter= */ !1,
|
|
4368
4373
|
/* path= */ void 0, e);
|
|
4369
4374
|
try {
|
|
4370
|
-
return new
|
|
4375
|
+
return new ge(...n.split("."))._internalPath;
|
|
4371
4376
|
} catch (r) {
|
|
4372
|
-
throw
|
|
4377
|
+
throw Ye(`Invalid field path (${n}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
|
|
4373
4378
|
/* hasConverter= */ !1,
|
|
4374
4379
|
/* path= */ void 0, e);
|
|
4375
4380
|
}
|
|
4376
4381
|
}
|
|
4377
4382
|
|
|
4378
|
-
function
|
|
4383
|
+
function Ye(t, n, e, r, s) {
|
|
4379
4384
|
const i = r && !r.isEmpty(), o = void 0 !== s;
|
|
4380
4385
|
let u = `Function ${n}() called with invalid data`;
|
|
4381
4386
|
e && (u += " (via `toFirestore()`)"), u += ". ";
|
|
@@ -4384,7 +4389,7 @@ function He(t, n, e, r, s) {
|
|
|
4384
4389
|
c += ")"), new U(R, u + t + c);
|
|
4385
4390
|
}
|
|
4386
4391
|
|
|
4387
|
-
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function
|
|
4392
|
+
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function He(t, n) {
|
|
4388
4393
|
return t.some((t => t.isEqual(n)));
|
|
4389
4394
|
}
|
|
4390
4395
|
|
|
@@ -4412,7 +4417,7 @@ function He(t, n, e, r, s) {
|
|
|
4412
4417
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
4413
4418
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
4414
4419
|
* explicitly verify a document's existence.
|
|
4415
|
-
*/ class
|
|
4420
|
+
*/ class Ke {
|
|
4416
4421
|
// Note: This class is stripped down version of the DocumentSnapshot in
|
|
4417
4422
|
// the legacy SDK. The changes are:
|
|
4418
4423
|
// - No support for SnapshotMetadata.
|
|
@@ -4428,7 +4433,7 @@ function He(t, n, e, r, s) {
|
|
|
4428
4433
|
/**
|
|
4429
4434
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
4430
4435
|
*/ get ref() {
|
|
4431
|
-
return new
|
|
4436
|
+
return new le(this._firestore, this._converter, this._key);
|
|
4432
4437
|
}
|
|
4433
4438
|
/**
|
|
4434
4439
|
* Signals whether or not the document at the snapshot's location exists.
|
|
@@ -4448,7 +4453,7 @@ function He(t, n, e, r, s) {
|
|
|
4448
4453
|
if (this._converter) {
|
|
4449
4454
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
4450
4455
|
// if a converter has been provided.
|
|
4451
|
-
const t = new
|
|
4456
|
+
const t = new Je(this._firestore, this._userDataWriter, this._key, this._document,
|
|
4452
4457
|
/* converter= */ null);
|
|
4453
4458
|
return this._converter.fromFirestore(t);
|
|
4454
4459
|
}
|
|
@@ -4468,7 +4473,7 @@ function He(t, n, e, r, s) {
|
|
|
4468
4473
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4469
4474
|
get(t) {
|
|
4470
4475
|
if (this._document) {
|
|
4471
|
-
const n = this._document.data.field(
|
|
4476
|
+
const n = this._document.data.field(tr("DocumentSnapshot.get", t));
|
|
4472
4477
|
if (null !== n) return this._userDataWriter.convertValue(n);
|
|
4473
4478
|
}
|
|
4474
4479
|
}
|
|
@@ -4484,7 +4489,7 @@ function He(t, n, e, r, s) {
|
|
|
4484
4489
|
* `DocumentSnapshot`. Since query results contain only existing documents, the
|
|
4485
4490
|
* `exists` property will always be true and `data()` will never return
|
|
4486
4491
|
* 'undefined'.
|
|
4487
|
-
*/ class
|
|
4492
|
+
*/ class Je extends Ke {
|
|
4488
4493
|
/**
|
|
4489
4494
|
* Retrieves all fields in the document as an `Object`.
|
|
4490
4495
|
*
|
|
@@ -4502,7 +4507,7 @@ function He(t, n, e, r, s) {
|
|
|
4502
4507
|
* array via the `docs` property or enumerated using the `forEach` method. The
|
|
4503
4508
|
* number of documents can be determined via the `empty` and `size`
|
|
4504
4509
|
* properties.
|
|
4505
|
-
*/ class
|
|
4510
|
+
*/ class Xe {
|
|
4506
4511
|
/** @hideconstructor */
|
|
4507
4512
|
constructor(t, n) {
|
|
4508
4513
|
this._docs = n, this.query = t;
|
|
@@ -4533,14 +4538,14 @@ function He(t, n, e, r, s) {
|
|
|
4533
4538
|
* @param left - A snapshot to compare.
|
|
4534
4539
|
* @param right - A snapshot to compare.
|
|
4535
4540
|
* @returns true if the snapshots are equal.
|
|
4536
|
-
*/ function
|
|
4537
|
-
return t = l(t), n = l(n), t instanceof
|
|
4541
|
+
*/ function Ze(t, n) {
|
|
4542
|
+
return t = l(t), n = l(n), t instanceof Ke && n instanceof Ke ? 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 Xe && n instanceof Xe && (_e(t.query, n.query) && gt(t.docs, n.docs, Ze));
|
|
4538
4543
|
}
|
|
4539
4544
|
|
|
4540
4545
|
/**
|
|
4541
4546
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
4542
|
-
*/ function
|
|
4543
|
-
return "string" == typeof n ?
|
|
4547
|
+
*/ function tr(t, n) {
|
|
4548
|
+
return "string" == typeof n ? We(t, n) : n instanceof ge ? n._internalPath : n._delegate._internalPath;
|
|
4544
4549
|
}
|
|
4545
4550
|
|
|
4546
4551
|
/**
|
|
@@ -4567,7 +4572,7 @@ function He(t, n, e, r, s) {
|
|
|
4567
4572
|
* can then be passed to {@link query} to create a new query instance that
|
|
4568
4573
|
* also contains this `QueryConstraint`.
|
|
4569
4574
|
*/
|
|
4570
|
-
class
|
|
4575
|
+
class nr {}
|
|
4571
4576
|
|
|
4572
4577
|
/**
|
|
4573
4578
|
* Creates a new immutable instance of {@link Query} that is extended to also include
|
|
@@ -4577,32 +4582,32 @@ class er {}
|
|
|
4577
4582
|
* @param queryConstraints - The list of {@link QueryConstraint}s to apply.
|
|
4578
4583
|
* @throws if any of the provided query constraints cannot be combined with the
|
|
4579
4584
|
* existing or new constraints.
|
|
4580
|
-
*/ function
|
|
4585
|
+
*/ function er(t, ...n) {
|
|
4581
4586
|
for (const e of n) t = e._apply(t);
|
|
4582
4587
|
return t;
|
|
4583
4588
|
}
|
|
4584
4589
|
|
|
4585
|
-
class
|
|
4590
|
+
class rr extends nr {
|
|
4586
4591
|
constructor(t, n, e) {
|
|
4587
4592
|
super(), this.dt = t, this.wt = n, this.yt = e, this.type = "where";
|
|
4588
4593
|
}
|
|
4589
4594
|
_apply(t) {
|
|
4590
|
-
const n =
|
|
4595
|
+
const n = De(t.firestore), e = function(t, n, e, r, s, i, o) {
|
|
4591
4596
|
let u;
|
|
4592
4597
|
if (s.isKeyField()) {
|
|
4593
4598
|
if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new U(R, `Invalid Query. You can't perform '${i}' queries on documentId().`);
|
|
4594
4599
|
if ("in" /* IN */ === i || "not-in" /* NOT_IN */ === i) {
|
|
4595
|
-
|
|
4600
|
+
_r(o, i);
|
|
4596
4601
|
const n = [];
|
|
4597
|
-
for (const e of o) n.push(
|
|
4602
|
+
for (const e of o) n.push(yr(r, t, e));
|
|
4598
4603
|
u = {
|
|
4599
4604
|
arrayValue: {
|
|
4600
4605
|
values: n
|
|
4601
4606
|
}
|
|
4602
4607
|
};
|
|
4603
|
-
} else u =
|
|
4604
|
-
} else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i ||
|
|
4605
|
-
u =
|
|
4608
|
+
} else u = yr(r, t, o);
|
|
4609
|
+
} else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || _r(o, i),
|
|
4610
|
+
u = Ue(e, n, o,
|
|
4606
4611
|
/* allowArrays= */ "in" /* IN */ === i || "not-in" /* NOT_IN */ === i);
|
|
4607
4612
|
const c = Ht.create(s, i, u);
|
|
4608
4613
|
return function(t, n) {
|
|
@@ -4610,7 +4615,7 @@ class sr extends er {
|
|
|
4610
4615
|
const e = fn(t);
|
|
4611
4616
|
if (null !== e && !e.isEqual(n.field)) throw new U(R, `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()}'`);
|
|
4612
4617
|
const r = ln(t);
|
|
4613
|
-
null !== r &&
|
|
4618
|
+
null !== r && gr(t, n.field, r);
|
|
4614
4619
|
}
|
|
4615
4620
|
const e = function(t, n) {
|
|
4616
4621
|
for (const e of t.filters) if (n.indexOf(e.op) >= 0) return e.op;
|
|
@@ -4654,7 +4659,7 @@ class sr extends er {
|
|
|
4654
4659
|
throw e === n.op ? new U(R, `Invalid query. You cannot use more than one '${n.op.toString()}' filter.`) : new U(R, `Invalid query. You cannot use '${n.op.toString()}' filters with '${e.toString()}' filters.`);
|
|
4655
4660
|
}(t, c), c;
|
|
4656
4661
|
}(t._query, "where", n, t.firestore._databaseId, this.dt, this.wt, this.yt);
|
|
4657
|
-
return new
|
|
4662
|
+
return new fe(t.firestore, t.converter, function(t, n) {
|
|
4658
4663
|
const e = t.filters.concat([ n ]);
|
|
4659
4664
|
return new an(t.path, t.collectionGroup, t.explicitOrderBy.slice(), e, t.limit, t.limitType, t.startAt, t.endAt);
|
|
4660
4665
|
}(t._query, e));
|
|
@@ -4671,12 +4676,12 @@ class sr extends er {
|
|
|
4671
4676
|
* "<=", "!=").
|
|
4672
4677
|
* @param value - The value for comparison
|
|
4673
4678
|
* @returns The created {@link Query}.
|
|
4674
|
-
*/ function
|
|
4675
|
-
const r = n, s =
|
|
4676
|
-
return new
|
|
4679
|
+
*/ function sr(t, n, e) {
|
|
4680
|
+
const r = n, s = tr("where", t);
|
|
4681
|
+
return new rr(s, r, e);
|
|
4677
4682
|
}
|
|
4678
4683
|
|
|
4679
|
-
class
|
|
4684
|
+
class ir extends nr {
|
|
4680
4685
|
constructor(t, n) {
|
|
4681
4686
|
super(), this.dt = t, this._t = n, this.type = "orderBy";
|
|
4682
4687
|
}
|
|
@@ -4689,7 +4694,7 @@ class or extends er {
|
|
|
4689
4694
|
if (null === ln(t)) {
|
|
4690
4695
|
// This is the first order by. It must match any inequality.
|
|
4691
4696
|
const e = fn(t);
|
|
4692
|
-
null !== e &&
|
|
4697
|
+
null !== e && gr(t, e, n.field);
|
|
4693
4698
|
}
|
|
4694
4699
|
}(t, r), r;
|
|
4695
4700
|
}
|
|
@@ -4704,7 +4709,7 @@ class or extends er {
|
|
|
4704
4709
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
4705
4710
|
* server timestamp.
|
|
4706
4711
|
*/ (t._query, this.dt, this._t);
|
|
4707
|
-
return new
|
|
4712
|
+
return new fe(t.firestore, t.converter, function(t, n) {
|
|
4708
4713
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
4709
4714
|
const e = t.explicitOrderBy.concat([ n ]);
|
|
4710
4715
|
return new an(t.path, t.collectionGroup, e, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -4720,19 +4725,19 @@ class or extends er {
|
|
|
4720
4725
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
4721
4726
|
* not specified, order will be ascending.
|
|
4722
4727
|
* @returns The created {@link Query}.
|
|
4723
|
-
*/ function
|
|
4724
|
-
const e = n, r =
|
|
4725
|
-
return new
|
|
4728
|
+
*/ function or(t, n = "asc") {
|
|
4729
|
+
const e = n, r = tr("orderBy", t);
|
|
4730
|
+
return new ir(r, e);
|
|
4726
4731
|
}
|
|
4727
4732
|
|
|
4728
|
-
class
|
|
4733
|
+
class ur extends nr {
|
|
4729
4734
|
constructor(t, n, e) {
|
|
4730
|
-
super(), this.type = t, this.gt = n, this.
|
|
4735
|
+
super(), this.type = t, this.gt = n, this.vt = e;
|
|
4731
4736
|
}
|
|
4732
4737
|
_apply(t) {
|
|
4733
|
-
return new
|
|
4738
|
+
return new fe(t.firestore, t.converter, function(t, n, e) {
|
|
4734
4739
|
return new an(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), n, e, t.startAt, t.endAt);
|
|
4735
|
-
}(t._query, this.gt, this.
|
|
4740
|
+
}(t._query, this.gt, this.vt));
|
|
4736
4741
|
}
|
|
4737
4742
|
}
|
|
4738
4743
|
|
|
@@ -4741,8 +4746,8 @@ class cr extends er {
|
|
|
4741
4746
|
*
|
|
4742
4747
|
* @param limit - The maximum number of items to return.
|
|
4743
4748
|
* @returns The created {@link Query}.
|
|
4744
|
-
*/ function
|
|
4745
|
-
return ct("limit", t), new
|
|
4749
|
+
*/ function cr(t) {
|
|
4750
|
+
return ct("limit", t), new ur("limit", t, "F" /* First */);
|
|
4746
4751
|
}
|
|
4747
4752
|
|
|
4748
4753
|
/**
|
|
@@ -4753,53 +4758,55 @@ class cr extends er {
|
|
|
4753
4758
|
*
|
|
4754
4759
|
* @param limit - The maximum number of items to return.
|
|
4755
4760
|
* @returns The created {@link Query}.
|
|
4756
|
-
*/ function
|
|
4757
|
-
return ct("limitToLast", t), new
|
|
4761
|
+
*/ function ar(t) {
|
|
4762
|
+
return ct("limitToLast", t), new ur("limitToLast", t, "L" /* Last */);
|
|
4758
4763
|
}
|
|
4759
4764
|
|
|
4760
|
-
class
|
|
4765
|
+
class hr extends nr {
|
|
4761
4766
|
constructor(t, n, e) {
|
|
4762
|
-
super(), this.type = t, this.
|
|
4767
|
+
super(), this.type = t, this.bt = n, this.Et = e;
|
|
4763
4768
|
}
|
|
4764
4769
|
_apply(t) {
|
|
4765
|
-
const n =
|
|
4766
|
-
return new
|
|
4770
|
+
const n = pr(t, this.type, this.bt, this.Et);
|
|
4771
|
+
return new fe(t.firestore, t.converter, function(t, n) {
|
|
4767
4772
|
return new an(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, n, t.endAt);
|
|
4768
4773
|
}(t._query, n));
|
|
4769
4774
|
}
|
|
4770
4775
|
}
|
|
4771
4776
|
|
|
4772
|
-
function
|
|
4773
|
-
return new
|
|
4777
|
+
function lr(...t) {
|
|
4778
|
+
return new hr("startAt", t,
|
|
4779
|
+
/*inclusive=*/ !0);
|
|
4774
4780
|
}
|
|
4775
4781
|
|
|
4776
|
-
function
|
|
4777
|
-
return new
|
|
4778
|
-
/*
|
|
4782
|
+
function fr(...t) {
|
|
4783
|
+
return new hr("startAfter", t,
|
|
4784
|
+
/*inclusive=*/ !1);
|
|
4779
4785
|
}
|
|
4780
4786
|
|
|
4781
|
-
class
|
|
4787
|
+
class dr extends nr {
|
|
4782
4788
|
constructor(t, n, e) {
|
|
4783
|
-
super(), this.type = t, this.
|
|
4789
|
+
super(), this.type = t, this.bt = n, this.Et = e;
|
|
4784
4790
|
}
|
|
4785
4791
|
_apply(t) {
|
|
4786
|
-
const n =
|
|
4787
|
-
return new
|
|
4792
|
+
const n = pr(t, this.type, this.bt, this.Et);
|
|
4793
|
+
return new fe(t.firestore, t.converter, function(t, n) {
|
|
4788
4794
|
return new an(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, n);
|
|
4789
4795
|
}(t._query, n));
|
|
4790
4796
|
}
|
|
4791
4797
|
}
|
|
4792
4798
|
|
|
4793
|
-
function
|
|
4794
|
-
return new
|
|
4799
|
+
function wr(...t) {
|
|
4800
|
+
return new dr("endBefore", t,
|
|
4801
|
+
/*inclusive=*/ !1);
|
|
4795
4802
|
}
|
|
4796
4803
|
|
|
4797
|
-
function
|
|
4798
|
-
return new
|
|
4804
|
+
function mr(...t) {
|
|
4805
|
+
return new dr("endAt", t, /*inclusive=*/ !0);
|
|
4799
4806
|
}
|
|
4800
4807
|
|
|
4801
|
-
/** Helper function to create a bound from a document or fields */ function
|
|
4802
|
-
if (e[0] = l(e[0]), e[0] instanceof
|
|
4808
|
+
/** Helper function to create a bound from a document or fields */ function pr(t, n, e, r) {
|
|
4809
|
+
if (e[0] = l(e[0]), e[0] instanceof Ke) return function(t, n, e, r, s) {
|
|
4803
4810
|
if (!r) throw new U(V, `Can't use a DocumentSnapshot that doesn't exist for ${e}().`);
|
|
4804
4811
|
const i = [];
|
|
4805
4812
|
// Because people expect to continue/end a query at the exact document
|
|
@@ -4824,7 +4831,7 @@ function pr(...t) {
|
|
|
4824
4831
|
* Converts a list of field values to a `Bound` for the given query.
|
|
4825
4832
|
*/ (t._query, t.firestore._databaseId, n, e[0]._document, r);
|
|
4826
4833
|
{
|
|
4827
|
-
const s =
|
|
4834
|
+
const s = De(t.firestore);
|
|
4828
4835
|
return function(t, n, e, r, s, i) {
|
|
4829
4836
|
// Use explicit order by's because it has to match the query the user made
|
|
4830
4837
|
const o = t.explicitOrderBy;
|
|
@@ -4840,7 +4847,7 @@ function pr(...t) {
|
|
|
4840
4847
|
const s = new et(e);
|
|
4841
4848
|
u.push(kt(n, s));
|
|
4842
4849
|
} else {
|
|
4843
|
-
const t =
|
|
4850
|
+
const t = Ue(e, r, c);
|
|
4844
4851
|
u.push(t);
|
|
4845
4852
|
}
|
|
4846
4853
|
}
|
|
@@ -4854,7 +4861,7 @@ function pr(...t) {
|
|
|
4854
4861
|
}
|
|
4855
4862
|
}
|
|
4856
4863
|
|
|
4857
|
-
function
|
|
4864
|
+
function yr(t, n, e) {
|
|
4858
4865
|
if ("string" == typeof (e = l(e))) {
|
|
4859
4866
|
if ("" === e) throw new U(R, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
4860
4867
|
if (!dn(n) && -1 !== e.indexOf("/")) throw new U(R, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${e}' contains a '/' character.`);
|
|
@@ -4862,19 +4869,19 @@ function _r(t, n, e) {
|
|
|
4862
4869
|
if (!et.isDocumentKey(r)) throw new U(R, `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}).`);
|
|
4863
4870
|
return kt(t, new et(r));
|
|
4864
4871
|
}
|
|
4865
|
-
if (e instanceof
|
|
4872
|
+
if (e instanceof le) return kt(t, e._key);
|
|
4866
4873
|
throw new U(R, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${ot(e)}.`);
|
|
4867
4874
|
}
|
|
4868
4875
|
|
|
4869
4876
|
/**
|
|
4870
4877
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
4871
4878
|
* array requirements.
|
|
4872
|
-
*/ function
|
|
4879
|
+
*/ function _r(t, n) {
|
|
4873
4880
|
if (!Array.isArray(t) || 0 === t.length) throw new U(R, `Invalid Query. A non-empty array is required for '${n.toString()}' filters.`);
|
|
4874
4881
|
if (t.length > 10) throw new U(R, `Invalid Query. '${n.toString()}' filters support a maximum of 10 elements in the value array.`);
|
|
4875
4882
|
}
|
|
4876
4883
|
|
|
4877
|
-
function
|
|
4884
|
+
function gr(t, n, e) {
|
|
4878
4885
|
if (!e.isEqual(n)) throw new U(R, `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.`);
|
|
4879
4886
|
}
|
|
4880
4887
|
|
|
@@ -4934,7 +4941,7 @@ function vr(t, n, e) {
|
|
|
4934
4941
|
r;
|
|
4935
4942
|
}
|
|
4936
4943
|
|
|
4937
|
-
class
|
|
4944
|
+
class br extends class {
|
|
4938
4945
|
convertValue(t, n = "none") {
|
|
4939
4946
|
switch (xt(t)) {
|
|
4940
4947
|
case 0 /* NullValue */ :
|
|
@@ -4971,7 +4978,7 @@ class Er extends class {
|
|
|
4971
4978
|
return this.convertObject(t.mapValue, n);
|
|
4972
4979
|
|
|
4973
4980
|
default:
|
|
4974
|
-
throw
|
|
4981
|
+
throw v();
|
|
4975
4982
|
}
|
|
4976
4983
|
}
|
|
4977
4984
|
convertObject(t, n) {
|
|
@@ -4981,7 +4988,7 @@ class Er extends class {
|
|
|
4981
4988
|
})), e;
|
|
4982
4989
|
}
|
|
4983
4990
|
convertGeoPoint(t) {
|
|
4984
|
-
return new
|
|
4991
|
+
return new Te(Nt(t.latitude), Nt(t.longitude));
|
|
4985
4992
|
}
|
|
4986
4993
|
convertArray(t, n) {
|
|
4987
4994
|
return (t.values || []).map((t => this.convertValue(t, n)));
|
|
@@ -5001,11 +5008,11 @@ class Er extends class {
|
|
|
5001
5008
|
}
|
|
5002
5009
|
convertTimestamp(t) {
|
|
5003
5010
|
const n = Vt(t);
|
|
5004
|
-
return new
|
|
5011
|
+
return new vt(n.seconds, n.nanos);
|
|
5005
5012
|
}
|
|
5006
5013
|
convertDocumentKey(t, n) {
|
|
5007
5014
|
const e = Z.fromString(t);
|
|
5008
|
-
|
|
5015
|
+
b(Kn(e));
|
|
5009
5016
|
const r = new J(e.get(1), e.get(3)), s = new et(e.popFirst(5));
|
|
5010
5017
|
return r.isEqual(n) ||
|
|
5011
5018
|
// TODO(b/64130202): Somehow support foreign references.
|
|
@@ -5017,11 +5024,11 @@ class Er extends class {
|
|
|
5017
5024
|
super(), this.firestore = t;
|
|
5018
5025
|
}
|
|
5019
5026
|
convertBytes(t) {
|
|
5020
|
-
return new
|
|
5027
|
+
return new be(t);
|
|
5021
5028
|
}
|
|
5022
5029
|
convertReference(t) {
|
|
5023
5030
|
const n = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
5024
|
-
return new
|
|
5031
|
+
return new le(this.firestore, /* converter= */ null, n);
|
|
5025
5032
|
}
|
|
5026
5033
|
}
|
|
5027
5034
|
|
|
@@ -5037,12 +5044,12 @@ class Er extends class {
|
|
|
5037
5044
|
* @param reference - The reference of the document to fetch.
|
|
5038
5045
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
5039
5046
|
* document contents.
|
|
5040
|
-
*/ function
|
|
5041
|
-
const n =
|
|
5042
|
-
return
|
|
5043
|
-
|
|
5047
|
+
*/ function Er(t) {
|
|
5048
|
+
const n = se((t = ut(t, le)).firestore), e = new br(t.firestore);
|
|
5049
|
+
return ne(n, [ t._key ]).then((n => {
|
|
5050
|
+
b(1 === n.length);
|
|
5044
5051
|
const r = n[0];
|
|
5045
|
-
return new
|
|
5052
|
+
return new Ke(t.firestore, e, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
5046
5053
|
}));
|
|
5047
5054
|
}
|
|
5048
5055
|
|
|
@@ -5057,33 +5064,33 @@ class Er extends class {
|
|
|
5057
5064
|
*
|
|
5058
5065
|
* @param query - The `Query` to execute.
|
|
5059
5066
|
* @returns A Promise that will be resolved with the results of the query.
|
|
5060
|
-
*/ function
|
|
5067
|
+
*/ function Tr(t) {
|
|
5061
5068
|
!function(t) {
|
|
5062
5069
|
if (hn(t) && 0 === t.explicitOrderBy.length) throw new U(O, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
5063
|
-
}((t = ut(t,
|
|
5064
|
-
const n =
|
|
5065
|
-
return
|
|
5066
|
-
const r = n.map((n => new
|
|
5070
|
+
}((t = ut(t, fe))._query);
|
|
5071
|
+
const n = se(t.firestore), e = new br(t.firestore);
|
|
5072
|
+
return ee(n, t._query).then((n => {
|
|
5073
|
+
const r = n.map((n => new Je(t.firestore, e, n.key, n, t.converter)));
|
|
5067
5074
|
return hn(t._query) &&
|
|
5068
5075
|
// Limit to last queries reverse the orderBy constraint that was
|
|
5069
5076
|
// specified by the user. As such, we need to reverse the order of the
|
|
5070
5077
|
// results to return the documents in the expected order.
|
|
5071
|
-
r.reverse(), new
|
|
5078
|
+
r.reverse(), new Xe(t, r);
|
|
5072
5079
|
}));
|
|
5073
5080
|
}
|
|
5074
5081
|
|
|
5075
|
-
function
|
|
5076
|
-
const r = vr((t = ut(t,
|
|
5077
|
-
return
|
|
5082
|
+
function Ir(t, n, e) {
|
|
5083
|
+
const r = vr((t = ut(t, le)).converter, n, e), s = $e(De(t.firestore), "setDoc", t._key, r, null !== t.converter, e);
|
|
5084
|
+
return te(se(t.firestore), [ s.toMutation(t._key, In.none()) ]);
|
|
5078
5085
|
}
|
|
5079
5086
|
|
|
5080
|
-
function
|
|
5081
|
-
const s =
|
|
5087
|
+
function Ar(t, n, e, ...r) {
|
|
5088
|
+
const s = De((t = ut(t, le)).firestore);
|
|
5082
5089
|
// For Compat types, we have to "extract" the underlying types before
|
|
5083
5090
|
// performing validation.
|
|
5084
5091
|
let i;
|
|
5085
|
-
i = "string" == typeof (n = l(n)) || n instanceof
|
|
5086
|
-
return
|
|
5092
|
+
i = "string" == typeof (n = l(n)) || n instanceof ge ? ke(s, "updateDoc", t._key, n, e, r) : Le(s, "updateDoc", t._key, n);
|
|
5093
|
+
return te(se(t.firestore), [ i.toMutation(t._key, In.exists(!0)) ]);
|
|
5087
5094
|
}
|
|
5088
5095
|
|
|
5089
5096
|
/**
|
|
@@ -5097,8 +5104,8 @@ function Rr(t, n, e, ...r) {
|
|
|
5097
5104
|
* @param reference - A reference to the document to delete.
|
|
5098
5105
|
* @returns A `Promise` resolved once the document has been successfully
|
|
5099
5106
|
* deleted from the backend.
|
|
5100
|
-
*/ function
|
|
5101
|
-
return
|
|
5107
|
+
*/ function Rr(t) {
|
|
5108
|
+
return te(se((t = ut(t, le)).firestore), [ new Vn(t._key, In.none()) ]);
|
|
5102
5109
|
}
|
|
5103
5110
|
|
|
5104
5111
|
/**
|
|
@@ -5115,9 +5122,9 @@ function Rr(t, n, e, ...r) {
|
|
|
5115
5122
|
* @throws Error - If the provided input is not a valid Firestore document.
|
|
5116
5123
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
5117
5124
|
* newly created document after it has been written to the backend.
|
|
5118
|
-
*/ function
|
|
5119
|
-
const e =
|
|
5120
|
-
return
|
|
5125
|
+
*/ function Pr(t, n) {
|
|
5126
|
+
const e = pe(t = ut(t, de)), r = vr(t.converter, n), s = $e(De(t.firestore), "addDoc", e._key, r, null !== e.converter, {});
|
|
5127
|
+
return te(se(t.firestore), [ s.toMutation(e._key, In.exists(!1)) ]).then((() => e));
|
|
5121
5128
|
}
|
|
5122
5129
|
|
|
5123
5130
|
/**
|
|
@@ -5139,15 +5146,15 @@ function Rr(t, n, e, ...r) {
|
|
|
5139
5146
|
/**
|
|
5140
5147
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
5141
5148
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
5142
|
-
*/ function
|
|
5143
|
-
return new
|
|
5149
|
+
*/ function Vr() {
|
|
5150
|
+
return new Se("deleteField");
|
|
5144
5151
|
}
|
|
5145
5152
|
|
|
5146
5153
|
/**
|
|
5147
5154
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
5148
5155
|
* include a server-generated timestamp in the written data.
|
|
5149
|
-
*/ function
|
|
5150
|
-
return new
|
|
5156
|
+
*/ function Nr() {
|
|
5157
|
+
return new xe("serverTimestamp");
|
|
5151
5158
|
}
|
|
5152
5159
|
|
|
5153
5160
|
/**
|
|
@@ -5161,10 +5168,10 @@ function Rr(t, n, e, ...r) {
|
|
|
5161
5168
|
* @param elements - The elements to union into the array.
|
|
5162
5169
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5163
5170
|
* `updateDoc()`.
|
|
5164
|
-
*/ function
|
|
5171
|
+
*/ function Dr(...t) {
|
|
5165
5172
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5166
5173
|
// update() since we'd need the Firestore instance to do this.
|
|
5167
|
-
return new
|
|
5174
|
+
return new qe("arrayUnion", t);
|
|
5168
5175
|
}
|
|
5169
5176
|
|
|
5170
5177
|
/**
|
|
@@ -5177,10 +5184,10 @@ function Rr(t, n, e, ...r) {
|
|
|
5177
5184
|
* @param elements - The elements to remove from the array.
|
|
5178
5185
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5179
5186
|
* `updateDoc()`
|
|
5180
|
-
*/ function
|
|
5187
|
+
*/ function $r(...t) {
|
|
5181
5188
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5182
5189
|
// update() since we'd need the Firestore instance to do this.
|
|
5183
|
-
return new
|
|
5190
|
+
return new Oe("arrayRemove", t);
|
|
5184
5191
|
}
|
|
5185
5192
|
|
|
5186
5193
|
/**
|
|
@@ -5201,8 +5208,8 @@ function Rr(t, n, e, ...r) {
|
|
|
5201
5208
|
* @param n - The value to increment by.
|
|
5202
5209
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5203
5210
|
* `updateDoc()`
|
|
5204
|
-
*/ function
|
|
5205
|
-
return new
|
|
5211
|
+
*/ function Sr(t) {
|
|
5212
|
+
return new Ce("increment", t);
|
|
5206
5213
|
}
|
|
5207
5214
|
|
|
5208
5215
|
/**
|
|
@@ -5228,24 +5235,24 @@ function Rr(t, n, e, ...r) {
|
|
|
5228
5235
|
* provides methods for adding writes to the write batch. None of the writes
|
|
5229
5236
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
5230
5237
|
* called.
|
|
5231
|
-
*/ class
|
|
5238
|
+
*/ class Fr {
|
|
5232
5239
|
/** @hideconstructor */
|
|
5233
5240
|
constructor(t, n) {
|
|
5234
5241
|
this._firestore = t, this._commitHandler = n, this._mutations = [], this._committed = !1,
|
|
5235
|
-
this._dataReader =
|
|
5242
|
+
this._dataReader = De(t);
|
|
5236
5243
|
}
|
|
5237
5244
|
set(t, n, e) {
|
|
5238
5245
|
this._verifyNotCommitted();
|
|
5239
|
-
const r =
|
|
5246
|
+
const r = xr(t, this._firestore), s = vr(r.converter, n, e), i = $e(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, e);
|
|
5240
5247
|
return this._mutations.push(i.toMutation(r._key, In.none())), this;
|
|
5241
5248
|
}
|
|
5242
5249
|
update(t, n, e, ...r) {
|
|
5243
5250
|
this._verifyNotCommitted();
|
|
5244
|
-
const s =
|
|
5251
|
+
const s = xr(t, this._firestore);
|
|
5245
5252
|
// For Compat types, we have to "extract" the underlying types before
|
|
5246
5253
|
// performing validation.
|
|
5247
5254
|
let i;
|
|
5248
|
-
return i = "string" == typeof (n = l(n)) || n instanceof
|
|
5255
|
+
return i = "string" == typeof (n = l(n)) || n instanceof ge ? ke(this._dataReader, "WriteBatch.update", s._key, n, e, r) : Le(this._dataReader, "WriteBatch.update", s._key, n),
|
|
5249
5256
|
this._mutations.push(i.toMutation(s._key, In.exists(!0))), this;
|
|
5250
5257
|
}
|
|
5251
5258
|
/**
|
|
@@ -5255,7 +5262,7 @@ function Rr(t, n, e, ...r) {
|
|
|
5255
5262
|
* @returns This `WriteBatch` instance. Used for chaining method calls.
|
|
5256
5263
|
*/ delete(t) {
|
|
5257
5264
|
this._verifyNotCommitted();
|
|
5258
|
-
const n =
|
|
5265
|
+
const n = xr(t, this._firestore);
|
|
5259
5266
|
return this._mutations = this._mutations.concat(new Vn(n._key, In.none())), this;
|
|
5260
5267
|
}
|
|
5261
5268
|
/**
|
|
@@ -5277,7 +5284,7 @@ function Rr(t, n, e, ...r) {
|
|
|
5277
5284
|
}
|
|
5278
5285
|
}
|
|
5279
5286
|
|
|
5280
|
-
function
|
|
5287
|
+
function xr(t, n) {
|
|
5281
5288
|
if ((t = l(t)).firestore !== n) throw new U(R, "Provided document reference is from a different Firestore instance.");
|
|
5282
5289
|
return t;
|
|
5283
5290
|
}
|
|
@@ -5294,9 +5301,9 @@ function qr(t, n) {
|
|
|
5294
5301
|
*
|
|
5295
5302
|
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
5296
5303
|
* writes.
|
|
5297
|
-
*/ function
|
|
5298
|
-
const n =
|
|
5299
|
-
return new
|
|
5304
|
+
*/ function qr(t) {
|
|
5305
|
+
const n = se(t = ut(t, oe));
|
|
5306
|
+
return new Fr(t, (t => te(n, t)));
|
|
5300
5307
|
}
|
|
5301
5308
|
|
|
5302
5309
|
/**
|
|
@@ -5318,7 +5325,7 @@ function qr(t, n) {
|
|
|
5318
5325
|
/**
|
|
5319
5326
|
* Internal transaction object responsible for accumulating the mutations to
|
|
5320
5327
|
* perform and the base versions for any documents read.
|
|
5321
|
-
*/ class
|
|
5328
|
+
*/ class Or {
|
|
5322
5329
|
constructor(t) {
|
|
5323
5330
|
this.datastore = t,
|
|
5324
5331
|
// The version of each document that was read during this transaction.
|
|
@@ -5338,7 +5345,7 @@ function qr(t, n) {
|
|
|
5338
5345
|
}
|
|
5339
5346
|
async lookup(t) {
|
|
5340
5347
|
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(R, "Firestore transactions require all reads to be executed before all writes.");
|
|
5341
|
-
const n = await
|
|
5348
|
+
const n = await ne(this.datastore, t);
|
|
5342
5349
|
return n.forEach((t => this.recordVersion(t))), n;
|
|
5343
5350
|
}
|
|
5344
5351
|
set(t, n) {
|
|
@@ -5367,14 +5374,14 @@ function qr(t, n) {
|
|
|
5367
5374
|
t.forEach(((t, n) => {
|
|
5368
5375
|
const e = et.fromPath(n);
|
|
5369
5376
|
this.mutations.push(new Nn(e, this.precondition(e)));
|
|
5370
|
-
})), await
|
|
5377
|
+
})), await te(this.datastore, this.mutations), this.committed = !0;
|
|
5371
5378
|
}
|
|
5372
5379
|
recordVersion(t) {
|
|
5373
5380
|
let n;
|
|
5374
5381
|
if (t.isFoundDocument()) n = t.version; else {
|
|
5375
|
-
if (!t.isNoDocument()) throw
|
|
5382
|
+
if (!t.isNoDocument()) throw v();
|
|
5376
5383
|
// For deleted docs, we must use baseVersion 0 when we overwrite them.
|
|
5377
|
-
n =
|
|
5384
|
+
n = bt.min();
|
|
5378
5385
|
}
|
|
5379
5386
|
const e = this.readVersions.get(t.key.toString());
|
|
5380
5387
|
if (e) {
|
|
@@ -5397,7 +5404,7 @@ function qr(t, n) {
|
|
|
5397
5404
|
// The first time a document is written, we want to take into account the
|
|
5398
5405
|
// read time and existence
|
|
5399
5406
|
if (!this.writtenDocs.has(t.toString()) && n) {
|
|
5400
|
-
if (n.isEqual(
|
|
5407
|
+
if (n.isEqual(bt.min()))
|
|
5401
5408
|
// The document doesn't exist, so fail the transaction.
|
|
5402
5409
|
// This has to be validated locally because you can't send a
|
|
5403
5410
|
// precondition that a document does not exist without changing the
|
|
@@ -5441,17 +5448,17 @@ function qr(t, n) {
|
|
|
5441
5448
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
5442
5449
|
* with backoff.
|
|
5443
5450
|
*/
|
|
5444
|
-
class
|
|
5451
|
+
class Cr {
|
|
5445
5452
|
constructor(t, n, e, r) {
|
|
5446
5453
|
this.asyncQueue = t, this.datastore = n, this.updateFunction = e, this.deferred = r,
|
|
5447
|
-
this.Tt = 5, this.It = new
|
|
5454
|
+
this.Tt = 5, this.It = new Xn(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
5448
5455
|
}
|
|
5449
5456
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
5450
5457
|
this.Tt -= 1, this.At();
|
|
5451
5458
|
}
|
|
5452
5459
|
At() {
|
|
5453
5460
|
this.It.W((async () => {
|
|
5454
|
-
const t = new
|
|
5461
|
+
const t = new Or(this.datastore), n = this.Rt(t);
|
|
5455
5462
|
n && n.then((n => {
|
|
5456
5463
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
5457
5464
|
this.deferred.resolve(n);
|
|
@@ -5492,7 +5499,7 @@ class Lr {
|
|
|
5492
5499
|
function(t) {
|
|
5493
5500
|
switch (t) {
|
|
5494
5501
|
default:
|
|
5495
|
-
return
|
|
5502
|
+
return v();
|
|
5496
5503
|
|
|
5497
5504
|
case I:
|
|
5498
5505
|
case A:
|
|
@@ -5541,7 +5548,7 @@ class Lr {
|
|
|
5541
5548
|
* See the License for the specific language governing permissions and
|
|
5542
5549
|
* limitations under the License.
|
|
5543
5550
|
*/
|
|
5544
|
-
/** The Platform's 'document' implementation or null if not available. */ function
|
|
5551
|
+
/** The Platform's 'document' implementation or null if not available. */ function Lr() {
|
|
5545
5552
|
// `document` is not always available, e.g. in ReactNative and WebWorkers.
|
|
5546
5553
|
// eslint-disable-next-line no-restricted-globals
|
|
5547
5554
|
return "undefined" != typeof document ? document : null;
|
|
@@ -5573,7 +5580,7 @@ class Lr {
|
|
|
5573
5580
|
* Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
|
|
5574
5581
|
* in newer versions of TypeScript defines `finally`, which is not available in
|
|
5575
5582
|
* IE.
|
|
5576
|
-
*/ class
|
|
5583
|
+
*/ class kr {
|
|
5577
5584
|
constructor(t, n, e, r, s) {
|
|
5578
5585
|
this.asyncQueue = t, this.timerId = n, this.targetTimeMs = e, this.op = r, this.removalCallback = s,
|
|
5579
5586
|
this.deferred = new j, this.then = this.deferred.promise.then.bind(this.deferred.promise),
|
|
@@ -5596,7 +5603,7 @@ class Lr {
|
|
|
5596
5603
|
* PORTING NOTE: This exists to prevent making removeDelayedOperation() and
|
|
5597
5604
|
* the DelayedOperation class public.
|
|
5598
5605
|
*/ static createAndSchedule(t, n, e, r, s) {
|
|
5599
|
-
const i = Date.now() + e, o = new
|
|
5606
|
+
const i = Date.now() + e, o = new kr(t, n, i, r, s);
|
|
5600
5607
|
return o.start(e), o;
|
|
5601
5608
|
}
|
|
5602
5609
|
/**
|
|
@@ -5645,7 +5652,7 @@ class Lr {
|
|
|
5645
5652
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5646
5653
|
* See the License for the specific language governing permissions and
|
|
5647
5654
|
* limitations under the License.
|
|
5648
|
-
*/ class
|
|
5655
|
+
*/ class Ur {
|
|
5649
5656
|
constructor() {
|
|
5650
5657
|
// The last promise in the queue.
|
|
5651
5658
|
this.Nt = Promise.resolve(),
|
|
@@ -5668,15 +5675,15 @@ class Lr {
|
|
|
5668
5675
|
// List of TimerIds to fast-forward delays for.
|
|
5669
5676
|
this.Ot = [],
|
|
5670
5677
|
// Backoff timer used to schedule retries for retryable operations
|
|
5671
|
-
this.It = new
|
|
5678
|
+
this.It = new Xn(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
5672
5679
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
5673
5680
|
// operations. Meant to speed up recovery when we regain file system access
|
|
5674
5681
|
// after page comes into foreground.
|
|
5675
5682
|
this.Ct = () => {
|
|
5676
|
-
const t =
|
|
5683
|
+
const t = Lr();
|
|
5677
5684
|
t && p("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.It.H();
|
|
5678
5685
|
};
|
|
5679
|
-
const t =
|
|
5686
|
+
const t = Lr();
|
|
5680
5687
|
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Ct);
|
|
5681
5688
|
}
|
|
5682
5689
|
get isShuttingDown() {
|
|
@@ -5697,7 +5704,7 @@ class Lr {
|
|
|
5697
5704
|
enterRestrictedMode(t) {
|
|
5698
5705
|
if (!this.$t) {
|
|
5699
5706
|
this.$t = !0, this.qt = t || !1;
|
|
5700
|
-
const n =
|
|
5707
|
+
const n = Lr();
|
|
5701
5708
|
n && "function" == typeof n.removeEventListener && n.removeEventListener("visibilitychange", this.Ct);
|
|
5702
5709
|
}
|
|
5703
5710
|
}
|
|
@@ -5829,11 +5836,11 @@ class Lr {
|
|
|
5829
5836
|
this.Lt(),
|
|
5830
5837
|
// Fast-forward delays for timerIds that have been overriden.
|
|
5831
5838
|
this.Ot.indexOf(t) > -1 && (n = 0);
|
|
5832
|
-
const r =
|
|
5839
|
+
const r = kr.createAndSchedule(this, t, n, e, (t => this.jt(t)));
|
|
5833
5840
|
return this.St.push(r), r;
|
|
5834
5841
|
}
|
|
5835
5842
|
Lt() {
|
|
5836
|
-
this.Ft &&
|
|
5843
|
+
this.Ft && v();
|
|
5837
5844
|
}
|
|
5838
5845
|
verifyOperationInProgress() {}
|
|
5839
5846
|
/**
|
|
@@ -5883,10 +5890,10 @@ class Lr {
|
|
|
5883
5890
|
}
|
|
5884
5891
|
}
|
|
5885
5892
|
|
|
5886
|
-
class
|
|
5893
|
+
class jr {
|
|
5887
5894
|
/** @hideconstructor */
|
|
5888
5895
|
constructor(t, n) {
|
|
5889
|
-
this._firestore = t, this._transaction = n, this._dataReader =
|
|
5896
|
+
this._firestore = t, this._transaction = n, this._dataReader = De(t);
|
|
5890
5897
|
}
|
|
5891
5898
|
/**
|
|
5892
5899
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
@@ -5894,25 +5901,25 @@ class Mr {
|
|
|
5894
5901
|
* @param documentRef - A reference to the document to be read.
|
|
5895
5902
|
* @returns A `DocumentSnapshot` with the read data.
|
|
5896
5903
|
*/ get(t) {
|
|
5897
|
-
const n =
|
|
5904
|
+
const n = xr(t, this._firestore), e = new br(this._firestore);
|
|
5898
5905
|
return this._transaction.lookup([ n._key ]).then((t => {
|
|
5899
|
-
if (!t || 1 !== t.length) return
|
|
5906
|
+
if (!t || 1 !== t.length) return v();
|
|
5900
5907
|
const r = t[0];
|
|
5901
|
-
if (r.isFoundDocument()) return new
|
|
5902
|
-
if (r.isNoDocument()) return new
|
|
5903
|
-
throw
|
|
5908
|
+
if (r.isFoundDocument()) return new Ke(this._firestore, e, r.key, r, n.converter);
|
|
5909
|
+
if (r.isNoDocument()) return new Ke(this._firestore, e, n._key, null, n.converter);
|
|
5910
|
+
throw v();
|
|
5904
5911
|
}));
|
|
5905
5912
|
}
|
|
5906
5913
|
set(t, n, e) {
|
|
5907
|
-
const r =
|
|
5914
|
+
const r = xr(t, this._firestore), s = vr(r.converter, n, e), i = $e(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, e);
|
|
5908
5915
|
return this._transaction.set(r._key, i), this;
|
|
5909
5916
|
}
|
|
5910
5917
|
update(t, n, e, ...r) {
|
|
5911
|
-
const s =
|
|
5918
|
+
const s = xr(t, this._firestore);
|
|
5912
5919
|
// For Compat types, we have to "extract" the underlying types before
|
|
5913
5920
|
// performing validation.
|
|
5914
5921
|
let i;
|
|
5915
|
-
return i = "string" == typeof (n = l(n)) || n instanceof
|
|
5922
|
+
return i = "string" == typeof (n = l(n)) || n instanceof ge ? ke(this._dataReader, "Transaction.update", s._key, n, e, r) : Le(this._dataReader, "Transaction.update", s._key, n),
|
|
5916
5923
|
this._transaction.update(s._key, i), this;
|
|
5917
5924
|
}
|
|
5918
5925
|
/**
|
|
@@ -5921,7 +5928,7 @@ class Mr {
|
|
|
5921
5928
|
* @param documentRef - A reference to the document to be deleted.
|
|
5922
5929
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
5923
5930
|
*/ delete(t) {
|
|
5924
|
-
const n =
|
|
5931
|
+
const n = xr(t, this._firestore);
|
|
5925
5932
|
return this._transaction.delete(n._key), this;
|
|
5926
5933
|
}
|
|
5927
5934
|
}
|
|
@@ -5942,9 +5949,9 @@ class Mr {
|
|
|
5942
5949
|
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
5943
5950
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
5944
5951
|
* rejected promise with the corresponding failure error is returned.
|
|
5945
|
-
*/ function
|
|
5946
|
-
const e =
|
|
5947
|
-
return new
|
|
5952
|
+
*/ function Mr(t, n) {
|
|
5953
|
+
const e = se(t = ut(t, oe)), r = new j;
|
|
5954
|
+
return new Cr(new Ur, e, (e => n(new jr(t, e))), r).run(), r.promise;
|
|
5948
5955
|
}
|
|
5949
5956
|
|
|
5950
5957
|
/**
|
|
@@ -5957,11 +5964,11 @@ class Mr {
|
|
|
5957
5964
|
*/ !function(t) {
|
|
5958
5965
|
d = t;
|
|
5959
5966
|
}(`${s}_lite`), e(new i("firestore/lite", ((t, {options: n}) => {
|
|
5960
|
-
const e = t.getProvider("app").getImmediate(), r = new
|
|
5967
|
+
const e = t.getProvider("app").getImmediate(), r = new oe(e, new Q(t.getProvider("auth-internal")), new H(t.getProvider("app-check-internal")));
|
|
5961
5968
|
return n && r._setSettings(n), r;
|
|
5962
5969
|
}), "PUBLIC")),
|
|
5963
5970
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5964
|
-
r("firestore-lite", "3.4.4-canary.
|
|
5971
|
+
r("firestore-lite", "3.4.4-canary.e8972ef49", "rn"), r("firestore-lite", "3.4.4-canary.e8972ef49", "esm2017");
|
|
5965
5972
|
|
|
5966
|
-
export {
|
|
5973
|
+
export { be as Bytes, de as CollectionReference, le as DocumentReference, Ke as DocumentSnapshot, ge as FieldPath, Ee as FieldValue, oe as Firestore, U as FirestoreError, Te as GeoPoint, fe as Query, nr as QueryConstraint, Je as QueryDocumentSnapshot, Xe as QuerySnapshot, vt as Timestamp, jr as Transaction, Fr as WriteBatch, Pr as addDoc, $r as arrayRemove, Dr as arrayUnion, we as collection, me as collectionGroup, ae as connectFirestoreEmulator, Rr as deleteDoc, Vr as deleteField, pe as doc, ve as documentId, mr as endAt, wr as endBefore, Er as getDoc, Tr as getDocs, ce as getFirestore, Sr as increment, ue as initializeFirestore, cr as limit, ar as limitToLast, or as orderBy, er as query, _e as queryEqual, ye as refEqual, Mr as runTransaction, Nr as serverTimestamp, Ir as setDoc, m as setLogLevel, Ze as snapshotEqual, fr as startAfter, lr as startAt, he as terminate, Ar as updateDoc, sr as where, qr as writeBatch };
|
|
5967
5974
|
//# sourceMappingURL=index.rn.esm2017.js.map
|