@firebase/firestore 3.4.4 → 3.4.5-canary.8ac8fb099
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/firestore/src/api/credentials.d.ts +1 -0
- package/dist/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
- package/dist/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/firestore/src/api.d.ts +1 -1
- package/dist/firestore/src/core/database_info.d.ts +1 -0
- package/dist/firestore/src/core/target.d.ts +34 -5
- package/dist/firestore/src/index/index_byte_encoder.d.ts +18 -1
- package/dist/firestore/src/index/index_entry.d.ts +32 -0
- 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 +87 -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 +195 -7
- package/dist/firestore/src/local/local_documents_view.d.ts +0 -1
- package/dist/firestore/src/local/local_serializer.d.ts +19 -3
- 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/remote_document_change_buffer.d.ts +3 -12
- package/dist/firestore/src/local/simple_db.d.ts +12 -0
- package/dist/firestore/src/model/document.d.ts +7 -0
- package/dist/firestore/src/model/document_key.d.ts +6 -0
- package/dist/firestore/src/model/field_index.d.ts +89 -7
- 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/src/model/type_order.d.ts +2 -1
- package/dist/firestore/src/model/values.d.ts +7 -0
- package/dist/firestore/src/platform/node/base64.d.ts +1 -0
- package/dist/firestore/src/platform/node/grpc_connection.d.ts +2 -2
- package/dist/firestore/src/platform/node/load_protos.d.ts +2 -2
- package/dist/firestore/src/util/sorted_set.d.ts +18 -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 +5 -3
- package/dist/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
- package/dist/firestore/test/unit/model/field_index.test.d.ts +17 -0
- package/dist/firestore/test/unit/model/target.test.d.ts +17 -0
- package/dist/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
- package/dist/firestore/test/util/helpers.d.ts +8 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.esm2017.js +5415 -3839
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +5039 -3613
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +2908 -592
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +2888 -593
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +5396 -3862
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +265 -26
- package/dist/lite/firestore/src/api/credentials.d.ts +1 -0
- package/dist/lite/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
- package/dist/lite/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/lite/firestore/src/api.d.ts +1 -1
- package/dist/lite/firestore/src/core/database_info.d.ts +1 -0
- package/dist/lite/firestore/src/core/target.d.ts +34 -5
- package/dist/lite/firestore/src/index/index_byte_encoder.d.ts +18 -1
- package/dist/lite/firestore/src/index/index_entry.d.ts +32 -0
- 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 +87 -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 +195 -7
- package/dist/lite/firestore/src/local/local_documents_view.d.ts +0 -1
- package/dist/lite/firestore/src/local/local_serializer.d.ts +19 -3
- 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/remote_document_change_buffer.d.ts +3 -12
- package/dist/lite/firestore/src/local/simple_db.d.ts +12 -0
- package/dist/lite/firestore/src/model/document.d.ts +7 -0
- package/dist/lite/firestore/src/model/document_key.d.ts +6 -0
- package/dist/lite/firestore/src/model/field_index.d.ts +89 -7
- 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/src/model/type_order.d.ts +2 -1
- package/dist/lite/firestore/src/model/values.d.ts +7 -0
- package/dist/lite/firestore/src/platform/node/base64.d.ts +1 -0
- package/dist/lite/firestore/src/platform/node/grpc_connection.d.ts +2 -2
- package/dist/lite/firestore/src/platform/node/load_protos.d.ts +2 -2
- package/dist/lite/firestore/src/util/sorted_set.d.ts +18 -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 +5 -3
- package/dist/lite/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
- package/dist/lite/firestore/test/unit/model/field_index.test.d.ts +17 -0
- package/dist/lite/firestore/test/unit/model/target.test.d.ts +17 -0
- package/dist/lite/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
- package/dist/lite/firestore/test/util/helpers.d.ts +8 -2
- package/dist/lite/index.browser.esm2017.js +1207 -1174
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +370 -361
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +83 -41
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +83 -41
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +375 -342
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +16 -2
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +125 -124
- package/dist/lite/packages/firestore/src/api/credentials.d.ts +1 -0
- package/dist/lite/packages/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
- package/dist/lite/packages/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/lite/packages/firestore/src/api.d.ts +1 -1
- package/dist/lite/packages/firestore/src/core/database_info.d.ts +1 -0
- package/dist/lite/packages/firestore/src/core/target.d.ts +34 -5
- package/dist/lite/packages/firestore/src/index/index_byte_encoder.d.ts +18 -1
- package/dist/lite/packages/firestore/src/index/index_entry.d.ts +32 -0
- 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 +87 -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 +195 -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 +19 -3
- 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/remote_document_change_buffer.d.ts +3 -12
- package/dist/lite/packages/firestore/src/local/simple_db.d.ts +12 -0
- package/dist/lite/packages/firestore/src/model/document.d.ts +7 -0
- package/dist/lite/packages/firestore/src/model/document_key.d.ts +6 -0
- package/dist/lite/packages/firestore/src/model/field_index.d.ts +89 -7
- 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/src/model/type_order.d.ts +2 -1
- package/dist/lite/packages/firestore/src/model/values.d.ts +7 -0
- package/dist/lite/packages/firestore/src/platform/node/base64.d.ts +1 -0
- package/dist/lite/packages/firestore/src/platform/node/grpc_connection.d.ts +2 -2
- package/dist/lite/packages/firestore/src/platform/node/load_protos.d.ts +2 -2
- package/dist/lite/packages/firestore/src/util/sorted_set.d.ts +18 -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 +5 -3
- 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/field_index.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/unit/model/target.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/util/helpers.d.ts +8 -2
- package/dist/lite/private.d.ts +9 -2
- package/dist/packages/firestore/dist/index.esm2017.d.ts +199 -194
- package/dist/packages/firestore/src/api/credentials.d.ts +1 -0
- package/dist/packages/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
- package/dist/packages/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/packages/firestore/src/api.d.ts +1 -1
- package/dist/packages/firestore/src/core/database_info.d.ts +1 -0
- package/dist/packages/firestore/src/core/target.d.ts +34 -5
- package/dist/packages/firestore/src/index/index_byte_encoder.d.ts +18 -1
- package/dist/packages/firestore/src/index/index_entry.d.ts +32 -0
- 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 +87 -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 +195 -7
- package/dist/packages/firestore/src/local/local_documents_view.d.ts +0 -1
- package/dist/packages/firestore/src/local/local_serializer.d.ts +19 -3
- 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/remote_document_change_buffer.d.ts +3 -12
- package/dist/packages/firestore/src/local/simple_db.d.ts +12 -0
- package/dist/packages/firestore/src/model/document.d.ts +7 -0
- package/dist/packages/firestore/src/model/document_key.d.ts +6 -0
- package/dist/packages/firestore/src/model/field_index.d.ts +89 -7
- 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/src/model/type_order.d.ts +2 -1
- package/dist/packages/firestore/src/model/values.d.ts +7 -0
- package/dist/packages/firestore/src/platform/node/base64.d.ts +1 -0
- package/dist/packages/firestore/src/platform/node/grpc_connection.d.ts +2 -2
- package/dist/packages/firestore/src/platform/node/load_protos.d.ts +2 -2
- package/dist/packages/firestore/src/util/sorted_set.d.ts +18 -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 +5 -3
- package/dist/packages/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
- package/dist/packages/firestore/test/unit/model/field_index.test.d.ts +17 -0
- package/dist/packages/firestore/test/unit/model/target.test.d.ts +17 -0
- package/dist/packages/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
- package/dist/packages/firestore/test/util/helpers.d.ts +8 -2
- package/dist/private.d.ts +258 -26
- 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.7-canary.8ac8fb099";
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
@@ -328,7 +328,7 @@ 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;
|
|
@@ -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.
|
|
@@ -450,6 +450,9 @@ class J {
|
|
|
450
450
|
constructor(t, n) {
|
|
451
451
|
this.projectId = t, this.database = n || "(default)";
|
|
452
452
|
}
|
|
453
|
+
static empty() {
|
|
454
|
+
return new J("", "");
|
|
455
|
+
}
|
|
453
456
|
get isDefaultDatabase() {
|
|
454
457
|
return "(default)" === this.database;
|
|
455
458
|
}
|
|
@@ -675,9 +678,21 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
675
678
|
static fromName(t) {
|
|
676
679
|
return new et(Z.fromString(t).popFirst(5));
|
|
677
680
|
}
|
|
681
|
+
static empty() {
|
|
682
|
+
return new et(Z.emptyPath());
|
|
683
|
+
}
|
|
684
|
+
get collectionGroup() {
|
|
685
|
+
return this.path.popLast().lastSegment();
|
|
686
|
+
}
|
|
678
687
|
/** Returns true if the document is in the specified collectionId. */ hasCollectionId(t) {
|
|
679
688
|
return this.path.length >= 2 && this.path.get(this.path.length - 2) === t;
|
|
680
689
|
}
|
|
690
|
+
/** Returns the collection group (i.e. the name of the parent collection) for this key. */ getCollectionGroup() {
|
|
691
|
+
return this.path.get(this.path.length - 2);
|
|
692
|
+
}
|
|
693
|
+
/** Returns the fully qualified path to the parent collection. */ getCollectionPath() {
|
|
694
|
+
return this.path.popLast();
|
|
695
|
+
}
|
|
681
696
|
isEqual(t) {
|
|
682
697
|
return null !== t && 0 === Z.comparator(this.path, t.path);
|
|
683
698
|
}
|
|
@@ -1470,6 +1485,8 @@ class Rt {
|
|
|
1470
1485
|
return new Rt(n);
|
|
1471
1486
|
}
|
|
1472
1487
|
static fromUint8Array(t) {
|
|
1488
|
+
// TODO(indexing); Remove the copy of the byte string here as this method
|
|
1489
|
+
// is frequently called during indexing.
|
|
1473
1490
|
const n =
|
|
1474
1491
|
/**
|
|
1475
1492
|
* Helper function to convert an Uint8array to a binary string.
|
|
@@ -1657,8 +1674,33 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1657
1674
|
* See the License for the specific language governing permissions and
|
|
1658
1675
|
* limitations under the License.
|
|
1659
1676
|
*/
|
|
1660
|
-
/** Extracts the backend's type order for the provided value. */
|
|
1661
|
-
|
|
1677
|
+
/** Extracts the backend's type order for the provided value. */
|
|
1678
|
+
function xt(t) {
|
|
1679
|
+
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 */ :
|
|
1680
|
+
/** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */
|
|
1681
|
+
function(t) {
|
|
1682
|
+
return "__max__" === (((t.mapValue || {}).fields || {}).__type__ || {}).stringValue;
|
|
1683
|
+
}
|
|
1684
|
+
/**
|
|
1685
|
+
* @license
|
|
1686
|
+
* Copyright 2017 Google LLC
|
|
1687
|
+
*
|
|
1688
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1689
|
+
* you may not use this file except in compliance with the License.
|
|
1690
|
+
* You may obtain a copy of the License at
|
|
1691
|
+
*
|
|
1692
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1693
|
+
*
|
|
1694
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1695
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1696
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1697
|
+
* See the License for the specific language governing permissions and
|
|
1698
|
+
* limitations under the License.
|
|
1699
|
+
*/
|
|
1700
|
+
/**
|
|
1701
|
+
* An ObjectValue represents a MapValue in the Firestore Proto and offers the
|
|
1702
|
+
* ability to add and remove fields (via the ObjectValueBuilder).
|
|
1703
|
+
*/ (t) ? 9 /* ArrayValue */ : 10 /* ObjectValue */ : v();
|
|
1662
1704
|
}
|
|
1663
1705
|
|
|
1664
1706
|
/** Tests `left` and `right` for equality based on the backend semantics. */ function qt(t, n) {
|
|
@@ -1667,6 +1709,7 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1667
1709
|
if (e !== xt(n)) return !1;
|
|
1668
1710
|
switch (e) {
|
|
1669
1711
|
case 0 /* NullValue */ :
|
|
1712
|
+
case 9007199254740991 /* MaxValue */ :
|
|
1670
1713
|
return !0;
|
|
1671
1714
|
|
|
1672
1715
|
case 1 /* BooleanValue */ :
|
|
@@ -1737,6 +1780,7 @@ function Ct(t, n) {
|
|
|
1737
1780
|
if (e !== r) return _t(e, r);
|
|
1738
1781
|
switch (e) {
|
|
1739
1782
|
case 0 /* NullValue */ :
|
|
1783
|
+
case 9007199254740991 /* MaxValue */ :
|
|
1740
1784
|
return 0;
|
|
1741
1785
|
|
|
1742
1786
|
case 1 /* BooleanValue */ :
|
|
@@ -1870,31 +1914,12 @@ function kt(t, n) {
|
|
|
1870
1914
|
return Object.assign({}, t);
|
|
1871
1915
|
}
|
|
1872
1916
|
|
|
1873
|
-
|
|
1874
|
-
* @license
|
|
1875
|
-
* Copyright 2017 Google LLC
|
|
1876
|
-
*
|
|
1877
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1878
|
-
* you may not use this file except in compliance with the License.
|
|
1879
|
-
* You may obtain a copy of the License at
|
|
1880
|
-
*
|
|
1881
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1882
|
-
*
|
|
1883
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1884
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1885
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1886
|
-
* See the License for the specific language governing permissions and
|
|
1887
|
-
* limitations under the License.
|
|
1888
|
-
*/
|
|
1889
|
-
/**
|
|
1890
|
-
* An ObjectValue represents a MapValue in the Firestore Proto and offers the
|
|
1891
|
-
* ability to add and remove fields (via the ObjectValueBuilder).
|
|
1892
|
-
*/ class Qt {
|
|
1917
|
+
class Gt {
|
|
1893
1918
|
constructor(t) {
|
|
1894
1919
|
this.value = t;
|
|
1895
1920
|
}
|
|
1896
1921
|
static empty() {
|
|
1897
|
-
return new
|
|
1922
|
+
return new Gt({
|
|
1898
1923
|
mapValue: {}
|
|
1899
1924
|
});
|
|
1900
1925
|
}
|
|
@@ -1975,7 +2000,7 @@ function kt(t, n) {
|
|
|
1975
2000
|
for (const n of e) delete t[n];
|
|
1976
2001
|
}
|
|
1977
2002
|
clone() {
|
|
1978
|
-
return new
|
|
2003
|
+
return new Gt(zt(this.value));
|
|
1979
2004
|
}
|
|
1980
2005
|
}
|
|
1981
2006
|
|
|
@@ -2004,31 +2029,32 @@ function kt(t, n) {
|
|
|
2004
2029
|
* not transition to one of these states even after all mutations have been
|
|
2005
2030
|
* applied, `isValidDocument()` returns false and the document should be removed
|
|
2006
2031
|
* from all views.
|
|
2007
|
-
*/ class
|
|
2008
|
-
constructor(t, n, e, r, s) {
|
|
2009
|
-
this.key = t, this.documentType = n, this.version = e, this.
|
|
2032
|
+
*/ class Qt {
|
|
2033
|
+
constructor(t, n, e, r, s, i) {
|
|
2034
|
+
this.key = t, this.documentType = n, this.version = e, this.readTime = r, this.data = s,
|
|
2035
|
+
this.documentState = i;
|
|
2010
2036
|
}
|
|
2011
2037
|
/**
|
|
2012
2038
|
* Creates a document with no known version or data, but which can serve as
|
|
2013
2039
|
* base document for mutations.
|
|
2014
2040
|
*/ static newInvalidDocument(t) {
|
|
2015
|
-
return new
|
|
2041
|
+
return new Qt(t, 0 /* INVALID */ , bt.min(), bt.min(), Gt.empty(), 0 /* SYNCED */);
|
|
2016
2042
|
}
|
|
2017
2043
|
/**
|
|
2018
2044
|
* Creates a new document that is known to exist with the given data at the
|
|
2019
2045
|
* given version.
|
|
2020
2046
|
*/ static newFoundDocument(t, n, e) {
|
|
2021
|
-
return new
|
|
2047
|
+
return new Qt(t, 1 /* FOUND_DOCUMENT */ , n, bt.min(), e, 0 /* SYNCED */);
|
|
2022
2048
|
}
|
|
2023
2049
|
/** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, n) {
|
|
2024
|
-
return new
|
|
2050
|
+
return new Qt(t, 2 /* NO_DOCUMENT */ , n, bt.min(), Gt.empty(), 0 /* SYNCED */);
|
|
2025
2051
|
}
|
|
2026
2052
|
/**
|
|
2027
2053
|
* Creates a new document that is known to exist at the given version but
|
|
2028
2054
|
* whose data is not known (e.g. a document that was updated without a known
|
|
2029
2055
|
* base document).
|
|
2030
2056
|
*/ static newUnknownDocument(t, n) {
|
|
2031
|
-
return new
|
|
2057
|
+
return new Qt(t, 3 /* UNKNOWN_DOCUMENT */ , n, bt.min(), Gt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
2032
2058
|
}
|
|
2033
2059
|
/**
|
|
2034
2060
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -2041,7 +2067,7 @@ function kt(t, n) {
|
|
|
2041
2067
|
* Changes the document type to indicate that it doesn't exist at the given
|
|
2042
2068
|
* version.
|
|
2043
2069
|
*/ convertToNoDocument(t) {
|
|
2044
|
-
return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data =
|
|
2070
|
+
return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = Gt.empty(),
|
|
2045
2071
|
this.documentState = 0 /* SYNCED */ , this;
|
|
2046
2072
|
}
|
|
2047
2073
|
/**
|
|
@@ -2049,7 +2075,7 @@ function kt(t, n) {
|
|
|
2049
2075
|
* that its data is not known (e.g. a document that was updated without a known
|
|
2050
2076
|
* base document).
|
|
2051
2077
|
*/ convertToUnknownDocument(t) {
|
|
2052
|
-
return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data =
|
|
2078
|
+
return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = Gt.empty(),
|
|
2053
2079
|
this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
|
|
2054
2080
|
}
|
|
2055
2081
|
setHasCommittedMutations() {
|
|
@@ -2058,6 +2084,9 @@ function kt(t, n) {
|
|
|
2058
2084
|
setHasLocalMutations() {
|
|
2059
2085
|
return this.documentState = 1 /* HAS_LOCAL_MUTATIONS */ , this;
|
|
2060
2086
|
}
|
|
2087
|
+
setReadTime(t) {
|
|
2088
|
+
return this.readTime = t, this;
|
|
2089
|
+
}
|
|
2061
2090
|
get hasLocalMutations() {
|
|
2062
2091
|
return 1 /* HAS_LOCAL_MUTATIONS */ === this.documentState;
|
|
2063
2092
|
}
|
|
@@ -2080,10 +2109,10 @@ function kt(t, n) {
|
|
|
2080
2109
|
return 3 /* UNKNOWN_DOCUMENT */ === this.documentType;
|
|
2081
2110
|
}
|
|
2082
2111
|
isEqual(t) {
|
|
2083
|
-
return t instanceof
|
|
2112
|
+
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);
|
|
2084
2113
|
}
|
|
2085
2114
|
mutableCopy() {
|
|
2086
|
-
return new
|
|
2115
|
+
return new Qt(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState);
|
|
2087
2116
|
}
|
|
2088
2117
|
toString() {
|
|
2089
2118
|
return `Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`;
|
|
@@ -2264,7 +2293,7 @@ function Zt(t, n) {
|
|
|
2264
2293
|
* just after the provided values.
|
|
2265
2294
|
*/ class sn {
|
|
2266
2295
|
constructor(t, n) {
|
|
2267
|
-
this.position = t, this.
|
|
2296
|
+
this.position = t, this.inclusive = n;
|
|
2268
2297
|
}
|
|
2269
2298
|
}
|
|
2270
2299
|
|
|
@@ -2283,7 +2312,7 @@ function un(t, n) {
|
|
|
2283
2312
|
function cn(t, n) {
|
|
2284
2313
|
if (null === t) return null === n;
|
|
2285
2314
|
if (null === n) return !1;
|
|
2286
|
-
if (t.
|
|
2315
|
+
if (t.inclusive !== n.inclusive || t.position.length !== n.position.length) return !1;
|
|
2287
2316
|
for (let e = 0; e < t.position.length; e++) {
|
|
2288
2317
|
if (!qt(t.position[e], n.position[e])) return !1;
|
|
2289
2318
|
}
|
|
@@ -2389,7 +2418,7 @@ function dn(t) {
|
|
|
2389
2418
|
t.push(new on(e.field, n));
|
|
2390
2419
|
}
|
|
2391
2420
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
2392
|
-
const e = n.endAt ? new sn(n.endAt.position, !n.endAt.
|
|
2421
|
+
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;
|
|
2393
2422
|
// Now return as a LimitType.First query.
|
|
2394
2423
|
n.S = Yt(n.path, n.collectionGroup, t, n.filters, n.limit, e, r);
|
|
2395
2424
|
}
|
|
@@ -2762,7 +2791,7 @@ function Ln(t, n) {
|
|
|
2762
2791
|
function kn(t, n) {
|
|
2763
2792
|
const e = function(t) {
|
|
2764
2793
|
const n = Z.fromString(t);
|
|
2765
|
-
return b(
|
|
2794
|
+
return b(Kn(n)), n;
|
|
2766
2795
|
}(n);
|
|
2767
2796
|
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);
|
|
2768
2797
|
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);
|
|
@@ -2788,16 +2817,16 @@ function Mn(t, n, e) {
|
|
|
2788
2817
|
function Bn(t, n) {
|
|
2789
2818
|
return "found" in n ? function(t, n) {
|
|
2790
2819
|
b(!!n.found), n.found.name, n.found.updateTime;
|
|
2791
|
-
const e = kn(t, n.found.name), r = On(n.found.updateTime), s = new
|
|
2820
|
+
const e = kn(t, n.found.name), r = On(n.found.updateTime), s = new Gt({
|
|
2792
2821
|
mapValue: {
|
|
2793
2822
|
fields: n.found.fields
|
|
2794
2823
|
}
|
|
2795
2824
|
});
|
|
2796
|
-
return
|
|
2825
|
+
return Qt.newFoundDocument(e, r, s);
|
|
2797
2826
|
}(t, n) : "missing" in n ? function(t, n) {
|
|
2798
2827
|
b(!!n.missing), b(!!n.readTime);
|
|
2799
2828
|
const e = kn(t, n.missing), r = On(n.readTime);
|
|
2800
|
-
return
|
|
2829
|
+
return Qt.newNoDocument(e, r);
|
|
2801
2830
|
}(t, n) : v();
|
|
2802
2831
|
}
|
|
2803
2832
|
|
|
@@ -2809,7 +2838,7 @@ function zn(t, n) {
|
|
|
2809
2838
|
delete: Ln(t, n.key)
|
|
2810
2839
|
}; else if (n instanceof Pn) e = {
|
|
2811
2840
|
update: Mn(t, n.key, n.data),
|
|
2812
|
-
updateMask:
|
|
2841
|
+
updateMask: Hn(n.fieldMask)
|
|
2813
2842
|
}; else {
|
|
2814
2843
|
if (!(n instanceof Nn)) return v();
|
|
2815
2844
|
e = {
|
|
@@ -2848,7 +2877,7 @@ function zn(t, n) {
|
|
|
2848
2877
|
}(t, n.precondition)), e;
|
|
2849
2878
|
}
|
|
2850
2879
|
|
|
2851
|
-
function
|
|
2880
|
+
function Gn(t, n) {
|
|
2852
2881
|
// Dissect the path into parent, collectionId, and optional key filter.
|
|
2853
2882
|
const e = {
|
|
2854
2883
|
structuredQuery: {}
|
|
@@ -2867,34 +2896,34 @@ function Qn(t, n) {
|
|
|
2867
2896
|
if ("==" /* EQUAL */ === t.op) {
|
|
2868
2897
|
if (Mt(t.value)) return {
|
|
2869
2898
|
unaryFilter: {
|
|
2870
|
-
field:
|
|
2899
|
+
field: Yn(t.field),
|
|
2871
2900
|
op: "IS_NAN"
|
|
2872
2901
|
}
|
|
2873
2902
|
};
|
|
2874
2903
|
if (jt(t.value)) return {
|
|
2875
2904
|
unaryFilter: {
|
|
2876
|
-
field:
|
|
2905
|
+
field: Yn(t.field),
|
|
2877
2906
|
op: "IS_NULL"
|
|
2878
2907
|
}
|
|
2879
2908
|
};
|
|
2880
2909
|
} else if ("!=" /* NOT_EQUAL */ === t.op) {
|
|
2881
2910
|
if (Mt(t.value)) return {
|
|
2882
2911
|
unaryFilter: {
|
|
2883
|
-
field:
|
|
2912
|
+
field: Yn(t.field),
|
|
2884
2913
|
op: "IS_NOT_NAN"
|
|
2885
2914
|
}
|
|
2886
2915
|
};
|
|
2887
2916
|
if (jt(t.value)) return {
|
|
2888
2917
|
unaryFilter: {
|
|
2889
|
-
field:
|
|
2918
|
+
field: Yn(t.field),
|
|
2890
2919
|
op: "IS_NOT_NULL"
|
|
2891
2920
|
}
|
|
2892
2921
|
};
|
|
2893
2922
|
}
|
|
2894
2923
|
return {
|
|
2895
2924
|
fieldFilter: {
|
|
2896
|
-
field:
|
|
2897
|
-
op:
|
|
2925
|
+
field: Yn(t.field),
|
|
2926
|
+
op: Wn(t.op),
|
|
2898
2927
|
value: t.value
|
|
2899
2928
|
}
|
|
2900
2929
|
};
|
|
@@ -2914,8 +2943,8 @@ function Qn(t, n) {
|
|
|
2914
2943
|
// visible for testing
|
|
2915
2944
|
function(t) {
|
|
2916
2945
|
return {
|
|
2917
|
-
field:
|
|
2918
|
-
direction:
|
|
2946
|
+
field: Yn(t.field),
|
|
2947
|
+
direction: Qn(t.dir)
|
|
2919
2948
|
};
|
|
2920
2949
|
}(t)));
|
|
2921
2950
|
}(n.orderBy);
|
|
@@ -2925,41 +2954,43 @@ function Qn(t, n) {
|
|
|
2925
2954
|
value: n
|
|
2926
2955
|
};
|
|
2927
2956
|
}(t, n.limit);
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2957
|
+
var u;
|
|
2958
|
+
return null !== o && (e.structuredQuery.limit = o), n.startAt && (e.structuredQuery.startAt = {
|
|
2959
|
+
before: (u = n.startAt).inclusive,
|
|
2960
|
+
values: u.position
|
|
2961
|
+
}), n.endAt && (e.structuredQuery.endAt = function(t) {
|
|
2962
|
+
return {
|
|
2963
|
+
before: !t.inclusive,
|
|
2964
|
+
values: t.position
|
|
2965
|
+
};
|
|
2966
|
+
}
|
|
2967
|
+
// visible for testing
|
|
2968
|
+
(n.endAt)), e;
|
|
2937
2969
|
}
|
|
2938
2970
|
|
|
2939
|
-
|
|
2940
|
-
function Wn(t) {
|
|
2971
|
+
function Qn(t) {
|
|
2941
2972
|
return Dn[t];
|
|
2942
2973
|
}
|
|
2943
2974
|
|
|
2944
2975
|
// visible for testing
|
|
2945
|
-
function
|
|
2976
|
+
function Wn(t) {
|
|
2946
2977
|
return $n[t];
|
|
2947
2978
|
}
|
|
2948
2979
|
|
|
2949
|
-
function
|
|
2980
|
+
function Yn(t) {
|
|
2950
2981
|
return {
|
|
2951
2982
|
fieldPath: t.canonicalString()
|
|
2952
2983
|
};
|
|
2953
2984
|
}
|
|
2954
2985
|
|
|
2955
|
-
function
|
|
2986
|
+
function Hn(t) {
|
|
2956
2987
|
const n = [];
|
|
2957
2988
|
return t.fields.forEach((t => n.push(t.canonicalString()))), {
|
|
2958
2989
|
fieldPaths: n
|
|
2959
2990
|
};
|
|
2960
2991
|
}
|
|
2961
2992
|
|
|
2962
|
-
function
|
|
2993
|
+
function Kn(t) {
|
|
2963
2994
|
// Resource names have at least 4 components (project ID, database ID)
|
|
2964
2995
|
return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
|
|
2965
2996
|
}
|
|
@@ -2979,7 +3010,7 @@ function Jn(t) {
|
|
|
2979
3010
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2980
3011
|
* See the License for the specific language governing permissions and
|
|
2981
3012
|
* limitations under the License.
|
|
2982
|
-
*/ function
|
|
3013
|
+
*/ function Jn(t) {
|
|
2983
3014
|
return new Sn(t, /* useProto3Json= */ !0);
|
|
2984
3015
|
}
|
|
2985
3016
|
|
|
@@ -3008,7 +3039,7 @@ function Jn(t) {
|
|
|
3008
3039
|
* base delay. This prevents clients from accidentally synchronizing their
|
|
3009
3040
|
* delays causing spikes of load to the backend.
|
|
3010
3041
|
*/
|
|
3011
|
-
class
|
|
3042
|
+
class Xn {
|
|
3012
3043
|
constructor(
|
|
3013
3044
|
/**
|
|
3014
3045
|
* The AsyncQueue to run backoff operations on.
|
|
@@ -3106,7 +3137,7 @@ class Zn {
|
|
|
3106
3137
|
* An implementation of Datastore that exposes additional state for internal
|
|
3107
3138
|
* consumption.
|
|
3108
3139
|
*/
|
|
3109
|
-
class
|
|
3140
|
+
class Zn extends class {} {
|
|
3110
3141
|
constructor(t, n, e, r) {
|
|
3111
3142
|
super(), this.authCredentials = t, this.appCheckCredentials = n, this.K = e, this.q = r,
|
|
3112
3143
|
this.J = !1;
|
|
@@ -3133,14 +3164,14 @@ class te extends class {} {
|
|
|
3133
3164
|
|
|
3134
3165
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
3135
3166
|
// firestore-exp client.
|
|
3136
|
-
async function
|
|
3167
|
+
async function te(t, n) {
|
|
3137
3168
|
const e = E(t), r = jn(e.q) + "/documents", s = {
|
|
3138
3169
|
writes: n.map((t => zn(e.q, t)))
|
|
3139
3170
|
};
|
|
3140
3171
|
await e.m("Commit", r, s);
|
|
3141
3172
|
}
|
|
3142
3173
|
|
|
3143
|
-
async function
|
|
3174
|
+
async function ne(t, n) {
|
|
3144
3175
|
const e = E(t), r = jn(e.q) + "/documents", s = {
|
|
3145
3176
|
documents: n.map((t => Ln(e.q, t)))
|
|
3146
3177
|
}, i = await e.T("BatchGetDocuments", r, s), o = new Map;
|
|
@@ -3155,16 +3186,16 @@ async function ee(t, n) {
|
|
|
3155
3186
|
})), u;
|
|
3156
3187
|
}
|
|
3157
3188
|
|
|
3158
|
-
async function
|
|
3159
|
-
const e = E(t), r =
|
|
3189
|
+
async function ee(t, n) {
|
|
3190
|
+
const e = E(t), r = Gn(e.q, mn(n));
|
|
3160
3191
|
return (await e.T("RunQuery", r.parent, {
|
|
3161
3192
|
structuredQuery: r.structuredQuery
|
|
3162
3193
|
})).filter((t => !!t.document)).map((t => function(t, n, e) {
|
|
3163
|
-
const r = kn(t, n.name), s = On(n.updateTime), i = new
|
|
3194
|
+
const r = kn(t, n.name), s = On(n.updateTime), i = new Gt({
|
|
3164
3195
|
mapValue: {
|
|
3165
3196
|
fields: n.fields
|
|
3166
3197
|
}
|
|
3167
|
-
}), o =
|
|
3198
|
+
}), o = Qt.newFoundDocument(r, s, i);
|
|
3168
3199
|
return e && o.setHasCommittedMutations(), e ? o.setHasCommittedMutations() : o;
|
|
3169
3200
|
}(e.q, t.document, void 0)));
|
|
3170
3201
|
}
|
|
@@ -3184,7 +3215,7 @@ async function re(t, n) {
|
|
|
3184
3215
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3185
3216
|
* See the License for the specific language governing permissions and
|
|
3186
3217
|
* limitations under the License.
|
|
3187
|
-
*/ const
|
|
3218
|
+
*/ const re = new Map;
|
|
3188
3219
|
|
|
3189
3220
|
/**
|
|
3190
3221
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -3195,17 +3226,17 @@ async function re(t, n) {
|
|
|
3195
3226
|
* instance. Callers must invoke removeComponents() when the Firestore
|
|
3196
3227
|
* instance is terminated.
|
|
3197
3228
|
*/
|
|
3198
|
-
function
|
|
3229
|
+
function se(t) {
|
|
3199
3230
|
if (t._terminated) throw new U(F, "The client has already been terminated.");
|
|
3200
|
-
if (!
|
|
3231
|
+
if (!re.has(t)) {
|
|
3201
3232
|
p("ComponentProvider", "Initializing Datastore");
|
|
3202
3233
|
const i = function(t) {
|
|
3203
3234
|
return new mt(t, fetch.bind(null));
|
|
3204
3235
|
}((n = t._databaseId, e = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
|
|
3205
|
-
new K(n, e, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o =
|
|
3206
|
-
return new
|
|
3236
|
+
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) {
|
|
3237
|
+
return new Zn(t, n, e, r);
|
|
3207
3238
|
}(t._authCredentials, t._appCheckCredentials, i, o);
|
|
3208
|
-
|
|
3239
|
+
re.set(t, u);
|
|
3209
3240
|
}
|
|
3210
3241
|
var n, e, r, s;
|
|
3211
3242
|
/**
|
|
@@ -3223,7 +3254,7 @@ function ie(t) {
|
|
|
3223
3254
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3224
3255
|
* See the License for the specific language governing permissions and
|
|
3225
3256
|
* limitations under the License.
|
|
3226
|
-
*/ return
|
|
3257
|
+
*/ return re.get(t);
|
|
3227
3258
|
}
|
|
3228
3259
|
|
|
3229
3260
|
/**
|
|
@@ -3235,7 +3266,7 @@ function ie(t) {
|
|
|
3235
3266
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
3236
3267
|
* defaults can be supplied and the value can be checked for equality.
|
|
3237
3268
|
*/
|
|
3238
|
-
class
|
|
3269
|
+
class ie {
|
|
3239
3270
|
constructor(t) {
|
|
3240
3271
|
var n;
|
|
3241
3272
|
if (void 0 === t.host) {
|
|
@@ -3277,14 +3308,14 @@ class oe {
|
|
|
3277
3308
|
* The Cloud Firestore service interface.
|
|
3278
3309
|
*
|
|
3279
3310
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
3280
|
-
*/ class
|
|
3311
|
+
*/ class oe {
|
|
3281
3312
|
/** @hideconstructor */
|
|
3282
3313
|
constructor(t, n, e) {
|
|
3283
3314
|
this._authCredentials = n, this._appCheckCredentials = e,
|
|
3284
3315
|
/**
|
|
3285
3316
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
3286
3317
|
*/
|
|
3287
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
3318
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new ie({}),
|
|
3288
3319
|
this._settingsFrozen = !1, t instanceof J ? this._databaseId = t : (this._app = t,
|
|
3289
3320
|
this._databaseId = function(t) {
|
|
3290
3321
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(R, '"projectId" not provided in firebase.initializeApp.');
|
|
@@ -3317,7 +3348,7 @@ class oe {
|
|
|
3317
3348
|
}
|
|
3318
3349
|
_setSettings(t) {
|
|
3319
3350
|
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.");
|
|
3320
|
-
this._settings = new
|
|
3351
|
+
this._settings = new ie(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
3321
3352
|
if (!t) return new B;
|
|
3322
3353
|
switch (t.type) {
|
|
3323
3354
|
case "gapi":
|
|
@@ -3358,13 +3389,13 @@ class oe {
|
|
|
3358
3389
|
* Only ever called once.
|
|
3359
3390
|
*/ _terminate() {
|
|
3360
3391
|
return function(t) {
|
|
3361
|
-
const n =
|
|
3362
|
-
n && (p("ComponentProvider", "Removing Datastore"),
|
|
3392
|
+
const n = re.get(t);
|
|
3393
|
+
n && (p("ComponentProvider", "Removing Datastore"), re.delete(t), n.terminate());
|
|
3363
3394
|
}(this), Promise.resolve();
|
|
3364
3395
|
}
|
|
3365
3396
|
}
|
|
3366
3397
|
|
|
3367
|
-
function
|
|
3398
|
+
function ue(t, n) {
|
|
3368
3399
|
const e = _getProvider(t, "firestore/lite");
|
|
3369
3400
|
if (e.isInitialized()) throw new U(F, "Firestore can only be initialized once per app.");
|
|
3370
3401
|
return e.initialize({
|
|
@@ -3380,7 +3411,7 @@ function ce(t, n) {
|
|
|
3380
3411
|
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
|
|
3381
3412
|
* instance is associated with.
|
|
3382
3413
|
* @returns The `Firestore` instance of the provided app.
|
|
3383
|
-
*/ function
|
|
3414
|
+
*/ function ce(n = t()) {
|
|
3384
3415
|
return _getProvider(n, "firestore/lite").getImmediate();
|
|
3385
3416
|
}
|
|
3386
3417
|
|
|
@@ -3396,9 +3427,9 @@ function ce(t, n) {
|
|
|
3396
3427
|
* @param port - the emulator port (ex: 9000).
|
|
3397
3428
|
* @param options.mockUserToken - the mock auth token to use for unit testing
|
|
3398
3429
|
* Security Rules.
|
|
3399
|
-
*/ function
|
|
3430
|
+
*/ function ae(t, n, e, r = {}) {
|
|
3400
3431
|
var s;
|
|
3401
|
-
const i = (t = ut(t,
|
|
3432
|
+
const i = (t = ut(t, oe))._getSettings();
|
|
3402
3433
|
if ("firestore.googleapis.com" !== i.host && i.host !== n && _("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
3403
3434
|
t._setSettings(Object.assign(Object.assign({}, i), {
|
|
3404
3435
|
host: `${n}:${e}`,
|
|
@@ -3436,8 +3467,8 @@ function ce(t, n) {
|
|
|
3436
3467
|
* @param firestore - The `Firestore` instance to terminate.
|
|
3437
3468
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
3438
3469
|
* terminated.
|
|
3439
|
-
*/ function
|
|
3440
|
-
return t = ut(t,
|
|
3470
|
+
*/ function he(t) {
|
|
3471
|
+
return t = ut(t, oe), n(t.app, "firestore/lite"), t._delete();
|
|
3441
3472
|
}
|
|
3442
3473
|
|
|
3443
3474
|
/**
|
|
@@ -3477,7 +3508,7 @@ function ce(t, n) {
|
|
|
3477
3508
|
* and can be used to write, read, or listen to the location. The document at
|
|
3478
3509
|
* the referenced location may or may not exist.
|
|
3479
3510
|
*/
|
|
3480
|
-
class
|
|
3511
|
+
class le {
|
|
3481
3512
|
/** @hideconstructor */
|
|
3482
3513
|
constructor(t,
|
|
3483
3514
|
/**
|
|
@@ -3505,17 +3536,17 @@ class fe {
|
|
|
3505
3536
|
/**
|
|
3506
3537
|
* The collection this `DocumentReference` belongs to.
|
|
3507
3538
|
*/ get parent() {
|
|
3508
|
-
return new
|
|
3539
|
+
return new de(this.firestore, this.converter, this._key.path.popLast());
|
|
3509
3540
|
}
|
|
3510
3541
|
withConverter(t) {
|
|
3511
|
-
return new
|
|
3542
|
+
return new le(this.firestore, t, this._key);
|
|
3512
3543
|
}
|
|
3513
3544
|
}
|
|
3514
3545
|
|
|
3515
3546
|
/**
|
|
3516
3547
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
3517
3548
|
* construct refined `Query` objects by adding filters and ordering.
|
|
3518
|
-
*/ class
|
|
3549
|
+
*/ class fe {
|
|
3519
3550
|
// This is the lite version of the Query class in the main SDK.
|
|
3520
3551
|
/** @hideconstructor protected */
|
|
3521
3552
|
constructor(t,
|
|
@@ -3528,14 +3559,14 @@ class fe {
|
|
|
3528
3559
|
this.type = "query", this.firestore = t;
|
|
3529
3560
|
}
|
|
3530
3561
|
withConverter(t) {
|
|
3531
|
-
return new
|
|
3562
|
+
return new fe(this.firestore, t, this._query);
|
|
3532
3563
|
}
|
|
3533
3564
|
}
|
|
3534
3565
|
|
|
3535
3566
|
/**
|
|
3536
3567
|
* A `CollectionReference` object can be used for adding documents, getting
|
|
3537
3568
|
* document references, and querying for documents (using {@link query}).
|
|
3538
|
-
*/ class
|
|
3569
|
+
*/ class de extends fe {
|
|
3539
3570
|
/** @hideconstructor */
|
|
3540
3571
|
constructor(t, n, e) {
|
|
3541
3572
|
super(t, n, new an(e)), this._path = e,
|
|
@@ -3556,23 +3587,23 @@ class fe {
|
|
|
3556
3587
|
* subcollection. If this isn't a subcollection, the reference is null.
|
|
3557
3588
|
*/ get parent() {
|
|
3558
3589
|
const t = this._path.popLast();
|
|
3559
|
-
return t.isEmpty() ? null : new
|
|
3590
|
+
return t.isEmpty() ? null : new le(this.firestore,
|
|
3560
3591
|
/* converter= */ null, new et(t));
|
|
3561
3592
|
}
|
|
3562
3593
|
withConverter(t) {
|
|
3563
|
-
return new
|
|
3594
|
+
return new de(this.firestore, t, this._path);
|
|
3564
3595
|
}
|
|
3565
3596
|
}
|
|
3566
3597
|
|
|
3567
|
-
function
|
|
3568
|
-
if (t = l(t), rt("collection", "path", n), t instanceof
|
|
3598
|
+
function we(t, n, ...e) {
|
|
3599
|
+
if (t = l(t), rt("collection", "path", n), t instanceof oe) {
|
|
3569
3600
|
const r = Z.fromString(n, ...e);
|
|
3570
|
-
return it(r), new
|
|
3601
|
+
return it(r), new de(t, /* converter= */ null, r);
|
|
3571
3602
|
}
|
|
3572
3603
|
{
|
|
3573
|
-
if (!(t instanceof
|
|
3604
|
+
if (!(t instanceof le || t instanceof de)) throw new U(R, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3574
3605
|
const r = t._path.child(Z.fromString(n, ...e));
|
|
3575
|
-
return it(r), new
|
|
3606
|
+
return it(r), new de(t.firestore,
|
|
3576
3607
|
/* converter= */ null, r);
|
|
3577
3608
|
}
|
|
3578
3609
|
}
|
|
@@ -3589,9 +3620,9 @@ function me(t, n, ...e) {
|
|
|
3589
3620
|
* collection or subcollection with this ID as the last segment of its path
|
|
3590
3621
|
* will be included. Cannot contain a slash.
|
|
3591
3622
|
* @returns The created `Query`.
|
|
3592
|
-
*/ function
|
|
3593
|
-
if (t = ut(t,
|
|
3594
|
-
return new
|
|
3623
|
+
*/ function me(t, n) {
|
|
3624
|
+
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 '/'.`);
|
|
3625
|
+
return new fe(t,
|
|
3595
3626
|
/* converter= */ null,
|
|
3596
3627
|
/**
|
|
3597
3628
|
* Creates a new Query for a collection group query that matches all documents
|
|
@@ -3602,19 +3633,19 @@ function me(t, n, ...e) {
|
|
|
3602
3633
|
}(n));
|
|
3603
3634
|
}
|
|
3604
3635
|
|
|
3605
|
-
function
|
|
3636
|
+
function pe(t, n, ...e) {
|
|
3606
3637
|
if (t = l(t),
|
|
3607
3638
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
3608
3639
|
// 'undefined' and 'null'.
|
|
3609
|
-
1 === arguments.length && (n = yt.R()), rt("doc", "path", n), t instanceof
|
|
3640
|
+
1 === arguments.length && (n = yt.R()), rt("doc", "path", n), t instanceof oe) {
|
|
3610
3641
|
const r = Z.fromString(n, ...e);
|
|
3611
|
-
return st(r), new
|
|
3642
|
+
return st(r), new le(t,
|
|
3612
3643
|
/* converter= */ null, new et(r));
|
|
3613
3644
|
}
|
|
3614
3645
|
{
|
|
3615
|
-
if (!(t instanceof
|
|
3646
|
+
if (!(t instanceof le || t instanceof de)) throw new U(R, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3616
3647
|
const r = t._path.child(Z.fromString(n, ...e));
|
|
3617
|
-
return st(r), new
|
|
3648
|
+
return st(r), new le(t.firestore, t instanceof de ? t.converter : null, new et(r));
|
|
3618
3649
|
}
|
|
3619
3650
|
}
|
|
3620
3651
|
|
|
@@ -3625,8 +3656,8 @@ function ye(t, n, ...e) {
|
|
|
3625
3656
|
* @param right - A reference to compare.
|
|
3626
3657
|
* @returns true if the references point to the same location in the same
|
|
3627
3658
|
* Firestore database.
|
|
3628
|
-
*/ function
|
|
3629
|
-
return t = l(t), n = l(n), (t instanceof
|
|
3659
|
+
*/ function ye(t, n) {
|
|
3660
|
+
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);
|
|
3630
3661
|
}
|
|
3631
3662
|
|
|
3632
3663
|
/**
|
|
@@ -3637,8 +3668,8 @@ function ye(t, n, ...e) {
|
|
|
3637
3668
|
* @param right - A `Query` to compare.
|
|
3638
3669
|
* @returns true if the references point to the same location in the same
|
|
3639
3670
|
* Firestore database.
|
|
3640
|
-
*/ function
|
|
3641
|
-
return t = l(t), n = l(n), t instanceof
|
|
3671
|
+
*/ function _e(t, n) {
|
|
3672
|
+
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);
|
|
3642
3673
|
}
|
|
3643
3674
|
|
|
3644
3675
|
/**
|
|
@@ -3664,7 +3695,7 @@ function ye(t, n, ...e) {
|
|
|
3664
3695
|
*
|
|
3665
3696
|
* Create a `FieldPath` by providing field names. If more than one field
|
|
3666
3697
|
* name is provided, the path will point to a nested field in a document.
|
|
3667
|
-
*/ class
|
|
3698
|
+
*/ class ge {
|
|
3668
3699
|
/**
|
|
3669
3700
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
3670
3701
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -3688,8 +3719,8 @@ function ye(t, n, ...e) {
|
|
|
3688
3719
|
/**
|
|
3689
3720
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
3690
3721
|
* It can be used in queries to sort or filter by the document ID.
|
|
3691
|
-
*/ function
|
|
3692
|
-
return new
|
|
3722
|
+
*/ function ve() {
|
|
3723
|
+
return new ge("__name__");
|
|
3693
3724
|
}
|
|
3694
3725
|
|
|
3695
3726
|
/**
|
|
@@ -3710,7 +3741,7 @@ function ye(t, n, ...e) {
|
|
|
3710
3741
|
*/
|
|
3711
3742
|
/**
|
|
3712
3743
|
* An immutable object representing an array of bytes.
|
|
3713
|
-
*/ class
|
|
3744
|
+
*/ class be {
|
|
3714
3745
|
/** @hideconstructor */
|
|
3715
3746
|
constructor(t) {
|
|
3716
3747
|
this._byteString = t;
|
|
@@ -3722,7 +3753,7 @@ function ye(t, n, ...e) {
|
|
|
3722
3753
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
3723
3754
|
*/ static fromBase64String(t) {
|
|
3724
3755
|
try {
|
|
3725
|
-
return new
|
|
3756
|
+
return new be(Rt.fromBase64String(t));
|
|
3726
3757
|
} catch (t) {
|
|
3727
3758
|
throw new U(R, "Failed to construct data from Base64 string: " + t);
|
|
3728
3759
|
}
|
|
@@ -3732,7 +3763,7 @@ function ye(t, n, ...e) {
|
|
|
3732
3763
|
*
|
|
3733
3764
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
3734
3765
|
*/ static fromUint8Array(t) {
|
|
3735
|
-
return new
|
|
3766
|
+
return new be(Rt.fromUint8Array(t));
|
|
3736
3767
|
}
|
|
3737
3768
|
/**
|
|
3738
3769
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -3784,7 +3815,7 @@ function ye(t, n, ...e) {
|
|
|
3784
3815
|
/**
|
|
3785
3816
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
3786
3817
|
* or `update()`.
|
|
3787
|
-
*/ class
|
|
3818
|
+
*/ class Ee {
|
|
3788
3819
|
/**
|
|
3789
3820
|
* @param _methodName - The public API endpoint that returns this class.
|
|
3790
3821
|
* @hideconstructor
|
|
@@ -3816,7 +3847,7 @@ function ye(t, n, ...e) {
|
|
|
3816
3847
|
*
|
|
3817
3848
|
* Latitude values are in the range of [-90, 90].
|
|
3818
3849
|
* Longitude values are in the range of [-180, 180].
|
|
3819
|
-
*/ class
|
|
3850
|
+
*/ class Te {
|
|
3820
3851
|
/**
|
|
3821
3852
|
* Creates a new immutable `GeoPoint` object with the provided latitude and
|
|
3822
3853
|
* longitude values.
|
|
@@ -3875,9 +3906,9 @@ function ye(t, n, ...e) {
|
|
|
3875
3906
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3876
3907
|
* See the License for the specific language governing permissions and
|
|
3877
3908
|
* limitations under the License.
|
|
3878
|
-
*/ const
|
|
3909
|
+
*/ const Ie = /^__.*__$/;
|
|
3879
3910
|
|
|
3880
|
-
/** The result of parsing document data (e.g. for a setData call). */ class
|
|
3911
|
+
/** The result of parsing document data (e.g. for a setData call). */ class Ae {
|
|
3881
3912
|
constructor(t, n, e) {
|
|
3882
3913
|
this.data = t, this.fieldMask = n, this.fieldTransforms = e;
|
|
3883
3914
|
}
|
|
@@ -3886,7 +3917,7 @@ function ye(t, n, ...e) {
|
|
|
3886
3917
|
}
|
|
3887
3918
|
}
|
|
3888
3919
|
|
|
3889
|
-
/** The result of parsing "update" data (i.e. for an updateData call). */ class
|
|
3920
|
+
/** The result of parsing "update" data (i.e. for an updateData call). */ class Re {
|
|
3890
3921
|
constructor(t,
|
|
3891
3922
|
// The fieldMask does not include document transforms.
|
|
3892
3923
|
n, e) {
|
|
@@ -3897,7 +3928,7 @@ function ye(t, n, ...e) {
|
|
|
3897
3928
|
}
|
|
3898
3929
|
}
|
|
3899
3930
|
|
|
3900
|
-
function
|
|
3931
|
+
function Pe(t) {
|
|
3901
3932
|
switch (t) {
|
|
3902
3933
|
case 0 /* Set */ :
|
|
3903
3934
|
// fall through
|
|
@@ -3915,7 +3946,7 @@ function Ve(t) {
|
|
|
3915
3946
|
}
|
|
3916
3947
|
}
|
|
3917
3948
|
|
|
3918
|
-
/** A "context" object passed around while parsing user data. */ class
|
|
3949
|
+
/** A "context" object passed around while parsing user data. */ class Ve {
|
|
3919
3950
|
/**
|
|
3920
3951
|
* Initializes a ParseContext with the given source and path.
|
|
3921
3952
|
*
|
|
@@ -3947,7 +3978,7 @@ function Ve(t) {
|
|
|
3947
3978
|
return this.settings.tt;
|
|
3948
3979
|
}
|
|
3949
3980
|
/** Returns a new context with the specified settings overwritten. */ nt(t) {
|
|
3950
|
-
return new
|
|
3981
|
+
return new Ve(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.q, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
3951
3982
|
}
|
|
3952
3983
|
et(t) {
|
|
3953
3984
|
var n;
|
|
@@ -3974,7 +4005,7 @@ function Ve(t) {
|
|
|
3974
4005
|
});
|
|
3975
4006
|
}
|
|
3976
4007
|
ut(t) {
|
|
3977
|
-
return
|
|
4008
|
+
return Ye(t, this.settings.methodName, this.settings.ct || !1, this.path, this.settings.at);
|
|
3978
4009
|
}
|
|
3979
4010
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
3980
4011
|
return void 0 !== this.fieldMask.find((n => t.isPrefixOf(n))) || void 0 !== this.fieldTransforms.find((n => t.isPrefixOf(n.field)));
|
|
@@ -3986,19 +4017,19 @@ function Ve(t) {
|
|
|
3986
4017
|
}
|
|
3987
4018
|
st(t) {
|
|
3988
4019
|
if (0 === t.length) throw this.ut("Document fields must not be empty");
|
|
3989
|
-
if (
|
|
4020
|
+
if (Pe(this.tt) && Ie.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
|
|
3990
4021
|
}
|
|
3991
4022
|
}
|
|
3992
4023
|
|
|
3993
4024
|
/**
|
|
3994
4025
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
3995
4026
|
* classes.
|
|
3996
|
-
*/ class
|
|
4027
|
+
*/ class Ne {
|
|
3997
4028
|
constructor(t, n, e) {
|
|
3998
|
-
this.databaseId = t, this.ignoreUndefinedProperties = n, this.q = e ||
|
|
4029
|
+
this.databaseId = t, this.ignoreUndefinedProperties = n, this.q = e || Jn(t);
|
|
3999
4030
|
}
|
|
4000
4031
|
/** Creates a new top-level parse context. */ ht(t, n, e, r = !1) {
|
|
4001
|
-
return new
|
|
4032
|
+
return new Ve({
|
|
4002
4033
|
tt: t,
|
|
4003
4034
|
methodName: n,
|
|
4004
4035
|
at: e,
|
|
@@ -4009,29 +4040,29 @@ function Ve(t) {
|
|
|
4009
4040
|
}
|
|
4010
4041
|
}
|
|
4011
4042
|
|
|
4012
|
-
function
|
|
4013
|
-
const n = t._freezeSettings(), e =
|
|
4014
|
-
return new
|
|
4043
|
+
function De(t) {
|
|
4044
|
+
const n = t._freezeSettings(), e = Jn(t._databaseId);
|
|
4045
|
+
return new Ne(t._databaseId, !!n.ignoreUndefinedProperties, e);
|
|
4015
4046
|
}
|
|
4016
4047
|
|
|
4017
|
-
/** Parse document data from a set() call. */ function
|
|
4048
|
+
/** Parse document data from a set() call. */ function $e(t, n, e, r, s, i = {}) {
|
|
4018
4049
|
const o = t.ht(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , n, e, s);
|
|
4019
|
-
|
|
4020
|
-
const u =
|
|
4050
|
+
ze("Data must be an object, but it was:", o, r);
|
|
4051
|
+
const u = Me(r, o);
|
|
4021
4052
|
let c, a;
|
|
4022
4053
|
if (i.merge) c = new It(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
|
|
4023
4054
|
const t = [];
|
|
4024
4055
|
for (const r of i.mergeFields) {
|
|
4025
4056
|
const s = Ge(n, r, e);
|
|
4026
4057
|
if (!o.contains(s)) throw new U(R, `Field '${s}' is specified in your field mask but missing from your input data.`);
|
|
4027
|
-
|
|
4058
|
+
He(t, s) || t.push(s);
|
|
4028
4059
|
}
|
|
4029
4060
|
c = new It(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
|
|
4030
4061
|
} else c = null, a = o.fieldTransforms;
|
|
4031
|
-
return new
|
|
4062
|
+
return new Ae(new Gt(u), c, a);
|
|
4032
4063
|
}
|
|
4033
4064
|
|
|
4034
|
-
class
|
|
4065
|
+
class Se extends Ee {
|
|
4035
4066
|
_toFieldTransform(t) {
|
|
4036
4067
|
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}`);
|
|
4037
4068
|
// No transform to add for a delete, but we need to add it to our
|
|
@@ -4039,7 +4070,7 @@ class Fe extends Te {
|
|
|
4039
4070
|
return t.fieldMask.push(t.path), null;
|
|
4040
4071
|
}
|
|
4041
4072
|
isEqual(t) {
|
|
4042
|
-
return t instanceof
|
|
4073
|
+
return t instanceof Se;
|
|
4043
4074
|
}
|
|
4044
4075
|
}
|
|
4045
4076
|
|
|
@@ -4058,8 +4089,8 @@ class Fe extends Te {
|
|
|
4058
4089
|
* context.
|
|
4059
4090
|
* @param context - The parent context.
|
|
4060
4091
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4061
|
-
*/ function
|
|
4062
|
-
return new
|
|
4092
|
+
*/ function Fe(t, n, e) {
|
|
4093
|
+
return new Ve({
|
|
4063
4094
|
tt: 3 /* Argument */ ,
|
|
4064
4095
|
at: n.settings.at,
|
|
4065
4096
|
methodName: t._methodName,
|
|
@@ -4067,22 +4098,22 @@ class Fe extends Te {
|
|
|
4067
4098
|
}, n.databaseId, n.q, n.ignoreUndefinedProperties);
|
|
4068
4099
|
}
|
|
4069
4100
|
|
|
4070
|
-
class
|
|
4101
|
+
class xe extends Ee {
|
|
4071
4102
|
_toFieldTransform(t) {
|
|
4072
4103
|
return new Tn(t.path, new gn);
|
|
4073
4104
|
}
|
|
4074
4105
|
isEqual(t) {
|
|
4075
|
-
return t instanceof
|
|
4106
|
+
return t instanceof xe;
|
|
4076
4107
|
}
|
|
4077
4108
|
}
|
|
4078
4109
|
|
|
4079
|
-
class
|
|
4110
|
+
class qe extends Ee {
|
|
4080
4111
|
constructor(t, n) {
|
|
4081
4112
|
super(t), this.lt = n;
|
|
4082
4113
|
}
|
|
4083
4114
|
_toFieldTransform(t) {
|
|
4084
|
-
const n =
|
|
4085
|
-
/*array=*/ !0), e = this.lt.map((t =>
|
|
4115
|
+
const n = Fe(this, t,
|
|
4116
|
+
/*array=*/ !0), e = this.lt.map((t => je(t, n))), r = new vn(e);
|
|
4086
4117
|
return new Tn(t.path, r);
|
|
4087
4118
|
}
|
|
4088
4119
|
isEqual(t) {
|
|
@@ -4091,13 +4122,13 @@ class Oe extends Te {
|
|
|
4091
4122
|
}
|
|
4092
4123
|
}
|
|
4093
4124
|
|
|
4094
|
-
class
|
|
4125
|
+
class Oe extends Ee {
|
|
4095
4126
|
constructor(t, n) {
|
|
4096
4127
|
super(t), this.lt = n;
|
|
4097
4128
|
}
|
|
4098
4129
|
_toFieldTransform(t) {
|
|
4099
|
-
const n =
|
|
4100
|
-
/*array=*/ !0), e = this.lt.map((t =>
|
|
4130
|
+
const n = Fe(this, t,
|
|
4131
|
+
/*array=*/ !0), e = this.lt.map((t => je(t, n))), r = new bn(e);
|
|
4101
4132
|
return new Tn(t.path, r);
|
|
4102
4133
|
}
|
|
4103
4134
|
isEqual(t) {
|
|
@@ -4106,7 +4137,7 @@ class Ce extends Te {
|
|
|
4106
4137
|
}
|
|
4107
4138
|
}
|
|
4108
4139
|
|
|
4109
|
-
class
|
|
4140
|
+
class Ce extends Ee {
|
|
4110
4141
|
constructor(t, n) {
|
|
4111
4142
|
super(t), this.ft = n;
|
|
4112
4143
|
}
|
|
@@ -4120,50 +4151,50 @@ class Le extends Te {
|
|
|
4120
4151
|
}
|
|
4121
4152
|
}
|
|
4122
4153
|
|
|
4123
|
-
/** Parse update data from an update() call. */ function
|
|
4154
|
+
/** Parse update data from an update() call. */ function Le(t, n, e, r) {
|
|
4124
4155
|
const s = t.ht(1 /* Update */ , n, e);
|
|
4125
|
-
|
|
4126
|
-
const i = [], o =
|
|
4156
|
+
ze("Data must be an object, but it was:", s, r);
|
|
4157
|
+
const i = [], o = Gt.empty();
|
|
4127
4158
|
Tt(r, ((t, r) => {
|
|
4128
|
-
const u =
|
|
4159
|
+
const u = We(n, t, e);
|
|
4129
4160
|
// For Compat types, we have to "extract" the underlying types before
|
|
4130
4161
|
// performing validation.
|
|
4131
4162
|
r = l(r);
|
|
4132
4163
|
const c = s.it(u);
|
|
4133
|
-
if (r instanceof
|
|
4164
|
+
if (r instanceof Se)
|
|
4134
4165
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4135
4166
|
i.push(u); else {
|
|
4136
|
-
const t =
|
|
4167
|
+
const t = je(r, c);
|
|
4137
4168
|
null != t && (i.push(u), o.set(u, t));
|
|
4138
4169
|
}
|
|
4139
4170
|
}));
|
|
4140
4171
|
const u = new It(i);
|
|
4141
|
-
return new
|
|
4172
|
+
return new Re(o, u, s.fieldTransforms);
|
|
4142
4173
|
}
|
|
4143
4174
|
|
|
4144
|
-
/** Parse update data from a list of field/value arguments. */ function
|
|
4175
|
+
/** Parse update data from a list of field/value arguments. */ function ke(t, n, e, r, s, i) {
|
|
4145
4176
|
const o = t.ht(1 /* Update */ , n, e), u = [ Ge(n, r, e) ], c = [ s ];
|
|
4146
4177
|
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.`);
|
|
4147
4178
|
for (let t = 0; t < i.length; t += 2) u.push(Ge(n, i[t])), c.push(i[t + 1]);
|
|
4148
|
-
const a = [], h =
|
|
4179
|
+
const a = [], h = Gt.empty();
|
|
4149
4180
|
// We iterate in reverse order to pick the last value for a field if the
|
|
4150
4181
|
// user specified the field multiple times.
|
|
4151
|
-
for (let t = u.length - 1; t >= 0; --t) if (!
|
|
4182
|
+
for (let t = u.length - 1; t >= 0; --t) if (!He(a, u[t])) {
|
|
4152
4183
|
const n = u[t];
|
|
4153
4184
|
let e = c[t];
|
|
4154
4185
|
// For Compat types, we have to "extract" the underlying types before
|
|
4155
4186
|
// performing validation.
|
|
4156
4187
|
e = l(e);
|
|
4157
4188
|
const r = o.it(n);
|
|
4158
|
-
if (e instanceof
|
|
4189
|
+
if (e instanceof Se)
|
|
4159
4190
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4160
4191
|
a.push(n); else {
|
|
4161
|
-
const t =
|
|
4192
|
+
const t = je(e, r);
|
|
4162
4193
|
null != t && (a.push(n), h.set(n, t));
|
|
4163
4194
|
}
|
|
4164
4195
|
}
|
|
4165
4196
|
const f = new It(a);
|
|
4166
|
-
return new
|
|
4197
|
+
return new Re(h, f, o.fieldTransforms);
|
|
4167
4198
|
}
|
|
4168
4199
|
|
|
4169
4200
|
/**
|
|
@@ -4172,8 +4203,8 @@ class Le extends Te {
|
|
|
4172
4203
|
*
|
|
4173
4204
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
4174
4205
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
4175
|
-
*/ function
|
|
4176
|
-
return
|
|
4206
|
+
*/ function Ue(t, n, e, r = !1) {
|
|
4207
|
+
return je(e, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , n));
|
|
4177
4208
|
}
|
|
4178
4209
|
|
|
4179
4210
|
/**
|
|
@@ -4184,12 +4215,12 @@ class Le extends Te {
|
|
|
4184
4215
|
* the source of the data being parsed, etc.
|
|
4185
4216
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
4186
4217
|
* that should not be included in the resulting parsed data.
|
|
4187
|
-
*/ function
|
|
4188
|
-
if (
|
|
4218
|
+
*/ function je(t, n) {
|
|
4219
|
+
if (Be(
|
|
4189
4220
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
4190
4221
|
// from firestore-exp.
|
|
4191
|
-
t = l(t))) return
|
|
4192
|
-
if (t instanceof
|
|
4222
|
+
t = l(t))) return ze("Unsupported field value:", n, t), Me(t, n);
|
|
4223
|
+
if (t instanceof Ee)
|
|
4193
4224
|
// FieldValues usually parse into transforms (except deleteField())
|
|
4194
4225
|
// in which case we do not want to include this field in our parsed data
|
|
4195
4226
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -4201,7 +4232,7 @@ class Le extends Te {
|
|
|
4201
4232
|
*/
|
|
4202
4233
|
return function(t, n) {
|
|
4203
4234
|
// Sentinels are only supported with writes, and not within arrays.
|
|
4204
|
-
if (!
|
|
4235
|
+
if (!Pe(n.tt)) throw n.ut(`${t._methodName}() can only be used with update() and set()`);
|
|
4205
4236
|
if (!n.path) throw n.ut(`${t._methodName}() is not currently supported inside arrays`);
|
|
4206
4237
|
const e = t._toFieldTransform(n);
|
|
4207
4238
|
e && n.fieldTransforms.push(e);
|
|
@@ -4231,7 +4262,7 @@ class Le extends Te {
|
|
|
4231
4262
|
const e = [];
|
|
4232
4263
|
let r = 0;
|
|
4233
4264
|
for (const s of t) {
|
|
4234
|
-
let t =
|
|
4265
|
+
let t = je(s, n.ot(r));
|
|
4235
4266
|
null == t && (
|
|
4236
4267
|
// Just include nulls in the array for fields being replaced with a
|
|
4237
4268
|
// sentinel.
|
|
@@ -4272,16 +4303,16 @@ class Le extends Te {
|
|
|
4272
4303
|
timestampValue: Fn(n.q, e)
|
|
4273
4304
|
};
|
|
4274
4305
|
}
|
|
4275
|
-
if (t instanceof
|
|
4306
|
+
if (t instanceof Te) return {
|
|
4276
4307
|
geoPointValue: {
|
|
4277
4308
|
latitude: t.latitude,
|
|
4278
4309
|
longitude: t.longitude
|
|
4279
4310
|
}
|
|
4280
4311
|
};
|
|
4281
|
-
if (t instanceof
|
|
4312
|
+
if (t instanceof be) return {
|
|
4282
4313
|
bytesValue: xn(n.q, t._byteString)
|
|
4283
4314
|
};
|
|
4284
|
-
if (t instanceof
|
|
4315
|
+
if (t instanceof le) {
|
|
4285
4316
|
const e = n.databaseId, r = t.firestore._databaseId;
|
|
4286
4317
|
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}`);
|
|
4287
4318
|
return {
|
|
@@ -4299,13 +4330,13 @@ class Le extends Te {
|
|
|
4299
4330
|
*/ (t, n);
|
|
4300
4331
|
}
|
|
4301
4332
|
|
|
4302
|
-
function
|
|
4333
|
+
function Me(t, n) {
|
|
4303
4334
|
const e = {};
|
|
4304
4335
|
return !function(t) {
|
|
4305
4336
|
for (const n in t) if (Object.prototype.hasOwnProperty.call(t, n)) return !1;
|
|
4306
4337
|
return !0;
|
|
4307
4338
|
}(t) ? Tt(t, ((t, r) => {
|
|
4308
|
-
const s =
|
|
4339
|
+
const s = je(r, n.et(t));
|
|
4309
4340
|
null != s && (e[t] = s);
|
|
4310
4341
|
})) :
|
|
4311
4342
|
// If we encounter an empty object, we explicitly add it to the update
|
|
@@ -4317,12 +4348,12 @@ function Be(t, n) {
|
|
|
4317
4348
|
};
|
|
4318
4349
|
}
|
|
4319
4350
|
|
|
4320
|
-
function
|
|
4321
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof vt || t instanceof
|
|
4351
|
+
function Be(t) {
|
|
4352
|
+
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);
|
|
4322
4353
|
}
|
|
4323
4354
|
|
|
4324
|
-
function
|
|
4325
|
-
if (!
|
|
4355
|
+
function ze(t, n, e) {
|
|
4356
|
+
if (!Be(e) || !function(t) {
|
|
4326
4357
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
4327
4358
|
}(e)) {
|
|
4328
4359
|
const r = ot(e);
|
|
@@ -4336,16 +4367,16 @@ function Qe(t, n, e) {
|
|
|
4336
4367
|
if ((
|
|
4337
4368
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
4338
4369
|
// FieldPath.
|
|
4339
|
-
n = l(n)) instanceof
|
|
4340
|
-
if ("string" == typeof n) return
|
|
4341
|
-
throw
|
|
4370
|
+
n = l(n)) instanceof ge) return n._internalPath;
|
|
4371
|
+
if ("string" == typeof n) return We(t, n);
|
|
4372
|
+
throw Ye("Field path arguments must be of type string or ", t,
|
|
4342
4373
|
/* hasConverter= */ !1,
|
|
4343
4374
|
/* path= */ void 0, e);
|
|
4344
4375
|
}
|
|
4345
4376
|
|
|
4346
4377
|
/**
|
|
4347
4378
|
* Matches any characters in a field path string that are reserved.
|
|
4348
|
-
*/ const
|
|
4379
|
+
*/ const Qe = new RegExp("[~\\*/\\[\\]]");
|
|
4349
4380
|
|
|
4350
4381
|
/**
|
|
4351
4382
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -4355,20 +4386,20 @@ function Qe(t, n, e) {
|
|
|
4355
4386
|
* split on dots.
|
|
4356
4387
|
* @param targetDoc - The document against which the field path will be
|
|
4357
4388
|
* evaluated.
|
|
4358
|
-
*/ function
|
|
4359
|
-
if (n.search(
|
|
4389
|
+
*/ function We(t, n, e) {
|
|
4390
|
+
if (n.search(Qe) >= 0) throw Ye(`Invalid field path (${n}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
|
|
4360
4391
|
/* hasConverter= */ !1,
|
|
4361
4392
|
/* path= */ void 0, e);
|
|
4362
4393
|
try {
|
|
4363
|
-
return new
|
|
4394
|
+
return new ge(...n.split("."))._internalPath;
|
|
4364
4395
|
} catch (r) {
|
|
4365
|
-
throw
|
|
4396
|
+
throw Ye(`Invalid field path (${n}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
|
|
4366
4397
|
/* hasConverter= */ !1,
|
|
4367
4398
|
/* path= */ void 0, e);
|
|
4368
4399
|
}
|
|
4369
4400
|
}
|
|
4370
4401
|
|
|
4371
|
-
function
|
|
4402
|
+
function Ye(t, n, e, r, s) {
|
|
4372
4403
|
const i = r && !r.isEmpty(), o = void 0 !== s;
|
|
4373
4404
|
let u = `Function ${n}() called with invalid data`;
|
|
4374
4405
|
e && (u += " (via `toFirestore()`)"), u += ". ";
|
|
@@ -4377,7 +4408,7 @@ function He(t, n, e, r, s) {
|
|
|
4377
4408
|
c += ")"), new U(R, u + t + c);
|
|
4378
4409
|
}
|
|
4379
4410
|
|
|
4380
|
-
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function
|
|
4411
|
+
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function He(t, n) {
|
|
4381
4412
|
return t.some((t => t.isEqual(n)));
|
|
4382
4413
|
}
|
|
4383
4414
|
|
|
@@ -4405,7 +4436,7 @@ function He(t, n, e, r, s) {
|
|
|
4405
4436
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
4406
4437
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
4407
4438
|
* explicitly verify a document's existence.
|
|
4408
|
-
*/ class
|
|
4439
|
+
*/ class Ke {
|
|
4409
4440
|
// Note: This class is stripped down version of the DocumentSnapshot in
|
|
4410
4441
|
// the legacy SDK. The changes are:
|
|
4411
4442
|
// - No support for SnapshotMetadata.
|
|
@@ -4421,7 +4452,7 @@ function He(t, n, e, r, s) {
|
|
|
4421
4452
|
/**
|
|
4422
4453
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
4423
4454
|
*/ get ref() {
|
|
4424
|
-
return new
|
|
4455
|
+
return new le(this._firestore, this._converter, this._key);
|
|
4425
4456
|
}
|
|
4426
4457
|
/**
|
|
4427
4458
|
* Signals whether or not the document at the snapshot's location exists.
|
|
@@ -4441,7 +4472,7 @@ function He(t, n, e, r, s) {
|
|
|
4441
4472
|
if (this._converter) {
|
|
4442
4473
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
4443
4474
|
// if a converter has been provided.
|
|
4444
|
-
const t = new
|
|
4475
|
+
const t = new Je(this._firestore, this._userDataWriter, this._key, this._document,
|
|
4445
4476
|
/* converter= */ null);
|
|
4446
4477
|
return this._converter.fromFirestore(t);
|
|
4447
4478
|
}
|
|
@@ -4461,7 +4492,7 @@ function He(t, n, e, r, s) {
|
|
|
4461
4492
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4462
4493
|
get(t) {
|
|
4463
4494
|
if (this._document) {
|
|
4464
|
-
const n = this._document.data.field(
|
|
4495
|
+
const n = this._document.data.field(tr("DocumentSnapshot.get", t));
|
|
4465
4496
|
if (null !== n) return this._userDataWriter.convertValue(n);
|
|
4466
4497
|
}
|
|
4467
4498
|
}
|
|
@@ -4477,7 +4508,7 @@ function He(t, n, e, r, s) {
|
|
|
4477
4508
|
* `DocumentSnapshot`. Since query results contain only existing documents, the
|
|
4478
4509
|
* `exists` property will always be true and `data()` will never return
|
|
4479
4510
|
* 'undefined'.
|
|
4480
|
-
*/ class
|
|
4511
|
+
*/ class Je extends Ke {
|
|
4481
4512
|
/**
|
|
4482
4513
|
* Retrieves all fields in the document as an `Object`.
|
|
4483
4514
|
*
|
|
@@ -4495,7 +4526,7 @@ function He(t, n, e, r, s) {
|
|
|
4495
4526
|
* array via the `docs` property or enumerated using the `forEach` method. The
|
|
4496
4527
|
* number of documents can be determined via the `empty` and `size`
|
|
4497
4528
|
* properties.
|
|
4498
|
-
*/ class
|
|
4529
|
+
*/ class Xe {
|
|
4499
4530
|
/** @hideconstructor */
|
|
4500
4531
|
constructor(t, n) {
|
|
4501
4532
|
this._docs = n, this.query = t;
|
|
@@ -4526,14 +4557,14 @@ function He(t, n, e, r, s) {
|
|
|
4526
4557
|
* @param left - A snapshot to compare.
|
|
4527
4558
|
* @param right - A snapshot to compare.
|
|
4528
4559
|
* @returns true if the snapshots are equal.
|
|
4529
|
-
*/ function
|
|
4530
|
-
return t = l(t), n = l(n), t instanceof
|
|
4560
|
+
*/ function Ze(t, n) {
|
|
4561
|
+
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));
|
|
4531
4562
|
}
|
|
4532
4563
|
|
|
4533
4564
|
/**
|
|
4534
4565
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
4535
|
-
*/ function
|
|
4536
|
-
return "string" == typeof n ?
|
|
4566
|
+
*/ function tr(t, n) {
|
|
4567
|
+
return "string" == typeof n ? We(t, n) : n instanceof ge ? n._internalPath : n._delegate._internalPath;
|
|
4537
4568
|
}
|
|
4538
4569
|
|
|
4539
4570
|
/**
|
|
@@ -4560,7 +4591,7 @@ function He(t, n, e, r, s) {
|
|
|
4560
4591
|
* can then be passed to {@link query} to create a new query instance that
|
|
4561
4592
|
* also contains this `QueryConstraint`.
|
|
4562
4593
|
*/
|
|
4563
|
-
class
|
|
4594
|
+
class nr {}
|
|
4564
4595
|
|
|
4565
4596
|
/**
|
|
4566
4597
|
* Creates a new immutable instance of {@link Query} that is extended to also include
|
|
@@ -4570,32 +4601,32 @@ class er {}
|
|
|
4570
4601
|
* @param queryConstraints - The list of {@link QueryConstraint}s to apply.
|
|
4571
4602
|
* @throws if any of the provided query constraints cannot be combined with the
|
|
4572
4603
|
* existing or new constraints.
|
|
4573
|
-
*/ function
|
|
4604
|
+
*/ function er(t, ...n) {
|
|
4574
4605
|
for (const e of n) t = e._apply(t);
|
|
4575
4606
|
return t;
|
|
4576
4607
|
}
|
|
4577
4608
|
|
|
4578
|
-
class
|
|
4609
|
+
class rr extends nr {
|
|
4579
4610
|
constructor(t, n, e) {
|
|
4580
4611
|
super(), this.dt = t, this.wt = n, this.yt = e, this.type = "where";
|
|
4581
4612
|
}
|
|
4582
4613
|
_apply(t) {
|
|
4583
|
-
const n =
|
|
4614
|
+
const n = De(t.firestore), e = function(t, n, e, r, s, i, o) {
|
|
4584
4615
|
let u;
|
|
4585
4616
|
if (s.isKeyField()) {
|
|
4586
4617
|
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().`);
|
|
4587
4618
|
if ("in" /* IN */ === i || "not-in" /* NOT_IN */ === i) {
|
|
4588
|
-
|
|
4619
|
+
_r(o, i);
|
|
4589
4620
|
const n = [];
|
|
4590
|
-
for (const e of o) n.push(
|
|
4621
|
+
for (const e of o) n.push(yr(r, t, e));
|
|
4591
4622
|
u = {
|
|
4592
4623
|
arrayValue: {
|
|
4593
4624
|
values: n
|
|
4594
4625
|
}
|
|
4595
4626
|
};
|
|
4596
|
-
} else u =
|
|
4597
|
-
} else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i ||
|
|
4598
|
-
u =
|
|
4627
|
+
} else u = yr(r, t, o);
|
|
4628
|
+
} else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || _r(o, i),
|
|
4629
|
+
u = Ue(e, n, o,
|
|
4599
4630
|
/* allowArrays= */ "in" /* IN */ === i || "not-in" /* NOT_IN */ === i);
|
|
4600
4631
|
const c = Ht.create(s, i, u);
|
|
4601
4632
|
return function(t, n) {
|
|
@@ -4603,7 +4634,7 @@ class sr extends er {
|
|
|
4603
4634
|
const e = fn(t);
|
|
4604
4635
|
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()}'`);
|
|
4605
4636
|
const r = ln(t);
|
|
4606
|
-
null !== r &&
|
|
4637
|
+
null !== r && gr(t, n.field, r);
|
|
4607
4638
|
}
|
|
4608
4639
|
const e = function(t, n) {
|
|
4609
4640
|
for (const e of t.filters) if (n.indexOf(e.op) >= 0) return e.op;
|
|
@@ -4647,7 +4678,7 @@ class sr extends er {
|
|
|
4647
4678
|
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.`);
|
|
4648
4679
|
}(t, c), c;
|
|
4649
4680
|
}(t._query, "where", n, t.firestore._databaseId, this.dt, this.wt, this.yt);
|
|
4650
|
-
return new
|
|
4681
|
+
return new fe(t.firestore, t.converter, function(t, n) {
|
|
4651
4682
|
const e = t.filters.concat([ n ]);
|
|
4652
4683
|
return new an(t.path, t.collectionGroup, t.explicitOrderBy.slice(), e, t.limit, t.limitType, t.startAt, t.endAt);
|
|
4653
4684
|
}(t._query, e));
|
|
@@ -4664,12 +4695,12 @@ class sr extends er {
|
|
|
4664
4695
|
* "<=", "!=").
|
|
4665
4696
|
* @param value - The value for comparison
|
|
4666
4697
|
* @returns The created {@link Query}.
|
|
4667
|
-
*/ function
|
|
4668
|
-
const r = n, s =
|
|
4669
|
-
return new
|
|
4698
|
+
*/ function sr(t, n, e) {
|
|
4699
|
+
const r = n, s = tr("where", t);
|
|
4700
|
+
return new rr(s, r, e);
|
|
4670
4701
|
}
|
|
4671
4702
|
|
|
4672
|
-
class
|
|
4703
|
+
class ir extends nr {
|
|
4673
4704
|
constructor(t, n) {
|
|
4674
4705
|
super(), this.dt = t, this._t = n, this.type = "orderBy";
|
|
4675
4706
|
}
|
|
@@ -4682,7 +4713,7 @@ class or extends er {
|
|
|
4682
4713
|
if (null === ln(t)) {
|
|
4683
4714
|
// This is the first order by. It must match any inequality.
|
|
4684
4715
|
const e = fn(t);
|
|
4685
|
-
null !== e &&
|
|
4716
|
+
null !== e && gr(t, e, n.field);
|
|
4686
4717
|
}
|
|
4687
4718
|
}(t, r), r;
|
|
4688
4719
|
}
|
|
@@ -4697,7 +4728,7 @@ class or extends er {
|
|
|
4697
4728
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
4698
4729
|
* server timestamp.
|
|
4699
4730
|
*/ (t._query, this.dt, this._t);
|
|
4700
|
-
return new
|
|
4731
|
+
return new fe(t.firestore, t.converter, function(t, n) {
|
|
4701
4732
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
4702
4733
|
const e = t.explicitOrderBy.concat([ n ]);
|
|
4703
4734
|
return new an(t.path, t.collectionGroup, e, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -4713,17 +4744,17 @@ class or extends er {
|
|
|
4713
4744
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
4714
4745
|
* not specified, order will be ascending.
|
|
4715
4746
|
* @returns The created {@link Query}.
|
|
4716
|
-
*/ function
|
|
4717
|
-
const e = n, r =
|
|
4718
|
-
return new
|
|
4747
|
+
*/ function or(t, n = "asc") {
|
|
4748
|
+
const e = n, r = tr("orderBy", t);
|
|
4749
|
+
return new ir(r, e);
|
|
4719
4750
|
}
|
|
4720
4751
|
|
|
4721
|
-
class
|
|
4752
|
+
class ur extends nr {
|
|
4722
4753
|
constructor(t, n, e) {
|
|
4723
4754
|
super(), this.type = t, this.gt = n, this.vt = e;
|
|
4724
4755
|
}
|
|
4725
4756
|
_apply(t) {
|
|
4726
|
-
return new
|
|
4757
|
+
return new fe(t.firestore, t.converter, function(t, n, e) {
|
|
4727
4758
|
return new an(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), n, e, t.startAt, t.endAt);
|
|
4728
4759
|
}(t._query, this.gt, this.vt));
|
|
4729
4760
|
}
|
|
@@ -4734,8 +4765,8 @@ class cr extends er {
|
|
|
4734
4765
|
*
|
|
4735
4766
|
* @param limit - The maximum number of items to return.
|
|
4736
4767
|
* @returns The created {@link Query}.
|
|
4737
|
-
*/ function
|
|
4738
|
-
return ct("limit", t), new
|
|
4768
|
+
*/ function cr(t) {
|
|
4769
|
+
return ct("limit", t), new ur("limit", t, "F" /* First */);
|
|
4739
4770
|
}
|
|
4740
4771
|
|
|
4741
4772
|
/**
|
|
@@ -4746,53 +4777,55 @@ class cr extends er {
|
|
|
4746
4777
|
*
|
|
4747
4778
|
* @param limit - The maximum number of items to return.
|
|
4748
4779
|
* @returns The created {@link Query}.
|
|
4749
|
-
*/ function
|
|
4750
|
-
return ct("limitToLast", t), new
|
|
4780
|
+
*/ function ar(t) {
|
|
4781
|
+
return ct("limitToLast", t), new ur("limitToLast", t, "L" /* Last */);
|
|
4751
4782
|
}
|
|
4752
4783
|
|
|
4753
|
-
class
|
|
4784
|
+
class hr extends nr {
|
|
4754
4785
|
constructor(t, n, e) {
|
|
4755
4786
|
super(), this.type = t, this.bt = n, this.Et = e;
|
|
4756
4787
|
}
|
|
4757
4788
|
_apply(t) {
|
|
4758
|
-
const n =
|
|
4759
|
-
return new
|
|
4789
|
+
const n = pr(t, this.type, this.bt, this.Et);
|
|
4790
|
+
return new fe(t.firestore, t.converter, function(t, n) {
|
|
4760
4791
|
return new an(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, n, t.endAt);
|
|
4761
4792
|
}(t._query, n));
|
|
4762
4793
|
}
|
|
4763
4794
|
}
|
|
4764
4795
|
|
|
4765
|
-
function
|
|
4766
|
-
return new
|
|
4796
|
+
function lr(...t) {
|
|
4797
|
+
return new hr("startAt", t,
|
|
4798
|
+
/*inclusive=*/ !0);
|
|
4767
4799
|
}
|
|
4768
4800
|
|
|
4769
|
-
function
|
|
4770
|
-
return new
|
|
4771
|
-
/*
|
|
4801
|
+
function fr(...t) {
|
|
4802
|
+
return new hr("startAfter", t,
|
|
4803
|
+
/*inclusive=*/ !1);
|
|
4772
4804
|
}
|
|
4773
4805
|
|
|
4774
|
-
class
|
|
4806
|
+
class dr extends nr {
|
|
4775
4807
|
constructor(t, n, e) {
|
|
4776
4808
|
super(), this.type = t, this.bt = n, this.Et = e;
|
|
4777
4809
|
}
|
|
4778
4810
|
_apply(t) {
|
|
4779
|
-
const n =
|
|
4780
|
-
return new
|
|
4811
|
+
const n = pr(t, this.type, this.bt, this.Et);
|
|
4812
|
+
return new fe(t.firestore, t.converter, function(t, n) {
|
|
4781
4813
|
return new an(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, n);
|
|
4782
4814
|
}(t._query, n));
|
|
4783
4815
|
}
|
|
4784
4816
|
}
|
|
4785
4817
|
|
|
4786
|
-
function
|
|
4787
|
-
return new
|
|
4818
|
+
function wr(...t) {
|
|
4819
|
+
return new dr("endBefore", t,
|
|
4820
|
+
/*inclusive=*/ !1);
|
|
4788
4821
|
}
|
|
4789
4822
|
|
|
4790
|
-
function
|
|
4791
|
-
return new
|
|
4823
|
+
function mr(...t) {
|
|
4824
|
+
return new dr("endAt", t, /*inclusive=*/ !0);
|
|
4792
4825
|
}
|
|
4793
4826
|
|
|
4794
|
-
/** Helper function to create a bound from a document or fields */ function
|
|
4795
|
-
if (e[0] = l(e[0]), e[0] instanceof
|
|
4827
|
+
/** Helper function to create a bound from a document or fields */ function pr(t, n, e, r) {
|
|
4828
|
+
if (e[0] = l(e[0]), e[0] instanceof Ke) return function(t, n, e, r, s) {
|
|
4796
4829
|
if (!r) throw new U(V, `Can't use a DocumentSnapshot that doesn't exist for ${e}().`);
|
|
4797
4830
|
const i = [];
|
|
4798
4831
|
// Because people expect to continue/end a query at the exact document
|
|
@@ -4817,7 +4850,7 @@ function pr(...t) {
|
|
|
4817
4850
|
* Converts a list of field values to a `Bound` for the given query.
|
|
4818
4851
|
*/ (t._query, t.firestore._databaseId, n, e[0]._document, r);
|
|
4819
4852
|
{
|
|
4820
|
-
const s =
|
|
4853
|
+
const s = De(t.firestore);
|
|
4821
4854
|
return function(t, n, e, r, s, i) {
|
|
4822
4855
|
// Use explicit order by's because it has to match the query the user made
|
|
4823
4856
|
const o = t.explicitOrderBy;
|
|
@@ -4833,7 +4866,7 @@ function pr(...t) {
|
|
|
4833
4866
|
const s = new et(e);
|
|
4834
4867
|
u.push(kt(n, s));
|
|
4835
4868
|
} else {
|
|
4836
|
-
const t =
|
|
4869
|
+
const t = Ue(e, r, c);
|
|
4837
4870
|
u.push(t);
|
|
4838
4871
|
}
|
|
4839
4872
|
}
|
|
@@ -4847,7 +4880,7 @@ function pr(...t) {
|
|
|
4847
4880
|
}
|
|
4848
4881
|
}
|
|
4849
4882
|
|
|
4850
|
-
function
|
|
4883
|
+
function yr(t, n, e) {
|
|
4851
4884
|
if ("string" == typeof (e = l(e))) {
|
|
4852
4885
|
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.");
|
|
4853
4886
|
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.`);
|
|
@@ -4855,19 +4888,19 @@ function _r(t, n, e) {
|
|
|
4855
4888
|
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}).`);
|
|
4856
4889
|
return kt(t, new et(r));
|
|
4857
4890
|
}
|
|
4858
|
-
if (e instanceof
|
|
4891
|
+
if (e instanceof le) return kt(t, e._key);
|
|
4859
4892
|
throw new U(R, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${ot(e)}.`);
|
|
4860
4893
|
}
|
|
4861
4894
|
|
|
4862
4895
|
/**
|
|
4863
4896
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
4864
4897
|
* array requirements.
|
|
4865
|
-
*/ function
|
|
4898
|
+
*/ function _r(t, n) {
|
|
4866
4899
|
if (!Array.isArray(t) || 0 === t.length) throw new U(R, `Invalid Query. A non-empty array is required for '${n.toString()}' filters.`);
|
|
4867
4900
|
if (t.length > 10) throw new U(R, `Invalid Query. '${n.toString()}' filters support a maximum of 10 elements in the value array.`);
|
|
4868
4901
|
}
|
|
4869
4902
|
|
|
4870
|
-
function
|
|
4903
|
+
function gr(t, n, e) {
|
|
4871
4904
|
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.`);
|
|
4872
4905
|
}
|
|
4873
4906
|
|
|
@@ -4918,7 +4951,7 @@ function vr(t, n, e) {
|
|
|
4918
4951
|
* their `set()` or fails due to invalid data originating from a `toFirestore()`
|
|
4919
4952
|
* call.
|
|
4920
4953
|
*/
|
|
4921
|
-
function
|
|
4954
|
+
function vr(t, n, e) {
|
|
4922
4955
|
let r;
|
|
4923
4956
|
// Cast to `any` in order to satisfy the union type constraint on
|
|
4924
4957
|
// toFirestore().
|
|
@@ -4927,7 +4960,7 @@ function br(t, n, e) {
|
|
|
4927
4960
|
r;
|
|
4928
4961
|
}
|
|
4929
4962
|
|
|
4930
|
-
class
|
|
4963
|
+
class br extends class {
|
|
4931
4964
|
convertValue(t, n = "none") {
|
|
4932
4965
|
switch (xt(t)) {
|
|
4933
4966
|
case 0 /* NullValue */ :
|
|
@@ -4974,7 +5007,7 @@ class Er extends class {
|
|
|
4974
5007
|
})), e;
|
|
4975
5008
|
}
|
|
4976
5009
|
convertGeoPoint(t) {
|
|
4977
|
-
return new
|
|
5010
|
+
return new Te(Nt(t.latitude), Nt(t.longitude));
|
|
4978
5011
|
}
|
|
4979
5012
|
convertArray(t, n) {
|
|
4980
5013
|
return (t.values || []).map((t => this.convertValue(t, n)));
|
|
@@ -4998,7 +5031,7 @@ class Er extends class {
|
|
|
4998
5031
|
}
|
|
4999
5032
|
convertDocumentKey(t, n) {
|
|
5000
5033
|
const e = Z.fromString(t);
|
|
5001
|
-
b(
|
|
5034
|
+
b(Kn(e));
|
|
5002
5035
|
const r = new J(e.get(1), e.get(3)), s = new et(e.popFirst(5));
|
|
5003
5036
|
return r.isEqual(n) ||
|
|
5004
5037
|
// TODO(b/64130202): Somehow support foreign references.
|
|
@@ -5010,11 +5043,11 @@ class Er extends class {
|
|
|
5010
5043
|
super(), this.firestore = t;
|
|
5011
5044
|
}
|
|
5012
5045
|
convertBytes(t) {
|
|
5013
|
-
return new
|
|
5046
|
+
return new be(t);
|
|
5014
5047
|
}
|
|
5015
5048
|
convertReference(t) {
|
|
5016
5049
|
const n = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
5017
|
-
return new
|
|
5050
|
+
return new le(this.firestore, /* converter= */ null, n);
|
|
5018
5051
|
}
|
|
5019
5052
|
}
|
|
5020
5053
|
|
|
@@ -5030,12 +5063,12 @@ class Er extends class {
|
|
|
5030
5063
|
* @param reference - The reference of the document to fetch.
|
|
5031
5064
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
5032
5065
|
* document contents.
|
|
5033
|
-
*/ function
|
|
5034
|
-
const n =
|
|
5035
|
-
return
|
|
5066
|
+
*/ function Er(t) {
|
|
5067
|
+
const n = se((t = ut(t, le)).firestore), e = new br(t.firestore);
|
|
5068
|
+
return ne(n, [ t._key ]).then((n => {
|
|
5036
5069
|
b(1 === n.length);
|
|
5037
5070
|
const r = n[0];
|
|
5038
|
-
return new
|
|
5071
|
+
return new Ke(t.firestore, e, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
5039
5072
|
}));
|
|
5040
5073
|
}
|
|
5041
5074
|
|
|
@@ -5050,33 +5083,33 @@ class Er extends class {
|
|
|
5050
5083
|
*
|
|
5051
5084
|
* @param query - The `Query` to execute.
|
|
5052
5085
|
* @returns A Promise that will be resolved with the results of the query.
|
|
5053
|
-
*/ function
|
|
5086
|
+
*/ function Tr(t) {
|
|
5054
5087
|
!function(t) {
|
|
5055
5088
|
if (hn(t) && 0 === t.explicitOrderBy.length) throw new U(O, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
5056
|
-
}((t = ut(t,
|
|
5057
|
-
const n =
|
|
5058
|
-
return
|
|
5059
|
-
const r = n.map((n => new
|
|
5089
|
+
}((t = ut(t, fe))._query);
|
|
5090
|
+
const n = se(t.firestore), e = new br(t.firestore);
|
|
5091
|
+
return ee(n, t._query).then((n => {
|
|
5092
|
+
const r = n.map((n => new Je(t.firestore, e, n.key, n, t.converter)));
|
|
5060
5093
|
return hn(t._query) &&
|
|
5061
5094
|
// Limit to last queries reverse the orderBy constraint that was
|
|
5062
5095
|
// specified by the user. As such, we need to reverse the order of the
|
|
5063
5096
|
// results to return the documents in the expected order.
|
|
5064
|
-
r.reverse(), new
|
|
5097
|
+
r.reverse(), new Xe(t, r);
|
|
5065
5098
|
}));
|
|
5066
5099
|
}
|
|
5067
5100
|
|
|
5068
|
-
function
|
|
5069
|
-
const r =
|
|
5070
|
-
return
|
|
5101
|
+
function Ir(t, n, e) {
|
|
5102
|
+
const r = vr((t = ut(t, le)).converter, n, e), s = $e(De(t.firestore), "setDoc", t._key, r, null !== t.converter, e);
|
|
5103
|
+
return te(se(t.firestore), [ s.toMutation(t._key, In.none()) ]);
|
|
5071
5104
|
}
|
|
5072
5105
|
|
|
5073
|
-
function
|
|
5074
|
-
const s =
|
|
5106
|
+
function Ar(t, n, e, ...r) {
|
|
5107
|
+
const s = De((t = ut(t, le)).firestore);
|
|
5075
5108
|
// For Compat types, we have to "extract" the underlying types before
|
|
5076
5109
|
// performing validation.
|
|
5077
5110
|
let i;
|
|
5078
|
-
i = "string" == typeof (n = l(n)) || n instanceof
|
|
5079
|
-
return
|
|
5111
|
+
i = "string" == typeof (n = l(n)) || n instanceof ge ? ke(s, "updateDoc", t._key, n, e, r) : Le(s, "updateDoc", t._key, n);
|
|
5112
|
+
return te(se(t.firestore), [ i.toMutation(t._key, In.exists(!0)) ]);
|
|
5080
5113
|
}
|
|
5081
5114
|
|
|
5082
5115
|
/**
|
|
@@ -5090,8 +5123,8 @@ function Rr(t, n, e, ...r) {
|
|
|
5090
5123
|
* @param reference - A reference to the document to delete.
|
|
5091
5124
|
* @returns A `Promise` resolved once the document has been successfully
|
|
5092
5125
|
* deleted from the backend.
|
|
5093
|
-
*/ function
|
|
5094
|
-
return
|
|
5126
|
+
*/ function Rr(t) {
|
|
5127
|
+
return te(se((t = ut(t, le)).firestore), [ new Vn(t._key, In.none()) ]);
|
|
5095
5128
|
}
|
|
5096
5129
|
|
|
5097
5130
|
/**
|
|
@@ -5108,9 +5141,9 @@ function Rr(t, n, e, ...r) {
|
|
|
5108
5141
|
* @throws Error - If the provided input is not a valid Firestore document.
|
|
5109
5142
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
5110
5143
|
* newly created document after it has been written to the backend.
|
|
5111
|
-
*/ function
|
|
5112
|
-
const e =
|
|
5113
|
-
return
|
|
5144
|
+
*/ function Pr(t, n) {
|
|
5145
|
+
const e = pe(t = ut(t, de)), r = vr(t.converter, n), s = $e(De(t.firestore), "addDoc", e._key, r, null !== e.converter, {});
|
|
5146
|
+
return te(se(t.firestore), [ s.toMutation(e._key, In.exists(!1)) ]).then((() => e));
|
|
5114
5147
|
}
|
|
5115
5148
|
|
|
5116
5149
|
/**
|
|
@@ -5132,15 +5165,15 @@ function Rr(t, n, e, ...r) {
|
|
|
5132
5165
|
/**
|
|
5133
5166
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
5134
5167
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
5135
|
-
*/ function
|
|
5136
|
-
return new
|
|
5168
|
+
*/ function Vr() {
|
|
5169
|
+
return new Se("deleteField");
|
|
5137
5170
|
}
|
|
5138
5171
|
|
|
5139
5172
|
/**
|
|
5140
5173
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
5141
5174
|
* include a server-generated timestamp in the written data.
|
|
5142
|
-
*/ function
|
|
5143
|
-
return new
|
|
5175
|
+
*/ function Nr() {
|
|
5176
|
+
return new xe("serverTimestamp");
|
|
5144
5177
|
}
|
|
5145
5178
|
|
|
5146
5179
|
/**
|
|
@@ -5154,10 +5187,10 @@ function Rr(t, n, e, ...r) {
|
|
|
5154
5187
|
* @param elements - The elements to union into the array.
|
|
5155
5188
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5156
5189
|
* `updateDoc()`.
|
|
5157
|
-
*/ function
|
|
5190
|
+
*/ function Dr(...t) {
|
|
5158
5191
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5159
5192
|
// update() since we'd need the Firestore instance to do this.
|
|
5160
|
-
return new
|
|
5193
|
+
return new qe("arrayUnion", t);
|
|
5161
5194
|
}
|
|
5162
5195
|
|
|
5163
5196
|
/**
|
|
@@ -5170,10 +5203,10 @@ function Rr(t, n, e, ...r) {
|
|
|
5170
5203
|
* @param elements - The elements to remove from the array.
|
|
5171
5204
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5172
5205
|
* `updateDoc()`
|
|
5173
|
-
*/ function
|
|
5206
|
+
*/ function $r(...t) {
|
|
5174
5207
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5175
5208
|
// update() since we'd need the Firestore instance to do this.
|
|
5176
|
-
return new
|
|
5209
|
+
return new Oe("arrayRemove", t);
|
|
5177
5210
|
}
|
|
5178
5211
|
|
|
5179
5212
|
/**
|
|
@@ -5194,8 +5227,8 @@ function Rr(t, n, e, ...r) {
|
|
|
5194
5227
|
* @param n - The value to increment by.
|
|
5195
5228
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5196
5229
|
* `updateDoc()`
|
|
5197
|
-
*/ function
|
|
5198
|
-
return new
|
|
5230
|
+
*/ function Sr(t) {
|
|
5231
|
+
return new Ce("increment", t);
|
|
5199
5232
|
}
|
|
5200
5233
|
|
|
5201
5234
|
/**
|
|
@@ -5221,24 +5254,24 @@ function Rr(t, n, e, ...r) {
|
|
|
5221
5254
|
* provides methods for adding writes to the write batch. None of the writes
|
|
5222
5255
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
5223
5256
|
* called.
|
|
5224
|
-
*/ class
|
|
5257
|
+
*/ class Fr {
|
|
5225
5258
|
/** @hideconstructor */
|
|
5226
5259
|
constructor(t, n) {
|
|
5227
5260
|
this._firestore = t, this._commitHandler = n, this._mutations = [], this._committed = !1,
|
|
5228
|
-
this._dataReader =
|
|
5261
|
+
this._dataReader = De(t);
|
|
5229
5262
|
}
|
|
5230
5263
|
set(t, n, e) {
|
|
5231
5264
|
this._verifyNotCommitted();
|
|
5232
|
-
const r =
|
|
5265
|
+
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);
|
|
5233
5266
|
return this._mutations.push(i.toMutation(r._key, In.none())), this;
|
|
5234
5267
|
}
|
|
5235
5268
|
update(t, n, e, ...r) {
|
|
5236
5269
|
this._verifyNotCommitted();
|
|
5237
|
-
const s =
|
|
5270
|
+
const s = xr(t, this._firestore);
|
|
5238
5271
|
// For Compat types, we have to "extract" the underlying types before
|
|
5239
5272
|
// performing validation.
|
|
5240
5273
|
let i;
|
|
5241
|
-
return i = "string" == typeof (n = l(n)) || n instanceof
|
|
5274
|
+
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),
|
|
5242
5275
|
this._mutations.push(i.toMutation(s._key, In.exists(!0))), this;
|
|
5243
5276
|
}
|
|
5244
5277
|
/**
|
|
@@ -5248,7 +5281,7 @@ function Rr(t, n, e, ...r) {
|
|
|
5248
5281
|
* @returns This `WriteBatch` instance. Used for chaining method calls.
|
|
5249
5282
|
*/ delete(t) {
|
|
5250
5283
|
this._verifyNotCommitted();
|
|
5251
|
-
const n =
|
|
5284
|
+
const n = xr(t, this._firestore);
|
|
5252
5285
|
return this._mutations = this._mutations.concat(new Vn(n._key, In.none())), this;
|
|
5253
5286
|
}
|
|
5254
5287
|
/**
|
|
@@ -5270,7 +5303,7 @@ function Rr(t, n, e, ...r) {
|
|
|
5270
5303
|
}
|
|
5271
5304
|
}
|
|
5272
5305
|
|
|
5273
|
-
function
|
|
5306
|
+
function xr(t, n) {
|
|
5274
5307
|
if ((t = l(t)).firestore !== n) throw new U(R, "Provided document reference is from a different Firestore instance.");
|
|
5275
5308
|
return t;
|
|
5276
5309
|
}
|
|
@@ -5287,9 +5320,9 @@ function qr(t, n) {
|
|
|
5287
5320
|
*
|
|
5288
5321
|
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
5289
5322
|
* writes.
|
|
5290
|
-
*/ function
|
|
5291
|
-
const n =
|
|
5292
|
-
return new
|
|
5323
|
+
*/ function qr(t) {
|
|
5324
|
+
const n = se(t = ut(t, oe));
|
|
5325
|
+
return new Fr(t, (t => te(n, t)));
|
|
5293
5326
|
}
|
|
5294
5327
|
|
|
5295
5328
|
/**
|
|
@@ -5311,7 +5344,7 @@ function qr(t, n) {
|
|
|
5311
5344
|
/**
|
|
5312
5345
|
* Internal transaction object responsible for accumulating the mutations to
|
|
5313
5346
|
* perform and the base versions for any documents read.
|
|
5314
|
-
*/ class
|
|
5347
|
+
*/ class Or {
|
|
5315
5348
|
constructor(t) {
|
|
5316
5349
|
this.datastore = t,
|
|
5317
5350
|
// The version of each document that was read during this transaction.
|
|
@@ -5331,7 +5364,7 @@ function qr(t, n) {
|
|
|
5331
5364
|
}
|
|
5332
5365
|
async lookup(t) {
|
|
5333
5366
|
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(R, "Firestore transactions require all reads to be executed before all writes.");
|
|
5334
|
-
const n = await
|
|
5367
|
+
const n = await ne(this.datastore, t);
|
|
5335
5368
|
return n.forEach((t => this.recordVersion(t))), n;
|
|
5336
5369
|
}
|
|
5337
5370
|
set(t, n) {
|
|
@@ -5360,7 +5393,7 @@ function qr(t, n) {
|
|
|
5360
5393
|
t.forEach(((t, n) => {
|
|
5361
5394
|
const e = et.fromPath(n);
|
|
5362
5395
|
this.mutations.push(new Nn(e, this.precondition(e)));
|
|
5363
|
-
})), await
|
|
5396
|
+
})), await te(this.datastore, this.mutations), this.committed = !0;
|
|
5364
5397
|
}
|
|
5365
5398
|
recordVersion(t) {
|
|
5366
5399
|
let n;
|
|
@@ -5434,17 +5467,17 @@ function qr(t, n) {
|
|
|
5434
5467
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
5435
5468
|
* with backoff.
|
|
5436
5469
|
*/
|
|
5437
|
-
class
|
|
5470
|
+
class Cr {
|
|
5438
5471
|
constructor(t, n, e, r) {
|
|
5439
5472
|
this.asyncQueue = t, this.datastore = n, this.updateFunction = e, this.deferred = r,
|
|
5440
|
-
this.Tt = 5, this.It = new
|
|
5473
|
+
this.Tt = 5, this.It = new Xn(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
5441
5474
|
}
|
|
5442
5475
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
5443
5476
|
this.Tt -= 1, this.At();
|
|
5444
5477
|
}
|
|
5445
5478
|
At() {
|
|
5446
5479
|
this.It.W((async () => {
|
|
5447
|
-
const t = new
|
|
5480
|
+
const t = new Or(this.datastore), n = this.Rt(t);
|
|
5448
5481
|
n && n.then((n => {
|
|
5449
5482
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
5450
5483
|
this.deferred.resolve(n);
|
|
@@ -5534,7 +5567,7 @@ class Lr {
|
|
|
5534
5567
|
* See the License for the specific language governing permissions and
|
|
5535
5568
|
* limitations under the License.
|
|
5536
5569
|
*/
|
|
5537
|
-
/** The Platform's 'document' implementation or null if not available. */ function
|
|
5570
|
+
/** The Platform's 'document' implementation or null if not available. */ function Lr() {
|
|
5538
5571
|
// `document` is not always available, e.g. in ReactNative and WebWorkers.
|
|
5539
5572
|
// eslint-disable-next-line no-restricted-globals
|
|
5540
5573
|
return "undefined" != typeof document ? document : null;
|
|
@@ -5566,7 +5599,7 @@ class Lr {
|
|
|
5566
5599
|
* Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
|
|
5567
5600
|
* in newer versions of TypeScript defines `finally`, which is not available in
|
|
5568
5601
|
* IE.
|
|
5569
|
-
*/ class
|
|
5602
|
+
*/ class kr {
|
|
5570
5603
|
constructor(t, n, e, r, s) {
|
|
5571
5604
|
this.asyncQueue = t, this.timerId = n, this.targetTimeMs = e, this.op = r, this.removalCallback = s,
|
|
5572
5605
|
this.deferred = new j, this.then = this.deferred.promise.then.bind(this.deferred.promise),
|
|
@@ -5589,7 +5622,7 @@ class Lr {
|
|
|
5589
5622
|
* PORTING NOTE: This exists to prevent making removeDelayedOperation() and
|
|
5590
5623
|
* the DelayedOperation class public.
|
|
5591
5624
|
*/ static createAndSchedule(t, n, e, r, s) {
|
|
5592
|
-
const i = Date.now() + e, o = new
|
|
5625
|
+
const i = Date.now() + e, o = new kr(t, n, i, r, s);
|
|
5593
5626
|
return o.start(e), o;
|
|
5594
5627
|
}
|
|
5595
5628
|
/**
|
|
@@ -5638,7 +5671,7 @@ class Lr {
|
|
|
5638
5671
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5639
5672
|
* See the License for the specific language governing permissions and
|
|
5640
5673
|
* limitations under the License.
|
|
5641
|
-
*/ class
|
|
5674
|
+
*/ class Ur {
|
|
5642
5675
|
constructor() {
|
|
5643
5676
|
// The last promise in the queue.
|
|
5644
5677
|
this.Nt = Promise.resolve(),
|
|
@@ -5661,15 +5694,15 @@ class Lr {
|
|
|
5661
5694
|
// List of TimerIds to fast-forward delays for.
|
|
5662
5695
|
this.Ot = [],
|
|
5663
5696
|
// Backoff timer used to schedule retries for retryable operations
|
|
5664
|
-
this.It = new
|
|
5697
|
+
this.It = new Xn(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
5665
5698
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
5666
5699
|
// operations. Meant to speed up recovery when we regain file system access
|
|
5667
5700
|
// after page comes into foreground.
|
|
5668
5701
|
this.Ct = () => {
|
|
5669
|
-
const t =
|
|
5702
|
+
const t = Lr();
|
|
5670
5703
|
t && p("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.It.H();
|
|
5671
5704
|
};
|
|
5672
|
-
const t =
|
|
5705
|
+
const t = Lr();
|
|
5673
5706
|
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Ct);
|
|
5674
5707
|
}
|
|
5675
5708
|
get isShuttingDown() {
|
|
@@ -5690,7 +5723,7 @@ class Lr {
|
|
|
5690
5723
|
enterRestrictedMode(t) {
|
|
5691
5724
|
if (!this.$t) {
|
|
5692
5725
|
this.$t = !0, this.qt = t || !1;
|
|
5693
|
-
const n =
|
|
5726
|
+
const n = Lr();
|
|
5694
5727
|
n && "function" == typeof n.removeEventListener && n.removeEventListener("visibilitychange", this.Ct);
|
|
5695
5728
|
}
|
|
5696
5729
|
}
|
|
@@ -5822,7 +5855,7 @@ class Lr {
|
|
|
5822
5855
|
this.Lt(),
|
|
5823
5856
|
// Fast-forward delays for timerIds that have been overriden.
|
|
5824
5857
|
this.Ot.indexOf(t) > -1 && (n = 0);
|
|
5825
|
-
const r =
|
|
5858
|
+
const r = kr.createAndSchedule(this, t, n, e, (t => this.jt(t)));
|
|
5826
5859
|
return this.St.push(r), r;
|
|
5827
5860
|
}
|
|
5828
5861
|
Lt() {
|
|
@@ -5866,7 +5899,7 @@ class Lr {
|
|
|
5866
5899
|
}
|
|
5867
5900
|
/**
|
|
5868
5901
|
* For Tests: Skip all subsequent delays for a timer id.
|
|
5869
|
-
*/
|
|
5902
|
+
*/ Gt(t) {
|
|
5870
5903
|
this.Ot.push(t);
|
|
5871
5904
|
}
|
|
5872
5905
|
/** Called once a DelayedOperation is run or canceled. */ jt(t) {
|
|
@@ -5876,10 +5909,10 @@ class Lr {
|
|
|
5876
5909
|
}
|
|
5877
5910
|
}
|
|
5878
5911
|
|
|
5879
|
-
class
|
|
5912
|
+
class jr {
|
|
5880
5913
|
/** @hideconstructor */
|
|
5881
5914
|
constructor(t, n) {
|
|
5882
|
-
this._firestore = t, this._transaction = n, this._dataReader =
|
|
5915
|
+
this._firestore = t, this._transaction = n, this._dataReader = De(t);
|
|
5883
5916
|
}
|
|
5884
5917
|
/**
|
|
5885
5918
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
@@ -5887,25 +5920,25 @@ class Mr {
|
|
|
5887
5920
|
* @param documentRef - A reference to the document to be read.
|
|
5888
5921
|
* @returns A `DocumentSnapshot` with the read data.
|
|
5889
5922
|
*/ get(t) {
|
|
5890
|
-
const n =
|
|
5923
|
+
const n = xr(t, this._firestore), e = new br(this._firestore);
|
|
5891
5924
|
return this._transaction.lookup([ n._key ]).then((t => {
|
|
5892
5925
|
if (!t || 1 !== t.length) return v();
|
|
5893
5926
|
const r = t[0];
|
|
5894
|
-
if (r.isFoundDocument()) return new
|
|
5895
|
-
if (r.isNoDocument()) return new
|
|
5927
|
+
if (r.isFoundDocument()) return new Ke(this._firestore, e, r.key, r, n.converter);
|
|
5928
|
+
if (r.isNoDocument()) return new Ke(this._firestore, e, n._key, null, n.converter);
|
|
5896
5929
|
throw v();
|
|
5897
5930
|
}));
|
|
5898
5931
|
}
|
|
5899
5932
|
set(t, n, e) {
|
|
5900
|
-
const r =
|
|
5933
|
+
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);
|
|
5901
5934
|
return this._transaction.set(r._key, i), this;
|
|
5902
5935
|
}
|
|
5903
5936
|
update(t, n, e, ...r) {
|
|
5904
|
-
const s =
|
|
5937
|
+
const s = xr(t, this._firestore);
|
|
5905
5938
|
// For Compat types, we have to "extract" the underlying types before
|
|
5906
5939
|
// performing validation.
|
|
5907
5940
|
let i;
|
|
5908
|
-
return i = "string" == typeof (n = l(n)) || n instanceof
|
|
5941
|
+
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),
|
|
5909
5942
|
this._transaction.update(s._key, i), this;
|
|
5910
5943
|
}
|
|
5911
5944
|
/**
|
|
@@ -5914,7 +5947,7 @@ class Mr {
|
|
|
5914
5947
|
* @param documentRef - A reference to the document to be deleted.
|
|
5915
5948
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
5916
5949
|
*/ delete(t) {
|
|
5917
|
-
const n =
|
|
5950
|
+
const n = xr(t, this._firestore);
|
|
5918
5951
|
return this._transaction.delete(n._key), this;
|
|
5919
5952
|
}
|
|
5920
5953
|
}
|
|
@@ -5935,9 +5968,9 @@ class Mr {
|
|
|
5935
5968
|
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
5936
5969
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
5937
5970
|
* rejected promise with the corresponding failure error is returned.
|
|
5938
|
-
*/ function
|
|
5939
|
-
const e =
|
|
5940
|
-
return new
|
|
5971
|
+
*/ function Mr(t, n) {
|
|
5972
|
+
const e = se(t = ut(t, oe)), r = new j;
|
|
5973
|
+
return new Cr(new Ur, e, (e => n(new jr(t, e))), r).run(), r.promise;
|
|
5941
5974
|
}
|
|
5942
5975
|
|
|
5943
5976
|
/**
|
|
@@ -5950,11 +5983,11 @@ class Mr {
|
|
|
5950
5983
|
*/ !function(t) {
|
|
5951
5984
|
d = t;
|
|
5952
5985
|
}(`${s}_lite`), e(new i("firestore/lite", ((t, {options: n}) => {
|
|
5953
|
-
const e = t.getProvider("app").getImmediate(), r = new
|
|
5986
|
+
const e = t.getProvider("app").getImmediate(), r = new oe(e, new G(t.getProvider("auth-internal")), new H(t.getProvider("app-check-internal")));
|
|
5954
5987
|
return n && r._setSettings(n), r;
|
|
5955
5988
|
}), "PUBLIC")),
|
|
5956
5989
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5957
|
-
r("firestore-lite", "3.4.
|
|
5990
|
+
r("firestore-lite", "3.4.5-canary.8ac8fb099", "rn"), r("firestore-lite", "3.4.5-canary.8ac8fb099", "esm2017");
|
|
5958
5991
|
|
|
5959
|
-
export {
|
|
5992
|
+
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 };
|
|
5960
5993
|
//# sourceMappingURL=index.rn.esm2017.js.map
|