@firebase/firestore 3.4.4-canary.2dd99ae2d → 3.4.4-canary.307d019c7

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.
Files changed (180) hide show
  1. package/dist/firestore/src/api/credentials.d.ts +1 -0
  2. package/dist/firestore/src/api/snapshot.d.ts +1 -2
  3. package/dist/firestore/src/core/target.d.ts +8 -4
  4. package/dist/firestore/src/index/index_byte_encoder.d.ts +18 -1
  5. package/dist/firestore/src/index/index_entry.d.ts +26 -0
  6. package/dist/firestore/src/lite-api/query.d.ts +2 -2
  7. package/dist/firestore/src/local/document_overlay_cache.d.ts +72 -0
  8. package/dist/firestore/src/local/index_manager.d.ts +52 -0
  9. package/dist/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
  10. package/dist/firestore/src/local/indexeddb_index_manager.d.ts +40 -2
  11. package/dist/firestore/src/local/indexeddb_persistence.d.ts +6 -4
  12. package/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
  13. package/dist/firestore/src/local/indexeddb_schema.d.ts +195 -7
  14. package/dist/firestore/src/local/local_documents_view.d.ts +0 -1
  15. package/dist/firestore/src/local/local_serializer.d.ts +18 -2
  16. package/dist/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
  17. package/dist/firestore/src/local/memory_index_manager.d.ts +11 -0
  18. package/dist/firestore/src/local/memory_persistence.d.ts +6 -2
  19. package/dist/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
  20. package/dist/firestore/src/local/persistence.d.ts +8 -2
  21. package/dist/firestore/src/local/remote_document_cache.d.ts +7 -9
  22. package/dist/firestore/src/local/simple_db.d.ts +1 -0
  23. package/dist/firestore/src/model/document_key.d.ts +5 -0
  24. package/dist/firestore/src/model/field_index.d.ts +2 -2
  25. package/dist/firestore/src/model/overlay.d.ts +32 -0
  26. package/dist/firestore/src/model/target_index_matcher.d.ts +70 -0
  27. package/dist/firestore/src/platform/node/grpc_connection.d.ts +2 -2
  28. package/dist/firestore/src/platform/node/load_protos.d.ts +2 -2
  29. package/dist/firestore/src/util/sorted_set.d.ts +18 -0
  30. package/dist/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
  31. package/dist/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
  32. package/dist/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
  33. package/dist/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
  34. package/dist/firestore/test/unit/local/test_index_manager.d.ts +11 -0
  35. package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
  36. package/dist/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
  37. package/dist/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
  38. package/dist/firestore/test/util/helpers.d.ts +1 -1
  39. package/dist/index.d.ts +1 -2
  40. package/dist/index.esm2017.js +4496 -3484
  41. package/dist/index.esm2017.js.map +1 -1
  42. package/dist/index.esm5.js +4452 -3556
  43. package/dist/index.esm5.js.map +1 -1
  44. package/dist/index.node.cjs.js +1757 -295
  45. package/dist/index.node.cjs.js.map +1 -1
  46. package/dist/index.node.mjs +1737 -296
  47. package/dist/index.node.mjs.map +1 -1
  48. package/dist/index.rn.js +4508 -3496
  49. package/dist/index.rn.js.map +1 -1
  50. package/dist/internal.d.ts +253 -14
  51. package/dist/lite/firestore/src/api/credentials.d.ts +1 -0
  52. package/dist/lite/firestore/src/api/snapshot.d.ts +1 -2
  53. package/dist/lite/firestore/src/core/target.d.ts +8 -4
  54. package/dist/lite/firestore/src/index/index_byte_encoder.d.ts +18 -1
  55. package/dist/lite/firestore/src/index/index_entry.d.ts +26 -0
  56. package/dist/lite/firestore/src/lite-api/query.d.ts +2 -2
  57. package/dist/lite/firestore/src/local/document_overlay_cache.d.ts +72 -0
  58. package/dist/lite/firestore/src/local/index_manager.d.ts +52 -0
  59. package/dist/lite/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
  60. package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +40 -2
  61. package/dist/lite/firestore/src/local/indexeddb_persistence.d.ts +6 -4
  62. package/dist/lite/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
  63. package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +195 -7
  64. package/dist/lite/firestore/src/local/local_documents_view.d.ts +0 -1
  65. package/dist/lite/firestore/src/local/local_serializer.d.ts +18 -2
  66. package/dist/lite/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
  67. package/dist/lite/firestore/src/local/memory_index_manager.d.ts +11 -0
  68. package/dist/lite/firestore/src/local/memory_persistence.d.ts +6 -2
  69. package/dist/lite/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
  70. package/dist/lite/firestore/src/local/persistence.d.ts +8 -2
  71. package/dist/lite/firestore/src/local/remote_document_cache.d.ts +7 -9
  72. package/dist/lite/firestore/src/local/simple_db.d.ts +1 -0
  73. package/dist/lite/firestore/src/model/document_key.d.ts +5 -0
  74. package/dist/lite/firestore/src/model/field_index.d.ts +2 -2
  75. package/dist/lite/firestore/src/model/overlay.d.ts +32 -0
  76. package/dist/lite/firestore/src/model/target_index_matcher.d.ts +70 -0
  77. package/dist/lite/firestore/src/platform/node/grpc_connection.d.ts +2 -2
  78. package/dist/lite/firestore/src/platform/node/load_protos.d.ts +2 -2
  79. package/dist/lite/firestore/src/util/sorted_set.d.ts +18 -0
  80. package/dist/lite/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
  81. package/dist/lite/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
  82. package/dist/lite/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
  83. package/dist/lite/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
  84. package/dist/lite/firestore/test/unit/local/test_index_manager.d.ts +11 -0
  85. package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
  86. package/dist/lite/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
  87. package/dist/lite/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
  88. package/dist/lite/firestore/test/util/helpers.d.ts +1 -1
  89. package/dist/lite/index.browser.esm2017.js +1155 -1143
  90. package/dist/lite/index.browser.esm2017.js.map +1 -1
  91. package/dist/lite/index.browser.esm5.js +355 -342
  92. package/dist/lite/index.browser.esm5.js.map +1 -1
  93. package/dist/lite/index.node.cjs.js +47 -29
  94. package/dist/lite/index.node.cjs.js.map +1 -1
  95. package/dist/lite/index.node.mjs +47 -29
  96. package/dist/lite/index.node.mjs.map +1 -1
  97. package/dist/lite/index.rn.esm2017.js +332 -320
  98. package/dist/lite/index.rn.esm2017.js.map +1 -1
  99. package/dist/lite/internal.d.ts +7 -2
  100. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +121 -121
  101. package/dist/lite/packages/firestore/src/api/credentials.d.ts +1 -0
  102. package/dist/lite/packages/firestore/src/api/snapshot.d.ts +1 -2
  103. package/dist/lite/packages/firestore/src/core/target.d.ts +8 -4
  104. package/dist/lite/packages/firestore/src/index/index_byte_encoder.d.ts +18 -1
  105. package/dist/lite/packages/firestore/src/index/index_entry.d.ts +26 -0
  106. package/dist/lite/packages/firestore/src/lite-api/query.d.ts +2 -2
  107. package/dist/lite/packages/firestore/src/local/document_overlay_cache.d.ts +72 -0
  108. package/dist/lite/packages/firestore/src/local/index_manager.d.ts +52 -0
  109. package/dist/lite/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
  110. package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +40 -2
  111. package/dist/lite/packages/firestore/src/local/indexeddb_persistence.d.ts +6 -4
  112. package/dist/lite/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
  113. package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +195 -7
  114. package/dist/lite/packages/firestore/src/local/local_documents_view.d.ts +0 -1
  115. package/dist/lite/packages/firestore/src/local/local_serializer.d.ts +18 -2
  116. package/dist/lite/packages/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
  117. package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +11 -0
  118. package/dist/lite/packages/firestore/src/local/memory_persistence.d.ts +6 -2
  119. package/dist/lite/packages/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
  120. package/dist/lite/packages/firestore/src/local/persistence.d.ts +8 -2
  121. package/dist/lite/packages/firestore/src/local/remote_document_cache.d.ts +7 -9
  122. package/dist/lite/packages/firestore/src/local/simple_db.d.ts +1 -0
  123. package/dist/lite/packages/firestore/src/model/document_key.d.ts +5 -0
  124. package/dist/lite/packages/firestore/src/model/field_index.d.ts +2 -2
  125. package/dist/lite/packages/firestore/src/model/overlay.d.ts +32 -0
  126. package/dist/lite/packages/firestore/src/model/target_index_matcher.d.ts +70 -0
  127. package/dist/lite/packages/firestore/src/platform/node/grpc_connection.d.ts +2 -2
  128. package/dist/lite/packages/firestore/src/platform/node/load_protos.d.ts +2 -2
  129. package/dist/lite/packages/firestore/src/util/sorted_set.d.ts +18 -0
  130. package/dist/lite/packages/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
  131. package/dist/lite/packages/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
  132. package/dist/lite/packages/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
  133. package/dist/lite/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
  134. package/dist/lite/packages/firestore/test/unit/local/test_index_manager.d.ts +11 -0
  135. package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
  136. package/dist/lite/packages/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
  137. package/dist/lite/packages/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
  138. package/dist/lite/packages/firestore/test/util/helpers.d.ts +1 -1
  139. package/dist/lite/private.d.ts +2 -2
  140. package/dist/packages/firestore/dist/index.esm2017.d.ts +189 -186
  141. package/dist/packages/firestore/src/api/credentials.d.ts +1 -0
  142. package/dist/packages/firestore/src/api/snapshot.d.ts +1 -2
  143. package/dist/packages/firestore/src/core/target.d.ts +8 -4
  144. package/dist/packages/firestore/src/index/index_byte_encoder.d.ts +18 -1
  145. package/dist/packages/firestore/src/index/index_entry.d.ts +26 -0
  146. package/dist/packages/firestore/src/lite-api/query.d.ts +2 -2
  147. package/dist/packages/firestore/src/local/document_overlay_cache.d.ts +72 -0
  148. package/dist/packages/firestore/src/local/index_manager.d.ts +52 -0
  149. package/dist/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
  150. package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +40 -2
  151. package/dist/packages/firestore/src/local/indexeddb_persistence.d.ts +6 -4
  152. package/dist/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
  153. package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +195 -7
  154. package/dist/packages/firestore/src/local/local_documents_view.d.ts +0 -1
  155. package/dist/packages/firestore/src/local/local_serializer.d.ts +18 -2
  156. package/dist/packages/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
  157. package/dist/packages/firestore/src/local/memory_index_manager.d.ts +11 -0
  158. package/dist/packages/firestore/src/local/memory_persistence.d.ts +6 -2
  159. package/dist/packages/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
  160. package/dist/packages/firestore/src/local/persistence.d.ts +8 -2
  161. package/dist/packages/firestore/src/local/remote_document_cache.d.ts +7 -9
  162. package/dist/packages/firestore/src/local/simple_db.d.ts +1 -0
  163. package/dist/packages/firestore/src/model/document_key.d.ts +5 -0
  164. package/dist/packages/firestore/src/model/field_index.d.ts +2 -2
  165. package/dist/packages/firestore/src/model/overlay.d.ts +32 -0
  166. package/dist/packages/firestore/src/model/target_index_matcher.d.ts +70 -0
  167. package/dist/packages/firestore/src/platform/node/grpc_connection.d.ts +2 -2
  168. package/dist/packages/firestore/src/platform/node/load_protos.d.ts +2 -2
  169. package/dist/packages/firestore/src/util/sorted_set.d.ts +18 -0
  170. package/dist/packages/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
  171. package/dist/packages/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
  172. package/dist/packages/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
  173. package/dist/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
  174. package/dist/packages/firestore/test/unit/local/test_index_manager.d.ts +11 -0
  175. package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
  176. package/dist/packages/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
  177. package/dist/packages/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
  178. package/dist/packages/firestore/test/util/helpers.d.ts +1 -1
  179. package/dist/private.d.ts +248 -14
  180. package/package.json +9 -9
