@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
|
@@ -14,7 +14,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
14
14
|
|
|
15
15
|
var nodeFetch__default = /*#__PURE__*/_interopDefaultLegacy(nodeFetch);
|
|
16
16
|
|
|
17
|
-
const version$1 = "3.4.
|
|
17
|
+
const version$1 = "3.4.5-canary.8ac8fb099";
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* @license
|
|
@@ -67,7 +67,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
|
|
|
67
67
|
User.FIRST_PARTY = new User('first-party-uid');
|
|
68
68
|
User.MOCK_USER = new User('mock-user');
|
|
69
69
|
|
|
70
|
-
const version = "9.6.
|
|
70
|
+
const version = "9.6.7-canary.8ac8fb099";
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* @license
|
|
@@ -666,6 +666,9 @@ class DatabaseId {
|
|
|
666
666
|
this.projectId = projectId;
|
|
667
667
|
this.database = database ? database : DEFAULT_DATABASE_NAME;
|
|
668
668
|
}
|
|
669
|
+
static empty() {
|
|
670
|
+
return new DatabaseId('', '');
|
|
671
|
+
}
|
|
669
672
|
get isDefaultDatabase() {
|
|
670
673
|
return this.database === DEFAULT_DATABASE_NAME;
|
|
671
674
|
}
|
|
@@ -979,11 +982,25 @@ class DocumentKey {
|
|
|
979
982
|
static fromName(name) {
|
|
980
983
|
return new DocumentKey(ResourcePath.fromString(name).popFirst(5));
|
|
981
984
|
}
|
|
985
|
+
static empty() {
|
|
986
|
+
return new DocumentKey(ResourcePath.emptyPath());
|
|
987
|
+
}
|
|
988
|
+
get collectionGroup() {
|
|
989
|
+
return this.path.popLast().lastSegment();
|
|
990
|
+
}
|
|
982
991
|
/** Returns true if the document is in the specified collectionId. */
|
|
983
992
|
hasCollectionId(collectionId) {
|
|
984
993
|
return (this.path.length >= 2 &&
|
|
985
994
|
this.path.get(this.path.length - 2) === collectionId);
|
|
986
995
|
}
|
|
996
|
+
/** Returns the collection group (i.e. the name of the parent collection) for this key. */
|
|
997
|
+
getCollectionGroup() {
|
|
998
|
+
return this.path.get(this.path.length - 2);
|
|
999
|
+
}
|
|
1000
|
+
/** Returns the fully qualified path to the parent collection. */
|
|
1001
|
+
getCollectionPath() {
|
|
1002
|
+
return this.path.popLast();
|
|
1003
|
+
}
|
|
987
1004
|
isEqual(other) {
|
|
988
1005
|
return (other !== null && ResourcePath.comparator(this.path, other.path) === 0);
|
|
989
1006
|
}
|
|
@@ -1872,17 +1889,15 @@ class FieldMask {
|
|
|
1872
1889
|
* See the License for the specific language governing permissions and
|
|
1873
1890
|
* limitations under the License.
|
|
1874
1891
|
*/
|
|
1892
|
+
/** Converts a Base64 encoded string to a binary string. */
|
|
1875
1893
|
function decodeBase64(encoded) {
|
|
1876
|
-
//
|
|
1877
|
-
//
|
|
1878
|
-
|
|
1879
|
-
throw new FirestoreError(Code.INVALID_ARGUMENT, 'Not a valid Base64 string: ' + encoded);
|
|
1880
|
-
}
|
|
1881
|
-
return new Buffer(encoded, 'base64').toString('binary');
|
|
1894
|
+
// Note: We used to validate the base64 string here via a regular expression.
|
|
1895
|
+
// This was removed to improve the performance of indexing.
|
|
1896
|
+
return Buffer.from(encoded, 'base64').toString('binary');
|
|
1882
1897
|
}
|
|
1883
1898
|
/** Converts a binary string to a Base64 encoded string. */
|
|
1884
1899
|
function encodeBase64(raw) {
|
|
1885
|
-
return
|
|
1900
|
+
return Buffer.from(raw, 'binary').toString('base64');
|
|
1886
1901
|
}
|
|
1887
1902
|
|
|
1888
1903
|
/**
|
|
@@ -1919,6 +1934,8 @@ class ByteString {
|
|
|
1919
1934
|
return new ByteString(binaryString);
|
|
1920
1935
|
}
|
|
1921
1936
|
static fromUint8Array(array) {
|
|
1937
|
+
// TODO(indexing); Remove the copy of the byte string here as this method
|
|
1938
|
+
// is frequently called during indexing.
|
|
1922
1939
|
const binaryString = binaryStringFromUint8Array(array);
|
|
1923
1940
|
return new ByteString(binaryString);
|
|
1924
1941
|
}
|
|
@@ -2173,6 +2190,7 @@ function isSafeInteger(value) {
|
|
|
2173
2190
|
* See the License for the specific language governing permissions and
|
|
2174
2191
|
* limitations under the License.
|
|
2175
2192
|
*/
|
|
2193
|
+
const MAX_VALUE_TYPE = '__max__';
|
|
2176
2194
|
/** Extracts the backend's type order for the provided value. */
|
|
2177
2195
|
function typeOrder(value) {
|
|
2178
2196
|
if ('nullValue' in value) {
|
|
@@ -2206,6 +2224,9 @@ function typeOrder(value) {
|
|
|
2206
2224
|
if (isServerTimestamp(value)) {
|
|
2207
2225
|
return 4 /* ServerTimestampValue */;
|
|
2208
2226
|
}
|
|
2227
|
+
else if (isMaxValue(value)) {
|
|
2228
|
+
return 9 /* ArrayValue */;
|
|
2229
|
+
}
|
|
2209
2230
|
return 10 /* ObjectValue */;
|
|
2210
2231
|
}
|
|
2211
2232
|
else {
|
|
@@ -2245,6 +2266,8 @@ function valueEquals(left, right) {
|
|
|
2245
2266
|
return arrayEquals(left.arrayValue.values || [], right.arrayValue.values || [], valueEquals);
|
|
2246
2267
|
case 10 /* ObjectValue */:
|
|
2247
2268
|
return objectEquals(left, right);
|
|
2269
|
+
case 9007199254740991 /* MaxValue */:
|
|
2270
|
+
return true;
|
|
2248
2271
|
default:
|
|
2249
2272
|
return fail();
|
|
2250
2273
|
}
|
|
@@ -2317,6 +2340,7 @@ function valueCompare(left, right) {
|
|
|
2317
2340
|
}
|
|
2318
2341
|
switch (leftType) {
|
|
2319
2342
|
case 0 /* NullValue */:
|
|
2343
|
+
case 9007199254740991 /* MaxValue */:
|
|
2320
2344
|
return 0;
|
|
2321
2345
|
case 1 /* BooleanValue */:
|
|
2322
2346
|
return primitiveComparator(left.booleanValue, right.booleanValue);
|
|
@@ -2481,6 +2505,11 @@ function deepClone(source) {
|
|
|
2481
2505
|
else {
|
|
2482
2506
|
return Object.assign({}, source);
|
|
2483
2507
|
}
|
|
2508
|
+
}
|
|
2509
|
+
/** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */
|
|
2510
|
+
function isMaxValue(value) {
|
|
2511
|
+
return ((((value.mapValue || {}).fields || {})['__type__'] || {}).stringValue ===
|
|
2512
|
+
MAX_VALUE_TYPE);
|
|
2484
2513
|
}
|
|
2485
2514
|
|
|
2486
2515
|
/**
|
|
@@ -2646,10 +2675,11 @@ class ObjectValue {
|
|
|
2646
2675
|
* from all views.
|
|
2647
2676
|
*/
|
|
2648
2677
|
class MutableDocument {
|
|
2649
|
-
constructor(key, documentType, version, data, documentState) {
|
|
2678
|
+
constructor(key, documentType, version, readTime, data, documentState) {
|
|
2650
2679
|
this.key = key;
|
|
2651
2680
|
this.documentType = documentType;
|
|
2652
2681
|
this.version = version;
|
|
2682
|
+
this.readTime = readTime;
|
|
2653
2683
|
this.data = data;
|
|
2654
2684
|
this.documentState = documentState;
|
|
2655
2685
|
}
|
|
@@ -2658,18 +2688,18 @@ class MutableDocument {
|
|
|
2658
2688
|
* base document for mutations.
|
|
2659
2689
|
*/
|
|
2660
2690
|
static newInvalidDocument(documentKey) {
|
|
2661
|
-
return new MutableDocument(documentKey, 0 /* INVALID */, SnapshotVersion.min(), ObjectValue.empty(), 0 /* SYNCED */);
|
|
2691
|
+
return new MutableDocument(documentKey, 0 /* INVALID */, SnapshotVersion.min(), SnapshotVersion.min(), ObjectValue.empty(), 0 /* SYNCED */);
|
|
2662
2692
|
}
|
|
2663
2693
|
/**
|
|
2664
2694
|
* Creates a new document that is known to exist with the given data at the
|
|
2665
2695
|
* given version.
|
|
2666
2696
|
*/
|
|
2667
2697
|
static newFoundDocument(documentKey, version, value) {
|
|
2668
|
-
return new MutableDocument(documentKey, 1 /* FOUND_DOCUMENT */, version, value, 0 /* SYNCED */);
|
|
2698
|
+
return new MutableDocument(documentKey, 1 /* FOUND_DOCUMENT */, version, SnapshotVersion.min(), value, 0 /* SYNCED */);
|
|
2669
2699
|
}
|
|
2670
2700
|
/** Creates a new document that is known to not exist at the given version. */
|
|
2671
2701
|
static newNoDocument(documentKey, version) {
|
|
2672
|
-
return new MutableDocument(documentKey, 2 /* NO_DOCUMENT */, version, ObjectValue.empty(), 0 /* SYNCED */);
|
|
2702
|
+
return new MutableDocument(documentKey, 2 /* NO_DOCUMENT */, version, SnapshotVersion.min(), ObjectValue.empty(), 0 /* SYNCED */);
|
|
2673
2703
|
}
|
|
2674
2704
|
/**
|
|
2675
2705
|
* Creates a new document that is known to exist at the given version but
|
|
@@ -2677,7 +2707,7 @@ class MutableDocument {
|
|
|
2677
2707
|
* base document).
|
|
2678
2708
|
*/
|
|
2679
2709
|
static newUnknownDocument(documentKey, version) {
|
|
2680
|
-
return new MutableDocument(documentKey, 3 /* UNKNOWN_DOCUMENT */, version, ObjectValue.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
2710
|
+
return new MutableDocument(documentKey, 3 /* UNKNOWN_DOCUMENT */, version, SnapshotVersion.min(), ObjectValue.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
2681
2711
|
}
|
|
2682
2712
|
/**
|
|
2683
2713
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -2721,6 +2751,10 @@ class MutableDocument {
|
|
|
2721
2751
|
this.documentState = 1 /* HAS_LOCAL_MUTATIONS */;
|
|
2722
2752
|
return this;
|
|
2723
2753
|
}
|
|
2754
|
+
setReadTime(readTime) {
|
|
2755
|
+
this.readTime = readTime;
|
|
2756
|
+
return this;
|
|
2757
|
+
}
|
|
2724
2758
|
get hasLocalMutations() {
|
|
2725
2759
|
return this.documentState === 1 /* HAS_LOCAL_MUTATIONS */;
|
|
2726
2760
|
}
|
|
@@ -2751,7 +2785,7 @@ class MutableDocument {
|
|
|
2751
2785
|
this.data.isEqual(other.data));
|
|
2752
2786
|
}
|
|
2753
2787
|
mutableCopy() {
|
|
2754
|
-
return new MutableDocument(this.key, this.documentType, this.version, this.data.clone(), this.documentState);
|
|
2788
|
+
return new MutableDocument(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState);
|
|
2755
2789
|
}
|
|
2756
2790
|
toString() {
|
|
2757
2791
|
return (`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, ` +
|
|
@@ -3017,9 +3051,9 @@ class ArrayContainsAnyFilter extends FieldFilter {
|
|
|
3017
3051
|
* just after the provided values.
|
|
3018
3052
|
*/
|
|
3019
3053
|
class Bound {
|
|
3020
|
-
constructor(position,
|
|
3054
|
+
constructor(position, inclusive) {
|
|
3021
3055
|
this.position = position;
|
|
3022
|
-
this.
|
|
3056
|
+
this.inclusive = inclusive;
|
|
3023
3057
|
}
|
|
3024
3058
|
}
|
|
3025
3059
|
/**
|
|
@@ -3041,7 +3075,7 @@ function boundEquals(left, right) {
|
|
|
3041
3075
|
else if (right === null) {
|
|
3042
3076
|
return false;
|
|
3043
3077
|
}
|
|
3044
|
-
if (left.
|
|
3078
|
+
if (left.inclusive !== right.inclusive ||
|
|
3045
3079
|
left.position.length !== right.position.length) {
|
|
3046
3080
|
return false;
|
|
3047
3081
|
}
|
|
@@ -3206,10 +3240,10 @@ function queryToTarget(query) {
|
|
|
3206
3240
|
}
|
|
3207
3241
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
3208
3242
|
const startAt = queryImpl.endAt
|
|
3209
|
-
? new Bound(queryImpl.endAt.position, !queryImpl.endAt.
|
|
3243
|
+
? new Bound(queryImpl.endAt.position, !queryImpl.endAt.inclusive)
|
|
3210
3244
|
: null;
|
|
3211
3245
|
const endAt = queryImpl.startAt
|
|
3212
|
-
? new Bound(queryImpl.startAt.position, !queryImpl.startAt.
|
|
3246
|
+
? new Bound(queryImpl.startAt.position, !queryImpl.startAt.inclusive)
|
|
3213
3247
|
: null;
|
|
3214
3248
|
// Now return as a LimitType.First query.
|
|
3215
3249
|
queryImpl.memoizedTarget = newTarget(queryImpl.path, queryImpl.collectionGroup, orderBys, queryImpl.filters, queryImpl.limit, startAt, endAt);
|
|
@@ -3837,10 +3871,10 @@ function toQueryTarget(serializer, target) {
|
|
|
3837
3871
|
result.structuredQuery.limit = limit;
|
|
3838
3872
|
}
|
|
3839
3873
|
if (target.startAt) {
|
|
3840
|
-
result.structuredQuery.startAt =
|
|
3874
|
+
result.structuredQuery.startAt = toStartAtCursor(target.startAt);
|
|
3841
3875
|
}
|
|
3842
3876
|
if (target.endAt) {
|
|
3843
|
-
result.structuredQuery.endAt =
|
|
3877
|
+
result.structuredQuery.endAt = toEndAtCursor(target.endAt);
|
|
3844
3878
|
}
|
|
3845
3879
|
return result;
|
|
3846
3880
|
}
|
|
@@ -3862,9 +3896,15 @@ function toOrder(orderBys) {
|
|
|
3862
3896
|
}
|
|
3863
3897
|
return orderBys.map(order => toPropertyOrder(order));
|
|
3864
3898
|
}
|
|
3865
|
-
function
|
|
3899
|
+
function toStartAtCursor(cursor) {
|
|
3900
|
+
return {
|
|
3901
|
+
before: cursor.inclusive,
|
|
3902
|
+
values: cursor.position
|
|
3903
|
+
};
|
|
3904
|
+
}
|
|
3905
|
+
function toEndAtCursor(cursor) {
|
|
3866
3906
|
return {
|
|
3867
|
-
before: cursor.
|
|
3907
|
+
before: !cursor.inclusive,
|
|
3868
3908
|
values: cursor.position
|
|
3869
3909
|
};
|
|
3870
3910
|
}
|
|
@@ -6141,51 +6181,53 @@ function limitToLast(limit) {
|
|
|
6141
6181
|
return new QueryLimitConstraint('limitToLast', limit, "L" /* Last */);
|
|
6142
6182
|
}
|
|
6143
6183
|
class QueryStartAtConstraint extends QueryConstraint {
|
|
6144
|
-
constructor(type, _docOrFields,
|
|
6184
|
+
constructor(type, _docOrFields, _inclusive) {
|
|
6145
6185
|
super();
|
|
6146
6186
|
this.type = type;
|
|
6147
6187
|
this._docOrFields = _docOrFields;
|
|
6148
|
-
this.
|
|
6188
|
+
this._inclusive = _inclusive;
|
|
6149
6189
|
}
|
|
6150
6190
|
_apply(query) {
|
|
6151
|
-
const bound = newQueryBoundFromDocOrFields(query, this.type, this._docOrFields, this.
|
|
6191
|
+
const bound = newQueryBoundFromDocOrFields(query, this.type, this._docOrFields, this._inclusive);
|
|
6152
6192
|
return new Query(query.firestore, query.converter, queryWithStartAt(query._query, bound));
|
|
6153
6193
|
}
|
|
6154
6194
|
}
|
|
6155
6195
|
function startAt(...docOrFields) {
|
|
6156
|
-
return new QueryStartAtConstraint('startAt', docOrFields,
|
|
6196
|
+
return new QueryStartAtConstraint('startAt', docOrFields,
|
|
6197
|
+
/*inclusive=*/ true);
|
|
6157
6198
|
}
|
|
6158
6199
|
function startAfter(...docOrFields) {
|
|
6159
6200
|
return new QueryStartAtConstraint('startAfter', docOrFields,
|
|
6160
|
-
/*
|
|
6201
|
+
/*inclusive=*/ false);
|
|
6161
6202
|
}
|
|
6162
6203
|
class QueryEndAtConstraint extends QueryConstraint {
|
|
6163
|
-
constructor(type, _docOrFields,
|
|
6204
|
+
constructor(type, _docOrFields, _inclusive) {
|
|
6164
6205
|
super();
|
|
6165
6206
|
this.type = type;
|
|
6166
6207
|
this._docOrFields = _docOrFields;
|
|
6167
|
-
this.
|
|
6208
|
+
this._inclusive = _inclusive;
|
|
6168
6209
|
}
|
|
6169
6210
|
_apply(query) {
|
|
6170
|
-
const bound = newQueryBoundFromDocOrFields(query, this.type, this._docOrFields, this.
|
|
6211
|
+
const bound = newQueryBoundFromDocOrFields(query, this.type, this._docOrFields, this._inclusive);
|
|
6171
6212
|
return new Query(query.firestore, query.converter, queryWithEndAt(query._query, bound));
|
|
6172
6213
|
}
|
|
6173
6214
|
}
|
|
6174
6215
|
function endBefore(...docOrFields) {
|
|
6175
|
-
return new QueryEndAtConstraint('endBefore', docOrFields,
|
|
6216
|
+
return new QueryEndAtConstraint('endBefore', docOrFields,
|
|
6217
|
+
/*inclusive=*/ false);
|
|
6176
6218
|
}
|
|
6177
6219
|
function endAt(...docOrFields) {
|
|
6178
|
-
return new QueryEndAtConstraint('endAt', docOrFields, /*
|
|
6220
|
+
return new QueryEndAtConstraint('endAt', docOrFields, /*inclusive=*/ true);
|
|
6179
6221
|
}
|
|
6180
6222
|
/** Helper function to create a bound from a document or fields */
|
|
6181
|
-
function newQueryBoundFromDocOrFields(query, methodName, docOrFields,
|
|
6223
|
+
function newQueryBoundFromDocOrFields(query, methodName, docOrFields, inclusive) {
|
|
6182
6224
|
docOrFields[0] = util.getModularInstance(docOrFields[0]);
|
|
6183
6225
|
if (docOrFields[0] instanceof DocumentSnapshot) {
|
|
6184
|
-
return newQueryBoundFromDocument(query._query, query.firestore._databaseId, methodName, docOrFields[0]._document,
|
|
6226
|
+
return newQueryBoundFromDocument(query._query, query.firestore._databaseId, methodName, docOrFields[0]._document, inclusive);
|
|
6185
6227
|
}
|
|
6186
6228
|
else {
|
|
6187
6229
|
const reader = newUserDataReader(query.firestore);
|
|
6188
|
-
return newQueryBoundFromFields(query._query, query.firestore._databaseId, reader, methodName, docOrFields,
|
|
6230
|
+
return newQueryBoundFromFields(query._query, query.firestore._databaseId, reader, methodName, docOrFields, inclusive);
|
|
6189
6231
|
}
|
|
6190
6232
|
}
|
|
6191
6233
|
function newQueryFilter(query, methodName, dataReader, databaseId, fieldPath, op, value) {
|
|
@@ -6243,7 +6285,7 @@ function newQueryOrderBy(query, fieldPath, direction) {
|
|
|
6243
6285
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
6244
6286
|
* server timestamp.
|
|
6245
6287
|
*/
|
|
6246
|
-
function newQueryBoundFromDocument(query, databaseId, methodName, doc,
|
|
6288
|
+
function newQueryBoundFromDocument(query, databaseId, methodName, doc, inclusive) {
|
|
6247
6289
|
if (!doc) {
|
|
6248
6290
|
throw new FirestoreError(Code.NOT_FOUND, `Can't use a DocumentSnapshot that doesn't exist for ` +
|
|
6249
6291
|
`${methodName}().`);
|
|
@@ -6280,12 +6322,12 @@ function newQueryBoundFromDocument(query, databaseId, methodName, doc, before) {
|
|
|
6280
6322
|
}
|
|
6281
6323
|
}
|
|
6282
6324
|
}
|
|
6283
|
-
return new Bound(components,
|
|
6325
|
+
return new Bound(components, inclusive);
|
|
6284
6326
|
}
|
|
6285
6327
|
/**
|
|
6286
6328
|
* Converts a list of field values to a `Bound` for the given query.
|
|
6287
6329
|
*/
|
|
6288
|
-
function newQueryBoundFromFields(query, databaseId, dataReader, methodName, values,
|
|
6330
|
+
function newQueryBoundFromFields(query, databaseId, dataReader, methodName, values, inclusive) {
|
|
6289
6331
|
// Use explicit order by's because it has to match the query the user made
|
|
6290
6332
|
const orderBy = query.explicitOrderBy;
|
|
6291
6333
|
if (values.length > orderBy.length) {
|
|
@@ -6322,7 +6364,7 @@ function newQueryBoundFromFields(query, databaseId, dataReader, methodName, valu
|
|
|
6322
6364
|
components.push(wrapped);
|
|
6323
6365
|
}
|
|
6324
6366
|
}
|
|
6325
|
-
return new Bound(components,
|
|
6367
|
+
return new Bound(components, inclusive);
|
|
6326
6368
|
}
|
|
6327
6369
|
/**
|
|
6328
6370
|
* Parses the given `documentIdValue` into a `ReferenceValue`, throwing
|