@firebase/firestore 3.4.4 → 3.4.5-canary.8ac8fb099

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/firestore/src/api/credentials.d.ts +1 -0
  3. package/dist/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
  4. package/dist/firestore/src/api/snapshot.d.ts +1 -2
  5. package/dist/firestore/src/api.d.ts +1 -1
  6. package/dist/firestore/src/core/database_info.d.ts +1 -0
  7. package/dist/firestore/src/core/target.d.ts +34 -5
  8. package/dist/firestore/src/index/index_byte_encoder.d.ts +18 -1
  9. package/dist/firestore/src/index/index_entry.d.ts +32 -0
  10. package/dist/firestore/src/lite-api/query.d.ts +2 -2
  11. package/dist/firestore/src/local/document_overlay_cache.d.ts +72 -0
  12. package/dist/firestore/src/local/index_manager.d.ts +52 -0
  13. package/dist/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
  14. package/dist/firestore/src/local/indexeddb_index_manager.d.ts +87 -2
  15. package/dist/firestore/src/local/indexeddb_persistence.d.ts +6 -4
  16. package/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
  17. package/dist/firestore/src/local/indexeddb_schema.d.ts +195 -7
  18. package/dist/firestore/src/local/local_documents_view.d.ts +0 -1
  19. package/dist/firestore/src/local/local_serializer.d.ts +19 -3
  20. package/dist/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
  21. package/dist/firestore/src/local/memory_index_manager.d.ts +11 -0
  22. package/dist/firestore/src/local/memory_persistence.d.ts +6 -2
  23. package/dist/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
  24. package/dist/firestore/src/local/persistence.d.ts +8 -2
  25. package/dist/firestore/src/local/remote_document_cache.d.ts +7 -9
  26. package/dist/firestore/src/local/remote_document_change_buffer.d.ts +3 -12
  27. package/dist/firestore/src/local/simple_db.d.ts +12 -0
  28. package/dist/firestore/src/model/document.d.ts +7 -0
  29. package/dist/firestore/src/model/document_key.d.ts +6 -0
  30. package/dist/firestore/src/model/field_index.d.ts +89 -7
  31. package/dist/firestore/src/model/overlay.d.ts +32 -0
  32. package/dist/firestore/src/model/target_index_matcher.d.ts +70 -0
  33. package/dist/firestore/src/model/type_order.d.ts +2 -1
  34. package/dist/firestore/src/model/values.d.ts +7 -0
  35. package/dist/firestore/src/platform/node/base64.d.ts +1 -0
  36. package/dist/firestore/src/platform/node/grpc_connection.d.ts +2 -2
  37. package/dist/firestore/src/platform/node/load_protos.d.ts +2 -2
  38. package/dist/firestore/src/util/sorted_set.d.ts +18 -0
  39. package/dist/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
  40. package/dist/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
  41. package/dist/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
  42. package/dist/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
  43. package/dist/firestore/test/unit/local/test_index_manager.d.ts +11 -0
  44. package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +5 -3
  45. package/dist/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
  46. package/dist/firestore/test/unit/model/field_index.test.d.ts +17 -0
  47. package/dist/firestore/test/unit/model/target.test.d.ts +17 -0
  48. package/dist/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
  49. package/dist/firestore/test/util/helpers.d.ts +8 -2
  50. package/dist/index.d.ts +1 -2
  51. package/dist/index.esm2017.js +5415 -3839
  52. package/dist/index.esm2017.js.map +1 -1
  53. package/dist/index.esm5.js +5039 -3613
  54. package/dist/index.esm5.js.map +1 -1
  55. package/dist/index.node.cjs.js +2908 -592
  56. package/dist/index.node.cjs.js.map +1 -1
  57. package/dist/index.node.mjs +2888 -593
  58. package/dist/index.node.mjs.map +1 -1
  59. package/dist/index.rn.js +5396 -3862
  60. package/dist/index.rn.js.map +1 -1
  61. package/dist/internal.d.ts +265 -26
  62. package/dist/lite/firestore/src/api/credentials.d.ts +1 -0
  63. package/dist/lite/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
  64. package/dist/lite/firestore/src/api/snapshot.d.ts +1 -2
  65. package/dist/lite/firestore/src/api.d.ts +1 -1
  66. package/dist/lite/firestore/src/core/database_info.d.ts +1 -0
  67. package/dist/lite/firestore/src/core/target.d.ts +34 -5
  68. package/dist/lite/firestore/src/index/index_byte_encoder.d.ts +18 -1
  69. package/dist/lite/firestore/src/index/index_entry.d.ts +32 -0
  70. package/dist/lite/firestore/src/lite-api/query.d.ts +2 -2
  71. package/dist/lite/firestore/src/local/document_overlay_cache.d.ts +72 -0
  72. package/dist/lite/firestore/src/local/index_manager.d.ts +52 -0
  73. package/dist/lite/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
  74. package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +87 -2
  75. package/dist/lite/firestore/src/local/indexeddb_persistence.d.ts +6 -4
  76. package/dist/lite/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
  77. package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +195 -7
  78. package/dist/lite/firestore/src/local/local_documents_view.d.ts +0 -1
  79. package/dist/lite/firestore/src/local/local_serializer.d.ts +19 -3
  80. package/dist/lite/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
  81. package/dist/lite/firestore/src/local/memory_index_manager.d.ts +11 -0
  82. package/dist/lite/firestore/src/local/memory_persistence.d.ts +6 -2
  83. package/dist/lite/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
  84. package/dist/lite/firestore/src/local/persistence.d.ts +8 -2
  85. package/dist/lite/firestore/src/local/remote_document_cache.d.ts +7 -9
  86. package/dist/lite/firestore/src/local/remote_document_change_buffer.d.ts +3 -12
  87. package/dist/lite/firestore/src/local/simple_db.d.ts +12 -0
  88. package/dist/lite/firestore/src/model/document.d.ts +7 -0
  89. package/dist/lite/firestore/src/model/document_key.d.ts +6 -0
  90. package/dist/lite/firestore/src/model/field_index.d.ts +89 -7
  91. package/dist/lite/firestore/src/model/overlay.d.ts +32 -0
  92. package/dist/lite/firestore/src/model/target_index_matcher.d.ts +70 -0
  93. package/dist/lite/firestore/src/model/type_order.d.ts +2 -1
  94. package/dist/lite/firestore/src/model/values.d.ts +7 -0
  95. package/dist/lite/firestore/src/platform/node/base64.d.ts +1 -0
  96. package/dist/lite/firestore/src/platform/node/grpc_connection.d.ts +2 -2
  97. package/dist/lite/firestore/src/platform/node/load_protos.d.ts +2 -2
  98. package/dist/lite/firestore/src/util/sorted_set.d.ts +18 -0
  99. package/dist/lite/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
  100. package/dist/lite/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
  101. package/dist/lite/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
  102. package/dist/lite/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
  103. package/dist/lite/firestore/test/unit/local/test_index_manager.d.ts +11 -0
  104. package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +5 -3
  105. package/dist/lite/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
  106. package/dist/lite/firestore/test/unit/model/field_index.test.d.ts +17 -0
  107. package/dist/lite/firestore/test/unit/model/target.test.d.ts +17 -0
  108. package/dist/lite/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
  109. package/dist/lite/firestore/test/util/helpers.d.ts +8 -2
  110. package/dist/lite/index.browser.esm2017.js +1207 -1174
  111. package/dist/lite/index.browser.esm2017.js.map +1 -1
  112. package/dist/lite/index.browser.esm5.js +370 -361
  113. package/dist/lite/index.browser.esm5.js.map +1 -1
  114. package/dist/lite/index.node.cjs.js +83 -41
  115. package/dist/lite/index.node.cjs.js.map +1 -1
  116. package/dist/lite/index.node.mjs +83 -41
  117. package/dist/lite/index.node.mjs.map +1 -1
  118. package/dist/lite/index.rn.esm2017.js +375 -342
  119. package/dist/lite/index.rn.esm2017.js.map +1 -1
  120. package/dist/lite/internal.d.ts +16 -2
  121. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +125 -124
  122. package/dist/lite/packages/firestore/src/api/credentials.d.ts +1 -0
  123. package/dist/lite/packages/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
  124. package/dist/lite/packages/firestore/src/api/snapshot.d.ts +1 -2
  125. package/dist/lite/packages/firestore/src/api.d.ts +1 -1
  126. package/dist/lite/packages/firestore/src/core/database_info.d.ts +1 -0
  127. package/dist/lite/packages/firestore/src/core/target.d.ts +34 -5
  128. package/dist/lite/packages/firestore/src/index/index_byte_encoder.d.ts +18 -1
  129. package/dist/lite/packages/firestore/src/index/index_entry.d.ts +32 -0
  130. package/dist/lite/packages/firestore/src/lite-api/query.d.ts +2 -2
  131. package/dist/lite/packages/firestore/src/local/document_overlay_cache.d.ts +72 -0
  132. package/dist/lite/packages/firestore/src/local/index_manager.d.ts +52 -0
  133. package/dist/lite/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
  134. package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +87 -2
  135. package/dist/lite/packages/firestore/src/local/indexeddb_persistence.d.ts +6 -4
  136. package/dist/lite/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
  137. package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +195 -7
  138. package/dist/lite/packages/firestore/src/local/local_documents_view.d.ts +0 -1
  139. package/dist/lite/packages/firestore/src/local/local_serializer.d.ts +19 -3
  140. package/dist/lite/packages/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
  141. package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +11 -0
  142. package/dist/lite/packages/firestore/src/local/memory_persistence.d.ts +6 -2
  143. package/dist/lite/packages/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
  144. package/dist/lite/packages/firestore/src/local/persistence.d.ts +8 -2
  145. package/dist/lite/packages/firestore/src/local/remote_document_cache.d.ts +7 -9
  146. package/dist/lite/packages/firestore/src/local/remote_document_change_buffer.d.ts +3 -12
  147. package/dist/lite/packages/firestore/src/local/simple_db.d.ts +12 -0
  148. package/dist/lite/packages/firestore/src/model/document.d.ts +7 -0
  149. package/dist/lite/packages/firestore/src/model/document_key.d.ts +6 -0
  150. package/dist/lite/packages/firestore/src/model/field_index.d.ts +89 -7
  151. package/dist/lite/packages/firestore/src/model/overlay.d.ts +32 -0
  152. package/dist/lite/packages/firestore/src/model/target_index_matcher.d.ts +70 -0
  153. package/dist/lite/packages/firestore/src/model/type_order.d.ts +2 -1
  154. package/dist/lite/packages/firestore/src/model/values.d.ts +7 -0
  155. package/dist/lite/packages/firestore/src/platform/node/base64.d.ts +1 -0
  156. package/dist/lite/packages/firestore/src/platform/node/grpc_connection.d.ts +2 -2
  157. package/dist/lite/packages/firestore/src/platform/node/load_protos.d.ts +2 -2
  158. package/dist/lite/packages/firestore/src/util/sorted_set.d.ts +18 -0
  159. package/dist/lite/packages/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
  160. package/dist/lite/packages/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
  161. package/dist/lite/packages/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
  162. package/dist/lite/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
  163. package/dist/lite/packages/firestore/test/unit/local/test_index_manager.d.ts +11 -0
  164. package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +5 -3
  165. package/dist/lite/packages/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
  166. package/dist/lite/packages/firestore/test/unit/model/field_index.test.d.ts +17 -0
  167. package/dist/lite/packages/firestore/test/unit/model/target.test.d.ts +17 -0
  168. package/dist/lite/packages/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
  169. package/dist/lite/packages/firestore/test/util/helpers.d.ts +8 -2
  170. package/dist/lite/private.d.ts +9 -2
  171. package/dist/packages/firestore/dist/index.esm2017.d.ts +199 -194
  172. package/dist/packages/firestore/src/api/credentials.d.ts +1 -0
  173. package/dist/packages/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
  174. package/dist/packages/firestore/src/api/snapshot.d.ts +1 -2
  175. package/dist/packages/firestore/src/api.d.ts +1 -1
  176. package/dist/packages/firestore/src/core/database_info.d.ts +1 -0
  177. package/dist/packages/firestore/src/core/target.d.ts +34 -5
  178. package/dist/packages/firestore/src/index/index_byte_encoder.d.ts +18 -1
  179. package/dist/packages/firestore/src/index/index_entry.d.ts +32 -0
  180. package/dist/packages/firestore/src/lite-api/query.d.ts +2 -2
  181. package/dist/packages/firestore/src/local/document_overlay_cache.d.ts +72 -0
  182. package/dist/packages/firestore/src/local/index_manager.d.ts +52 -0
  183. package/dist/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
  184. package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +87 -2
  185. package/dist/packages/firestore/src/local/indexeddb_persistence.d.ts +6 -4
  186. package/dist/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
  187. package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +195 -7
  188. package/dist/packages/firestore/src/local/local_documents_view.d.ts +0 -1
  189. package/dist/packages/firestore/src/local/local_serializer.d.ts +19 -3
  190. package/dist/packages/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
  191. package/dist/packages/firestore/src/local/memory_index_manager.d.ts +11 -0
  192. package/dist/packages/firestore/src/local/memory_persistence.d.ts +6 -2
  193. package/dist/packages/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
  194. package/dist/packages/firestore/src/local/persistence.d.ts +8 -2
  195. package/dist/packages/firestore/src/local/remote_document_cache.d.ts +7 -9
  196. package/dist/packages/firestore/src/local/remote_document_change_buffer.d.ts +3 -12
  197. package/dist/packages/firestore/src/local/simple_db.d.ts +12 -0
  198. package/dist/packages/firestore/src/model/document.d.ts +7 -0
  199. package/dist/packages/firestore/src/model/document_key.d.ts +6 -0
  200. package/dist/packages/firestore/src/model/field_index.d.ts +89 -7
  201. package/dist/packages/firestore/src/model/overlay.d.ts +32 -0
  202. package/dist/packages/firestore/src/model/target_index_matcher.d.ts +70 -0
  203. package/dist/packages/firestore/src/model/type_order.d.ts +2 -1
  204. package/dist/packages/firestore/src/model/values.d.ts +7 -0
  205. package/dist/packages/firestore/src/platform/node/base64.d.ts +1 -0
  206. package/dist/packages/firestore/src/platform/node/grpc_connection.d.ts +2 -2
  207. package/dist/packages/firestore/src/platform/node/load_protos.d.ts +2 -2
  208. package/dist/packages/firestore/src/util/sorted_set.d.ts +18 -0
  209. package/dist/packages/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
  210. package/dist/packages/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
  211. package/dist/packages/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
  212. package/dist/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
  213. package/dist/packages/firestore/test/unit/local/test_index_manager.d.ts +11 -0
  214. package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +5 -3
  215. package/dist/packages/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
  216. package/dist/packages/firestore/test/unit/model/field_index.test.d.ts +17 -0
  217. package/dist/packages/firestore/test/unit/model/target.test.d.ts +17 -0
  218. package/dist/packages/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
  219. package/dist/packages/firestore/test/util/helpers.d.ts +8 -2
  220. package/dist/private.d.ts +258 -26
  221. 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
  /**
@@ -623,6 +623,7 @@ export declare class _DatabaseId {
623
623
  readonly projectId: string;
624
624
  readonly database: string;
625
625
  constructor(projectId: string, database?: string);
626
+ static empty(): _DatabaseId;
626
627
  get isDefaultDatabase(): boolean;
627
628
  isEqual(other: {}): boolean;
628
629
  }
@@ -841,6 +842,11 @@ declare interface Document_2 {
841
842
  * document was guaranteed to not exist.
842
843
  */
