@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.
Files changed (160) 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/lite-api/query.d.ts +2 -2
  5. package/dist/firestore/src/local/document_overlay_cache.d.ts +72 -0
  6. package/dist/firestore/src/local/index_manager.d.ts +52 -0
  7. package/dist/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
  8. package/dist/firestore/src/local/indexeddb_index_manager.d.ts +21 -2
  9. package/dist/firestore/src/local/indexeddb_persistence.d.ts +6 -4
  10. package/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
  11. package/dist/firestore/src/local/indexeddb_schema.d.ts +193 -7
  12. package/dist/firestore/src/local/local_documents_view.d.ts +0 -1
  13. package/dist/firestore/src/local/local_serializer.d.ts +18 -2
  14. package/dist/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
  15. package/dist/firestore/src/local/memory_index_manager.d.ts +11 -0
  16. package/dist/firestore/src/local/memory_persistence.d.ts +6 -2
  17. package/dist/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
  18. package/dist/firestore/src/local/persistence.d.ts +8 -2
  19. package/dist/firestore/src/local/remote_document_cache.d.ts +7 -9
  20. package/dist/firestore/src/local/simple_db.d.ts +1 -0
  21. package/dist/firestore/src/model/document_key.d.ts +4 -0
  22. package/dist/firestore/src/model/field_index.d.ts +2 -2
  23. package/dist/firestore/src/model/overlay.d.ts +32 -0
  24. package/dist/firestore/src/model/target_index_matcher.d.ts +70 -0
  25. package/dist/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
  26. package/dist/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
  27. package/dist/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
  28. package/dist/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
  29. package/dist/firestore/test/unit/local/test_index_manager.d.ts +11 -0
  30. package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
  31. package/dist/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
  32. package/dist/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
  33. package/dist/firestore/test/util/helpers.d.ts +1 -1
  34. package/dist/index.d.ts +1 -2
  35. package/dist/index.esm2017.js +3864 -3349
  36. package/dist/index.esm2017.js.map +1 -1
  37. package/dist/index.esm5.js +3879 -3455
  38. package/dist/index.esm5.js.map +1 -1
  39. package/dist/index.node.cjs.js +878 -221
  40. package/dist/index.node.cjs.js.map +1 -1
  41. package/dist/index.node.mjs +878 -221
  42. package/dist/index.node.mjs.map +1 -1
  43. package/dist/index.rn.js +3973 -3458
  44. package/dist/index.rn.js.map +1 -1
  45. package/dist/internal.d.ts +252 -14
  46. package/dist/lite/firestore/src/api/credentials.d.ts +1 -0
  47. package/dist/lite/firestore/src/api/snapshot.d.ts +1 -2
  48. package/dist/lite/firestore/src/core/target.d.ts +8 -4
  49. package/dist/lite/firestore/src/lite-api/query.d.ts +2 -2
  50. package/dist/lite/firestore/src/local/document_overlay_cache.d.ts +72 -0
  51. package/dist/lite/firestore/src/local/index_manager.d.ts +52 -0
  52. package/dist/lite/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
  53. package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +21 -2
  54. package/dist/lite/firestore/src/local/indexeddb_persistence.d.ts +6 -4
  55. package/dist/lite/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
  56. package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +193 -7
  57. package/dist/lite/firestore/src/local/local_documents_view.d.ts +0 -1
  58. package/dist/lite/firestore/src/local/local_serializer.d.ts +18 -2
  59. package/dist/lite/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
  60. package/dist/lite/firestore/src/local/memory_index_manager.d.ts +11 -0
  61. package/dist/lite/firestore/src/local/memory_persistence.d.ts +6 -2
  62. package/dist/lite/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
  63. package/dist/lite/firestore/src/local/persistence.d.ts +8 -2
  64. package/dist/lite/firestore/src/local/remote_document_cache.d.ts +7 -9
  65. package/dist/lite/firestore/src/local/simple_db.d.ts +1 -0
  66. package/dist/lite/firestore/src/model/document_key.d.ts +4 -0
  67. package/dist/lite/firestore/src/model/field_index.d.ts +2 -2
  68. package/dist/lite/firestore/src/model/overlay.d.ts +32 -0
  69. package/dist/lite/firestore/src/model/target_index_matcher.d.ts +70 -0
  70. package/dist/lite/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
  71. package/dist/lite/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
  72. package/dist/lite/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
  73. package/dist/lite/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
  74. package/dist/lite/firestore/test/unit/local/test_index_manager.d.ts +11 -0
  75. package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
  76. package/dist/lite/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
  77. package/dist/lite/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
  78. package/dist/lite/firestore/test/util/helpers.d.ts +1 -1
  79. package/dist/lite/index.browser.esm2017.js +1152 -1143
  80. package/dist/lite/index.browser.esm2017.js.map +1 -1
  81. package/dist/lite/index.browser.esm5.js +348 -341
  82. package/dist/lite/index.browser.esm5.js.map +1 -1
  83. package/dist/lite/index.node.cjs.js +44 -29
  84. package/dist/lite/index.node.cjs.js.map +1 -1
  85. package/dist/lite/index.node.mjs +44 -29
  86. package/dist/lite/index.node.mjs.map +1 -1
  87. package/dist/lite/index.rn.esm2017.js +1180 -1171
  88. package/dist/lite/index.rn.esm2017.js.map +1 -1
  89. package/dist/lite/internal.d.ts +6 -2
  90. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +121 -121
  91. package/dist/lite/packages/firestore/src/api/credentials.d.ts +1 -0
  92. package/dist/lite/packages/firestore/src/api/snapshot.d.ts +1 -2
  93. package/dist/lite/packages/firestore/src/core/target.d.ts +8 -4
  94. package/dist/lite/packages/firestore/src/lite-api/query.d.ts +2 -2
  95. package/dist/lite/packages/firestore/src/local/document_overlay_cache.d.ts +72 -0
  96. package/dist/lite/packages/firestore/src/local/index_manager.d.ts +52 -0
  97. package/dist/lite/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
  98. package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +21 -2
  99. package/dist/lite/packages/firestore/src/local/indexeddb_persistence.d.ts +6 -4
  100. package/dist/lite/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
  101. package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +193 -7
  102. package/dist/lite/packages/firestore/src/local/local_documents_view.d.ts +0 -1
  103. package/dist/lite/packages/firestore/src/local/local_serializer.d.ts +18 -2
  104. package/dist/lite/packages/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
  105. package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +11 -0
  106. package/dist/lite/packages/firestore/src/local/memory_persistence.d.ts +6 -2
  107. package/dist/lite/packages/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
  108. package/dist/lite/packages/firestore/src/local/persistence.d.ts +8 -2
  109. package/dist/lite/packages/firestore/src/local/remote_document_cache.d.ts +7 -9
  110. package/dist/lite/packages/firestore/src/local/simple_db.d.ts +1 -0
  111. package/dist/lite/packages/firestore/src/model/document_key.d.ts +4 -0
  112. package/dist/lite/packages/firestore/src/model/field_index.d.ts +2 -2
  113. package/dist/lite/packages/firestore/src/model/overlay.d.ts +32 -0
  114. package/dist/lite/packages/firestore/src/model/target_index_matcher.d.ts +70 -0
  115. package/dist/lite/packages/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
  116. package/dist/lite/packages/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
  117. package/dist/lite/packages/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
  118. package/dist/lite/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
  119. package/dist/lite/packages/firestore/test/unit/local/test_index_manager.d.ts +11 -0
  120. package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
  121. package/dist/lite/packages/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
  122. package/dist/lite/packages/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
  123. package/dist/lite/packages/firestore/test/util/helpers.d.ts +1 -1
  124. package/dist/lite/private.d.ts +2 -2
  125. package/dist/packages/firestore/dist/index.esm2017.d.ts +181 -179
  126. package/dist/packages/firestore/src/api/credentials.d.ts +1 -0
  127. package/dist/packages/firestore/src/api/snapshot.d.ts +1 -2
  128. package/dist/packages/firestore/src/core/target.d.ts +8 -4
  129. package/dist/packages/firestore/src/lite-api/query.d.ts +2 -2
  130. package/dist/packages/firestore/src/local/document_overlay_cache.d.ts +72 -0
  131. package/dist/packages/firestore/src/local/index_manager.d.ts +52 -0
  132. package/dist/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
  133. package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +21 -2
  134. package/dist/packages/firestore/src/local/indexeddb_persistence.d.ts +6 -4
  135. package/dist/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
  136. package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +193 -7
  137. package/dist/packages/firestore/src/local/local_documents_view.d.ts +0 -1
  138. package/dist/packages/firestore/src/local/local_serializer.d.ts +18 -2
  139. package/dist/packages/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
  140. package/dist/packages/firestore/src/local/memory_index_manager.d.ts +11 -0
  141. package/dist/packages/firestore/src/local/memory_persistence.d.ts +6 -2
  142. package/dist/packages/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
  143. package/dist/packages/firestore/src/local/persistence.d.ts +8 -2
  144. package/dist/packages/firestore/src/local/remote_document_cache.d.ts +7 -9
  145. package/dist/packages/firestore/src/local/simple_db.d.ts +1 -0
  146. package/dist/packages/firestore/src/model/document_key.d.ts +4 -0
  147. package/dist/packages/firestore/src/model/field_index.d.ts +2 -2
  148. package/dist/packages/firestore/src/model/overlay.d.ts +32 -0
  149. package/dist/packages/firestore/src/model/target_index_matcher.d.ts +70 -0
  150. package/dist/packages/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
  151. package/dist/packages/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
  152. package/dist/packages/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
  153. package/dist/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
  154. package/dist/packages/firestore/test/unit/local/test_index_manager.d.ts +11 -0
  155. package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
  156. package/dist/packages/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
  157. package/dist/packages/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
  158. package/dist/packages/firestore/test/util/helpers.d.ts +1 -1
  159. package/dist/private.d.ts +248 -14
  160. package/package.json +9 -9
