@react-native-firebase/firestore 23.8.6 → 24.0.0

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 (359) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/RNFBFirestore.podspec +2 -1
  3. package/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestoreCollectionModule.java +17 -4
  4. package/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestoreDocumentModule.java +2 -2
  5. package/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestorePipelineExecutor.java +1243 -0
  6. package/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestorePipelineNodeBuilder.java +3919 -0
  7. package/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestorePipelineParser.java +1735 -0
  8. package/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestoreSerialize.java +1 -1
  9. package/dist/module/FieldPath.js +59 -0
  10. package/dist/module/FieldPath.js.map +1 -0
  11. package/dist/module/FieldValue.js +82 -0
  12. package/dist/module/FieldValue.js.map +1 -0
  13. package/{lib → dist/module}/FirestoreAggregate.js +31 -43
  14. package/dist/module/FirestoreAggregate.js.map +1 -0
  15. package/dist/module/FirestoreBlob.js +56 -0
  16. package/dist/module/FirestoreBlob.js.map +1 -0
  17. package/dist/module/FirestoreCollectionReference.js +70 -0
  18. package/dist/module/FirestoreCollectionReference.js.map +1 -0
  19. package/{lib → dist/module}/FirestoreDocumentChange.js +12 -15
  20. package/dist/module/FirestoreDocumentChange.js.map +1 -0
  21. package/dist/module/FirestoreDocumentReference.js +170 -0
  22. package/dist/module/FirestoreDocumentReference.js.map +1 -0
  23. package/dist/module/FirestoreDocumentSnapshot.js +88 -0
  24. package/dist/module/FirestoreDocumentSnapshot.js.map +1 -0
  25. package/dist/module/FirestoreFilter.js +146 -0
  26. package/dist/module/FirestoreFilter.js.map +1 -0
  27. package/dist/module/FirestoreGeoPoint.js +80 -0
  28. package/dist/module/FirestoreGeoPoint.js.map +1 -0
  29. package/{lib → dist/module}/FirestorePath.js +5 -12
  30. package/dist/module/FirestorePath.js.map +1 -0
  31. package/{lib → dist/module}/FirestorePersistentCacheIndexManager.js +11 -4
  32. package/dist/module/FirestorePersistentCacheIndexManager.js.map +1 -0
  33. package/dist/module/FirestoreQuery.js +298 -0
  34. package/dist/module/FirestoreQuery.js.map +1 -0
  35. package/{lib → dist/module}/FirestoreQueryModifiers.js +25 -136
  36. package/dist/module/FirestoreQueryModifiers.js.map +1 -0
  37. package/dist/module/FirestoreQuerySnapshot.js +98 -0
  38. package/dist/module/FirestoreQuerySnapshot.js.map +1 -0
  39. package/dist/module/FirestoreSnapshotMetadata.js +38 -0
  40. package/dist/module/FirestoreSnapshotMetadata.js.map +1 -0
  41. package/dist/module/FirestoreStatics.js +50 -0
  42. package/dist/module/FirestoreStatics.js.map +1 -0
  43. package/{lib → dist/module}/FirestoreTimestamp.js +39 -39
  44. package/dist/module/FirestoreTimestamp.js.map +1 -0
  45. package/dist/module/FirestoreTransaction.js +113 -0
  46. package/dist/module/FirestoreTransaction.js.map +1 -0
  47. package/dist/module/FirestoreTransactionHandler.js +137 -0
  48. package/dist/module/FirestoreTransactionHandler.js.map +1 -0
  49. package/dist/module/FirestoreVectorValue.js +75 -0
  50. package/dist/module/FirestoreVectorValue.js.map +1 -0
  51. package/dist/module/FirestoreWriteBatch.js +113 -0
  52. package/dist/module/FirestoreWriteBatch.js.map +1 -0
  53. package/dist/module/LoadBundleTask.js +70 -0
  54. package/dist/module/LoadBundleTask.js.map +1 -0
  55. package/dist/module/index.js +31 -0
  56. package/dist/module/index.js.map +1 -0
  57. package/dist/module/modular/Bytes.js +67 -0
  58. package/dist/module/modular/Bytes.js.map +1 -0
  59. package/dist/module/modular/FieldPath.js +25 -0
  60. package/dist/module/modular/FieldPath.js.map +1 -0
  61. package/dist/module/modular/FieldValue.js +37 -0
  62. package/dist/module/modular/FieldValue.js.map +1 -0
  63. package/dist/module/modular/GeoPoint.js +22 -0
  64. package/dist/module/modular/GeoPoint.js.map +1 -0
  65. package/dist/module/modular/Timestamp.js +22 -0
  66. package/dist/module/modular/Timestamp.js.map +1 -0
  67. package/dist/module/modular/VectorValue.js +25 -0
  68. package/dist/module/modular/VectorValue.js.map +1 -0
  69. package/dist/module/modular/query.js +222 -0
  70. package/dist/module/modular/query.js.map +1 -0
  71. package/dist/module/modular/snapshot.js +32 -0
  72. package/dist/module/modular/snapshot.js.map +1 -0
  73. package/dist/module/modular.js +229 -0
  74. package/dist/module/modular.js.map +1 -0
  75. package/dist/module/namespaced.js +298 -0
  76. package/dist/module/namespaced.js.map +1 -0
  77. package/dist/module/package.json +1 -0
  78. package/dist/module/pipelines/expressions.js +1273 -0
  79. package/dist/module/pipelines/expressions.js.map +1 -0
  80. package/dist/module/pipelines/index.js +32 -0
  81. package/dist/module/pipelines/index.js.map +1 -0
  82. package/dist/module/pipelines/pipeline-result.js +58 -0
  83. package/dist/module/pipelines/pipeline-result.js.map +1 -0
  84. package/dist/module/pipelines/pipeline-source.js +4 -0
  85. package/dist/module/pipelines/pipeline-source.js.map +1 -0
  86. package/dist/module/pipelines/pipeline.js +4 -0
  87. package/dist/module/pipelines/pipeline.js.map +1 -0
  88. package/dist/module/pipelines/pipeline_impl.js +42 -0
  89. package/dist/module/pipelines/pipeline_impl.js.map +1 -0
  90. package/dist/module/pipelines/pipeline_options.js +4 -0
  91. package/dist/module/pipelines/pipeline_options.js.map +1 -0
  92. package/dist/module/pipelines/pipeline_runtime.js +526 -0
  93. package/dist/module/pipelines/pipeline_runtime.js.map +1 -0
  94. package/dist/module/pipelines/pipeline_support.js +71 -0
  95. package/dist/module/pipelines/pipeline_support.js.map +1 -0
  96. package/dist/module/pipelines/pipeline_validate.js +183 -0
  97. package/dist/module/pipelines/pipeline_validate.js.map +1 -0
  98. package/dist/module/pipelines/stage_options.js +4 -0
  99. package/dist/module/pipelines/stage_options.js.map +1 -0
  100. package/dist/module/pipelines/types.js +2 -0
  101. package/dist/module/pipelines/types.js.map +1 -0
  102. package/dist/module/types/firestore.js +4 -0
  103. package/dist/module/types/firestore.js.map +1 -0
  104. package/dist/module/types/internal.js +4 -0
  105. package/dist/module/types/internal.js.map +1 -0
  106. package/dist/module/types/namespaced.js +338 -0
  107. package/dist/module/types/namespaced.js.map +1 -0
  108. package/{lib → dist/module}/utils/index.js +59 -114
  109. package/dist/module/utils/index.js.map +1 -0
  110. package/{lib → dist/module}/utils/serialize.js +58 -116
  111. package/dist/module/utils/serialize.js.map +1 -0
  112. package/{lib → dist/module}/utils/typemap.js +6 -20
  113. package/dist/module/utils/typemap.js.map +1 -0
  114. package/dist/module/version.js +5 -0
  115. package/dist/module/version.js.map +1 -0
  116. package/dist/module/web/RNFBFirestoreModule.android.js +5 -0
  117. package/dist/module/web/RNFBFirestoreModule.android.js.map +1 -0
  118. package/dist/module/web/RNFBFirestoreModule.ios.js +5 -0
  119. package/dist/module/web/RNFBFirestoreModule.ios.js.map +1 -0
  120. package/dist/module/web/RNFBFirestoreModule.js +387 -0
  121. package/dist/module/web/RNFBFirestoreModule.js.map +1 -0
  122. package/{lib → dist/module}/web/convert.js +60 -94
  123. package/dist/module/web/convert.js.map +1 -0
  124. package/dist/module/web/pipelines/pipeline.js +34 -0
  125. package/dist/module/web/pipelines/pipeline.js.map +1 -0
  126. package/dist/module/web/pipelines/pipeline_bridge_factory.js +217 -0
  127. package/dist/module/web/pipelines/pipeline_bridge_factory.js.map +1 -0
  128. package/dist/module/web/pipelines/pipeline_node_builder.js +294 -0
  129. package/dist/module/web/pipelines/pipeline_node_builder.js.map +1 -0
  130. package/dist/module/web/pipelines/pipeline_parser.js +21 -0
  131. package/dist/module/web/pipelines/pipeline_parser.js.map +1 -0
  132. package/dist/module/web/pipelines/pipeline_snapshot_serializer.js +89 -0
  133. package/dist/module/web/pipelines/pipeline_snapshot_serializer.js.map +1 -0
  134. package/dist/module/web/query.js +95 -0
  135. package/dist/module/web/query.js.map +1 -0
  136. package/dist/typescript/lib/FieldPath.d.ts +10 -0
  137. package/dist/typescript/lib/FieldPath.d.ts.map +1 -0
  138. package/dist/typescript/lib/FieldValue.d.ts +17 -0
  139. package/dist/typescript/lib/FieldValue.d.ts.map +1 -0
  140. package/dist/typescript/lib/FirestoreAggregate.d.ts +40 -0
  141. package/dist/typescript/lib/FirestoreAggregate.d.ts.map +1 -0
  142. package/dist/typescript/lib/FirestoreBlob.d.ts +11 -0
  143. package/dist/typescript/lib/FirestoreBlob.d.ts.map +1 -0
  144. package/dist/typescript/lib/FirestoreCollectionReference.d.ts +15 -0
  145. package/dist/typescript/lib/FirestoreCollectionReference.d.ts.map +1 -0
  146. package/dist/typescript/lib/FirestoreDocumentChange.d.ts +27 -0
  147. package/dist/typescript/lib/FirestoreDocumentChange.d.ts.map +1 -0
  148. package/dist/typescript/lib/FirestoreDocumentReference.d.ts +30 -0
  149. package/dist/typescript/lib/FirestoreDocumentReference.d.ts.map +1 -0
  150. package/dist/typescript/lib/FirestoreDocumentSnapshot.d.ts +30 -0
  151. package/dist/typescript/lib/FirestoreDocumentSnapshot.d.ts.map +1 -0
  152. package/dist/typescript/lib/FirestoreFilter.d.ts +52 -0
  153. package/dist/typescript/lib/FirestoreFilter.d.ts.map +1 -0
  154. package/dist/typescript/lib/FirestoreGeoPoint.d.ts +22 -0
  155. package/dist/typescript/lib/FirestoreGeoPoint.d.ts.map +1 -0
  156. package/dist/typescript/lib/FirestorePath.d.ts +12 -0
  157. package/dist/typescript/lib/FirestorePath.d.ts.map +1 -0
  158. package/dist/typescript/lib/FirestorePersistentCacheIndexManager.d.ts +16 -0
  159. package/dist/typescript/lib/FirestorePersistentCacheIndexManager.d.ts.map +1 -0
  160. package/dist/typescript/lib/FirestoreQuery.d.ts +39 -0
  161. package/dist/typescript/lib/FirestoreQuery.d.ts.map +1 -0
  162. package/dist/typescript/lib/FirestoreQueryModifiers.d.ts +59 -0
  163. package/dist/typescript/lib/FirestoreQueryModifiers.d.ts.map +1 -0
  164. package/dist/typescript/lib/FirestoreQuerySnapshot.d.ts +49 -0
  165. package/dist/typescript/lib/FirestoreQuerySnapshot.d.ts.map +1 -0
  166. package/dist/typescript/lib/FirestoreSnapshotMetadata.d.ts +8 -0
  167. package/dist/typescript/lib/FirestoreSnapshotMetadata.d.ts.map +1 -0
  168. package/dist/typescript/lib/FirestoreStatics.d.ts +23 -0
  169. package/dist/typescript/lib/FirestoreStatics.d.ts.map +1 -0
  170. package/dist/typescript/lib/FirestoreTimestamp.d.ts +33 -0
  171. package/dist/typescript/lib/FirestoreTimestamp.d.ts.map +1 -0
  172. package/dist/typescript/lib/FirestoreTransaction.d.ts +42 -0
  173. package/dist/typescript/lib/FirestoreTransaction.d.ts.map +1 -0
  174. package/dist/typescript/lib/FirestoreTransactionHandler.d.ts +26 -0
  175. package/dist/typescript/lib/FirestoreTransactionHandler.d.ts.map +1 -0
  176. package/dist/typescript/lib/FirestoreVectorValue.d.ts +17 -0
  177. package/dist/typescript/lib/FirestoreVectorValue.d.ts.map +1 -0
  178. package/dist/typescript/lib/FirestoreWriteBatch.d.ts +21 -0
  179. package/dist/typescript/lib/FirestoreWriteBatch.d.ts.map +1 -0
  180. package/dist/typescript/lib/LoadBundleTask.d.ts +16 -0
  181. package/dist/typescript/lib/LoadBundleTask.d.ts.map +1 -0
  182. package/dist/typescript/lib/index.d.ts +6 -0
  183. package/dist/typescript/lib/index.d.ts.map +1 -0
  184. package/dist/typescript/lib/modular/Bytes.d.ts +22 -0
  185. package/dist/typescript/lib/modular/Bytes.d.ts.map +1 -0
  186. package/dist/typescript/lib/modular/FieldPath.d.ts +4 -0
  187. package/dist/typescript/lib/modular/FieldPath.d.ts.map +1 -0
  188. package/dist/typescript/lib/modular/FieldValue.d.ts +8 -0
  189. package/dist/typescript/lib/modular/FieldValue.d.ts.map +1 -0
  190. package/dist/typescript/lib/modular/GeoPoint.d.ts +3 -0
  191. package/dist/typescript/lib/modular/GeoPoint.d.ts.map +1 -0
  192. package/dist/typescript/lib/modular/Timestamp.d.ts +3 -0
  193. package/dist/typescript/lib/modular/Timestamp.d.ts.map +1 -0
  194. package/dist/typescript/lib/modular/VectorValue.d.ts +4 -0
  195. package/dist/typescript/lib/modular/VectorValue.d.ts.map +1 -0
  196. package/dist/typescript/lib/modular/query.d.ts +93 -0
  197. package/dist/typescript/lib/modular/query.d.ts.map +1 -0
  198. package/dist/typescript/lib/modular/snapshot.d.ts +30 -0
  199. package/dist/typescript/lib/modular/snapshot.d.ts.map +1 -0
  200. package/dist/typescript/lib/modular.d.ts +69 -0
  201. package/dist/typescript/lib/modular.d.ts.map +1 -0
  202. package/dist/typescript/lib/namespaced.d.ts +13 -0
  203. package/dist/typescript/lib/namespaced.d.ts.map +1 -0
  204. package/dist/typescript/lib/pipelines/expressions.d.ts +723 -0
  205. package/dist/typescript/lib/pipelines/expressions.d.ts.map +1 -0
  206. package/dist/typescript/lib/pipelines/index.d.ts +31 -0
  207. package/dist/typescript/lib/pipelines/index.d.ts.map +1 -0
  208. package/dist/typescript/lib/pipelines/pipeline-result.d.ts +30 -0
  209. package/dist/typescript/lib/pipelines/pipeline-result.d.ts.map +1 -0
  210. package/dist/typescript/lib/pipelines/pipeline-source.d.ts +64 -0
  211. package/dist/typescript/lib/pipelines/pipeline-source.d.ts.map +1 -0
  212. package/dist/typescript/lib/pipelines/pipeline.d.ts +61 -0
  213. package/dist/typescript/lib/pipelines/pipeline.d.ts.map +1 -0
  214. package/dist/typescript/lib/pipelines/pipeline_impl.d.ts +21 -0
  215. package/dist/typescript/lib/pipelines/pipeline_impl.d.ts.map +1 -0
  216. package/dist/typescript/lib/pipelines/pipeline_options.d.ts +17 -0
  217. package/dist/typescript/lib/pipelines/pipeline_options.d.ts.map +1 -0
  218. package/dist/typescript/lib/pipelines/pipeline_runtime.d.ts +10 -0
  219. package/dist/typescript/lib/pipelines/pipeline_runtime.d.ts.map +1 -0
  220. package/dist/typescript/lib/pipelines/pipeline_support.d.ts +7 -0
  221. package/dist/typescript/lib/pipelines/pipeline_support.d.ts.map +1 -0
  222. package/dist/typescript/lib/pipelines/pipeline_validate.d.ts +9 -0
  223. package/dist/typescript/lib/pipelines/pipeline_validate.d.ts.map +1 -0
  224. package/dist/typescript/lib/pipelines/stage_options.d.ts +326 -0
  225. package/dist/typescript/lib/pipelines/stage_options.d.ts.map +1 -0
  226. package/dist/typescript/lib/pipelines/types.d.ts +10 -0
  227. package/dist/typescript/lib/pipelines/types.d.ts.map +1 -0
  228. package/dist/typescript/lib/types/firestore.d.ts +263 -0
  229. package/dist/typescript/lib/types/firestore.d.ts.map +1 -0
  230. package/dist/typescript/lib/types/internal.d.ts +483 -0
  231. package/dist/typescript/lib/types/internal.d.ts.map +1 -0
  232. package/dist/typescript/lib/types/namespaced.d.ts +2285 -0
  233. package/dist/typescript/lib/types/namespaced.d.ts.map +1 -0
  234. package/dist/typescript/lib/utils/index.d.ts +15 -0
  235. package/dist/typescript/lib/utils/index.d.ts.map +1 -0
  236. package/dist/typescript/lib/utils/serialize.d.ts +17 -0
  237. package/dist/typescript/lib/utils/serialize.d.ts.map +1 -0
  238. package/dist/typescript/lib/utils/typemap.d.ts +3 -0
  239. package/dist/typescript/lib/utils/typemap.d.ts.map +1 -0
  240. package/dist/typescript/lib/version.d.ts +2 -0
  241. package/dist/typescript/lib/version.d.ts.map +1 -0
  242. package/dist/typescript/lib/web/RNFBFirestoreModule.android.d.ts +3 -0
  243. package/dist/typescript/lib/web/RNFBFirestoreModule.android.d.ts.map +1 -0
  244. package/dist/typescript/lib/web/RNFBFirestoreModule.d.ts +75 -0
  245. package/dist/typescript/lib/web/RNFBFirestoreModule.d.ts.map +1 -0
  246. package/dist/typescript/lib/web/RNFBFirestoreModule.ios.d.ts +3 -0
  247. package/dist/typescript/lib/web/RNFBFirestoreModule.ios.d.ts.map +1 -0
  248. package/dist/typescript/lib/web/convert.d.ts +14 -0
  249. package/dist/typescript/lib/web/convert.d.ts.map +1 -0
  250. package/dist/typescript/lib/web/pipelines/pipeline.d.ts +4 -0
  251. package/dist/typescript/lib/web/pipelines/pipeline.d.ts.map +1 -0
  252. package/dist/typescript/lib/web/pipelines/pipeline_bridge_factory.d.ts +5 -0
  253. package/dist/typescript/lib/web/pipelines/pipeline_bridge_factory.d.ts.map +1 -0
  254. package/dist/typescript/lib/web/pipelines/pipeline_node_builder.d.ts +5 -0
  255. package/dist/typescript/lib/web/pipelines/pipeline_node_builder.d.ts.map +1 -0
  256. package/dist/typescript/lib/web/pipelines/pipeline_parser.d.ts +3 -0
  257. package/dist/typescript/lib/web/pipelines/pipeline_parser.d.ts.map +1 -0
  258. package/dist/typescript/lib/web/pipelines/pipeline_snapshot_serializer.d.ts +4 -0
  259. package/dist/typescript/lib/web/pipelines/pipeline_snapshot_serializer.d.ts.map +1 -0
  260. package/dist/typescript/lib/web/query.d.ts +23 -0
  261. package/dist/typescript/lib/web/query.d.ts.map +1 -0
  262. package/dist/typescript/package.json +1 -0
  263. package/ios/RNFBFirestore/RNFBFirestoreCollectionModule.m +52 -2
  264. package/ios/RNFBFirestore/RNFBFirestorePipelineBridgeFactory.swift +384 -0
  265. package/ios/RNFBFirestore/RNFBFirestorePipelineCallHandler.swift +86 -0
  266. package/ios/RNFBFirestore/RNFBFirestorePipelineNodeBuilder.swift +1500 -0
  267. package/ios/RNFBFirestore/RNFBFirestorePipelineParser.swift +1352 -0
  268. package/ios/RNFBFirestore/RNFBFirestorePipelineSnapshotSerializer.swift +98 -0
  269. package/lib/{FirestoreFieldPath.js → FieldPath.ts} +10 -12
  270. package/lib/{FirestoreFieldValue.js → FieldValue.ts} +22 -19
  271. package/lib/FirestoreAggregate.ts +124 -0
  272. package/lib/FirestoreBlob.ts +73 -0
  273. package/lib/FirestoreCollectionReference.ts +99 -0
  274. package/lib/FirestoreDocumentChange.ts +71 -0
  275. package/lib/FirestoreDocumentReference.ts +310 -0
  276. package/lib/FirestoreDocumentSnapshot.ts +149 -0
  277. package/lib/FirestoreFilter.ts +232 -0
  278. package/lib/{FirestoreGeoPoint.js → FirestoreGeoPoint.ts} +48 -8
  279. package/lib/FirestorePath.ts +54 -0
  280. package/lib/FirestorePersistentCacheIndexManager.ts +46 -0
  281. package/lib/{FirestoreQuery.js → FirestoreQuery.ts} +208 -100
  282. package/lib/FirestoreQueryModifiers.ts +411 -0
  283. package/lib/{FirestoreQuerySnapshot.js → FirestoreQuerySnapshot.ts} +61 -32
  284. package/lib/{FirestoreSnapshotMetadata.js → FirestoreSnapshotMetadata.ts} +8 -6
  285. package/lib/{FirestoreStatics.js → FirestoreStatics.ts} +18 -11
  286. package/lib/FirestoreTimestamp.ts +161 -0
  287. package/lib/{FirestoreTransaction.js → FirestoreTransaction.ts} +64 -27
  288. package/lib/{FirestoreTransactionHandler.js → FirestoreTransactionHandler.ts} +54 -75
  289. package/lib/{FirestoreVectorValue.js → FirestoreVectorValue.ts} +36 -15
  290. package/lib/{FirestoreWriteBatch.js → FirestoreWriteBatch.ts} +45 -21
  291. package/lib/LoadBundleTask.ts +85 -0
  292. package/lib/index.ts +71 -0
  293. package/lib/modular/Bytes.ts +81 -0
  294. package/lib/modular/FieldPath.ts +24 -0
  295. package/lib/modular/FieldValue.ts +40 -0
  296. package/lib/modular/GeoPoint.ts +20 -0
  297. package/lib/modular/Timestamp.ts +20 -0
  298. package/lib/modular/VectorValue.ts +24 -0
  299. package/lib/modular/query.ts +368 -0
  300. package/lib/modular/snapshot.ts +137 -0
  301. package/lib/modular.ts +552 -0
  302. package/lib/{index.js → namespaced.ts} +170 -80
  303. package/lib/pipelines/expressions.ts +2321 -0
  304. package/lib/pipelines/index.ts +203 -0
  305. package/lib/pipelines/pipeline-result.ts +78 -0
  306. package/lib/pipelines/pipeline-source.ts +83 -0
  307. package/lib/pipelines/pipeline.ts +99 -0
  308. package/lib/pipelines/pipeline_impl.ts +46 -0
  309. package/lib/pipelines/pipeline_options.ts +32 -0
  310. package/lib/pipelines/pipeline_runtime.ts +863 -0
  311. package/lib/pipelines/pipeline_support.ts +134 -0
  312. package/lib/pipelines/pipeline_validate.ts +242 -0
  313. package/lib/pipelines/stage_options.ts +376 -0
  314. package/lib/pipelines/types.ts +26 -0
  315. package/lib/types/firestore.ts +477 -0
  316. package/lib/types/internal.ts +747 -0
  317. package/lib/{index.d.ts → types/namespaced.ts} +280 -79
  318. package/lib/utils/index.ts +244 -0
  319. package/lib/utils/serialize.ts +314 -0
  320. package/lib/utils/typemap.ts +65 -0
  321. package/lib/version.ts +2 -0
  322. package/lib/web/{RNFBFirestoreModule.js → RNFBFirestoreModule.ts} +222 -234
  323. package/lib/web/convert.ts +287 -0
  324. package/lib/web/pipelines/pipeline.ts +47 -0
  325. package/lib/web/pipelines/pipeline_bridge_factory.ts +377 -0
  326. package/lib/web/pipelines/pipeline_node_builder.ts +413 -0
  327. package/lib/web/pipelines/pipeline_parser.ts +23 -0
  328. package/lib/web/pipelines/pipeline_snapshot_serializer.ts +133 -0
  329. package/lib/web/query.ts +150 -0
  330. package/package.json +46 -7
  331. package/tsconfig.json +35 -0
  332. package/lib/FirestoreBlob.js +0 -107
  333. package/lib/FirestoreCollectionReference.js +0 -70
  334. package/lib/FirestoreDocumentReference.js +0 -222
  335. package/lib/FirestoreDocumentSnapshot.js +0 -132
  336. package/lib/FirestoreFilter.js +0 -156
  337. package/lib/modular/Bytes.d.ts +0 -11
  338. package/lib/modular/Bytes.js +0 -62
  339. package/lib/modular/FieldPath.d.ts +0 -20
  340. package/lib/modular/FieldPath.js +0 -7
  341. package/lib/modular/FieldValue.d.ts +0 -67
  342. package/lib/modular/FieldValue.js +0 -41
  343. package/lib/modular/GeoPoint.d.ts +0 -17
  344. package/lib/modular/GeoPoint.js +0 -3
  345. package/lib/modular/Timestamp.d.ts +0 -85
  346. package/lib/modular/Timestamp.js +0 -3
  347. package/lib/modular/VectorValue.d.ts +0 -30
  348. package/lib/modular/VectorValue.js +0 -11
  349. package/lib/modular/index.d.ts +0 -788
  350. package/lib/modular/index.js +0 -410
  351. package/lib/modular/query.d.ts +0 -370
  352. package/lib/modular/query.js +0 -233
  353. package/lib/modular/snapshot.d.ts +0 -256
  354. package/lib/modular/snapshot.js +0 -33
  355. package/lib/modular/utils/observer.js +0 -16
  356. package/lib/version.js +0 -2
  357. package/lib/web/query.js +0 -112
  358. /package/lib/web/{RNFBFirestoreModule.android.js → RNFBFirestoreModule.android.ts} +0 -0
  359. /package/lib/web/{RNFBFirestoreModule.ios.js → RNFBFirestoreModule.ios.ts} +0 -0
