@react-native-firebase/firestore 23.8.8 → 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 +27 -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
@@ -47,31 +47,34 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
47
47
  *
48
48
  * @firebase firestore
49
49
  */
50
+ // eslint-disable-next-line @typescript-eslint/no-namespace
50
51
  export namespace FirebaseFirestoreTypes {
51
- import FirebaseModule = ReactNativeFirebase.FirebaseModule;
52
+ type _FirebaseModule = ReactNativeFirebase.FirebaseModule;
52
53
  /**
53
54
  * An instance of Filter used to generate Firestore Filter queries.
54
55
  */
55
56
 
56
57
  export type QueryFilterType = 'OR' | 'AND';
57
58
 
58
- export interface QueryFieldFilterConstraint {
59
+ export interface QueryFieldFilterConstraint<T extends DocumentData = DocumentData> {
59
60
  fieldPath: keyof T | FieldPath;
60
61
  operator: WhereFilterOp;
61
62
  value: any;
62
63
  }
63
64
 
64
- export interface QueryCompositeFilterConstraint {
65
+ export interface QueryCompositeFilterConstraint<T extends DocumentData = DocumentData> {
65
66
  operator: QueryFilterType;
66
- queries: QueryFieldFilterConstraint[];
67
+ queries: QueryFieldFilterConstraint<T>[];
67
68
  }
68
69
 
69
- export type QueryFilterConstraint = QueryFieldFilterConstraint | QueryCompositeFilterConstraint;
70
+ export type QueryFilterConstraint<T extends DocumentData = DocumentData> =
71
+ | QueryFieldFilterConstraint<T>
72
+ | QueryCompositeFilterConstraint<T>;
70
73
 
71
74
  /**
72
75
  * The Filter functions used to generate an instance of Filter.
73
76
  */
74
- export interface FilterFunction {
77
+ export interface FilterFunction<T extends DocumentData = DocumentData> {
75
78
  /**
76
79
  * The Filter function used to generate an instance of Filter.
77
80
  * e.g. Filter('name', '==', 'Ada')
@@ -80,28 +83,28 @@ export namespace FirebaseFirestoreTypes {
80
83
  fieldPath: keyof T | FieldPath,
81
84
  operator: WhereFilterOp,
82
85
  value: any,
83
- ): QueryFieldFilterConstraint;
86
+ ): QueryFieldFilterConstraint<T>;
84
87
  /**
85
88
  * The Filter.or() static function used to generate a logical OR query using multiple Filter instances.
86
89
  * e.g. Filter.or(Filter('name', '==', 'Ada'), Filter('name', '==', 'Bob'))
87
90
  */
88
- or(...queries: QueryFilterConstraint[]): QueryCompositeFilterConstraint;
91
+ or(...queries: QueryFilterConstraint<T>[]): QueryCompositeFilterConstraint<T>;
89
92
  /**
90
93
  * The Filter.and() static function used to generate a logical AND query using multiple Filter instances.
91
94
  * e.g. Filter.and(Filter('name', '==', 'Ada'), Filter('name', '==', 'Bob'))
92
95
  */
93
- and(...queries: QueryFilterConstraint[]): QueryCompositeFilterConstraint;
96
+ and(...queries: QueryFilterConstraint<T>[]): QueryCompositeFilterConstraint<T>;
94
97
  }
95
98
  /**
96
99
  * The Filter function used to generate an instance of Filter.
97
100
  * e.g. Filter('name', '==', 'Ada')
98
101
  */
99
- export const Filter: FilterFunction;
102
+ export declare const Filter: FilterFunction;
100
103
 
101
104
  /**
102
105
  * An immutable object representing an array of bytes.
103
106
  */
104
- export class Blob {
107
+ export declare class Blob {
105
108
  /**
106
109
  * Creates a new Blob from the given Base64 string, converting it to bytes.
107
110
  *
@@ -145,7 +148,10 @@ export namespace FirebaseFirestoreTypes {
145
148
  * A `CollectionReference` object can be used for adding documents, getting document references, and querying for
146
149
  * documents (using the methods inherited from `Query`).
147
150
  */
148
- export interface CollectionReference<T extends DocumentData = DocumentData> extends Query<T> {
151
+ export declare class CollectionReference<
152
+ AppModelType extends DocumentData = DocumentData,
153
+ DbModelType extends DocumentData = DocumentData,
154
+ > extends Query<AppModelType, DbModelType> {
149
155
  /**
150
156
  * The collection's identifier.
151
157
  */
@@ -155,7 +161,7 @@ export namespace FirebaseFirestoreTypes {
155
161
  * A reference to the containing `DocumentReference` if this is a subcollection. If this isn't a
156
162
  * subcollection, the reference is null.
157
163
  */
158
- parent: DocumentReference | null;
164
+ parent: DocumentReference<DocumentData, DocumentData> | null;
159
165
 
160
166
  /**
161
167
  * A string representing the path of the referenced collection (relative to the root of the database).
@@ -176,7 +182,7 @@ export namespace FirebaseFirestoreTypes {
176
182
  *
177
183
  * @param data An Object containing the data for the new document.
178
184
  */
179
- add(data: T): Promise<DocumentReference<T>>;
185
+ add(data: AppModelType): Promise<DocumentReference<AppModelType, DbModelType>>;
180
186
 
181
187
  /**
182
188
  * Get a DocumentReference for the document within the collection at the specified path. If no
@@ -193,18 +199,56 @@ export namespace FirebaseFirestoreTypes {
193
199
  *
194
200
  * @param documentPath A slash-separated path to a document.
195
201
  */
196
- doc(documentPath?: string): DocumentReference<T>;
202
+ doc(documentPath?: string): DocumentReference<AppModelType, DbModelType>;
203
+
204
+ /**
205
+ * Applies a custom data converter to this CollectionReference, allowing you
206
+ * to use your own custom model objects with Firestore. When you call add()
207
+ * on the returned CollectionReference instance, the provided converter will
208
+ * convert between Firestore data and your custom type U.
209
+ *
210
+ * Passing in `null` as the converter parameter removes the current
211
+ * converter.
212
+ *
213
+ * @param converter Converts objects to and from Firestore. Passing in
214
+ * `null` removes the current converter.
215
+ * @return A CollectionReference<U> that uses the provided converter.
216
+ */
217
+ withConverter(converter: null): CollectionReference<DocumentData, DocumentData>;
218
+
219
+ /**
220
+ * Applies a custom data converter to this CollectionReference, allowing you
221
+ * to use your own custom model objects with Firestore. When you call add()
222
+ * on the returned CollectionReference instance, the provided converter will
223
+ * convert between Firestore data and your custom type U.
224
+ *
225
+ * Passing in `null` as the converter parameter removes the current
226
+ * converter.
227
+ *
228
+ * @param converter Converts objects to and from Firestore. Passing in
229
+ * `null` removes the current converter.
230
+ * @return A CollectionReference<U> that uses the provided converter.
231
+ */
232
+ withConverter<
233
+ NewAppModelType extends DocumentData,
234
+ NewDbModelType extends DocumentData = DocumentData,
235
+ >(
236
+ converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>,
237
+ ): CollectionReference<NewAppModelType, NewDbModelType>;
197
238
  }
198
239
 
199
240
  /**
200
241
  * A DocumentChange represents a change to the documents matching a query. It contains the document affected and the
201
242
  * type of change that occurred.
202
243
  */
203
- export interface DocumentChange<T extends DocumentData = DocumentData> {
244
+ export interface DocumentChange<
245
+ AppModelType extends DocumentData = DocumentData,
246
+ DbModelType extends DocumentData = DocumentData,
247
+ > {
204
248
  /**
205
249
  * The document affected by this change.
206
250
  */
207
- doc: QueryDocumentSnapshot<T>;
251
+ doc: QueryDocumentSnapshot<AppModelType, DbModelType>;
208
252
 
209
253
  /**
210
254
  * The index of the changed document in the result set immediately after this `DocumentChange`
@@ -230,6 +274,13 @@ export namespace FirebaseFirestoreTypes {
230
274
  */
231
275
  export type DocumentChangeType = 'added' | 'removed' | 'modified';
232
276
 
277
+ /**
278
+ * An options object that configures how document snapshot data is returned (e.g. server timestamps).
279
+ */
280
+ export type SnapshotOptions = {
281
+ readonly serverTimestamps?: 'estimate' | 'previous' | 'none';
282
+ };
283
+
233
284
  /**
234
285
  * The types for a DocumentSnapshot field that are supported by Firestore.
235
286
  */
@@ -245,15 +296,18 @@ export namespace FirebaseFirestoreTypes {
245
296
  | Blob
246
297
  | FieldPath
247
298
  | FieldValue
248
- | DocumentReference
249
- | CollectionReference;
299
+ | DocumentReference<DocumentData, DocumentData>
300
+ | CollectionReference<DocumentData, DocumentData>;
250
301
 
251
302
  /**
252
303
  * A `DocumentReference` refers to a document location in a Firestore database and can be used to write, read, or listen
253
304
  * to the location. The document at the referenced location may or may not exist. A `DocumentReference` can also be used
254
305
  * to create a `CollectionReference` to a subcollection.
255
306
  */
256
- export interface DocumentReference<T extends DocumentData = DocumentData> {
307
+ export declare class DocumentReference<
308
+ AppModelType extends DocumentData = DocumentData,
309
+ DbModelType extends DocumentData = DocumentData,
310
+ > {
257
311
  /**
258
312
  * The Firestore instance the document is in. This is useful for performing transactions, for example.
259
313
  */
@@ -267,7 +321,7 @@ export namespace FirebaseFirestoreTypes {
267
321
  /**
268
322
  * The Collection this `DocumentReference` belongs to.
269
323
  */
270
- parent: CollectionReference<T>;
324
+ parent: CollectionReference<AppModelType, DbModelType>;
271
325
 
272
326
  /**
273
327
  * A string representing the path of the referenced document (relative to the root of the database).
@@ -285,7 +339,7 @@ export namespace FirebaseFirestoreTypes {
285
339
  *
286
340
  * @param collectionPath A slash-separated path to a collection.
287
341
  */
288
- collection(collectionPath: string): CollectionReference;
342
+ collection(collectionPath: string): CollectionReference<DocumentData, DocumentData>;
289
343
 
290
344
  /**
291
345
  * Deletes the document referred to by this DocumentReference.
@@ -318,7 +372,7 @@ export namespace FirebaseFirestoreTypes {
318
372
  *
319
373
  * @param options An object to configure the get behavior.
320
374
  */
321
- get(options?: GetOptions): Promise<DocumentSnapshot<T>>;
375
+ get(options?: GetOptions): Promise<DocumentSnapshot<AppModelType, DbModelType>>;
322
376
 
323
377
  /**
324
378
  * Returns true if this DocumentReference is equal to the provided one.
@@ -335,7 +389,7 @@ export namespace FirebaseFirestoreTypes {
335
389
  *
336
390
  * @param other The `DocumentReference` to compare against.
337
391
  */
338
- isEqual(other: DocumentReference): boolean;
392
+ isEqual(other: DocumentReference<AppModelType, DbModelType>): boolean;
339
393
 
340
394
  /**
341
395
  * Attaches a listener for DocumentSnapshot events.
@@ -361,7 +415,7 @@ export namespace FirebaseFirestoreTypes {
361
415
  onSnapshot(observer: {
362
416
  complete?: () => void;
363
417
  error?: (error: Error) => void;
364
- next?: (snapshot: DocumentSnapshot<T>) => void;
418
+ next?: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void;
365
419
  }): () => void;
366
420
 
367
421
  /**
@@ -393,7 +447,7 @@ export namespace FirebaseFirestoreTypes {
393
447
  observer: {
394
448
  complete?: () => void;
395
449
  error?: (error: Error) => void;
396
- next?: (snapshot: DocumentSnapshot<T>) => void;
450
+ next?: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void;
397
451
  },
398
452
  ): () => void;
399
453
 
@@ -420,7 +474,7 @@ export namespace FirebaseFirestoreTypes {
420
474
  * @param onCompletion An optional function which will never be called.
421
475
  */
422
476
  onSnapshot(
423
- onNext: (snapshot: DocumentSnapshot<T>) => void,
477
+ onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void,
424
478
  onError?: (error: Error) => void,
425
479
  onCompletion?: () => void,
426
480
  ): () => void;
@@ -451,7 +505,7 @@ export namespace FirebaseFirestoreTypes {
451
505
  */
452
506
  onSnapshot(
453
507
  options: SnapshotListenOptions,
454
- onNext: (snapshot: DocumentSnapshot<T>) => void,
508
+ onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void,
455
509
  onError?: (error: Error) => void,
456
510
  onCompletion?: () => void,
457
511
  ): () => void;
@@ -477,7 +531,7 @@ export namespace FirebaseFirestoreTypes {
477
531
  * @param data A map of the fields and values for the document.
478
532
  * @param options An object to configure the set behavior.
479
533
  */
480
- set(data: SetValue<T>, options?: SetOptions): Promise<void>;
534
+ set(data: SetValue<AppModelType>, options?: SetOptions): Promise<void>;
481
535
 
482
536
  /**
483
537
  * Updates fields in the document referred to by this `DocumentReference`. The update will fail
@@ -496,7 +550,7 @@ export namespace FirebaseFirestoreTypes {
496
550
  *
497
551
  * @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.
498
552
  */
499
- update(data: Partial<SetValue<T>>): Promise<void>;
553
+ update(data: Partial<SetValue<DbModelType>>): Promise<void>;
500
554
 
501
555
  /**
502
556
  * Updates fields in the document referred to by this DocumentReference. The update will fail if
@@ -515,7 +569,36 @@ export namespace FirebaseFirestoreTypes {
515
569
  * @param value The first value.
516
570
  * @param moreFieldsAndValues Additional key value pairs.
517
571
  */
518
- update(field: keyof T | FieldPath, value: any, ...moreFieldsAndValues: any[]): Promise<void>;
572
+ update(
573
+ field: keyof DbModelType | FieldPath,
574
+ value: any,
575
+ ...moreFieldsAndValues: any[]
576
+ ): Promise<void>;
577
+
578
+ /**
579
+ * Removes the current converter.
580
+ *
581
+ * @param converter Passing in `null` removes the current converter.
582
+ * @return A DocumentReference<U> that uses the provided converter.
583
+ */
584
+ withConverter(converter: null): DocumentReference<DocumentData, DocumentData>;
585
+
586
+ /**
587
+ * Applies a custom data converter to this `DocumentReference`, allowing you
588
+ * to use your own custom model objects with Firestore. When you call setDoc
589
+ * getDoc, etc. with the returned `DocumentReference`
590
+ * instance, the provided converter will convert between Firestore data of
591
+ * type `NewDbModelType` and your custom type `NewAppModelType`.
592
+ *
593
+ * @param converter - Converts objects to and from Firestore.
594
+ * @returns A `DocumentReference` that uses the provided converter.
595
+ */
596
+ withConverter<
597
+ NewAppModelType extends DocumentData,
598
+ NewDbModelType extends DocumentData = DocumentData,
599
+ >(
600
+ converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>,
601
+ ): DocumentReference<NewAppModelType, NewDbModelType>;
519
602
  }
520
603
 
521
604
  /**
@@ -525,7 +608,10 @@ export namespace FirebaseFirestoreTypes {
525
608
  * For a DocumentSnapshot that points to a non-existing document, any data access will return 'undefined'.
526
609
  * You can use the `exists()` method to explicitly verify a document's existence.
527
610
  */
528
- export interface DocumentSnapshot<T extends DocumentData = DocumentData> {
611
+ export interface DocumentSnapshot<
612
+ AppModelType extends DocumentData = DocumentData,
613
+ DbModelType extends DocumentData = DocumentData,
614
+ > {
529
615
  /**
530
616
  * Method of the `DocumentSnapshot` that signals whether or not the data exists. True if the document exists.
531
617
  */
@@ -544,7 +630,7 @@ export namespace FirebaseFirestoreTypes {
544
630
  /**
545
631
  * The `DocumentReference` for the document included in the `DocumentSnapshot`.
546
632
  */
547
- ref: DocumentReference<T>;
633
+ ref: DocumentReference<AppModelType, DbModelType>;
548
634
 
549
635
  /**
550
636
  * Retrieves all fields in the document as an Object. Returns 'undefined' if the document doesn't exist.
@@ -557,7 +643,7 @@ export namespace FirebaseFirestoreTypes {
557
643
  * console.log('User', user.data());
558
644
  * ```
559
645
  */
560
- data(): T | undefined;
646
+ data(): AppModelType | undefined;
561
647
 
562
648
  /**
563
649
  * Retrieves the field specified by fieldPath. Returns undefined if the document or field doesn't exist.
@@ -572,7 +658,9 @@ export namespace FirebaseFirestoreTypes {
572
658
  *
573
659
  * @param fieldPath The path (e.g. 'foo' or 'foo.bar') to a specific field.
574
660
  */
575
- get<fieldType extends DocumentFieldType>(fieldPath: keyof T | string | FieldPath): fieldType;
661
+ get<fieldType extends DocumentFieldType>(
662
+ fieldPath: keyof AppModelType | string | FieldPath,
663
+ ): fieldType;
576
664
 
577
665
  /**
578
666
  * Returns true if this `DocumentSnapshot` is equal to the provided one.
@@ -589,7 +677,7 @@ export namespace FirebaseFirestoreTypes {
589
677
  *
590
678
  * @param other The `DocumentSnapshot` to compare against.
591
679
  */
592
- isEqual(other: DocumentSnapshot): boolean;
680
+ isEqual(other: DocumentSnapshot<AppModelType, DbModelType>): boolean;
593
681
  }
594
682
 
595
683
  /**
@@ -600,8 +688,9 @@ export namespace FirebaseFirestoreTypes {
600
688
  * Since query results contain only existing documents, the exists() method will always be true and data() will never return 'undefined'.
601
689
  */
602
690
  export interface QueryDocumentSnapshot<
603
- T extends DocumentData = DocumentData,
604
- > extends DocumentSnapshot<T> {
691
+ AppModelType extends DocumentData = DocumentData,
692
+ DbModelType extends DocumentData = DocumentData,
693
+ > extends DocumentSnapshot<AppModelType, DbModelType> {
605
694
  /**
606
695
  * A QueryDocumentSnapshot is always guaranteed to exist.
607
696
  */
@@ -620,7 +709,7 @@ export namespace FirebaseFirestoreTypes {
620
709
  * }
621
710
  * ```
622
711
  */
623
- data(): T;
712
+ data(): AppModelType;
624
713
  }
625
714
 
626
715
  /**
@@ -640,7 +729,7 @@ export namespace FirebaseFirestoreTypes {
640
729
  * console.log('Address ZIP Code', user.get(fieldPath));
641
730
  * ```
642
731
  */
643
- export class FieldPath {
732
+ export declare class FieldPath {
644
733
  /**
645
734
  * 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.
646
735
  */
@@ -690,7 +779,7 @@ export namespace FirebaseFirestoreTypes {
690
779
  * });
691
780
  * ```
692
781
  */
693
- export class FieldValue {
782
+ export declare class FieldValue {
694
783
  /**
695
784
  * Returns a special value that can be used with `set()` or `update()` that tells the server to remove the given elements
696
785
  * from any array value that already exists on the server. All instances of each element specified will be removed from
@@ -816,7 +905,7 @@ export namespace FirebaseFirestoreTypes {
816
905
  *
817
906
  * Latitude values are in the range of [-90, 90]. Longitude values are in the range of [-180, 180].
818
907
  */
819
- export class GeoPoint {
908
+ export declare class GeoPoint {
820
909
  /**
821
910
  * Creates a new immutable GeoPoint object with the provided latitude and longitude values.
822
911
  *
@@ -892,8 +981,7 @@ export namespace FirebaseFirestoreTypes {
892
981
  /**
893
982
  * Represents an aggregation that can be performed by Firestore.
894
983
  */
895
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
896
- export class AggregateField<T> {
984
+ export class AggregateField<_T> {
897
985
  /** A type string to uniquely identify instances of this class. */
898
986
  type = 'AggregateField';
899
987
  }
@@ -924,7 +1012,7 @@ export namespace FirebaseFirestoreTypes {
924
1012
  */
925
1013
  export interface AggregateQuerySnapshot<
926
1014
  AggregateSpecType extends AggregateSpec,
927
- AppModelType = DocumentData,
1015
+ AppModelType extends DocumentData = DocumentData,
928
1016
  DbModelType extends DocumentData = DocumentData,
929
1017
  > {
930
1018
  /**
@@ -954,7 +1042,7 @@ export namespace FirebaseFirestoreTypes {
954
1042
  /**
955
1043
  * The underlying query for this instance.
956
1044
  */
957
- get query(): Query<unknown>;
1045
+ get query(): Query<DocumentData, DocumentData>;
958
1046
 
959
1047
  /**
960
1048
  * Executes the query and returns the results as a AggregateQuerySnapshot.
@@ -978,7 +1066,10 @@ export namespace FirebaseFirestoreTypes {
978
1066
  * A Query refers to a `Query` which you can read or listen to. You can also construct refined `Query` objects by
979
1067
  * adding filters and ordering.
980
1068
  */
981
- export interface Query<T extends DocumentData = DocumentData> {
1069
+ export declare class Query<
1070
+ AppModelType extends DocumentData = DocumentData,
1071
+ DbModelType extends DocumentData = DocumentData,
1072
+ > {
982
1073
  /**
983
1074
  * Calculates the number of documents in the result set of the given query, without actually downloading
984
1075
  * the documents.
@@ -1020,7 +1111,7 @@ export namespace FirebaseFirestoreTypes {
1020
1111
  *
1021
1112
  * @param snapshot The snapshot of the document to end at.
1022
1113
  */
1023
- endAt(snapshot: DocumentSnapshot<T>): Query<T>;
1114
+ endAt(snapshot: DocumentSnapshot<AppModelType, DbModelType>): Query<AppModelType, DbModelType>;
1024
1115
 
1025
1116
  /**
1026
1117
  * Creates and returns a new Query that ends at the provided fields relative to the order of the query.
@@ -1038,7 +1129,7 @@ export namespace FirebaseFirestoreTypes {
1038
1129
  *
1039
1130
  * @param fieldValues The field values to end this query at, in order of the query's order by.
1040
1131
  */
1041
- endAt(...fieldValues: any[]): Query<T>;
1132
+ endAt(...fieldValues: any[]): Query<AppModelType, DbModelType>;
1042
1133
 
1043
1134
  /**
1044
1135
  * Creates and returns a new Query that ends before the provided document (exclusive). The end
@@ -1061,7 +1152,9 @@ export namespace FirebaseFirestoreTypes {
1061
1152
  *
1062
1153
  * @param snapshot The snapshot of the document to end before.
1063
1154
  */
1064
- endBefore(snapshot: DocumentSnapshot<T>): Query<T>;
1155
+ endBefore(
1156
+ snapshot: DocumentSnapshot<AppModelType, DbModelType>,
1157
+ ): Query<AppModelType, DbModelType>;
1065
1158
 
1066
1159
  /**
1067
1160
  * Creates and returns a new Query that ends before the provided fields relative to the order of
@@ -1079,7 +1172,7 @@ export namespace FirebaseFirestoreTypes {
1079
1172
  *
1080
1173
  * @param fieldValues The field values to end this query before, in order of the query's order by.
1081
1174
  */
1082
- endBefore(...fieldValues: any[]): Query<T>;
1175
+ endBefore(...fieldValues: any[]): Query<AppModelType, DbModelType>;
1083
1176
 
1084
1177
  /**
1085
1178
  * Executes the query and returns the results as a QuerySnapshot.
@@ -1101,7 +1194,7 @@ export namespace FirebaseFirestoreTypes {
1101
1194
  *
1102
1195
  * @param options An object to configure the get behavior.
1103
1196
  */
1104
- get(options?: GetOptions): Promise<QuerySnapshot<T>>;
1197
+ get(options?: GetOptions): Promise<QuerySnapshot<AppModelType, DbModelType>>;
1105
1198
 
1106
1199
  /**
1107
1200
  * Returns true if this Query is equal to the provided one.
@@ -1141,7 +1234,7 @@ export namespace FirebaseFirestoreTypes {
1141
1234
  *
1142
1235
  * @param limit The maximum number of items to return.
1143
1236
  */
1144
- limit(limit: number): Query<T>;
1237
+ limit(limit: number): Query<AppModelType, DbModelType>;
1145
1238
 
1146
1239
  /**
1147
1240
  * Creates and returns a new Query where the results are limited to the specified number of documents
@@ -1161,7 +1254,7 @@ export namespace FirebaseFirestoreTypes {
1161
1254
  *
1162
1255
  * @param limitToLast The maximum number of items to return.
1163
1256
  */
1164
- limitToLast(limitToLast: number): Query<T>;
1257
+ limitToLast(limitToLast: number): Query<AppModelType, DbModelType>;
1165
1258
 
1166
1259
  /**
1167
1260
  * Attaches a listener for `QuerySnapshot` events.
@@ -1187,7 +1280,7 @@ export namespace FirebaseFirestoreTypes {
1187
1280
  onSnapshot(observer: {
1188
1281
  complete?: () => void;
1189
1282
  error?: (error: Error) => void;
1190
- next?: (snapshot: QuerySnapshot<T>) => void;
1283
+ next?: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
1191
1284
  }): () => void;
1192
1285
 
1193
1286
  /**
@@ -1219,7 +1312,7 @@ export namespace FirebaseFirestoreTypes {
1219
1312
  observer: {
1220
1313
  complete?: () => void;
1221
1314
  error?: (error: Error) => void;
1222
- next?: (snapshot: QuerySnapshot<T>) => void;
1315
+ next?: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
1223
1316
  },
1224
1317
  ): () => void;
1225
1318
 
@@ -1246,7 +1339,7 @@ export namespace FirebaseFirestoreTypes {
1246
1339
  * @param onCompletion An optional function which will never be called.
1247
1340
  */
1248
1341
  onSnapshot(
1249
- onNext: (snapshot: QuerySnapshot<T>) => void,
1342
+ onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void,
1250
1343
  onError?: (error: Error) => void,
1251
1344
  onCompletion?: () => void,
1252
1345
  ): () => void;
@@ -1277,7 +1370,7 @@ export namespace FirebaseFirestoreTypes {
1277
1370
  */
1278
1371
  onSnapshot(
1279
1372
  options: SnapshotListenOptions,
1280
- onNext: (snapshot: QuerySnapshot<T>) => void,
1373
+ onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void,
1281
1374
  onError?: (error: Error) => void,
1282
1375
  onCompletion?: () => void,
1283
1376
  ): () => void;
@@ -1300,7 +1393,10 @@ export namespace FirebaseFirestoreTypes {
1300
1393
  * @param fieldPath The field to sort by. Either a string or FieldPath instance.
1301
1394
  * @param directionStr Optional direction to sort by (`asc` or `desc`). If not specified, order will be ascending.
1302
1395
  */
1303
- orderBy(fieldPath: keyof T | string | FieldPath, directionStr?: 'asc' | 'desc'): Query<T>;
1396
+ orderBy(
1397
+ fieldPath: string | FieldPath,
1398
+ directionStr?: 'asc' | 'desc',
1399
+ ): Query<AppModelType, DbModelType>;
1304
1400
 
1305
1401
  /**
1306
1402
  * Creates and returns a new Query that starts after the provided document (exclusive). The start
@@ -1324,7 +1420,9 @@ export namespace FirebaseFirestoreTypes {
1324
1420
  *
1325
1421
  * @param snapshot The snapshot of the document to start after.
1326
1422
  */
1327
- startAfter(snapshot: DocumentSnapshot<T>): Query<T>;
1423
+ startAfter(
1424
+ snapshot: DocumentSnapshot<AppModelType, DbModelType>,
1425
+ ): Query<AppModelType, DbModelType>;
1328
1426
 
1329
1427
  /**
1330
1428
  * Creates and returns a new Query that starts after the provided fields relative to the order of
@@ -1343,7 +1441,7 @@ export namespace FirebaseFirestoreTypes {
1343
1441
  *
1344
1442
  * @param fieldValues The field values to start this query after, in order of the query's order by.
1345
1443
  */
1346
- startAfter(...fieldValues: any[]): Query<T>;
1444
+ startAfter(...fieldValues: any[]): Query<AppModelType, DbModelType>;
1347
1445
 
1348
1446
  /**
1349
1447
  * Creates and returns a new Query that starts at the provided document (inclusive). The start
@@ -1367,7 +1465,9 @@ export namespace FirebaseFirestoreTypes {
1367
1465
  *
1368
1466
  * @param snapshot The snapshot of the document to start at.
1369
1467
  */
1370
- startAt(snapshot: DocumentSnapshot<T>): Query<T>;
1468
+ startAt(
1469
+ snapshot: DocumentSnapshot<AppModelType, DbModelType>,
1470
+ ): Query<AppModelType, DbModelType>;
1371
1471
 
1372
1472
  /**
1373
1473
  * Creates and returns a new Query that starts at the provided fields relative to the order of the query.
@@ -1386,7 +1486,7 @@ export namespace FirebaseFirestoreTypes {
1386
1486
  *
1387
1487
  * @param fieldValues The field values to start this query at, in order of the query's order by.
1388
1488
  */
1389
- startAt(...fieldValues: any[]): Query<T>;
1489
+ startAt(...fieldValues: any[]): Query<AppModelType, DbModelType>;
1390
1490
 
1391
1491
  /**
1392
1492
  * Creates and returns a new Query with the additional filter that documents must contain the specified field and
@@ -1406,7 +1506,11 @@ export namespace FirebaseFirestoreTypes {
1406
1506
  * @param opStr The operation string (e.g "<", "<=", "==", ">", ">=", "!=", "array-contains", "array-contains-any", "in", "not-in").
1407
1507
  * @param value The comparison value.
1408
1508
  */
1409
- where(fieldPath: keyof T | FieldPath, opStr: WhereFilterOp, value: any): Query<T>;
1509
+ where(
1510
+ fieldPath: string | FieldPath,
1511
+ opStr: WhereFilterOp,
1512
+ value: any,
1513
+ ): Query<AppModelType, DbModelType>;
1410
1514
 
1411
1515
  /**
1412
1516
  * Creates and returns a new Query with the additional filter that documents must contain the specified field and
@@ -1424,7 +1528,35 @@ export namespace FirebaseFirestoreTypes {
1424
1528
  *
1425
1529
  * @param filter The filter to apply to the query.
1426
1530
  */
1427
- where(filter: QueryFilterConstraint): Query<T>;
1531
+ where(filter: QueryFilterConstraint): Query<AppModelType, DbModelType>;
1532
+
1533
+ /**
1534
+ * Removes the current converter.
1535
+ *
1536
+ * @param converter `null` removes the current converter.
1537
+ * @return A Query that uses the provided converter.
1538
+ */
1539
+ withConverter(converter: null): Query<DocumentData, DocumentData>;
1540
+
1541
+ /**
1542
+ * Applies a custom data converter to this Query, allowing you to use your
1543
+ * own custom model objects with Firestore. When you call get() on the
1544
+ * returned Query, the provided converter will convert between Firestore
1545
+ * data and your custom type U.
1546
+ *
1547
+ * Passing in `null` as the converter parameter removes the current
1548
+ * converter.
1549
+ *
1550
+ * @param converter Converts objects to and from Firestore. Passing in
1551
+ * `null` removes the current converter.
1552
+ * @return A Query<U> that uses the provided converter.
1553
+ */
1554
+ withConverter<
1555
+ NewAppModelType extends DocumentData,
1556
+ NewDbModelType extends DocumentData = DocumentData,
1557
+ >(
1558
+ converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>,
1559
+ ): Query<NewAppModelType, NewDbModelType>;
1428
1560
  }
1429
1561
 
1430
1562
  /**
@@ -1447,11 +1579,14 @@ export namespace FirebaseFirestoreTypes {
1447
1579
  * can be accessed as an array via the `docs` property or enumerated using the `forEach` method. The number of documents
1448
1580
  * can be determined via the `empty` and `size` properties.
1449
1581
  */
1450
- export interface QuerySnapshot<T extends DocumentData = DocumentData> {
1582
+ export interface QuerySnapshot<
1583
+ AppModelType extends DocumentData = DocumentData,
1584
+ DbModelType extends DocumentData = DocumentData,
1585
+ > {
1451
1586
  /**
1452
1587
  * An array of all the documents in the `QuerySnapshot`.
1453
1588
  */
1454
- docs: QueryDocumentSnapshot<T>[];
1589
+ docs: Array<QueryDocumentSnapshot<AppModelType, DbModelType>>;
1455
1590
 
1456
1591
  /**
1457
1592
  * True if there are no documents in the `QuerySnapshot`.
@@ -1466,7 +1601,7 @@ export namespace FirebaseFirestoreTypes {
1466
1601
  /**
1467
1602
  * The query on which you called get or `onSnapshot` in order to `get` this `QuerySnapshot`.
1468
1603
  */
1469
- query: Query<T>;
1604
+ query: Query<AppModelType, DbModelType>;
1470
1605
 
1471
1606
  /**
1472
1607
  * The number of documents in the `QuerySnapshot`.
@@ -1501,7 +1636,7 @@ export namespace FirebaseFirestoreTypes {
1501
1636
  *
1502
1637
  * @param options `SnapshotListenOptions` that control whether metadata-only changes (i.e. only `DocumentSnapshot.metadata` changed) should trigger snapshot events.
1503
1638
  */
1504
- docChanges(options?: SnapshotListenOptions): DocumentChange<T>[];
1639
+ docChanges(options?: SnapshotListenOptions): Array<DocumentChange<AppModelType, DbModelType>>;
1505
1640
 
1506
1641
  /**
1507
1642
  * Enumerates all of the documents in the `QuerySnapshot`.
@@ -1519,10 +1654,9 @@ export namespace FirebaseFirestoreTypes {
1519
1654
  * @param callback A callback to be called with a `QueryDocumentSnapshot` for each document in the snapshot.
1520
1655
  * @param thisArg The `this` binding for the callback.
1521
1656
  */
1522
-
1523
1657
  forEach(
1524
- callback: (result: QueryDocumentSnapshot<T>, index: number) => void,
1525
- thisArg?: any,
1658
+ callback: (result: QueryDocumentSnapshot<AppModelType, DbModelType>) => void,
1659
+ thisArg?: unknown,
1526
1660
  ): void;
1527
1661
 
1528
1662
  /**
@@ -1667,7 +1801,7 @@ export namespace FirebaseFirestoreTypes {
1667
1801
  * It is encoded assuming all minutes are 60 seconds long, i.e. leap seconds are "smeared" so that no leap second table
1668
1802
  * is needed for interpretation. Range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
1669
1803
  */
1670
- export class Timestamp {
1804
+ export declare class Timestamp {
1671
1805
  /**
1672
1806
  * Creates a new timestamp from the given JavaScript [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date).
1673
1807
  *
@@ -2130,6 +2264,74 @@ export namespace FirebaseFirestoreTypes {
2130
2264
  SDK_VERSION: string;
2131
2265
  }
2132
2266
 
2267
+ /**
2268
+ * Converter used by `withConverter()` to transform user objects of type T
2269
+ * into Firestore data.
2270
+ *
2271
+ * Using the converter allows you to specify generic type arguments when
2272
+ * storing and retrieving objects from Firestore.
2273
+ *
2274
+ * @example
2275
+ * ```typescript
2276
+ * class Post {
2277
+ * constructor(readonly title: string, readonly author: string) {}
2278
+ *
2279
+ * toString(): string {
2280
+ * return this.title + ', by ' + this.author;
2281
+ * }
2282
+ * }
2283
+ *
2284
+ * const postConverter = {
2285
+ * toFirestore(post: Post): firebase.firestore.DocumentData {
2286
+ * return {title: post.title, author: post.author};
2287
+ * },
2288
+ * fromFirestore(
2289
+ * snapshot: firebase.firestore.QueryDocumentSnapshot,
2290
+ * options: firebase.firestore.SnapshotOptions
2291
+ * ): Post {
2292
+ * const data = snapshot.data(options)!;
2293
+ * return new Post(data.title, data.author);
2294
+ * }
2295
+ * };
2296
+ *
2297
+ * const postSnap = await firebase.firestore()
2298
+ * .collection('posts')
2299
+ * .withConverter(postConverter)
2300
+ * .doc().get();
2301
+ * const post = postSnap.data();
2302
+ * if (post !== undefined) {
2303
+ * post.title; // string
2304
+ * post.toString(); // Should be defined
2305
+ * post.someNonExistentProperty; // TS error
2306
+ * }
2307
+ * ```
2308
+ */
2309
+ export interface FirestoreDataConverter<
2310
+ AppModelType,
2311
+ DbModelType extends DocumentData = DocumentData,
2312
+ > {
2313
+ /**
2314
+ * Called by the Firestore SDK to convert a custom model object of type T
2315
+ * into a plain JavaScript object (suitable for writing directly to the
2316
+ * Firestore database). To use `set()` with `merge` and `mergeFields`,
2317
+ * `toFirestore()` must be defined with `Partial<T>`.
2318
+ */
2319
+ toFirestore(modelObject: AppModelType): DocumentData;
2320
+ toFirestore(modelObject: Partial<AppModelType>, options: SetOptions): DocumentData;
2321
+
2322
+ /**
2323
+ * Called by the Firestore SDK to convert Firestore data into an object of
2324
+ * type T. You can access your data by calling: `snapshot.data(options)`.
2325
+ *
2326
+ * @param snapshot A QueryDocumentSnapshot containing your data and metadata.
2327
+ * @param options The SnapshotOptions from the initial call to `data()`.
2328
+ */
2329
+ fromFirestore(
2330
+ snapshot: QueryDocumentSnapshot<DocumentData, DbModelType>,
2331
+ options: SnapshotOptions,
2332
+ ): AppModelType;
2333
+ }
2334
+
2133
2335
  /**
2134
2336
  * The Firebase Cloud Firestore service is available for the default app or a given app.
2135
2337
  *
@@ -2147,7 +2349,7 @@ export namespace FirebaseFirestoreTypes {
2147
2349
  * ```
2148
2350
  *
2149
2351
  */
2150
- export class Module extends FirebaseModule {
2352
+ export declare class Module implements _FirebaseModule {
2151
2353
  /**
2152
2354
  * The current `FirebaseApp` instance for this Firebase service.
2153
2355
  */
@@ -2223,7 +2425,7 @@ export namespace FirebaseFirestoreTypes {
2223
2425
  *
2224
2426
  * @param documentPath A slash-separated path to a document.
2225
2427
  */
2226
- doc<T extends DocumentData = DocumentData>(documentPath: string): DocumentReference<T>;
2428
+ doc<T extends DocumentData = DocumentData>(documentPath: string): DocumentReference<T, T>;
2227
2429
 
2228
2430
  /**
2229
2431
  * Re-enables use of the network for this Firestore instance after a prior call to `disableNetwork()`.
@@ -2391,16 +2593,14 @@ type FirestoreNamespace = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<
2391
2593
 
2392
2594
  declare const defaultExport: FirestoreNamespace;
2393
2595
 
2394
- export const firebase: ReactNativeFirebase.Module & {
2596
+ export declare const firebase: ReactNativeFirebase.Module & {
2395
2597
  firestore: typeof defaultExport;
2396
2598
  app(
2397
2599
  name?: string,
2398
2600
  ): ReactNativeFirebase.FirebaseApp & { firestore(): FirebaseFirestoreTypes.Module };
2399
2601
  };
2400
2602
 
2401
- export * from './modular';
2402
-
2403
- export const Filter: FirebaseFirestoreTypes.FilterFunction;
2603
+ export declare const Filter: FirebaseFirestoreTypes.FilterFunction;
2404
2604
 
2405
2605
  export default defaultExport;
2406
2606
 
@@ -2408,6 +2608,7 @@ export default defaultExport;
2408
2608
  * Attach namespace to `firebase.` and `FirebaseApp.`.
2409
2609
  */
2410
2610
  declare module '@react-native-firebase/app' {
2611
+ // eslint-disable-next-line @typescript-eslint/no-namespace -- module augmentation uses namespace
2411
2612
  namespace ReactNativeFirebase {
2412
2613
  import FirebaseModuleWithStaticsAndApp = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp;
2413
2614
  interface Module {