package/dist/private.d.ts CHANGED
@@ -197,8 +197,8 @@ declare type BatchId = number;
197
197
  */
198
198
  declare class Bound {
199
199
  readonly position: Value[];
200
- readonly before: boolean;
201
- constructor(position: Value[], before: boolean);
200
+ readonly inclusive: boolean;
201
+ constructor(position: Value[], inclusive: boolean);
202
202
  }
203
203
 
204
204
  /**
@@ -850,6 +850,56 @@ declare type DocumentKeySet = SortedSet<_DocumentKey>;
850
850
 
851
851
  declare type DocumentMap = SortedMap<_DocumentKey, Document_2>;
852
852
 
853
+ /**
854
+ * Provides methods to read and write document overlays.
855
+ *
856
+ * An overlay is a saved mutation, that gives a local view of a document when
857
+ * applied to the remote version of the document.
858
+ *
859
+ * Each overlay stores the largest batch ID that is included in the overlay,
860
+ * which allows us to remove the overlay once all batches leading up to it have
861
+ * been acknowledged.
862
+ */
863
+ declare interface DocumentOverlayCache {
864
+ /**
865
+ * Gets the saved overlay mutation for the given document key.
866
+ * Returns null if there is no overlay for that key.
867
+ */
868
+ getOverlay(transaction: PersistenceTransaction, key: _DocumentKey): PersistencePromise<Overlay | null>;
869
+ /**
870
+ * Saves the given document mutation map to persistence as overlays.
871
+ * All overlays will have their largest batch id set to `largestBatchId`.
872
+ */
873
+ saveOverlays(transaction: PersistenceTransaction, largestBatchId: number, overlays: Map<_DocumentKey, Mutation>): PersistencePromise<void>;
874
+ /** Removes overlays for the given document keys and batch ID. */
875
+ removeOverlaysForBatchId(transaction: PersistenceTransaction, documentKeys: DocumentKeySet, batchId: number): PersistencePromise<void>;
876
+ /**
877
+ * Returns all saved overlays for the given collection.
878
+ *
879
+ * @param transaction - The persistence transaction to use for this operation.
880
+ * @param collection - The collection path to get the overlays for.
881
+ * @param sinceBatchId - The minimum batch ID to filter by (exclusive).
882
+ * Only overlays that contain a change past `sinceBatchId` are returned.
883
+ * @returns Mapping of each document key in the collection to its overlay.
884
+ */
885
+ getOverlaysForCollection(transaction: PersistenceTransaction, collection: _ResourcePath, sinceBatchId: number): PersistencePromise<Map<_DocumentKey, Overlay>>;
886
+ /**
887
+ * Returns `count` overlays with a batch ID higher than `sinceBatchId` for the
888
+ * provided collection group, processed by ascending batch ID. The method
889
+ * always returns all overlays for a batch even if the last batch contains
890
+ * more documents than the remaining limit.
891
+ *
892
+ * @param transaction - The persistence transaction used for this operation.
893
+ * @param collectionGroup - The collection group to get the overlays for.
894
+ * @param sinceBatchId - The minimum batch ID to filter by (exclusive).
895
+ * Only overlays that contain a change past `sinceBatchId` are returned.
896
+ * @param count - The number of overlays to return. Can be exceeded if the last
897
+ * batch contains more entries.
898
+ * @return Mapping of each document key in the collection group to its overlay.
899
+ */
900
+ getOverlaysForCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, sinceBatchId: number, count: number): PersistencePromise<Map<_DocumentKey, Overlay>>;
901
+ }
902
+
853
903
  /**
854
904
  * A `DocumentReference` refers to a document location in a Firestore database
855
905
  * and can be used to write, read, or listen to the location. The document at
@@ -967,8 +1017,7 @@ export declare class DocumentSnapshot<T = DocumentData> extends DocumentSnapshot
967
1017
  /** @hideconstructor protected */