@@ -214,8 +214,8 @@ declare type BatchId = number;
214
214
  */
215
215
  declare class Bound {
216
216
  readonly position: Value[];
217
- readonly before: boolean;
218
- constructor(position: Value[], before: boolean);
217
+ readonly inclusive: boolean;
218
+ constructor(position: Value[], inclusive: boolean);
219
219
  }
220
220
 
221
221
  /**
@@ -938,8 +938,13 @@ export declare class _DocumentKey {
938
938
  static fromPath(path: string): _DocumentKey;
939
939
  static fromName(name: string): _DocumentKey;
940
940
  static empty(): _DocumentKey;
941
+ get collectionGroup(): string;
941
942
  /** Returns true if the document is in the specified collectionId. */
942
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;
943
948
  isEqual(other: _DocumentKey | null): boolean;
944
949
  toString(): string;
945
950
  static comparator(k1: _DocumentKey, k2: _DocumentKey): number;
@@ -957,6 +962,56 @@ declare type DocumentKeySet = SortedSet<_DocumentKey>;
957
962
 
958
963
  declare type DocumentMap = SortedMap<_DocumentKey, Document_2>;
959
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: Map<_DocumentKey, Mutation>): 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<Map<_DocumentKey, Overlay>>;
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<Map<_DocumentKey, Overlay>>;
1013
+ }
1014
+
960
1015
  /**
961
1016
  * A `DocumentReference` refers to a document location in a Firestore database
962
1017
  * and can be used to write, read, or listen to the location. The document at
@@ -1074,8 +1129,7 @@ export declare class DocumentSnapshot<T = DocumentData> extends DocumentSnapshot
1074
1129
  /** @hideconstructor protected */
