@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
package/dist/lite/index.node.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { FirebaseError, createMockUserToken, getModularInstance } from '@firebas
|
|
|
6
6
|
import nodeFetch from 'node-fetch';
|
|
7
7
|
import { randomBytes as randomBytes$1 } from 'crypto';
|
|
8
8
|
|
|
9
|
-
const version$1 = "3.4.
|
|
9
|
+
const version$1 = "3.4.5-canary.8ac8fb099";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @license
|
|
@@ -59,7 +59,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
|
|
|
59
59
|
User.FIRST_PARTY = new User('first-party-uid');
|
|
60
60
|
User.MOCK_USER = new User('mock-user');
|
|
61
61
|
|
|
62
|
-
const version = "9.6.
|
|
62
|
+
const version = "9.6.7-canary.8ac8fb099";
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* @license
|
|
@@ -658,6 +658,9 @@ class DatabaseId {
|
|
|
658
658
|
this.projectId = projectId;
|
|
659
659
|
this.database = database ? database : DEFAULT_DATABASE_NAME;
|
|
660
660
|
}
|
|
661
|
+
static empty() {
|
|
662
|
+
return new DatabaseId('', '');
|
|
663
|
+
}
|
|
661
664
|
get isDefaultDatabase() {
|
|
662
665
|
return this.database === DEFAULT_DATABASE_NAME;
|
|
663
666
|
}
|
|
@@ -971,11 +974,25 @@ class DocumentKey {
|
|
|
971
974
|
static fromName(name) {
|
|
972
975
|
return new DocumentKey(ResourcePath.fromString(name).popFirst(5));
|
|
973
976
|
}
|
|
977
|
+
static empty() {
|
|
978
|
+
return new DocumentKey(ResourcePath.emptyPath());
|
|
979
|
+
}
|
|
980
|
+
get collectionGroup() {
|
|
981
|
+
return this.path.popLast().lastSegment();
|
|
982
|
+
}
|
|
974
983
|
/** Returns true if the document is in the specified collectionId. */
|
|
975
984
|
hasCollectionId(collectionId) {
|
|
976
985
|
return (this.path.length >= 2 &&
|
|
977
986
|
this.path.get(this.path.length - 2) === collectionId);
|
|
978
987
|
}
|
|
988
|
+
/** Returns the collection group (i.e. the name of the parent collection) for this key. */
|
|
989
|
+
getCollectionGroup() {
|
|
990
|
+
return this.path.get(this.path.length - 2);
|
|
991
|
+
}
|
|
992
|
+
/** Returns the fully qualified path to the parent collection. */
|
|
993
|
+
getCollectionPath() {
|
|
994
|
+
return this.path.popLast();
|
|
995
|
+
}
|
|
979
996
|
isEqual(other) {
|
|
980
997
|
return (other !== null && ResourcePath.comparator(this.path, other.path) === 0);
|
|
981
998
|
}
|
|
@@ -1864,17 +1881,15 @@ class FieldMask {
|
|
|
1864
1881
|
* See the License for the specific language governing permissions and
|
|
1865
1882
|
* limitations under the License.
|
|
1866
1883
|
*/
|
|
1884
|
+
/** Converts a Base64 encoded string to a binary string. */
|
|
1867
1885
|
function decodeBase64(encoded) {
|
|
1868
|
-
//
|
|
1869
|
-
//
|
|
1870
|
-
|
|
1871
|
-
throw new FirestoreError(Code.INVALID_ARGUMENT, 'Not a valid Base64 string: ' + encoded);
|
|
1872
|
-
}
|
|
1873
|
-
return new Buffer(encoded, 'base64').toString('binary');
|
|
1886
|
+
// Note: We used to validate the base64 string here via a regular expression.
|
|
1887
|
+
// This was removed to improve the performance of indexing.
|
|
1888
|
+
return Buffer.from(encoded, 'base64').toString('binary');
|
|
1874
1889
|
}
|
|
1875
1890
|
/** Converts a binary string to a Base64 encoded string. */
|
|
1876
1891
|
function encodeBase64(raw) {
|
|
1877
|
-
return
|
|
1892
|
+
return Buffer.from(raw, 'binary').toString('base64');
|
|
1878
1893
|
}
|
|
1879
1894
|
|
|
1880
1895
|
/**
|
|
@@ -1911,6 +1926,8 @@ class ByteString {
|
|
|
1911
1926
|
return new ByteString(binaryString);
|
|
1912
1927
|
}
|
|
1913
1928
|
static fromUint8Array(array) {
|
|
1929
|
+
// TODO(indexing); Remove the copy of the byte string here as this method
|
|
1930
|
+
// is frequently called during indexing.
|
|
1914
1931
|
const binaryString = binaryStringFromUint8Array(array);
|
|
1915
1932
|
return new ByteString(binaryString);
|
|
1916
1933
|
}
|
|
@@ -2165,6 +2182,7 @@ function isSafeInteger(value) {
|
|
|
2165
2182
|
* See the License for the specific language governing permissions and
|
|
2166
2183
|
* limitations under the License.
|
|
2167
2184
|
*/
|
|
2185
|
+
const MAX_VALUE_TYPE = '__max__';
|
|
2168
2186
|
/** Extracts the backend's type order for the provided value. */
|
|
2169
2187
|
function typeOrder(value) {
|
|
2170
2188
|
if ('nullValue' in value) {
|
|
@@ -2198,6 +2216,9 @@ function typeOrder(value) {
|
|
|
2198
2216
|
if (isServerTimestamp(value)) {
|
|
2199
2217
|
return 4 /* ServerTimestampValue */;
|
|
2200
2218
|
}
|
|
2219
|
+
else if (isMaxValue(value)) {
|
|
2220
|
+
return 9 /* ArrayValue */;
|
|
2221
|
+
}
|
|
2201
2222
|
return 10 /* ObjectValue */;
|
|
2202
2223
|
}
|
|
2203
2224
|
else {
|
|
@@ -2237,6 +2258,8 @@ function valueEquals(left, right) {
|
|
|
2237
2258
|
return arrayEquals(left.arrayValue.values || [], right.arrayValue.values || [], valueEquals);
|
|
2238
2259
|
case 10 /* ObjectValue */:
|
|
2239
2260
|
return objectEquals(left, right);
|
|
2261
|
+
case 9007199254740991 /* MaxValue */:
|
|
2262
|
+
return true;
|
|
2240
2263
|
default:
|
|
2241
2264
|
return fail();
|
|
2242
2265
|
}
|
|
@@ -2309,6 +2332,7 @@ function valueCompare(left, right) {
|
|
|
2309
2332
|
}
|
|
2310
2333
|
switch (leftType) {
|
|
2311
2334
|
case 0 /* NullValue */:
|
|
2335
|
+
case 9007199254740991 /* MaxValue */:
|
|
2312
2336
|
return 0;
|
|
2313
2337
|
case 1 /* BooleanValue */:
|
|
2314
2338
|
return primitiveComparator(left.booleanValue, right.booleanValue);
|
|
@@ -2473,6 +2497,11 @@ function deepClone(source) {
|
|
|
2473
2497
|
else {
|
|
2474
2498
|
return Object.assign({}, source);
|
|
2475
2499
|
}
|
|
2500
|
+
}
|
|
2501
|
+
/** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */
|
|
2502
|
+
function isMaxValue(value) {
|
|
2503
|
+
return ((((value.mapValue || {}).fields || {})['__type__'] || {}).stringValue ===
|
|
2504
|
+
MAX_VALUE_TYPE);
|
|
2476
2505
|
}
|
|
2477
2506
|
|
|
2478
2507
|
/**
|
|
@@ -2638,10 +2667,11 @@ class ObjectValue {
|
|
|
2638
2667
|
* from all views.
|
|
2639
2668
|
*/
|
|
2640
2669
|
class MutableDocument {
|
|
2641
|
-
constructor(key, documentType, version, data, documentState) {
|
|
2670
|
+
constructor(key, documentType, version, readTime, data, documentState) {
|
|
2642
2671
|
this.key = key;
|
|
2643
2672
|
this.documentType = documentType;
|
|
2644
2673
|
this.version = version;
|
|
2674
|
+
this.readTime = readTime;
|
|
2645
2675
|
this.data = data;
|
|
2646
2676
|
this.documentState = documentState;
|
|
2647
2677
|
}
|
|
@@ -2650,18 +2680,18 @@ class MutableDocument {
|
|
|
2650
2680
|
* base document for mutations.
|
|
2651
2681
|
*/
|
|
2652
2682
|
static newInvalidDocument(documentKey) {
|
|
2653
|
-
return new MutableDocument(documentKey, 0 /* INVALID */, SnapshotVersion.min(), ObjectValue.empty(), 0 /* SYNCED */);
|
|
2683
|
+
return new MutableDocument(documentKey, 0 /* INVALID */, SnapshotVersion.min(), SnapshotVersion.min(), ObjectValue.empty(), 0 /* SYNCED */);
|
|
2654
2684
|
}
|
|
2655
2685
|
/**
|
|
2656
2686
|
* Creates a new document that is known to exist with the given data at the
|
|
2657
2687
|
* given version.
|
|
2658
2688
|
*/
|
|
2659
2689
|
static newFoundDocument(documentKey, version, value) {
|
|
2660
|
-
return new MutableDocument(documentKey, 1 /* FOUND_DOCUMENT */, version, value, 0 /* SYNCED */);
|
|
2690
|
+
return new MutableDocument(documentKey, 1 /* FOUND_DOCUMENT */, version, SnapshotVersion.min(), value, 0 /* SYNCED */);
|
|
2661
2691
|
}
|
|
2662
2692
|
/** Creates a new document that is known to not exist at the given version. */
|
|
2663
2693
|
static newNoDocument(documentKey, version) {
|
|
2664
|
-
return new MutableDocument(documentKey, 2 /* NO_DOCUMENT */, version, ObjectValue.empty(), 0 /* SYNCED */);
|
|
2694
|
+
return new MutableDocument(documentKey, 2 /* NO_DOCUMENT */, version, SnapshotVersion.min(), ObjectValue.empty(), 0 /* SYNCED */);
|
|
2665
2695
|
}
|
|
2666
2696
|
/**
|
|
2667
2697
|
* Creates a new document that is known to exist at the given version but
|
|
@@ -2669,7 +2699,7 @@ class MutableDocument {
|
|
|
2669
2699
|
* base document).
|
|
2670
2700
|
*/
|
|
2671
2701
|
static newUnknownDocument(documentKey, version) {
|
|
2672
|
-
return new MutableDocument(documentKey, 3 /* UNKNOWN_DOCUMENT */, version, ObjectValue.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
2702
|
+
return new MutableDocument(documentKey, 3 /* UNKNOWN_DOCUMENT */, version, SnapshotVersion.min(), ObjectValue.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
2673
2703
|
}
|
|
2674
2704
|
/**
|
|
2675
2705
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -2713,6 +2743,10 @@ class MutableDocument {
|
|
|
2713
2743
|
this.documentState = 1 /* HAS_LOCAL_MUTATIONS */;
|
|
2714
2744
|
return this;
|
|
2715
2745
|
}
|
|
2746
|
+
setReadTime(readTime) {
|
|
2747
|
+
this.readTime = readTime;
|
|
2748
|
+
return this;
|
|
2749
|
+
}
|
|
2716
2750
|
get hasLocalMutations() {
|
|
2717
2751
|
return this.documentState === 1 /* HAS_LOCAL_MUTATIONS */;
|
|
2718
2752
|
}
|
|
@@ -2743,7 +2777,7 @@ class MutableDocument {
|
|
|
2743
2777
|
this.data.isEqual(other.data));
|
|
2744
2778
|
}
|
|
2745
2779
|
mutableCopy() {
|
|
2746
|
-
return new MutableDocument(this.key, this.documentType, this.version, this.data.clone(), this.documentState);
|
|
2780
|
+
return new MutableDocument(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState);
|
|
2747
2781
|
}
|
|
2748
2782
|
toString() {
|
|
2749
2783
|
return (`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, ` +
|
|
@@ -3009,9 +3043,9 @@ class ArrayContainsAnyFilter extends FieldFilter {
|
|
|
3009
3043
|
* just after the provided values.
|
|
3010
3044
|
*/
|
|
3011
3045
|
class Bound {
|
|
3012
|
-
constructor(position,
|
|
3046
|
+
constructor(position, inclusive) {
|
|
3013
3047
|
this.position = position;
|
|
3014
|
-
this.
|
|
3048
|
+
this.inclusive = inclusive;
|
|
3015
3049
|
}
|
|
3016
3050
|
}
|
|
3017
3051
|
/**
|
|
@@ -3033,7 +3067,7 @@ function boundEquals(left, right) {
|
|
|
3033
3067
|
else if (right === null) {
|
|
3034
3068
|
return false;
|
|
3035
3069
|
}
|
|
3036
|
-
if (left.
|
|
3070
|
+
if (left.inclusive !== right.inclusive ||
|
|
3037
3071
|
left.position.length !== right.position.length) {
|
|
3038
3072
|
return false;
|
|
3039
3073
|
}
|
|
@@ -3198,10 +3232,10 @@ function queryToTarget(query) {
|
|
|
3198
3232
|
}
|
|
3199
3233
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
3200
3234
|
const startAt = queryImpl.endAt
|
|
3201
|
-
? new Bound(queryImpl.endAt.position, !queryImpl.endAt.
|
|
3235
|
+
? new Bound(queryImpl.endAt.position, !queryImpl.endAt.inclusive)
|
|
3202
3236
|
: null;
|
|
3203
3237
|
const endAt = queryImpl.startAt
|
|
3204
|
-
? new Bound(queryImpl.startAt.position, !queryImpl.startAt.
|
|
3238
|
+
? new Bound(queryImpl.startAt.position, !queryImpl.startAt.inclusive)
|
|
3205
3239
|
: null;
|
|
3206
3240
|
// Now return as a LimitType.First query.
|
|
3207
3241
|
queryImpl.memoizedTarget = newTarget(queryImpl.path, queryImpl.collectionGroup, orderBys, queryImpl.filters, queryImpl.limit, startAt, endAt);
|
|
@@ -3829,10 +3863,10 @@ function toQueryTarget(serializer, target) {
|
|
|
3829
3863
|
result.structuredQuery.limit = limit;
|
|
3830
3864
|
}
|
|
3831
3865
|
if (target.startAt) {
|
|
3832
|
-
result.structuredQuery.startAt =
|
|
3866
|
+
result.structuredQuery.startAt = toStartAtCursor(target.startAt);
|
|
3833
3867
|
}
|
|
3834
3868
|
if (target.endAt) {
|
|
3835
|
-
result.structuredQuery.endAt =
|
|
3869
|
+
result.structuredQuery.endAt = toEndAtCursor(target.endAt);
|
|
3836
3870
|
}
|
|
3837
3871
|
return result;
|
|
3838
3872
|
}
|
|
@@ -3854,9 +3888,15 @@ function toOrder(orderBys) {
|
|
|
3854
3888
|
}
|
|
3855
3889
|
return orderBys.map(order => toPropertyOrder(order));
|
|
3856
3890
|
}
|
|
3857
|
-
function
|
|
3891
|
+
function toStartAtCursor(cursor) {
|
|
3892
|
+
return {
|
|
3893
|
+
before: cursor.inclusive,
|
|
3894
|
+
values: cursor.position
|
|
3895
|
+
};
|
|
3896
|
+
}
|
|
3897
|
+
function toEndAtCursor(cursor) {
|
|
3858
3898
|
return {
|
|
3859
|
-
before: cursor.
|
|
3899
|
+
before: !cursor.inclusive,
|
|
3860
3900
|
values: cursor.position
|
|
3861
3901
|
};
|
|
3862
3902
|
}
|
|
@@ -6133,51 +6173,53 @@ function limitToLast(limit) {
|
|
|
6133
6173
|
return new QueryLimitConstraint('limitToLast', limit, "L" /* Last */);
|
|
6134
6174
|
}
|
|
6135
6175
|
class QueryStartAtConstraint extends QueryConstraint {
|
|
6136
|
-
constructor(type, _docOrFields,
|
|
6176
|
+
constructor(type, _docOrFields, _inclusive) {
|
|
6137
6177
|
super();
|
|
6138
6178
|
this.type = type;
|
|
6139
6179
|
this._docOrFields = _docOrFields;
|
|
6140
|
-
this.
|
|
6180
|
+
this._inclusive = _inclusive;
|
|
6141
6181
|
}
|
|
6142
6182
|
_apply(query) {
|
|
6143
|
-
const bound = newQueryBoundFromDocOrFields(query, this.type, this._docOrFields, this.
|
|
6183
|
+
const bound = newQueryBoundFromDocOrFields(query, this.type, this._docOrFields, this._inclusive);
|
|
6144
6184
|
return new Query(query.firestore, query.converter, queryWithStartAt(query._query, bound));
|
|
6145
6185
|
}
|
|
6146
6186
|
}
|
|
6147
6187
|
function startAt(...docOrFields) {
|
|
6148
|
-
return new QueryStartAtConstraint('startAt', docOrFields,
|
|
6188
|
+
return new QueryStartAtConstraint('startAt', docOrFields,
|
|
6189
|
+
/*inclusive=*/ true);
|
|
6149
6190
|
}
|
|
6150
6191
|
function startAfter(...docOrFields) {
|
|
6151
6192
|
return new QueryStartAtConstraint('startAfter', docOrFields,
|
|
6152
|
-
/*
|
|
6193
|
+
/*inclusive=*/ false);
|
|
6153
6194
|
}
|
|
6154
6195
|
class QueryEndAtConstraint extends QueryConstraint {
|
|
6155
|
-
constructor(type, _docOrFields,
|
|
6196
|
+
constructor(type, _docOrFields, _inclusive) {
|
|
6156
6197
|
super();
|
|
6157
6198
|
this.type = type;
|
|
6158
6199
|
this._docOrFields = _docOrFields;
|
|
6159
|
-
this.
|
|
6200
|
+
this._inclusive = _inclusive;
|
|
6160
6201
|
}
|
|
6161
6202
|
_apply(query) {
|
|
6162
|
-
const bound = newQueryBoundFromDocOrFields(query, this.type, this._docOrFields, this.
|
|
6203
|
+
const bound = newQueryBoundFromDocOrFields(query, this.type, this._docOrFields, this._inclusive);
|
|
6163
6204
|
return new Query(query.firestore, query.converter, queryWithEndAt(query._query, bound));
|
|
6164
6205
|
}
|
|
6165
6206
|
}
|
|
6166
6207
|
function endBefore(...docOrFields) {
|
|
6167
|
-
return new QueryEndAtConstraint('endBefore', docOrFields,
|
|
6208
|
+
return new QueryEndAtConstraint('endBefore', docOrFields,
|
|
6209
|
+
/*inclusive=*/ false);
|
|
6168
6210
|
}
|
|
6169
6211
|
function endAt(...docOrFields) {
|
|
6170
|
-
return new QueryEndAtConstraint('endAt', docOrFields, /*
|
|
6212
|
+
return new QueryEndAtConstraint('endAt', docOrFields, /*inclusive=*/ true);
|
|
6171
6213
|
}
|
|
6172
6214
|
/** Helper function to create a bound from a document or fields */
|
|
6173
|
-
function newQueryBoundFromDocOrFields(query, methodName, docOrFields,
|
|
6215
|
+
function newQueryBoundFromDocOrFields(query, methodName, docOrFields, inclusive) {
|
|
6174
6216
|
docOrFields[0] = getModularInstance(docOrFields[0]);
|
|
6175
6217
|
if (docOrFields[0] instanceof DocumentSnapshot) {
|
|
6176
|
-
return newQueryBoundFromDocument(query._query, query.firestore._databaseId, methodName, docOrFields[0]._document,
|
|
6218
|
+
return newQueryBoundFromDocument(query._query, query.firestore._databaseId, methodName, docOrFields[0]._document, inclusive);
|
|
6177
6219
|
}
|
|
6178
6220
|
else {
|
|
6179
6221
|
const reader = newUserDataReader(query.firestore);
|
|
6180
|
-
return newQueryBoundFromFields(query._query, query.firestore._databaseId, reader, methodName, docOrFields,
|
|
6222
|
+
return newQueryBoundFromFields(query._query, query.firestore._databaseId, reader, methodName, docOrFields, inclusive);
|
|
6181
6223
|
}
|
|
6182
6224
|
}
|
|
6183
6225
|
function newQueryFilter(query, methodName, dataReader, databaseId, fieldPath, op, value) {
|
|
@@ -6235,7 +6277,7 @@ function newQueryOrderBy(query, fieldPath, direction) {
|
|
|
6235
6277
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
6236
6278
|
* server timestamp.
|
|
6237
6279
|
*/
|
|
6238
|
-
function newQueryBoundFromDocument(query, databaseId, methodName, doc,
|
|
6280
|
+
function newQueryBoundFromDocument(query, databaseId, methodName, doc, inclusive) {
|
|
6239
6281
|
if (!doc) {
|
|
6240
6282
|
throw new FirestoreError(Code.NOT_FOUND, `Can't use a DocumentSnapshot that doesn't exist for ` +
|
|
6241
6283
|
`${methodName}().`);
|
|
@@ -6272,12 +6314,12 @@ function newQueryBoundFromDocument(query, databaseId, methodName, doc, before) {
|
|
|
6272
6314
|
}
|
|
6273
6315
|
}
|
|
6274
6316
|
}
|
|
6275
|
-
return new Bound(components,
|
|
6317
|
+
return new Bound(components, inclusive);
|
|
6276
6318
|
}
|
|
6277
6319
|
/**
|
|
6278
6320
|
* Converts a list of field values to a `Bound` for the given query.
|
|
6279
6321
|
*/
|
|
6280
|
-
function newQueryBoundFromFields(query, databaseId, dataReader, methodName, values,
|
|
6322
|
+
function newQueryBoundFromFields(query, databaseId, dataReader, methodName, values, inclusive) {
|
|
6281
6323
|
// Use explicit order by's because it has to match the query the user made
|
|
6282
6324
|
const orderBy = query.explicitOrderBy;
|
|
6283
6325
|
if (values.length > orderBy.length) {
|
|
@@ -6314,7 +6356,7 @@ function newQueryBoundFromFields(query, databaseId, dataReader, methodName, valu
|
|
|
6314
6356
|
components.push(wrapped);
|
|
6315
6357
|
}
|
|
6316
6358
|
}
|
|
6317
|
-
return new Bound(components,
|
|
6359
|
+
return new Bound(components, inclusive);
|
|
6318
6360
|
}
|
|
6319
6361
|
/**
|
|
6320
6362
|
* Parses the given `documentIdValue` into a `ReferenceValue`, throwing
|