968
1018
  constructor(_firestore: Firestore, userDataWriter: AbstractUserDataWriter, key: _DocumentKey, document: Document_2 | null, metadata: SnapshotMetadata, converter: UntypedFirestoreDataConverter<T> | null);
969
1019
  /**
970
- * Property of the `DocumentSnapshot` that signals whether or not the data
971
- * exists. True if the document exists.
1020
+ * Returns whether or not the data exists. True if the document exists.
972
1021
  */
973
1022
  exists(): this is QueryDocumentSnapshot<T>;
974
1023
  /**
@@ -1192,6 +1241,45 @@ declare interface EventManager {
1192
1241
 
1193
1242
  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';
1194
1243
 
1244
+ /**
1245
+ * An index definition for field indexes in Firestore.
1246
+ *
1247
+ * Every index is associated with a collection. The definition contains a list
1248
+ * of fields and their index kind (which can be `ASCENDING`, `DESCENDING` or
1249
+ * `CONTAINS` for ArrayContains/ArrayContainsAny queries).
1250
+ *
1251
+ * Unlike the backend, the SDK does not differentiate between collection or
1252
+ * collection group-scoped indices. Every index can be used for both single
1253
+ * collection and collection group queries.
1254
+ */
1255
+ declare class FieldIndex {
1256
+ /**
1257
+ * The index ID. Returns -1 if the index ID is not available (e.g. the index
1258
+ * has not yet been persisted).
1259
+ */
1260
+ readonly indexId: number;
1261
+ /** The collection ID this index applies to. */
1262
+ readonly collectionGroup: string;
1263
+ /** The field segments for this index. */
1264
+ readonly fields: IndexSegment[];
1265
+ /** Shows how up-to-date the index is for the current user. */
1266
+ readonly indexState: IndexState_2;
1267
+ /** An ID for an index that has not yet been added to persistence. */
1268
+ static UNKNOWN_ID: number;
1269
+ constructor(
1270
+ /**
1271
+ * The index ID. Returns -1 if the index ID is not available (e.g. the index
1272
+ * has not yet been persisted).
1273
+ */
1274
+ indexId: number,
1275
+ /** The collection ID this index applies to. */
1276
+ collectionGroup: string,
1277
+ /** The field segments for this index. */
1278
+ fields: IndexSegment[],
1279
+ /** Shows how up-to-date the index is for the current user. */
1280
+ indexState: IndexState_2);
1281
+ }
1282
+
1195
1283
  /**
1196
1284
  * Provides a set of fields that can be used to partially patch a document.
1197
1285
  * FieldMask is used in conjunction with ObjectValue.
@@ -2154,6 +2242,20 @@ export declare function increment(n: number): FieldValue;
2154
2242
 
2155
2243
  declare type IndexFieldMode = 'MODE_UNSPECIFIED' | 'ASCENDING' | 'DESCENDING';
2156
2244
 
2245
+ /** The type of the index, e.g. for which type of query it can be used. */
2246
+ declare const enum IndexKind {
2247
+ /**
2248
+ * Ordered index. Can be used for <, <=, ==, >=, >, !=, IN and NOT IN queries.
2249
+ */
2250
+ ASCENDING = 0,
2251
+ /**
2252
+ * Ordered index. Can be used for <, <=, ==, >=, >, !=, IN and NOT IN queries.
2253
+ */
2254
+ DESCENDING = 1,
2255
+ /** Contains index. Can be used for ArrayContains and ArrayContainsAny. */
2256
+ CONTAINS = 2
2257
+ }
2258
+
2157
2259
  /**
2158
2260
  * Represents a set of indexes that are used to execute queries efficiently.
2159
2261
  *
@@ -2177,10 +2279,125 @@ declare interface IndexManager {
2177
2279
  * path for a root-level collection).
2178
2280
  */