843
844
  readonly version: SnapshotVersion;
845
+ /**
846
+ * The timestamp at which this document was read from the remote server. Uses
847
+ * `SnapshotVersion.min()` for documents created by the user.
848
+ */
849
+ readonly readTime: SnapshotVersion;
844
850
  /** The underlying data of this document or an empty value if no data exists. */
845
851
  readonly data: ObjectValue;
846
852
  /** Returns whether local mutations were applied via the mutation queue. */
@@ -931,8 +937,14 @@ export declare class _DocumentKey {
931
937
  constructor(path: _ResourcePath);
932
938
  static fromPath(path: string): _DocumentKey;
933
939
  static fromName(name: string): _DocumentKey;
940
+ static empty(): _DocumentKey;
941
+ get collectionGroup(): string;
934
942
  /** Returns true if the document is in the specified collectionId. */
935
943
  hasCollectionId(collectionId: string): boolean;
944
+ /** Returns the collection group (i.e. the name of the parent collection) for this key. */
945
+ getCollectionGroup(): string;
946
+ /** Returns the fully qualified path to the parent collection. */
947
+ getCollectionPath(): _ResourcePath;
936
948
  isEqual(other: _DocumentKey | null): boolean;
937
949
  toString(): string;
938
950
  static comparator(k1: _DocumentKey, k2: _DocumentKey): number;
@@ -950,6 +962,56 @@ declare type DocumentKeySet = SortedSet<_DocumentKey>;
950
962
 
951
963
  declare type DocumentMap = SortedMap<_DocumentKey, Document_2>;
952
964
 
965
+ /**
966
+ * Provides methods to read and write document overlays.
967
+ *
968
+ * An overlay is a saved mutation, that gives a local view of a document when
969
+ * applied to the remote version of the document.
970
+ *
971
+ * Each overlay stores the largest batch ID that is included in the overlay,
972
+ * which allows us to remove the overlay once all batches leading up to it have
973
+ * been acknowledged.
974
+ */
975
+ declare interface DocumentOverlayCache {
976
+ /**
977
+ * Gets the saved overlay mutation for the given document key.
978
+ * Returns null if there is no overlay for that key.
979
+ */
980
+ getOverlay(transaction: PersistenceTransaction, key: _DocumentKey): PersistencePromise<Overlay | null>;
981
+ /**
982
+ * Saves the given document mutation map to persistence as overlays.
983
+ * All overlays will have their largest batch id set to `largestBatchId`.
984
+ */
985
+ saveOverlays(transaction: PersistenceTransaction, largestBatchId: number, overlays: 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
+
953
1015
  /**
954
1016
  * A `DocumentReference` refers to a document location in a Firestore database
955
1017
  * and can be used to write, read, or listen to the location. The document at
@@ -1067,8 +1129,7 @@ export declare class DocumentSnapshot<T = DocumentData> extends DocumentSnapshot
1067
1129
  /** @hideconstructor protected */
1068
1130
  constructor(_firestore: Firestore, userDataWriter: AbstractUserDataWriter, key: _DocumentKey, document: Document_2 | null, metadata: SnapshotMetadata, converter: UntypedFirestoreDataConverter<T> | null);
1069
1131
  /**
1070
- * Property of the `DocumentSnapshot` that signals whether or not the data
1071
- * exists. True if the document exists.
1132
+ * Returns whether or not the data exists. True if the document exists.
1072
1133
  */
1073
1134
  exists(): this is QueryDocumentSnapshot<T>;
1074
1135
  /**
@@ -1317,6 +1378,45 @@ export declare function executeWrite(firestore: Firestore, mutations: Mutation[]
1317
1378
 
1318
1379
  declare type FieldFilterOp = 'OPERATOR_UNSPECIFIED' | 'LESS_THAN' | 'LESS_THAN_OR_EQUAL' | 'GREATER_THAN' | 'GREATER_THAN_OR_EQUAL' | 'EQUAL' | 'NOT_EQUAL' | 'ARRAY_CONTAINS' | 'IN' | 'ARRAY_CONTAINS_ANY' | 'NOT_IN';
1319
1380
 
1381
+ /**
1382
+ * An index definition for field indexes in Firestore.
1383
+ *
1384
+ * Every index is associated with a collection. The definition contains a list
1385
+ * of fields and their index kind (which can be `ASCENDING`, `DESCENDING` or
1386
+ * `CONTAINS` for ArrayContains/ArrayContainsAny queries).
1387
+ *
1388
+ * Unlike the backend, the SDK does not differentiate between collection or
1389
+ * collection group-scoped indices. Every index can be used for both single
1390
+ * collection and collection group queries.
1391
+ */
1392
+ declare class FieldIndex {
1393
+ /**
1394
+ * The index ID. Returns -1 if the index ID is not available (e.g. the index
1395
+ * has not yet been persisted).
1396
+ */
1397
+ readonly indexId: number;
1398
+ /** The collection ID this index applies to. */
1399
+ readonly collectionGroup: string;
1400
+ /** The field segments for this index. */
1401
+ readonly fields: IndexSegment[];
1402
+ /** Shows how up-to-date the index is for the current user. */
1403
+ readonly indexState: IndexState_2;
1404
+ /** An ID for an index that has not yet been added to persistence. */
1405
+ static UNKNOWN_ID: number;
1406
+ constructor(
1407
+ /**
1408
+ * The index ID. Returns -1 if the index ID is not available (e.g. the index
1409
+ * has not yet been persisted).
1410
+ */
1411
+ indexId: number,
1412
+ /** The collection ID this index applies to. */
1413
+ collectionGroup: string,
1414
+ /** The field segments for this index. */
1415
+ fields: IndexSegment[],
1416
+ /** Shows how up-to-date the index is for the current user. */
1417
+ indexState: IndexState_2);
1418
+ }
1419
+
1320
1420
  /**
1321
1421
  * Provides a set of fields that can be used to partially patch a document.
1322
1422
  * FieldMask is used in conjunction with ObjectValue.
@@ -2356,6 +2456,20 @@ declare interface IndexField {
2356
2456
 
2357
2457
  declare type IndexFieldMode = 'MODE_UNSPECIFIED' | 'ASCENDING' | 'DESCENDING';
2358
2458
 
2459
+ /** The type of the index, e.g. for which type of query it can be used. */
2460
+ declare const enum IndexKind {
2461
+ /**
2462
+ * Ordered index. Can be used for <, <=, ==, >=, >, !=, IN and NOT IN queries.
2463
+ */
2464
+ ASCENDING = 0,
2465
+ /**
2466
+ * Ordered index. Can be used for <, <=, ==, >=, >, !=, IN and NOT IN queries.
2467
+ */
2468
+ DESCENDING = 1,
2469
+ /** Contains index. Can be used for ArrayContains and ArrayContainsAny. */
2470
+ CONTAINS = 2
2471
+ }
2472
+
2359
2473
  /**
2360
2474
  * Represents a set of indexes that are used to execute queries efficiently.
2361
2475
  *
@@ -2379,10 +2493,125 @@ declare interface IndexManager {
2379
2493
  * path for a root-level collection).
2380
2494
  */
2381
2495
  getCollectionParents(transaction: PersistenceTransaction, collectionId: string): PersistencePromise<_ResourcePath[]>;
2496
+ /**
2497
+ * Adds a field path index.
2498
+ *
2499
+ * Values for this index are persisted via the index backfill, which runs
2500
+ * asynchronously in the background. Once the first values are written,
2501
+ * an index can be used to serve partial results for any matching queries.
2502
+ * Any unindexed portion of the database will continue to be served via
2503
+ * collection scons.
2504
+ */
2505
+ addFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
2506
+ /** Removes the given field index and deletes all index values. */
2507
+ deleteFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
2508
+ /**
2509
+ * Returns a list of field indexes that correspond to the specified collection
2510
+ * group.
2511
+ *
2512
+ * @param collectionGroup The collection group to get matching field indexes
2513
+ * for.
2514
+ * @return A collection of field indexes for the specified collection group.
2515
+ */
2516
+ getFieldIndexes(transaction: PersistenceTransaction, collectionGroup: string): PersistencePromise<FieldIndex[]>;
2517
+ /** Returns all configured field indexes. */
2518
+ getFieldIndexes(transaction: PersistenceTransaction): PersistencePromise<FieldIndex[]>;
2519
+ /**
2520
+ * Returns an index that can be used to serve the provided target. Returns
2521
+ * `null` if no index is configured.
2522
+ */
2523
+ getFieldIndex(transaction: PersistenceTransaction, target: Target): PersistencePromise<FieldIndex | null>;
2524
+ /**
2525
+ * Returns the documents that match the given target based on the provided
2526
+ * index or `null` if the target does not have a matching index.
2527
+ */
2528
+ getDocumentsMatchingTarget(transaction: PersistenceTransaction, target: Target): PersistencePromise<DocumentKeySet | null>;
2529
+ /**
2530
+ * Returns the next collection group to update. Returns `null` if no group
2531
+ * exists.
2532
+ */
2533
+ getNextCollectionGroupToUpdate(transaction: PersistenceTransaction): PersistencePromise<string | null>;
2534
+ /**
2535
+ * Sets the collection group's latest read time.
2536
+ *
2537
+ * This method updates the index offset for all field indices for the
2538
+ * collection group and increments their sequence number. Subsequent calls to
2539
+ * `getNextCollectionGroupToUpdate()` will return a different collection group
2540
+ * (unless only one collection group is configured).
2541
+ */
2542
+ updateCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, offset: IndexOffset): PersistencePromise<void>;
2543
+ /** Updates the index entries for the provided documents. */
2544
+ updateIndexEntries(transaction: PersistenceTransaction, documents: DocumentMap): PersistencePromise<void>;
2545
+ }
2546
+
2547
+ /**
2548
+ * Stores the latest read time, document and batch ID that were processed for an
2549
+ * index.
2550
+ */
2551
+ declare class IndexOffset {
2552
+ /**
2553
+ * The latest read time version that has been indexed by Firestore for this
2554
+ * field index.
2555
+ */
2556
+ readonly readTime: SnapshotVersion;
2557
+ /**
2558
+ * The key of the last document that was indexed for this query. Use
2559
+ * `DocumentKey.empty()` if no document has been indexed.
2560
+ */
2561
+ readonly documentKey: _DocumentKey;
2562
+ readonly largestBatchId: number;
2563
+ constructor(
2564
+ /**
2565
+ * The latest read time version that has been indexed by Firestore for this
2566
+ * field index.
2567
+ */
2568
+ readTime: SnapshotVersion,
2569
+ /**
2570
+ * The key of the last document that was indexed for this query. Use
2571
+ * `DocumentKey.empty()` if no document has been indexed.
2572
+ */
2573
+ documentKey: _DocumentKey, largestBatchId: number);
2574
+ /** The state of an index that has not yet been backfilled. */
2575
+ static min(): IndexOffset;
2576
+ }
2577
+
2578
+ /** An index component consisting of field path and index type. */
2579
+ declare class IndexSegment {
2580
+ /** The field path of the component. */
2581
+ readonly fieldPath: _FieldPath;
2582
+ /** The fields sorting order. */
2583
+ readonly kind: IndexKind;
2584
+ constructor(
2585
+ /** The field path of the component. */
2586
+ fieldPath: _FieldPath,
2587
+ /** The fields sorting order. */
2588
+ kind: IndexKind);
2382
2589
  }
2383
2590
 
2384
2591
  declare type IndexState = 'STATE_UNSPECIFIED' | 'CREATING' | 'READY' | 'ERROR';
2385
2592
 
2593
+ /**
2594
+ * Stores the "high water mark" that indicates how updated the Index is for the
2595
+ * current user.
2596
+ */
2597
+ declare class IndexState_2 {
2598
+ /**
2599
+ * Indicates when the index was last updated (relative to other indexes).
2600
+ */
2601
+ readonly sequenceNumber: number;
2602
+ /** The the latest indexed read time, document and batch id. */
2603
+ readonly offset: IndexOffset;
2604
+ constructor(
2605
+ /**
2606
+ * Indicates when the index was last updated (relative to other indexes).
2607
+ */
2608
+ sequenceNumber: number,
2609
+ /** The the latest indexed read time, document and batch id. */
2610
+ offset: IndexOffset);
2611
+ /** The state of an index that has not yet been backfilled. */
2612
+ static empty(): IndexState_2;
2613
+ }
2614
+
2386
2615
  /**
2387
2616
  * Initializes a new instance of {@link Firestore} with the provided settings.
2388
2617
  * Can only be called before any other function, including
@@ -2639,6 +2868,7 @@ declare class MutableDocument implements Document_2 {
2639
2868
  readonly key: _DocumentKey;
2640
2869
  private documentType;
2641
2870
  version: SnapshotVersion;
2871
+ readTime: SnapshotVersion;
2642
2872
  data: ObjectValue;
2643
2873
  private documentState;
2644
2874
  private constructor();
@@ -2678,6 +2908,7 @@ declare class MutableDocument implements Document_2 {
2678
2908
  convertToUnknownDocument(version: SnapshotVersion): MutableDocument;
2679
2909
  setHasCommittedMutations(): MutableDocument;
2680
2910
  setHasLocalMutations(): MutableDocument;
2911
+ setReadTime(readTime: SnapshotVersion): MutableDocument;
2681
2912
  get hasLocalMutations(): boolean;
2682
2913
  get hasCommittedMutations(): boolean;
2683
2914
  get hasPendingWrites(): boolean;
@@ -3397,6 +3628,21 @@ export declare type OrderByDirection = 'desc' | 'asc';
3397
3628
 
3398
3629
  declare type OrderDirection = 'DIRECTION_UNSPECIFIED' | 'ASCENDING' | 'DESCENDING';
3399
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
+
3400
3646
  declare interface ParseContext {
3401
3647
  readonly databaseId: _DatabaseId;
3402
3648
  readonly ignoreUndefinedProperties: boolean;
@@ -3500,7 +3746,7 @@ declare interface Persistence {
3500
3746
  * extent possible (e.g. in the case of uid switching from
3501
3747
  * sally=&gt;jack=&gt;sally, sally's mutation queue will be preserved).
3502
3748
  */
3503
- getMutationQueue(user: User): MutationQueue;
3749
+ getMutationQueue(user: User, indexManager: IndexManager): MutationQueue;
3504
3750
  /**
3505
3751
  * Returns a TargetCache representing the persisted cache of targets.
3506
3752
  *
@@ -3533,7 +3779,12 @@ declare interface Persistence {
3533
3779
  * this is called. In particular, the memory-backed implementation does this
3534
3780
  * to emulate the persisted implementation to the extent possible.
3535
3781
  */
3536
- 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;
3537
3788
  /**
3538
3789
  * Performs an operation inside a persistence transaction. Any reads or writes
3539
3790
  * against persistence must be performed within a transaction. Writes will be
@@ -3944,6 +4195,8 @@ declare type Rejector = (error: Error) => void;
3944
4195
  * documents that are known to not exist.
3945
4196
  */
3946
4197
  declare interface RemoteDocumentCache {
4198
+ /** Sets the index manager to use for managing the collectionGroup index. */
4199
+ setIndexManager(indexManager: IndexManager): void;
3947
4200
  /**
3948
4201
  * Looks up an entry in the cache.
3949
4202
  *
@@ -3961,19 +4214,14 @@ declare interface RemoteDocumentCache {
3961
4214
  */
3962
4215
  getEntries(transaction: PersistenceTransaction, documentKeys: DocumentKeySet): PersistencePromise<MutableDocumentMap>;
3963
4216
  /**
3964
- * Executes a query against the cached Document entries.
3965
- *
3966
- * Implementations may return extra documents if convenient. The results
3967
- * should be re-filtered by the consumer before presenting them to the user.
4217
+ * Returns the documents from the provided collection.
3968
4218
  *
3969
- * Cached NoDocument entries have no bearing on query results.
3970
- *
3971
- * @param query - The query to match documents against.
4219
+ * @param collection - The collection to read.
3972
4220
  * @param sinceReadTime - If not set to SnapshotVersion.min(), return only
3973
4221
  * documents that have been read since this snapshot version (exclusive).
3974
4222
  * @returns The set of matching documents.
3975
4223
  */
3976
- getDocumentsMatchingQuery(transaction: PersistenceTransaction, query: Query_2, sinceReadTime: SnapshotVersion): PersistencePromise<MutableDocumentMap>;
4224
+ getAll(transaction: PersistenceTransaction, collection: _ResourcePath, sinceReadTime: SnapshotVersion): PersistencePromise<MutableDocumentMap>;
3977
4225
  /**
3978
4226
  * Provides access to add or update the contents of the cache. The buffer
3979
4227
  * handles proper size accounting for the change.
@@ -3994,14 +4242,6 @@ declare interface RemoteDocumentCache {
3994
4242
  getSize(transaction: PersistenceTransaction): PersistencePromise<number>;
3995
4243
  }
3996
4244
 
3997
- /**
3998
- * Represents a document change to be applied to remote document cache.
3999
- */
4000
- declare interface RemoteDocumentChange {
4001
- readonly document: MutableDocument;
4002
- readonly readTime: SnapshotVersion | null;
4003
- }
4004
-
4005
4245
  /**
4006
4246
  * An in-memory buffer of entries to be written to a RemoteDocumentCache.
4007
4247
  * It can be used to batch up a set of changes to be written to the cache, but
@@ -4017,26 +4257,25 @@ declare interface RemoteDocumentChange {
4017
4257
  * porting this class as part of that implementation work.
4018
4258
  */
4019
4259
  declare abstract class RemoteDocumentChangeBuffer {
4020
- protected changes: ObjectMap<_DocumentKey, RemoteDocumentChange>;
4260
+ protected changes: ObjectMap<_DocumentKey, MutableDocument>;
4021
4261
  private changesApplied;
4022
4262
  protected abstract getFromCache(transaction: PersistenceTransaction, documentKey: _DocumentKey): PersistencePromise<MutableDocument>;
4023
4263
  protected abstract getAllFromCache(transaction: PersistenceTransaction, documentKeys: DocumentKeySet): PersistencePromise<MutableDocumentMap>;
4024
4264
  protected abstract applyChanges(transaction: PersistenceTransaction): PersistencePromise<void>;
4025
- protected getReadTime(key: _DocumentKey): SnapshotVersion;
4026
4265
  /**
4027
4266
  * Buffers a `RemoteDocumentCache.addEntry()` call.
4028
4267
  *
4029
4268
  * You can only modify documents that have already been retrieved via
4030
4269
  * `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`).
4031
4270
  */
4032
- addEntry(document: MutableDocument, readTime: SnapshotVersion): void;
4271
+ addEntry(document: MutableDocument): void;
4033
4272
  /**
4034
4273
  * Buffers a `RemoteDocumentCache.removeEntry()` call.
4035
4274
  *
4036
4275
  * You can only remove documents that have already been retrieved via
4037
4276
  * `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`).
4038
4277
  */
4039
- removeEntry(key: _DocumentKey, readTime?: SnapshotVersion | null): void;
4278
+ removeEntry(key: _DocumentKey, readTime: SnapshotVersion): void;
4040
4279
  /**
4041
4280
  * Looks up an entry in the cache. The buffered changes will first be checked,
4042
4281
  * and if no buffered change applies, this will forward to
@@ -176,6 +176,7 @@ export declare class FirebaseAppCheckTokenProvider implements CredentialsProvide
176
176
  private tokenListener;
177
177
  private forceRefresh;
178
178
  private appCheck;
179
+ private latestAppCheckToken;
179
180
  constructor(appCheckProvider: Provider<AppCheckInternalComponentName>);
180
181
  start(asyncQueue: AsyncQueue, changeListener: CredentialChangeListener<string>): void;
181
182
  getToken(): Promise<Token | null>;
@@ -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
  /**
@@ -20,7 +20,7 @@ export { LoadBundleTask, LoadBundleTaskProgress, TaskState } from './api/bundle'
20
20
  export { FirestoreSettings, PersistenceSettings } from './api/settings';
21
21
  export { DocumentChange, DocumentSnapshot, QueryDocumentSnapshot, QuerySnapshot, snapshotEqual, SnapshotOptions, FirestoreDataConverter, DocumentChangeType, SnapshotMetadata } from './api/snapshot';
22
22
  export { DocumentReference, CollectionReference, Query, doc, collection, collectionGroup, SetOptions, DocumentData, UpdateData, WithFieldValue, PartialWithFieldValue, refEqual, queryEqual } from './api/reference';
23
- export { endAt, endBefore, startAt, startAfter, limit, limitToLast, where, orderBy, query, QueryConstraint, QueryConstraintType, OrderByDirection, WhereFilterOp } from './api/query';
23
+ export { endAt, endBefore, startAt, startAfter, limit, limitToLast, where, orderBy, query, QueryConstraint, QueryConstraintType, OrderByDirection, WhereFilterOp } from './api/filter';
24
24
  export { Unsubscribe, SnapshotListenOptions } from './api/reference_impl';
25
25
  export { runTransaction, Transaction } from './api/transaction';
26
26
  export { getDoc, getDocFromCache, getDocFromServer, getDocs, getDocsFromCache, getDocsFromServer, onSnapshot, onSnapshotsInSync, setDoc, updateDoc, deleteDoc, addDoc, executeWrite } from './api/reference_impl';
@@ -50,6 +50,7 @@ export declare class DatabaseId {
50
50
  readonly projectId: string;
51
51
  readonly database: string;
52
52
  constructor(projectId: string, database?: string);
53
+ static empty(): DatabaseId;
53
54
  get isDefaultDatabase(): boolean;
54
55
  isEqual(other: {}): boolean;
55
56
  }
@@ -15,6 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { Document } from '../model/document';
18
+ import { FieldIndex } from '../model/field_index';
18
19
  import { FieldPath, ResourcePath } from '../model/path';
19
20
  import { Value as ProtoValue } from '../protos/firestore_proto_api';
20
21
  /**
@@ -56,7 +57,31 @@ export declare function newTarget(path: ResourcePath, collectionGroup?: string |
56
57
  export declare function canonifyTarget(target: Target): string;
57
58
  export declare function stringifyTarget(target: Target): string;
58
59
  export declare function targetEquals(left: Target, right: Target): boolean;
59
- export declare function isDocumentTarget(target: Target): boolean;
60
+ export declare function targetIsDocumentTarget(target: Target): boolean;
61
+ /** Returns the field filters that target the given field path. */
62
+ export declare function targetGetFieldFiltersForPath(target: Target, path: FieldPath): FieldFilter[];
63
+ /**
64
+ * Returns the values that are used in ARRAY_CONTAINS or ARRAY_CONTAINS_ANY
65
+ * filters. Returns `null` if there are no such filters.
66
+ */
67
+ export declare function targetGetArrayValues(target: Target, fieldIndex: FieldIndex): ProtoValue[] | null;
68
+ /**
69
+ * Returns the list of values that are used in != or NOT_IN filters. Returns
70
+ * `null` if there are no such filters.
71
+ */
72
+ export declare function targetGetNotInValues(target: Target, fieldIndex: FieldIndex): ProtoValue[] | null;
73
+ /**
74
+ * Returns a lower bound of field values that can be used as a starting point to
75
+ * scan the index defined by `fieldIndex`. Returns `null` if no lower bound
76
+ * exists.
77
+ */
78
+ export declare function targetGetLowerBound(target: Target, fieldIndex: FieldIndex): Bound | null;
79
+ /**
80
+ * Returns an upper bound of field values that can be used as an ending point
81
+ * when scanning the index defined by `fieldIndex`. Returns `null` if no
82
+ * upper bound exists.
83
+ */
84
+ export declare function targetGetUpperBound(target: Target, fieldIndex: FieldIndex): Bound | null;
60
85
  export declare abstract class Filter {
61
86
  abstract matches(doc: Document): boolean;
62
87
  }
@@ -151,10 +176,9 @@ export declare class ArrayContainsAnyFilter extends FieldFilter {
151
176
  */
152
177
  export declare class Bound {
153
178
  readonly position: ProtoValue[];
154
- readonly before: boolean;
155
- constructor(position: ProtoValue[], before: boolean);
179
+ readonly inclusive: boolean;
180
+ constructor(position: ProtoValue[], inclusive: boolean);
156
181
  }
157
- export declare function canonifyBound(bound: Bound): string;
158
182
  /**
159
183
  * An ordering on a field, in some Direction. Direction defaults to ASCENDING.
160
184
  */
@@ -166,9 +190,14 @@ export declare class OrderBy {
166
190
  export declare function canonifyOrderBy(orderBy: OrderBy): string;
167
191
  export declare function stringifyOrderBy(orderBy: OrderBy): string;
168
192
  export declare function orderByEquals(left: OrderBy, right: OrderBy): boolean;
193
+ /**
194
+ * Returns true if a document sorts after a bound using the provided sort
195
+ * order.
196
+ */
197
+ export declare function boundSortsAfterDocument(bound: Bound, orderBy: OrderBy[], doc: Document): boolean;
169
198
  /**
170
199
  * Returns true if a document sorts before a bound using the provided sort
171
200
  * order.
172
201
  */
173
- export declare function sortsBeforeDocument(bound: Bound, orderBy: OrderBy[], doc: Document): boolean;
202
+ export declare function boundSortsBeforeDocument(bound: Bound, orderBy: OrderBy[], doc: Document): boolean;
174
203
  export declare function boundEquals(left: Bound | null, right: Bound | null): boolean;
@@ -1,3 +1,20 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2021 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { IndexKind } from '../model/field_index';
1
18
  import { DirectionalIndexByteEncoder } from './directional_index_byte_encoder';
2
19
  /**
3
20
  * Implements `DirectionalIndexByteEncoder` using `OrderedCodeWriter` for the
@@ -8,7 +25,7 @@ export declare class IndexByteEncoder {
8
25
  private ascending;
9
26
  private descending;
10
27
  seed(encodedBytes: Uint8Array): void;
11
- forKind(kind: 'asc' | 'desc'): DirectionalIndexByteEncoder;
28
+ forKind(kind: IndexKind): DirectionalIndexByteEncoder;
12
29
  encodedBytes(): Uint8Array;
13
30
  reset(): void;
14
31
  }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { DocumentKey } from '../model/document_key';
18
+ /** Represents an index entry saved by the SDK in persisted storage. */
19
+ export declare class IndexEntry {
20
+ readonly indexId: number;
21
+ readonly documentKey: DocumentKey;
22
+ readonly arrayValue: Uint8Array;
23
+ readonly directionalValue: Uint8Array;
24
+ constructor(indexId: number, documentKey: DocumentKey, arrayValue: Uint8Array, directionalValue: Uint8Array);
25
+ /**
26
+ * Returns an IndexEntry entry that sorts immediately after the current
27
+ * directional value.
28
+ */
29
+ successor(): IndexEntry;
30
+ }
31
+ export declare function indexEntryComparator(left: IndexEntry, right: IndexEntry): number;
32
+ export declare function compareByteArrays(left: Uint8Array, right: Uint8Array): number;
@@ -196,8 +196,8 @@ export declare function newQueryOrderBy(query: InternalQuery, fieldPath: Interna
196
196
  * of the query or if any of the fields in the order by are an uncommitted
197
197
  * server timestamp.
198
198
  */
199
- export declare function newQueryBoundFromDocument(query: InternalQuery, databaseId: DatabaseId, methodName: string, doc: Document | null, 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;