@firebase/firestore 3.4.4 → 3.4.5-canary.09e62431f
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 +71 -0
- package/dist/firestore/src/local/index_manager.d.ts +52 -0
- package/dist/firestore/src/local/indexeddb_document_overlay_cache.d.ts +44 -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 +106 -437
- package/dist/firestore/src/local/indexeddb_sentinels.d.ts +238 -0
- package/dist/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
- package/dist/firestore/src/local/local_documents_view.d.ts +0 -1
- package/dist/firestore/src/local/local_serializer.d.ts +20 -3
- package/dist/firestore/src/local/memory_document_overlay_cache.d.ts +36 -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/collections.d.ts +7 -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/obj_map.d.ts +3 -0
- 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 +5421 -4355
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +5471 -4495
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +3056 -1181
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +3048 -1194
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +5469 -4445
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +272 -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 +71 -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 +44 -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 +106 -437
- package/dist/lite/firestore/src/local/indexeddb_sentinels.d.ts +238 -0
- package/dist/lite/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
- package/dist/lite/firestore/src/local/local_documents_view.d.ts +0 -1
- package/dist/lite/firestore/src/local/local_serializer.d.ts +20 -3
- package/dist/lite/firestore/src/local/memory_document_overlay_cache.d.ts +36 -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/collections.d.ts +7 -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/obj_map.d.ts +3 -0
- 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 +1198 -1165
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +366 -357
- 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 +122 -121
- 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 +71 -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 +44 -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 +106 -437
- package/dist/lite/packages/firestore/src/local/indexeddb_sentinels.d.ts +238 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
- 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 +20 -3
- package/dist/lite/packages/firestore/src/local/memory_document_overlay_cache.d.ts +36 -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/collections.d.ts +7 -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/obj_map.d.ts +3 -0
- 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 +200 -195
- 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 +71 -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 +44 -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 +106 -437
- package/dist/packages/firestore/src/local/indexeddb_sentinels.d.ts +238 -0
- package/dist/packages/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
- package/dist/packages/firestore/src/local/local_documents_view.d.ts +0 -1
- package/dist/packages/firestore/src/local/local_serializer.d.ts +20 -3
- package/dist/packages/firestore/src/local/memory_document_overlay_cache.d.ts +36 -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/collections.d.ts +7 -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/obj_map.d.ts +3 -0
- 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 +265 -26
- package/package.json +9 -9
package/dist/internal.d.ts
CHANGED
|
@@ -214,8 +214,8 @@ declare type BatchId = number;
|
|
|
214
214
|
*/
|
|
215
215
|
declare class Bound {
|
|
216
216
|
readonly position: Value[];
|
|
217
|
-
readonly
|
|
218
|
-
constructor(position: Value[],
|
|
217
|
+
readonly inclusive: boolean;
|
|
218
|
+
constructor(position: Value[], inclusive: boolean);
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
/**
|
|
@@ -623,6 +623,7 @@ export declare class _DatabaseId {
|
|
|
623
623
|
readonly projectId: string;
|
|
624
624
|
readonly database: string;
|
|
625
625
|
constructor(projectId: string, database?: string);
|
|
626
|
+
static empty(): _DatabaseId;
|
|
626
627
|
get isDefaultDatabase(): boolean;
|
|
627
628
|
isEqual(other: {}): boolean;
|
|
628
629
|
}
|
|
@@ -841,6 +842,11 @@ declare interface Document_2 {
|
|
|
841
842
|
* document was guaranteed to not exist.
|
|
842
843
|
*/
|
|
843
844
|
readonly version: SnapshotVersion;
|
|
845
|
+
/**
|
|
846
|
+
* The timestamp at which this document was read from the remote server. Uses
|
|
847
|
+
* `SnapshotVersion.min()` for documents created by the user.
|
|
848
|
+
*/
|
|
849
|
+
readonly readTime: SnapshotVersion;
|
|
844
850
|
/** The underlying data of this document or an empty value if no data exists. */
|
|
845
851
|
readonly data: ObjectValue;
|
|
846
852
|
/** Returns whether local mutations were applied via the mutation queue. */
|
|
@@ -931,8 +937,14 @@ export declare class _DocumentKey {
|
|
|
931
937
|
constructor(path: _ResourcePath);
|
|
932
938
|
static fromPath(path: string): _DocumentKey;
|
|
933
939
|
static fromName(name: string): _DocumentKey;
|
|
940
|
+
static empty(): _DocumentKey;
|
|
941
|
+
get collectionGroup(): string;
|
|
934
942
|
/** Returns true if the document is in the specified collectionId. */
|
|
935
943
|
hasCollectionId(collectionId: string): boolean;
|
|
944
|
+
/** Returns the collection group (i.e. the name of the parent collection) for this key. */
|
|
945
|
+
getCollectionGroup(): string;
|
|
946
|
+
/** Returns the fully qualified path to the parent collection. */
|
|
947
|
+
getCollectionPath(): _ResourcePath;
|
|
936
948
|
isEqual(other: _DocumentKey | null): boolean;
|
|
937
949
|
toString(): string;
|
|
938
950
|
static comparator(k1: _DocumentKey, k2: _DocumentKey): number;
|
|
@@ -950,6 +962,56 @@ declare type DocumentKeySet = SortedSet<_DocumentKey>;
|
|
|
950
962
|
|
|
951
963
|
declare type DocumentMap = SortedMap<_DocumentKey, Document_2>;
|
|
952
964
|
|
|
965
|
+
/**
|
|
966
|
+
* Provides methods to read and write document overlays.
|
|
967
|
+
*
|
|
968
|
+
* An overlay is a saved mutation, that gives a local view of a document when
|
|
969
|
+
* applied to the remote version of the document.
|
|
970
|
+
*
|
|
971
|
+
* Each overlay stores the largest batch ID that is included in the overlay,
|
|
972
|
+
* which allows us to remove the overlay once all batches leading up to it have
|
|
973
|
+
* been acknowledged.
|
|
974
|
+
*/
|
|
975
|
+
declare interface DocumentOverlayCache {
|
|
976
|
+
/**
|
|
977
|
+
* Gets the saved overlay mutation for the given document key.
|
|
978
|
+
* Returns null if there is no overlay for that key.
|
|
979
|
+
*/
|
|
980
|
+
getOverlay(transaction: PersistenceTransaction, key: _DocumentKey): PersistencePromise<Overlay | null>;
|
|
981
|
+
/**
|
|
982
|
+
* Saves the given document mutation map to persistence as overlays.
|
|
983
|
+
* All overlays will have their largest batch id set to `largestBatchId`.
|
|
984
|
+
*/
|
|
985
|
+
saveOverlays(transaction: PersistenceTransaction, largestBatchId: number, overlays: MutationMap): PersistencePromise<void>;
|
|
986
|
+
/** Removes overlays for the given document keys and batch ID. */
|
|
987
|
+
removeOverlaysForBatchId(transaction: PersistenceTransaction, documentKeys: DocumentKeySet, batchId: number): PersistencePromise<void>;
|
|
988
|
+
/**
|
|
989
|
+
* Returns all saved overlays for the given collection.
|
|
990
|
+
*
|
|
991
|
+
* @param transaction - The persistence transaction to use for this operation.
|
|
992
|
+
* @param collection - The collection path to get the overlays for.
|
|
993
|
+
* @param sinceBatchId - The minimum batch ID to filter by (exclusive).
|
|
994
|
+
* Only overlays that contain a change past `sinceBatchId` are returned.
|
|
995
|
+
* @returns Mapping of each document key in the collection to its overlay.
|
|
996
|
+
*/
|
|
997
|
+
getOverlaysForCollection(transaction: PersistenceTransaction, collection: _ResourcePath, sinceBatchId: number): PersistencePromise<OverlayMap>;
|
|
998
|
+
/**
|
|
999
|
+
* Returns `count` overlays with a batch ID higher than `sinceBatchId` for the
|
|
1000
|
+
* provided collection group, processed by ascending batch ID. The method
|
|
1001
|
+
* always returns all overlays for a batch even if the last batch contains
|
|
1002
|
+
* more documents than the remaining limit.
|
|
1003
|
+
*
|
|
1004
|
+
* @param transaction - The persistence transaction used for this operation.
|
|
1005
|
+
* @param collectionGroup - The collection group to get the overlays for.
|
|
1006
|
+
* @param sinceBatchId - The minimum batch ID to filter by (exclusive).
|
|
1007
|
+
* Only overlays that contain a change past `sinceBatchId` are returned.
|
|
1008
|
+
* @param count - The number of overlays to return. Can be exceeded if the last
|
|
1009
|
+
* batch contains more entries.
|
|
1010
|
+
* @return Mapping of each document key in the collection group to its overlay.
|
|
1011
|
+
*/
|
|
1012
|
+
getOverlaysForCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, sinceBatchId: number, count: number): PersistencePromise<OverlayMap>;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
953
1015
|
/**
|
|
954
1016
|
* A `DocumentReference` refers to a document location in a Firestore database
|
|
955
1017
|
* and can be used to write, read, or listen to the location. The document at
|
|
@@ -1067,8 +1129,7 @@ export declare class DocumentSnapshot<T = DocumentData> extends DocumentSnapshot
|
|
|
1067
1129
|
/** @hideconstructor protected */
|
|
1068
1130
|
constructor(_firestore: Firestore, userDataWriter: AbstractUserDataWriter, key: _DocumentKey, document: Document_2 | null, metadata: SnapshotMetadata, converter: UntypedFirestoreDataConverter<T> | null);
|
|
1069
1131
|
/**
|
|
1070
|
-
*
|
|
1071
|
-
* exists. True if the document exists.
|
|
1132
|
+
* Returns whether or not the data exists. True if the document exists.
|
|
1072
1133
|
*/
|
|
1073
1134
|
exists(): this is QueryDocumentSnapshot<T>;
|
|
1074
1135
|
/**
|
|
@@ -1317,6 +1378,45 @@ export declare function executeWrite(firestore: Firestore, mutations: Mutation[]
|
|
|
1317
1378
|
|
|
1318
1379
|
declare type FieldFilterOp = 'OPERATOR_UNSPECIFIED' | 'LESS_THAN' | 'LESS_THAN_OR_EQUAL' | 'GREATER_THAN' | 'GREATER_THAN_OR_EQUAL' | 'EQUAL' | 'NOT_EQUAL' | 'ARRAY_CONTAINS' | 'IN' | 'ARRAY_CONTAINS_ANY' | 'NOT_IN';
|
|
1319
1380
|
|
|
1381
|
+
/**
|
|
1382
|
+
* An index definition for field indexes in Firestore.
|
|
1383
|
+
*
|
|
1384
|
+
* Every index is associated with a collection. The definition contains a list
|
|
1385
|
+
* of fields and their index kind (which can be `ASCENDING`, `DESCENDING` or
|
|
1386
|
+
* `CONTAINS` for ArrayContains/ArrayContainsAny queries).
|
|
1387
|
+
*
|
|
1388
|
+
* Unlike the backend, the SDK does not differentiate between collection or
|
|
1389
|
+
* collection group-scoped indices. Every index can be used for both single
|
|
1390
|
+
* collection and collection group queries.
|
|
1391
|
+
*/
|
|
1392
|
+
declare class FieldIndex {
|
|
1393
|
+
/**
|
|
1394
|
+
* The index ID. Returns -1 if the index ID is not available (e.g. the index
|
|
1395
|
+
* has not yet been persisted).
|
|
1396
|
+
*/
|
|
1397
|
+
readonly indexId: number;
|
|
1398
|
+
/** The collection ID this index applies to. */
|
|
1399
|
+
readonly collectionGroup: string;
|
|
1400
|
+
/** The field segments for this index. */
|
|
1401
|
+
readonly fields: IndexSegment[];
|
|
1402
|
+
/** Shows how up-to-date the index is for the current user. */
|
|
1403
|
+
readonly indexState: IndexState_2;
|
|
1404
|
+
/** An ID for an index that has not yet been added to persistence. */
|
|
1405
|
+
static UNKNOWN_ID: number;
|
|
1406
|
+
constructor(
|
|
1407
|
+
/**
|
|
1408
|
+
* The index ID. Returns -1 if the index ID is not available (e.g. the index
|
|
1409
|
+
* has not yet been persisted).
|
|
1410
|
+
*/
|
|
1411
|
+
indexId: number,
|
|
1412
|
+
/** The collection ID this index applies to. */
|
|
1413
|
+
collectionGroup: string,
|
|
1414
|
+
/** The field segments for this index. */
|
|
1415
|
+
fields: IndexSegment[],
|
|
1416
|
+
/** Shows how up-to-date the index is for the current user. */
|
|
1417
|
+
indexState: IndexState_2);
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1320
1420
|
/**
|
|
1321
1421
|
* Provides a set of fields that can be used to partially patch a document.
|
|
1322
1422
|
* FieldMask is used in conjunction with ObjectValue.
|
|
@@ -2356,6 +2456,20 @@ declare interface IndexField {
|
|
|
2356
2456
|
|
|
2357
2457
|
declare type IndexFieldMode = 'MODE_UNSPECIFIED' | 'ASCENDING' | 'DESCENDING';
|
|
2358
2458
|
|
|
2459
|
+
/** The type of the index, e.g. for which type of query it can be used. */
|
|
2460
|
+
declare const enum IndexKind {
|
|
2461
|
+
/**
|
|
2462
|
+
* Ordered index. Can be used for <, <=, ==, >=, >, !=, IN and NOT IN queries.
|
|
2463
|
+
*/
|
|
2464
|
+
ASCENDING = 0,
|
|
2465
|
+
/**
|
|
2466
|
+
* Ordered index. Can be used for <, <=, ==, >=, >, !=, IN and NOT IN queries.
|
|
2467
|
+
*/
|
|
2468
|
+
DESCENDING = 1,
|
|
2469
|
+
/** Contains index. Can be used for ArrayContains and ArrayContainsAny. */
|
|
2470
|
+
CONTAINS = 2
|
|
2471
|
+
}
|
|
2472
|
+
|
|
2359
2473
|
/**
|
|
2360
2474
|
* Represents a set of indexes that are used to execute queries efficiently.
|
|
2361
2475
|
*
|
|
@@ -2379,10 +2493,125 @@ declare interface IndexManager {
|
|
|
2379
2493
|
* path for a root-level collection).
|
|
2380
2494
|
*/
|
|
2381
2495
|
getCollectionParents(transaction: PersistenceTransaction, collectionId: string): PersistencePromise<_ResourcePath[]>;
|
|
2496
|
+
/**
|
|
2497
|
+
* Adds a field path index.
|
|
2498
|
+
*
|
|
2499
|
+
* Values for this index are persisted via the index backfill, which runs
|
|
2500
|
+
* asynchronously in the background. Once the first values are written,
|
|
2501
|
+
* an index can be used to serve partial results for any matching queries.
|
|
2502
|
+
* Any unindexed portion of the database will continue to be served via
|
|
2503
|
+
* collection scons.
|
|
2504
|
+
*/
|
|
2505
|
+
addFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
|
|
2506
|
+
/** Removes the given field index and deletes all index values. */
|
|
2507
|
+
deleteFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
|
|
2508
|
+
/**
|
|
2509
|
+
* Returns a list of field indexes that correspond to the specified collection
|
|
2510
|
+
* group.
|
|
2511
|
+
*
|
|
2512
|
+
* @param collectionGroup The collection group to get matching field indexes
|
|
2513
|
+
* for.
|
|
2514
|
+
* @return A collection of field indexes for the specified collection group.
|
|
2515
|
+
*/
|
|
2516
|
+
getFieldIndexes(transaction: PersistenceTransaction, collectionGroup: string): PersistencePromise<FieldIndex[]>;
|
|
2517
|
+
/** Returns all configured field indexes. */
|
|
2518
|
+
getFieldIndexes(transaction: PersistenceTransaction): PersistencePromise<FieldIndex[]>;
|
|
2519
|
+
/**
|
|
2520
|
+
* Returns an index that can be used to serve the provided target. Returns
|
|
2521
|
+
* `null` if no index is configured.
|
|
2522
|
+
*/
|
|
2523
|
+
getFieldIndex(transaction: PersistenceTransaction, target: Target): PersistencePromise<FieldIndex | null>;
|
|
2524
|
+
/**
|
|
2525
|
+
* Returns the documents that match the given target based on the provided
|
|
2526
|
+
* index or `null` if the target does not have a matching index.
|
|
2527
|
+
*/
|
|
2528
|
+
getDocumentsMatchingTarget(transaction: PersistenceTransaction, target: Target): PersistencePromise<DocumentKeySet | null>;
|
|
2529
|
+
/**
|
|
2530
|
+
* Returns the next collection group to update. Returns `null` if no group
|
|
2531
|
+
* exists.
|
|
2532
|
+
*/
|
|
2533
|
+
getNextCollectionGroupToUpdate(transaction: PersistenceTransaction): PersistencePromise<string | null>;
|
|
2534
|
+
/**
|
|
2535
|
+
* Sets the collection group's latest read time.
|
|
2536
|
+
*
|
|
2537
|
+
* This method updates the index offset for all field indices for the
|
|
2538
|
+
* collection group and increments their sequence number. Subsequent calls to
|
|
2539
|
+
* `getNextCollectionGroupToUpdate()` will return a different collection group
|
|
2540
|
+
* (unless only one collection group is configured).
|
|
2541
|
+
*/
|
|
2542
|
+
updateCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, offset: IndexOffset): PersistencePromise<void>;
|
|
2543
|
+
/** Updates the index entries for the provided documents. */
|
|
2544
|
+
updateIndexEntries(transaction: PersistenceTransaction, documents: DocumentMap): PersistencePromise<void>;
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2547
|
+
/**
|
|
2548
|
+
* Stores the latest read time, document and batch ID that were processed for an
|
|
2549
|
+
* index.
|
|
2550
|
+
*/
|
|
2551
|
+
declare class IndexOffset {
|
|
2552
|
+
/**
|
|
2553
|
+
* The latest read time version that has been indexed by Firestore for this
|
|
2554
|
+
* field index.
|
|
2555
|
+
*/
|
|
2556
|
+
readonly readTime: SnapshotVersion;
|
|
2557
|
+
/**
|
|
2558
|
+
* The key of the last document that was indexed for this query. Use
|
|
2559
|
+
* `DocumentKey.empty()` if no document has been indexed.
|
|
2560
|
+
*/
|
|
2561
|
+
readonly documentKey: _DocumentKey;
|
|
2562
|
+
readonly largestBatchId: number;
|
|
2563
|
+
constructor(
|
|
2564
|
+
/**
|
|
2565
|
+
* The latest read time version that has been indexed by Firestore for this
|
|
2566
|
+
* field index.
|
|
2567
|
+
*/
|
|
2568
|
+
readTime: SnapshotVersion,
|
|
2569
|
+
/**
|
|
2570
|
+
* The key of the last document that was indexed for this query. Use
|
|
2571
|
+
* `DocumentKey.empty()` if no document has been indexed.
|
|
2572
|
+
*/
|
|
2573
|
+
documentKey: _DocumentKey, largestBatchId: number);
|
|
2574
|
+
/** The state of an index that has not yet been backfilled. */
|
|
2575
|
+
static min(): IndexOffset;
|
|
2576
|
+
}
|
|
2577
|
+
|
|
2578
|
+
/** An index component consisting of field path and index type. */
|
|
2579
|
+
declare class IndexSegment {
|
|
2580
|
+
/** The field path of the component. */
|
|
2581
|
+
readonly fieldPath: _FieldPath;
|
|
2582
|
+
/** The fields sorting order. */
|
|
2583
|
+
readonly kind: IndexKind;
|
|
2584
|
+
constructor(
|
|
2585
|
+
/** The field path of the component. */
|
|
2586
|
+
fieldPath: _FieldPath,
|
|
2587
|
+
/** The fields sorting order. */
|
|
2588
|
+
kind: IndexKind);
|
|
2382
2589
|
}
|
|
2383
2590
|
|
|
2384
2591
|
declare type IndexState = 'STATE_UNSPECIFIED' | 'CREATING' | 'READY' | 'ERROR';
|
|
2385
2592
|
|
|
2593
|
+
/**
|
|
2594
|
+
* Stores the "high water mark" that indicates how updated the Index is for the
|
|
2595
|
+
* current user.
|
|
2596
|
+
*/
|
|
2597
|
+
declare class IndexState_2 {
|
|
2598
|
+
/**
|
|
2599
|
+
* Indicates when the index was last updated (relative to other indexes).
|
|
2600
|
+
*/
|
|
2601
|
+
readonly sequenceNumber: number;
|
|
2602
|
+
/** The the latest indexed read time, document and batch id. */
|
|
2603
|
+
readonly offset: IndexOffset;
|
|
2604
|
+
constructor(
|
|
2605
|
+
/**
|
|
2606
|
+
* Indicates when the index was last updated (relative to other indexes).
|
|
2607
|
+
*/
|
|
2608
|
+
sequenceNumber: number,
|
|
2609
|
+
/** The the latest indexed read time, document and batch id. */
|
|
2610
|
+
offset: IndexOffset);
|
|
2611
|
+
/** The state of an index that has not yet been backfilled. */
|
|
2612
|
+
static empty(): IndexState_2;
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2386
2615
|
/**
|
|
2387
2616
|
* Initializes a new instance of {@link Firestore} with the provided settings.
|
|
2388
2617
|
* Can only be called before any other function, including
|
|
@@ -2639,6 +2868,7 @@ declare class MutableDocument implements Document_2 {
|
|
|
2639
2868
|
readonly key: _DocumentKey;
|
|
2640
2869
|
private documentType;
|
|
2641
2870
|
version: SnapshotVersion;
|
|
2871
|
+
readTime: SnapshotVersion;
|
|
2642
2872
|
data: ObjectValue;
|
|
2643
2873
|
private documentState;
|
|
2644
2874
|
private constructor();
|
|
@@ -2678,6 +2908,7 @@ declare class MutableDocument implements Document_2 {
|
|
|
2678
2908
|
convertToUnknownDocument(version: SnapshotVersion): MutableDocument;
|
|
2679
2909
|
setHasCommittedMutations(): MutableDocument;
|
|
2680
2910
|
setHasLocalMutations(): MutableDocument;
|
|
2911
|
+
setReadTime(readTime: SnapshotVersion): MutableDocument;
|
|
2681
2912
|
get hasLocalMutations(): boolean;
|
|
2682
2913
|
get hasCommittedMutations(): boolean;
|
|
2683
2914
|
get hasPendingWrites(): boolean;
|
|
@@ -2808,6 +3039,8 @@ declare class MutationBatchResult {
|
|
|
2808
3039
|
static from(batch: MutationBatch, commitVersion: SnapshotVersion, results: MutationResult[]): MutationBatchResult;
|
|
2809
3040
|
}
|
|
2810
3041
|
|
|
3042
|
+
declare type MutationMap = ObjectMap<_DocumentKey, Mutation>;
|
|
3043
|
+
|
|
2811
3044
|
/** A queue of mutations to apply to the remote store. */
|
|
2812
3045
|
declare interface MutationQueue {
|
|
2813
3046
|
/** Returns true if this queue contains no mutation batches. */
|
|
@@ -3034,6 +3267,8 @@ declare class ObjectMap<KeyType, ValueType> {
|
|
|
3034
3267
|
* constant time lookups in practice.
|
|
3035
3268
|
*/
|
|
3036
3269
|
private inner;
|
|
3270
|
+
/** The number of entries stored in the map */
|
|
3271
|
+
private innerSize;
|
|
3037
3272
|
constructor(mapKeyFn: (key: KeyType) => string, equalsFn: (l: KeyType, r: KeyType) => boolean);
|
|
3038
3273
|
/** Get a value for this key, or undefined if it does not exist. */
|
|
3039
3274
|
get(key: KeyType): ValueType | undefined;
|
|
@@ -3046,6 +3281,7 @@ declare class ObjectMap<KeyType, ValueType> {
|
|
|
3046
3281
|
delete(key: KeyType): boolean;
|
|
3047
3282
|
forEach(fn: (key: KeyType, val: ValueType) => void): void;
|
|
3048
3283
|
isEmpty(): boolean;
|
|
3284
|
+
size(): number;
|
|
3049
3285
|
}
|
|
3050
3286
|
|
|
3051
3287
|
/**
|
|
@@ -3397,6 +3633,23 @@ export declare type OrderByDirection = 'desc' | 'asc';
|
|
|
3397
3633
|
|
|
3398
3634
|
declare type OrderDirection = 'DIRECTION_UNSPECIFIED' | 'ASCENDING' | 'DESCENDING';
|
|
3399
3635
|
|
|
3636
|
+
/**
|
|
3637
|
+
* Representation of an overlay computed by Firestore.
|
|
3638
|
+
*
|
|
3639
|
+
* Holds information about a mutation and the largest batch id in Firestore when
|
|
3640
|
+
* the mutation was created.
|
|
3641
|
+
*/
|
|
3642
|
+
declare class Overlay {
|
|
3643
|
+
readonly largestBatchId: number;
|
|
3644
|
+
readonly mutation: Mutation;
|
|
3645
|
+
constructor(largestBatchId: number, mutation: Mutation);
|
|
3646
|
+
getKey(): _DocumentKey;
|
|
3647
|
+
isEqual(other: Overlay | null): boolean;
|
|
3648
|
+
toString(): string;
|
|
3649
|
+
}
|
|
3650
|
+
|
|
3651
|
+
declare type OverlayMap = ObjectMap<_DocumentKey, Overlay>;
|
|
3652
|
+
|
|
3400
3653
|
declare interface ParseContext {
|
|
3401
3654
|
readonly databaseId: _DatabaseId;
|
|
3402
3655
|
readonly ignoreUndefinedProperties: boolean;
|
|
@@ -3500,7 +3753,7 @@ declare interface Persistence {
|
|
|
3500
3753
|
* extent possible (e.g. in the case of uid switching from
|
|
3501
3754
|
* sally=>jack=>sally, sally's mutation queue will be preserved).
|
|
3502
3755
|
*/
|
|
3503
|
-
getMutationQueue(user: User): MutationQueue;
|
|
3756
|
+
getMutationQueue(user: User, indexManager: IndexManager): MutationQueue;
|
|
3504
3757
|
/**
|
|
3505
3758
|
* Returns a TargetCache representing the persisted cache of targets.
|
|
3506
3759
|
*
|
|
@@ -3533,7 +3786,12 @@ declare interface Persistence {
|
|
|
3533
3786
|
* this is called. In particular, the memory-backed implementation does this
|
|
3534
3787
|
* to emulate the persisted implementation to the extent possible.
|
|
3535
3788
|
*/
|
|
3536
|
-
getIndexManager(): IndexManager;
|
|
3789
|
+
getIndexManager(user: User): IndexManager;
|
|
3790
|
+
/**
|
|
3791
|
+
* Returns a DocumentOverlayCache representing the documents that are mutated
|
|
3792
|
+
* locally.
|
|
3793
|
+
*/
|
|
3794
|
+
getDocumentOverlayCache(user: User): DocumentOverlayCache;
|
|
3537
3795
|
/**
|
|
3538
3796
|
* Performs an operation inside a persistence transaction. Any reads or writes
|
|
3539
3797
|
* against persistence must be performed within a transaction. Writes will be
|
|
@@ -3944,6 +4202,8 @@ declare type Rejector = (error: Error) => void;
|
|
|
3944
4202
|
* documents that are known to not exist.
|
|
3945
4203
|
*/
|
|
3946
4204
|
declare interface RemoteDocumentCache {
|
|
4205
|
+
/** Sets the index manager to use for managing the collectionGroup index. */
|
|
4206
|
+
setIndexManager(indexManager: IndexManager): void;
|
|
3947
4207
|
/**
|
|
3948
4208
|
* Looks up an entry in the cache.
|
|
3949
4209
|
*
|
|
@@ -3961,19 +4221,14 @@ declare interface RemoteDocumentCache {
|
|
|
3961
4221
|
*/
|
|
3962
4222
|
getEntries(transaction: PersistenceTransaction, documentKeys: DocumentKeySet): PersistencePromise<MutableDocumentMap>;
|
|
3963
4223
|
/**
|
|
3964
|
-
*
|
|
3965
|
-
*
|
|
3966
|
-
* Implementations may return extra documents if convenient. The results
|
|
3967
|
-
* should be re-filtered by the consumer before presenting them to the user.
|
|
4224
|
+
* Returns the documents from the provided collection.
|
|
3968
4225
|
*
|
|
3969
|
-
*
|
|
3970
|
-
*
|
|
3971
|
-
* @param query - The query to match documents against.
|
|
4226
|
+
* @param collection - The collection to read.
|
|
3972
4227
|
* @param sinceReadTime - If not set to SnapshotVersion.min(), return only
|
|
3973
4228
|
* documents that have been read since this snapshot version (exclusive).
|
|
3974
4229
|
* @returns The set of matching documents.
|
|
3975
4230
|
*/
|
|
3976
|
-
|
|
4231
|
+
getAll(transaction: PersistenceTransaction, collection: _ResourcePath, sinceReadTime: SnapshotVersion): PersistencePromise<MutableDocumentMap>;
|
|
3977
4232
|
/**
|
|
3978
4233
|
* Provides access to add or update the contents of the cache. The buffer
|
|
3979
4234
|
* handles proper size accounting for the change.
|
|
@@ -3994,14 +4249,6 @@ declare interface RemoteDocumentCache {
|
|
|
3994
4249
|
getSize(transaction: PersistenceTransaction): PersistencePromise<number>;
|
|
3995
4250
|
}
|
|
3996
4251
|
|
|
3997
|
-
/**
|
|
3998
|
-
* Represents a document change to be applied to remote document cache.
|
|
3999
|
-
*/
|
|
4000
|
-
declare interface RemoteDocumentChange {
|
|
4001
|
-
readonly document: MutableDocument;
|
|
4002
|
-
readonly readTime: SnapshotVersion | null;
|
|
4003
|
-
}
|
|
4004
|
-
|
|
4005
4252
|
/**
|
|
4006
4253
|
* An in-memory buffer of entries to be written to a RemoteDocumentCache.
|
|
4007
4254
|
* It can be used to batch up a set of changes to be written to the cache, but
|
|
@@ -4017,26 +4264,25 @@ declare interface RemoteDocumentChange {
|
|
|
4017
4264
|
* porting this class as part of that implementation work.
|
|
4018
4265
|
*/
|
|
4019
4266
|
declare abstract class RemoteDocumentChangeBuffer {
|
|
4020
|
-
protected changes: ObjectMap<_DocumentKey,
|
|
4267
|
+
protected changes: ObjectMap<_DocumentKey, MutableDocument>;
|
|
4021
4268
|
private changesApplied;
|
|
4022
4269
|
protected abstract getFromCache(transaction: PersistenceTransaction, documentKey: _DocumentKey): PersistencePromise<MutableDocument>;
|
|
4023
4270
|
protected abstract getAllFromCache(transaction: PersistenceTransaction, documentKeys: DocumentKeySet): PersistencePromise<MutableDocumentMap>;
|
|
4024
4271
|
protected abstract applyChanges(transaction: PersistenceTransaction): PersistencePromise<void>;
|
|
4025
|
-
protected getReadTime(key: _DocumentKey): SnapshotVersion;
|
|
4026
4272
|
/**
|
|
4027
4273
|
* Buffers a `RemoteDocumentCache.addEntry()` call.
|
|
4028
4274
|
*
|
|
4029
4275
|
* You can only modify documents that have already been retrieved via
|
|
4030
4276
|
* `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`).
|
|
4031
4277
|
*/
|
|
4032
|
-
addEntry(document: MutableDocument
|
|
4278
|
+
addEntry(document: MutableDocument): void;
|
|
4033
4279
|
/**
|
|
4034
4280
|
* Buffers a `RemoteDocumentCache.removeEntry()` call.
|
|
4035
4281
|
*
|
|
4036
4282
|
* You can only remove documents that have already been retrieved via
|
|
4037
4283
|
* `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`).
|
|
4038
4284
|
*/
|
|
4039
|
-
removeEntry(key: _DocumentKey, readTime
|
|
4285
|
+
removeEntry(key: _DocumentKey, readTime: SnapshotVersion): void;
|
|
4040
4286
|
/**
|
|
4041
4287
|
* Looks up an entry in the cache. The buffered changes will first be checked,
|
|
4042
4288
|
* and if no buffered change applies, this will forward to
|
|
@@ -176,6 +176,7 @@ export declare class FirebaseAppCheckTokenProvider implements CredentialsProvide
|
|
|
176
176
|
private tokenListener;
|
|
177
177
|
private forceRefresh;
|
|
178
178
|
private appCheck;
|
|
179
|
+
private latestAppCheckToken;
|
|
179
180
|
constructor(appCheckProvider: Provider<AppCheckInternalComponentName>);
|
|
180
181
|
start(asyncQueue: AsyncQueue, changeListener: CredentialChangeListener<string>): void;
|
|
181
182
|
getToken(): Promise<Token | null>;
|
|
File without changes
|
|
@@ -198,8 +198,7 @@ export declare class DocumentSnapshot<T = DocumentData> extends LiteDocumentSnap
|
|
|
198
198
|
/** @hideconstructor protected */
|
|
199
199
|
constructor(_firestore: Firestore, userDataWriter: AbstractUserDataWriter, key: DocumentKey, document: Document | null, metadata: SnapshotMetadata, converter: UntypedFirestoreDataConverter<T> | null);
|
|
200
200
|
/**
|
|
201
|
-
*
|
|
202
|
-
* exists. True if the document exists.
|
|
201
|
+
* Returns whether or not the data exists. True if the document exists.
|
|
203
202
|
*/
|
|
204
203
|
exists(): this is QueryDocumentSnapshot<T>;
|
|
205
204
|
/**
|
|
@@ -20,7 +20,7 @@ export { LoadBundleTask, LoadBundleTaskProgress, TaskState } from './api/bundle'
|
|
|
20
20
|
export { FirestoreSettings, PersistenceSettings } from './api/settings';
|
|
21
21
|
export { DocumentChange, DocumentSnapshot, QueryDocumentSnapshot, QuerySnapshot, snapshotEqual, SnapshotOptions, FirestoreDataConverter, DocumentChangeType, SnapshotMetadata } from './api/snapshot';
|
|
22
22
|
export { DocumentReference, CollectionReference, Query, doc, collection, collectionGroup, SetOptions, DocumentData, UpdateData, WithFieldValue, PartialWithFieldValue, refEqual, queryEqual } from './api/reference';
|
|
23
|
-
export { endAt, endBefore, startAt, startAfter, limit, limitToLast, where, orderBy, query, QueryConstraint, QueryConstraintType, OrderByDirection, WhereFilterOp } from './api/
|
|
23
|
+
export { endAt, endBefore, startAt, startAfter, limit, limitToLast, where, orderBy, query, QueryConstraint, QueryConstraintType, OrderByDirection, WhereFilterOp } from './api/filter';
|
|
24
24
|
export { Unsubscribe, SnapshotListenOptions } from './api/reference_impl';
|
|
25
25
|
export { runTransaction, Transaction } from './api/transaction';
|
|
26
26
|
export { getDoc, getDocFromCache, getDocFromServer, getDocs, getDocsFromCache, getDocsFromServer, onSnapshot, onSnapshotsInSync, setDoc, updateDoc, deleteDoc, addDoc, executeWrite } from './api/reference_impl';
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import { Document } from '../model/document';
|
|
18
|
+
import { FieldIndex } from '../model/field_index';
|
|
18
19
|
import { FieldPath, ResourcePath } from '../model/path';
|
|
19
20
|
import { Value as ProtoValue } from '../protos/firestore_proto_api';
|
|
20
21
|
/**
|
|
@@ -56,7 +57,31 @@ export declare function newTarget(path: ResourcePath, collectionGroup?: string |
|
|
|
56
57
|
export declare function canonifyTarget(target: Target): string;
|
|
57
58
|
export declare function stringifyTarget(target: Target): string;
|
|
58
59
|
export declare function targetEquals(left: Target, right: Target): boolean;
|
|
59
|
-
export declare function
|
|
60
|
+
export declare function targetIsDocumentTarget(target: Target): boolean;
|
|
61
|
+
/** Returns the field filters that target the given field path. */
|
|
62
|
+
export declare function targetGetFieldFiltersForPath(target: Target, path: FieldPath): FieldFilter[];
|
|
63
|
+
/**
|
|
64
|
+
* Returns the values that are used in ARRAY_CONTAINS or ARRAY_CONTAINS_ANY
|
|
65
|
+
* filters. Returns `null` if there are no such filters.
|
|
66
|
+
*/
|
|
67
|
+
export declare function targetGetArrayValues(target: Target, fieldIndex: FieldIndex): ProtoValue[] | null;
|
|
68
|
+
/**
|
|
69
|
+
* Returns the list of values that are used in != or NOT_IN filters. Returns
|
|
70
|
+
* `null` if there are no such filters.
|
|
71
|
+
*/
|
|
72
|
+
export declare function targetGetNotInValues(target: Target, fieldIndex: FieldIndex): ProtoValue[] | null;
|
|
73
|
+
/**
|
|
74
|
+
* Returns a lower bound of field values that can be used as a starting point to
|
|
75
|
+
* scan the index defined by `fieldIndex`. Returns `null` if no lower bound
|
|
76
|
+
* exists.
|
|
77
|
+
*/
|
|
78
|
+
export declare function targetGetLowerBound(target: Target, fieldIndex: FieldIndex): Bound | null;
|
|
79
|
+
/**
|
|
80
|
+
* Returns an upper bound of field values that can be used as an ending point
|
|
81
|
+
* when scanning the index defined by `fieldIndex`. Returns `null` if no
|
|
82
|
+
* upper bound exists.
|
|
83
|
+
*/
|
|
84
|
+
export declare function targetGetUpperBound(target: Target, fieldIndex: FieldIndex): Bound | null;
|
|
60
85
|
export declare abstract class Filter {
|
|
61
86
|
abstract matches(doc: Document): boolean;
|
|
62
87
|
}
|
|
@@ -151,10 +176,9 @@ export declare class ArrayContainsAnyFilter extends FieldFilter {
|
|
|
151
176
|
*/
|
|
152
177
|
export declare class Bound {
|
|
153
178
|
readonly position: ProtoValue[];
|
|
154
|
-
readonly
|
|
155
|
-
constructor(position: ProtoValue[],
|
|
179
|
+
readonly inclusive: boolean;
|
|
180
|
+
constructor(position: ProtoValue[], inclusive: boolean);
|
|
156
181
|
}
|
|
157
|
-
export declare function canonifyBound(bound: Bound): string;
|
|
158
182
|
/**
|
|
159
183
|
* An ordering on a field, in some Direction. Direction defaults to ASCENDING.
|
|
160
184
|
*/
|
|
@@ -166,9 +190,14 @@ export declare class OrderBy {
|
|
|
166
190
|
export declare function canonifyOrderBy(orderBy: OrderBy): string;
|
|
167
191
|
export declare function stringifyOrderBy(orderBy: OrderBy): string;
|
|
168
192
|
export declare function orderByEquals(left: OrderBy, right: OrderBy): boolean;
|
|
193
|
+
/**
|
|
194
|
+
* Returns true if a document sorts after a bound using the provided sort
|
|
195
|
+
* order.
|
|
196
|
+
*/
|
|
197
|
+
export declare function boundSortsAfterDocument(bound: Bound, orderBy: OrderBy[], doc: Document): boolean;
|
|
169
198
|
/**
|
|
170
199
|
* Returns true if a document sorts before a bound using the provided sort
|
|
171
200
|
* order.
|
|
172
201
|
*/
|
|
173
|
-
export declare function
|
|
202
|
+
export declare function boundSortsBeforeDocument(bound: Bound, orderBy: OrderBy[], doc: Document): boolean;
|
|
174
203
|
export declare function boundEquals(left: Bound | null, right: Bound | null): boolean;
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { IndexKind } from '../model/field_index';
|
|
1
18
|
import { DirectionalIndexByteEncoder } from './directional_index_byte_encoder';
|
|
2
19
|
/**
|
|
3
20
|
* Implements `DirectionalIndexByteEncoder` using `OrderedCodeWriter` for the
|
|
@@ -8,7 +25,7 @@ export declare class IndexByteEncoder {
|
|
|
8
25
|
private ascending;
|
|
9
26
|
private descending;
|
|
10
27
|
seed(encodedBytes: Uint8Array): void;
|
|
11
|
-
forKind(kind:
|
|
28
|
+
forKind(kind: IndexKind): DirectionalIndexByteEncoder;
|
|
12
29
|
encodedBytes(): Uint8Array;
|
|
13
30
|
reset(): void;
|
|
14
31
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { DocumentKey } from '../model/document_key';
|
|
18
|
+
/** Represents an index entry saved by the SDK in persisted storage. */
|
|
19
|
+
export declare class IndexEntry {
|
|
20
|
+
readonly indexId: number;
|
|
21
|
+
readonly documentKey: DocumentKey;
|
|
22
|
+
readonly arrayValue: Uint8Array;
|
|
23
|
+
readonly directionalValue: Uint8Array;
|
|
24
|
+
constructor(indexId: number, documentKey: DocumentKey, arrayValue: Uint8Array, directionalValue: Uint8Array);
|
|
25
|
+
/**
|
|
26
|
+
* Returns an IndexEntry entry that sorts immediately after the current
|
|
27
|
+
* directional value.
|
|
28
|
+
*/
|
|
29
|
+
successor(): IndexEntry;
|
|
30
|
+
}
|
|
31
|
+
export declare function indexEntryComparator(left: IndexEntry, right: IndexEntry): number;
|
|
32
|
+
export declare function compareByteArrays(left: Uint8Array, right: Uint8Array): number;
|
|
@@ -196,8 +196,8 @@ export declare function newQueryOrderBy(query: InternalQuery, fieldPath: Interna
|
|
|
196
196
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
197
197
|
* server timestamp.
|
|
198
198
|
*/
|
|
199
|
-
export declare function newQueryBoundFromDocument(query: InternalQuery, databaseId: DatabaseId, methodName: string, doc: Document | null,
|
|
199
|
+
export declare function newQueryBoundFromDocument(query: InternalQuery, databaseId: DatabaseId, methodName: string, doc: Document | null, inclusive: boolean): Bound;
|
|
200
200
|
/**
|
|
201
201
|
* Converts a list of field values to a `Bound` for the given query.
|
|
202
202
|
*/
|
|
203
|
-
export declare function newQueryBoundFromFields(query: InternalQuery, databaseId: DatabaseId, dataReader: UserDataReader, methodName: string, values: unknown[],
|
|
203
|
+
export declare function newQueryBoundFromFields(query: InternalQuery, databaseId: DatabaseId, dataReader: UserDataReader, methodName: string, values: unknown[], inclusive: boolean): Bound;
|