@firebase/firestore 3.4.4-canary.2dd99ae2d → 3.4.4-canary.3e9f3e253
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/firestore/src/api/credentials.d.ts +1 -0
- package/dist/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/firestore/src/core/target.d.ts +8 -4
- package/dist/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/firestore/src/local/document_overlay_cache.d.ts +72 -0
- package/dist/firestore/src/local/index_manager.d.ts +52 -0
- package/dist/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
- package/dist/firestore/src/local/indexeddb_index_manager.d.ts +21 -2
- package/dist/firestore/src/local/indexeddb_persistence.d.ts +6 -4
- package/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
- package/dist/firestore/src/local/indexeddb_schema.d.ts +193 -7
- package/dist/firestore/src/local/local_documents_view.d.ts +0 -1
- package/dist/firestore/src/local/local_serializer.d.ts +18 -2
- package/dist/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
- package/dist/firestore/src/local/memory_index_manager.d.ts +11 -0
- package/dist/firestore/src/local/memory_persistence.d.ts +6 -2
- package/dist/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
- package/dist/firestore/src/local/persistence.d.ts +8 -2
- package/dist/firestore/src/local/remote_document_cache.d.ts +7 -9
- package/dist/firestore/src/local/simple_db.d.ts +1 -0
- package/dist/firestore/src/model/document_key.d.ts +4 -0
- package/dist/firestore/src/model/field_index.d.ts +2 -2
- package/dist/firestore/src/model/overlay.d.ts +32 -0
- package/dist/firestore/src/model/target_index_matcher.d.ts +70 -0
- package/dist/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
- package/dist/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
- package/dist/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
- package/dist/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
- package/dist/firestore/test/unit/local/test_index_manager.d.ts +11 -0
- package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
- package/dist/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
- package/dist/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
- package/dist/firestore/test/util/helpers.d.ts +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.esm2017.js +3864 -3349
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3879 -3455
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +878 -221
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +878 -221
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +3973 -3458
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +252 -14
- package/dist/lite/firestore/src/api/credentials.d.ts +1 -0
- package/dist/lite/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/lite/firestore/src/core/target.d.ts +8 -4
- package/dist/lite/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/lite/firestore/src/local/document_overlay_cache.d.ts +72 -0
- package/dist/lite/firestore/src/local/index_manager.d.ts +52 -0
- package/dist/lite/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
- package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +21 -2
- package/dist/lite/firestore/src/local/indexeddb_persistence.d.ts +6 -4
- package/dist/lite/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
- package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +193 -7
- package/dist/lite/firestore/src/local/local_documents_view.d.ts +0 -1
- package/dist/lite/firestore/src/local/local_serializer.d.ts +18 -2
- package/dist/lite/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
- package/dist/lite/firestore/src/local/memory_index_manager.d.ts +11 -0
- package/dist/lite/firestore/src/local/memory_persistence.d.ts +6 -2
- package/dist/lite/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
- package/dist/lite/firestore/src/local/persistence.d.ts +8 -2
- package/dist/lite/firestore/src/local/remote_document_cache.d.ts +7 -9
- package/dist/lite/firestore/src/local/simple_db.d.ts +1 -0
- package/dist/lite/firestore/src/model/document_key.d.ts +4 -0
- package/dist/lite/firestore/src/model/field_index.d.ts +2 -2
- package/dist/lite/firestore/src/model/overlay.d.ts +32 -0
- package/dist/lite/firestore/src/model/target_index_matcher.d.ts +70 -0
- package/dist/lite/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
- package/dist/lite/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
- package/dist/lite/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
- package/dist/lite/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
- package/dist/lite/firestore/test/unit/local/test_index_manager.d.ts +11 -0
- package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
- package/dist/lite/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
- package/dist/lite/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
- package/dist/lite/firestore/test/util/helpers.d.ts +1 -1
- package/dist/lite/index.browser.esm2017.js +1152 -1143
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +348 -341
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +44 -29
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +44 -29
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +1180 -1171
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +6 -2
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +121 -121
- package/dist/lite/packages/firestore/src/api/credentials.d.ts +1 -0
- package/dist/lite/packages/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/lite/packages/firestore/src/core/target.d.ts +8 -4
- package/dist/lite/packages/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/lite/packages/firestore/src/local/document_overlay_cache.d.ts +72 -0
- package/dist/lite/packages/firestore/src/local/index_manager.d.ts +52 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +21 -2
- package/dist/lite/packages/firestore/src/local/indexeddb_persistence.d.ts +6 -4
- package/dist/lite/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
- package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +193 -7
- package/dist/lite/packages/firestore/src/local/local_documents_view.d.ts +0 -1
- package/dist/lite/packages/firestore/src/local/local_serializer.d.ts +18 -2
- package/dist/lite/packages/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
- package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +11 -0
- package/dist/lite/packages/firestore/src/local/memory_persistence.d.ts +6 -2
- package/dist/lite/packages/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
- package/dist/lite/packages/firestore/src/local/persistence.d.ts +8 -2
- package/dist/lite/packages/firestore/src/local/remote_document_cache.d.ts +7 -9
- package/dist/lite/packages/firestore/src/local/simple_db.d.ts +1 -0
- package/dist/lite/packages/firestore/src/model/document_key.d.ts +4 -0
- package/dist/lite/packages/firestore/src/model/field_index.d.ts +2 -2
- package/dist/lite/packages/firestore/src/model/overlay.d.ts +32 -0
- package/dist/lite/packages/firestore/src/model/target_index_matcher.d.ts +70 -0
- package/dist/lite/packages/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
- package/dist/lite/packages/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
- package/dist/lite/packages/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
- package/dist/lite/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
- package/dist/lite/packages/firestore/test/unit/local/test_index_manager.d.ts +11 -0
- package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
- package/dist/lite/packages/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
- package/dist/lite/packages/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/util/helpers.d.ts +1 -1
- package/dist/lite/private.d.ts +2 -2
- package/dist/packages/firestore/dist/index.esm2017.d.ts +181 -179
- package/dist/packages/firestore/src/api/credentials.d.ts +1 -0
- package/dist/packages/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/packages/firestore/src/core/target.d.ts +8 -4
- package/dist/packages/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/packages/firestore/src/local/document_overlay_cache.d.ts +72 -0
- package/dist/packages/firestore/src/local/index_manager.d.ts +52 -0
- package/dist/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
- package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +21 -2
- package/dist/packages/firestore/src/local/indexeddb_persistence.d.ts +6 -4
- package/dist/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
- package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +193 -7
- package/dist/packages/firestore/src/local/local_documents_view.d.ts +0 -1
- package/dist/packages/firestore/src/local/local_serializer.d.ts +18 -2
- package/dist/packages/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
- package/dist/packages/firestore/src/local/memory_index_manager.d.ts +11 -0
- package/dist/packages/firestore/src/local/memory_persistence.d.ts +6 -2
- package/dist/packages/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
- package/dist/packages/firestore/src/local/persistence.d.ts +8 -2
- package/dist/packages/firestore/src/local/remote_document_cache.d.ts +7 -9
- package/dist/packages/firestore/src/local/simple_db.d.ts +1 -0
- package/dist/packages/firestore/src/model/document_key.d.ts +4 -0
- package/dist/packages/firestore/src/model/field_index.d.ts +2 -2
- package/dist/packages/firestore/src/model/overlay.d.ts +32 -0
- package/dist/packages/firestore/src/model/target_index_matcher.d.ts +70 -0
- package/dist/packages/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
- package/dist/packages/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
- package/dist/packages/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
- package/dist/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
- package/dist/packages/firestore/test/unit/local/test_index_manager.d.ts +11 -0
- package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
- package/dist/packages/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
- package/dist/packages/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
- package/dist/packages/firestore/test/util/helpers.d.ts +1 -1
- package/dist/private.d.ts +248 -14
- package/package.json +9 -9
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
|
/**
|
|
@@ -940,6 +940,10 @@ export declare class _DocumentKey {
|
|
|
940
940
|
static empty(): _DocumentKey;
|
|
941
941
|
/** Returns true if the document is in the specified collectionId. */
|
|
942
942
|
hasCollectionId(collectionId: string): boolean;
|
|
943
|
+
/** Returns the collection group (i.e. the name of the parent collection) for this key. */
|
|
944
|
+
getCollectionGroup(): string;
|
|
945
|
+
/** Returns the fully qualified path to the parent collection. */
|
|
946
|
+
getCollectionPath(): _ResourcePath;
|
|
943
947
|
isEqual(other: _DocumentKey | null): boolean;
|
|
944
948
|
toString(): string;
|
|
945
949
|
static comparator(k1: _DocumentKey, k2: _DocumentKey): number;
|
|
@@ -957,6 +961,56 @@ declare type DocumentKeySet = SortedSet<_DocumentKey>;
|
|
|
957
961
|
|
|
958
962
|
declare type DocumentMap = SortedMap<_DocumentKey, Document_2>;
|
|
959
963
|
|
|
964
|
+
/**
|
|
965
|
+
* Provides methods to read and write document overlays.
|
|
966
|
+
*
|
|
967
|
+
* An overlay is a saved mutation, that gives a local view of a document when
|
|
968
|
+
* applied to the remote version of the document.
|
|
969
|
+
*
|
|
970
|
+
* Each overlay stores the largest batch ID that is included in the overlay,
|
|
971
|
+
* which allows us to remove the overlay once all batches leading up to it have
|
|
972
|
+
* been acknowledged.
|
|
973
|
+
*/
|
|
974
|
+
declare interface DocumentOverlayCache {
|
|
975
|
+
/**
|
|
976
|
+
* Gets the saved overlay mutation for the given document key.
|
|
977
|
+
* Returns null if there is no overlay for that key.
|
|
978
|
+
*/
|
|
979
|
+
getOverlay(transaction: PersistenceTransaction, key: _DocumentKey): PersistencePromise<Overlay | null>;
|
|
980
|
+
/**
|
|
981
|
+
* Saves the given document mutation map to persistence as overlays.
|
|
982
|
+
* All overlays will have their largest batch id set to `largestBatchId`.
|
|
983
|
+
*/
|
|
984
|
+
saveOverlays(transaction: PersistenceTransaction, largestBatchId: number, overlays: Map<_DocumentKey, Mutation>): PersistencePromise<void>;
|
|
985
|
+
/** Removes overlays for the given document keys and batch ID. */
|
|
986
|
+
removeOverlaysForBatchId(transaction: PersistenceTransaction, documentKeys: DocumentKeySet, batchId: number): PersistencePromise<void>;
|
|
987
|
+
/**
|
|
988
|
+
* Returns all saved overlays for the given collection.
|
|
989
|
+
*
|
|
990
|
+
* @param transaction - The persistence transaction to use for this operation.
|
|
991
|
+
* @param collection - The collection path to get the overlays for.
|
|
992
|
+
* @param sinceBatchId - The minimum batch ID to filter by (exclusive).
|
|
993
|
+
* Only overlays that contain a change past `sinceBatchId` are returned.
|
|
994
|
+
* @returns Mapping of each document key in the collection to its overlay.
|
|
995
|
+
*/
|
|
996
|
+
getOverlaysForCollection(transaction: PersistenceTransaction, collection: _ResourcePath, sinceBatchId: number): PersistencePromise<Map<_DocumentKey, Overlay>>;
|
|
997
|
+
/**
|
|
998
|
+
* Returns `count` overlays with a batch ID higher than `sinceBatchId` for the
|
|
999
|
+
* provided collection group, processed by ascending batch ID. The method
|
|
1000
|
+
* always returns all overlays for a batch even if the last batch contains
|
|
1001
|
+
* more documents than the remaining limit.
|
|
1002
|
+
*
|
|
1003
|
+
* @param transaction - The persistence transaction used for this operation.
|
|
1004
|
+
* @param collectionGroup - The collection group to get the overlays for.
|
|
1005
|
+
* @param sinceBatchId - The minimum batch ID to filter by (exclusive).
|
|
1006
|
+
* Only overlays that contain a change past `sinceBatchId` are returned.
|
|
1007
|
+
* @param count - The number of overlays to return. Can be exceeded if the last
|
|
1008
|
+
* batch contains more entries.
|
|
1009
|
+
* @return Mapping of each document key in the collection group to its overlay.
|
|
1010
|
+
*/
|
|
1011
|
+
getOverlaysForCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, sinceBatchId: number, count: number): PersistencePromise<Map<_DocumentKey, Overlay>>;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
960
1014
|
/**
|
|
961
1015
|
* A `DocumentReference` refers to a document location in a Firestore database
|
|
962
1016
|
* and can be used to write, read, or listen to the location. The document at
|
|
@@ -1074,8 +1128,7 @@ export declare class DocumentSnapshot<T = DocumentData> extends DocumentSnapshot
|
|
|
1074
1128
|
/** @hideconstructor protected */
|
|
1075
1129
|
constructor(_firestore: Firestore, userDataWriter: AbstractUserDataWriter, key: _DocumentKey, document: Document_2 | null, metadata: SnapshotMetadata, converter: UntypedFirestoreDataConverter<T> | null);
|
|
1076
1130
|
/**
|
|
1077
|
-
*
|
|
1078
|
-
* exists. True if the document exists.
|
|
1131
|
+
* Returns whether or not the data exists. True if the document exists.
|
|
1079
1132
|
*/
|
|
1080
1133
|
exists(): this is QueryDocumentSnapshot<T>;
|
|
1081
1134
|
/**
|
|
@@ -1324,6 +1377,45 @@ export declare function executeWrite(firestore: Firestore, mutations: Mutation[]
|
|
|
1324
1377
|
|
|
1325
1378
|
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';
|
|
1326
1379
|
|
|
1380
|
+
/**
|
|
1381
|
+
* An index definition for field indexes in Firestore.
|
|
1382
|
+
*
|
|
1383
|
+
* Every index is associated with a collection. The definition contains a list
|
|
1384
|
+
* of fields and their index kind (which can be `ASCENDING`, `DESCENDING` or
|
|
1385
|
+
* `CONTAINS` for ArrayContains/ArrayContainsAny queries).
|
|
1386
|
+
*
|
|
1387
|
+
* Unlike the backend, the SDK does not differentiate between collection or
|
|
1388
|
+
* collection group-scoped indices. Every index can be used for both single
|
|
1389
|
+
* collection and collection group queries.
|
|
1390
|
+
*/
|
|
1391
|
+
declare class FieldIndex {
|
|
1392
|
+
/**
|
|
1393
|
+
* The index ID. Returns -1 if the index ID is not available (e.g. the index
|
|
1394
|
+
* has not yet been persisted).
|
|
1395
|
+
*/
|
|
1396
|
+
readonly indexId: number;
|
|
1397
|
+
/** The collection ID this index applies to. */
|
|
1398
|
+
readonly collectionGroup: string;
|
|
1399
|
+
/** The field segments for this index. */
|
|
1400
|
+
readonly fields: IndexSegment[];
|
|
1401
|
+
/** Shows how up-to-date the index is for the current user. */
|
|
1402
|
+
readonly indexState: IndexState_2;
|
|
1403
|
+
/** An ID for an index that has not yet been added to persistence. */
|
|
1404
|
+
static UNKNOWN_ID: number;
|
|
1405
|
+
constructor(
|
|
1406
|
+
/**
|
|
1407
|
+
* The index ID. Returns -1 if the index ID is not available (e.g. the index
|
|
1408
|
+
* has not yet been persisted).
|
|
1409
|
+
*/
|
|
1410
|
+
indexId: number,
|
|
1411
|
+
/** The collection ID this index applies to. */
|
|
1412
|
+
collectionGroup: string,
|
|
1413
|
+
/** The field segments for this index. */
|
|
1414
|
+
fields: IndexSegment[],
|
|
1415
|
+
/** Shows how up-to-date the index is for the current user. */
|
|
1416
|
+
indexState: IndexState_2);
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1327
1419
|
/**
|
|
1328
1420
|
* Provides a set of fields that can be used to partially patch a document.
|
|
1329
1421
|
* FieldMask is used in conjunction with ObjectValue.
|
|
@@ -2363,6 +2455,20 @@ declare interface IndexField {
|
|
|
2363
2455
|
|
|
2364
2456
|
declare type IndexFieldMode = 'MODE_UNSPECIFIED' | 'ASCENDING' | 'DESCENDING';
|
|
2365
2457
|
|
|
2458
|
+
/** The type of the index, e.g. for which type of query it can be used. */
|
|
2459
|
+
declare const enum IndexKind {
|
|
2460
|
+
/**
|
|
2461
|
+
* Ordered index. Can be used for <, <=, ==, >=, >, !=, IN and NOT IN queries.
|
|
2462
|
+
*/
|
|
2463
|
+
ASCENDING = 0,
|
|
2464
|
+
/**
|
|
2465
|
+
* Ordered index. Can be used for <, <=, ==, >=, >, !=, IN and NOT IN queries.
|
|
2466
|
+
*/
|
|
2467
|
+
DESCENDING = 1,
|
|
2468
|
+
/** Contains index. Can be used for ArrayContains and ArrayContainsAny. */
|
|
2469
|
+
CONTAINS = 2
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2366
2472
|
/**
|
|
2367
2473
|
* Represents a set of indexes that are used to execute queries efficiently.
|
|
2368
2474
|
*
|
|
@@ -2386,10 +2492,125 @@ declare interface IndexManager {
|
|
|
2386
2492
|
* path for a root-level collection).
|
|
2387
2493
|
*/
|
|
2388
2494
|
getCollectionParents(transaction: PersistenceTransaction, collectionId: string): PersistencePromise<_ResourcePath[]>;
|
|
2495
|
+
/**
|
|
2496
|
+
* Adds a field path index.
|
|
2497
|
+
*
|
|
2498
|
+
* Values for this index are persisted via the index backfill, which runs
|
|
2499
|
+
* asynchronously in the background. Once the first values are written,
|
|
2500
|
+
* an index can be used to serve partial results for any matching queries.
|
|
2501
|
+
* Any unindexed portion of the database will continue to be served via
|
|
2502
|
+
* collection scons.
|
|
2503
|
+
*/
|
|
2504
|
+
addFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
|
|
2505
|
+
/** Removes the given field index and deletes all index values. */
|
|
2506
|
+
deleteFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
|
|
2507
|
+
/**
|
|
2508
|
+
* Returns a list of field indexes that correspond to the specified collection
|
|
2509
|
+
* group.
|
|
2510
|
+
*
|
|
2511
|
+
* @param collectionGroup The collection group to get matching field indexes
|
|
2512
|
+
* for.
|
|
2513
|
+
* @return A collection of field indexes for the specified collection group.
|
|
2514
|
+
*/
|
|
2515
|
+
getFieldIndexes(transaction: PersistenceTransaction, collectionGroup: string): PersistencePromise<FieldIndex[]>;
|
|
2516
|
+
/** Returns all configured field indexes. */
|
|
2517
|
+
getFieldIndexes(transaction: PersistenceTransaction): PersistencePromise<FieldIndex[]>;
|
|
2518
|
+
/**
|
|
2519
|
+
* Returns an index that can be used to serve the provided target. Returns
|
|
2520
|
+
* `null` if no index is configured.
|
|
2521
|
+
*/
|
|
2522
|
+
getFieldIndex(transaction: PersistenceTransaction, target: Target): PersistencePromise<FieldIndex | null>;
|
|
2523
|
+
/**
|
|
2524
|
+
* Returns the documents that match the given target based on the provided
|
|
2525
|
+
* index.
|
|
2526
|
+
*/
|
|
2527
|
+
getDocumentsMatchingTarget(transaction: PersistenceTransaction, fieldIndex: FieldIndex, target: Target): PersistencePromise<DocumentKeySet>;
|
|
2528
|
+
/**
|
|
2529
|
+
* Returns the next collection group to update. Returns `null` if no group
|
|
2530
|
+
* exists.
|
|
2531
|
+
*/
|
|
2532
|
+
getNextCollectionGroupToUpdate(transaction: PersistenceTransaction): PersistencePromise<string | null>;
|
|
2533
|
+
/**
|
|
2534
|
+
* Sets the collection group's latest read time.
|
|
2535
|
+
*
|
|
2536
|
+
* This method updates the index offset for all field indices for the
|
|
2537
|
+
* collection group and increments their sequence number. Subsequent calls to
|
|
2538
|
+
* `getNextCollectionGroupToUpdate()` will return a different collection group
|
|
2539
|
+
* (unless only one collection group is configured).
|
|
2540
|
+
*/
|
|
2541
|
+
updateCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, offset: IndexOffset): PersistencePromise<void>;
|
|
2542
|
+
/** Updates the index entries for the provided documents. */
|
|
2543
|
+
updateIndexEntries(transaction: PersistenceTransaction, documents: DocumentMap): PersistencePromise<void>;
|
|
2544
|
+
}
|
|
2545
|
+
|
|
2546
|
+
/**
|
|
2547
|
+
* Stores the latest read time, document and batch ID that were processed for an
|
|
2548
|
+
* index.
|
|
2549
|
+
*/
|
|
2550
|
+
declare class IndexOffset {
|
|
2551
|
+
/**
|
|
2552
|
+
* The latest read time version that has been indexed by Firestore for this
|
|
2553
|
+
* field index.
|
|
2554
|
+
*/
|
|
2555
|
+
readonly readTime: SnapshotVersion;
|
|
2556
|
+
/**
|
|
2557
|
+
* The key of the last document that was indexed for this query. Use
|
|
2558
|
+
* `DocumentKey.empty()` if no document has been indexed.
|
|
2559
|
+
*/
|
|
2560
|
+
readonly documentKey: _DocumentKey;
|
|
2561
|
+
readonly largestBatchId: number;
|
|
2562
|
+
constructor(
|
|
2563
|
+
/**
|
|
2564
|
+
* The latest read time version that has been indexed by Firestore for this
|
|
2565
|
+
* field index.
|
|
2566
|
+
*/
|
|
2567
|
+
readTime: SnapshotVersion,
|
|
2568
|
+
/**
|
|
2569
|
+
* The key of the last document that was indexed for this query. Use
|
|
2570
|
+
* `DocumentKey.empty()` if no document has been indexed.
|
|
2571
|
+
*/
|
|
2572
|
+
documentKey: _DocumentKey, largestBatchId: number);
|
|
2573
|
+
/** The state of an index that has not yet been backfilled. */
|
|
2574
|
+
static min(): IndexOffset;
|
|
2575
|
+
}
|
|
2576
|
+
|
|
2577
|
+
/** An index component consisting of field path and index type. */
|
|
2578
|
+
declare class IndexSegment {
|
|
2579
|
+
/** The field path of the component. */
|
|
2580
|
+
readonly fieldPath: _FieldPath;
|
|
2581
|
+
/** The fields sorting order. */
|
|
2582
|
+
readonly kind: IndexKind;
|
|
2583
|
+
constructor(
|
|
2584
|
+
/** The field path of the component. */
|
|
2585
|
+
fieldPath: _FieldPath,
|
|
2586
|
+
/** The fields sorting order. */
|
|
2587
|
+
kind: IndexKind);
|
|
2389
2588
|
}
|
|
2390
2589
|
|
|
2391
2590
|
declare type IndexState = 'STATE_UNSPECIFIED' | 'CREATING' | 'READY' | 'ERROR';
|
|
2392
2591
|
|
|
2592
|
+
/**
|
|
2593
|
+
* Stores the "high water mark" that indicates how updated the Index is for the
|
|
2594
|
+
* current user.
|
|
2595
|
+
*/
|
|
2596
|
+
declare class IndexState_2 {
|
|
2597
|
+
/**
|
|
2598
|
+
* Indicates when the index was last updated (relative to other indexes).
|
|
2599
|
+
*/
|
|
2600
|
+
readonly sequenceNumber: number;
|
|
2601
|
+
/** The the latest indexed read time, document and batch id. */
|
|
2602
|
+
readonly offset: IndexOffset;
|
|
2603
|
+
constructor(
|
|
2604
|
+
/**
|
|
2605
|
+
* Indicates when the index was last updated (relative to other indexes).
|
|
2606
|
+
*/
|
|
2607
|
+
sequenceNumber: number,
|
|
2608
|
+
/** The the latest indexed read time, document and batch id. */
|
|
2609
|
+
offset: IndexOffset);
|
|
2610
|
+
/** The state of an index that has not yet been backfilled. */
|
|
2611
|
+
static empty(): IndexState_2;
|
|
2612
|
+
}
|
|
2613
|
+
|
|
2393
2614
|
/**
|
|
2394
2615
|
* Initializes a new instance of {@link Firestore} with the provided settings.
|
|
2395
2616
|
* Can only be called before any other function, including
|
|
@@ -3406,6 +3627,21 @@ export declare type OrderByDirection = 'desc' | 'asc';
|
|
|
3406
3627
|
|
|
3407
3628
|
declare type OrderDirection = 'DIRECTION_UNSPECIFIED' | 'ASCENDING' | 'DESCENDING';
|
|
3408
3629
|
|
|
3630
|
+
/**
|
|
3631
|
+
* Representation of an overlay computed by Firestore.
|
|
3632
|
+
*
|
|
3633
|
+
* Holds information about a mutation and the largest batch id in Firestore when
|
|
3634
|
+
* the mutation was created.
|
|
3635
|
+
*/
|
|
3636
|
+
declare class Overlay {
|
|
3637
|
+
readonly largestBatchId: number;
|
|
3638
|
+
readonly mutation: Mutation;
|
|
3639
|
+
constructor(largestBatchId: number, mutation: Mutation);
|
|
3640
|
+
getKey(): _DocumentKey;
|
|
3641
|
+
isEqual(other: Overlay | null): boolean;
|
|
3642
|
+
toString(): string;
|
|
3643
|
+
}
|
|
3644
|
+
|
|
3409
3645
|
declare interface ParseContext {
|
|
3410
3646
|
readonly databaseId: _DatabaseId;
|
|
3411
3647
|
readonly ignoreUndefinedProperties: boolean;
|
|
@@ -3509,7 +3745,7 @@ declare interface Persistence {
|
|
|
3509
3745
|
* extent possible (e.g. in the case of uid switching from
|
|
3510
3746
|
* sally=>jack=>sally, sally's mutation queue will be preserved).
|
|
3511
3747
|
*/
|
|
3512
|
-
getMutationQueue(user: User): MutationQueue;
|
|
3748
|
+
getMutationQueue(user: User, indexManager: IndexManager): MutationQueue;
|
|
3513
3749
|
/**
|
|
3514
3750
|
* Returns a TargetCache representing the persisted cache of targets.
|
|
3515
3751
|
*
|
|
@@ -3542,7 +3778,12 @@ declare interface Persistence {
|
|
|
3542
3778
|
* this is called. In particular, the memory-backed implementation does this
|
|
3543
3779
|
* to emulate the persisted implementation to the extent possible.
|
|
3544
3780
|
*/
|
|
3545
|
-
getIndexManager(): IndexManager;
|
|
3781
|
+
getIndexManager(user: User): IndexManager;
|
|
3782
|
+
/**
|
|
3783
|
+
* Returns a DocumentOverlayCache representing the documents that are mutated
|
|
3784
|
+
* locally.
|
|
3785
|
+
*/
|
|
3786
|
+
getDocumentOverlayCache(user: User): DocumentOverlayCache;
|
|
3546
3787
|
/**
|
|
3547
3788
|
* Performs an operation inside a persistence transaction. Any reads or writes
|
|
3548
3789
|
* against persistence must be performed within a transaction. Writes will be
|
|
@@ -3953,6 +4194,8 @@ declare type Rejector = (error: Error) => void;
|
|
|
3953
4194
|
* documents that are known to not exist.
|
|
3954
4195
|
*/
|
|
3955
4196
|
declare interface RemoteDocumentCache {
|
|
4197
|
+
/** Sets the index manager to use for managing the collectionGroup index. */
|
|
4198
|
+
setIndexManager(indexManager: IndexManager): void;
|
|
3956
4199
|
/**
|
|
3957
4200
|
* Looks up an entry in the cache.
|
|
3958
4201
|
*
|
|
@@ -3970,19 +4213,14 @@ declare interface RemoteDocumentCache {
|
|
|
3970
4213
|
*/
|
|
3971
4214
|
getEntries(transaction: PersistenceTransaction, documentKeys: DocumentKeySet): PersistencePromise<MutableDocumentMap>;
|
|
3972
4215
|
/**
|
|
3973
|
-
*
|
|
3974
|
-
*
|
|
3975
|
-
* Implementations may return extra documents if convenient. The results
|
|
3976
|
-
* should be re-filtered by the consumer before presenting them to the user.
|
|
3977
|
-
*
|
|
3978
|
-
* Cached NoDocument entries have no bearing on query results.
|
|
4216
|
+
* Returns the documents from the provided collection.
|
|
3979
4217
|
*
|
|
3980
|
-
* @param
|
|
4218
|
+
* @param collection - The collection to read.
|
|
3981
4219
|
* @param sinceReadTime - If not set to SnapshotVersion.min(), return only
|
|
3982
4220
|
* documents that have been read since this snapshot version (exclusive).
|
|
3983
4221
|
* @returns The set of matching documents.
|
|
3984
4222
|
*/
|
|
3985
|
-
|
|
4223
|
+
getAll(transaction: PersistenceTransaction, collection: _ResourcePath, sinceReadTime: SnapshotVersion): PersistencePromise<MutableDocumentMap>;
|
|
3986
4224
|
/**
|
|
3987
4225
|
* Provides access to add or update the contents of the cache. The buffer
|
|
3988
4226
|
* handles proper size accounting for the change.
|
|
@@ -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>;
|
|
@@ -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
|
/**
|
|
@@ -176,10 +176,9 @@ export declare class ArrayContainsAnyFilter extends FieldFilter {
|
|
|
176
176
|
*/
|
|
177
177
|
export declare class Bound {
|
|
178
178
|
readonly position: ProtoValue[];
|
|
179
|
-
readonly
|
|
180
|
-
constructor(position: ProtoValue[],
|
|
179
|
+
readonly inclusive: boolean;
|
|
180
|
+
constructor(position: ProtoValue[], inclusive: boolean);
|
|
181
181
|
}
|
|
182
|
-
export declare function canonifyBound(bound: Bound): string;
|
|
183
182
|
/**
|
|
184
183
|
* An ordering on a field, in some Direction. Direction defaults to ASCENDING.
|
|
185
184
|
*/
|
|
@@ -191,9 +190,14 @@ export declare class OrderBy {
|
|
|
191
190
|
export declare function canonifyOrderBy(orderBy: OrderBy): string;
|
|
192
191
|
export declare function stringifyOrderBy(orderBy: OrderBy): string;
|
|
193
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;
|
|
194
198
|
/**
|
|
195
199
|
* Returns true if a document sorts before a bound using the provided sort
|
|
196
200
|
* order.
|
|
197
201
|
*/
|
|
198
|
-
export declare function
|
|
202
|
+
export declare function boundSortsBeforeDocument(bound: Bound, orderBy: OrderBy[], doc: Document): boolean;
|
|
199
203
|
export declare function boundEquals(left: Bound | null, right: Bound | null): boolean;
|
|
@@ -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;
|
|
@@ -0,0 +1,72 @@
|
|
|
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 { DocumentKeySet } from '../model/collections';
|
|
18
|
+
import { DocumentKey } from '../model/document_key';
|
|
19
|
+
import { Mutation } from '../model/mutation';
|
|
20
|
+
import { Overlay } from '../model/overlay';
|
|
21
|
+
import { ResourcePath } from '../model/path';
|
|
22
|
+
import { PersistencePromise } from './persistence_promise';
|
|
23
|
+
import { PersistenceTransaction } from './persistence_transaction';
|
|
24
|
+
/**
|
|
25
|
+
* Provides methods to read and write document overlays.
|
|
26
|
+
*
|
|
27
|
+
* An overlay is a saved mutation, that gives a local view of a document when
|
|
28
|
+
* applied to the remote version of the document.
|
|
29
|
+
*
|
|
30
|
+
* Each overlay stores the largest batch ID that is included in the overlay,
|
|
31
|
+
* which allows us to remove the overlay once all batches leading up to it have
|
|
32
|
+
* been acknowledged.
|
|
33
|
+
*/
|
|
34
|
+
export interface DocumentOverlayCache {
|
|
35
|
+
/**
|
|
36
|
+
* Gets the saved overlay mutation for the given document key.
|
|
37
|
+
* Returns null if there is no overlay for that key.
|
|
38
|
+
*/
|
|
39
|
+
getOverlay(transaction: PersistenceTransaction, key: DocumentKey): PersistencePromise<Overlay | null>;
|
|
40
|
+
/**
|
|
41
|
+
* Saves the given document mutation map to persistence as overlays.
|
|
42
|
+
* All overlays will have their largest batch id set to `largestBatchId`.
|
|
43
|
+
*/
|
|
44
|
+
saveOverlays(transaction: PersistenceTransaction, largestBatchId: number, overlays: Map<DocumentKey, Mutation>): PersistencePromise<void>;
|
|
45
|
+
/** Removes overlays for the given document keys and batch ID. */
|
|
46
|
+
removeOverlaysForBatchId(transaction: PersistenceTransaction, documentKeys: DocumentKeySet, batchId: number): PersistencePromise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Returns all saved overlays for the given collection.
|
|
49
|
+
*
|
|
50
|
+
* @param transaction - The persistence transaction to use for this operation.
|
|
51
|
+
* @param collection - The collection path to get the overlays for.
|
|
52
|
+
* @param sinceBatchId - The minimum batch ID to filter by (exclusive).
|
|
53
|
+
* Only overlays that contain a change past `sinceBatchId` are returned.
|
|
54
|
+
* @returns Mapping of each document key in the collection to its overlay.
|
|
55
|
+
*/
|
|
56
|
+
getOverlaysForCollection(transaction: PersistenceTransaction, collection: ResourcePath, sinceBatchId: number): PersistencePromise<Map<DocumentKey, Overlay>>;
|
|
57
|
+
/**
|
|
58
|
+
* Returns `count` overlays with a batch ID higher than `sinceBatchId` for the
|
|
59
|
+
* provided collection group, processed by ascending batch ID. The method
|
|
60
|
+
* always returns all overlays for a batch even if the last batch contains
|
|
61
|
+
* more documents than the remaining limit.
|
|
62
|
+
*
|
|
63
|
+
* @param transaction - The persistence transaction used for this operation.
|
|
64
|
+
* @param collectionGroup - The collection group to get the overlays for.
|
|
65
|
+
* @param sinceBatchId - The minimum batch ID to filter by (exclusive).
|
|
66
|
+
* Only overlays that contain a change past `sinceBatchId` are returned.
|
|
67
|
+
* @param count - The number of overlays to return. Can be exceeded if the last
|
|
68
|
+
* batch contains more entries.
|
|
69
|
+
* @return Mapping of each document key in the collection group to its overlay.
|
|
70
|
+
*/
|
|
71
|
+
getOverlaysForCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, sinceBatchId: number, count: number): PersistencePromise<Map<DocumentKey, Overlay>>;
|
|
72
|
+
}
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
+
import { Target } from '../core/target';
|
|
18
|
+
import { DocumentKeySet, DocumentMap } from '../model/collections';
|
|
19
|
+
import { FieldIndex, IndexOffset } from '../model/field_index';
|
|
17
20
|
import { ResourcePath } from '../model/path';
|
|
18
21
|
import { PersistencePromise } from './persistence_promise';
|
|
19
22
|
import { PersistenceTransaction } from './persistence_transaction';
|
|
@@ -40,4 +43,53 @@ export interface IndexManager {
|
|
|
40
43
|
* path for a root-level collection).
|
|
41
44
|
*/
|
|
42
45
|
getCollectionParents(transaction: PersistenceTransaction, collectionId: string): PersistencePromise<ResourcePath[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Adds a field path index.
|
|
48
|
+
*
|
|
49
|
+
* Values for this index are persisted via the index backfill, which runs
|
|
50
|
+
* asynchronously in the background. Once the first values are written,
|
|
51
|
+
* an index can be used to serve partial results for any matching queries.
|
|
52
|
+
* Any unindexed portion of the database will continue to be served via
|
|
53
|
+
* collection scons.
|
|
54
|
+
*/
|
|
55
|
+
addFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
|
|
56
|
+
/** Removes the given field index and deletes all index values. */
|
|
57
|
+
deleteFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Returns a list of field indexes that correspond to the specified collection
|
|
60
|
+
* group.
|
|
61
|
+
*
|
|
62
|
+
* @param collectionGroup The collection group to get matching field indexes
|
|
63
|
+
* for.
|
|
64
|
+
* @return A collection of field indexes for the specified collection group.
|
|
65
|
+
*/
|
|
66
|
+
getFieldIndexes(transaction: PersistenceTransaction, collectionGroup: string): PersistencePromise<FieldIndex[]>;
|
|
67
|
+
/** Returns all configured field indexes. */
|
|
68
|
+
getFieldIndexes(transaction: PersistenceTransaction): PersistencePromise<FieldIndex[]>;
|
|
69
|
+
/**
|
|
70
|
+
* Returns an index that can be used to serve the provided target. Returns
|
|
71
|
+
* `null` if no index is configured.
|
|
72
|
+
*/
|
|
73
|
+
getFieldIndex(transaction: PersistenceTransaction, target: Target): PersistencePromise<FieldIndex | null>;
|
|
74
|
+
/**
|
|
75
|
+
* Returns the documents that match the given target based on the provided
|
|
76
|
+
* index.
|
|
77
|
+
*/
|
|
78
|
+
getDocumentsMatchingTarget(transaction: PersistenceTransaction, fieldIndex: FieldIndex, target: Target): PersistencePromise<DocumentKeySet>;
|
|
79
|
+
/**
|
|
80
|
+
* Returns the next collection group to update. Returns `null` if no group
|
|
81
|
+
* exists.
|
|
82
|
+
*/
|
|
83
|
+
getNextCollectionGroupToUpdate(transaction: PersistenceTransaction): PersistencePromise<string | null>;
|
|
84
|
+
/**
|
|
85
|
+
* Sets the collection group's latest read time.
|
|
86
|
+
*
|
|
87
|
+
* This method updates the index offset for all field indices for the
|
|
88
|
+
* collection group and increments their sequence number. Subsequent calls to
|
|
89
|
+
* `getNextCollectionGroupToUpdate()` will return a different collection group
|
|
90
|
+
* (unless only one collection group is configured).
|
|
91
|
+
*/
|
|
92
|
+
updateCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, offset: IndexOffset): PersistencePromise<void>;
|
|
93
|
+
/** Updates the index entries for the provided documents. */
|
|
94
|
+
updateIndexEntries(transaction: PersistenceTransaction, documents: DocumentMap): PersistencePromise<void>;
|
|
43
95
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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 { User } from '../auth/user';
|
|
18
|
+
import { DocumentKeySet } from '../model/collections';
|
|
19
|
+
import { DocumentKey } from '../model/document_key';
|
|
20
|
+
import { Mutation } from '../model/mutation';
|
|
21
|
+
import { Overlay } from '../model/overlay';
|
|
22
|
+
import { ResourcePath } from '../model/path';
|
|
23
|
+
import { DocumentOverlayCache } from './document_overlay_cache';
|
|
24
|
+
import { LocalSerializer } from './local_serializer';
|
|
25
|
+
import { PersistencePromise } from './persistence_promise';
|
|
26
|
+
import { PersistenceTransaction } from './persistence_transaction';
|
|
27
|
+
/**
|
|
28
|
+
* Implementation of DocumentOverlayCache using IndexedDb.
|
|
29
|
+
*/
|
|
30
|
+
export declare class IndexedDbDocumentOverlayCache implements DocumentOverlayCache {
|
|
31
|
+
private readonly serializer;
|
|
32
|
+
private readonly userId;
|
|
33
|
+
/**
|
|
34
|
+
* @param serializer - The document serializer.
|
|
35
|
+
* @param userId - The userId for which we are accessing overlays.
|
|
36
|
+
*/
|
|
37
|
+
constructor(serializer: LocalSerializer, userId: string);
|
|
38
|
+
static forUser(serializer: LocalSerializer, user: User): IndexedDbDocumentOverlayCache;
|
|
39
|
+
getOverlay(transaction: PersistenceTransaction, key: DocumentKey): PersistencePromise<Overlay | null>;
|
|
40
|
+
saveOverlays(transaction: PersistenceTransaction, largestBatchId: number, overlays: Map<DocumentKey, Mutation>): PersistencePromise<void>;
|
|
41
|
+
removeOverlaysForBatchId(transaction: PersistenceTransaction, documentKeys: DocumentKeySet, batchId: number): PersistencePromise<void>;
|
|
42
|
+
getOverlaysForCollection(transaction: PersistenceTransaction, collection: ResourcePath, sinceBatchId: number): PersistencePromise<Map<DocumentKey, Overlay>>;
|
|
43
|
+
getOverlaysForCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, sinceBatchId: number, count: number): PersistencePromise<Map<DocumentKey, Overlay>>;
|
|
44
|
+
private saveOverlay;
|
|
45
|
+
}
|
|
@@ -14,22 +14,32 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
+
import { User } from '../auth/user';
|
|
18
|
+
import { Target } from '../core/target';
|
|
19
|
+
import { DocumentKeySet, DocumentMap } from '../model/collections';
|
|
20
|
+
import { FieldIndex, IndexOffset } from '../model/field_index';
|
|
17
21
|
import { ResourcePath } from '../model/path';
|
|
18
22
|
import { IndexManager } from './index_manager';
|
|
19
23
|
import { PersistencePromise } from './persistence_promise';
|
|
20
24
|
import { PersistenceTransaction } from './persistence_transaction';
|
|
21
25
|
/**
|
|
22
26
|
* A persisted implementation of IndexManager.
|
|
27
|
+
*
|
|
28
|
+
* PORTING NOTE: Unlike iOS and Android, the Web SDK does not memoize index
|
|
29
|
+
* data as it supports multi-tab access.
|
|
23
30
|
*/
|
|
24
31
|
export declare class IndexedDbIndexManager implements IndexManager {
|
|
32
|
+
private user;
|
|
25
33
|
/**
|
|
26
34
|
* An in-memory copy of the index entries we've already written since the SDK
|
|
27
35
|
* launched. Used to avoid re-writing the same entry repeatedly.
|
|
28
36
|
*
|
|
29
|
-
* This is *NOT* a complete cache of what's in persistence and so can never be
|
|
30
|
-
* satisfy reads.
|
|
37
|
+
* This is *NOT* a complete cache of what's in persistence and so can never be
|
|
38
|
+
* used to satisfy reads.
|
|
31
39
|
*/
|
|
32
40
|
private collectionParentsCache;
|
|
41
|
+
private uid;
|
|
42
|
+
constructor(user: User);
|
|
33
43
|
/**
|
|
34
44
|
* Adds a new entry to the collection parent index.
|
|
35
45
|
*
|
|
@@ -39,4 +49,13 @@ export declare class IndexedDbIndexManager implements IndexManager {
|
|
|
39
49
|
*/
|
|
40
50
|
addToCollectionParentIndex(transaction: PersistenceTransaction, collectionPath: ResourcePath): PersistencePromise<void>;
|
|
41
51
|
getCollectionParents(transaction: PersistenceTransaction, collectionId: string): PersistencePromise<ResourcePath[]>;
|
|
52
|
+
addFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
|
|
53
|
+
deleteFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
|
|
54
|
+
getDocumentsMatchingTarget(transaction: PersistenceTransaction, fieldIndex: FieldIndex, target: Target): PersistencePromise<DocumentKeySet>;
|
|
55
|
+
getFieldIndex(transaction: PersistenceTransaction, target: Target): PersistencePromise<FieldIndex | null>;
|
|
56
|
+
getFieldIndexes(transaction: PersistenceTransaction, collectionGroup?: string): PersistencePromise<FieldIndex[]>;
|
|
57
|
+
getNextCollectionGroupToUpdate(transaction: PersistenceTransaction): PersistencePromise<string | null>;
|
|
58
|
+
updateCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, offset: IndexOffset): PersistencePromise<void>;
|
|
59
|
+
updateIndexEntries(transaction: PersistenceTransaction, documents: DocumentMap): PersistencePromise<void>;
|
|
60
|
+
private getNextSequenceNumber;
|
|
42
61
|
}
|