@@ -0,0 +1,2285 @@
1
+ import { ReactNativeFirebase } from '@react-native-firebase/app';
2
+ /**
3
+ * Firebase Cloud Firestore package for React Native.
4
+ *
5
+ * #### Example: Access the firebase export from the `firestore` package:
6
+ *
7
+ * ```js
8
+ * import { firebase } from '@react-native-firebase/firestore';
9
+ *
10
+ * // firebase.firestore().X
11
+ * ```
12
+ *
13
+ * #### Example: Using the default export from the `firestore` package:
14
+ *
15
+ * ```js
16
+ * import firestore from '@react-native-firebase/firestore';
17
+ *
18
+ * // firestore().X
19
+ * ```
20
+ *
21
+ * #### Example: Using the default export from the `app` package:
22
+ *
23
+ * ```js
24
+ * import firebase from '@react-native-firebase/app';
25
+ * import '@react-native-firebase/firestore';
26
+ *
27
+ * // firebase.firestore().X
28
+ * ```
29
+ *
30
+ * @firebase firestore
31
+ */
32
+ export declare namespace FirebaseFirestoreTypes {
33
+ type _FirebaseModule = ReactNativeFirebase.FirebaseModule;
34
+ /**
35
+ * An instance of Filter used to generate Firestore Filter queries.
36
+ */
37
+ export type QueryFilterType = 'OR' | 'AND';
38
+ export interface QueryFieldFilterConstraint<T extends DocumentData = DocumentData> {
39
+ fieldPath: keyof T | FieldPath;
40
+ operator: WhereFilterOp;
41
+ value: any;
42
+ }
43
+ export interface QueryCompositeFilterConstraint<T extends DocumentData = DocumentData> {
44
+ operator: QueryFilterType;
45
+ queries: QueryFieldFilterConstraint<T>[];
46
+ }
47
+ export type QueryFilterConstraint<T extends DocumentData = DocumentData> = QueryFieldFilterConstraint<T> | QueryCompositeFilterConstraint<T>;
48
+ /**
49
+ * The Filter functions used to generate an instance of Filter.
50
+ */
51
+ export interface FilterFunction<T extends DocumentData = DocumentData> {
52
+ /**
53
+ * The Filter function used to generate an instance of Filter.
54
+ * e.g. Filter('name', '==', 'Ada')
55
+ */
56
+ (fieldPath: keyof T | FieldPath, operator: WhereFilterOp, value: any): QueryFieldFilterConstraint<T>;
57
+ /**
58
+ * The Filter.or() static function used to generate a logical OR query using multiple Filter instances.
59
+ * e.g. Filter.or(Filter('name', '==', 'Ada'), Filter('name', '==', 'Bob'))
60
+ */
61
+ or(...queries: QueryFilterConstraint<T>[]): QueryCompositeFilterConstraint<T>;
62
+ /**
63
+ * The Filter.and() static function used to generate a logical AND query using multiple Filter instances.
64
+ * e.g. Filter.and(Filter('name', '==', 'Ada'), Filter('name', '==', 'Bob'))
65
+ */
66
+ and(...queries: QueryFilterConstraint<T>[]): QueryCompositeFilterConstraint<T>;
67
+ }
68
+ /**
69
+ * The Filter function used to generate an instance of Filter.
70
+ * e.g. Filter('name', '==', 'Ada')
71
+ */
72
+ export const Filter: FilterFunction;
73
+ /**
74
+ * An immutable object representing an array of bytes.
75
+ */
76
+ export class Blob {
77
+ /**
78
+ * Creates a new Blob from the given Base64 string, converting it to bytes.
79
+ *
80
+ * @param base64 The Base64 string used to create the Blob object.
81
+ */
82
+ static fromBase64String(base64: string): Blob;
83
+ /**
84
+ * Creates a new Blob from the given Uint8Array.
85
+ *
86
+ * @param array The Uint8Array used to create the Blob object.
87
+ */
88
+ static fromUint8Array(array: Uint8Array): Blob;
89
+ /**
90
+ * Returns true if this `Blob` is equal to the provided one.
91
+ *
92
+ * @param other The `Blob` to compare against.
93
+ */
94
+ isEqual(other: Blob): boolean;
95
+ /**
96
+ * Returns the bytes of a Blob as a Base64-encoded string.
97
+ */
98
+ toBase64(): string;
99
+ /**
100
+ * Returns the bytes of a Blob in a new Uint8Array.
101
+ */
102
+ toUint8Array(): Uint8Array;
103
+ }
104
+ /**
105
+ * A `DocumentData` object represents the data in a document.
106
+ */
107
+ export interface DocumentData {
108
+ [key: string]: any;
109
+ }
110
+ /**
111
+ * A `CollectionReference` object can be used for adding documents, getting document references, and querying for
112
+ * documents (using the methods inherited from `Query`).
113
+ */
114
+ export class CollectionReference<AppModelType extends DocumentData = DocumentData, DbModelType extends DocumentData = DocumentData> extends Query<AppModelType, DbModelType> {
115
+ /**
116
+ * The collection's identifier.
117
+ */
118
+ id: string;
119
+ /**
120
+ * A reference to the containing `DocumentReference` if this is a subcollection. If this isn't a
121
+ * subcollection, the reference is null.
122
+ */
123
+ parent: DocumentReference<DocumentData, DocumentData> | null;
124
+ /**
125
+ * A string representing the path of the referenced collection (relative to the root of the database).
126
+ */
127
+ path: string;
128
+ /**
129
+ * Add a new document to this collection with the specified data, assigning it a document ID automatically.
130
+ *
131
+ * #### Example
132
+ *
133
+ * ```js
134
+ * const documentRef = await firebase.firestore().collection('users').add({
135
+ * name: 'Ada Lovelace',
136
+ * age: 30,
137
+ * });
138
+ * ```
139
+ *
140
+ * @param data An Object containing the data for the new document.
141
+ */
142
+ add(data: AppModelType): Promise<DocumentReference<AppModelType, DbModelType>>;
143
+ /**
144
+ * Get a DocumentReference for the document within the collection at the specified path. If no
145
+ * path is specified, an automatically-generated unique ID will be used for the returned DocumentReference.
146
+ *
147
+ * #### Example
148
+ *
149
+ * ```js
150
+ * await firebase.firestore().collection('users').doc('alovelace').set({
151
+ * name: 'Ada Lovelace',
152
+ * age: 30,
153
+ * });
154
+ * ```
155
+ *
156
+ * @param documentPath A slash-separated path to a document.
157
+ */
158
+ doc(documentPath?: string): DocumentReference<AppModelType, DbModelType>;
159
+ /**
160
+ * Applies a custom data converter to this CollectionReference, allowing you
161
+ * to use your own custom model objects with Firestore. When you call add()
162
+ * on the returned CollectionReference instance, the provided converter will
163
+ * convert between Firestore data and your custom type U.
164
+ *
165
+ * Passing in `null` as the converter parameter removes the current
166
+ * converter.
167
+ *
168
+ * @param converter Converts objects to and from Firestore. Passing in
169
+ * `null` removes the current converter.
170
+ * @return A CollectionReference<U> that uses the provided converter.
171
+ */
172
+ withConverter(converter: null): CollectionReference<DocumentData, DocumentData>;
173
+ /**
174
+ * Applies a custom data converter to this CollectionReference, allowing you
175
+ * to use your own custom model objects with Firestore. When you call add()
176
+ * on the returned CollectionReference instance, the provided converter will
177
+ * convert between Firestore data and your custom type U.
178
+ *
179
+ * Passing in `null` as the converter parameter removes the current
180
+ * converter.
181
+ *
182
+ * @param converter Converts objects to and from Firestore. Passing in
183
+ * `null` removes the current converter.
184
+ * @return A CollectionReference<U> that uses the provided converter.
185
+ */
186
+ withConverter<NewAppModelType extends DocumentData, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): CollectionReference<NewAppModelType, NewDbModelType>;
187
+ }
188
+ /**
189
+ * A DocumentChange represents a change to the documents matching a query. It contains the document affected and the
190
+ * type of change that occurred.
191
+ */
192
+ export interface DocumentChange<AppModelType extends DocumentData = DocumentData, DbModelType extends DocumentData = DocumentData> {
193
+ /**
194
+ * The document affected by this change.
195
+ */
196
+ doc: QueryDocumentSnapshot<AppModelType, DbModelType>;
197
+ /**
198
+ * The index of the changed document in the result set immediately after this `DocumentChange`
199
+ * (i.e. supposing that all prior `DocumentChange` objects and the current `DocumentChange` object have been applied).
200
+ * Is -1 for 'removed' events.
201
+ */
202
+ newIndex: number;
203
+ /**
204
+ * The index of the changed document in the result set immediately prior to this `DocumentChange` (i.e.
205
+ * supposing that all prior `DocumentChange` objects have been applied). Is -1 for 'added' events.
206
+ */
207
+ oldIndex: number;
208
+ /**
209
+ * The type of change ('added', 'modified', or 'removed').
210
+ */
211
+ type: DocumentChangeType;
212
+ }
213
+ /**
214
+ * The type of a DocumentChange may be 'added', 'removed', or 'modified'.
215
+ */
216
+ export type DocumentChangeType = 'added' | 'removed' | 'modified';
217
+ /**
218
+ * An options object that configures how document snapshot data is returned (e.g. server timestamps).
219
+ */
220
+ export type SnapshotOptions = {
221
+ readonly serverTimestamps?: 'estimate' | 'previous' | 'none';
222
+ };
223
+ /**
224
+ * The types for a DocumentSnapshot field that are supported by Firestore.
225
+ */
226
+ export type DocumentFieldType = string | number | boolean | {
227
+ [key: string]: DocumentFieldType;
228
+ } | DocumentFieldType[] | null | Timestamp | GeoPoint | Blob | FieldPath | FieldValue | DocumentReference<DocumentData, DocumentData> | CollectionReference<DocumentData, DocumentData>;
229
+ /**
230
+ * A `DocumentReference` refers to a document location in a Firestore database and can be used to write, read, or listen
231
+ * to the location. The document at the referenced location may or may not exist. A `DocumentReference` can also be used
232
+ * to create a `CollectionReference` to a subcollection.
233
+ */
234
+ export class DocumentReference<AppModelType extends DocumentData = DocumentData, DbModelType extends DocumentData = DocumentData> {
235
+ /**
236
+ * The Firestore instance the document is in. This is useful for performing transactions, for example.
237
+ */
238
+ firestore: Module;
239
+ /**
240
+ * The document's identifier within its collection.
241
+ */
242
+ id: string;
243
+ /**
244
+ * The Collection this `DocumentReference` belongs to.
245
+ */
246
+ parent: CollectionReference<AppModelType, DbModelType>;
247
+ /**
248
+ * A string representing the path of the referenced document (relative to the root of the database).
249
+ */
250
+ path: string;
251
+ /**
252
+ * Gets a `CollectionReference` instance that refers to the collection at the specified path.
253
+ *
254
+ * #### Example
255
+ *
256
+ * ```js
257
+ * const collectionRef = firebase.firestore().doc('users/alovelace').collection('orders');
258
+ * ```
259
+ *
260
+ * @param collectionPath A slash-separated path to a collection.
261
+ */
262
+ collection(collectionPath: string): CollectionReference<DocumentData, DocumentData>;
263
+ /**
264
+ * Deletes the document referred to by this DocumentReference.
265
+ *
266
+ * #### Example
267
+ *
268
+ * ```js
269
+ * await firebase.firestore().doc('users/alovelace').delete();
270
+ * ```
271
+ *
272
+ * The Promise is resolved once the document has been successfully deleted from the backend
273
+ * (Note that it won't resolve while you're offline).
274
+ */
275
+ delete(): Promise<void>;
276
+ /**
277
+ * Reads the document referred to by this DocumentReference.
278
+ *
279
+ * Note: By default, get() attempts to provide up-to-date data when possible by waiting for data
280
+ * from the server, but it may return cached data or fail if you are offline and the server cannot
281
+ * be reached. This behavior can be altered via the GetOptions parameter.
282
+ *
283
+ * #### Example
284
+ *
285
+ * ```js
286
+ * await firebase.firestore().doc('users/alovelace').get({
287
+ * source: 'server',
288
+ * });
289
+ * ```
290
+ *
291
+ * @param options An object to configure the get behavior.
292
+ */
293
+ get(options?: GetOptions): Promise<DocumentSnapshot<AppModelType, DbModelType>>;
294
+ /**
295
+ * Returns true if this DocumentReference is equal to the provided one.
296
+ *
297
+ * #### Example
298
+ *
299
+ * ```js
300
+ * const alovelace = firebase.firestore().doc('users/alovelace');
301
+ * const dsmith = firebase.firestore().doc('users/dsmith');
302
+ *
303
+ * // false
304
+ * alovelace.isEqual(dsmith);
305
+ * ```
306
+ *
307
+ * @param other The `DocumentReference` to compare against.
308
+ */
309
+ isEqual(other: DocumentReference<AppModelType, DbModelType>): boolean;
310
+ /**
311
+ * Attaches a listener for DocumentSnapshot events.
312
+ *
313
+ * NOTE: Although an complete callback can be provided, it will never be called because the snapshot stream is never-ending.
314
+ *
315
+ * Returns an unsubscribe function to stop listening to events.
316
+ *
317
+ * #### Example
318
+ *
319
+ * ```js
320
+ * const unsubscribe = firebase.firestore().doc('users/alovelace')
321
+ * .onSnapshot({
322
+ * error: (e) => console.error(e),
323
+ * next: (documentSnapshot) => {},
324
+ * });
325
+ *
326
+ * unsubscribe();
327
+ * ```
328
+ *
329
+ * @param observer A single object containing `next` and `error` callbacks.
330
+ */
331
+ onSnapshot(observer: {
332
+ complete?: () => void;
333
+ error?: (error: Error) => void;
334
+ next?: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void;
335
+ }): () => void;
336
+ /**
337
+ * Attaches a listener for DocumentSnapshot events with snapshot listener options.
338
+ *
339
+ * NOTE: Although an complete callback can be provided, it will never be called because the snapshot stream is never-ending.
340
+ *
341
+ * Returns an unsubscribe function to stop listening to events.
342
+ *
343
+ * #### Example
344
+ *
345
+ * ```js
346
+ * const unsubscribe = firebase.firestore().doc('users/alovelace')
347
+ * .onSnapshot({
348
+ * includeMetadataChanges: true,
349
+ * }, {
350
+ * error: (e) => console.error(e),
351
+ * next: (documentSnapshot) => {},
352
+ * });
353
+ *
354
+ * unsubscribe();
355
+ * ```
356
+ *
357
+ * @param options Options controlling the listen behavior.
358
+ * @param observer A single object containing `next` and `error` callbacks.
359
+ */
360
+ onSnapshot(options: SnapshotListenOptions, observer: {
361
+ complete?: () => void;
362
+ error?: (error: Error) => void;
363
+ next?: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void;
364
+ }): () => void;
365
+ /**
366
+ * Attaches a listener for DocumentSnapshot events.
367
+ *
368
+ * NOTE: Although an onCompletion callback can be provided, it will never be called because the snapshot stream is never-ending.
369
+ *
370
+ * Returns an unsubscribe function to stop listening to events.
371
+ *
372
+ * #### Example
373
+ *
374
+ * ```js
375
+ * const unsubscribe = firebase.firestore().doc('users/alovelace')
376
+ * .onSnapshot(
377
+ * (documentSnapshot) => {}, // onNext
378
+ * (error) => console.error(error), // onError
379
+ * );
380
+ *
381
+ * unsubscribe();
382
+ * ```
383
+ * @param onNext A callback to be called every time a new `DocumentSnapshot` is available.
384
+ * @param onError A callback to be called if the listen fails or is cancelled. No further callbacks will occur.
385
+ * @param onCompletion An optional function which will never be called.
386
+ */
387
+ onSnapshot(onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void, onError?: (error: Error) => void, onCompletion?: () => void): () => void;
388
+ /**
389
+ * Attaches a listener for DocumentSnapshot events with snapshot listener options.
390
+ *
391
+ * NOTE: Although an onCompletion callback can be provided, it will never be called because the snapshot stream is never-ending.
392
+ *
393
+ * Returns an unsubscribe function to stop listening to events.
394
+ *
395
+ * #### Example
396
+ *
397
+ * ```js
398
+ * const unsubscribe = firebase.firestore().doc('users/alovelace')
399
+ * .onSnapshot(
400
+ * { includeMetadataChanges: true }, // SnapshotListenerOptions
401
+ * (documentSnapshot) => {}, // onNext
402
+ * (error) => console.error(error), // onError
403
+ * );
404
+ *
405
+ * unsubscribe();
406
+ * ```
407
+ * @param options Options controlling the listen behavior.
408
+ * @param onNext A callback to be called every time a new `DocumentSnapshot` is available.
409
+ * @param onError A callback to be called if the listen fails or is cancelled. No further callbacks will occur.
410
+ * @param onCompletion An optional function which will never be called.
411
+ */
412
+ onSnapshot(options: SnapshotListenOptions, onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void, onError?: (error: Error) => void, onCompletion?: () => void): () => void;
413
+ /**
414
+ * Writes to the document referred to by this DocumentReference. If the document does not yet
415
+ * exist, it will be created. If you pass SetOptions, the provided data can be merged into an
416
+ * existing document.
417
+ *
418
+ * #### Example
419
+ *
420
+ * ```js
421
+ * const user = firebase.firestore().doc('users/alovelace');
422
+ *
423
+ * // Set new data
424
+ * await user.set({
425
+ * name: 'Ada Lovelace',
426
+ * age: 30,
427
+ * city: 'LON',
428
+ * });
429
+ * ```
430
+ *
431
+ * @param data A map of the fields and values for the document.
432
+ * @param options An object to configure the set behavior.
433
+ */
434
+ set(data: SetValue<AppModelType>, options?: SetOptions): Promise<void>;
435
+ /**
436
+ * Updates fields in the document referred to by this `DocumentReference`. The update will fail
437
+ * if applied to a document that does not exist.
438
+ *
439
+ * #### Example
440
+ *
441
+ * ```
442
+ * const user = firebase.firestore().doc('users/alovelace');
443
+ *
444
+ * // Update age but leave other fields untouched
445
+ * await user.update({
446
+ * age: 31,
447
+ * });
448
+ * ```
449
+ *
450
+ * @param data An object containing the fields and values with which to update the document. Fields can contain dots to reference nested fields within the document.
451
+ */
452
+ update(data: Partial<SetValue<DbModelType>>): Promise<void>;
453
+ /**
454
+ * Updates fields in the document referred to by this DocumentReference. The update will fail if
455
+ * applied to a document that does not exist.
456
+ *
457
+ * #### Example
458
+ *
459
+ * ```
460
+ * const user = firebase.firestore().doc('users/alovelace');
461
+ *
462
+ * // Update age & city but leve other fields untouched
463
+ * await user.update('age', 31, 'city', 'SF');
464
+ * ```
465
+ *
466
+ * @param field The first field to update.
467
+ * @param value The first value.
468
+ * @param moreFieldsAndValues Additional key value pairs.
469
+ */
470
+ update(field: keyof DbModelType | FieldPath, value: any, ...moreFieldsAndValues: any[]): Promise<void>;
471
+ /**
472
+ * Removes the current converter.
473
+ *
474
+ * @param converter Passing in `null` removes the current converter.
475
+ * @return A DocumentReference<U> that uses the provided converter.
476
+ */
477
+ withConverter(converter: null): DocumentReference<DocumentData, DocumentData>;
478
+ /**
479
+ * Applies a custom data converter to this `DocumentReference`, allowing you
480
+ * to use your own custom model objects with Firestore. When you call setDoc
481
+ * getDoc, etc. with the returned `DocumentReference`
482
+ * instance, the provided converter will convert between Firestore data of
483
+ * type `NewDbModelType` and your custom type `NewAppModelType`.
484
+ *
485
+ * @param converter - Converts objects to and from Firestore.
486
+ * @returns A `DocumentReference` that uses the provided converter.
487
+ */
488
+ withConverter<NewAppModelType extends DocumentData, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
489
+ }
490
+ /**
491
+ * A DocumentSnapshot contains data read from a document in your Firestore database. The data can be extracted with
492
+ * .`data()` or `.get(:field)` to get a specific field.
493
+ *
494
+ * For a DocumentSnapshot that points to a non-existing document, any data access will return 'undefined'.
495
+ * You can use the `exists()` method to explicitly verify a document's existence.
496
+ */
497
+ export interface DocumentSnapshot<AppModelType extends DocumentData = DocumentData, DbModelType extends DocumentData = DocumentData> {
498
+ /**
499
+ * Method of the `DocumentSnapshot` that signals whether or not the data exists. True if the document exists.
500
+ */
501
+ exists(): boolean;
502
+ /**
503
+ * Property of the `DocumentSnapshot` that provides the document's ID.
504
+ */
505
+ id: string;
506
+ /**
507
+ * Metadata about the `DocumentSnapshot`, including information about its source and local modifications.
508
+ */
509
+ metadata: SnapshotMetadata;
510
+ /**
511
+ * The `DocumentReference` for the document included in the `DocumentSnapshot`.
512
+ */
513
+ ref: DocumentReference<AppModelType, DbModelType>;
514
+ /**
515
+ * Retrieves all fields in the document as an Object. Returns 'undefined' if the document doesn't exist.
516
+ *
517
+ * #### Example
518
+ *
519
+ * ```js
520
+ * const user = await firebase.firestore().doc('users/alovelace').get();
521
+ *
522
+ * console.log('User', user.data());
523
+ * ```
524
+ */
525
+ data(): AppModelType | undefined;
526
+ /**
527
+ * Retrieves the field specified by fieldPath. Returns undefined if the document or field doesn't exist.
528
+ *
529
+ * #### Example
530
+ *
531
+ * ```js
532
+ * const user = await firebase.firestore().doc('users/alovelace').get();
533
+ *
534
+ * console.log('Address ZIP Code', user.get('address.zip'));
535
+ * ```
536
+ *
537
+ * @param fieldPath The path (e.g. 'foo' or 'foo.bar') to a specific field.
538
+ */
539
+ get<fieldType extends DocumentFieldType>(fieldPath: keyof AppModelType | string | FieldPath): fieldType;
540
+ /**
541
+ * Returns true if this `DocumentSnapshot` is equal to the provided one.
542
+ *
543
+ * #### Example
544
+ *
545
+ * ```js
546
+ * const user1 = await firebase.firestore().doc('users/alovelace').get();
547
+ * const user2 = await firebase.firestore().doc('users/dsmith').get();
548
+ *
549
+ * // false
550
+ * user1.isEqual(user2);
551
+ * ```
552
+ *
553
+ * @param other The `DocumentSnapshot` to compare against.
554
+ */
555
+ isEqual(other: DocumentSnapshot<AppModelType, DbModelType>): boolean;
556
+ }
557
+ /**
558
+ * A QueryDocumentSnapshot contains data read from a document in your Firestore database as part of a query.
559
+ * The document is guaranteed to exist and its data can be extracted with .data() or .get(:field) to get a specific field.
560
+ *
561
+ * A QueryDocumentSnapshot offers the same API surface as a DocumentSnapshot.
562
+ * Since query results contain only existing documents, the exists() method will always be true and data() will never return 'undefined'.
563
+ */
564
+ export interface QueryDocumentSnapshot<AppModelType extends DocumentData = DocumentData, DbModelType extends DocumentData = DocumentData> extends DocumentSnapshot<AppModelType, DbModelType> {
565
+ /**
566
+ * A QueryDocumentSnapshot is always guaranteed to exist.
567
+ */
568
+ exists(): true;
569
+ /**
570
+ * Retrieves all fields in the document as an Object.
571
+ *
572
+ * #### Example
573
+ *
574
+ * ```js
575
+ * const users = await firebase.firestore().collection('users').get();
576
+ *
577
+ * for (const user of users.docs) {
578
+ * console.log('User', user.data());
579
+ * }
580
+ * ```
581
+ */
582
+ data(): AppModelType;
583
+ }
584
+ /**
585
+ * A FieldPath refers to a field in a document. The path may consist of a single field name (referring to a
586
+ * top-level field in the document), or a list of field names (referring to a nested field in the document).
587
+ *
588
+ * Create a FieldPath by providing field names. If more than one field name is provided, the path will point to a nested field in a document.
589
+ *
590
+ * #### Example
591
+ *
592
+ * ```js
593
+ * const user = await firebase.firestore().doc('users/alovelace').get();
594
+ *
595
+ * // Create a new field path
596
+ * const fieldPath = new firebase.firestore.FieldPath('address', 'zip');
597
+ *
598
+ * console.log('Address ZIP Code', user.get(fieldPath));
599
+ * ```
600
+ */
601
+ export class FieldPath {
602
+ /**
603
+ * Returns a special sentinel `FieldPath` to refer to the ID of a document. It can be used in queries to sort or filter by the document ID.
604
+ */
605
+ static documentId(): FieldPath;
606
+ /**
607
+ * Creates a FieldPath from the provided field names. If more than one field name is provided, the path will point to a nested field in a document.
608
+ *
609
+ * #### Example
610
+ *
611
+ * ```js
612
+ * const fieldPath = new firebase.firestore.FieldPath('address', line', 'one');
613
+ * ```
614
+ *
615
+ * @param fieldNames A list of field names.
616
+ */
617
+ constructor(...fieldNames: string[]);
618
+ /**
619
+ * Returns true if this `FieldPath` is equal to the provided one.
620
+ *
621
+ * #### Example
622
+ *
623
+ * ```js
624
+ * const fieldPath1 = new firebase.firestore.FieldPath('address', 'zip');
625
+ * const fieldPath2 = new firebase.firestore.FieldPath('address', line', 'one');
626
+ *
627
+ * // false
628
+ * fieldPath1.isEqual(fieldPath2);
629
+ * ```
630
+ *
631
+ * @param other The `FieldPath` to compare against.
632
+ */
633
+ isEqual(other: FieldPath): boolean;
634
+ }
635
+ /**
636
+ * Sentinel values that can be used when writing document fields with `set()` or `update()`.
637
+ *
638
+ * #### Example
639
+ *
640
+ * ```js
641
+ * const increment = firebase.firestore.FieldValue.increment(1);
642
+ *
643
+ * await firebase.firestore().doc('users/alovelace').update({
644
+ * age: increment, // increment age by 1
645
+ * });
646
+ * ```
647
+ */
648
+ export class FieldValue {
649
+ /**
650
+ * Returns a special value that can be used with `set()` or `update()` that tells the server to remove the given elements
651
+ * from any array value that already exists on the server. All instances of each element specified will be removed from
652
+ * the array. If the field being modified is not already an array it will be overwritten with an empty array.
653
+ *
654
+ * #### Example
655
+ *
656
+ * ```js
657
+ * const arrayRemove = firebase.firestore.FieldValue.arrayRemove(2, '3');
658
+ *
659
+ * // Removes the values 2 & '3' from the values array on the document
660
+ * await docRef.update({
661
+ * values: arrayRemove,
662
+ * });
663
+ * ```
664
+ *
665
+ * @param elements The elements to remove from the array.
666
+ */
667
+ static arrayRemove(...elements: any[]): FieldValue;
668
+ /**
669
+ * Returns a special value that can be used with `set()` or `update()` that tells the server to union the given
670
+ * elements with any array value that already exists on the server. Each specified element that doesn't already exist
671
+ * in the array will be added to the end. If the field being modified is not already an array it will be overwritten
672
+ * with an array containing exactly the specified elements.
673
+ *
674
+ * #### Example
675
+ *
676
+ * ```js
677
+ * const arrayUnion = firebase.firestore.FieldValue.arrayUnion(2, '3');
678
+ *
679
+ * // Appends the values 2 & '3' onto the values array on the document
680
+ * await docRef.update({
681
+ * values: arrayUnion,
682
+ * });
683
+ * ```
684
+ *
685
+ * @param elements The elements to union into the array.
686
+ */
687
+ static arrayUnion(...elements: any[]): FieldValue;
688
+ /**
689
+ * Returns a sentinel for use with update() to mark a field for deletion.
690
+ *
691
+ * #### Example
692
+ *
693
+ * ```js
694
+ * const delete = firebase.firestore.FieldValue.delete();
695
+ *
696
+ * // Deletes the name field on the document
697
+ * await docRef.update({
698
+ * name: delete,
699
+ * });
700
+ * ```
701
+ */
702
+ static delete(): FieldValue;
703
+ /**
704
+ * Returns a special value that can be used with `set()` or `update()` that tells the server to increment the field's current value by the given value.
705
+ *
706
+ * If either the operand or the current field value uses floating point precision, all arithmetic follows IEEE 754 semantics.
707
+ * If both values are integers, values outside of JavaScript's safe number range (`Number.MIN_SAFE_INTEGER` to `Number.MAX_SAFE_INTEGER`)
708
+ * are also subject to precision loss. Furthermore, once processed by the Firestore backend, all integer operations are
709
+ * capped between -2^63 and 2^63-1.
710
+ *
711
+ * If the current field value is not of type `number`, or if the field does not yet exist, the transformation sets the field to the given value.
712
+ *
713
+ * #### Example
714
+ *
715
+ * ```js
716
+ * const increment = firebase.firestore.FieldValue.increment(1);
717
+ *
718
+ * // Increment the loginCount field by 1 on the document
719
+ * await docRef.update({
720
+ * loginCount: increment,
721
+ * });
722
+ * ```
723
+ *
724
+ * Please be careful using this operator. It may not be reliable enough for use in circumstances where absolute accuracy is required,
725
+ * as it appears writes to Firestore may sometimes be duplicated in situations not fully understood yet, but possibly correlated with
726
+ * write frequency. See https://github.com/invertase/react-native-firebase/discussions/5914
727
+ *
728
+ * @param n The value to increment by.
729
+ */
730
+ static increment(n: number): FieldValue;
731
+ /**
732
+ * Returns a sentinel used with set() or update() to include a server-generated timestamp in the written data.
733
+ *
734
+ * #### Example
735
+ *
736
+ * ```js
737
+ * const timestamp = firebase.firestore.FieldValue.serverTimestamp();
738
+ *
739
+ * // Set the updatedAt field to the current server time
740
+ * await docRef.update({
741
+ * updatedAt: timestamp,
742
+ * });
743
+ * ```
744
+ */
745
+ static serverTimestamp(): FieldValue;
746
+ /**
747
+ * Returns true if this `FieldValue` is equal to the provided one.
748
+ *
749
+ * #### Example
750
+ *
751
+ * ```js
752
+ * const increment = firebase.firestore.FieldValue.increment(1);
753
+ * const timestamp = firebase.firestore.FieldValue.serverTimestamp();
754
+ *
755
+ * // false
756
+ * increment.isEqual(timestamp);
757
+ * ```
758
+ *
759
+ * @param other The `FieldValue` to compare against.
760
+ */
761
+ isEqual(other: FieldValue): boolean;
762
+ }
763
+ /**
764
+ * An immutable object representing a geo point in Firestore. The geo point is represented as latitude/longitude pair.
765
+ *
766
+ * Latitude values are in the range of [-90, 90]. Longitude values are in the range of [-180, 180].
767
+ */
768
+ export class GeoPoint {
769
+ /**
770
+ * Creates a new immutable GeoPoint object with the provided latitude and longitude values.
771
+ *
772
+ * #### Example
773
+ *
774
+ * ```js
775
+ * const geoPoint = new firebase.firestore.GeoPoint(60, -40);
776
+ * ```
777
+ *
778
+ * @param latitude The latitude as number between -90 and 90.
779
+ * @param longitude The longitude as number between -180 and 180.
780
+ */
781
+ constructor(latitude: number, longitude: number);
782
+ /**
783
+ * The latitude of this `GeoPoint` instance.
784
+ */
785
+ latitude: number;
786
+ /**
787
+ * The longitude of this `GeoPoint` instance.
788
+ */
789
+ longitude: number;
790
+ /**
791
+ * Returns true if this `GeoPoint` is equal to the provided one.
792
+ *
793
+ * #### Example
794
+ *
795
+ * ```js
796
+ * const geoPoint1 = new firebase.firestore.GeoPoint(60, -40);
797
+ * const geoPoint2 = new firebase.firestore.GeoPoint(60, -20);
798
+ *
799
+ * // false
800
+ * geoPoint1.isEqual(geoPoint2);
801
+ * ```
802
+ *
803
+ * @param other The `GeoPoint` to compare against.
804
+ */
805
+ isEqual(other: GeoPoint): boolean;
806
+ /**
807
+ * Returns a JSON-serializable representation of this GeoPoint.
808
+ */
809
+ toJSON(): {
810
+ latitude: number;
811
+ longitude: number;
812
+ };
813
+ }
814
+ /**
815
+ * An options object that configures the behavior of get() calls on DocumentReference and Query.
816
+ * By providing a GetOptions object, these methods can be configured to fetch results only from the
817
+ * server, only from the local cache or attempt to fetch results from the server and fall back to the
818
+ * cache (which is the default).
819
+ */
820
+ export interface GetOptions {
821
+ /**
822
+ * Describes whether we should get from server or cache.
823
+ *
824
+ * Setting to `default` (or not setting at all), causes Firestore to try to retrieve an up-to-date (server-retrieved)
825
+ * snapshot, but fall back to returning cached data if the server can't be reached.
826
+ *
827
+ * Setting to `server` causes Firestore to avoid the cache, generating an error if the server cannot be reached. Note
828
+ * that the cache will still be updated if the server request succeeds. Also note that latency-compensation still
829
+ * takes effect, so any pending write operations will be visible in the returned data (merged into the server-provided data).
830
+ *
831
+ * Setting to `cache` causes Firestore to immediately return a value from the cache, ignoring the server completely
832
+ * (implying that the returned value may be stale with respect to the value on the server.) If there is no data in the
833
+ * cache to satisfy the `get()` call, `DocumentReference.get()` will return an error and `QuerySnapshot.get()` will return an
834
+ * empty `QuerySnapshot` with no documents.
835
+ */
836
+ source: 'default' | 'server' | 'cache';
837
+ }
838
+ /**
839
+ * Represents an aggregation that can be performed by Firestore.
840
+ */
841
+ export class AggregateField<_T> {
842
+ /** A type string to uniquely identify instances of this class. */
843
+ type: string;
844
+ }
845
+ /**
846
+ * The union of all `AggregateField` types that are supported by Firestore.
847
+ */
848
+ export type AggregateFieldType = AggregateField<number>;
849
+ /**
850
+ * A type whose property values are all `AggregateField` objects.
851
+ */
852
+ export interface AggregateSpec {
853
+ [field: string]: AggregateFieldType;
854
+ }
855
+ /**
856
+ * A type whose keys are taken from an `AggregateSpec`, and whose values are the
857
+ * result of the aggregation performed by the corresponding `AggregateField`
858
+ * from the input `AggregateSpec`.
859
+ */
860
+ export type AggregateSpecData<T extends AggregateSpec> = {
861
+ [P in keyof T]: T[P] extends AggregateField<infer U> ? U : never;
862
+ };
863
+ /**
864
+ * The results of executing an aggregation query.
865
+ */
866
+ export interface AggregateQuerySnapshot<AggregateSpecType extends AggregateSpec, AppModelType extends DocumentData = DocumentData, DbModelType extends DocumentData = DocumentData> {
867
+ /**
868
+ * The underlying query over which the aggregations recorded in this
869
+ * `AggregateQuerySnapshot` were performed.
870
+ */
871
+ get query(): Query<AppModelType, DbModelType>;
872
+ /**
873
+ * Returns the results of the aggregations performed over the underlying
874
+ * query.
875
+ *
876
+ * The keys of the returned object will be the same as those of the
877
+ * `AggregateSpec` object specified to the aggregation method, and the values
878
+ * will be the corresponding aggregation result.
879
+ *
880
+ * @returns The results of the aggregations performed over the underlying
881
+ * query.
882
+ */
883
+ data(): AggregateSpecData<AggregateSpecType>;
884
+ }
885
+ /**
886
+ * The results of requesting an aggregated query.
887
+ */
888
+ export interface AggregateQuery<T extends AggregateSpec> {
889
+ /**
890
+ * The underlying query for this instance.
891
+ */
892
+ get query(): Query<DocumentData, DocumentData>;
893
+ /**
894
+ * Executes the query and returns the results as a AggregateQuerySnapshot.
895
+ *
896
+ *
897
+ * #### Example
898
+ *
899
+ * ```js
900
+ * const querySnapshot = await firebase.firestore()
901
+ * .collection('users')
902
+ * .count()
903
+ * .get();
904
+ * ```
905
+ *
906
+ * @param options An object to configure the get behavior.
907
+ */
908
+ get(): Promise<AggregateQuerySnapshot<T>>;
909
+ }
910
+ /**
911
+ * A Query refers to a `Query` which you can read or listen to. You can also construct refined `Query` objects by
912
+ * adding filters and ordering.
913
+ */
914
+ export class Query<AppModelType extends DocumentData = DocumentData, DbModelType extends DocumentData = DocumentData> {
915
+ /**
916
+ * Calculates the number of documents in the result set of the given query, without actually downloading
917
+ * the documents.
918
+ *
919
+ * Using this function to count the documents is efficient because only the final count, not the
920
+ * documents' data, is downloaded. This function can even count the documents if the result set
921
+ * would be prohibitively large to download entirely (e.g. thousands of documents).
922
+ *
923
+ * The result received from the server is presented, unaltered, without considering any local state.
924
+ * That is, documents in the local cache are not taken into consideration, neither are local
925
+ * modifications not yet synchronized with the server. Previously-downloaded results, if any,
926
+ * are not used: every request using this source necessarily involves a round trip to the server.
927
+ */
928
+ count(): AggregateQuery<{
929
+ count: AggregateField<number>;
930
+ }>;
931
+ /**
932
+ * Same as count()
933
+ */
934
+ countFromServer(): AggregateQuery<{
935
+ count: AggregateField<number>;
936
+ }>;
937
+ /**
938
+ * Creates and returns a new Query that ends at the provided document (inclusive). The end
939
+ * position is relative to the order of the query. The document must contain all of the
940
+ * fields provided in the orderBy of this query.
941
+ *
942
+ * #### Example
943
+ *
944
+ * ```js
945
+ * const user = await firebase.firestore().doc('users/alovelace').get();
946
+ *
947
+ * // Get all users up to a specific user in order of age
948
+ * const querySnapshot = await firebase.firestore()
949
+ * .collection('users')
950
+ * .orderBy('age')
951
+ * .endAt(user);
952
+ * ```
953
+ *
954
+ * > Cursor snapshot queries have limitations. Please see [Query limitations](/query-limitations) for more information.
955
+ *
956
+ * @param snapshot The snapshot of the document to end at.
957
+ */
958
+ endAt(snapshot: DocumentSnapshot<AppModelType, DbModelType>): Query<AppModelType, DbModelType>;
959
+ /**
960
+ * Creates and returns a new Query that ends at the provided fields relative to the order of the query.
961
+ * The order of the field values must match the order of the order by clauses of the query.
962
+ *
963
+ * #### Example
964
+ *
965
+ * ```js
966
+ * // Get all users who's age is 30 or less
967
+ * const querySnapshot = await firebase.firestore()
968
+ * .collection('users')
969
+ * .orderBy('age')
970
+ * .endAt(30);
971
+ * ```
972
+ *
973
+ * @param fieldValues The field values to end this query at, in order of the query's order by.
974
+ */
975
+ endAt(...fieldValues: any[]): Query<AppModelType, DbModelType>;
976
+ /**
977
+ * Creates and returns a new Query that ends before the provided document (exclusive). The end
978
+ * position is relative to the order of the query. The document must contain all of the fields
979
+ * provided in the orderBy of this query.
980
+ *
981
+ * #### Example
982
+ *
983
+ * ```js
984
+ * const user = await firebase.firestore().doc('users/alovelace').get();
985
+ *
986
+ * // Get all users up to, but not including, a specific user in order of age
987
+ * const querySnapshot = await firebase.firestore()
988
+ * .collection('users')
989
+ * .orderBy('age')
990
+ * .endBefore(user);
991
+ * ```
992
+ *
993
+ * > Cursor snapshot queries have limitations. Please see [Query limitations](/query-limitations) for more information.
994
+ *
995
+ * @param snapshot The snapshot of the document to end before.
996
+ */
997
+ endBefore(snapshot: DocumentSnapshot<AppModelType, DbModelType>): Query<AppModelType, DbModelType>;
998
+ /**
999
+ * Creates and returns a new Query that ends before the provided fields relative to the order of
1000
+ * the query. The order of the field values must match the order of the order by clauses of the query.
1001
+ *
1002
+ * #### Example
1003
+ *
1004
+ * ```js
1005
+ * // Get all users who's age is 29 or less
1006
+ * const querySnapshot = await firebase.firestore()
1007
+ * .collection('users')
1008
+ * .orderBy('age')
1009
+ * .endBefore(30);
1010
+ * ```
1011
+ *
1012
+ * @param fieldValues The field values to end this query before, in order of the query's order by.
1013
+ */
1014
+ endBefore(...fieldValues: any[]): Query<AppModelType, DbModelType>;
1015
+ /**
1016
+ * Executes the query and returns the results as a QuerySnapshot.
1017
+ *
1018
+ * Note: By default, get() attempts to provide up-to-date data when possible by waiting for data from the server,
1019
+ * but it may return cached data or fail if you are offline and the server cannot be reached. This behavior can be
1020
+ * altered via the `GetOptions` parameter.
1021
+ *
1022
+ * #### Example
1023
+ *
1024
+ * ```js
1025
+ * const querySnapshot = await firebase.firestore()
1026
+ * .collection('users')
1027
+ * .orderBy('age')
1028
+ * .get({
1029
+ * source: 'server',
1030
+ * });
1031
+ * ```
1032
+ *
1033
+ * @param options An object to configure the get behavior.
1034
+ */
1035
+ get(options?: GetOptions): Promise<QuerySnapshot<AppModelType, DbModelType>>;
1036
+ /**
1037
+ * Returns true if this Query is equal to the provided one.
1038
+ *
1039
+ * #### Example
1040
+ *
1041
+ * ```js
1042
+ * const query = firebase.firestore()
1043
+ * .collection('users')
1044
+ * .orderBy('age');
1045
+ *
1046
+ * // false
1047
+ * query.isEqual(
1048
+ * firebase.firestore()
1049
+ * .collection('users')
1050
+ * .orderBy('name')
1051
+ * );
1052
+ * ```
1053
+ *
1054
+ * @param other The `Query` to compare against.
1055
+ */
1056
+ isEqual(other: Query): boolean;
1057
+ /**
1058
+ * Creates and returns a new Query where the results are limited to the specified number of documents.
1059
+ *
1060
+ * #### Example
1061
+ *
1062
+ * ```js
1063
+ * // Get 10 users in order of age
1064
+ * const querySnapshot = firebase.firestore()
1065
+ * .collection('users')
1066
+ * .orderBy('age')
1067
+ * .limit(10)
1068
+ * .get();
1069
+ * ```
1070
+ *
1071
+ * @param limit The maximum number of items to return.
1072
+ */
1073
+ limit(limit: number): Query<AppModelType, DbModelType>;
1074
+ /**
1075
+ * Creates and returns a new Query where the results are limited to the specified number of documents
1076
+ * starting from the last document. The order is dependent on the second parameter for the `orderBy`
1077
+ * method. If `desc` is used, the order is reversed. `orderBy` method call is required when calling `limitToLast`.
1078
+ *
1079
+ * #### Example
1080
+ *
1081
+ * ```js
1082
+ * // Get the last 10 users in reverse order of age
1083
+ * const querySnapshot = firebase.firestore()
1084
+ * .collection('users')
1085
+ * .orderBy('age', 'desc')
1086
+ * .limitToLast(10)
1087
+ * .get();
1088
+ * ```
1089
+ *
1090
+ * @param limitToLast The maximum number of items to return.
1091
+ */
1092
+ limitToLast(limitToLast: number): Query<AppModelType, DbModelType>;
1093
+ /**
1094
+ * Attaches a listener for `QuerySnapshot` events.
1095
+ *
1096
+ * > Although an `onCompletion` callback can be provided, it will never be called because the snapshot stream is never-ending.
1097
+ *
1098
+ * Returns an unsubscribe function to stop listening to events.
1099
+ *
1100
+ * #### Example
1101
+ *
1102
+ * ```js
1103
+ * const unsubscribe = firebase.firestore().collection('users')
1104
+ * .onSnapshot({
1105
+ * error: (e) => console.error(e),
1106
+ * next: (querySnapshot) => {},
1107
+ * });
1108
+ *
1109
+ * unsubscribe();
1110
+ * ```
1111
+ *
1112
+ * @param observer A single object containing `next` and `error` callbacks.
1113
+ */
1114
+ onSnapshot(observer: {
1115
+ complete?: () => void;
1116
+ error?: (error: Error) => void;
1117
+ next?: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
1118
+ }): () => void;
1119
+ /**
1120
+ * Attaches a listener for `QuerySnapshot` events with snapshot listener options.
1121
+ *
1122
+ * > Although an `onCompletion` callback can be provided, it will never be called because the snapshot stream is never-ending.
1123
+ *
1124
+ * Returns an unsubscribe function to stop listening to events.
1125
+ *
1126
+ * #### Example
1127
+ *
1128
+ * ```js
1129
+ * const unsubscribe = firebase.firestore().collection('users')
1130
+ * .onSnapshot({
1131
+ * includeMetadataChanges: true,
1132
+ * }, {
1133
+ * error: (e) => console.error(e),
1134
+ * next: (querySnapshot) => {},
1135
+ * });
1136
+ *
1137
+ * unsubscribe();
1138
+ * ```
1139
+ *
1140
+ * @param options Options controlling the listen behavior.
1141
+ * @param observer A single object containing `next` and `error` callbacks.
1142
+ */
1143
+ onSnapshot(options: SnapshotListenOptions, observer: {
1144
+ complete?: () => void;
1145
+ error?: (error: Error) => void;
1146
+ next?: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
1147
+ }): () => void;
1148
+ /**
1149
+ * Attaches a listener for `QuerySnapshot` events.
1150
+ *
1151
+ * > Although an `onCompletion` callback can be provided, it will never be called because the snapshot stream is never-ending.
1152
+ *
1153
+ * Returns an unsubscribe function to stop listening to events.
1154
+ *
1155
+ * #### Example
1156
+ *
1157
+ * ```js
1158
+ * const unsubscribe = firebase.firestore().collection('users')
1159
+ * .onSnapshot(
1160
+ * (querySnapshot) => {}, // onNext
1161
+ * (error) => console.error(error), // onError
1162
+ * );
1163
+ *
1164
+ * unsubscribe();
1165
+ * ```
1166
+ * @param onNext A callback to be called every time a new `QuerySnapshot` is available.
1167
+ * @param onError A callback to be called if the listen fails or is cancelled. No further callbacks will occur.
1168
+ * @param onCompletion An optional function which will never be called.
1169
+ */
1170
+ onSnapshot(onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: Error) => void, onCompletion?: () => void): () => void;
1171
+ /**
1172
+ * Attaches a listener for `QuerySnapshot` events with snapshot listener options.
1173
+ *
1174
+ * NOTE: Although an onCompletion callback can be provided, it will never be called because the snapshot stream is never-ending.
1175
+ *
1176
+ * Returns an unsubscribe function to stop listening to events.
1177
+ *
1178
+ * #### Example
1179
+ *
1180
+ * ```js
1181
+ * const unsubscribe = firebase.firestore().collection('users')
1182
+ * .onSnapshot(
1183
+ * { includeMetadataChanges: true }, // SnapshotListenerOptions
1184
+ * (querySnapshot) => {}, // onNext
1185
+ * (error) => console.error(error), // onError
1186
+ * );
1187
+ *
1188
+ * unsubscribe();
1189
+ * ```
1190
+ * @param options Options controlling the listen behavior.
1191
+ * @param onNext A callback to be called every time a new `QuerySnapshot` is available.
1192
+ * @param onError A callback to be called if the listen fails or is cancelled. No further callbacks will occur.
1193
+ * @param onCompletion An optional function which will never be called.
1194
+ */
1195
+ onSnapshot(options: SnapshotListenOptions, onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: Error) => void, onCompletion?: () => void): () => void;
1196
+ /**
1197
+ * Creates and returns a new Query that's additionally sorted by the specified field, optionally in descending order instead of ascending.
1198
+ *
1199
+ * * #### Example
1200
+ *
1201
+ * #### Example
1202
+ *
1203
+ * ```js
1204
+ * // Get users in order of age, descending
1205
+ * const querySnapshot = firebase.firestore()
1206
+ * .collection('users')
1207
+ * .orderBy('age', 'desc')
1208
+ * .get();
1209
+ * ```
1210
+ *
1211
+ * @param fieldPath The field to sort by. Either a string or FieldPath instance.
1212
+ * @param directionStr Optional direction to sort by (`asc` or `desc`). If not specified, order will be ascending.
1213
+ */
1214
+ orderBy(fieldPath: string | FieldPath, directionStr?: 'asc' | 'desc'): Query<AppModelType, DbModelType>;
1215
+ /**
1216
+ * Creates and returns a new Query that starts after the provided document (exclusive). The start
1217
+ * position is relative to the order of the query. The document must contain all of the fields
1218
+ * provided in the orderBy of this query.
1219
+ *
1220
+ * #### Example
1221
+ *
1222
+ * ```js
1223
+ * const user = await firebase.firestore().doc('users/alovelace').get();
1224
+ *
1225
+ * // Get all users up to, but not including, a specific user in order of age
1226
+ * const querySnapshot = await firebase.firestore()
1227
+ * .collection('users')
1228
+ * .orderBy('age')
1229
+ * .startAfter(user)
1230
+ * .get();
1231
+ * ```
1232
+ *
1233
+ * > Cursor snapshot queries have limitations. Please see [Query limitations](/query-limitations) for more information.
1234
+ *
1235
+ * @param snapshot The snapshot of the document to start after.
1236
+ */
1237
+ startAfter(snapshot: DocumentSnapshot<AppModelType, DbModelType>): Query<AppModelType, DbModelType>;
1238
+ /**
1239
+ * Creates and returns a new Query that starts after the provided fields relative to the order of
1240
+ * the query. The order of the field values must match the order of the order by clauses of the query.
1241
+ *
1242
+ * #### Example
1243
+ *
1244
+ * ```js
1245
+ * // Get all users who's age is above 30
1246
+ * const querySnapshot = await firebase.firestore()
1247
+ * .collection('users')
1248
+ * .orderBy('age')
1249
+ * .startAfter(30)
1250
+ * .get();
1251
+ * ```
1252
+ *
1253
+ * @param fieldValues The field values to start this query after, in order of the query's order by.
1254
+ */
1255
+ startAfter(...fieldValues: any[]): Query<AppModelType, DbModelType>;
1256
+ /**
1257
+ * Creates and returns a new Query that starts at the provided document (inclusive). The start
1258
+ * position is relative to the order of the query. The document must contain all of the
1259
+ * fields provided in the orderBy of this query.
1260
+ *
1261
+ * #### Example
1262
+ *
1263
+ * ```js
1264
+ * const user = await firebase.firestore().doc('users/alovelace').get();
1265
+ *
1266
+ * // Get all users up to a specific user in order of age
1267
+ * const querySnapshot = await firebase.firestore()
1268
+ * .collection('users')
1269
+ * .orderBy('age')
1270
+ * .startAt(user)
1271
+ * .get();
1272
+ * ```
1273
+ *
1274
+ * > Cursor snapshot queries have limitations. Please see [Query limitations](/query-limitations) for more information.
1275
+ *
1276
+ * @param snapshot The snapshot of the document to start at.
1277
+ */
1278
+ startAt(snapshot: DocumentSnapshot<AppModelType, DbModelType>): Query<AppModelType, DbModelType>;
1279
+ /**
1280
+ * Creates and returns a new Query that starts at the provided fields relative to the order of the query.
1281
+ * The order of the field values must match the order of the order by clauses of the query.
1282
+ *
1283
+ * #### Example
1284
+ *
1285
+ * ```js
1286
+ * // Get all users who's age is 30 or above
1287
+ * const querySnapshot = await firebase.firestore()
1288
+ * .collection('users')
1289
+ * .orderBy('age')
1290
+ * .startAt(30)
1291
+ * .get();
1292
+ * ```
1293
+ *
1294
+ * @param fieldValues The field values to start this query at, in order of the query's order by.
1295
+ */
1296
+ startAt(...fieldValues: any[]): Query<AppModelType, DbModelType>;
1297
+ /**
1298
+ * Creates and returns a new Query with the additional filter that documents must contain the specified field and
1299
+ * the value should satisfy the relation constraint provided.
1300
+ *
1301
+ * #### Example
1302
+ *
1303
+ * ```js
1304
+ * // Get all users who's age is 30 or above
1305
+ * const querySnapshot = await firebase.firestore()
1306
+ * .collection('users')
1307
+ * .where('age', '>=', 30);
1308
+ * .get();
1309
+ * ```
1310
+ *
1311
+ * @param fieldPath The path to compare.
1312
+ * @param opStr The operation string (e.g "<", "<=", "==", ">", ">=", "!=", "array-contains", "array-contains-any", "in", "not-in").
1313
+ * @param value The comparison value.
1314
+ */
1315
+ where(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: any): Query<AppModelType, DbModelType>;
1316
+ /**
1317
+ * Creates and returns a new Query with the additional filter that documents must contain the specified field and
1318
+ * the value should satisfy the relation constraint provided.
1319
+ *
1320
+ * #### Example
1321
+ *
1322
+ * ```js
1323
+ * // Get all users who's age is 30 or above
1324
+ * const querySnapshot = await firebase.firestore()
1325
+ * .collection('users')
1326
+ * .where(Filter('age', '>=', 30));
1327
+ * .get();
1328
+ * ```
1329
+ *
1330
+ * @param filter The filter to apply to the query.
1331
+ */
1332
+ where(filter: QueryFilterConstraint): Query<AppModelType, DbModelType>;
1333
+ /**
1334
+ * Removes the current converter.
1335
+ *
1336
+ * @param converter `null` removes the current converter.
1337
+ * @return A Query that uses the provided converter.
1338
+ */
1339
+ withConverter(converter: null): Query<DocumentData, DocumentData>;
1340
+ /**
1341
+ * Applies a custom data converter to this Query, allowing you to use your
1342
+ * own custom model objects with Firestore. When you call get() on the
1343
+ * returned Query, the provided converter will convert between Firestore
1344
+ * data and your custom type U.
1345
+ *
1346
+ * Passing in `null` as the converter parameter removes the current
1347
+ * converter.
1348
+ *
1349
+ * @param converter Converts objects to and from Firestore. Passing in
1350
+ * `null` removes the current converter.
1351
+ * @return A Query<U> that uses the provided converter.
1352
+ */
1353
+ withConverter<NewAppModelType extends DocumentData, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): Query<NewAppModelType, NewDbModelType>;
1354
+ }
1355
+ /**
1356
+ * Filter conditions in a `Query.where()` clause are specified using the strings '<', '<=', '==', '>=', '>', 'array-contains', 'array-contains-any' or 'in'.
1357
+ */
1358
+ export type WhereFilterOp = '<' | '<=' | '==' | '>' | '>=' | '!=' | 'array-contains' | 'array-contains-any' | 'in' | 'not-in';
1359
+ /**
1360
+ * A `QuerySnapshot` contains zero or more `QueryDocumentSnapshot` objects representing the results of a query. The documents
1361
+ * can be accessed as an array via the `docs` property or enumerated using the `forEach` method. The number of documents
1362
+ * can be determined via the `empty` and `size` properties.
1363
+ */
1364
+ export interface QuerySnapshot<AppModelType extends DocumentData = DocumentData, DbModelType extends DocumentData = DocumentData> {
1365
+ /**
1366
+ * An array of all the documents in the `QuerySnapshot`.
1367
+ */
1368
+ docs: Array<QueryDocumentSnapshot<AppModelType, DbModelType>>;
1369
+ /**
1370
+ * True if there are no documents in the `QuerySnapshot`.
1371
+ */
1372
+ empty: boolean;
1373
+ /**
1374
+ * Metadata about this snapshot, concerning its source and if it has local modifications.
1375
+ */
1376
+ metadata: SnapshotMetadata;
1377
+ /**
1378
+ * The query on which you called get or `onSnapshot` in order to `get` this `QuerySnapshot`.
1379
+ */
1380
+ query: Query<AppModelType, DbModelType>;
1381
+ /**
1382
+ * The number of documents in the `QuerySnapshot`.
1383
+ */
1384
+ size: number;
1385
+ /**
1386
+ * Returns an array of the documents changes since the last snapshot. If this is the first snapshot, all documents
1387
+ * will be in the list as added changes.
1388
+ *
1389
+ * To include metadata changes, ensure that the `onSnapshot()` method includes metadata changes.
1390
+ *
1391
+ * #### Example
1392
+ *
1393
+ * ```js
1394
+ * firebase.firestore().collection('users')
1395
+ * .onSnapshot((querySnapshot) => {
1396
+ * console.log('Metadata Changes', querySnapshot.docChanges());
1397
+ * });
1398
+ * ```
1399
+ *
1400
+ * #### Example - With metadata changes
1401
+ *
1402
+ * ```js
1403
+ * firebase.firestore().collection('users')
1404
+ * .onSnapshot({ includeMetadataChanges: true }, (querySnapshot) => {
1405
+ * console.log('Metadata Changes', querySnapshot.docChanges({
1406
+ * includeMetadataChanges: true,
1407
+ * }));
1408
+ * });
1409
+ * ```
1410
+ *
1411
+ * @param options `SnapshotListenOptions` that control whether metadata-only changes (i.e. only `DocumentSnapshot.metadata` changed) should trigger snapshot events.
1412
+ */
1413
+ docChanges(options?: SnapshotListenOptions): Array<DocumentChange<AppModelType, DbModelType>>;
1414
+ /**
1415
+ * Enumerates all of the documents in the `QuerySnapshot`.
1416
+ *
1417
+ * #### Example
1418
+ *
1419
+ * ```js
1420
+ * const querySnapshot = await firebase.firestore().collection('users').get();
1421
+ *
1422
+ * querySnapshot.forEach((queryDocumentSnapshot) => {
1423
+ * console.log('User', queryDocumentSnapshot.data());
1424
+ * })
1425
+ * ```
1426
+ *
1427
+ * @param callback A callback to be called with a `QueryDocumentSnapshot` for each document in the snapshot.
1428
+ * @param thisArg The `this` binding for the callback.
1429
+ */
1430
+ forEach(callback: (result: QueryDocumentSnapshot<AppModelType, DbModelType>) => void, thisArg?: unknown): void;
1431
+ /**
1432
+ * Returns true if this `QuerySnapshot` is equal to the provided one.
1433
+ *
1434
+ * #### Example
1435
+ *
1436
+ * ```js
1437
+ * const querySnapshot1 = await firebase.firestore().collection('users').limit(5).get();
1438
+ * const querySnapshot2 = await firebase.firestore().collection('users').limit(10).get();
1439
+ *
1440
+ * // false
1441
+ * querySnapshot1.isEqual(querySnapshot2);
1442
+ * ```
1443
+ *
1444
+ * > This operation can be resource intensive when dealing with large datasets.
1445
+ *
1446
+ * @param other The `QuerySnapshot` to compare against.
1447
+ */
1448
+ isEqual(other: QuerySnapshot): boolean;
1449
+ }
1450
+ /**
1451
+ * An options object that configures the behavior of set() calls in `DocumentReference`, `WriteBatch` and `Transaction`.
1452
+ * These calls can be configured to perform granular merges instead of overwriting the target documents in their entirety
1453
+ * by providing a `SetOptions` with `merge: true`.
1454
+ *
1455
+ * Using both `merge` and `mergeFields` together will throw an error.
1456
+ */
1457
+ export interface SetOptions {
1458
+ /**
1459
+ * Changes the behavior of a `set()` call to only replace the values specified in its data argument.
1460
+ * Fields omitted from the `set()` call remain untouched.
1461
+ */
1462
+ merge?: boolean;
1463
+ /**
1464
+ * Changes the behavior of `set()` calls to only replace the specified field paths.
1465
+ * Any field path that is not specified is ignored and remains untouched.
1466
+ */
1467
+ mergeFields?: (string | FieldPath)[];
1468
+ }
1469
+ /**
1470
+ * Specifies custom configurations for your Cloud Firestore instance. You must set these before invoking any other methods.
1471
+ *
1472
+ * Used with `firebase.firestore().settings()`.
1473
+ */
1474
+ export interface Settings {
1475
+ /**
1476
+ * Enables or disables local persistent storage.
1477
+ */
1478
+ persistence?: boolean;
1479
+ /**
1480
+ * An approximate cache size threshold for the on-disk data. If the cache grows beyond this size, Firestore will start
1481
+ * removing data that hasn't been recently used. The size is not a guarantee that the cache will stay below that size,
1482
+ * only that if the cache exceeds the given size, cleanup will be attempted.
1483
+ *
1484
+ * To disable garbage collection and set an unlimited cache size, use `firebase.firestore.CACHE_SIZE_UNLIMITED`.
1485
+ */
1486
+ cacheSizeBytes?: number;
1487
+ /**
1488
+ * The hostname to connect to.
1489
+ *
1490
+ * Note: on android, hosts 'localhost' and '127.0.0.1' are automatically remapped to '10.0.2.2' (the
1491
+ * "host" computer IP address for android emulators) to make the standard development experience easy.
1492
+ * If you want to use the emulator on a real android device, you will need to specify the actual host
1493
+ * computer IP address. Use of this property for emulator connection is deprecated. Use useEmulator instead
1494
+ */
1495
+ host?: string;
1496
+ /**
1497
+ * Whether to use SSL when connecting. A true value is incompatible with the firestore emulator.
1498
+ */
1499
+ ssl?: boolean;
1500
+ /**
1501
+ * Whether to skip nested properties that are set to undefined during object serialization.
1502
+ * If set to true, these properties are skipped and not written to Firestore.
1503
+ * If set to false or omitted, the SDK throws an exception when it encounters properties of type undefined.
1504
+ */
1505
+ ignoreUndefinedProperties?: boolean;
1506
+ /**
1507
+ * If set, controls the return value for server timestamps that have not yet been set to their final value.
1508
+ *
1509
+ * By specifying 'estimate', pending server timestamps return an estimate based on the local clock.
1510
+ * This estimate will differ from the final value and cause these values to change once the server result becomes available.
1511
+ *
1512
+ * By specifying 'previous', pending timestamps will be ignored and return their previous value instead.
1513
+ *
1514
+ * If omitted or set to 'none', null will be returned by default until the server value becomes available.
1515
+ *
1516
+ */
1517
+ serverTimestampBehavior?: 'estimate' | 'previous' | 'none';
1518
+ }
1519
+ /**
1520
+ * An options object that can be passed to `DocumentReference.onSnapshot()`, `Query.onSnapshot()` and `QuerySnapshot.docChanges()`
1521
+ * to control which types of changes to include in the result set.
1522
+ */
1523
+ export interface SnapshotListenOptions {
1524
+ /**
1525
+ * Include a change even if only the metadata of the query or of a document changed. Default is false.
1526
+ */
1527
+ includeMetadataChanges: boolean;
1528
+ }
1529
+ /**
1530
+ * Metadata about a snapshot, describing the state of the snapshot.
1531
+ */
1532
+ export interface SnapshotMetadata {
1533
+ /**
1534
+ * True if the snapshot includes local writes (`set()` or `update()` calls) that haven't been committed to the backend yet.
1535
+ * If your listener has opted into metadata updates (via `SnapshotListenOptions`) you will receive another snapshot with
1536
+ * `fromCache` equal to false once the client has received up-to-date data from the backend.
1537
+ */
1538
+ fromCache: boolean;
1539
+ /**
1540
+ * True if the snapshot contains the result of local writes (e.g. `set()` or `update()` calls) that have not yet been
1541
+ * committed to the backend. If your listener has opted into metadata updates (via `SnapshotListenOptions`) you will
1542
+ * receive another snapshot with `hasPendingWrites` equal to false once the writes have been committed to the backend.
1543
+ */
1544
+ hasPendingWrites: boolean;
1545
+ /**
1546
+ * Returns true if this `SnapshotMetadata` is equal to the provided one.
1547
+ *
1548
+ * @param other The `SnapshotMetadata` to compare against.
1549
+ */
1550
+ isEqual(other: SnapshotMetadata): boolean;
1551
+ }
1552
+ /**
1553
+ * A Timestamp represents a point in time independent of any time zone or calendar, represented as seconds and
1554
+ * fractions of seconds at nanosecond resolution in UTC Epoch time.
1555
+ *
1556
+ * It is encoded using the Proleptic Gregorian Calendar which extends the Gregorian calendar backwards to year one.
1557
+ * It is encoded assuming all minutes are 60 seconds long, i.e. leap seconds are "smeared" so that no leap second table
1558
+ * is needed for interpretation. Range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
1559
+ */
1560
+ export class Timestamp {
1561
+ /**
1562
+ * Creates a new timestamp from the given JavaScript [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date).
1563
+ *
1564
+ * @param date The date to initialize the `Timestamp` from.
1565
+ */
1566
+ static fromDate(date: Date): Timestamp;
1567
+ /**
1568
+ * Creates a new timestamp from the given number of milliseconds.
1569
+ *
1570
+ * @param milliseconds Number of milliseconds since Unix epoch 1970-01-01T00:00:00Z.
1571
+ */
1572
+ static fromMillis(milliseconds: number): Timestamp;
1573
+ /**
1574
+ * Creates a new timestamp with the current date, with millisecond precision.
1575
+ */
1576
+ static now(): Timestamp;
1577
+ /**
1578
+ * Creates a new timestamp.
1579
+ *
1580
+ * @param seconds The number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.
1581
+ * @param nanoseconds The non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanoseconds values that count forward in time. Must be from 0 to 999,999,999 inclusive.
1582
+ */
1583
+ constructor(seconds: number, nanoseconds: number);
1584
+ /**
1585
+ * The number of nanoseconds of this `Timestamp`;
1586
+ */
1587
+ nanoseconds: number;
1588
+ /**
1589
+ * The number of seconds of this `Timestamp`.
1590
+ */
1591
+ seconds: number;
1592
+ /**
1593
+ * Returns true if this `Timestamp` is equal to the provided one.
1594
+ *
1595
+ * @param other The `Timestamp` to compare against.
1596
+ */
1597
+ isEqual(other: Timestamp): boolean;
1598
+ /**
1599
+ * Convert a Timestamp to a JavaScript Date object. This conversion causes a loss of precision since Date objects
1600
+ * only support millisecond precision.
1601
+ *
1602
+ * Returns a JavaScript [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) with
1603
+ * millseconds precision.
1604
+ */
1605
+ toDate(): Date;
1606
+ /**
1607
+ * Convert a Timestamp to a numeric timestamp (in milliseconds since epoch). This operation causes a loss of precision.
1608
+ *
1609
+ * The point in time corresponding to this timestamp, represented as the number of milliseconds since Unix epoch 1970-01-01T00:00:00Z.
1610
+ */
1611
+ toMillis(): number;
1612
+ /**
1613
+ * Convert a timestamp to a string in format "FirestoreTimestamp(seconds=`seconds`, nanoseconds=`nanoseconds`)",
1614
+ * with the `seconds` and `nanoseconds` replaced by the values in the Timestamp object
1615
+ */
1616
+ toString(): string;
1617
+ /**
1618
+ * Convert a Timestamp to a JSON object with seconds and nanoseconds members
1619
+ */
1620
+ toJSON(): {
1621
+ seconds: number;
1622
+ nanoseconds: number;
1623
+ };
1624
+ /**
1625
+ * Converts this object to a primitive string, which allows Timestamp objects to be compared
1626
+ * using the `>`, `<=`, `>=` and `>` operators.
1627
+ */
1628
+ valueOf(): string;
1629
+ }
1630
+ /**
1631
+ * A reference to a transaction. The `Transaction` object passed to a transaction's updateFunction provides the methods to
1632
+ * read and write data within the transaction context. See `Firestore.runTransaction()`.
1633
+ *
1634
+ * A transaction consists of any number of `get()` operations followed by any number of write operations such as `set()`,
1635
+ * `update()`, or `delete()`. In the case of a concurrent edit, Cloud Firestore runs the entire transaction again. For example,
1636
+ * if a transaction reads documents and another client modifies any of those documents, Cloud Firestore retries the transaction.
1637
+ * This feature ensures that the transaction runs on up-to-date and consistent data.
1638
+ *
1639
+ * Transactions never partially apply writes. All writes execute at the end of a successful transaction.
1640
+ *
1641
+ * When using transactions, note that:
1642
+ * - Read operations must come before write operations.
1643
+ * - A function calling a transaction (transaction function) might run more than once if a concurrent edit affects a document that the transaction reads.
1644
+ * - Transaction functions should not directly modify application state (return a value from the `updateFunction`).
1645
+ * - Transactions will fail when the client is offline.
1646
+ */
1647
+ export interface Transaction {
1648
+ /**
1649
+ * Deletes the document referred to by the provided `DocumentReference`.
1650
+ *
1651
+ * #### Example
1652
+ *
1653
+ * ```js
1654
+ * const docRef = firebase.firestore().doc('users/alovelace');
1655
+ *
1656
+ * await firebase.firestore().runTransaction((transaction) => {
1657
+ * return transaction.delete(docRef);
1658
+ * });
1659
+ * ```
1660
+ *
1661
+ * @param documentRef A reference to the document to be deleted.
1662
+ */
1663
+ delete(documentRef: DocumentReference): Transaction;
1664
+ /**
1665
+ * Reads the document referenced by the provided `DocumentReference`.
1666
+ *
1667
+ * #### Example
1668
+ *
1669
+ * ```js
1670
+ * const docRef = firebase.firestore().doc('users/alovelace');
1671
+ *
1672
+ * await firebase.firestore().runTransaction(async (transaction) => {
1673
+ * const snapshot = await transaction.get(docRef);
1674
+ * // use snapshot with transaction (see set() or update())
1675
+ * ...
1676
+ * });
1677
+ * ```
1678
+ *
1679
+ * @param documentRef A reference to the document to be read.
1680
+ */
1681
+ get<T extends DocumentData = DocumentData>(documentRef: DocumentReference<T>): Promise<DocumentSnapshot<T>>;
1682
+ /**
1683
+ * Writes to the document referred to by the provided `DocumentReference`. If the document does not exist yet,
1684
+ * it will be created. If you pass `SetOptions`, the provided data can be merged into the existing document.
1685
+ *
1686
+ * #### Example
1687
+ *
1688
+ * ```js
1689
+ * const docRef = firebase.firestore().doc('users/alovelace');
1690
+ *
1691
+ * await firebase.firestore().runTransaction((transaction) => {
1692
+ * const snapshot = await transaction.get(docRef);
1693
+ * const snapshotData = snapshot.data();
1694
+ *
1695
+ * return transaction.set(docRef, {
1696
+ * ...data,
1697
+ * age: 30, // new field
1698
+ * });
1699
+ * });
1700
+ * ```
1701
+ *
1702
+ * @param documentRef A reference to the document to be set.
1703
+ * @param data An object of the fields and values for the document.
1704
+ * @param options An object to configure the set behavior.
1705
+ */
1706
+ set<T extends DocumentData = DocumentData>(documentRef: DocumentReference<T>, data: T, options?: SetOptions): Transaction;
1707
+ /**
1708
+ * Updates fields in the document referred to by the provided `DocumentReference`. The update will fail if applied
1709
+ * to a document that does not exist.
1710
+ *
1711
+ * #### Example
1712
+ *
1713
+ * ```js
1714
+ * const docRef = firebase.firestore().doc('users/alovelace');
1715
+ *
1716
+ * await firebase.firestore().runTransaction((transaction) => {
1717
+ * const snapshot = await transaction.get(docRef);
1718
+ *
1719
+ * return transaction.update(docRef, {
1720
+ * age: snapshot.data().age + 1,
1721
+ * });
1722
+ * });
1723
+ * ```
1724
+ *
1725
+ * @param documentRef A reference to the document to be updated.
1726
+ * @param data An object containing the fields and values with which to update the document. Fields can contain dots to reference nested fields within the document.
1727
+ */
1728
+ update<T extends DocumentData = DocumentData>(documentRef: DocumentReference<T>, data: Partial<{
1729
+ [K in keyof T]: T[K] | FieldValue;
1730
+ }>): Transaction;
1731
+ /**
1732
+ * Updates fields in the document referred to by the provided DocumentReference. The update will fail if applied to
1733
+ * a document that does not exist.
1734
+ *
1735
+ * Nested fields can be updated by providing dot-separated field path strings or by providing FieldPath objects.
1736
+ *
1737
+ * #### Example
1738
+ *
1739
+ * ```js
1740
+ * const docRef = firebase.firestore().doc('users/alovelace');
1741
+ *
1742
+ * await firebase.firestore().runTransaction((transaction) => {
1743
+ * const snapshot = await transaction.get(docRef);
1744
+ *
1745
+ * return transaction.update(docRef, 'age', snapshot.data().age + 1);
1746
+ * });
1747
+ * ```
1748
+ *
1749
+ * @param documentRef A reference to the document to be updated.
1750
+ * @param field The first field to update.
1751
+ * @param value The first value.
1752
+ * @param moreFieldsAndValues Additional key/value pairs.
1753
+ */
1754
+ update<T extends DocumentData = DocumentData, K extends keyof T = string>(documentRef: DocumentReference<T>, field: K | FieldPath, value: T[K], ...moreFieldsAndValues: any[]): Transaction;
1755
+ }
1756
+ /**
1757
+ * A write batch, used to perform multiple writes as a single atomic unit.
1758
+ *
1759
+ * A WriteBatch object can be acquired by calling `firestore.batch()`. It provides methods for adding
1760
+ * writes to the write batch. None of the writes will be committed (or visible locally) until
1761
+ * `WriteBatch.commit()` is called.
1762
+ *
1763
+ * Unlike transactions, write batches are persisted offline and therefore are preferable when you don't need to
1764
+ * condition your writes on read data.
1765
+ */
1766
+ export interface WriteBatch {
1767
+ /**
1768
+ * Commits all of the writes in this write batch as a single atomic unit.
1769
+ *
1770
+ * Returns a Promise resolved once all of the writes in the batch have been successfully written
1771
+ * to the backend as an atomic unit. Note that it won't resolve while you're offline.
1772
+ *
1773
+ * #### Example
1774
+ *
1775
+ * ```js
1776
+ * const batch = firebase.firestore().batch();
1777
+ *
1778
+ * // Perform batch operations...
1779
+ *
1780
+ * await batch.commit();
1781
+ * ```
1782
+ */
1783
+ commit(): Promise<void>;
1784
+ /**
1785
+ * Deletes the document referred to by the provided `DocumentReference`.
1786
+ *
1787
+ * #### Example
1788
+ *
1789
+ * ```js
1790
+ * const batch = firebase.firestore().batch();
1791
+ * const docRef = firebase.firestore().doc('users/alovelace');
1792
+ *
1793
+ * batch.delete(docRef);
1794
+ * ```
1795
+ *
1796
+ * @param documentRef A reference to the document to be deleted.
1797
+ */
1798
+ delete(documentRef: DocumentReference): WriteBatch;
1799
+ /**
1800
+ * Writes to the document referred to by the provided DocumentReference. If the document does
1801
+ * not exist yet, it will be created. If you pass SetOptions, the provided data can be merged
1802
+ * into the existing document.
1803
+ *
1804
+ * #### Example
1805
+ *
1806
+ * ```js
1807
+ * const batch = firebase.firestore().batch();
1808
+ * const docRef = firebase.firestore().doc('users/dsmith');
1809
+ *
1810
+ * batch.set(docRef, {
1811
+ * name: 'David Smith',
1812
+ * age: 25,
1813
+ * });
1814
+ * ```
1815
+ *
1816
+ * @param documentRef A reference to the document to be set.
1817
+ * @param data An object of the fields and values for the document.
1818
+ * @param options An object to configure the set behavior.
1819
+ */
1820
+ set<T extends DocumentData = DocumentData>(documentRef: DocumentReference<T>, data: T, options?: SetOptions): WriteBatch;
1821
+ /**
1822
+ * Updates fields in the document referred to by the provided DocumentReference. The update will fail if applied to a document that does not exist.
1823
+ *
1824
+ * #### Example
1825
+ *
1826
+ * ```js
1827
+ * const batch = firebase.firestore().batch();
1828
+ * const docRef = firebase.firestore().doc('users/alovelace');
1829
+ *
1830
+ * batch.update(docRef, {
1831
+ * city: 'SF',
1832
+ * });
1833
+ * ```
1834
+ *
1835
+ * @param documentRef A reference to the document to be updated.
1836
+ * @param data An object containing the fields and values with which to update the document. Fields can contain dots to reference nested fields within the document.
1837
+ */
1838
+ update<T extends DocumentData = DocumentData>(documentRef: DocumentReference<T>, data: Partial<{
1839
+ [K in keyof T]: T[K] | FieldValue;
1840
+ }>): WriteBatch;
1841
+ /**
1842
+ * Updates fields in the document referred to by this DocumentReference. The update will fail if applied to a document that does not exist.
1843
+ *
1844
+ * Nested fields can be update by providing dot-separated field path strings or by providing FieldPath objects.
1845
+ *
1846
+ * #### Example
1847
+ *
1848
+ * ```js
1849
+ * const batch = firebase.firestore().batch();
1850
+ * const docRef = firebase.firestore().doc('users/alovelace');
1851
+ *
1852
+ * batch.update(docRef, 'city', 'SF', 'age', 31);
1853
+ * ```
1854
+ *
1855
+ * @param documentRef A reference to the document to be updated.
1856
+ * @param field The first field to update.
1857
+ * @param value The first value.
1858
+ * @param moreFieldAndValues Additional key value pairs.
1859
+ */
1860
+ update<T extends DocumentData = DocumentData, K extends keyof T = string>(documentRef: DocumentReference<T>, field: K | FieldPath, value: T[K] | FieldValue, ...moreFieldAndValues: any[]): WriteBatch;
1861
+ }
1862
+ /**
1863
+ * Returns the PersistentCache Index Manager used by the given Firestore object.
1864
+ * The PersistentCacheIndexManager instance, or null if local persistent storage is not in use.
1865
+ */
1866
+ export interface PersistentCacheIndexManager {
1867
+ /**
1868
+ * Enables the SDK to create persistent cache indexes automatically for local query
1869
+ * execution when the SDK believes cache indexes can help improves performance.
1870
+ * This feature is disabled by default.
1871
+ */
1872
+ enableIndexAutoCreation(): Promise<void>;
1873
+ /**
1874
+ * Stops creating persistent cache indexes automatically for local query execution.
1875
+ * The indexes which have been created by calling `enableIndexAutoCreation()` still take effect.
1876
+ */
1877
+ disableIndexAutoCreation(): Promise<void>;
1878
+ /**
1879
+ * Removes all persistent cache indexes. Note this function also deletes indexes
1880
+ * generated by `setIndexConfiguration()`, which is deprecated.
1881
+ */
1882
+ deleteAllIndexes(): Promise<void>;
1883
+ }
1884
+ /**
1885
+ * Represents the state of bundle loading tasks.
1886
+ *
1887
+ * Both 'Error' and 'Success' are sinking state: task will abort or complete and there will be no more
1888
+ * updates after they are reported.
1889
+ */
1890
+ export type TaskState = 'Error' | 'Running' | 'Success';
1891
+ /**
1892
+ * Represents a progress update or a final state from loading bundles.
1893
+ */
1894
+ export interface LoadBundleTaskProgress {
1895
+ /**
1896
+ * How many bytes have been loaded.
1897
+ */
1898
+ bytesLoaded: number;
1899
+ /**
1900
+ * How many documents have been loaded.
1901
+ */
1902
+ documentsLoaded: number;
1903
+ /**
1904
+ * Current task state.
1905
+ */
1906
+ taskState: TaskState;
1907
+ /**
1908
+ * How many bytes are in the bundle being loaded.
1909
+ */
1910
+ totalBytes: number;
1911
+ /**
1912
+ * How many documents are in the bundle being loaded.
1913
+ */
1914
+ totalDocuments: number;
1915
+ }
1916
+ /**
1917
+ * `firebase.firestore.X`
1918
+ */
1919
+ export interface Statics {
1920
+ /**
1921
+ * Returns the `Blob` class.
1922
+ */
1923
+ Blob: typeof Blob;
1924
+ /**
1925
+ * Returns the `FieldPath` class.
1926
+ */
1927
+ FieldPath: typeof FieldPath;
1928
+ /**
1929
+ * Returns the `FieldValue` class.
1930
+ */
1931
+ FieldValue: typeof FieldValue;
1932
+ /**
1933
+ * Returns the `GeoPoint` class.
1934
+ */
1935
+ GeoPoint: typeof GeoPoint;
1936
+ /**
1937
+ * Returns the `Timestamp` class.
1938
+ */
1939
+ Timestamp: typeof Timestamp;
1940
+ /**
1941
+ * Returns the `Filter` function.
1942
+ */
1943
+ Filter: typeof Filter;
1944
+ /**
1945
+ * Used to set the cache size to unlimited when passing to `cacheSizeBytes` in
1946
+ * `firebase.firestore().settings()`.
1947
+ */
1948
+ CACHE_SIZE_UNLIMITED: number;
1949
+ /**
1950
+ * Sets the verbosity of Cloud Firestore native device logs (debug, error, or silent).
1951
+ *
1952
+ * - `debug`: the most verbose logging level, primarily for debugging.
1953
+ * - `error`: logs only error events.
1954
+ * - `silent`: turn off logging.
1955
+ *
1956
+ * #### Example
1957
+ *
1958
+ * ```js
1959
+ * firebase.firestore.setLogLevel('silent');
1960
+ * ```
1961
+ *
1962
+ * @param logLevel The verbosity you set for activity and error logging.
1963
+ */
1964
+ setLogLevel(logLevel: 'debug' | 'error' | 'silent'): void;
1965
+ SDK_VERSION: string;
1966
+ }
1967
+ /**
1968
+ * Converter used by `withConverter()` to transform user objects of type T
1969
+ * into Firestore data.
1970
+ *
1971
+ * Using the converter allows you to specify generic type arguments when
1972
+ * storing and retrieving objects from Firestore.
1973
+ *
1974
+ * @example
1975
+ * ```typescript
1976
+ * class Post {
1977
+ * constructor(readonly title: string, readonly author: string) {}
1978
+ *
1979
+ * toString(): string {
1980
+ * return this.title + ', by ' + this.author;
1981
+ * }
1982
+ * }
1983
+ *
1984
+ * const postConverter = {
1985
+ * toFirestore(post: Post): firebase.firestore.DocumentData {
1986
+ * return {title: post.title, author: post.author};
1987
+ * },
1988
+ * fromFirestore(
1989
+ * snapshot: firebase.firestore.QueryDocumentSnapshot,
1990
+ * options: firebase.firestore.SnapshotOptions
1991
+ * ): Post {
1992
+ * const data = snapshot.data(options)!;
1993
+ * return new Post(data.title, data.author);
1994
+ * }
1995
+ * };
1996
+ *
1997
+ * const postSnap = await firebase.firestore()
1998
+ * .collection('posts')
1999
+ * .withConverter(postConverter)
2000
+ * .doc().get();
2001
+ * const post = postSnap.data();
2002
+ * if (post !== undefined) {
2003
+ * post.title; // string
2004
+ * post.toString(); // Should be defined
2005
+ * post.someNonExistentProperty; // TS error
2006
+ * }
2007
+ * ```
2008
+ */
2009
+ export interface FirestoreDataConverter<AppModelType, DbModelType extends DocumentData = DocumentData> {
2010
+ /**
2011
+ * Called by the Firestore SDK to convert a custom model object of type T
2012
+ * into a plain JavaScript object (suitable for writing directly to the
2013
+ * Firestore database). To use `set()` with `merge` and `mergeFields`,
2014
+ * `toFirestore()` must be defined with `Partial<T>`.
2015
+ */
2016
+ toFirestore(modelObject: AppModelType): DocumentData;
2017
+ toFirestore(modelObject: Partial<AppModelType>, options: SetOptions): DocumentData;
2018
+ /**
2019
+ * Called by the Firestore SDK to convert Firestore data into an object of
2020
+ * type T. You can access your data by calling: `snapshot.data(options)`.
2021
+ *
2022
+ * @param snapshot A QueryDocumentSnapshot containing your data and metadata.
2023
+ * @param options The SnapshotOptions from the initial call to `data()`.
2024
+ */
2025
+ fromFirestore(snapshot: QueryDocumentSnapshot<DocumentData, DbModelType>, options: SnapshotOptions): AppModelType;
2026
+ }
2027
+ /**
2028
+ * The Firebase Cloud Firestore service is available for the default app or a given app.
2029
+ *
2030
+ * #### Example: Get the firestore instance for the **default app**:
2031
+ *
2032
+ * ```js
2033
+ * const firestoreForDefaultApp = firebase.firestore();
2034
+ * ```
2035
+ *
2036
+ * #### Example: Get the firestore instance for a **secondary app**:
2037
+ *
2038
+ * ```js
2039
+ * const otherApp = firebase.app('otherApp');
2040
+ * const firestoreForOtherApp = firebase.firestore(otherApp);
2041
+ * ```
2042
+ *
2043
+ */
2044
+ export class Module implements _FirebaseModule {
2045
+ /**
2046
+ * The current `FirebaseApp` instance for this Firebase service.
2047
+ */
2048
+ app: ReactNativeFirebase.FirebaseApp;
2049
+ /**
2050
+ * Creates a write batch, used for performing multiple writes as a single atomic operation.
2051
+ * The maximum number of writes allowed in a single WriteBatch is 500, but note that each usage
2052
+ * of `FieldValue.serverTimestamp()`, `FieldValue.arrayUnion()`, `FieldValue.arrayRemove()`, or `FieldValue.increment()`
2053
+ * inside a WriteBatch counts as an additional write.
2054
+ *
2055
+ * #### Example
2056
+ *
2057
+ * ```js
2058
+ * const batch = firebase.firestore().batch();
2059
+ * batch.delete(...);
2060
+ * ```
2061
+ */
2062
+ batch(): WriteBatch;
2063
+ /**
2064
+ * Gets a `CollectionReference` instance that refers to the collection at the specified path.
2065
+ *
2066
+ * #### Example
2067
+ *
2068
+ * ```js
2069
+ * const collectionReference = firebase.firestore().collection('users');
2070
+ * ```
2071
+ *
2072
+ * @param collectionPath A slash-separated path to a collection.
2073
+ */
2074
+ collection<T extends DocumentData = DocumentData>(collectionPath: string): CollectionReference<T>;
2075
+ /**
2076
+ * Creates and returns a new Query that includes all documents in the database that are contained
2077
+ * in a collection or subcollection with the given collectionId.
2078
+ *
2079
+ * #### Example
2080
+ *
2081
+ * ```js
2082
+ * const collectionGroup = firebase.firestore().collectionGroup('orders');
2083
+ * ```
2084
+ *
2085
+ * @param collectionId Identifies the collections to query over. Every collection or subcollection with this ID as the last segment of its path will be included. Cannot contain a slash.
2086
+ */
2087
+ collectionGroup<T extends DocumentData = DocumentData>(collectionId: string): Query<T>;
2088
+ /**
2089
+ * Disables network usage for this instance. It can be re-enabled via `enableNetwork()`. While the
2090
+ * network is disabled, any snapshot listeners or get() calls will return results from cache, and any
2091
+ * write operations will be queued until the network is restored.
2092
+ *
2093
+ * Returns a promise that is resolved once the network has been disabled.
2094
+ *
2095
+ * #### Example
2096
+ *
2097
+ * ```js
2098
+ * await firebase.firestore().disableNetwork();
2099
+ * ```
2100
+ */
2101
+ disableNetwork(): Promise<void>;
2102
+ /**
2103
+ * Gets a `DocumentReference` instance that refers to the document at the specified path.
2104
+ *
2105
+ * #### Example
2106
+ *
2107
+ * ```js
2108
+ * const documentReference = firebase.firestore().doc('users/alovelace');
2109
+ * ```
2110
+ *
2111
+ * @param documentPath A slash-separated path to a document.
2112
+ */
2113
+ doc<T extends DocumentData = DocumentData>(documentPath: string): DocumentReference<T, T>;
2114
+ /**
2115
+ * Re-enables use of the network for this Firestore instance after a prior call to `disableNetwork()`.
2116
+ *
2117
+ * #### Example
2118
+ *
2119
+ * ```js
2120
+ * await firebase.firestore().enableNetwork();
2121
+ * ```
2122
+ */
2123
+ enableNetwork(): Promise<void>;
2124
+ /**
2125
+ * Executes the given `updateFunction` and then attempts to commit the changes applied within the transaction.
2126
+ * If any document read within the transaction has changed, Cloud Firestore retries the `updateFunction`.
2127
+ * If it fails to commit after 5 attempts, the transaction fails.
2128
+ *
2129
+ * The maximum number of writes allowed in a single transaction is 500, but note that each usage of
2130
+ * `FieldValue.serverTimestamp()`, `FieldValue.arrayUnion()`, `FieldValue.arrayRemove()`, or `FieldValue.increment()`
2131
+ * inside a transaction counts as an additional write.
2132
+ *
2133
+ * #### Example
2134
+ *
2135
+ * ```js
2136
+ * const cityRef = firebase.firestore().doc('cities/SF');
2137
+ *
2138
+ * await firebase.firestore()
2139
+ * .runTransaction(async (transaction) => {
2140
+ * const snapshot = await transaction.get(cityRef);
2141
+ * await transaction.update(cityRef, {
2142
+ * population: snapshot.data().population + 1,
2143
+ * });
2144
+ * });
2145
+ * ```
2146
+ */
2147
+ runTransaction(updateFunction: (transaction: Transaction) => Promise<any>): Promise<any>;
2148
+ /**
2149
+ * Specifies custom settings to be used to configure the Firestore instance. Must be set before invoking any other methods.
2150
+ *
2151
+ * #### Example
2152
+ *
2153
+ * ```js
2154
+ * const settings = {
2155
+ * cacheSizeBytes: firebase.firestore.CACHE_SIZE_UNLIMITED,
2156
+ * };
2157
+ *
2158
+ * await firebase.firestore().settings(settings);
2159
+ * ```
2160
+ *
2161
+ * @param settings A `Settings` object.
2162
+ */
2163
+ settings(settings: Settings): Promise<void>;
2164
+ /**
2165
+ * Loads a Firestore bundle into the local cache.
2166
+ *
2167
+ * #### Example
2168
+ *
2169
+ * ```js
2170
+ * const resp = await fetch('/createBundle');
2171
+ * const bundleString = await resp.text();
2172
+ * await firestore().loadBundle(bundleString);
2173
+ * ```
2174
+ */
2175
+ loadBundle(bundle: string): Promise<LoadBundleTaskProgress>;
2176
+ /**
2177
+ * Reads a Firestore Query from local cache, identified by the given name.
2178
+ *
2179
+ * #### Example
2180
+ *
2181
+ * ```js
2182
+ * const query = firestore().namedQuery('latest-stories-query');
2183
+ * const storiesSnap = await query.get({ source: 'cache' });
2184
+ * ```
2185
+ */
2186
+ namedQuery<T extends DocumentData = DocumentData>(name: string): Query<T>;
2187
+ /**
2188
+ * Aimed primarily at clearing up any data cached from running tests. Needs to be executed before any database calls
2189
+ * are made.
2190
+ *
2191
+ * #### Example
2192
+ *
2193
+ *```js
2194
+ * await firebase.firestore().clearPersistence();
2195
+ * ```
2196
+ */
2197
+ clearPersistence(): Promise<void>;
2198
+ /**
2199
+ * Waits until all currently pending writes for the active user have been acknowledged by the
2200
+ * backend.
2201
+ *
2202
+ * The returned Promise resolves immediately if there are no outstanding writes. Otherwise, the
2203
+ * Promise waits for all previously issued writes (including those written in a previous app
2204
+ * session), but it does not wait for writes that were added after the method is called. If you
2205
+ * want to wait for additional writes, call `waitForPendingWrites()` again.
2206
+ *
2207
+ * Any outstanding `waitForPendingWrites()` Promises are rejected when the logged-in user changes.
2208
+ *
2209
+ * #### Example
2210
+ *
2211
+ *```js
2212
+ * await firebase.firestore().waitForPendingWrites();
2213
+ * ```
2214
+ */
2215
+ waitForPendingWrites(): Promise<void>;
2216
+ /**
2217
+ * Typically called to ensure a new Firestore instance is initialized before calling
2218
+ * `firebase.firestore().clearPersistence()`.
2219
+ *
2220
+ * #### Example
2221
+ *
2222
+ *```js
2223
+ * await firebase.firestore().terminate();
2224
+ * ```
2225
+ */
2226
+ terminate(): Promise<void>;
2227
+ /**
2228
+ * Modify this Firestore instance to communicate with the Firebase Firestore emulator.
2229
+ * This must be called before any other calls to Firebase Firestore to take effect.
2230
+ * Do not use with production credentials as emulator traffic is not encrypted.
2231
+ *
2232
+ * Note: on android, hosts 'localhost' and '127.0.0.1' are automatically remapped to '10.0.2.2' (the
2233
+ * "host" computer IP address for android emulators) to make the standard development experience easy.
2234
+ * If you want to use the emulator on a real android device, you will need to specify the actual host
2235
+ * computer IP address.
2236
+ *
2237
+ * @param host: emulator host (eg, 'localhost')
2238
+ * @param port: emulator port (eg, 8080)
2239
+ */
2240
+ useEmulator(host: string, port: number): void;
2241
+ /**
2242
+ * Gets the `PersistentCacheIndexManager` instance used by this Cloud Firestore instance.
2243
+ * This is not the same as Cloud Firestore Indexes.
2244
+ * Persistent cache indexes are optional indexes that only exist within the SDK to assist in local query execution.
2245
+ * Returns `null` if local persistent storage is not in use.
2246
+ */
2247
+ persistentCacheIndexManager(): PersistentCacheIndexManager | null;
2248
+ }
2249
+ /**
2250
+ * Utility type to allow FieldValue and to allow Date in place of Timestamp objects.
2251
+ */
2252
+ export type SetValue<T> = T extends Timestamp ? Timestamp | Date : T extends object ? {
2253
+ [P in keyof T]: SetValue<T[P]> | FieldValue;
2254
+ } : T;
2255
+ export {};
2256
+ }
2257
+ type FirestoreNamespace = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<FirebaseFirestoreTypes.Module, FirebaseFirestoreTypes.Statics> & {
2258
+ firestore: ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<FirebaseFirestoreTypes.Module, FirebaseFirestoreTypes.Statics>;
2259
+ firebase: ReactNativeFirebase.Module;
2260
+ app(name?: string): ReactNativeFirebase.FirebaseApp;
2261
+ };
2262
+ declare const defaultExport: FirestoreNamespace;
2263
+ export declare const firebase: ReactNativeFirebase.Module & {
2264
+ firestore: typeof defaultExport;
2265
+ app(name?: string): ReactNativeFirebase.FirebaseApp & {
2266
+ firestore(): FirebaseFirestoreTypes.Module;
2267
+ };
2268
+ };
2269
+ export declare const Filter: FirebaseFirestoreTypes.FilterFunction;
2270
+ export default defaultExport;
2271
+ /**
2272
+ * Attach namespace to `firebase.` and `FirebaseApp.`.
2273
+ */
2274
+ declare module '@react-native-firebase/app' {
2275
+ namespace ReactNativeFirebase {
2276
+ import FirebaseModuleWithStaticsAndApp = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp;
2277
+ interface Module {
2278
+ firestore: FirebaseModuleWithStaticsAndApp<FirebaseFirestoreTypes.Module, FirebaseFirestoreTypes.Statics>;
2279
+ }
2280
+ interface FirebaseApp {
2281
+ firestore(databaseId?: string): FirebaseFirestoreTypes.Module;
2282
+ }
2283
+ }
2284
+ }
2285
+ //# sourceMappingURL=namespaced.d.ts.map