@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
@@ -0,0 +1,747 @@
1
+ /*
2
+ * Copyright (c) 2016-present Invertase Limited & Contributors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ */
17
+
18
+ import type {
19
+ CollectionReference,
20
+ DocumentData,
21
+ DocumentReference,
22
+ DocumentSnapshot,
23
+ Firestore,
24
+ FirestoreSettings,
25
+ LoadBundleTask,
26
+ LoadBundleTaskProgress,
27
+ LogLevel,
28
+ Primitive,
29
+ Query,
30
+ QuerySnapshot,
31
+ SetOptions,
32
+ SnapshotOptions,
33
+ Transaction,
34
+ Unsubscribe,
35
+ WriteBatch,
36
+ WithFieldValue,
37
+ AggregateType,
38
+ PartialWithFieldValue,
39
+ } from './firestore';
40
+ import type { PersistentCacheIndexManager } from '../FirestorePersistentCacheIndexManager';
41
+ import type { QueryConstraint } from '../modular/query';
42
+ import type { _Filter } from '../FirestoreFilter';
43
+ import type FirestoreTimestamp from '../FirestoreTimestamp';
44
+ import Blob from 'lib/FirestoreBlob';
45
+
46
+ /** Optional final argument passed by modular API wrappers (MODULAR_DEPRECATION_ARG). */
47
+ export type FirestoreModularDeprecationArg = string;
48
+
49
+ /** Query type passed to native ('collection' or 'collectionGroup'). */
50
+ export type FirestoreQueryTypeInternal = 'collection' | 'collectionGroup';
51
+
52
+ /** App instance with firestore() method (e.g. from getApp() when used for getFirestore()). */
53
+ export interface AppWithFirestoreInternal {
54
+ firestore(databaseId?: string): Firestore;
55
+ }
56
+
57
+ /** Single filter spec passed to native (fieldPath serialized as string[] from QueryModifiers). */
58
+ export interface FirestoreFilterSpecInternal {
59
+ fieldPath?: string[] | unknown;
60
+ operator: string;
61
+ value?: unknown;
62
+ /** Nested queries for composite filters (AND/OR). */
63
+ queries?: FirestoreFilterSpecInternal[];
64
+ }
65
+
66
+ /** Order spec passed to native (fieldPath serialized as string[] from QueryModifiers). */
67
+ export interface FirestoreOrderSpecInternal {
68
+ fieldPath: string[] | unknown;
69
+ direction: string;
70
+ }
71
+
72
+ /** Query options passed to native (limit, limitToLast, startAt, etc.). */
73
+ export interface FirestoreQueryOptionsInternal {
74
+ limit?: number;
75
+ limitToLast?: number;
76
+ startAt?: unknown[];
77
+ startAfter?: unknown[];
78
+ endAt?: unknown[];
79
+ endBefore?: unknown[];
80
+ }
81
+
82
+ /** Cursor field values (startAt, startAfter, endAt, endBefore) – serialized array passed to native. */
83
+ export type FirestoreCursorFieldsInternal = unknown[];
84
+
85
+ /** Single aggregate query spec passed to native (aggregateQuery). */
86
+ export interface FirestoreAggregateQuerySpecInternal {
87
+ aggregateType: AggregateType;
88
+ field: string | null;
89
+ key: string;
90
+ }
91
+
92
+ /** Aggregate query result from native (passed to AggregateQuerySnapshot constructor). */
93
+ export interface FirestoreAggregateQueryResultInternal {
94
+ count?: number;
95
+ [key: string]: unknown;
96
+ }
97
+
98
+ /** Serialized expression node passed to native pipeline execute bridge. */
99
+ export interface FirestorePipelineFieldExpressionInternal {
100
+ __kind?: 'expression';
101
+ exprType: 'Field';
102
+ path: string;
103
+ }
104
+
105
+ /** Serialized constant expression node passed to native pipeline execute bridge. */
106
+ export interface FirestorePipelineConstantExpressionInternal {
107
+ __kind?: 'expression';
108
+ exprType: 'Constant';
109
+ value: FirestorePipelineSerializedValueInternal;
110
+ }
111
+
112
+ /** Serialized function expression node passed to native pipeline execute bridge. */
113
+ export interface FirestorePipelineFunctionExpressionInternal {
114
+ __kind?: 'expression';
115
+ exprType?: 'Function';
116
+ name: string;
117
+ args?: FirestorePipelineSerializedValueInternal[];
118
+ }
119
+
120
+ /** Serialized aggregate function node passed to native pipeline execute bridge. */
121
+ export interface FirestorePipelineAggregateFunctionInternal {
122
+ __kind?: 'aggregate';
123
+ exprType?: 'AggregateFunction';
124
+ kind: string;
125
+ args?: FirestorePipelineSerializedValueInternal[];
126
+ }
127
+
128
+ /** Serialized ordering node passed to native pipeline execute bridge. */
129
+ export interface FirestorePipelineOrderingInternal {
130
+ __kind?: 'ordering';
131
+ expr: FirestorePipelineExpressionInternal;
132
+ direction: 'ascending' | 'descending';
133
+ }
134
+
135
+ /** Flat aliased field shape used to avoid nested field parsing on native platforms. */
136
+ export interface FirestorePipelineFlatAliasedFieldInternal {
137
+ path: string;
138
+ alias: string;
139
+ as: string;
140
+ }
141
+
142
+ /** Serialized aliased expression node passed to native pipeline execute bridge. */
143
+ export interface FirestorePipelineAliasedExpressionInternal {
144
+ __kind?: 'aliasedExpression';
145
+ exprType?: 'AliasedExpression';
146
+ selectable?: true;
147
+ expr: FirestorePipelineExpressionInternal;
148
+ alias: string;
149
+ as: string;
150
+ }
151
+
152
+ /** Serialized aliased aggregate node passed to native pipeline execute bridge. */
153
+ export interface FirestorePipelineAliasedAggregateInternal {
154
+ __kind?: 'aliasedAggregate';
155
+ aggregate: FirestorePipelineAggregateFunctionInternal;
156
+ alias: string;
157
+ }
158
+
159
+ export type FirestorePipelineExpressionInternal =
160
+ | FirestorePipelineFieldExpressionInternal
161
+ | FirestorePipelineConstantExpressionInternal
162
+ | FirestorePipelineFunctionExpressionInternal;
163
+
164
+ export type FirestorePipelineSelectableInternal =
165
+ | FirestorePipelineExpressionInternal
166
+ | FirestorePipelineFlatAliasedFieldInternal
167
+ | FirestorePipelineAliasedExpressionInternal;
168
+
169
+ export type FirestorePipelineSerializedRecordInternal = {
170
+ [key: string]: FirestorePipelineSerializedValueInternal;
171
+ };
172
+
173
+ export type FirestorePipelineSerializedValueInternal =
174
+ | null
175
+ | boolean
176
+ | number
177
+ | string
178
+ | FirestorePipelineExpressionInternal
179
+ | FirestorePipelineAggregateFunctionInternal
180
+ | FirestorePipelineOrderingInternal
181
+ | FirestorePipelineFlatAliasedFieldInternal
182
+ | FirestorePipelineAliasedExpressionInternal
183
+ | FirestorePipelineAliasedAggregateInternal
184
+ | FirestorePipelineSerializedInternal
185
+ | FirestorePipelineSerializedValueInternal[]
186
+ | FirestorePipelineSerializedRecordInternal;
187
+
188
+ /** Serialized pipeline source passed to native execute bridge. */
189
+ export type FirestorePipelineSourceInternal =
190
+ | {
191
+ source: 'collection';
192
+ path: string;
193
+ rawOptions?: Record<string, unknown>;
194
+ }
195
+ | {
196
+ source: 'collectionGroup';
197
+ collectionId: string;
198
+ rawOptions?: Record<string, unknown>;
199
+ }
200
+ | {
201
+ source: 'database';
202
+ rawOptions?: Record<string, unknown>;
203
+ }
204
+ | {
205
+ source: 'documents';
206
+ documents: string[];
207
+ rawOptions?: Record<string, unknown>;
208
+ }
209
+ | {
210
+ source: 'query';
211
+ path: string;
212
+ queryType: FirestoreQueryTypeInternal;
213
+ filters: FirestoreFilterSpecInternal[];
214
+ orders: FirestoreOrderSpecInternal[];
215
+ options: FirestoreQueryOptionsInternal;
216
+ };
217
+
218
+ export type FirestorePipelineStageInternal =
219
+ | {
220
+ stage: 'where';
221
+ options: {
222
+ condition: FirestorePipelineExpressionInternal;
223
+ };
224
+ }
225
+ | {
226
+ stage: 'select';
227
+ options: {
228
+ selections: Array<string | FirestorePipelineSelectableInternal>;
229
+ };
230
+ }
231
+ | {
232
+ stage: 'addFields';
233
+ options: {
234
+ fields: FirestorePipelineSelectableInternal[];
235
+ };
236
+ }
237
+ | {
238
+ stage: 'removeFields';
239
+ options: {
240
+ fields: Array<string | FirestorePipelineFieldExpressionInternal>;
241
+ };
242
+ }
243
+ | {
244
+ stage: 'sort';
245
+ options: {
246
+ orderings: FirestorePipelineOrderingInternal[];
247
+ };
248
+ }
249
+ | {
250
+ stage: 'limit';
251
+ options: {
252
+ limit: number;
253
+ };
254
+ }
255
+ | {
256
+ stage: 'offset';
257
+ options: {
258
+ offset: number;
259
+ };
260
+ }
261
+ | {
262
+ stage: 'aggregate';
263
+ options: {
264
+ accumulators: FirestorePipelineAliasedAggregateInternal[];
265
+ groups?: Array<string | FirestorePipelineSelectableInternal>;
266
+ };
267
+ }
268
+ | {
269
+ stage: 'distinct';
270
+ options: {
271
+ groups: Array<string | FirestorePipelineSelectableInternal>;
272
+ };
273
+ }
274
+ | {
275
+ stage: 'findNearest';
276
+ options: {
277
+ field: string | FirestorePipelineFieldExpressionInternal;
278
+ vectorValue: number[] | { values: number[] };
279
+ distanceMeasure: 'euclidean' | 'cosine' | 'dot_product';
280
+ limit?: number;
281
+ distanceField?: string;
282
+ };
283
+ }
284
+ | {
285
+ stage: 'replaceWith';
286
+ options: {
287
+ map:
288
+ | string
289
+ | FirestorePipelineExpressionInternal
290
+ | FirestorePipelineFlatAliasedFieldInternal
291
+ | FirestorePipelineAliasedExpressionInternal;
292
+ };
293
+ }
294
+ | {
295
+ stage: 'sample';
296
+ options: { documents: number } | { percentage: number };
297
+ }
298
+ | {
299
+ stage: 'union';
300
+ options: {
301
+ other: FirestorePipelineSerializedInternal;
302
+ };
303
+ }
304
+ | {
305
+ stage: 'unnest';
306
+ options: {
307
+ selectable: FirestorePipelineSelectableInternal;
308
+ indexField?: string;
309
+ };
310
+ }
311
+ | {
312
+ stage: 'rawStage';
313
+ options: {
314
+ name: string;
315
+ params?: FirestorePipelineSerializedValueInternal;
316
+ options: Record<string, unknown>;
317
+ };
318
+ };
319
+
320
+ export type FirestorePipelineStageNameInternal = FirestorePipelineStageInternal['stage'];
321
+
322
+ export type FirestorePipelineStageOptionsInternal<
323
+ TStage extends FirestorePipelineStageNameInternal,
324
+ > = Extract<FirestorePipelineStageInternal, { stage: TStage }>['options'];
325
+
326
+ /** Serialized pipeline payload passed to native execute bridge. */
327
+ export interface FirestorePipelineSerializedInternal {
328
+ source: FirestorePipelineSourceInternal;
329
+ stages: FirestorePipelineStageInternal[];
330
+ }
331
+
332
+ /** Options passed to native pipeline execute bridge. */
333
+ export interface FirestorePipelineExecuteOptionsInternal {
334
+ indexMode?: 'recommended';
335
+ rawOptions?: Record<string, unknown>;
336
+ }
337
+
338
+ /** Timestamp shape received from native pipeline execution. */
339
+ export type FirestorePipelineTimestampInternal =
340
+ | FirestoreTimestamp
341
+ | { seconds?: number; nanoseconds?: number }
342
+ | [number, number]
343
+ | number;
344
+
345
+ /** Single serialized pipeline result received from native execution. */
346
+ export interface FirestorePipelineResultInternal {
347
+ data?: Record<string, unknown>;
348
+ path?: string;
349
+ id?: string;
350
+ createTime?: FirestorePipelineTimestampInternal;
351
+ updateTime?: FirestorePipelineTimestampInternal;
352
+ }
353
+
354
+ /** Pipeline execution response received from native execution. */
355
+ export interface FirestorePipelineSnapshotInternal {
356
+ results?: FirestorePipelineResultInternal[];
357
+ executionTime: FirestorePipelineTimestampInternal;
358
+ }
359
+
360
+ /** Options for snapshot listeners (includeMetadataChanges). */
361
+ export interface FirestoreSnapshotListenOptionsInternal {
362
+ includeMetadataChanges?: boolean;
363
+ }
364
+
365
+ /** Settings state on the Firestore module instance (ignoreUndefinedProperties, persistence). */
366
+ export interface FirestoreSettingsStateInternal {
367
+ ignoreUndefinedProperties: boolean;
368
+ persistence: boolean;
369
+ }
370
+
371
+ /** Subscription returned by emitter.addListener. */
372
+ export interface FirestoreEmitterSubscriptionInternal {
373
+ remove(): void;
374
+ }
375
+
376
+ /** Native error shape in sync event body. */
377
+ export interface FirestoreSyncEventErrorInternal {
378
+ code?: string;
379
+ message?: string;
380
+ }
381
+
382
+ /** Serialized document snapshot from native (event.body.snapshot). */
383
+ export interface FirestoreDocumentSnapshotDataInternal {
384
+ path: string;
385
+ exists: boolean;
386
+ data?: Record<string, unknown>;
387
+ metadata: [boolean, boolean];
388
+ }
389
+
390
+ /** Sync event body (document or collection) from native. */
391
+ export interface FirestoreSyncEventBodyInternal {
392
+ error?: FirestoreSyncEventErrorInternal;
393
+ snapshot?: FirestoreDocumentSnapshotDataInternal;
394
+ documents?: FirestoreDocumentSnapshotDataInternal[];
395
+ }
396
+
397
+ /** Emitter interface used by FirestoreInternal (matches FirebaseModule.emitter usage). */
398
+ export interface FirestoreEmitterInternal {
399
+ addListener(
400
+ eventName: string,
401
+ callback: (event: { body: FirestoreSyncEventBodyInternal }) => void,
402
+ ): FirestoreEmitterSubscriptionInternal;
403
+ }
404
+
405
+ /**
406
+ * Wrapped native module interface for Firestore.
407
+ *
408
+ * Note: React Native Firebase internally wraps native methods and auto-prepends app name and
409
+ * database ID when `hasMultiAppSupport` and `hasCustomUrlOrRegionSupport` are enabled.
410
+ * Firestore uses multiple native modules (RNFBFirestoreModule, RNFBFirestoreCollectionModule,
411
+ * RNFBFirestoreDocumentModule, RNFBFirestoreTransactionModule) which are merged into a single
412
+ * wrapped object. This interface represents that merged *wrapped* module shape exposed as
413
+ * `this.native` within FirebaseFirestoreModule.
414
+ */
415
+ export interface RNFBFirestoreModule {
416
+ setLogLevel(level: LogLevel): Promise<void>;
417
+ // --- Main Firestore module (RNFBFirestoreModule) ---
418
+ loadBundle(bundle: string): Promise<LoadBundleTaskProgress>;
419
+ clearPersistence(): Promise<void>;
420
+ waitForPendingWrites(): Promise<void>;
421
+ terminate(): Promise<void>;
422
+ useEmulator(host: string, port: number): void;
423
+ disableNetwork(): Promise<void>;
424
+ enableNetwork(): Promise<void>;
425
+ settings(settings: object): Promise<void>;
426
+
427
+ addSnapshotsInSync(listenerId: number): void;
428
+ removeSnapshotsInSync(listenerId: number): void;
429
+
430
+ /**
431
+ * Persistent cache index manager.
432
+ * - 0: enableIndexAutoCreation
433
+ * - 1: disableIndexAutoCreation
434
+ * - 2: deleteAllIndexes
435
+ */
436
+ persistenceCacheIndexManager(mode: number): Promise<void>;
437
+
438
+ // --- Collection module (RNFBFirestoreCollectionModule) ---
439
+ collectionOffSnapshot(listenerId: number): void;
440
+ namedQueryOnSnapshot(
441
+ queryName: string,
442
+ type: FirestoreQueryTypeInternal | string,
443
+ filters: FirestoreFilterSpecInternal[],
444
+ orders: FirestoreOrderSpecInternal[],
445
+ options: FirestoreQueryOptionsInternal,
446
+ listenerId: number,
447
+ snapshotListenOptions: FirestoreSnapshotListenOptionsInternal,
448
+ ): void;
449
+ collectionOnSnapshot(
450
+ path: string,
451
+ type: FirestoreQueryTypeInternal | string,
452
+ filters: FirestoreFilterSpecInternal[],
453
+ orders: FirestoreOrderSpecInternal[],
454
+ options: FirestoreQueryOptionsInternal,
455
+ listenerId: number,
456
+ snapshotListenOptions: FirestoreSnapshotListenOptionsInternal,
457
+ ): void;
458
+ namedQueryGet(
459
+ queryName: string,
460
+ type: FirestoreQueryTypeInternal | string,
461
+ filters: FirestoreFilterSpecInternal[],
462
+ orders: FirestoreOrderSpecInternal[],
463
+ options: FirestoreQueryOptionsInternal,
464
+ getOptions?: { source?: string },
465
+ ): Promise<unknown>;
466
+ collectionGet(
467
+ path: string,
468
+ type: FirestoreQueryTypeInternal | string,
469
+ filters: FirestoreFilterSpecInternal[],
470
+ orders: FirestoreOrderSpecInternal[],
471
+ options: FirestoreQueryOptionsInternal,
472
+ getOptions?: { source?: string },
473
+ ): Promise<unknown>;
474
+ collectionCount(
475
+ path: string,
476
+ type: FirestoreQueryTypeInternal | string,
477
+ filters: FirestoreFilterSpecInternal[],
478
+ orders: FirestoreOrderSpecInternal[],
479
+ options: FirestoreQueryOptionsInternal,
480
+ ): Promise<{ count?: number }>;
481
+ aggregateQuery(
482
+ path: string,
483
+ type: FirestoreQueryTypeInternal | string,
484
+ filters: FirestoreFilterSpecInternal[],
485
+ orders: FirestoreOrderSpecInternal[],
486
+ options: FirestoreQueryOptionsInternal,
487
+ aggregateQueries: FirestoreAggregateQuerySpecInternal[],
488
+ ): Promise<Record<string, unknown>>;
489
+ pipelineExecute(
490
+ pipeline: FirestorePipelineSerializedInternal,
491
+ options?: FirestorePipelineExecuteOptionsInternal,
492
+ ): Promise<FirestorePipelineSnapshotInternal>;
493
+
494
+ // --- Document module (RNFBFirestoreDocumentModule) ---
495
+ documentDelete(path: string): Promise<void>;
496
+ documentOffSnapshot(listenerId: number): void;
497
+ documentOnSnapshot(
498
+ path: string,
499
+ listenerId: number,
500
+ snapshotListenOptions: FirestoreSnapshotListenOptionsInternal,
501
+ ): void;
502
+ documentGet(path: string, getOptions?: { source?: string }): Promise<unknown>;
503
+ documentSet(
504
+ path: string,
505
+ data: Record<string, unknown>,
506
+ options: Record<string, unknown>,
507
+ ): Promise<void>;
508
+ documentUpdate(path: string, data: Record<string, unknown>): Promise<void>;
509
+ documentBatch(writes: Array<Record<string, unknown>>): Promise<void>;
510
+
511
+ // --- Transaction module (RNFBFirestoreTransactionModule) ---
512
+ transactionBegin(transactionId: number): Promise<void>;
513
+ transactionDispose(transactionId: number): void;
514
+ transactionGetDocument(transactionId: number, path: string): Promise<unknown>;
515
+ transactionApplyBuffer(transactionId: number, commandBuffer: unknown[]): void;
516
+ }
517
+
518
+ declare module '@react-native-firebase/app/dist/module/internal/NativeModules' {
519
+ interface ReactNativeFirebaseNativeModules {
520
+ RNFBFirestoreModule: RNFBFirestoreModule;
521
+ }
522
+ }
523
+
524
+ // Helper type for wrappers that forward MODULAR_DEPRECATION_ARG via .call(...).
525
+ export type WithModularDeprecationArg<F> = F extends (...args: infer P) => infer R
526
+ ? (...args: [...P, FirestoreModularDeprecationArg?]) => R
527
+ : never;
528
+
529
+ export interface ParentReferenceInternal<
530
+ AppModelType = DocumentData,
531
+ DbModelType extends DocumentData = DocumentData,
532
+ > {
533
+ doc(
534
+ path?: string,
535
+ deprecationArg?: FirestoreModularDeprecationArg,
536
+ ): DocumentReference<AppModelType, DbModelType>;
537
+ collection(
538
+ path: string,
539
+ deprecationArg?: FirestoreModularDeprecationArg,
540
+ ): CollectionReference<AppModelType, DbModelType>;
541
+ }
542
+
543
+ export interface ReferenceInternal<
544
+ AppModelType = DocumentData,
545
+ DbModelType extends DocumentData = DocumentData,
546
+ > {
547
+ isEqual(
548
+ other:
549
+ | DocumentReference<AppModelType, DbModelType>
550
+ | CollectionReference<AppModelType, DbModelType>,
551
+ deprecationArg?: FirestoreModularDeprecationArg,
552
+ ): boolean;
553
+ }
554
+
555
+ /** Used when calling query instance methods by name (e.g. in QueryConstraint._apply). */
556
+ export type QueryWithMethodInternal<
557
+ AppModelType = DocumentData,
558
+ DbModelType extends DocumentData = DocumentData,
559
+ > = Record<string, (...args: unknown[]) => Query<AppModelType, DbModelType>>;
560
+
561
+ /** Used when calling .where() on a query with a composite filter. */
562
+ export interface QueryWithWhereInternal<
563
+ AppModelType = DocumentData,
564
+ DbModelType extends DocumentData = DocumentData,
565
+ > {
566
+ where(...args: unknown[]): Query<AppModelType, DbModelType>;
567
+ }
568
+
569
+ /** Constraint instance that may have _apply(query) to apply itself to a query. */
570
+ export interface QueryConstraintWithApplyInternal<
571
+ AppModelType = DocumentData,
572
+ DbModelType extends DocumentData = DocumentData,
573
+ > {
574
+ _apply?(query: Query<AppModelType, DbModelType>): Query<AppModelType, DbModelType>;
575
+ }
576
+
577
+ /** Filter constraint (field or composite) that exposes _filter. */
578
+ export interface QueryFilterConstraintWithFilterInternal {
579
+ _filter: _Filter;
580
+ }
581
+
582
+ /** DocumentReference viewed as having get() returning DocumentSnapshot. */
583
+ export interface DocumentReferenceGetInternal<
584
+ AppModelType = DocumentData,
585
+ DbModelType extends DocumentData = DocumentData,
586
+ > {
587
+ get(...args: unknown[]): Promise<DocumentSnapshot<AppModelType, DbModelType>>;
588
+ }
589
+
590
+ /** DocumentReference viewed as having delete(). */
591
+ export interface DocumentReferenceDeleteInternal {
592
+ delete(...args: unknown[]): Promise<void>;
593
+ }
594
+
595
+ /** Reference or query viewed as having isEqual(). */
596
+ export interface ReferenceIsEqualInternal {
597
+ isEqual(other: unknown, deprecationArg?: FirestoreModularDeprecationArg): boolean;
598
+ }
599
+
600
+ /** DocumentReference or Query viewed as having onSnapshot(). */
601
+ export interface ReferenceWithOnSnapshotInternal {
602
+ onSnapshot(...listenerArgs: unknown[]): Unsubscribe;
603
+ }
604
+
605
+ /** Converter object with optional toFirestore (for guards before calling). */
606
+ export interface ConverterWithOptionalToFirestoreInternal {
607
+ toFirestore?(data: unknown, options?: unknown): unknown;
608
+ }
609
+
610
+ /** Converter object with required toFirestore (after guard). */
611
+ export interface ConverterWithToFirestoreInternal {
612
+ toFirestore: (data: unknown, options?: unknown) => unknown;
613
+ }
614
+
615
+ /** Partial snapshot listener observer (next / error only). */
616
+ export interface PartialSnapshotObserverInternal {
617
+ next?: (snapshot: unknown) => void;
618
+ error?: (e: Error) => void;
619
+ }
620
+
621
+ /** Converter object with optional toFirestore/fromFirestore (for validation). */
622
+ export interface ConverterWithOptionalMethodsInternal {
623
+ toFirestore?: unknown;
624
+ fromFirestore?: unknown;
625
+ }
626
+
627
+ /** Converter with required fromFirestore (for DocumentSnapshot.data() when converter is present). */
628
+ export interface ConverterWithFromFirestoreInternal {
629
+ fromFirestore(snapshot: DocumentSnapshot, options?: SnapshotOptions): unknown;
630
+ }
631
+
632
+ /** Value at a field path in a document (primitive, nested object, or array). */
633
+ export type DocumentFieldValueInternal = Primitive | Record<string, unknown> | unknown[];
634
+
635
+ export interface DocumentReferenceInternal<
636
+ AppModelType = DocumentData,
637
+ DbModelType extends DocumentData = DocumentData,
638
+ >
639
+ extends ReferenceInternal<AppModelType, DbModelType>, ParentReferenceInternal {
640
+ set(
641
+ data: WithFieldValue<AppModelType> | PartialWithFieldValue<AppModelType>,
642
+ options?: SetOptions,
643
+ deprecationArg?: FirestoreModularDeprecationArg,
644
+ ): Promise<void>;
645
+ update(
646
+ fieldOrUpdateData?: unknown,
647
+ value?: unknown,
648
+ ...moreFieldsAndValuesAndDeprecationArg: (unknown | FirestoreModularDeprecationArg)[]
649
+ ): Promise<void>;
650
+ delete(deprecationArg?: FirestoreModularDeprecationArg): Promise<void>;
651
+ get(
652
+ getOptions?: { source?: string },
653
+ deprecationArg?: FirestoreModularDeprecationArg,
654
+ ): Promise<unknown>;
655
+ }
656
+
657
+ export interface CollectionReferenceInternal<
658
+ AppModelType = DocumentData,
659
+ DbModelType extends DocumentData = DocumentData,
660
+ >
661
+ extends ReferenceInternal<AppModelType, DbModelType>, ParentReferenceInternal {
662
+ add(
663
+ data: WithFieldValue<AppModelType>,
664
+ deprecationArg?: FirestoreModularDeprecationArg,
665
+ ): Promise<DocumentReference<AppModelType, DbModelType>>;
666
+ }
667
+
668
+ export interface QueryInternal<
669
+ AppModelType = DocumentData,
670
+ DbModelType extends DocumentData = DocumentData,
671
+ > extends ReferenceInternal<AppModelType, DbModelType> {
672
+ get(
673
+ getOptions?: { source?: string },
674
+ deprecationArg?: FirestoreModularDeprecationArg,
675
+ ): Promise<QuerySnapshot<AppModelType, DbModelType>>;
676
+ count(deprecationArg?: FirestoreModularDeprecationArg): { get(): Promise<unknown> };
677
+ where(
678
+ queryConstraintOrFilter: unknown,
679
+ deprecationArg?: FirestoreModularDeprecationArg,
680
+ ): Query<AppModelType, DbModelType>;
681
+ withConstraints(...queryConstraints: QueryConstraint[]): Query<AppModelType, DbModelType>;
682
+ }
683
+
684
+ export interface FirestoreInternal extends ParentReferenceInternal, Firestore {
685
+ /** Wrapped native module (merged Firestore native modules). */
686
+ readonly native: RNFBFirestoreModule;
687
+ /** Shared event emitter for sync events (document, collection, snapshots-in-sync). */
688
+ readonly emitter: FirestoreEmitterInternal;
689
+ /** Builds app- and database-scoped event name. */
690
+ eventNameForApp(...args: Array<string | number>): string;
691
+ /** Module settings (e.g. ignoreUndefinedProperties for serialization). */
692
+ readonly _settings: FirestoreSettingsStateInternal;
693
+ collectionGroup(collectionId: string, deprecationArg?: FirestoreModularDeprecationArg): Query;
694
+ enableNetwork(deprecationArg?: FirestoreModularDeprecationArg): Promise<void>;
695
+ disableNetwork(deprecationArg?: FirestoreModularDeprecationArg): Promise<void>;
696
+ clearPersistence(deprecationArg?: FirestoreModularDeprecationArg): Promise<void>;
697
+ waitForPendingWrites(deprecationArg?: FirestoreModularDeprecationArg): Promise<void>;
698
+ terminate(deprecationArg?: FirestoreModularDeprecationArg): Promise<void>;
699
+ settings(
700
+ settings: FirestoreSettings,
701
+ deprecationArg?: FirestoreModularDeprecationArg,
702
+ ): Promise<void>;
703
+ useEmulator(
704
+ host: string,
705
+ port: number,
706
+ options?: unknown,
707
+ deprecationArg?: FirestoreModularDeprecationArg,
708
+ ): void;
709
+ runTransaction(
710
+ updateFunction: (transaction: Transaction) => Promise<unknown>,
711
+ deprecationArg?: FirestoreModularDeprecationArg,
712
+ ): Promise<unknown>;
713
+ loadBundle(
714
+ bundleData: ReadableStream<Uint8Array> | ArrayBuffer | string,
715
+ deprecationArg?: FirestoreModularDeprecationArg,
716
+ ): LoadBundleTask;
717
+ namedQuery(name: string, deprecationArg?: FirestoreModularDeprecationArg): Query | null;
718
+ batch(deprecationArg?: FirestoreModularDeprecationArg): WriteBatch;
719
+ persistentCacheIndexManager(
720
+ deprecationArg?: FirestoreModularDeprecationArg,
721
+ ): PersistentCacheIndexManager | null;
722
+ }
723
+
724
+ /** Firestore instance prototype shape used when installing pipeline() at runtime. */
725
+ export interface FirestorePipelinePrototypeInternal {
726
+ pipeline?: (this: FirestoreInternal) => unknown;
727
+ __rnfbFirestorePipelineInstalled__?: boolean;
728
+ }
729
+
730
+ export interface PersistentCacheIndexManagerInternal extends PersistentCacheIndexManager {
731
+ enableIndexAutoCreation(deprecationArg?: FirestoreModularDeprecationArg): Promise<void>;
732
+ disableIndexAutoCreation(deprecationArg?: FirestoreModularDeprecationArg): Promise<void>;
733
+ deleteAllIndexes(deprecationArg?: FirestoreModularDeprecationArg): Promise<void>;
734
+ }
735
+
736
+ export type FirestoreBlobInternal = Blob & { _binaryString: string };
737
+
738
+ export type QueryWithAggregateInternals = Query & {
739
+ _firestore: FirestoreInternal;
740
+ _collectionPath: { relativeName: string };
741
+ _modifiers: {
742
+ type: FirestoreQueryTypeInternal;
743
+ filters: FirestoreFilterSpecInternal[];
744
+ orders: FirestoreOrderSpecInternal[];
745
+ options: FirestoreQueryOptionsInternal;
746
+ };
747
+ };