@firebase/firestore 3.4.4-canary.d04b608f2 → 3.4.4-canary.ea9895797
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/credentials.d.ts +1 -0
- package/dist/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/firestore/src/core/target.d.ts +8 -4
- package/dist/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/firestore/src/local/document_overlay_cache.d.ts +72 -0
- package/dist/firestore/src/local/index_manager.d.ts +52 -0
- package/dist/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
- package/dist/firestore/src/local/indexeddb_index_manager.d.ts +21 -2
- package/dist/firestore/src/local/indexeddb_persistence.d.ts +6 -4
- package/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
- package/dist/firestore/src/local/indexeddb_schema.d.ts +193 -7
- package/dist/firestore/src/local/local_documents_view.d.ts +0 -1
- package/dist/firestore/src/local/local_serializer.d.ts +18 -2
- package/dist/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
- package/dist/firestore/src/local/memory_index_manager.d.ts +11 -0
- package/dist/firestore/src/local/memory_persistence.d.ts +6 -2
- package/dist/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
- package/dist/firestore/src/local/persistence.d.ts +8 -2
- package/dist/firestore/src/local/remote_document_cache.d.ts +7 -9
- package/dist/firestore/src/local/simple_db.d.ts +1 -0
- package/dist/firestore/src/model/document_key.d.ts +4 -0
- package/dist/firestore/src/model/field_index.d.ts +2 -2
- package/dist/firestore/src/model/overlay.d.ts +32 -0
- package/dist/firestore/src/model/target_index_matcher.d.ts +70 -0
- package/dist/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
- package/dist/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
- package/dist/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
- package/dist/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
- package/dist/firestore/test/unit/local/test_index_manager.d.ts +11 -0
- package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
- package/dist/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
- package/dist/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
- package/dist/firestore/test/util/helpers.d.ts +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.esm2017.js +3802 -3287
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3890 -3466
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +878 -221
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +878 -221
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +3973 -3458
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +252 -14
- package/dist/lite/firestore/src/api/credentials.d.ts +1 -0
- package/dist/lite/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/lite/firestore/src/core/target.d.ts +8 -4
- package/dist/lite/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/lite/firestore/src/local/document_overlay_cache.d.ts +72 -0
- package/dist/lite/firestore/src/local/index_manager.d.ts +52 -0
- package/dist/lite/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
- package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +21 -2
- package/dist/lite/firestore/src/local/indexeddb_persistence.d.ts +6 -4
- package/dist/lite/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
- package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +193 -7
- package/dist/lite/firestore/src/local/local_documents_view.d.ts +0 -1
- package/dist/lite/firestore/src/local/local_serializer.d.ts +18 -2
- package/dist/lite/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
- package/dist/lite/firestore/src/local/memory_index_manager.d.ts +11 -0
- package/dist/lite/firestore/src/local/memory_persistence.d.ts +6 -2
- package/dist/lite/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
- package/dist/lite/firestore/src/local/persistence.d.ts +8 -2
- package/dist/lite/firestore/src/local/remote_document_cache.d.ts +7 -9
- package/dist/lite/firestore/src/local/simple_db.d.ts +1 -0
- package/dist/lite/firestore/src/model/document_key.d.ts +4 -0
- package/dist/lite/firestore/src/model/field_index.d.ts +2 -2
- package/dist/lite/firestore/src/model/overlay.d.ts +32 -0
- package/dist/lite/firestore/src/model/target_index_matcher.d.ts +70 -0
- package/dist/lite/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
- package/dist/lite/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
- package/dist/lite/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
- package/dist/lite/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
- package/dist/lite/firestore/test/unit/local/test_index_manager.d.ts +11 -0
- package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
- package/dist/lite/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
- package/dist/lite/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
- package/dist/lite/firestore/test/util/helpers.d.ts +1 -1
- package/dist/lite/index.browser.esm2017.js +1162 -1153
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +352 -345
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +44 -29
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +44 -29
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +381 -372
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +6 -2
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +124 -124
- package/dist/lite/packages/firestore/src/api/credentials.d.ts +1 -0
- package/dist/lite/packages/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/lite/packages/firestore/src/core/target.d.ts +8 -4
- package/dist/lite/packages/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/lite/packages/firestore/src/local/document_overlay_cache.d.ts +72 -0
- package/dist/lite/packages/firestore/src/local/index_manager.d.ts +52 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +21 -2
- package/dist/lite/packages/firestore/src/local/indexeddb_persistence.d.ts +6 -4
- package/dist/lite/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
- package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +193 -7
- package/dist/lite/packages/firestore/src/local/local_documents_view.d.ts +0 -1
- package/dist/lite/packages/firestore/src/local/local_serializer.d.ts +18 -2
- package/dist/lite/packages/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
- package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +11 -0
- package/dist/lite/packages/firestore/src/local/memory_persistence.d.ts +6 -2
- package/dist/lite/packages/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
- package/dist/lite/packages/firestore/src/local/persistence.d.ts +8 -2
- package/dist/lite/packages/firestore/src/local/remote_document_cache.d.ts +7 -9
- package/dist/lite/packages/firestore/src/local/simple_db.d.ts +1 -0
- package/dist/lite/packages/firestore/src/model/document_key.d.ts +4 -0
- package/dist/lite/packages/firestore/src/model/field_index.d.ts +2 -2
- package/dist/lite/packages/firestore/src/model/overlay.d.ts +32 -0
- package/dist/lite/packages/firestore/src/model/target_index_matcher.d.ts +70 -0
- package/dist/lite/packages/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
- package/dist/lite/packages/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
- package/dist/lite/packages/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
- package/dist/lite/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
- package/dist/lite/packages/firestore/test/unit/local/test_index_manager.d.ts +11 -0
- package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
- package/dist/lite/packages/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
- package/dist/lite/packages/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/util/helpers.d.ts +1 -1
- package/dist/lite/private.d.ts +2 -2
- package/dist/packages/firestore/dist/index.esm2017.d.ts +171 -169
- package/dist/packages/firestore/src/api/credentials.d.ts +1 -0
- package/dist/packages/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/packages/firestore/src/core/target.d.ts +8 -4
- package/dist/packages/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/packages/firestore/src/local/document_overlay_cache.d.ts +72 -0
- package/dist/packages/firestore/src/local/index_manager.d.ts +52 -0
- package/dist/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
- package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +21 -2
- package/dist/packages/firestore/src/local/indexeddb_persistence.d.ts +6 -4
- package/dist/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
- package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +193 -7
- package/dist/packages/firestore/src/local/local_documents_view.d.ts +0 -1
- package/dist/packages/firestore/src/local/local_serializer.d.ts +18 -2
- package/dist/packages/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
- package/dist/packages/firestore/src/local/memory_index_manager.d.ts +11 -0
- package/dist/packages/firestore/src/local/memory_persistence.d.ts +6 -2
- package/dist/packages/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
- package/dist/packages/firestore/src/local/persistence.d.ts +8 -2
- package/dist/packages/firestore/src/local/remote_document_cache.d.ts +7 -9
- package/dist/packages/firestore/src/local/simple_db.d.ts +1 -0
- package/dist/packages/firestore/src/model/document_key.d.ts +4 -0
- package/dist/packages/firestore/src/model/field_index.d.ts +2 -2
- package/dist/packages/firestore/src/model/overlay.d.ts +32 -0
- package/dist/packages/firestore/src/model/target_index_matcher.d.ts +70 -0
- package/dist/packages/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
- package/dist/packages/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
- package/dist/packages/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
- package/dist/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
- package/dist/packages/firestore/test/unit/local/test_index_manager.d.ts +11 -0
- package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
- package/dist/packages/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
- package/dist/packages/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
- package/dist/packages/firestore/test/util/helpers.d.ts +1 -1
- package/dist/private.d.ts +248 -14
- 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.
|
|
69
|
+
let d = "9.6.6-canary.ea9895797";
|
|
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
|
/**
|
|
@@ -328,14 +328,14 @@ n) {
|
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
330
|
|
|
331
|
-
/** Credential provider for the Lite SDK. */ class
|
|
331
|
+
/** Credential provider for the Lite SDK. */ class G {
|
|
332
332
|
constructor(t) {
|
|
333
333
|
this.auth = null, t.onInit((t => {
|
|
334
334
|
this.auth = t;
|
|
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() {}
|
|
@@ -349,7 +349,7 @@ n) {
|
|
|
349
349
|
* Technically this may no longer be necessary since the SDK should gracefully
|
|
350
350
|
* recover from unauthenticated errors (see b/33147818 for context), but it's
|
|
351
351
|
* safer to keep the implementation as-is.
|
|
352
|
-
*/ class
|
|
352
|
+
*/ class Q {
|
|
353
353
|
constructor(t, n, e) {
|
|
354
354
|
this.type = "FirstParty", this.user = f.FIRST_PARTY, this.headers = new Map, this.headers.set("X-Goog-AuthUser", n);
|
|
355
355
|
const r = t.auth.getAuthHeaderValueForFirstParty([]);
|
|
@@ -366,7 +366,7 @@ n) {
|
|
|
366
366
|
this.t = t, this.i = n, this.o = e;
|
|
367
367
|
}
|
|
368
368
|
getToken() {
|
|
369
|
-
return Promise.resolve(new
|
|
369
|
+
return Promise.resolve(new Q(this.t, this.i, this.o));
|
|
370
370
|
}
|
|
371
371
|
start(t, n) {
|
|
372
372
|
// Fire with initial uid.
|
|
@@ -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() {}
|
|
@@ -482,7 +482,7 @@ class J {
|
|
|
482
482
|
*/
|
|
483
483
|
class X {
|
|
484
484
|
constructor(t, n, e) {
|
|
485
|
-
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(),
|
|
486
486
|
this.segments = t, this.offset = n, this.len = e;
|
|
487
487
|
}
|
|
488
488
|
get length() {
|
|
@@ -684,6 +684,12 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
684
684
|
/** Returns true if the document is in the specified collectionId. */ hasCollectionId(t) {
|
|
685
685
|
return this.path.length >= 2 && this.path.get(this.path.length - 2) === t;
|
|
686
686
|
}
|
|
687
|
+
/** Returns the collection group (i.e. the name of the parent collection) for this key. */ getCollectionGroup() {
|
|
688
|
+
return this.path.get(this.path.length - 2);
|
|
689
|
+
}
|
|
690
|
+
/** Returns the fully qualified path to the parent collection. */ getCollectionPath() {
|
|
691
|
+
return this.path.popLast();
|
|
692
|
+
}
|
|
687
693
|
isEqual(t) {
|
|
688
694
|
return null !== t && 0 === Z.comparator(this.path, t.path);
|
|
689
695
|
}
|
|
@@ -775,7 +781,7 @@ function ot(t) {
|
|
|
775
781
|
return n ? `a custom ${n} object` : "an object";
|
|
776
782
|
}
|
|
777
783
|
}
|
|
778
|
-
return "function" == typeof t ? "a function" :
|
|
784
|
+
return "function" == typeof t ? "a function" : v();
|
|
779
785
|
}
|
|
780
786
|
|
|
781
787
|
function ut(t,
|
|
@@ -1184,7 +1190,7 @@ function _t(t, n) {
|
|
|
1184
1190
|
* For examples and further specifications, refer to the
|
|
1185
1191
|
* {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}.
|
|
1186
1192
|
*/
|
|
1187
|
-
class
|
|
1193
|
+
class vt {
|
|
1188
1194
|
/**
|
|
1189
1195
|
* Creates a new timestamp.
|
|
1190
1196
|
*
|
|
@@ -1216,7 +1222,7 @@ class bt {
|
|
|
1216
1222
|
*
|
|
1217
1223
|
* @returns a new timestamp representing the current date.
|
|
1218
1224
|
*/ static now() {
|
|
1219
|
-
return
|
|
1225
|
+
return vt.fromMillis(Date.now());
|
|
1220
1226
|
}
|
|
1221
1227
|
/**
|
|
1222
1228
|
* Creates a new timestamp from the given date.
|
|
@@ -1225,7 +1231,7 @@ class bt {
|
|
|
1225
1231
|
* @returns A new `Timestamp` representing the same point in time as the given
|
|
1226
1232
|
* date.
|
|
1227
1233
|
*/ static fromDate(t) {
|
|
1228
|
-
return
|
|
1234
|
+
return vt.fromMillis(t.getTime());
|
|
1229
1235
|
}
|
|
1230
1236
|
/**
|
|
1231
1237
|
* Creates a new timestamp from the given number of milliseconds.
|
|
@@ -1236,7 +1242,7 @@ class bt {
|
|
|
1236
1242
|
* number of milliseconds.
|
|
1237
1243
|
*/ static fromMillis(t) {
|
|
1238
1244
|
const n = Math.floor(t / 1e3), e = Math.floor(1e6 * (t - 1e3 * n));
|
|
1239
|
-
return new
|
|
1245
|
+
return new vt(n, e);
|
|
1240
1246
|
}
|
|
1241
1247
|
/**
|
|
1242
1248
|
* Converts a `Timestamp` to a JavaScript `Date` object. This conversion
|
|
@@ -1314,15 +1320,15 @@ class bt {
|
|
|
1314
1320
|
/**
|
|
1315
1321
|
* A version of a document in Firestore. This corresponds to the version
|
|
1316
1322
|
* timestamp, such as update_time or read_time.
|
|
1317
|
-
*/ class
|
|
1323
|
+
*/ class bt {
|
|
1318
1324
|
constructor(t) {
|
|
1319
1325
|
this.timestamp = t;
|
|
1320
1326
|
}
|
|
1321
1327
|
static fromTimestamp(t) {
|
|
1322
|
-
return new
|
|
1328
|
+
return new bt(t);
|
|
1323
1329
|
}
|
|
1324
1330
|
static min() {
|
|
1325
|
-
return new
|
|
1331
|
+
return new bt(new vt(0, 0));
|
|
1326
1332
|
}
|
|
1327
1333
|
compareTo(t) {
|
|
1328
1334
|
return this.timestamp._compareTo(t.timestamp);
|
|
@@ -1556,13 +1562,13 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1556
1562
|
// The json interface (for the browser) will return an iso timestamp string,
|
|
1557
1563
|
// while the proto js library (for node) will return a
|
|
1558
1564
|
// google.protobuf.Timestamp instance.
|
|
1559
|
-
if (
|
|
1565
|
+
if (b(!!t), "string" == typeof t) {
|
|
1560
1566
|
// The date string can have higher precision (nanos) than the Date class
|
|
1561
1567
|
// (millis), so we do some custom parsing here.
|
|
1562
1568
|
// Parse the nanos right out of the string.
|
|
1563
1569
|
let n = 0;
|
|
1564
1570
|
const e = Pt.exec(t);
|
|
1565
|
-
if (
|
|
1571
|
+
if (b(!!e), e[1]) {
|
|
1566
1572
|
// Pad the fraction out to 9 digits (nanos).
|
|
1567
1573
|
let t = e[1];
|
|
1568
1574
|
t = (t + "000000000").substr(0, 9), n = Number(t);
|
|
@@ -1644,7 +1650,7 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1644
1650
|
* Returns the local time at which this timestamp was first set.
|
|
1645
1651
|
*/ function Ft(t) {
|
|
1646
1652
|
const n = Vt(t.mapValue.fields.__local_write_time__.timestampValue);
|
|
1647
|
-
return new
|
|
1653
|
+
return new vt(n.seconds, n.nanos);
|
|
1648
1654
|
}
|
|
1649
1655
|
|
|
1650
1656
|
/**
|
|
@@ -1664,7 +1670,7 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1664
1670
|
* limitations under the License.
|
|
1665
1671
|
*/
|
|
1666
1672
|
/** Extracts the backend's type order for the provided value. */ function xt(t) {
|
|
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 */ :
|
|
1673
|
+
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();
|
|
1668
1674
|
}
|
|
1669
1675
|
|
|
1670
1676
|
/** Tests `left` and `right` for equality based on the backend semantics. */ function qt(t, n) {
|
|
@@ -1729,7 +1735,7 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1729
1735
|
/** Returns true if the ArrayValue contains the specified element. */ (t, n);
|
|
1730
1736
|
|
|
1731
1737
|
default:
|
|
1732
|
-
return
|
|
1738
|
+
return v();
|
|
1733
1739
|
}
|
|
1734
1740
|
}
|
|
1735
1741
|
|
|
@@ -1817,7 +1823,7 @@ function Ct(t, n) {
|
|
|
1817
1823
|
/** Returns a reference value for the provided database and key. */ (t.mapValue, n.mapValue);
|
|
1818
1824
|
|
|
1819
1825
|
default:
|
|
1820
|
-
throw
|
|
1826
|
+
throw v();
|
|
1821
1827
|
}
|
|
1822
1828
|
}
|
|
1823
1829
|
|
|
@@ -1895,12 +1901,12 @@ function kt(t, n) {
|
|
|
1895
1901
|
/**
|
|
1896
1902
|
* An ObjectValue represents a MapValue in the Firestore Proto and offers the
|
|
1897
1903
|
* ability to add and remove fields (via the ObjectValueBuilder).
|
|
1898
|
-
*/ class
|
|
1904
|
+
*/ class Gt {
|
|
1899
1905
|
constructor(t) {
|
|
1900
1906
|
this.value = t;
|
|
1901
1907
|
}
|
|
1902
1908
|
static empty() {
|
|
1903
|
-
return new
|
|
1909
|
+
return new Gt({
|
|
1904
1910
|
mapValue: {}
|
|
1905
1911
|
});
|
|
1906
1912
|
}
|
|
@@ -1981,7 +1987,7 @@ function kt(t, n) {
|
|
|
1981
1987
|
for (const n of e) delete t[n];
|
|
1982
1988
|
}
|
|
1983
1989
|
clone() {
|
|
1984
|
-
return new
|
|
1990
|
+
return new Gt(zt(this.value));
|
|
1985
1991
|
}
|
|
1986
1992
|
}
|
|
1987
1993
|
|
|
@@ -2010,7 +2016,7 @@ function kt(t, n) {
|
|
|
2010
2016
|
* not transition to one of these states even after all mutations have been
|
|
2011
2017
|
* applied, `isValidDocument()` returns false and the document should be removed
|
|
2012
2018
|
* from all views.
|
|
2013
|
-
*/ class
|
|
2019
|
+
*/ class Qt {
|
|
2014
2020
|
constructor(t, n, e, r, s, i) {
|
|
2015
2021
|
this.key = t, this.documentType = n, this.version = e, this.readTime = r, this.data = s,
|
|
2016
2022
|
this.documentState = i;
|
|
@@ -2019,23 +2025,23 @@ function kt(t, n) {
|
|
|
2019
2025
|
* Creates a document with no known version or data, but which can serve as
|
|
2020
2026
|
* base document for mutations.
|
|
2021
2027
|
*/ static newInvalidDocument(t) {
|
|
2022
|
-
return new
|
|
2028
|
+
return new Qt(t, 0 /* INVALID */ , bt.min(), bt.min(), Gt.empty(), 0 /* SYNCED */);
|
|
2023
2029
|
}
|
|
2024
2030
|
/**
|
|
2025
2031
|
* Creates a new document that is known to exist with the given data at the
|
|
2026
2032
|
* given version.
|
|
2027
2033
|
*/ static newFoundDocument(t, n, e) {
|
|
2028
|
-
return new
|
|
2034
|
+
return new Qt(t, 1 /* FOUND_DOCUMENT */ , n, bt.min(), e, 0 /* SYNCED */);
|
|
2029
2035
|
}
|
|
2030
2036
|
/** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, n) {
|
|
2031
|
-
return new
|
|
2037
|
+
return new Qt(t, 2 /* NO_DOCUMENT */ , n, bt.min(), Gt.empty(), 0 /* SYNCED */);
|
|
2032
2038
|
}
|
|
2033
2039
|
/**
|
|
2034
2040
|
* Creates a new document that is known to exist at the given version but
|
|
2035
2041
|
* whose data is not known (e.g. a document that was updated without a known
|
|
2036
2042
|
* base document).
|
|
2037
2043
|
*/ static newUnknownDocument(t, n) {
|
|
2038
|
-
return new
|
|
2044
|
+
return new Qt(t, 3 /* UNKNOWN_DOCUMENT */ , n, bt.min(), Gt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
2039
2045
|
}
|
|
2040
2046
|
/**
|
|
2041
2047
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -2048,7 +2054,7 @@ function kt(t, n) {
|
|
|
2048
2054
|
* Changes the document type to indicate that it doesn't exist at the given
|
|
2049
2055
|
* version.
|
|
2050
2056
|
*/ convertToNoDocument(t) {
|
|
2051
|
-
return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data =
|
|
2057
|
+
return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = Gt.empty(),
|
|
2052
2058
|
this.documentState = 0 /* SYNCED */ , this;
|
|
2053
2059
|
}
|
|
2054
2060
|
/**
|
|
@@ -2056,7 +2062,7 @@ function kt(t, n) {
|
|
|
2056
2062
|
* that its data is not known (e.g. a document that was updated without a known
|
|
2057
2063
|
* base document).
|
|
2058
2064
|
*/ convertToUnknownDocument(t) {
|
|
2059
|
-
return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data =
|
|
2065
|
+
return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = Gt.empty(),
|
|
2060
2066
|
this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
|
|
2061
2067
|
}
|
|
2062
2068
|
setHasCommittedMutations() {
|
|
@@ -2090,10 +2096,10 @@ function kt(t, n) {
|
|
|
2090
2096
|
return 3 /* UNKNOWN_DOCUMENT */ === this.documentType;
|
|
2091
2097
|
}
|
|
2092
2098
|
isEqual(t) {
|
|
2093
|
-
return t instanceof
|
|
2099
|
+
return t instanceof Qt && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
|
|
2094
2100
|
}
|
|
2095
2101
|
mutableCopy() {
|
|
2096
|
-
return new
|
|
2102
|
+
return new Qt(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState);
|
|
2097
2103
|
}
|
|
2098
2104
|
toString() {
|
|
2099
2105
|
return `Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`;
|
|
@@ -2174,7 +2180,7 @@ class Ht extends class {} {
|
|
|
2174
2180
|
return t >= 0;
|
|
2175
2181
|
|
|
2176
2182
|
default:
|
|
2177
|
-
return
|
|
2183
|
+
return v();
|
|
2178
2184
|
}
|
|
2179
2185
|
}
|
|
2180
2186
|
D() {
|
|
@@ -2259,7 +2265,6 @@ function Zt(t, n) {
|
|
|
2259
2265
|
}
|
|
2260
2266
|
}
|
|
2261
2267
|
|
|
2262
|
-
// TODO(indexing): Change Bound.before to "inclusive"
|
|
2263
2268
|
/**
|
|
2264
2269
|
* Represents a bound of a query.
|
|
2265
2270
|
*
|
|
@@ -2275,7 +2280,7 @@ function Zt(t, n) {
|
|
|
2275
2280
|
* just after the provided values.
|
|
2276
2281
|
*/ class sn {
|
|
2277
2282
|
constructor(t, n) {
|
|
2278
|
-
this.position = t, this.
|
|
2283
|
+
this.position = t, this.inclusive = n;
|
|
2279
2284
|
}
|
|
2280
2285
|
}
|
|
2281
2286
|
|
|
@@ -2294,7 +2299,7 @@ function un(t, n) {
|
|
|
2294
2299
|
function cn(t, n) {
|
|
2295
2300
|
if (null === t) return null === n;
|
|
2296
2301
|
if (null === n) return !1;
|
|
2297
|
-
if (t.
|
|
2302
|
+
if (t.inclusive !== n.inclusive || t.position.length !== n.position.length) return !1;
|
|
2298
2303
|
for (let e = 0; e < t.position.length; e++) {
|
|
2299
2304
|
if (!qt(t.position[e], n.position[e])) return !1;
|
|
2300
2305
|
}
|
|
@@ -2400,7 +2405,7 @@ function dn(t) {
|
|
|
2400
2405
|
t.push(new on(e.field, n));
|
|
2401
2406
|
}
|
|
2402
2407
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
2403
|
-
const e = n.endAt ? new sn(n.endAt.position, !n.endAt.
|
|
2408
|
+
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;
|
|
2404
2409
|
// Now return as a LimitType.First query.
|
|
2405
2410
|
n.S = Yt(n.path, n.collectionGroup, t, n.filters, n.limit, e, r);
|
|
2406
2411
|
}
|
|
@@ -2500,13 +2505,13 @@ function yn(t, n) {
|
|
|
2500
2505
|
|
|
2501
2506
|
/** Transforms a value into a server-generated timestamp. */ class gn extends _n {}
|
|
2502
2507
|
|
|
2503
|
-
/** Transforms an array value via a union operation. */ class
|
|
2508
|
+
/** Transforms an array value via a union operation. */ class vn extends _n {
|
|
2504
2509
|
constructor(t) {
|
|
2505
2510
|
super(), this.elements = t;
|
|
2506
2511
|
}
|
|
2507
2512
|
}
|
|
2508
2513
|
|
|
2509
|
-
/** Transforms an array value via a remove operation. */ class
|
|
2514
|
+
/** Transforms an array value via a remove operation. */ class bn extends _n {
|
|
2510
2515
|
constructor(t) {
|
|
2511
2516
|
super(), this.elements = t;
|
|
2512
2517
|
}
|
|
@@ -2754,9 +2759,9 @@ function qn(t, n) {
|
|
|
2754
2759
|
}
|
|
2755
2760
|
|
|
2756
2761
|
function On(t) {
|
|
2757
|
-
return
|
|
2762
|
+
return b(!!t), bt.fromTimestamp(function(t) {
|
|
2758
2763
|
const n = Vt(t);
|
|
2759
|
-
return new
|
|
2764
|
+
return new vt(n.seconds, n.nanos);
|
|
2760
2765
|
}(t));
|
|
2761
2766
|
}
|
|
2762
2767
|
|
|
@@ -2773,11 +2778,11 @@ function Ln(t, n) {
|
|
|
2773
2778
|
function kn(t, n) {
|
|
2774
2779
|
const e = function(t) {
|
|
2775
2780
|
const n = Z.fromString(t);
|
|
2776
|
-
return
|
|
2781
|
+
return b(Kn(n)), n;
|
|
2777
2782
|
}(n);
|
|
2778
2783
|
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);
|
|
2779
2784
|
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);
|
|
2780
|
-
return new et((
|
|
2785
|
+
return new et((b((r = e).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
|
|
2781
2786
|
var r;
|
|
2782
2787
|
/** Creates a Document proto from key and fields (but no create/update time) */}
|
|
2783
2788
|
|
|
@@ -2798,18 +2803,18 @@ function Mn(t, n, e) {
|
|
|
2798
2803
|
|
|
2799
2804
|
function Bn(t, n) {
|
|
2800
2805
|
return "found" in n ? function(t, n) {
|
|
2801
|
-
|
|
2802
|
-
const e = kn(t, n.found.name), r = On(n.found.updateTime), s = new
|
|
2806
|
+
b(!!n.found), n.found.name, n.found.updateTime;
|
|
2807
|
+
const e = kn(t, n.found.name), r = On(n.found.updateTime), s = new Gt({
|
|
2803
2808
|
mapValue: {
|
|
2804
2809
|
fields: n.found.fields
|
|
2805
2810
|
}
|
|
2806
2811
|
});
|
|
2807
|
-
return
|
|
2812
|
+
return Qt.newFoundDocument(e, r, s);
|
|
2808
2813
|
}(t, n) : "missing" in n ? function(t, n) {
|
|
2809
|
-
|
|
2814
|
+
b(!!n.missing), b(!!n.readTime);
|
|
2810
2815
|
const e = kn(t, n.missing), r = On(n.readTime);
|
|
2811
|
-
return
|
|
2812
|
-
}(t, n) :
|
|
2816
|
+
return Qt.newNoDocument(e, r);
|
|
2817
|
+
}(t, n) : v();
|
|
2813
2818
|
}
|
|
2814
2819
|
|
|
2815
2820
|
function zn(t, n) {
|
|
@@ -2820,9 +2825,9 @@ function zn(t, n) {
|
|
|
2820
2825
|
delete: Ln(t, n.key)
|
|
2821
2826
|
}; else if (n instanceof Pn) e = {
|
|
2822
2827
|
update: Mn(t, n.key, n.data),
|
|
2823
|
-
updateMask:
|
|
2828
|
+
updateMask: Hn(n.fieldMask)
|
|
2824
2829
|
}; else {
|
|
2825
|
-
if (!(n instanceof Nn)) return
|
|
2830
|
+
if (!(n instanceof Nn)) return v();
|
|
2826
2831
|
e = {
|
|
2827
2832
|
verify: Ln(t, n.key)
|
|
2828
2833
|
};
|
|
@@ -2833,13 +2838,13 @@ function zn(t, n) {
|
|
|
2833
2838
|
fieldPath: n.field.canonicalString(),
|
|
2834
2839
|
setToServerValue: "REQUEST_TIME"
|
|
2835
2840
|
};
|
|
2836
|
-
if (e instanceof
|
|
2841
|
+
if (e instanceof vn) return {
|
|
2837
2842
|
fieldPath: n.field.canonicalString(),
|
|
2838
2843
|
appendMissingElements: {
|
|
2839
2844
|
values: e.elements
|
|
2840
2845
|
}
|
|
2841
2846
|
};
|
|
2842
|
-
if (e instanceof
|
|
2847
|
+
if (e instanceof bn) return {
|
|
2843
2848
|
fieldPath: n.field.canonicalString(),
|
|
2844
2849
|
removeAllFromArray: {
|
|
2845
2850
|
values: e.elements
|
|
@@ -2849,17 +2854,17 @@ function zn(t, n) {
|
|
|
2849
2854
|
fieldPath: n.field.canonicalString(),
|
|
2850
2855
|
increment: e.O
|
|
2851
2856
|
};
|
|
2852
|
-
throw
|
|
2857
|
+
throw v();
|
|
2853
2858
|
}(0, t)))), n.precondition.isNone || (e.currentDocument = function(t, n) {
|
|
2854
2859
|
return void 0 !== n.updateTime ? {
|
|
2855
2860
|
updateTime: qn(t, n.updateTime)
|
|
2856
2861
|
} : void 0 !== n.exists ? {
|
|
2857
2862
|
exists: n.exists
|
|
2858
|
-
} :
|
|
2863
|
+
} : v();
|
|
2859
2864
|
}(t, n.precondition)), e;
|
|
2860
2865
|
}
|
|
2861
2866
|
|
|
2862
|
-
function
|
|
2867
|
+
function Gn(t, n) {
|
|
2863
2868
|
// Dissect the path into parent, collectionId, and optional key filter.
|
|
2864
2869
|
const e = {
|
|
2865
2870
|
structuredQuery: {}
|
|
@@ -2878,34 +2883,34 @@ function Qn(t, n) {
|
|
|
2878
2883
|
if ("==" /* EQUAL */ === t.op) {
|
|
2879
2884
|
if (Mt(t.value)) return {
|
|
2880
2885
|
unaryFilter: {
|
|
2881
|
-
field:
|
|
2886
|
+
field: Yn(t.field),
|
|
2882
2887
|
op: "IS_NAN"
|
|
2883
2888
|
}
|
|
2884
2889
|
};
|
|
2885
2890
|
if (jt(t.value)) return {
|
|
2886
2891
|
unaryFilter: {
|
|
2887
|
-
field:
|
|
2892
|
+
field: Yn(t.field),
|
|
2888
2893
|
op: "IS_NULL"
|
|
2889
2894
|
}
|
|
2890
2895
|
};
|
|
2891
2896
|
} else if ("!=" /* NOT_EQUAL */ === t.op) {
|
|
2892
2897
|
if (Mt(t.value)) return {
|
|
2893
2898
|
unaryFilter: {
|
|
2894
|
-
field:
|
|
2899
|
+
field: Yn(t.field),
|
|
2895
2900
|
op: "IS_NOT_NAN"
|
|
2896
2901
|
}
|
|
2897
2902
|
};
|
|
2898
2903
|
if (jt(t.value)) return {
|
|
2899
2904
|
unaryFilter: {
|
|
2900
|
-
field:
|
|
2905
|
+
field: Yn(t.field),
|
|
2901
2906
|
op: "IS_NOT_NULL"
|
|
2902
2907
|
}
|
|
2903
2908
|
};
|
|
2904
2909
|
}
|
|
2905
2910
|
return {
|
|
2906
2911
|
fieldFilter: {
|
|
2907
|
-
field:
|
|
2908
|
-
op:
|
|
2912
|
+
field: Yn(t.field),
|
|
2913
|
+
op: Wn(t.op),
|
|
2909
2914
|
value: t.value
|
|
2910
2915
|
}
|
|
2911
2916
|
};
|
|
@@ -2925,8 +2930,8 @@ function Qn(t, n) {
|
|
|
2925
2930
|
// visible for testing
|
|
2926
2931
|
function(t) {
|
|
2927
2932
|
return {
|
|
2928
|
-
field:
|
|
2929
|
-
direction:
|
|
2933
|
+
field: Yn(t.field),
|
|
2934
|
+
direction: Qn(t.dir)
|
|
2930
2935
|
};
|
|
2931
2936
|
}(t)));
|
|
2932
2937
|
}(n.orderBy);
|
|
@@ -2936,41 +2941,43 @@ function Qn(t, n) {
|
|
|
2936
2941
|
value: n
|
|
2937
2942
|
};
|
|
2938
2943
|
}(t, n.limit);
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2944
|
+
var u;
|
|
2945
|
+
return null !== o && (e.structuredQuery.limit = o), n.startAt && (e.structuredQuery.startAt = {
|
|
2946
|
+
before: (u = n.startAt).inclusive,
|
|
2947
|
+
values: u.position
|
|
2948
|
+
}), n.endAt && (e.structuredQuery.endAt = function(t) {
|
|
2949
|
+
return {
|
|
2950
|
+
before: !t.inclusive,
|
|
2951
|
+
values: t.position
|
|
2952
|
+
};
|
|
2953
|
+
}
|
|
2954
|
+
// visible for testing
|
|
2955
|
+
(n.endAt)), e;
|
|
2948
2956
|
}
|
|
2949
2957
|
|
|
2950
|
-
|
|
2951
|
-
function Wn(t) {
|
|
2958
|
+
function Qn(t) {
|
|
2952
2959
|
return Dn[t];
|
|
2953
2960
|
}
|
|
2954
2961
|
|
|
2955
2962
|
// visible for testing
|
|
2956
|
-
function
|
|
2963
|
+
function Wn(t) {
|
|
2957
2964
|
return $n[t];
|
|
2958
2965
|
}
|
|
2959
2966
|
|
|
2960
|
-
function
|
|
2967
|
+
function Yn(t) {
|
|
2961
2968
|
return {
|
|
2962
2969
|
fieldPath: t.canonicalString()
|
|
2963
2970
|
};
|
|
2964
2971
|
}
|
|
2965
2972
|
|
|
2966
|
-
function
|
|
2973
|
+
function Hn(t) {
|
|
2967
2974
|
const n = [];
|
|
2968
2975
|
return t.fields.forEach((t => n.push(t.canonicalString()))), {
|
|
2969
2976
|
fieldPaths: n
|
|
2970
2977
|
};
|
|
2971
2978
|
}
|
|
2972
2979
|
|
|
2973
|
-
function
|
|
2980
|
+
function Kn(t) {
|
|
2974
2981
|
// Resource names have at least 4 components (project ID, database ID)
|
|
2975
2982
|
return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
|
|
2976
2983
|
}
|
|
@@ -2990,7 +2997,7 @@ function Jn(t) {
|
|
|
2990
2997
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2991
2998
|
* See the License for the specific language governing permissions and
|
|
2992
2999
|
* limitations under the License.
|
|
2993
|
-
*/ function
|
|
3000
|
+
*/ function Jn(t) {
|
|
2994
3001
|
return new Sn(t, /* useProto3Json= */ !0);
|
|
2995
3002
|
}
|
|
2996
3003
|
|
|
@@ -3019,7 +3026,7 @@ function Jn(t) {
|
|
|
3019
3026
|
* base delay. This prevents clients from accidentally synchronizing their
|
|
3020
3027
|
* delays causing spikes of load to the backend.
|
|
3021
3028
|
*/
|
|
3022
|
-
class
|
|
3029
|
+
class Xn {
|
|
3023
3030
|
constructor(
|
|
3024
3031
|
/**
|
|
3025
3032
|
* The AsyncQueue to run backoff operations on.
|
|
@@ -3117,7 +3124,7 @@ class Zn {
|
|
|
3117
3124
|
* An implementation of Datastore that exposes additional state for internal
|
|
3118
3125
|
* consumption.
|
|
3119
3126
|
*/
|
|
3120
|
-
class
|
|
3127
|
+
class Zn extends class {} {
|
|
3121
3128
|
constructor(t, n, e, r) {
|
|
3122
3129
|
super(), this.authCredentials = t, this.appCheckCredentials = n, this.K = e, this.q = r,
|
|
3123
3130
|
this.J = !1;
|
|
@@ -3144,14 +3151,14 @@ class te extends class {} {
|
|
|
3144
3151
|
|
|
3145
3152
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
3146
3153
|
// firestore-exp client.
|
|
3147
|
-
async function
|
|
3154
|
+
async function te(t, n) {
|
|
3148
3155
|
const e = E(t), r = jn(e.q) + "/documents", s = {
|
|
3149
3156
|
writes: n.map((t => zn(e.q, t)))
|
|
3150
3157
|
};
|
|
3151
3158
|
await e.m("Commit", r, s);
|
|
3152
3159
|
}
|
|
3153
3160
|
|
|
3154
|
-
async function
|
|
3161
|
+
async function ne(t, n) {
|
|
3155
3162
|
const e = E(t), r = jn(e.q) + "/documents", s = {
|
|
3156
3163
|
documents: n.map((t => Ln(e.q, t)))
|
|
3157
3164
|
}, i = await e.T("BatchGetDocuments", r, s), o = new Map;
|
|
@@ -3162,20 +3169,20 @@ async function ee(t, n) {
|
|
|
3162
3169
|
const u = [];
|
|
3163
3170
|
return n.forEach((t => {
|
|
3164
3171
|
const n = o.get(t.toString());
|
|
3165
|
-
|
|
3172
|
+
b(!!n), u.push(n);
|
|
3166
3173
|
})), u;
|
|
3167
3174
|
}
|
|
3168
3175
|
|
|
3169
|
-
async function
|
|
3170
|
-
const e = E(t), r =
|
|
3176
|
+
async function ee(t, n) {
|
|
3177
|
+
const e = E(t), r = Gn(e.q, mn(n));
|
|
3171
3178
|
return (await e.T("RunQuery", r.parent, {
|
|
3172
3179
|
structuredQuery: r.structuredQuery
|
|
3173
3180
|
})).filter((t => !!t.document)).map((t => function(t, n, e) {
|
|
3174
|
-
const r = kn(t, n.name), s = On(n.updateTime), i = new
|
|
3181
|
+
const r = kn(t, n.name), s = On(n.updateTime), i = new Gt({
|
|
3175
3182
|
mapValue: {
|
|
3176
3183
|
fields: n.fields
|
|
3177
3184
|
}
|
|
3178
|
-
}), o =
|
|
3185
|
+
}), o = Qt.newFoundDocument(r, s, i);
|
|
3179
3186
|
return e && o.setHasCommittedMutations(), e ? o.setHasCommittedMutations() : o;
|
|
3180
3187
|
}(e.q, t.document, void 0)));
|
|
3181
3188
|
}
|
|
@@ -3195,7 +3202,7 @@ async function re(t, n) {
|
|
|
3195
3202
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3196
3203
|
* See the License for the specific language governing permissions and
|
|
3197
3204
|
* limitations under the License.
|
|
3198
|
-
*/ const
|
|
3205
|
+
*/ const re = new Map;
|
|
3199
3206
|
|
|
3200
3207
|
/**
|
|
3201
3208
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -3206,17 +3213,17 @@ async function re(t, n) {
|
|
|
3206
3213
|
* instance. Callers must invoke removeComponents() when the Firestore
|
|
3207
3214
|
* instance is terminated.
|
|
3208
3215
|
*/
|
|
3209
|
-
function
|
|
3216
|
+
function se(t) {
|
|
3210
3217
|
if (t._terminated) throw new U(F, "The client has already been terminated.");
|
|
3211
|
-
if (!
|
|
3218
|
+
if (!re.has(t)) {
|
|
3212
3219
|
p("ComponentProvider", "Initializing Datastore");
|
|
3213
3220
|
const i = function(t) {
|
|
3214
3221
|
return new mt(t, fetch.bind(null));
|
|
3215
3222
|
}((n = t._databaseId, e = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
|
|
3216
|
-
new K(n, e, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o =
|
|
3217
|
-
return new
|
|
3223
|
+
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) {
|
|
3224
|
+
return new Zn(t, n, e, r);
|
|
3218
3225
|
}(t._authCredentials, t._appCheckCredentials, i, o);
|
|
3219
|
-
|
|
3226
|
+
re.set(t, u);
|
|
3220
3227
|
}
|
|
3221
3228
|
var n, e, r, s;
|
|
3222
3229
|
/**
|
|
@@ -3234,7 +3241,7 @@ function ie(t) {
|
|
|
3234
3241
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3235
3242
|
* See the License for the specific language governing permissions and
|
|
3236
3243
|
* limitations under the License.
|
|
3237
|
-
*/ return
|
|
3244
|
+
*/ return re.get(t);
|
|
3238
3245
|
}
|
|
3239
3246
|
|
|
3240
3247
|
/**
|
|
@@ -3246,7 +3253,7 @@ function ie(t) {
|
|
|
3246
3253
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
3247
3254
|
* defaults can be supplied and the value can be checked for equality.
|
|
3248
3255
|
*/
|
|
3249
|
-
class
|
|
3256
|
+
class ie {
|
|
3250
3257
|
constructor(t) {
|
|
3251
3258
|
var n;
|
|
3252
3259
|
if (void 0 === t.host) {
|
|
@@ -3288,14 +3295,14 @@ class oe {
|
|
|
3288
3295
|
* The Cloud Firestore service interface.
|
|
3289
3296
|
*
|
|
3290
3297
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
3291
|
-
*/ class
|
|
3298
|
+
*/ class oe {
|
|
3292
3299
|
/** @hideconstructor */
|
|
3293
3300
|
constructor(t, n, e) {
|
|
3294
3301
|
this._authCredentials = n, this._appCheckCredentials = e,
|
|
3295
3302
|
/**
|
|
3296
3303
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
3297
3304
|
*/
|
|
3298
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
3305
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new ie({}),
|
|
3299
3306
|
this._settingsFrozen = !1, t instanceof J ? this._databaseId = t : (this._app = t,
|
|
3300
3307
|
this._databaseId = function(t) {
|
|
3301
3308
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(R, '"projectId" not provided in firebase.initializeApp.');
|
|
@@ -3328,13 +3335,13 @@ class oe {
|
|
|
3328
3335
|
}
|
|
3329
3336
|
_setSettings(t) {
|
|
3330
3337
|
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.");
|
|
3331
|
-
this._settings = new
|
|
3338
|
+
this._settings = new ie(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
3332
3339
|
if (!t) return new B;
|
|
3333
3340
|
switch (t.type) {
|
|
3334
3341
|
case "gapi":
|
|
3335
3342
|
const n = t.client;
|
|
3336
3343
|
// Make sure this really is a Gapi client.
|
|
3337
|
-
return
|
|
3344
|
+
return b(!("object" != typeof n || null === n || !n.auth || !n.auth.getAuthHeaderValueForFirstParty)),
|
|
3338
3345
|
new W(n, t.sessionIndex || "0", t.iamToken || null);
|
|
3339
3346
|
|
|
3340
3347
|
case "provider":
|
|
@@ -3369,13 +3376,13 @@ class oe {
|
|
|
3369
3376
|
* Only ever called once.
|
|
3370
3377
|
*/ _terminate() {
|
|
3371
3378
|
return function(t) {
|
|
3372
|
-
const n =
|
|
3373
|
-
n && (p("ComponentProvider", "Removing Datastore"),
|
|
3379
|
+
const n = re.get(t);
|
|
3380
|
+
n && (p("ComponentProvider", "Removing Datastore"), re.delete(t), n.terminate());
|
|
3374
3381
|
}(this), Promise.resolve();
|
|
3375
3382
|
}
|
|
3376
3383
|
}
|
|
3377
3384
|
|
|
3378
|
-
function
|
|
3385
|
+
function ue(t, n) {
|
|
3379
3386
|
const e = _getProvider(t, "firestore/lite");
|
|
3380
3387
|
if (e.isInitialized()) throw new U(F, "Firestore can only be initialized once per app.");
|
|
3381
3388
|
return e.initialize({
|
|
@@ -3391,7 +3398,7 @@ function ce(t, n) {
|
|
|
3391
3398
|
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
|
|
3392
3399
|
* instance is associated with.
|
|
3393
3400
|
* @returns The `Firestore` instance of the provided app.
|
|
3394
|
-
*/ function
|
|
3401
|
+
*/ function ce(n = t()) {
|
|
3395
3402
|
return _getProvider(n, "firestore/lite").getImmediate();
|
|
3396
3403
|
}
|
|
3397
3404
|
|
|
@@ -3407,9 +3414,9 @@ function ce(t, n) {
|
|
|
3407
3414
|
* @param port - the emulator port (ex: 9000).
|
|
3408
3415
|
* @param options.mockUserToken - the mock auth token to use for unit testing
|
|
3409
3416
|
* Security Rules.
|
|
3410
|
-
*/ function
|
|
3417
|
+
*/ function ae(t, n, e, r = {}) {
|
|
3411
3418
|
var s;
|
|
3412
|
-
const i = (t = ut(t,
|
|
3419
|
+
const i = (t = ut(t, oe))._getSettings();
|
|
3413
3420
|
if ("firestore.googleapis.com" !== i.host && i.host !== n && _("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
3414
3421
|
t._setSettings(Object.assign(Object.assign({}, i), {
|
|
3415
3422
|
host: `${n}:${e}`,
|
|
@@ -3447,8 +3454,8 @@ function ce(t, n) {
|
|
|
3447
3454
|
* @param firestore - The `Firestore` instance to terminate.
|
|
3448
3455
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
3449
3456
|
* terminated.
|
|
3450
|
-
*/ function
|
|
3451
|
-
return t = ut(t,
|
|
3457
|
+
*/ function he(t) {
|
|
3458
|
+
return t = ut(t, oe), n(t.app, "firestore/lite"), t._delete();
|
|
3452
3459
|
}
|
|
3453
3460
|
|
|
3454
3461
|
/**
|
|
@@ -3488,7 +3495,7 @@ function ce(t, n) {
|
|
|
3488
3495
|
* and can be used to write, read, or listen to the location. The document at
|
|
3489
3496
|
* the referenced location may or may not exist.
|
|
3490
3497
|
*/
|
|
3491
|
-
class
|
|
3498
|
+
class le {
|
|
3492
3499
|
/** @hideconstructor */
|
|
3493
3500
|
constructor(t,
|
|
3494
3501
|
/**
|
|
@@ -3516,17 +3523,17 @@ class fe {
|
|
|
3516
3523
|
/**
|
|
3517
3524
|
* The collection this `DocumentReference` belongs to.
|
|
3518
3525
|
*/ get parent() {
|
|
3519
|
-
return new
|
|
3526
|
+
return new de(this.firestore, this.converter, this._key.path.popLast());
|
|
3520
3527
|
}
|
|
3521
3528
|
withConverter(t) {
|
|
3522
|
-
return new
|
|
3529
|
+
return new le(this.firestore, t, this._key);
|
|
3523
3530
|
}
|
|
3524
3531
|
}
|
|
3525
3532
|
|
|
3526
3533
|
/**
|
|
3527
3534
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
3528
3535
|
* construct refined `Query` objects by adding filters and ordering.
|
|
3529
|
-
*/ class
|
|
3536
|
+
*/ class fe {
|
|
3530
3537
|
// This is the lite version of the Query class in the main SDK.
|
|
3531
3538
|
/** @hideconstructor protected */
|
|
3532
3539
|
constructor(t,
|
|
@@ -3539,14 +3546,14 @@ class fe {
|
|
|
3539
3546
|
this.type = "query", this.firestore = t;
|
|
3540
3547
|
}
|
|
3541
3548
|
withConverter(t) {
|
|
3542
|
-
return new
|
|
3549
|
+
return new fe(this.firestore, t, this._query);
|
|
3543
3550
|
}
|
|
3544
3551
|
}
|
|
3545
3552
|
|
|
3546
3553
|
/**
|
|
3547
3554
|
* A `CollectionReference` object can be used for adding documents, getting
|
|
3548
3555
|
* document references, and querying for documents (using {@link query}).
|
|
3549
|
-
*/ class
|
|
3556
|
+
*/ class de extends fe {
|
|
3550
3557
|
/** @hideconstructor */
|
|
3551
3558
|
constructor(t, n, e) {
|
|
3552
3559
|
super(t, n, new an(e)), this._path = e,
|
|
@@ -3567,23 +3574,23 @@ class fe {
|
|
|
3567
3574
|
* subcollection. If this isn't a subcollection, the reference is null.
|
|
3568
3575
|
*/ get parent() {
|
|
3569
3576
|
const t = this._path.popLast();
|
|
3570
|
-
return t.isEmpty() ? null : new
|
|
3577
|
+
return t.isEmpty() ? null : new le(this.firestore,
|
|
3571
3578
|
/* converter= */ null, new et(t));
|
|
3572
3579
|
}
|
|
3573
3580
|
withConverter(t) {
|
|
3574
|
-
return new
|
|
3581
|
+
return new de(this.firestore, t, this._path);
|
|
3575
3582
|
}
|
|
3576
3583
|
}
|
|
3577
3584
|
|
|
3578
|
-
function
|
|
3579
|
-
if (t = l(t), rt("collection", "path", n), t instanceof
|
|
3585
|
+
function we(t, n, ...e) {
|
|
3586
|
+
if (t = l(t), rt("collection", "path", n), t instanceof oe) {
|
|
3580
3587
|
const r = Z.fromString(n, ...e);
|
|
3581
|
-
return it(r), new
|
|
3588
|
+
return it(r), new de(t, /* converter= */ null, r);
|
|
3582
3589
|
}
|
|
3583
3590
|
{
|
|
3584
|
-
if (!(t instanceof
|
|
3591
|
+
if (!(t instanceof le || t instanceof de)) throw new U(R, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3585
3592
|
const r = t._path.child(Z.fromString(n, ...e));
|
|
3586
|
-
return it(r), new
|
|
3593
|
+
return it(r), new de(t.firestore,
|
|
3587
3594
|
/* converter= */ null, r);
|
|
3588
3595
|
}
|
|
3589
3596
|
}
|
|
@@ -3600,9 +3607,9 @@ function me(t, n, ...e) {
|
|
|
3600
3607
|
* collection or subcollection with this ID as the last segment of its path
|
|
3601
3608
|
* will be included. Cannot contain a slash.
|
|
3602
3609
|
* @returns The created `Query`.
|
|
3603
|
-
*/ function
|
|
3604
|
-
if (t = ut(t,
|
|
3605
|
-
return new
|
|
3610
|
+
*/ function me(t, n) {
|
|
3611
|
+
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 '/'.`);
|
|
3612
|
+
return new fe(t,
|
|
3606
3613
|
/* converter= */ null,
|
|
3607
3614
|
/**
|
|
3608
3615
|
* Creates a new Query for a collection group query that matches all documents
|
|
@@ -3613,19 +3620,19 @@ function me(t, n, ...e) {
|
|
|
3613
3620
|
}(n));
|
|
3614
3621
|
}
|
|
3615
3622
|
|
|
3616
|
-
function
|
|
3623
|
+
function pe(t, n, ...e) {
|
|
3617
3624
|
if (t = l(t),
|
|
3618
3625
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
3619
3626
|
// 'undefined' and 'null'.
|
|
3620
|
-
1 === arguments.length && (n = yt.R()), rt("doc", "path", n), t instanceof
|
|
3627
|
+
1 === arguments.length && (n = yt.R()), rt("doc", "path", n), t instanceof oe) {
|
|
3621
3628
|
const r = Z.fromString(n, ...e);
|
|
3622
|
-
return st(r), new
|
|
3629
|
+
return st(r), new le(t,
|
|
3623
3630
|
/* converter= */ null, new et(r));
|
|
3624
3631
|
}
|
|
3625
3632
|
{
|
|
3626
|
-
if (!(t instanceof
|
|
3633
|
+
if (!(t instanceof le || t instanceof de)) throw new U(R, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3627
3634
|
const r = t._path.child(Z.fromString(n, ...e));
|
|
3628
|
-
return st(r), new
|
|
3635
|
+
return st(r), new le(t.firestore, t instanceof de ? t.converter : null, new et(r));
|
|
3629
3636
|
}
|
|
3630
3637
|
}
|
|
3631
3638
|
|
|
@@ -3636,8 +3643,8 @@ function ye(t, n, ...e) {
|
|
|
3636
3643
|
* @param right - A reference to compare.
|
|
3637
3644
|
* @returns true if the references point to the same location in the same
|
|
3638
3645
|
* Firestore database.
|
|
3639
|
-
*/ function
|
|
3640
|
-
return t = l(t), n = l(n), (t instanceof
|
|
3646
|
+
*/ function ye(t, n) {
|
|
3647
|
+
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);
|
|
3641
3648
|
}
|
|
3642
3649
|
|
|
3643
3650
|
/**
|
|
@@ -3648,8 +3655,8 @@ function ye(t, n, ...e) {
|
|
|
3648
3655
|
* @param right - A `Query` to compare.
|
|
3649
3656
|
* @returns true if the references point to the same location in the same
|
|
3650
3657
|
* Firestore database.
|
|
3651
|
-
*/ function
|
|
3652
|
-
return t = l(t), n = l(n), t instanceof
|
|
3658
|
+
*/ function _e(t, n) {
|
|
3659
|
+
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);
|
|
3653
3660
|
}
|
|
3654
3661
|
|
|
3655
3662
|
/**
|
|
@@ -3675,7 +3682,7 @@ function ye(t, n, ...e) {
|
|
|
3675
3682
|
*
|
|
3676
3683
|
* Create a `FieldPath` by providing field names. If more than one field
|
|
3677
3684
|
* name is provided, the path will point to a nested field in a document.
|
|
3678
|
-
*/ class
|
|
3685
|
+
*/ class ge {
|
|
3679
3686
|
/**
|
|
3680
3687
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
3681
3688
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -3700,7 +3707,7 @@ function ye(t, n, ...e) {
|
|
|
3700
3707
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
3701
3708
|
* It can be used in queries to sort or filter by the document ID.
|
|
3702
3709
|
*/ function ve() {
|
|
3703
|
-
return new
|
|
3710
|
+
return new ge("__name__");
|
|
3704
3711
|
}
|
|
3705
3712
|
|
|
3706
3713
|
/**
|
|
@@ -3721,7 +3728,7 @@ function ye(t, n, ...e) {
|
|
|
3721
3728
|
*/
|
|
3722
3729
|
/**
|
|
3723
3730
|
* An immutable object representing an array of bytes.
|
|
3724
|
-
*/ class
|
|
3731
|
+
*/ class be {
|
|
3725
3732
|
/** @hideconstructor */
|
|
3726
3733
|
constructor(t) {
|
|
3727
3734
|
this._byteString = t;
|
|
@@ -3733,7 +3740,7 @@ function ye(t, n, ...e) {
|
|
|
3733
3740
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
3734
3741
|
*/ static fromBase64String(t) {
|
|
3735
3742
|
try {
|
|
3736
|
-
return new
|
|
3743
|
+
return new be(Rt.fromBase64String(t));
|
|
3737
3744
|
} catch (t) {
|
|
3738
3745
|
throw new U(R, "Failed to construct data from Base64 string: " + t);
|
|
3739
3746
|
}
|
|
@@ -3743,7 +3750,7 @@ function ye(t, n, ...e) {
|
|
|
3743
3750
|
*
|
|
3744
3751
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
3745
3752
|
*/ static fromUint8Array(t) {
|
|
3746
|
-
return new
|
|
3753
|
+
return new be(Rt.fromUint8Array(t));
|
|
3747
3754
|
}
|
|
3748
3755
|
/**
|
|
3749
3756
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -3795,7 +3802,7 @@ function ye(t, n, ...e) {
|
|
|
3795
3802
|
/**
|
|
3796
3803
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
3797
3804
|
* or `update()`.
|
|
3798
|
-
*/ class
|
|
3805
|
+
*/ class Ee {
|
|
3799
3806
|
/**
|
|
3800
3807
|
* @param _methodName - The public API endpoint that returns this class.
|
|
3801
3808
|
* @hideconstructor
|
|
@@ -3827,7 +3834,7 @@ function ye(t, n, ...e) {
|
|
|
3827
3834
|
*
|
|
3828
3835
|
* Latitude values are in the range of [-90, 90].
|
|
3829
3836
|
* Longitude values are in the range of [-180, 180].
|
|
3830
|
-
*/ class
|
|
3837
|
+
*/ class Te {
|
|
3831
3838
|
/**
|
|
3832
3839
|
* Creates a new immutable `GeoPoint` object with the provided latitude and
|
|
3833
3840
|
* longitude values.
|
|
@@ -3886,9 +3893,9 @@ function ye(t, n, ...e) {
|
|
|
3886
3893
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3887
3894
|
* See the License for the specific language governing permissions and
|
|
3888
3895
|
* limitations under the License.
|
|
3889
|
-
*/ const
|
|
3896
|
+
*/ const Ie = /^__.*__$/;
|
|
3890
3897
|
|
|
3891
|
-
/** The result of parsing document data (e.g. for a setData call). */ class
|
|
3898
|
+
/** The result of parsing document data (e.g. for a setData call). */ class Ae {
|
|
3892
3899
|
constructor(t, n, e) {
|
|
3893
3900
|
this.data = t, this.fieldMask = n, this.fieldTransforms = e;
|
|
3894
3901
|
}
|
|
@@ -3897,7 +3904,7 @@ function ye(t, n, ...e) {
|
|
|
3897
3904
|
}
|
|
3898
3905
|
}
|
|
3899
3906
|
|
|
3900
|
-
/** The result of parsing "update" data (i.e. for an updateData call). */ class
|
|
3907
|
+
/** The result of parsing "update" data (i.e. for an updateData call). */ class Re {
|
|
3901
3908
|
constructor(t,
|
|
3902
3909
|
// The fieldMask does not include document transforms.
|
|
3903
3910
|
n, e) {
|
|
@@ -3908,7 +3915,7 @@ function ye(t, n, ...e) {
|
|
|
3908
3915
|
}
|
|
3909
3916
|
}
|
|
3910
3917
|
|
|
3911
|
-
function
|
|
3918
|
+
function Pe(t) {
|
|
3912
3919
|
switch (t) {
|
|
3913
3920
|
case 0 /* Set */ :
|
|
3914
3921
|
// fall through
|
|
@@ -3922,11 +3929,11 @@ function Ve(t) {
|
|
|
3922
3929
|
return !1;
|
|
3923
3930
|
|
|
3924
3931
|
default:
|
|
3925
|
-
throw
|
|
3932
|
+
throw v();
|
|
3926
3933
|
}
|
|
3927
3934
|
}
|
|
3928
3935
|
|
|
3929
|
-
/** A "context" object passed around while parsing user data. */ class
|
|
3936
|
+
/** A "context" object passed around while parsing user data. */ class Ve {
|
|
3930
3937
|
/**
|
|
3931
3938
|
* Initializes a ParseContext with the given source and path.
|
|
3932
3939
|
*
|
|
@@ -3958,7 +3965,7 @@ function Ve(t) {
|
|
|
3958
3965
|
return this.settings.tt;
|
|
3959
3966
|
}
|
|
3960
3967
|
/** Returns a new context with the specified settings overwritten. */ nt(t) {
|
|
3961
|
-
return new
|
|
3968
|
+
return new Ve(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.q, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
3962
3969
|
}
|
|
3963
3970
|
et(t) {
|
|
3964
3971
|
var n;
|
|
@@ -3985,7 +3992,7 @@ function Ve(t) {
|
|
|
3985
3992
|
});
|
|
3986
3993
|
}
|
|
3987
3994
|
ut(t) {
|
|
3988
|
-
return
|
|
3995
|
+
return Ye(t, this.settings.methodName, this.settings.ct || !1, this.path, this.settings.at);
|
|
3989
3996
|
}
|
|
3990
3997
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
3991
3998
|
return void 0 !== this.fieldMask.find((n => t.isPrefixOf(n))) || void 0 !== this.fieldTransforms.find((n => t.isPrefixOf(n.field)));
|
|
@@ -3997,19 +4004,19 @@ function Ve(t) {
|
|
|
3997
4004
|
}
|
|
3998
4005
|
st(t) {
|
|
3999
4006
|
if (0 === t.length) throw this.ut("Document fields must not be empty");
|
|
4000
|
-
if (
|
|
4007
|
+
if (Pe(this.tt) && Ie.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
|
|
4001
4008
|
}
|
|
4002
4009
|
}
|
|
4003
4010
|
|
|
4004
4011
|
/**
|
|
4005
4012
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
4006
4013
|
* classes.
|
|
4007
|
-
*/ class
|
|
4014
|
+
*/ class Ne {
|
|
4008
4015
|
constructor(t, n, e) {
|
|
4009
|
-
this.databaseId = t, this.ignoreUndefinedProperties = n, this.q = e ||
|
|
4016
|
+
this.databaseId = t, this.ignoreUndefinedProperties = n, this.q = e || Jn(t);
|
|
4010
4017
|
}
|
|
4011
4018
|
/** Creates a new top-level parse context. */ ht(t, n, e, r = !1) {
|
|
4012
|
-
return new
|
|
4019
|
+
return new Ve({
|
|
4013
4020
|
tt: t,
|
|
4014
4021
|
methodName: n,
|
|
4015
4022
|
at: e,
|
|
@@ -4020,29 +4027,29 @@ function Ve(t) {
|
|
|
4020
4027
|
}
|
|
4021
4028
|
}
|
|
4022
4029
|
|
|
4023
|
-
function
|
|
4024
|
-
const n = t._freezeSettings(), e =
|
|
4025
|
-
return new
|
|
4030
|
+
function De(t) {
|
|
4031
|
+
const n = t._freezeSettings(), e = Jn(t._databaseId);
|
|
4032
|
+
return new Ne(t._databaseId, !!n.ignoreUndefinedProperties, e);
|
|
4026
4033
|
}
|
|
4027
4034
|
|
|
4028
|
-
/** Parse document data from a set() call. */ function
|
|
4035
|
+
/** Parse document data from a set() call. */ function $e(t, n, e, r, s, i = {}) {
|
|
4029
4036
|
const o = t.ht(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , n, e, s);
|
|
4030
|
-
|
|
4031
|
-
const u =
|
|
4037
|
+
ze("Data must be an object, but it was:", o, r);
|
|
4038
|
+
const u = Me(r, o);
|
|
4032
4039
|
let c, a;
|
|
4033
4040
|
if (i.merge) c = new It(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
|
|
4034
4041
|
const t = [];
|
|
4035
4042
|
for (const r of i.mergeFields) {
|
|
4036
4043
|
const s = Ge(n, r, e);
|
|
4037
4044
|
if (!o.contains(s)) throw new U(R, `Field '${s}' is specified in your field mask but missing from your input data.`);
|
|
4038
|
-
|
|
4045
|
+
He(t, s) || t.push(s);
|
|
4039
4046
|
}
|
|
4040
4047
|
c = new It(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
|
|
4041
4048
|
} else c = null, a = o.fieldTransforms;
|
|
4042
|
-
return new
|
|
4049
|
+
return new Ae(new Gt(u), c, a);
|
|
4043
4050
|
}
|
|
4044
4051
|
|
|
4045
|
-
class
|
|
4052
|
+
class Se extends Ee {
|
|
4046
4053
|
_toFieldTransform(t) {
|
|
4047
4054
|
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}`);
|
|
4048
4055
|
// No transform to add for a delete, but we need to add it to our
|
|
@@ -4050,7 +4057,7 @@ class Fe extends Te {
|
|
|
4050
4057
|
return t.fieldMask.push(t.path), null;
|
|
4051
4058
|
}
|
|
4052
4059
|
isEqual(t) {
|
|
4053
|
-
return t instanceof
|
|
4060
|
+
return t instanceof Se;
|
|
4054
4061
|
}
|
|
4055
4062
|
}
|
|
4056
4063
|
|
|
@@ -4069,8 +4076,8 @@ class Fe extends Te {
|
|
|
4069
4076
|
* context.
|
|
4070
4077
|
* @param context - The parent context.
|
|
4071
4078
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4072
|
-
*/ function
|
|
4073
|
-
return new
|
|
4079
|
+
*/ function Fe(t, n, e) {
|
|
4080
|
+
return new Ve({
|
|
4074
4081
|
tt: 3 /* Argument */ ,
|
|
4075
4082
|
at: n.settings.at,
|
|
4076
4083
|
methodName: t._methodName,
|
|
@@ -4078,22 +4085,22 @@ class Fe extends Te {
|
|
|
4078
4085
|
}, n.databaseId, n.q, n.ignoreUndefinedProperties);
|
|
4079
4086
|
}
|
|
4080
4087
|
|
|
4081
|
-
class
|
|
4088
|
+
class xe extends Ee {
|
|
4082
4089
|
_toFieldTransform(t) {
|
|
4083
4090
|
return new Tn(t.path, new gn);
|
|
4084
4091
|
}
|
|
4085
4092
|
isEqual(t) {
|
|
4086
|
-
return t instanceof
|
|
4093
|
+
return t instanceof xe;
|
|
4087
4094
|
}
|
|
4088
4095
|
}
|
|
4089
4096
|
|
|
4090
|
-
class
|
|
4097
|
+
class qe extends Ee {
|
|
4091
4098
|
constructor(t, n) {
|
|
4092
4099
|
super(t), this.lt = n;
|
|
4093
4100
|
}
|
|
4094
4101
|
_toFieldTransform(t) {
|
|
4095
|
-
const n =
|
|
4096
|
-
/*array=*/ !0), e = this.lt.map((t =>
|
|
4102
|
+
const n = Fe(this, t,
|
|
4103
|
+
/*array=*/ !0), e = this.lt.map((t => je(t, n))), r = new vn(e);
|
|
4097
4104
|
return new Tn(t.path, r);
|
|
4098
4105
|
}
|
|
4099
4106
|
isEqual(t) {
|
|
@@ -4102,13 +4109,13 @@ class Oe extends Te {
|
|
|
4102
4109
|
}
|
|
4103
4110
|
}
|
|
4104
4111
|
|
|
4105
|
-
class
|
|
4112
|
+
class Oe extends Ee {
|
|
4106
4113
|
constructor(t, n) {
|
|
4107
4114
|
super(t), this.lt = n;
|
|
4108
4115
|
}
|
|
4109
4116
|
_toFieldTransform(t) {
|
|
4110
|
-
const n =
|
|
4111
|
-
/*array=*/ !0), e = this.lt.map((t =>
|
|
4117
|
+
const n = Fe(this, t,
|
|
4118
|
+
/*array=*/ !0), e = this.lt.map((t => je(t, n))), r = new bn(e);
|
|
4112
4119
|
return new Tn(t.path, r);
|
|
4113
4120
|
}
|
|
4114
4121
|
isEqual(t) {
|
|
@@ -4117,7 +4124,7 @@ class Ce extends Te {
|
|
|
4117
4124
|
}
|
|
4118
4125
|
}
|
|
4119
4126
|
|
|
4120
|
-
class
|
|
4127
|
+
class Ce extends Ee {
|
|
4121
4128
|
constructor(t, n) {
|
|
4122
4129
|
super(t), this.ft = n;
|
|
4123
4130
|
}
|
|
@@ -4131,50 +4138,50 @@ class Le extends Te {
|
|
|
4131
4138
|
}
|
|
4132
4139
|
}
|
|
4133
4140
|
|
|
4134
|
-
/** Parse update data from an update() call. */ function
|
|
4141
|
+
/** Parse update data from an update() call. */ function Le(t, n, e, r) {
|
|
4135
4142
|
const s = t.ht(1 /* Update */ , n, e);
|
|
4136
|
-
|
|
4137
|
-
const i = [], o =
|
|
4143
|
+
ze("Data must be an object, but it was:", s, r);
|
|
4144
|
+
const i = [], o = Gt.empty();
|
|
4138
4145
|
Tt(r, ((t, r) => {
|
|
4139
|
-
const u =
|
|
4146
|
+
const u = We(n, t, e);
|
|
4140
4147
|
// For Compat types, we have to "extract" the underlying types before
|
|
4141
4148
|
// performing validation.
|
|
4142
4149
|
r = l(r);
|
|
4143
4150
|
const c = s.it(u);
|
|
4144
|
-
if (r instanceof
|
|
4151
|
+
if (r instanceof Se)
|
|
4145
4152
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4146
4153
|
i.push(u); else {
|
|
4147
|
-
const t =
|
|
4154
|
+
const t = je(r, c);
|
|
4148
4155
|
null != t && (i.push(u), o.set(u, t));
|
|
4149
4156
|
}
|
|
4150
4157
|
}));
|
|
4151
4158
|
const u = new It(i);
|
|
4152
|
-
return new
|
|
4159
|
+
return new Re(o, u, s.fieldTransforms);
|
|
4153
4160
|
}
|
|
4154
4161
|
|
|
4155
|
-
/** Parse update data from a list of field/value arguments. */ function
|
|
4162
|
+
/** Parse update data from a list of field/value arguments. */ function ke(t, n, e, r, s, i) {
|
|
4156
4163
|
const o = t.ht(1 /* Update */ , n, e), u = [ Ge(n, r, e) ], c = [ s ];
|
|
4157
4164
|
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.`);
|
|
4158
4165
|
for (let t = 0; t < i.length; t += 2) u.push(Ge(n, i[t])), c.push(i[t + 1]);
|
|
4159
|
-
const a = [], h =
|
|
4166
|
+
const a = [], h = Gt.empty();
|
|
4160
4167
|
// We iterate in reverse order to pick the last value for a field if the
|
|
4161
4168
|
// user specified the field multiple times.
|
|
4162
|
-
for (let t = u.length - 1; t >= 0; --t) if (!
|
|
4169
|
+
for (let t = u.length - 1; t >= 0; --t) if (!He(a, u[t])) {
|
|
4163
4170
|
const n = u[t];
|
|
4164
4171
|
let e = c[t];
|
|
4165
4172
|
// For Compat types, we have to "extract" the underlying types before
|
|
4166
4173
|
// performing validation.
|
|
4167
4174
|
e = l(e);
|
|
4168
4175
|
const r = o.it(n);
|
|
4169
|
-
if (e instanceof
|
|
4176
|
+
if (e instanceof Se)
|
|
4170
4177
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4171
4178
|
a.push(n); else {
|
|
4172
|
-
const t =
|
|
4179
|
+
const t = je(e, r);
|
|
4173
4180
|
null != t && (a.push(n), h.set(n, t));
|
|
4174
4181
|
}
|
|
4175
4182
|
}
|
|
4176
4183
|
const f = new It(a);
|
|
4177
|
-
return new
|
|
4184
|
+
return new Re(h, f, o.fieldTransforms);
|
|
4178
4185
|
}
|
|
4179
4186
|
|
|
4180
4187
|
/**
|
|
@@ -4183,8 +4190,8 @@ class Le extends Te {
|
|
|
4183
4190
|
*
|
|
4184
4191
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
4185
4192
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
4186
|
-
*/ function
|
|
4187
|
-
return
|
|
4193
|
+
*/ function Ue(t, n, e, r = !1) {
|
|
4194
|
+
return je(e, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , n));
|
|
4188
4195
|
}
|
|
4189
4196
|
|
|
4190
4197
|
/**
|
|
@@ -4195,12 +4202,12 @@ class Le extends Te {
|
|
|
4195
4202
|
* the source of the data being parsed, etc.
|
|
4196
4203
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
4197
4204
|
* that should not be included in the resulting parsed data.
|
|
4198
|
-
*/ function
|
|
4199
|
-
if (
|
|
4205
|
+
*/ function je(t, n) {
|
|
4206
|
+
if (Be(
|
|
4200
4207
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
4201
4208
|
// from firestore-exp.
|
|
4202
|
-
t = l(t))) return
|
|
4203
|
-
if (t instanceof
|
|
4209
|
+
t = l(t))) return ze("Unsupported field value:", n, t), Me(t, n);
|
|
4210
|
+
if (t instanceof Ee)
|
|
4204
4211
|
// FieldValues usually parse into transforms (except deleteField())
|
|
4205
4212
|
// in which case we do not want to include this field in our parsed data
|
|
4206
4213
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -4212,7 +4219,7 @@ class Le extends Te {
|
|
|
4212
4219
|
*/
|
|
4213
4220
|
return function(t, n) {
|
|
4214
4221
|
// Sentinels are only supported with writes, and not within arrays.
|
|
4215
|
-
if (!
|
|
4222
|
+
if (!Pe(n.tt)) throw n.ut(`${t._methodName}() can only be used with update() and set()`);
|
|
4216
4223
|
if (!n.path) throw n.ut(`${t._methodName}() is not currently supported inside arrays`);
|
|
4217
4224
|
const e = t._toFieldTransform(n);
|
|
4218
4225
|
e && n.fieldTransforms.push(e);
|
|
@@ -4242,7 +4249,7 @@ class Le extends Te {
|
|
|
4242
4249
|
const e = [];
|
|
4243
4250
|
let r = 0;
|
|
4244
4251
|
for (const s of t) {
|
|
4245
|
-
let t =
|
|
4252
|
+
let t = je(s, n.ot(r));
|
|
4246
4253
|
null == t && (
|
|
4247
4254
|
// Just include nulls in the array for fields being replaced with a
|
|
4248
4255
|
// sentinel.
|
|
@@ -4269,30 +4276,30 @@ class Le extends Te {
|
|
|
4269
4276
|
stringValue: t
|
|
4270
4277
|
};
|
|
4271
4278
|
if (t instanceof Date) {
|
|
4272
|
-
const e =
|
|
4279
|
+
const e = vt.fromDate(t);
|
|
4273
4280
|
return {
|
|
4274
4281
|
timestampValue: Fn(n.q, e)
|
|
4275
4282
|
};
|
|
4276
4283
|
}
|
|
4277
|
-
if (t instanceof
|
|
4284
|
+
if (t instanceof vt) {
|
|
4278
4285
|
// Firestore backend truncates precision down to microseconds. To ensure
|
|
4279
4286
|
// offline mode works the same with regards to truncation, perform the
|
|
4280
4287
|
// truncation immediately without waiting for the backend to do that.
|
|
4281
|
-
const e = new
|
|
4288
|
+
const e = new vt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
4282
4289
|
return {
|
|
4283
4290
|
timestampValue: Fn(n.q, e)
|
|
4284
4291
|
};
|
|
4285
4292
|
}
|
|
4286
|
-
if (t instanceof
|
|
4293
|
+
if (t instanceof Te) return {
|
|
4287
4294
|
geoPointValue: {
|
|
4288
4295
|
latitude: t.latitude,
|
|
4289
4296
|
longitude: t.longitude
|
|
4290
4297
|
}
|
|
4291
4298
|
};
|
|
4292
|
-
if (t instanceof
|
|
4299
|
+
if (t instanceof be) return {
|
|
4293
4300
|
bytesValue: xn(n.q, t._byteString)
|
|
4294
4301
|
};
|
|
4295
|
-
if (t instanceof
|
|
4302
|
+
if (t instanceof le) {
|
|
4296
4303
|
const e = n.databaseId, r = t.firestore._databaseId;
|
|
4297
4304
|
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}`);
|
|
4298
4305
|
return {
|
|
@@ -4310,13 +4317,13 @@ class Le extends Te {
|
|
|
4310
4317
|
*/ (t, n);
|
|
4311
4318
|
}
|
|
4312
4319
|
|
|
4313
|
-
function
|
|
4320
|
+
function Me(t, n) {
|
|
4314
4321
|
const e = {};
|
|
4315
4322
|
return !function(t) {
|
|
4316
4323
|
for (const n in t) if (Object.prototype.hasOwnProperty.call(t, n)) return !1;
|
|
4317
4324
|
return !0;
|
|
4318
4325
|
}(t) ? Tt(t, ((t, r) => {
|
|
4319
|
-
const s =
|
|
4326
|
+
const s = je(r, n.et(t));
|
|
4320
4327
|
null != s && (e[t] = s);
|
|
4321
4328
|
})) :
|
|
4322
4329
|
// If we encounter an empty object, we explicitly add it to the update
|
|
@@ -4328,12 +4335,12 @@ function Be(t, n) {
|
|
|
4328
4335
|
};
|
|
4329
4336
|
}
|
|
4330
4337
|
|
|
4331
|
-
function
|
|
4332
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof
|
|
4338
|
+
function Be(t) {
|
|
4339
|
+
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);
|
|
4333
4340
|
}
|
|
4334
4341
|
|
|
4335
|
-
function
|
|
4336
|
-
if (!
|
|
4342
|
+
function ze(t, n, e) {
|
|
4343
|
+
if (!Be(e) || !function(t) {
|
|
4337
4344
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
4338
4345
|
}(e)) {
|
|
4339
4346
|
const r = ot(e);
|
|
@@ -4347,16 +4354,16 @@ function Qe(t, n, e) {
|
|
|
4347
4354
|
if ((
|
|
4348
4355
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
4349
4356
|
// FieldPath.
|
|
4350
|
-
n = l(n)) instanceof
|
|
4351
|
-
if ("string" == typeof n) return
|
|
4352
|
-
throw
|
|
4357
|
+
n = l(n)) instanceof ge) return n._internalPath;
|
|
4358
|
+
if ("string" == typeof n) return We(t, n);
|
|
4359
|
+
throw Ye("Field path arguments must be of type string or ", t,
|
|
4353
4360
|
/* hasConverter= */ !1,
|
|
4354
4361
|
/* path= */ void 0, e);
|
|
4355
4362
|
}
|
|
4356
4363
|
|
|
4357
4364
|
/**
|
|
4358
4365
|
* Matches any characters in a field path string that are reserved.
|
|
4359
|
-
*/ const
|
|
4366
|
+
*/ const Qe = new RegExp("[~\\*/\\[\\]]");
|
|
4360
4367
|
|
|
4361
4368
|
/**
|
|
4362
4369
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -4366,20 +4373,20 @@ function Qe(t, n, e) {
|
|
|
4366
4373
|
* split on dots.
|
|
4367
4374
|
* @param targetDoc - The document against which the field path will be
|
|
4368
4375
|
* evaluated.
|
|
4369
|
-
*/ function
|
|
4370
|
-
if (n.search(
|
|
4376
|
+
*/ function We(t, n, e) {
|
|
4377
|
+
if (n.search(Qe) >= 0) throw Ye(`Invalid field path (${n}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
|
|
4371
4378
|
/* hasConverter= */ !1,
|
|
4372
4379
|
/* path= */ void 0, e);
|
|
4373
4380
|
try {
|
|
4374
|
-
return new
|
|
4381
|
+
return new ge(...n.split("."))._internalPath;
|
|
4375
4382
|
} catch (r) {
|
|
4376
|
-
throw
|
|
4383
|
+
throw Ye(`Invalid field path (${n}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
|
|
4377
4384
|
/* hasConverter= */ !1,
|
|
4378
4385
|
/* path= */ void 0, e);
|
|
4379
4386
|
}
|
|
4380
4387
|
}
|
|
4381
4388
|
|
|
4382
|
-
function
|
|
4389
|
+
function Ye(t, n, e, r, s) {
|
|
4383
4390
|
const i = r && !r.isEmpty(), o = void 0 !== s;
|
|
4384
4391
|
let u = `Function ${n}() called with invalid data`;
|
|
4385
4392
|
e && (u += " (via `toFirestore()`)"), u += ". ";
|
|
@@ -4388,7 +4395,7 @@ function He(t, n, e, r, s) {
|
|
|
4388
4395
|
c += ")"), new U(R, u + t + c);
|
|
4389
4396
|
}
|
|
4390
4397
|
|
|
4391
|
-
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function
|
|
4398
|
+
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function He(t, n) {
|
|
4392
4399
|
return t.some((t => t.isEqual(n)));
|
|
4393
4400
|
}
|
|
4394
4401
|
|
|
@@ -4416,7 +4423,7 @@ function He(t, n, e, r, s) {
|
|
|
4416
4423
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
4417
4424
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
4418
4425
|
* explicitly verify a document's existence.
|
|
4419
|
-
*/ class
|
|
4426
|
+
*/ class Ke {
|
|
4420
4427
|
// Note: This class is stripped down version of the DocumentSnapshot in
|
|
4421
4428
|
// the legacy SDK. The changes are:
|
|
4422
4429
|
// - No support for SnapshotMetadata.
|
|
@@ -4432,7 +4439,7 @@ function He(t, n, e, r, s) {
|
|
|
4432
4439
|
/**
|
|
4433
4440
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
4434
4441
|
*/ get ref() {
|
|
4435
|
-
return new
|
|
4442
|
+
return new le(this._firestore, this._converter, this._key);
|
|
4436
4443
|
}
|
|
4437
4444
|
/**
|
|
4438
4445
|
* Signals whether or not the document at the snapshot's location exists.
|
|
@@ -4452,7 +4459,7 @@ function He(t, n, e, r, s) {
|
|
|
4452
4459
|
if (this._converter) {
|
|
4453
4460
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
4454
4461
|
// if a converter has been provided.
|
|
4455
|
-
const t = new
|
|
4462
|
+
const t = new Je(this._firestore, this._userDataWriter, this._key, this._document,
|
|
4456
4463
|
/* converter= */ null);
|
|
4457
4464
|
return this._converter.fromFirestore(t);
|
|
4458
4465
|
}
|
|
@@ -4472,7 +4479,7 @@ function He(t, n, e, r, s) {
|
|
|
4472
4479
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4473
4480
|
get(t) {
|
|
4474
4481
|
if (this._document) {
|
|
4475
|
-
const n = this._document.data.field(
|
|
4482
|
+
const n = this._document.data.field(tr("DocumentSnapshot.get", t));
|
|
4476
4483
|
if (null !== n) return this._userDataWriter.convertValue(n);
|
|
4477
4484
|
}
|
|
4478
4485
|
}
|
|
@@ -4488,7 +4495,7 @@ function He(t, n, e, r, s) {
|
|
|
4488
4495
|
* `DocumentSnapshot`. Since query results contain only existing documents, the
|
|
4489
4496
|
* `exists` property will always be true and `data()` will never return
|
|
4490
4497
|
* 'undefined'.
|
|
4491
|
-
*/ class
|
|
4498
|
+
*/ class Je extends Ke {
|
|
4492
4499
|
/**
|
|
4493
4500
|
* Retrieves all fields in the document as an `Object`.
|
|
4494
4501
|
*
|
|
@@ -4506,7 +4513,7 @@ function He(t, n, e, r, s) {
|
|
|
4506
4513
|
* array via the `docs` property or enumerated using the `forEach` method. The
|
|
4507
4514
|
* number of documents can be determined via the `empty` and `size`
|
|
4508
4515
|
* properties.
|
|
4509
|
-
*/ class
|
|
4516
|
+
*/ class Xe {
|
|
4510
4517
|
/** @hideconstructor */
|
|
4511
4518
|
constructor(t, n) {
|
|
4512
4519
|
this._docs = n, this.query = t;
|
|
@@ -4537,14 +4544,14 @@ function He(t, n, e, r, s) {
|
|
|
4537
4544
|
* @param left - A snapshot to compare.
|
|
4538
4545
|
* @param right - A snapshot to compare.
|
|
4539
4546
|
* @returns true if the snapshots are equal.
|
|
4540
|
-
*/ function
|
|
4541
|
-
return t = l(t), n = l(n), t instanceof
|
|
4547
|
+
*/ function Ze(t, n) {
|
|
4548
|
+
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));
|
|
4542
4549
|
}
|
|
4543
4550
|
|
|
4544
4551
|
/**
|
|
4545
4552
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
4546
|
-
*/ function
|
|
4547
|
-
return "string" == typeof n ?
|
|
4553
|
+
*/ function tr(t, n) {
|
|
4554
|
+
return "string" == typeof n ? We(t, n) : n instanceof ge ? n._internalPath : n._delegate._internalPath;
|
|
4548
4555
|
}
|
|
4549
4556
|
|
|
4550
4557
|
/**
|
|
@@ -4571,7 +4578,7 @@ function He(t, n, e, r, s) {
|
|
|
4571
4578
|
* can then be passed to {@link query} to create a new query instance that
|
|
4572
4579
|
* also contains this `QueryConstraint`.
|
|
4573
4580
|
*/
|
|
4574
|
-
class
|
|
4581
|
+
class nr {}
|
|
4575
4582
|
|
|
4576
4583
|
/**
|
|
4577
4584
|
* Creates a new immutable instance of {@link Query} that is extended to also include
|
|
@@ -4581,32 +4588,32 @@ class er {}
|
|
|
4581
4588
|
* @param queryConstraints - The list of {@link QueryConstraint}s to apply.
|
|
4582
4589
|
* @throws if any of the provided query constraints cannot be combined with the
|
|
4583
4590
|
* existing or new constraints.
|
|
4584
|
-
*/ function
|
|
4591
|
+
*/ function er(t, ...n) {
|
|
4585
4592
|
for (const e of n) t = e._apply(t);
|
|
4586
4593
|
return t;
|
|
4587
4594
|
}
|
|
4588
4595
|
|
|
4589
|
-
class
|
|
4596
|
+
class rr extends nr {
|
|
4590
4597
|
constructor(t, n, e) {
|
|
4591
4598
|
super(), this.dt = t, this.wt = n, this.yt = e, this.type = "where";
|
|
4592
4599
|
}
|
|
4593
4600
|
_apply(t) {
|
|
4594
|
-
const n =
|
|
4601
|
+
const n = De(t.firestore), e = function(t, n, e, r, s, i, o) {
|
|
4595
4602
|
let u;
|
|
4596
4603
|
if (s.isKeyField()) {
|
|
4597
4604
|
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().`);
|
|
4598
4605
|
if ("in" /* IN */ === i || "not-in" /* NOT_IN */ === i) {
|
|
4599
|
-
|
|
4606
|
+
_r(o, i);
|
|
4600
4607
|
const n = [];
|
|
4601
|
-
for (const e of o) n.push(
|
|
4608
|
+
for (const e of o) n.push(yr(r, t, e));
|
|
4602
4609
|
u = {
|
|
4603
4610
|
arrayValue: {
|
|
4604
4611
|
values: n
|
|
4605
4612
|
}
|
|
4606
4613
|
};
|
|
4607
|
-
} else u =
|
|
4608
|
-
} else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i ||
|
|
4609
|
-
u =
|
|
4614
|
+
} else u = yr(r, t, o);
|
|
4615
|
+
} else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || _r(o, i),
|
|
4616
|
+
u = Ue(e, n, o,
|
|
4610
4617
|
/* allowArrays= */ "in" /* IN */ === i || "not-in" /* NOT_IN */ === i);
|
|
4611
4618
|
const c = Ht.create(s, i, u);
|
|
4612
4619
|
return function(t, n) {
|
|
@@ -4614,7 +4621,7 @@ class sr extends er {
|
|
|
4614
4621
|
const e = fn(t);
|
|
4615
4622
|
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()}'`);
|
|
4616
4623
|
const r = ln(t);
|
|
4617
|
-
null !== r &&
|
|
4624
|
+
null !== r && gr(t, n.field, r);
|
|
4618
4625
|
}
|
|
4619
4626
|
const e = function(t, n) {
|
|
4620
4627
|
for (const e of t.filters) if (n.indexOf(e.op) >= 0) return e.op;
|
|
@@ -4658,7 +4665,7 @@ class sr extends er {
|
|
|
4658
4665
|
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.`);
|
|
4659
4666
|
}(t, c), c;
|
|
4660
4667
|
}(t._query, "where", n, t.firestore._databaseId, this.dt, this.wt, this.yt);
|
|
4661
|
-
return new
|
|
4668
|
+
return new fe(t.firestore, t.converter, function(t, n) {
|
|
4662
4669
|
const e = t.filters.concat([ n ]);
|
|
4663
4670
|
return new an(t.path, t.collectionGroup, t.explicitOrderBy.slice(), e, t.limit, t.limitType, t.startAt, t.endAt);
|
|
4664
4671
|
}(t._query, e));
|
|
@@ -4675,12 +4682,12 @@ class sr extends er {
|
|
|
4675
4682
|
* "<=", "!=").
|
|
4676
4683
|
* @param value - The value for comparison
|
|
4677
4684
|
* @returns The created {@link Query}.
|
|
4678
|
-
*/ function
|
|
4679
|
-
const r = n, s =
|
|
4680
|
-
return new
|
|
4685
|
+
*/ function sr(t, n, e) {
|
|
4686
|
+
const r = n, s = tr("where", t);
|
|
4687
|
+
return new rr(s, r, e);
|
|
4681
4688
|
}
|
|
4682
4689
|
|
|
4683
|
-
class
|
|
4690
|
+
class ir extends nr {
|
|
4684
4691
|
constructor(t, n) {
|
|
4685
4692
|
super(), this.dt = t, this._t = n, this.type = "orderBy";
|
|
4686
4693
|
}
|
|
@@ -4693,7 +4700,7 @@ class or extends er {
|
|
|
4693
4700
|
if (null === ln(t)) {
|
|
4694
4701
|
// This is the first order by. It must match any inequality.
|
|
4695
4702
|
const e = fn(t);
|
|
4696
|
-
null !== e &&
|
|
4703
|
+
null !== e && gr(t, e, n.field);
|
|
4697
4704
|
}
|
|
4698
4705
|
}(t, r), r;
|
|
4699
4706
|
}
|
|
@@ -4708,7 +4715,7 @@ class or extends er {
|
|
|
4708
4715
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
4709
4716
|
* server timestamp.
|
|
4710
4717
|
*/ (t._query, this.dt, this._t);
|
|
4711
|
-
return new
|
|
4718
|
+
return new fe(t.firestore, t.converter, function(t, n) {
|
|
4712
4719
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
4713
4720
|
const e = t.explicitOrderBy.concat([ n ]);
|
|
4714
4721
|
return new an(t.path, t.collectionGroup, e, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -4724,19 +4731,19 @@ class or extends er {
|
|
|
4724
4731
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
4725
4732
|
* not specified, order will be ascending.
|
|
4726
4733
|
* @returns The created {@link Query}.
|
|
4727
|
-
*/ function
|
|
4728
|
-
const e = n, r =
|
|
4729
|
-
return new
|
|
4734
|
+
*/ function or(t, n = "asc") {
|
|
4735
|
+
const e = n, r = tr("orderBy", t);
|
|
4736
|
+
return new ir(r, e);
|
|
4730
4737
|
}
|
|
4731
4738
|
|
|
4732
|
-
class
|
|
4739
|
+
class ur extends nr {
|
|
4733
4740
|
constructor(t, n, e) {
|
|
4734
|
-
super(), this.type = t, this.gt = n, this.
|
|
4741
|
+
super(), this.type = t, this.gt = n, this.vt = e;
|
|
4735
4742
|
}
|
|
4736
4743
|
_apply(t) {
|
|
4737
|
-
return new
|
|
4744
|
+
return new fe(t.firestore, t.converter, function(t, n, e) {
|
|
4738
4745
|
return new an(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), n, e, t.startAt, t.endAt);
|
|
4739
|
-
}(t._query, this.gt, this.
|
|
4746
|
+
}(t._query, this.gt, this.vt));
|
|
4740
4747
|
}
|
|
4741
4748
|
}
|
|
4742
4749
|
|
|
@@ -4745,8 +4752,8 @@ class cr extends er {
|
|
|
4745
4752
|
*
|
|
4746
4753
|
* @param limit - The maximum number of items to return.
|
|
4747
4754
|
* @returns The created {@link Query}.
|
|
4748
|
-
*/ function
|
|
4749
|
-
return ct("limit", t), new
|
|
4755
|
+
*/ function cr(t) {
|
|
4756
|
+
return ct("limit", t), new ur("limit", t, "F" /* First */);
|
|
4750
4757
|
}
|
|
4751
4758
|
|
|
4752
4759
|
/**
|
|
@@ -4757,53 +4764,55 @@ class cr extends er {
|
|
|
4757
4764
|
*
|
|
4758
4765
|
* @param limit - The maximum number of items to return.
|
|
4759
4766
|
* @returns The created {@link Query}.
|
|
4760
|
-
*/ function
|
|
4761
|
-
return ct("limitToLast", t), new
|
|
4767
|
+
*/ function ar(t) {
|
|
4768
|
+
return ct("limitToLast", t), new ur("limitToLast", t, "L" /* Last */);
|
|
4762
4769
|
}
|
|
4763
4770
|
|
|
4764
|
-
class
|
|
4771
|
+
class hr extends nr {
|
|
4765
4772
|
constructor(t, n, e) {
|
|
4766
|
-
super(), this.type = t, this.
|
|
4773
|
+
super(), this.type = t, this.bt = n, this.Et = e;
|
|
4767
4774
|
}
|
|
4768
4775
|
_apply(t) {
|
|
4769
|
-
const n =
|
|
4770
|
-
return new
|
|
4776
|
+
const n = pr(t, this.type, this.bt, this.Et);
|
|
4777
|
+
return new fe(t.firestore, t.converter, function(t, n) {
|
|
4771
4778
|
return new an(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, n, t.endAt);
|
|
4772
4779
|
}(t._query, n));
|
|
4773
4780
|
}
|
|
4774
4781
|
}
|
|
4775
4782
|
|
|
4776
|
-
function
|
|
4777
|
-
return new
|
|
4783
|
+
function lr(...t) {
|
|
4784
|
+
return new hr("startAt", t,
|
|
4785
|
+
/*inclusive=*/ !0);
|
|
4778
4786
|
}
|
|
4779
4787
|
|
|
4780
|
-
function
|
|
4781
|
-
return new
|
|
4782
|
-
/*
|
|
4788
|
+
function fr(...t) {
|
|
4789
|
+
return new hr("startAfter", t,
|
|
4790
|
+
/*inclusive=*/ !1);
|
|
4783
4791
|
}
|
|
4784
4792
|
|
|
4785
|
-
class
|
|
4793
|
+
class dr extends nr {
|
|
4786
4794
|
constructor(t, n, e) {
|
|
4787
|
-
super(), this.type = t, this.
|
|
4795
|
+
super(), this.type = t, this.bt = n, this.Et = e;
|
|
4788
4796
|
}
|
|
4789
4797
|
_apply(t) {
|
|
4790
|
-
const n =
|
|
4791
|
-
return new
|
|
4798
|
+
const n = pr(t, this.type, this.bt, this.Et);
|
|
4799
|
+
return new fe(t.firestore, t.converter, function(t, n) {
|
|
4792
4800
|
return new an(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, n);
|
|
4793
4801
|
}(t._query, n));
|
|
4794
4802
|
}
|
|
4795
4803
|
}
|
|
4796
4804
|
|
|
4797
|
-
function
|
|
4798
|
-
return new
|
|
4805
|
+
function wr(...t) {
|
|
4806
|
+
return new dr("endBefore", t,
|
|
4807
|
+
/*inclusive=*/ !1);
|
|
4799
4808
|
}
|
|
4800
4809
|
|
|
4801
|
-
function
|
|
4802
|
-
return new
|
|
4810
|
+
function mr(...t) {
|
|
4811
|
+
return new dr("endAt", t, /*inclusive=*/ !0);
|
|
4803
4812
|
}
|
|
4804
4813
|
|
|
4805
|
-
/** Helper function to create a bound from a document or fields */ function
|
|
4806
|
-
if (e[0] = l(e[0]), e[0] instanceof
|
|
4814
|
+
/** Helper function to create a bound from a document or fields */ function pr(t, n, e, r) {
|
|
4815
|
+
if (e[0] = l(e[0]), e[0] instanceof Ke) return function(t, n, e, r, s) {
|
|
4807
4816
|
if (!r) throw new U(V, `Can't use a DocumentSnapshot that doesn't exist for ${e}().`);
|
|
4808
4817
|
const i = [];
|
|
4809
4818
|
// Because people expect to continue/end a query at the exact document
|
|
@@ -4828,7 +4837,7 @@ function pr(...t) {
|
|
|
4828
4837
|
* Converts a list of field values to a `Bound` for the given query.
|
|
4829
4838
|
*/ (t._query, t.firestore._databaseId, n, e[0]._document, r);
|
|
4830
4839
|
{
|
|
4831
|
-
const s =
|
|
4840
|
+
const s = De(t.firestore);
|
|
4832
4841
|
return function(t, n, e, r, s, i) {
|
|
4833
4842
|
// Use explicit order by's because it has to match the query the user made
|
|
4834
4843
|
const o = t.explicitOrderBy;
|
|
@@ -4844,7 +4853,7 @@ function pr(...t) {
|
|
|
4844
4853
|
const s = new et(e);
|
|
4845
4854
|
u.push(kt(n, s));
|
|
4846
4855
|
} else {
|
|
4847
|
-
const t =
|
|
4856
|
+
const t = Ue(e, r, c);
|
|
4848
4857
|
u.push(t);
|
|
4849
4858
|
}
|
|
4850
4859
|
}
|
|
@@ -4858,7 +4867,7 @@ function pr(...t) {
|
|
|
4858
4867
|
}
|
|
4859
4868
|
}
|
|
4860
4869
|
|
|
4861
|
-
function
|
|
4870
|
+
function yr(t, n, e) {
|
|
4862
4871
|
if ("string" == typeof (e = l(e))) {
|
|
4863
4872
|
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.");
|
|
4864
4873
|
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.`);
|
|
@@ -4866,19 +4875,19 @@ function _r(t, n, e) {
|
|
|
4866
4875
|
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}).`);
|
|
4867
4876
|
return kt(t, new et(r));
|
|
4868
4877
|
}
|
|
4869
|
-
if (e instanceof
|
|
4878
|
+
if (e instanceof le) return kt(t, e._key);
|
|
4870
4879
|
throw new U(R, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${ot(e)}.`);
|
|
4871
4880
|
}
|
|
4872
4881
|
|
|
4873
4882
|
/**
|
|
4874
4883
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
4875
4884
|
* array requirements.
|
|
4876
|
-
*/ function
|
|
4885
|
+
*/ function _r(t, n) {
|
|
4877
4886
|
if (!Array.isArray(t) || 0 === t.length) throw new U(R, `Invalid Query. A non-empty array is required for '${n.toString()}' filters.`);
|
|
4878
4887
|
if (t.length > 10) throw new U(R, `Invalid Query. '${n.toString()}' filters support a maximum of 10 elements in the value array.`);
|
|
4879
4888
|
}
|
|
4880
4889
|
|
|
4881
|
-
function
|
|
4890
|
+
function gr(t, n, e) {
|
|
4882
4891
|
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.`);
|
|
4883
4892
|
}
|
|
4884
4893
|
|
|
@@ -4938,7 +4947,7 @@ function vr(t, n, e) {
|
|
|
4938
4947
|
r;
|
|
4939
4948
|
}
|
|
4940
4949
|
|
|
4941
|
-
class
|
|
4950
|
+
class br extends class {
|
|
4942
4951
|
convertValue(t, n = "none") {
|
|
4943
4952
|
switch (xt(t)) {
|
|
4944
4953
|
case 0 /* NullValue */ :
|
|
@@ -4975,7 +4984,7 @@ class Er extends class {
|
|
|
4975
4984
|
return this.convertObject(t.mapValue, n);
|
|
4976
4985
|
|
|
4977
4986
|
default:
|
|
4978
|
-
throw
|
|
4987
|
+
throw v();
|
|
4979
4988
|
}
|
|
4980
4989
|
}
|
|
4981
4990
|
convertObject(t, n) {
|
|
@@ -4985,7 +4994,7 @@ class Er extends class {
|
|
|
4985
4994
|
})), e;
|
|
4986
4995
|
}
|
|
4987
4996
|
convertGeoPoint(t) {
|
|
4988
|
-
return new
|
|
4997
|
+
return new Te(Nt(t.latitude), Nt(t.longitude));
|
|
4989
4998
|
}
|
|
4990
4999
|
convertArray(t, n) {
|
|
4991
5000
|
return (t.values || []).map((t => this.convertValue(t, n)));
|
|
@@ -5005,11 +5014,11 @@ class Er extends class {
|
|
|
5005
5014
|
}
|
|
5006
5015
|
convertTimestamp(t) {
|
|
5007
5016
|
const n = Vt(t);
|
|
5008
|
-
return new
|
|
5017
|
+
return new vt(n.seconds, n.nanos);
|
|
5009
5018
|
}
|
|
5010
5019
|
convertDocumentKey(t, n) {
|
|
5011
5020
|
const e = Z.fromString(t);
|
|
5012
|
-
|
|
5021
|
+
b(Kn(e));
|
|
5013
5022
|
const r = new J(e.get(1), e.get(3)), s = new et(e.popFirst(5));
|
|
5014
5023
|
return r.isEqual(n) ||
|
|
5015
5024
|
// TODO(b/64130202): Somehow support foreign references.
|
|
@@ -5021,11 +5030,11 @@ class Er extends class {
|
|
|
5021
5030
|
super(), this.firestore = t;
|
|
5022
5031
|
}
|
|
5023
5032
|
convertBytes(t) {
|
|
5024
|
-
return new
|
|
5033
|
+
return new be(t);
|
|
5025
5034
|
}
|
|
5026
5035
|
convertReference(t) {
|
|
5027
5036
|
const n = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
5028
|
-
return new
|
|
5037
|
+
return new le(this.firestore, /* converter= */ null, n);
|
|
5029
5038
|
}
|
|
5030
5039
|
}
|
|
5031
5040
|
|
|
@@ -5041,12 +5050,12 @@ class Er extends class {
|
|
|
5041
5050
|
* @param reference - The reference of the document to fetch.
|
|
5042
5051
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
5043
5052
|
* document contents.
|
|
5044
|
-
*/ function
|
|
5045
|
-
const n =
|
|
5046
|
-
return
|
|
5047
|
-
|
|
5053
|
+
*/ function Er(t) {
|
|
5054
|
+
const n = se((t = ut(t, le)).firestore), e = new br(t.firestore);
|
|
5055
|
+
return ne(n, [ t._key ]).then((n => {
|
|
5056
|
+
b(1 === n.length);
|
|
5048
5057
|
const r = n[0];
|
|
5049
|
-
return new
|
|
5058
|
+
return new Ke(t.firestore, e, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
5050
5059
|
}));
|
|
5051
5060
|
}
|
|
5052
5061
|
|
|
@@ -5061,33 +5070,33 @@ class Er extends class {
|
|
|
5061
5070
|
*
|
|
5062
5071
|
* @param query - The `Query` to execute.
|
|
5063
5072
|
* @returns A Promise that will be resolved with the results of the query.
|
|
5064
|
-
*/ function
|
|
5073
|
+
*/ function Tr(t) {
|
|
5065
5074
|
!function(t) {
|
|
5066
5075
|
if (hn(t) && 0 === t.explicitOrderBy.length) throw new U(O, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
5067
|
-
}((t = ut(t,
|
|
5068
|
-
const n =
|
|
5069
|
-
return
|
|
5070
|
-
const r = n.map((n => new
|
|
5076
|
+
}((t = ut(t, fe))._query);
|
|
5077
|
+
const n = se(t.firestore), e = new br(t.firestore);
|
|
5078
|
+
return ee(n, t._query).then((n => {
|
|
5079
|
+
const r = n.map((n => new Je(t.firestore, e, n.key, n, t.converter)));
|
|
5071
5080
|
return hn(t._query) &&
|
|
5072
5081
|
// Limit to last queries reverse the orderBy constraint that was
|
|
5073
5082
|
// specified by the user. As such, we need to reverse the order of the
|
|
5074
5083
|
// results to return the documents in the expected order.
|
|
5075
|
-
r.reverse(), new
|
|
5084
|
+
r.reverse(), new Xe(t, r);
|
|
5076
5085
|
}));
|
|
5077
5086
|
}
|
|
5078
5087
|
|
|
5079
|
-
function
|
|
5080
|
-
const r = vr((t = ut(t,
|
|
5081
|
-
return
|
|
5088
|
+
function Ir(t, n, e) {
|
|
5089
|
+
const r = vr((t = ut(t, le)).converter, n, e), s = $e(De(t.firestore), "setDoc", t._key, r, null !== t.converter, e);
|
|
5090
|
+
return te(se(t.firestore), [ s.toMutation(t._key, In.none()) ]);
|
|
5082
5091
|
}
|
|
5083
5092
|
|
|
5084
|
-
function
|
|
5085
|
-
const s =
|
|
5093
|
+
function Ar(t, n, e, ...r) {
|
|
5094
|
+
const s = De((t = ut(t, le)).firestore);
|
|
5086
5095
|
// For Compat types, we have to "extract" the underlying types before
|
|
5087
5096
|
// performing validation.
|
|
5088
5097
|
let i;
|
|
5089
|
-
i = "string" == typeof (n = l(n)) || n instanceof
|
|
5090
|
-
return
|
|
5098
|
+
i = "string" == typeof (n = l(n)) || n instanceof ge ? ke(s, "updateDoc", t._key, n, e, r) : Le(s, "updateDoc", t._key, n);
|
|
5099
|
+
return te(se(t.firestore), [ i.toMutation(t._key, In.exists(!0)) ]);
|
|
5091
5100
|
}
|
|
5092
5101
|
|
|
5093
5102
|
/**
|
|
@@ -5101,8 +5110,8 @@ function Rr(t, n, e, ...r) {
|
|
|
5101
5110
|
* @param reference - A reference to the document to delete.
|
|
5102
5111
|
* @returns A `Promise` resolved once the document has been successfully
|
|
5103
5112
|
* deleted from the backend.
|
|
5104
|
-
*/ function
|
|
5105
|
-
return
|
|
5113
|
+
*/ function Rr(t) {
|
|
5114
|
+
return te(se((t = ut(t, le)).firestore), [ new Vn(t._key, In.none()) ]);
|
|
5106
5115
|
}
|
|
5107
5116
|
|
|
5108
5117
|
/**
|
|
@@ -5119,9 +5128,9 @@ function Rr(t, n, e, ...r) {
|
|
|
5119
5128
|
* @throws Error - If the provided input is not a valid Firestore document.
|
|
5120
5129
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
5121
5130
|
* newly created document after it has been written to the backend.
|
|
5122
|
-
*/ function
|
|
5123
|
-
const e =
|
|
5124
|
-
return
|
|
5131
|
+
*/ function Pr(t, n) {
|
|
5132
|
+
const e = pe(t = ut(t, de)), r = vr(t.converter, n), s = $e(De(t.firestore), "addDoc", e._key, r, null !== e.converter, {});
|
|
5133
|
+
return te(se(t.firestore), [ s.toMutation(e._key, In.exists(!1)) ]).then((() => e));
|
|
5125
5134
|
}
|
|
5126
5135
|
|
|
5127
5136
|
/**
|
|
@@ -5143,15 +5152,15 @@ function Rr(t, n, e, ...r) {
|
|
|
5143
5152
|
/**
|
|
5144
5153
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
5145
5154
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
5146
|
-
*/ function
|
|
5147
|
-
return new
|
|
5155
|
+
*/ function Vr() {
|
|
5156
|
+
return new Se("deleteField");
|
|
5148
5157
|
}
|
|
5149
5158
|
|
|
5150
5159
|
/**
|
|
5151
5160
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
5152
5161
|
* include a server-generated timestamp in the written data.
|
|
5153
|
-
*/ function
|
|
5154
|
-
return new
|
|
5162
|
+
*/ function Nr() {
|
|
5163
|
+
return new xe("serverTimestamp");
|
|
5155
5164
|
}
|
|
5156
5165
|
|
|
5157
5166
|
/**
|
|
@@ -5165,10 +5174,10 @@ function Rr(t, n, e, ...r) {
|
|
|
5165
5174
|
* @param elements - The elements to union into the array.
|
|
5166
5175
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5167
5176
|
* `updateDoc()`.
|
|
5168
|
-
*/ function
|
|
5177
|
+
*/ function Dr(...t) {
|
|
5169
5178
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5170
5179
|
// update() since we'd need the Firestore instance to do this.
|
|
5171
|
-
return new
|
|
5180
|
+
return new qe("arrayUnion", t);
|
|
5172
5181
|
}
|
|
5173
5182
|
|
|
5174
5183
|
/**
|
|
@@ -5181,10 +5190,10 @@ function Rr(t, n, e, ...r) {
|
|
|
5181
5190
|
* @param elements - The elements to remove from the array.
|
|
5182
5191
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5183
5192
|
* `updateDoc()`
|
|
5184
|
-
*/ function
|
|
5193
|
+
*/ function $r(...t) {
|
|
5185
5194
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5186
5195
|
// update() since we'd need the Firestore instance to do this.
|
|
5187
|
-
return new
|
|
5196
|
+
return new Oe("arrayRemove", t);
|
|
5188
5197
|
}
|
|
5189
5198
|
|
|
5190
5199
|
/**
|
|
@@ -5205,8 +5214,8 @@ function Rr(t, n, e, ...r) {
|
|
|
5205
5214
|
* @param n - The value to increment by.
|
|
5206
5215
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5207
5216
|
* `updateDoc()`
|
|
5208
|
-
*/ function
|
|
5209
|
-
return new
|
|
5217
|
+
*/ function Sr(t) {
|
|
5218
|
+
return new Ce("increment", t);
|
|
5210
5219
|
}
|
|
5211
5220
|
|
|
5212
5221
|
/**
|
|
@@ -5232,24 +5241,24 @@ function Rr(t, n, e, ...r) {
|
|
|
5232
5241
|
* provides methods for adding writes to the write batch. None of the writes
|
|
5233
5242
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
5234
5243
|
* called.
|
|
5235
|
-
*/ class
|
|
5244
|
+
*/ class Fr {
|
|
5236
5245
|
/** @hideconstructor */
|
|
5237
5246
|
constructor(t, n) {
|
|
5238
5247
|
this._firestore = t, this._commitHandler = n, this._mutations = [], this._committed = !1,
|
|
5239
|
-
this._dataReader =
|
|
5248
|
+
this._dataReader = De(t);
|
|
5240
5249
|
}
|
|
5241
5250
|
set(t, n, e) {
|
|
5242
5251
|
this._verifyNotCommitted();
|
|
5243
|
-
const r =
|
|
5252
|
+
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);
|
|
5244
5253
|
return this._mutations.push(i.toMutation(r._key, In.none())), this;
|
|
5245
5254
|
}
|
|
5246
5255
|
update(t, n, e, ...r) {
|
|
5247
5256
|
this._verifyNotCommitted();
|
|
5248
|
-
const s =
|
|
5257
|
+
const s = xr(t, this._firestore);
|
|
5249
5258
|
// For Compat types, we have to "extract" the underlying types before
|
|
5250
5259
|
// performing validation.
|
|
5251
5260
|
let i;
|
|
5252
|
-
return i = "string" == typeof (n = l(n)) || n instanceof
|
|
5261
|
+
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),
|
|
5253
5262
|
this._mutations.push(i.toMutation(s._key, In.exists(!0))), this;
|
|
5254
5263
|
}
|
|
5255
5264
|
/**
|
|
@@ -5259,7 +5268,7 @@ function Rr(t, n, e, ...r) {
|
|
|
5259
5268
|
* @returns This `WriteBatch` instance. Used for chaining method calls.
|
|
5260
5269
|
*/ delete(t) {
|
|
5261
5270
|
this._verifyNotCommitted();
|
|
5262
|
-
const n =
|
|
5271
|
+
const n = xr(t, this._firestore);
|
|
5263
5272
|
return this._mutations = this._mutations.concat(new Vn(n._key, In.none())), this;
|
|
5264
5273
|
}
|
|
5265
5274
|
/**
|
|
@@ -5281,7 +5290,7 @@ function Rr(t, n, e, ...r) {
|
|
|
5281
5290
|
}
|
|
5282
5291
|
}
|
|
5283
5292
|
|
|
5284
|
-
function
|
|
5293
|
+
function xr(t, n) {
|
|
5285
5294
|
if ((t = l(t)).firestore !== n) throw new U(R, "Provided document reference is from a different Firestore instance.");
|
|
5286
5295
|
return t;
|
|
5287
5296
|
}
|
|
@@ -5298,9 +5307,9 @@ function qr(t, n) {
|
|
|
5298
5307
|
*
|
|
5299
5308
|
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
5300
5309
|
* writes.
|
|
5301
|
-
*/ function
|
|
5302
|
-
const n =
|
|
5303
|
-
return new
|
|
5310
|
+
*/ function qr(t) {
|
|
5311
|
+
const n = se(t = ut(t, oe));
|
|
5312
|
+
return new Fr(t, (t => te(n, t)));
|
|
5304
5313
|
}
|
|
5305
5314
|
|
|
5306
5315
|
/**
|
|
@@ -5322,7 +5331,7 @@ function qr(t, n) {
|
|
|
5322
5331
|
/**
|
|
5323
5332
|
* Internal transaction object responsible for accumulating the mutations to
|
|
5324
5333
|
* perform and the base versions for any documents read.
|
|
5325
|
-
*/ class
|
|
5334
|
+
*/ class Or {
|
|
5326
5335
|
constructor(t) {
|
|
5327
5336
|
this.datastore = t,
|
|
5328
5337
|
// The version of each document that was read during this transaction.
|
|
@@ -5342,7 +5351,7 @@ function qr(t, n) {
|
|
|
5342
5351
|
}
|
|
5343
5352
|
async lookup(t) {
|
|
5344
5353
|
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(R, "Firestore transactions require all reads to be executed before all writes.");
|
|
5345
|
-
const n = await
|
|
5354
|
+
const n = await ne(this.datastore, t);
|
|
5346
5355
|
return n.forEach((t => this.recordVersion(t))), n;
|
|
5347
5356
|
}
|
|
5348
5357
|
set(t, n) {
|
|
@@ -5371,14 +5380,14 @@ function qr(t, n) {
|
|
|
5371
5380
|
t.forEach(((t, n) => {
|
|
5372
5381
|
const e = et.fromPath(n);
|
|
5373
5382
|
this.mutations.push(new Nn(e, this.precondition(e)));
|
|
5374
|
-
})), await
|
|
5383
|
+
})), await te(this.datastore, this.mutations), this.committed = !0;
|
|
5375
5384
|
}
|
|
5376
5385
|
recordVersion(t) {
|
|
5377
5386
|
let n;
|
|
5378
5387
|
if (t.isFoundDocument()) n = t.version; else {
|
|
5379
|
-
if (!t.isNoDocument()) throw
|
|
5388
|
+
if (!t.isNoDocument()) throw v();
|
|
5380
5389
|
// For deleted docs, we must use baseVersion 0 when we overwrite them.
|
|
5381
|
-
n =
|
|
5390
|
+
n = bt.min();
|
|
5382
5391
|
}
|
|
5383
5392
|
const e = this.readVersions.get(t.key.toString());
|
|
5384
5393
|
if (e) {
|
|
@@ -5401,7 +5410,7 @@ function qr(t, n) {
|
|
|
5401
5410
|
// The first time a document is written, we want to take into account the
|
|
5402
5411
|
// read time and existence
|
|
5403
5412
|
if (!this.writtenDocs.has(t.toString()) && n) {
|
|
5404
|
-
if (n.isEqual(
|
|
5413
|
+
if (n.isEqual(bt.min()))
|
|
5405
5414
|
// The document doesn't exist, so fail the transaction.
|
|
5406
5415
|
// This has to be validated locally because you can't send a
|
|
5407
5416
|
// precondition that a document does not exist without changing the
|
|
@@ -5445,17 +5454,17 @@ function qr(t, n) {
|
|
|
5445
5454
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
5446
5455
|
* with backoff.
|
|
5447
5456
|
*/
|
|
5448
|
-
class
|
|
5457
|
+
class Cr {
|
|
5449
5458
|
constructor(t, n, e, r) {
|
|
5450
5459
|
this.asyncQueue = t, this.datastore = n, this.updateFunction = e, this.deferred = r,
|
|
5451
|
-
this.Tt = 5, this.It = new
|
|
5460
|
+
this.Tt = 5, this.It = new Xn(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
5452
5461
|
}
|
|
5453
5462
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
5454
5463
|
this.Tt -= 1, this.At();
|
|
5455
5464
|
}
|
|
5456
5465
|
At() {
|
|
5457
5466
|
this.It.W((async () => {
|
|
5458
|
-
const t = new
|
|
5467
|
+
const t = new Or(this.datastore), n = this.Rt(t);
|
|
5459
5468
|
n && n.then((n => {
|
|
5460
5469
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
5461
5470
|
this.deferred.resolve(n);
|
|
@@ -5496,7 +5505,7 @@ class Lr {
|
|
|
5496
5505
|
function(t) {
|
|
5497
5506
|
switch (t) {
|
|
5498
5507
|
default:
|
|
5499
|
-
return
|
|
5508
|
+
return v();
|
|
5500
5509
|
|
|
5501
5510
|
case I:
|
|
5502
5511
|
case A:
|
|
@@ -5545,7 +5554,7 @@ class Lr {
|
|
|
5545
5554
|
* See the License for the specific language governing permissions and
|
|
5546
5555
|
* limitations under the License.
|
|
5547
5556
|
*/
|
|
5548
|
-
/** The Platform's 'document' implementation or null if not available. */ function
|
|
5557
|
+
/** The Platform's 'document' implementation or null if not available. */ function Lr() {
|
|
5549
5558
|
// `document` is not always available, e.g. in ReactNative and WebWorkers.
|
|
5550
5559
|
// eslint-disable-next-line no-restricted-globals
|
|
5551
5560
|
return "undefined" != typeof document ? document : null;
|
|
@@ -5577,7 +5586,7 @@ class Lr {
|
|
|
5577
5586
|
* Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
|
|
5578
5587
|
* in newer versions of TypeScript defines `finally`, which is not available in
|
|
5579
5588
|
* IE.
|
|
5580
|
-
*/ class
|
|
5589
|
+
*/ class kr {
|
|
5581
5590
|
constructor(t, n, e, r, s) {
|
|
5582
5591
|
this.asyncQueue = t, this.timerId = n, this.targetTimeMs = e, this.op = r, this.removalCallback = s,
|
|
5583
5592
|
this.deferred = new j, this.then = this.deferred.promise.then.bind(this.deferred.promise),
|
|
@@ -5600,7 +5609,7 @@ class Lr {
|
|
|
5600
5609
|
* PORTING NOTE: This exists to prevent making removeDelayedOperation() and
|
|
5601
5610
|
* the DelayedOperation class public.
|
|
5602
5611
|
*/ static createAndSchedule(t, n, e, r, s) {
|
|
5603
|
-
const i = Date.now() + e, o = new
|
|
5612
|
+
const i = Date.now() + e, o = new kr(t, n, i, r, s);
|
|
5604
5613
|
return o.start(e), o;
|
|
5605
5614
|
}
|
|
5606
5615
|
/**
|
|
@@ -5649,7 +5658,7 @@ class Lr {
|
|
|
5649
5658
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5650
5659
|
* See the License for the specific language governing permissions and
|
|
5651
5660
|
* limitations under the License.
|
|
5652
|
-
*/ class
|
|
5661
|
+
*/ class Ur {
|
|
5653
5662
|
constructor() {
|
|
5654
5663
|
// The last promise in the queue.
|
|
5655
5664
|
this.Nt = Promise.resolve(),
|
|
@@ -5672,15 +5681,15 @@ class Lr {
|
|
|
5672
5681
|
// List of TimerIds to fast-forward delays for.
|
|
5673
5682
|
this.Ot = [],
|
|
5674
5683
|
// Backoff timer used to schedule retries for retryable operations
|
|
5675
|
-
this.It = new
|
|
5684
|
+
this.It = new Xn(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
5676
5685
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
5677
5686
|
// operations. Meant to speed up recovery when we regain file system access
|
|
5678
5687
|
// after page comes into foreground.
|
|
5679
5688
|
this.Ct = () => {
|
|
5680
|
-
const t =
|
|
5689
|
+
const t = Lr();
|
|
5681
5690
|
t && p("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.It.H();
|
|
5682
5691
|
};
|
|
5683
|
-
const t =
|
|
5692
|
+
const t = Lr();
|
|
5684
5693
|
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Ct);
|
|
5685
5694
|
}
|
|
5686
5695
|
get isShuttingDown() {
|
|
@@ -5701,7 +5710,7 @@ class Lr {
|
|
|
5701
5710
|
enterRestrictedMode(t) {
|
|
5702
5711
|
if (!this.$t) {
|
|
5703
5712
|
this.$t = !0, this.qt = t || !1;
|
|
5704
|
-
const n =
|
|
5713
|
+
const n = Lr();
|
|
5705
5714
|
n && "function" == typeof n.removeEventListener && n.removeEventListener("visibilitychange", this.Ct);
|
|
5706
5715
|
}
|
|
5707
5716
|
}
|
|
@@ -5833,11 +5842,11 @@ class Lr {
|
|
|
5833
5842
|
this.Lt(),
|
|
5834
5843
|
// Fast-forward delays for timerIds that have been overriden.
|
|
5835
5844
|
this.Ot.indexOf(t) > -1 && (n = 0);
|
|
5836
|
-
const r =
|
|
5845
|
+
const r = kr.createAndSchedule(this, t, n, e, (t => this.jt(t)));
|
|
5837
5846
|
return this.St.push(r), r;
|
|
5838
5847
|
}
|
|
5839
5848
|
Lt() {
|
|
5840
|
-
this.Ft &&
|
|
5849
|
+
this.Ft && v();
|
|
5841
5850
|
}
|
|
5842
5851
|
verifyOperationInProgress() {}
|
|
5843
5852
|
/**
|
|
@@ -5877,7 +5886,7 @@ class Lr {
|
|
|
5877
5886
|
}
|
|
5878
5887
|
/**
|
|
5879
5888
|
* For Tests: Skip all subsequent delays for a timer id.
|
|
5880
|
-
*/
|
|
5889
|
+
*/ Gt(t) {
|
|
5881
5890
|
this.Ot.push(t);
|
|
5882
5891
|
}
|
|
5883
5892
|
/** Called once a DelayedOperation is run or canceled. */ jt(t) {
|
|
@@ -5887,10 +5896,10 @@ class Lr {
|
|
|
5887
5896
|
}
|
|
5888
5897
|
}
|
|
5889
5898
|
|
|
5890
|
-
class
|
|
5899
|
+
class jr {
|
|
5891
5900
|
/** @hideconstructor */
|
|
5892
5901
|
constructor(t, n) {
|
|
5893
|
-
this._firestore = t, this._transaction = n, this._dataReader =
|
|
5902
|
+
this._firestore = t, this._transaction = n, this._dataReader = De(t);
|
|
5894
5903
|
}
|
|
5895
5904
|
/**
|
|
5896
5905
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
@@ -5898,25 +5907,25 @@ class Mr {
|
|
|
5898
5907
|
* @param documentRef - A reference to the document to be read.
|
|
5899
5908
|
* @returns A `DocumentSnapshot` with the read data.
|
|
5900
5909
|
*/ get(t) {
|
|
5901
|
-
const n =
|
|
5910
|
+
const n = xr(t, this._firestore), e = new br(this._firestore);
|
|
5902
5911
|
return this._transaction.lookup([ n._key ]).then((t => {
|
|
5903
|
-
if (!t || 1 !== t.length) return
|
|
5912
|
+
if (!t || 1 !== t.length) return v();
|
|
5904
5913
|
const r = t[0];
|
|
5905
|
-
if (r.isFoundDocument()) return new
|
|
5906
|
-
if (r.isNoDocument()) return new
|
|
5907
|
-
throw
|
|
5914
|
+
if (r.isFoundDocument()) return new Ke(this._firestore, e, r.key, r, n.converter);
|
|
5915
|
+
if (r.isNoDocument()) return new Ke(this._firestore, e, n._key, null, n.converter);
|
|
5916
|
+
throw v();
|
|
5908
5917
|
}));
|
|
5909
5918
|
}
|
|
5910
5919
|
set(t, n, e) {
|
|
5911
|
-
const r =
|
|
5920
|
+
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);
|
|
5912
5921
|
return this._transaction.set(r._key, i), this;
|
|
5913
5922
|
}
|
|
5914
5923
|
update(t, n, e, ...r) {
|
|
5915
|
-
const s =
|
|
5924
|
+
const s = xr(t, this._firestore);
|
|
5916
5925
|
// For Compat types, we have to "extract" the underlying types before
|
|
5917
5926
|
// performing validation.
|
|
5918
5927
|
let i;
|
|
5919
|
-
return i = "string" == typeof (n = l(n)) || n instanceof
|
|
5928
|
+
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),
|
|
5920
5929
|
this._transaction.update(s._key, i), this;
|
|
5921
5930
|
}
|
|
5922
5931
|
/**
|
|
@@ -5925,7 +5934,7 @@ class Mr {
|
|
|
5925
5934
|
* @param documentRef - A reference to the document to be deleted.
|
|
5926
5935
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
5927
5936
|
*/ delete(t) {
|
|
5928
|
-
const n =
|
|
5937
|
+
const n = xr(t, this._firestore);
|
|
5929
5938
|
return this._transaction.delete(n._key), this;
|
|
5930
5939
|
}
|
|
5931
5940
|
}
|
|
@@ -5946,9 +5955,9 @@ class Mr {
|
|
|
5946
5955
|
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
5947
5956
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
5948
5957
|
* rejected promise with the corresponding failure error is returned.
|
|
5949
|
-
*/ function
|
|
5950
|
-
const e =
|
|
5951
|
-
return new
|
|
5958
|
+
*/ function Mr(t, n) {
|
|
5959
|
+
const e = se(t = ut(t, oe)), r = new j;
|
|
5960
|
+
return new Cr(new Ur, e, (e => n(new jr(t, e))), r).run(), r.promise;
|
|
5952
5961
|
}
|
|
5953
5962
|
|
|
5954
5963
|
/**
|
|
@@ -5961,11 +5970,11 @@ class Mr {
|
|
|
5961
5970
|
*/ !function(t) {
|
|
5962
5971
|
d = t;
|
|
5963
5972
|
}(`${s}_lite`), e(new i("firestore/lite", ((t, {options: n}) => {
|
|
5964
|
-
const e = t.getProvider("app").getImmediate(), r = new
|
|
5973
|
+
const e = t.getProvider("app").getImmediate(), r = new oe(e, new G(t.getProvider("auth-internal")), new H(t.getProvider("app-check-internal")));
|
|
5965
5974
|
return n && r._setSettings(n), r;
|
|
5966
5975
|
}), "PUBLIC")),
|
|
5967
5976
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5968
|
-
r("firestore-lite", "3.4.4-canary.
|
|
5977
|
+
r("firestore-lite", "3.4.4-canary.ea9895797", "rn"), r("firestore-lite", "3.4.4-canary.ea9895797", "esm2017");
|
|
5969
5978
|
|
|
5970
|
-
export {
|
|
5979
|
+
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 };
|
|
5971
5980
|
//# sourceMappingURL=index.rn.esm2017.js.map
|