1075
1130
  constructor(_firestore: Firestore, userDataWriter: AbstractUserDataWriter, key: _DocumentKey, document: Document_2 | null, metadata: SnapshotMetadata, converter: UntypedFirestoreDataConverter<T> | null);
1076
1131
  /**
1077
- * Property of the `DocumentSnapshot` that signals whether or not the data
1078
- * exists. True if the document exists.
1132
+ * Returns whether or not the data exists. True if the document exists.
1079
1133
  */
1080
1134
  exists(): this is QueryDocumentSnapshot<T>;
1081
1135
  /**
@@ -1324,6 +1378,45 @@ export declare function executeWrite(firestore: Firestore, mutations: Mutation[]
1324
1378
 
1325
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';
1326
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
+
1327
1420
  /**
1328
1421
  * Provides a set of fields that can be used to partially patch a document.
1329
1422
  * FieldMask is used in conjunction with ObjectValue.
@@ -2363,6 +2456,20 @@ declare interface IndexField {
2363
2456
 
2364
2457
  declare type IndexFieldMode = 'MODE_UNSPECIFIED' | 'ASCENDING' | 'DESCENDING';
2365
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
+
2366
2473
  /**
2367
2474
  * Represents a set of indexes that are used to execute queries efficiently.
2368
2475
  *
@@ -2386,10 +2493,125 @@ declare interface IndexManager {
2386
2493
  * path for a root-level collection).
2387
2494
  */