2179
2281
  getCollectionParents(transaction: PersistenceTransaction, collectionId: string): PersistencePromise<_ResourcePath[]>;
2282
+ /**
2283
+ * Adds a field path index.
2284
+ *
2285
+ * Values for this index are persisted via the index backfill, which runs
2286
+ * asynchronously in the background. Once the first values are written,
2287
+ * an index can be used to serve partial results for any matching queries.
2288
+ * Any unindexed portion of the database will continue to be served via
2289
+ * collection scons.
2290
+ */
2291
+ addFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
2292
+ /** Removes the given field index and deletes all index values. */
2293
+ deleteFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
2294
+ /**
2295
+ * Returns a list of field indexes that correspond to the specified collection
2296
+ * group.
2297
+ *
2298
+ * @param collectionGroup The collection group to get matching field indexes
2299
+ * for.
2300
+ * @return A collection of field indexes for the specified collection group.
2301
+ */
2302
+ getFieldIndexes(transaction: PersistenceTransaction, collectionGroup: string): PersistencePromise<FieldIndex[]>;
2303
+ /** Returns all configured field indexes. */
2304
+ getFieldIndexes(transaction: PersistenceTransaction): PersistencePromise<FieldIndex[]>;
2305
+ /**
2306
+ * Returns an index that can be used to serve the provided target. Returns
2307
+ * `null` if no index is configured.
2308
+ */
2309
+ getFieldIndex(transaction: PersistenceTransaction, target: Target): PersistencePromise<FieldIndex | null>;
2310
+ /**
2311
+ * Returns the documents that match the given target based on the provided
2312
+ * index.
2313
+ */
2314
+ getDocumentsMatchingTarget(transaction: PersistenceTransaction, fieldIndex: FieldIndex, target: Target): PersistencePromise<DocumentKeySet>;
2315
+ /**
2316
+ * Returns the next collection group to update. Returns `null` if no group
2317
+ * exists.
2318
+ */
2319
+ getNextCollectionGroupToUpdate(transaction: PersistenceTransaction): PersistencePromise<string | null>;
2320
+ /**
2321
+ * Sets the collection group's latest read time.
2322
+ *
2323
+ * This method updates the index offset for all field indices for the
2324
+ * collection group and increments their sequence number. Subsequent calls to
2325
+ * `getNextCollectionGroupToUpdate()` will return a different collection group
2326
+ * (unless only one collection group is configured).
2327
+ */
2328
+ updateCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, offset: IndexOffset): PersistencePromise<void>;
2329
+ /** Updates the index entries for the provided documents. */
2330
+ updateIndexEntries(transaction: PersistenceTransaction, documents: DocumentMap): PersistencePromise<void>;
2331
+ }
2332
+
2333
+ /**
2334
+ * Stores the latest read time, document and batch ID that were processed for an
2335
+ * index.
2336
+ */
2337
+ declare class IndexOffset {
2338
+ /**
2339
+ * The latest read time version that has been indexed by Firestore for this
2340
+ * field index.
2341
+ */
2342
+ readonly readTime: SnapshotVersion;
2343
+ /**
2344
+ * The key of the last document that was indexed for this query. Use
2345
+ * `DocumentKey.empty()` if no document has been indexed.
2346
+ */
2347
+ readonly documentKey: _DocumentKey;
2348
+ readonly largestBatchId: number;
2349
+ constructor(
2350
+ /**
2351
+ * The latest read time version that has been indexed by Firestore for this
2352
+ * field index.
2353
+ */
2354
+ readTime: SnapshotVersion,
2355
+ /**
2356
+ * The key of the last document that was indexed for this query. Use
2357
+ * `DocumentKey.empty()` if no document has been indexed.
2358
+ */
2359
+ documentKey: _DocumentKey, largestBatchId: number);
2360
+ /** The state of an index that has not yet been backfilled. */
2361
+ static min(): IndexOffset;
2362
+ }
2363
+
2364
+ /** An index component consisting of field path and index type. */
2365
+ declare class IndexSegment {
2366
+ /** The field path of the component. */
2367
+ readonly fieldPath: _FieldPath;
2368
+ /** The fields sorting order. */
2369
+ readonly kind: IndexKind;
2370
+ constructor(
2371
+ /** The field path of the component. */
2372
+ fieldPath: _FieldPath,
2373
+ /** The fields sorting order. */
2374
+ kind: IndexKind);
2180
2375
  }