2388
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.
2527
+ */
2528
+ getDocumentsMatchingTarget(transaction: PersistenceTransaction, fieldIndex: FieldIndex, target: Target): PersistencePromise<DocumentKeySet>;
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);
2389
2589
  }
2390
2590
 
2391
2591
  declare type IndexState = 'STATE_UNSPECIFIED' | 'CREATING' | 'READY' | 'ERROR';
2392
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
+
2393
2615
  /**
2394
2616
  * Initializes a new instance of {@link Firestore} with the provided settings.
2395
2617
  * Can only be called before any other function, including
@@ -3406,6 +3628,21 @@ export declare type OrderByDirection = 'desc' | 'asc';
3406
3628
 
3407
3629
  declare type OrderDirection = 'DIRECTION_UNSPECIFIED' | 'ASCENDING' | 'DESCENDING';
3408
3630
 
3631
+ /**
3632
+ * Representation of an overlay computed by Firestore.
3633
+ *
3634
+ * Holds information about a mutation and the largest batch id in Firestore when
3635
+ * the mutation was created.
3636
+ */
3637
+ declare class Overlay {
3638
+ readonly largestBatchId: number;
3639
+ readonly mutation: Mutation;
3640
+ constructor(largestBatchId: number, mutation: Mutation);
3641
+ getKey(): _DocumentKey;
3642
+ isEqual(other: Overlay | null): boolean;
3643
+ toString(): string;
3644
+ }
3645
+
3409
3646
  declare interface ParseContext {
3410
3647
  readonly databaseId: _DatabaseId;
3411
3648
  readonly ignoreUndefinedProperties: boolean;
@@ -3509,7 +3746,7 @@ declare interface Persistence {
3509
3746
  * extent possible (e.g. in the case of uid switching from
3510
3747
  * sally=&gt;jack=&gt;sally, sally's mutation queue will be preserved).
3511
3748
  */
3512
- getMutationQueue(user: User): MutationQueue;
3749
+ getMutationQueue(user: User, indexManager: IndexManager): MutationQueue;
3513
3750
  /**
3514
3751
  * Returns a TargetCache representing the persisted cache of targets.
3515
3752
  *
@@ -3542,7 +3779,12 @@ declare interface Persistence {
3542
3779
  * this is called. In particular, the memory-backed implementation does this
3543
3780
  * to emulate the persisted implementation to the extent possible.
3544
3781
  */
3545
- getIndexManager(): IndexManager;
3782
+ getIndexManager(user: User): IndexManager;
3783
+ /**
3784
+ * Returns a DocumentOverlayCache representing the documents that are mutated
3785
+ * locally.
3786
+ */
3787
+ getDocumentOverlayCache(user: User): DocumentOverlayCache;
3546
3788
  /**
3547
3789
  * Performs an operation inside a persistence transaction. Any reads or writes
3548
3790
  * against persistence must be performed within a transaction. Writes will be
@@ -3953,6 +4195,8 @@ declare type Rejector = (error: Error) => void;
3953
4195
  * documents that are known to not exist.
3954
4196
  */
3955
4197
  declare interface RemoteDocumentCache {
4198
+ /** Sets the index manager to use for managing the collectionGroup index. */
4199
+ setIndexManager(indexManager: IndexManager): void;
3956
4200
  /**
3957
4201
  * Looks up an entry in the cache.
3958
4202
  *
@@ -3970,19 +4214,14 @@ declare interface RemoteDocumentCache {
3970
4214
  */
3971
4215
  getEntries(transaction: PersistenceTransaction, documentKeys: DocumentKeySet): PersistencePromise<MutableDocumentMap>;
3972
4216
  /**
3973
- * Executes a query against the cached Document entries.
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.
4217
+ * Returns the documents from the provided collection.
3979
4218
  *
3980
- * @param query - The query to match documents against.
4219
+ * @param collection - The collection to read.
3981
4220
  * @param sinceReadTime - If not set to SnapshotVersion.min(), return only
3982
4221
  * documents that have been read since this snapshot version (exclusive).
3983
4222
  * @returns The set of matching documents.
3984
4223
  */
3985
- getDocumentsMatchingQuery(transaction: PersistenceTransaction, query: Query_2, sinceReadTime: SnapshotVersion): PersistencePromise<MutableDocumentMap>;
4224
+ getAll(transaction: PersistenceTransaction, collection: _ResourcePath, sinceReadTime: SnapshotVersion): PersistencePromise<MutableDocumentMap>;
3986
4225
  /**
3987
4226
  * Provides access to add or update the contents of the cache. The buffer
3988
4227
  * 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
- * Property of the `DocumentSnapshot` that signals whether or not the data
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 before: boolean;
180
- constructor(position: ProtoValue[], before: boolean);
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 sortsBeforeDocument(bound: Bound, orderBy: OrderBy[], doc: Document): boolean;
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;
@@ -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: 'asc' | 'desc'): DirectionalIndexByteEncoder;
28
+ forKind(kind: IndexKind): DirectionalIndexByteEncoder;
12
29
  encodedBytes(): Uint8Array;
13
30
  reset(): void;
14
31
  }
@@ -0,0 +1,26 @@
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
+ export declare function indexEntryComparator(left: IndexEntry, right: IndexEntry): 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, before: boolean): Bound;
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[], before: boolean): Bound;
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
+ }