2181
2376
 
2182
2377
  declare type IndexState = 'STATE_UNSPECIFIED' | 'CREATING' | 'READY' | 'ERROR';
2183
2378
 
2379
+ /**
2380
+ * Stores the "high water mark" that indicates how updated the Index is for the
2381
+ * current user.
2382
+ */
2383
+ declare class IndexState_2 {
2384
+ /**
2385
+ * Indicates when the index was last updated (relative to other indexes).
2386
+ */
2387
+ readonly sequenceNumber: number;
2388
+ /** The the latest indexed read time, document and batch id. */
2389
+ readonly offset: IndexOffset;
2390
+ constructor(
2391
+ /**
2392
+ * Indicates when the index was last updated (relative to other indexes).
2393
+ */
2394
+ sequenceNumber: number,
2395
+ /** The the latest indexed read time, document and batch id. */
2396
+ offset: IndexOffset);
2397
+ /** The state of an index that has not yet been backfilled. */
2398
+ static empty(): IndexState_2;
2399
+ }
2400
+
2184
2401
  /**
2185
2402
  * Initializes a new instance of {@link Firestore} with the provided settings.
2186
2403
  * Can only be called before any other function, including
@@ -3190,6 +3407,21 @@ export declare type OrderByDirection = 'desc' | 'asc';
3190
3407
 
3191
3408
  declare type OrderDirection = 'DIRECTION_UNSPECIFIED' | 'ASCENDING' | 'DESCENDING';
3192
3409
 
3410
+ /**
3411
+ * Representation of an overlay computed by Firestore.
3412
+ *
3413
+ * Holds information about a mutation and the largest batch id in Firestore when
3414
+ * the mutation was created.
3415
+ */
3416
+ declare class Overlay {
3417
+ readonly largestBatchId: number;
3418
+ readonly mutation: Mutation;
3419
+ constructor(largestBatchId: number, mutation: Mutation);
3420
+ getKey(): _DocumentKey;
3421
+ isEqual(other: Overlay | null): boolean;
3422
+ toString(): string;
3423
+ }
3424
+
3193
3425
  declare interface ParseContext {
3194
3426
  readonly databaseId: _DatabaseId;
3195
3427
  readonly ignoreUndefinedProperties: boolean;
@@ -3293,7 +3525,7 @@ declare interface Persistence {
3293
3525
  * extent possible (e.g. in the case of uid switching from
3294
3526
  * sally=&gt;jack=&gt;sally, sally's mutation queue will be preserved).
3295
3527
  */
3296
- getMutationQueue(user: User): MutationQueue;
3528
+ getMutationQueue(user: User, indexManager: IndexManager): MutationQueue;
3297
3529
  /**
3298
3530
  * Returns a TargetCache representing the persisted cache of targets.
3299
3531
  *
@@ -3326,7 +3558,12 @@ declare interface Persistence {
3326
3558
  * this is called. In particular, the memory-backed implementation does this
3327
3559
  * to emulate the persisted implementation to the extent possible.
3328
3560
  */
3329
- getIndexManager(): IndexManager;
3561
+ getIndexManager(user: User): IndexManager;
3562
+ /**
3563
+ * Returns a DocumentOverlayCache representing the documents that are mutated
3564
+ * locally.
3565
+ */
3566
+ getDocumentOverlayCache(user: User): DocumentOverlayCache;
3330
3567
  /**
3331
3568
  * Performs an operation inside a persistence transaction. Any reads or writes
3332
3569
  * against persistence must be performed within a transaction. Writes will be
@@ -3737,6 +3974,8 @@ declare type Rejector = (error: Error) => void;
3737
3974
  * documents that are known to not exist.
3738
3975
  */
3739
3976
  declare interface RemoteDocumentCache {
3977
+ /** Sets the index manager to use for managing the collectionGroup index. */
3978
+ setIndexManager(indexManager: IndexManager): void;
3740
3979
  /**
3741
3980
  * Looks up an entry in the cache.
3742
3981
  *
@@ -3754,19 +3993,14 @@ declare interface RemoteDocumentCache {
3754
3993
  */
3755
3994
  getEntries(transaction: PersistenceTransaction, documentKeys: DocumentKeySet): PersistencePromise<MutableDocumentMap>;
3756
3995
  /**
3757
- * Executes a query against the cached Document entries.
3758
- *
3759
- * Implementations may return extra documents if convenient. The results
3760
- * should be re-filtered by the consumer before presenting them to the user.
3761
- *
3762
- * Cached NoDocument entries have no bearing on query results.
3996
+ * Returns the documents from the provided collection.
3763
3997
  *
3764
- * @param query - The query to match documents against.
3998
+ * @param collection - The collection to read.
3765
3999
  * @param sinceReadTime - If not set to SnapshotVersion.min(), return only
3766
4000
  * documents that have been read since this snapshot version (exclusive).
3767
4001
  * @returns The set of matching documents.
3768
4002
  */
3769
- getDocumentsMatchingQuery(transaction: PersistenceTransaction, query: Query_2, sinceReadTime: SnapshotVersion): PersistencePromise<MutableDocumentMap>;
4003
+ getAll(transaction: PersistenceTransaction, collection: _ResourcePath, sinceReadTime: SnapshotVersion): PersistencePromise<MutableDocumentMap>;
3770
4004
  /**
3771
4005
  * Provides access to add or update the contents of the cache. The buffer
3772
4006
  * handles proper size accounting for the change.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firebase/firestore",
3
- "version": "3.4.4-canary.2dd99ae2d",
3
+ "version": "3.4.4-canary.3e9f3e253",
4
4
  "engines": {
5
5
  "node": ">=10.10.0"
6
6
  },
@@ -77,22 +77,22 @@
77
77
  "lite/package.json"
78
78
  ],
79
79
  "dependencies": {
80
- "@firebase/component": "0.5.10-canary.2dd99ae2d",
81
- "@firebase/logger": "0.3.2-canary.2dd99ae2d",
82
- "@firebase/util": "1.4.3-canary.2dd99ae2d",
83
- "@firebase/webchannel-wrapper": "0.6.1-canary.2dd99ae2d",
80
+ "@firebase/component": "0.5.10-canary.3e9f3e253",
81
+ "@firebase/logger": "0.3.2-canary.3e9f3e253",
82
+ "@firebase/util": "1.4.3-canary.3e9f3e253",
83
+ "@firebase/webchannel-wrapper": "0.6.1-canary.3e9f3e253",
84
84
  "@grpc/grpc-js": "^1.3.2",
85
85
  "@grpc/proto-loader": "^0.6.0",
86
86
  "node-fetch": "2.6.7",
87
87
  "tslib": "^2.1.0"
88
88
  },
89
89
  "peerDependencies": {
90
- "@firebase/app": "0.7.15-canary.2dd99ae2d"
90
+ "@firebase/app": "0.7.16-canary.3e9f3e253"
91
91
  },
92
92
  "devDependencies": {
93
- "@firebase/app": "0.7.15-canary.2dd99ae2d",
94
- "@firebase/app-compat": "0.1.16-canary.2dd99ae2d",
95
- "@firebase/auth": "0.19.7-canary.2dd99ae2d",
93
+ "@firebase/app": "0.7.16-canary.3e9f3e253",
94
+ "@firebase/app-compat": "0.1.17-canary.3e9f3e253",
95
+ "@firebase/auth": "0.19.8-canary.3e9f3e253",
96
96
  "@rollup/plugin-alias": "3.1.5",
97
97
  "@rollup/plugin-json": "4.1.0",
98
98
  "@types/eslint": "7.28.0",