@react-native-firebase/firestore 23.8.6 → 24.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (359) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/RNFBFirestore.podspec +2 -1
  3. package/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestoreCollectionModule.java +17 -4
  4. package/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestoreDocumentModule.java +2 -2
  5. package/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestorePipelineExecutor.java +1243 -0
  6. package/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestorePipelineNodeBuilder.java +3919 -0
  7. package/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestorePipelineParser.java +1735 -0
  8. package/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestoreSerialize.java +1 -1
  9. package/dist/module/FieldPath.js +59 -0
  10. package/dist/module/FieldPath.js.map +1 -0
  11. package/dist/module/FieldValue.js +82 -0
  12. package/dist/module/FieldValue.js.map +1 -0
  13. package/{lib → dist/module}/FirestoreAggregate.js +31 -43
  14. package/dist/module/FirestoreAggregate.js.map +1 -0
  15. package/dist/module/FirestoreBlob.js +56 -0
  16. package/dist/module/FirestoreBlob.js.map +1 -0
  17. package/dist/module/FirestoreCollectionReference.js +70 -0
  18. package/dist/module/FirestoreCollectionReference.js.map +1 -0
  19. package/{lib → dist/module}/FirestoreDocumentChange.js +12 -15
  20. package/dist/module/FirestoreDocumentChange.js.map +1 -0
  21. package/dist/module/FirestoreDocumentReference.js +170 -0
  22. package/dist/module/FirestoreDocumentReference.js.map +1 -0
  23. package/dist/module/FirestoreDocumentSnapshot.js +88 -0
  24. package/dist/module/FirestoreDocumentSnapshot.js.map +1 -0
  25. package/dist/module/FirestoreFilter.js +146 -0
  26. package/dist/module/FirestoreFilter.js.map +1 -0
  27. package/dist/module/FirestoreGeoPoint.js +80 -0
  28. package/dist/module/FirestoreGeoPoint.js.map +1 -0
  29. package/{lib → dist/module}/FirestorePath.js +5 -12
  30. package/dist/module/FirestorePath.js.map +1 -0
  31. package/{lib → dist/module}/FirestorePersistentCacheIndexManager.js +11 -4
  32. package/dist/module/FirestorePersistentCacheIndexManager.js.map +1 -0
  33. package/dist/module/FirestoreQuery.js +298 -0
  34. package/dist/module/FirestoreQuery.js.map +1 -0
  35. package/{lib → dist/module}/FirestoreQueryModifiers.js +25 -136
  36. package/dist/module/FirestoreQueryModifiers.js.map +1 -0
  37. package/dist/module/FirestoreQuerySnapshot.js +98 -0
  38. package/dist/module/FirestoreQuerySnapshot.js.map +1 -0
  39. package/dist/module/FirestoreSnapshotMetadata.js +38 -0
  40. package/dist/module/FirestoreSnapshotMetadata.js.map +1 -0
  41. package/dist/module/FirestoreStatics.js +50 -0
  42. package/dist/module/FirestoreStatics.js.map +1 -0
  43. package/{lib → dist/module}/FirestoreTimestamp.js +39 -39
  44. package/dist/module/FirestoreTimestamp.js.map +1 -0
  45. package/dist/module/FirestoreTransaction.js +113 -0
  46. package/dist/module/FirestoreTransaction.js.map +1 -0
  47. package/dist/module/FirestoreTransactionHandler.js +137 -0
  48. package/dist/module/FirestoreTransactionHandler.js.map +1 -0
  49. package/dist/module/FirestoreVectorValue.js +75 -0
  50. package/dist/module/FirestoreVectorValue.js.map +1 -0
  51. package/dist/module/FirestoreWriteBatch.js +113 -0
  52. package/dist/module/FirestoreWriteBatch.js.map +1 -0
  53. package/dist/module/LoadBundleTask.js +70 -0
  54. package/dist/module/LoadBundleTask.js.map +1 -0
  55. package/dist/module/index.js +31 -0
  56. package/dist/module/index.js.map +1 -0
  57. package/dist/module/modular/Bytes.js +67 -0
  58. package/dist/module/modular/Bytes.js.map +1 -0
  59. package/dist/module/modular/FieldPath.js +25 -0
  60. package/dist/module/modular/FieldPath.js.map +1 -0
  61. package/dist/module/modular/FieldValue.js +37 -0
  62. package/dist/module/modular/FieldValue.js.map +1 -0
  63. package/dist/module/modular/GeoPoint.js +22 -0
  64. package/dist/module/modular/GeoPoint.js.map +1 -0
  65. package/dist/module/modular/Timestamp.js +22 -0
  66. package/dist/module/modular/Timestamp.js.map +1 -0
  67. package/dist/module/modular/VectorValue.js +25 -0
  68. package/dist/module/modular/VectorValue.js.map +1 -0
  69. package/dist/module/modular/query.js +222 -0
  70. package/dist/module/modular/query.js.map +1 -0
  71. package/dist/module/modular/snapshot.js +32 -0
  72. package/dist/module/modular/snapshot.js.map +1 -0
  73. package/dist/module/modular.js +229 -0
  74. package/dist/module/modular.js.map +1 -0
  75. package/dist/module/namespaced.js +298 -0
  76. package/dist/module/namespaced.js.map +1 -0
  77. package/dist/module/package.json +1 -0
  78. package/dist/module/pipelines/expressions.js +1273 -0
  79. package/dist/module/pipelines/expressions.js.map +1 -0
  80. package/dist/module/pipelines/index.js +32 -0
  81. package/dist/module/pipelines/index.js.map +1 -0
  82. package/dist/module/pipelines/pipeline-result.js +58 -0
  83. package/dist/module/pipelines/pipeline-result.js.map +1 -0
  84. package/dist/module/pipelines/pipeline-source.js +4 -0
  85. package/dist/module/pipelines/pipeline-source.js.map +1 -0
  86. package/dist/module/pipelines/pipeline.js +4 -0
  87. package/dist/module/pipelines/pipeline.js.map +1 -0
  88. package/dist/module/pipelines/pipeline_impl.js +42 -0
  89. package/dist/module/pipelines/pipeline_impl.js.map +1 -0
  90. package/dist/module/pipelines/pipeline_options.js +4 -0
  91. package/dist/module/pipelines/pipeline_options.js.map +1 -0
  92. package/dist/module/pipelines/pipeline_runtime.js +526 -0
  93. package/dist/module/pipelines/pipeline_runtime.js.map +1 -0
  94. package/dist/module/pipelines/pipeline_support.js +71 -0
  95. package/dist/module/pipelines/pipeline_support.js.map +1 -0
  96. package/dist/module/pipelines/pipeline_validate.js +183 -0
  97. package/dist/module/pipelines/pipeline_validate.js.map +1 -0
  98. package/dist/module/pipelines/stage_options.js +4 -0
  99. package/dist/module/pipelines/stage_options.js.map +1 -0
  100. package/dist/module/pipelines/types.js +2 -0
  101. package/dist/module/pipelines/types.js.map +1 -0
  102. package/dist/module/types/firestore.js +4 -0
  103. package/dist/module/types/firestore.js.map +1 -0
  104. package/dist/module/types/internal.js +4 -0
  105. package/dist/module/types/internal.js.map +1 -0
  106. package/dist/module/types/namespaced.js +338 -0
  107. package/dist/module/types/namespaced.js.map +1 -0
  108. package/{lib → dist/module}/utils/index.js +59 -114
  109. package/dist/module/utils/index.js.map +1 -0
  110. package/{lib → dist/module}/utils/serialize.js +58 -116
  111. package/dist/module/utils/serialize.js.map +1 -0
  112. package/{lib → dist/module}/utils/typemap.js +6 -20
  113. package/dist/module/utils/typemap.js.map +1 -0
  114. package/dist/module/version.js +5 -0
  115. package/dist/module/version.js.map +1 -0
  116. package/dist/module/web/RNFBFirestoreModule.android.js +5 -0
  117. package/dist/module/web/RNFBFirestoreModule.android.js.map +1 -0
  118. package/dist/module/web/RNFBFirestoreModule.ios.js +5 -0
  119. package/dist/module/web/RNFBFirestoreModule.ios.js.map +1 -0
  120. package/dist/module/web/RNFBFirestoreModule.js +387 -0
  121. package/dist/module/web/RNFBFirestoreModule.js.map +1 -0
  122. package/{lib → dist/module}/web/convert.js +60 -94
  123. package/dist/module/web/convert.js.map +1 -0
  124. package/dist/module/web/pipelines/pipeline.js +34 -0
  125. package/dist/module/web/pipelines/pipeline.js.map +1 -0
  126. package/dist/module/web/pipelines/pipeline_bridge_factory.js +217 -0
  127. package/dist/module/web/pipelines/pipeline_bridge_factory.js.map +1 -0
  128. package/dist/module/web/pipelines/pipeline_node_builder.js +294 -0
  129. package/dist/module/web/pipelines/pipeline_node_builder.js.map +1 -0
  130. package/dist/module/web/pipelines/pipeline_parser.js +21 -0
  131. package/dist/module/web/pipelines/pipeline_parser.js.map +1 -0
  132. package/dist/module/web/pipelines/pipeline_snapshot_serializer.js +89 -0
  133. package/dist/module/web/pipelines/pipeline_snapshot_serializer.js.map +1 -0
  134. package/dist/module/web/query.js +95 -0
  135. package/dist/module/web/query.js.map +1 -0
  136. package/dist/typescript/lib/FieldPath.d.ts +10 -0
  137. package/dist/typescript/lib/FieldPath.d.ts.map +1 -0
  138. package/dist/typescript/lib/FieldValue.d.ts +17 -0
  139. package/dist/typescript/lib/FieldValue.d.ts.map +1 -0
  140. package/dist/typescript/lib/FirestoreAggregate.d.ts +40 -0
  141. package/dist/typescript/lib/FirestoreAggregate.d.ts.map +1 -0
  142. package/dist/typescript/lib/FirestoreBlob.d.ts +11 -0
  143. package/dist/typescript/lib/FirestoreBlob.d.ts.map +1 -0
  144. package/dist/typescript/lib/FirestoreCollectionReference.d.ts +15 -0
  145. package/dist/typescript/lib/FirestoreCollectionReference.d.ts.map +1 -0
  146. package/dist/typescript/lib/FirestoreDocumentChange.d.ts +27 -0
  147. package/dist/typescript/lib/FirestoreDocumentChange.d.ts.map +1 -0
  148. package/dist/typescript/lib/FirestoreDocumentReference.d.ts +30 -0
  149. package/dist/typescript/lib/FirestoreDocumentReference.d.ts.map +1 -0
  150. package/dist/typescript/lib/FirestoreDocumentSnapshot.d.ts +30 -0
  151. package/dist/typescript/lib/FirestoreDocumentSnapshot.d.ts.map +1 -0
  152. package/dist/typescript/lib/FirestoreFilter.d.ts +52 -0
  153. package/dist/typescript/lib/FirestoreFilter.d.ts.map +1 -0
  154. package/dist/typescript/lib/FirestoreGeoPoint.d.ts +22 -0
  155. package/dist/typescript/lib/FirestoreGeoPoint.d.ts.map +1 -0
  156. package/dist/typescript/lib/FirestorePath.d.ts +12 -0
  157. package/dist/typescript/lib/FirestorePath.d.ts.map +1 -0
  158. package/dist/typescript/lib/FirestorePersistentCacheIndexManager.d.ts +16 -0
  159. package/dist/typescript/lib/FirestorePersistentCacheIndexManager.d.ts.map +1 -0
  160. package/dist/typescript/lib/FirestoreQuery.d.ts +39 -0
  161. package/dist/typescript/lib/FirestoreQuery.d.ts.map +1 -0
  162. package/dist/typescript/lib/FirestoreQueryModifiers.d.ts +59 -0
  163. package/dist/typescript/lib/FirestoreQueryModifiers.d.ts.map +1 -0
  164. package/dist/typescript/lib/FirestoreQuerySnapshot.d.ts +49 -0
  165. package/dist/typescript/lib/FirestoreQuerySnapshot.d.ts.map +1 -0
  166. package/dist/typescript/lib/FirestoreSnapshotMetadata.d.ts +8 -0
  167. package/dist/typescript/lib/FirestoreSnapshotMetadata.d.ts.map +1 -0
  168. package/dist/typescript/lib/FirestoreStatics.d.ts +23 -0
  169. package/dist/typescript/lib/FirestoreStatics.d.ts.map +1 -0
  170. package/dist/typescript/lib/FirestoreTimestamp.d.ts +33 -0
  171. package/dist/typescript/lib/FirestoreTimestamp.d.ts.map +1 -0
  172. package/dist/typescript/lib/FirestoreTransaction.d.ts +42 -0
  173. package/dist/typescript/lib/FirestoreTransaction.d.ts.map +1 -0
  174. package/dist/typescript/lib/FirestoreTransactionHandler.d.ts +26 -0
  175. package/dist/typescript/lib/FirestoreTransactionHandler.d.ts.map +1 -0
  176. package/dist/typescript/lib/FirestoreVectorValue.d.ts +17 -0
  177. package/dist/typescript/lib/FirestoreVectorValue.d.ts.map +1 -0
  178. package/dist/typescript/lib/FirestoreWriteBatch.d.ts +21 -0
  179. package/dist/typescript/lib/FirestoreWriteBatch.d.ts.map +1 -0
  180. package/dist/typescript/lib/LoadBundleTask.d.ts +16 -0
  181. package/dist/typescript/lib/LoadBundleTask.d.ts.map +1 -0
  182. package/dist/typescript/lib/index.d.ts +6 -0
  183. package/dist/typescript/lib/index.d.ts.map +1 -0
  184. package/dist/typescript/lib/modular/Bytes.d.ts +22 -0
  185. package/dist/typescript/lib/modular/Bytes.d.ts.map +1 -0
  186. package/dist/typescript/lib/modular/FieldPath.d.ts +4 -0
  187. package/dist/typescript/lib/modular/FieldPath.d.ts.map +1 -0
  188. package/dist/typescript/lib/modular/FieldValue.d.ts +8 -0
  189. package/dist/typescript/lib/modular/FieldValue.d.ts.map +1 -0
  190. package/dist/typescript/lib/modular/GeoPoint.d.ts +3 -0
  191. package/dist/typescript/lib/modular/GeoPoint.d.ts.map +1 -0
  192. package/dist/typescript/lib/modular/Timestamp.d.ts +3 -0
  193. package/dist/typescript/lib/modular/Timestamp.d.ts.map +1 -0
  194. package/dist/typescript/lib/modular/VectorValue.d.ts +4 -0
  195. package/dist/typescript/lib/modular/VectorValue.d.ts.map +1 -0
  196. package/dist/typescript/lib/modular/query.d.ts +93 -0
  197. package/dist/typescript/lib/modular/query.d.ts.map +1 -0
  198. package/dist/typescript/lib/modular/snapshot.d.ts +30 -0
  199. package/dist/typescript/lib/modular/snapshot.d.ts.map +1 -0
  200. package/dist/typescript/lib/modular.d.ts +69 -0
  201. package/dist/typescript/lib/modular.d.ts.map +1 -0
  202. package/dist/typescript/lib/namespaced.d.ts +13 -0
  203. package/dist/typescript/lib/namespaced.d.ts.map +1 -0
  204. package/dist/typescript/lib/pipelines/expressions.d.ts +723 -0
  205. package/dist/typescript/lib/pipelines/expressions.d.ts.map +1 -0
  206. package/dist/typescript/lib/pipelines/index.d.ts +31 -0
  207. package/dist/typescript/lib/pipelines/index.d.ts.map +1 -0
  208. package/dist/typescript/lib/pipelines/pipeline-result.d.ts +30 -0
  209. package/dist/typescript/lib/pipelines/pipeline-result.d.ts.map +1 -0
  210. package/dist/typescript/lib/pipelines/pipeline-source.d.ts +64 -0
  211. package/dist/typescript/lib/pipelines/pipeline-source.d.ts.map +1 -0
  212. package/dist/typescript/lib/pipelines/pipeline.d.ts +61 -0
  213. package/dist/typescript/lib/pipelines/pipeline.d.ts.map +1 -0
  214. package/dist/typescript/lib/pipelines/pipeline_impl.d.ts +21 -0
  215. package/dist/typescript/lib/pipelines/pipeline_impl.d.ts.map +1 -0
  216. package/dist/typescript/lib/pipelines/pipeline_options.d.ts +17 -0
  217. package/dist/typescript/lib/pipelines/pipeline_options.d.ts.map +1 -0
  218. package/dist/typescript/lib/pipelines/pipeline_runtime.d.ts +10 -0
  219. package/dist/typescript/lib/pipelines/pipeline_runtime.d.ts.map +1 -0
  220. package/dist/typescript/lib/pipelines/pipeline_support.d.ts +7 -0
  221. package/dist/typescript/lib/pipelines/pipeline_support.d.ts.map +1 -0
  222. package/dist/typescript/lib/pipelines/pipeline_validate.d.ts +9 -0
  223. package/dist/typescript/lib/pipelines/pipeline_validate.d.ts.map +1 -0
  224. package/dist/typescript/lib/pipelines/stage_options.d.ts +326 -0
  225. package/dist/typescript/lib/pipelines/stage_options.d.ts.map +1 -0
  226. package/dist/typescript/lib/pipelines/types.d.ts +10 -0
  227. package/dist/typescript/lib/pipelines/types.d.ts.map +1 -0
  228. package/dist/typescript/lib/types/firestore.d.ts +263 -0
  229. package/dist/typescript/lib/types/firestore.d.ts.map +1 -0
  230. package/dist/typescript/lib/types/internal.d.ts +483 -0
  231. package/dist/typescript/lib/types/internal.d.ts.map +1 -0
  232. package/dist/typescript/lib/types/namespaced.d.ts +2285 -0
  233. package/dist/typescript/lib/types/namespaced.d.ts.map +1 -0
  234. package/dist/typescript/lib/utils/index.d.ts +15 -0
  235. package/dist/typescript/lib/utils/index.d.ts.map +1 -0
  236. package/dist/typescript/lib/utils/serialize.d.ts +17 -0
  237. package/dist/typescript/lib/utils/serialize.d.ts.map +1 -0
  238. package/dist/typescript/lib/utils/typemap.d.ts +3 -0
  239. package/dist/typescript/lib/utils/typemap.d.ts.map +1 -0
  240. package/dist/typescript/lib/version.d.ts +2 -0
  241. package/dist/typescript/lib/version.d.ts.map +1 -0
  242. package/dist/typescript/lib/web/RNFBFirestoreModule.android.d.ts +3 -0
  243. package/dist/typescript/lib/web/RNFBFirestoreModule.android.d.ts.map +1 -0
  244. package/dist/typescript/lib/web/RNFBFirestoreModule.d.ts +75 -0
  245. package/dist/typescript/lib/web/RNFBFirestoreModule.d.ts.map +1 -0
  246. package/dist/typescript/lib/web/RNFBFirestoreModule.ios.d.ts +3 -0
  247. package/dist/typescript/lib/web/RNFBFirestoreModule.ios.d.ts.map +1 -0
  248. package/dist/typescript/lib/web/convert.d.ts +14 -0
  249. package/dist/typescript/lib/web/convert.d.ts.map +1 -0
  250. package/dist/typescript/lib/web/pipelines/pipeline.d.ts +4 -0
  251. package/dist/typescript/lib/web/pipelines/pipeline.d.ts.map +1 -0
  252. package/dist/typescript/lib/web/pipelines/pipeline_bridge_factory.d.ts +5 -0
  253. package/dist/typescript/lib/web/pipelines/pipeline_bridge_factory.d.ts.map +1 -0
  254. package/dist/typescript/lib/web/pipelines/pipeline_node_builder.d.ts +5 -0
  255. package/dist/typescript/lib/web/pipelines/pipeline_node_builder.d.ts.map +1 -0
  256. package/dist/typescript/lib/web/pipelines/pipeline_parser.d.ts +3 -0
  257. package/dist/typescript/lib/web/pipelines/pipeline_parser.d.ts.map +1 -0
  258. package/dist/typescript/lib/web/pipelines/pipeline_snapshot_serializer.d.ts +4 -0
  259. package/dist/typescript/lib/web/pipelines/pipeline_snapshot_serializer.d.ts.map +1 -0
  260. package/dist/typescript/lib/web/query.d.ts +23 -0
  261. package/dist/typescript/lib/web/query.d.ts.map +1 -0
  262. package/dist/typescript/package.json +1 -0
  263. package/ios/RNFBFirestore/RNFBFirestoreCollectionModule.m +52 -2
  264. package/ios/RNFBFirestore/RNFBFirestorePipelineBridgeFactory.swift +384 -0
  265. package/ios/RNFBFirestore/RNFBFirestorePipelineCallHandler.swift +86 -0
  266. package/ios/RNFBFirestore/RNFBFirestorePipelineNodeBuilder.swift +1500 -0
  267. package/ios/RNFBFirestore/RNFBFirestorePipelineParser.swift +1352 -0
  268. package/ios/RNFBFirestore/RNFBFirestorePipelineSnapshotSerializer.swift +98 -0
  269. package/lib/{FirestoreFieldPath.js → FieldPath.ts} +10 -12
  270. package/lib/{FirestoreFieldValue.js → FieldValue.ts} +22 -19
  271. package/lib/FirestoreAggregate.ts +124 -0
  272. package/lib/FirestoreBlob.ts +73 -0
  273. package/lib/FirestoreCollectionReference.ts +99 -0
  274. package/lib/FirestoreDocumentChange.ts +71 -0
  275. package/lib/FirestoreDocumentReference.ts +310 -0
  276. package/lib/FirestoreDocumentSnapshot.ts +149 -0
  277. package/lib/FirestoreFilter.ts +232 -0
  278. package/lib/{FirestoreGeoPoint.js → FirestoreGeoPoint.ts} +48 -8
  279. package/lib/FirestorePath.ts +54 -0
  280. package/lib/FirestorePersistentCacheIndexManager.ts +46 -0
  281. package/lib/{FirestoreQuery.js → FirestoreQuery.ts} +208 -100
  282. package/lib/FirestoreQueryModifiers.ts +411 -0
  283. package/lib/{FirestoreQuerySnapshot.js → FirestoreQuerySnapshot.ts} +61 -32
  284. package/lib/{FirestoreSnapshotMetadata.js → FirestoreSnapshotMetadata.ts} +8 -6
  285. package/lib/{FirestoreStatics.js → FirestoreStatics.ts} +18 -11
  286. package/lib/FirestoreTimestamp.ts +161 -0
  287. package/lib/{FirestoreTransaction.js → FirestoreTransaction.ts} +64 -27
  288. package/lib/{FirestoreTransactionHandler.js → FirestoreTransactionHandler.ts} +54 -75
  289. package/lib/{FirestoreVectorValue.js → FirestoreVectorValue.ts} +36 -15
  290. package/lib/{FirestoreWriteBatch.js → FirestoreWriteBatch.ts} +45 -21
  291. package/lib/LoadBundleTask.ts +85 -0
  292. package/lib/index.ts +71 -0
  293. package/lib/modular/Bytes.ts +81 -0
  294. package/lib/modular/FieldPath.ts +24 -0
  295. package/lib/modular/FieldValue.ts +40 -0
  296. package/lib/modular/GeoPoint.ts +20 -0
  297. package/lib/modular/Timestamp.ts +20 -0
  298. package/lib/modular/VectorValue.ts +24 -0
  299. package/lib/modular/query.ts +368 -0
  300. package/lib/modular/snapshot.ts +137 -0
  301. package/lib/modular.ts +552 -0
  302. package/lib/{index.js → namespaced.ts} +170 -80
  303. package/lib/pipelines/expressions.ts +2321 -0
  304. package/lib/pipelines/index.ts +203 -0
  305. package/lib/pipelines/pipeline-result.ts +78 -0
  306. package/lib/pipelines/pipeline-source.ts +83 -0
  307. package/lib/pipelines/pipeline.ts +99 -0
  308. package/lib/pipelines/pipeline_impl.ts +46 -0
  309. package/lib/pipelines/pipeline_options.ts +32 -0
  310. package/lib/pipelines/pipeline_runtime.ts +863 -0
  311. package/lib/pipelines/pipeline_support.ts +134 -0
  312. package/lib/pipelines/pipeline_validate.ts +242 -0
  313. package/lib/pipelines/stage_options.ts +376 -0
  314. package/lib/pipelines/types.ts +26 -0
  315. package/lib/types/firestore.ts +477 -0
  316. package/lib/types/internal.ts +747 -0
  317. package/lib/{index.d.ts → types/namespaced.ts} +280 -79
  318. package/lib/utils/index.ts +244 -0
  319. package/lib/utils/serialize.ts +314 -0
  320. package/lib/utils/typemap.ts +65 -0
  321. package/lib/version.ts +2 -0
  322. package/lib/web/{RNFBFirestoreModule.js → RNFBFirestoreModule.ts} +222 -234
  323. package/lib/web/convert.ts +287 -0
  324. package/lib/web/pipelines/pipeline.ts +47 -0
  325. package/lib/web/pipelines/pipeline_bridge_factory.ts +377 -0
  326. package/lib/web/pipelines/pipeline_node_builder.ts +413 -0
  327. package/lib/web/pipelines/pipeline_parser.ts +23 -0
  328. package/lib/web/pipelines/pipeline_snapshot_serializer.ts +133 -0
  329. package/lib/web/query.ts +150 -0
  330. package/package.json +46 -7
  331. package/tsconfig.json +35 -0
  332. package/lib/FirestoreBlob.js +0 -107
  333. package/lib/FirestoreCollectionReference.js +0 -70
  334. package/lib/FirestoreDocumentReference.js +0 -222
  335. package/lib/FirestoreDocumentSnapshot.js +0 -132
  336. package/lib/FirestoreFilter.js +0 -156
  337. package/lib/modular/Bytes.d.ts +0 -11
  338. package/lib/modular/Bytes.js +0 -62
  339. package/lib/modular/FieldPath.d.ts +0 -20
  340. package/lib/modular/FieldPath.js +0 -7
  341. package/lib/modular/FieldValue.d.ts +0 -67
  342. package/lib/modular/FieldValue.js +0 -41
  343. package/lib/modular/GeoPoint.d.ts +0 -17
  344. package/lib/modular/GeoPoint.js +0 -3
  345. package/lib/modular/Timestamp.d.ts +0 -85
  346. package/lib/modular/Timestamp.js +0 -3
  347. package/lib/modular/VectorValue.d.ts +0 -30
  348. package/lib/modular/VectorValue.js +0 -11
  349. package/lib/modular/index.d.ts +0 -788
  350. package/lib/modular/index.js +0 -410
  351. package/lib/modular/query.d.ts +0 -370
  352. package/lib/modular/query.js +0 -233
  353. package/lib/modular/snapshot.d.ts +0 -256
  354. package/lib/modular/snapshot.js +0 -33
  355. package/lib/modular/utils/observer.js +0 -16
  356. package/lib/version.js +0 -2
  357. package/lib/web/query.js +0 -112
  358. /package/lib/web/{RNFBFirestoreModule.android.js → RNFBFirestoreModule.android.ts} +0 -0
  359. /package/lib/web/{RNFBFirestoreModule.ios.js → RNFBFirestoreModule.ios.ts} +0 -0
@@ -0,0 +1,411 @@
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 library 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 { isNumber } from '@react-native-firebase/app/dist/module/common';
19
+ import FieldPath, { DOCUMENT_ID } from './FieldPath';
20
+ import type {
21
+ DocumentFieldValueInternal,
22
+ FirestoreCursorFieldsInternal,
23
+ FirestoreFilterSpecInternal,
24
+ FirestoreOrderSpecInternal,
25
+ FirestoreQueryOptionsInternal,
26
+ } from './types/internal';
27
+ import { buildNativeArray, generateNativeData } from './utils/serialize';
28
+
29
+ export const OPERATORS: Record<string, string> = {
30
+ '==': 'EQUAL',
31
+ '>': 'GREATER_THAN',
32
+ '>=': 'GREATER_THAN_OR_EQUAL',
33
+ '<': 'LESS_THAN',
34
+ '<=': 'LESS_THAN_OR_EQUAL',
35
+ '!=': 'NOT_EQUAL',
36
+ 'array-contains': 'ARRAY_CONTAINS',
37
+ 'array-contains-any': 'ARRAY_CONTAINS_ANY',
38
+ 'not-in': 'NOT_IN',
39
+ in: 'IN',
40
+ };
41
+
42
+ const INEQUALITY: Record<string, boolean> = {
43
+ LESS_THAN: true,
44
+ LESS_THAN_OR_EQUAL: true,
45
+ GREATER_THAN: true,
46
+ GREATER_THAN_OR_EQUAL: true,
47
+ NOT_EQUAL: true,
48
+ };
49
+
50
+ const DIRECTIONS: Record<string, string> = {
51
+ asc: 'ASCENDING',
52
+ desc: 'DESCENDING',
53
+ };
54
+
55
+ export interface FilterDef {
56
+ fieldPath?: FieldPath | string[];
57
+ operator: string;
58
+ value?: DocumentFieldValueInternal;
59
+ queries?: FilterDef[];
60
+ }
61
+
62
+ export interface OrderDef {
63
+ fieldPath: FieldPath;
64
+ direction: string;
65
+ }
66
+
67
+ export default class QueryModifiers {
68
+ _limit: number | undefined;
69
+ _limitToLast: number | undefined;
70
+ _filters: FilterDef[];
71
+ _orders: OrderDef[];
72
+ _type: 'collection' | 'collectionGroup';
73
+ _startAt: FirestoreCursorFieldsInternal | undefined;
74
+ _startAfter: FirestoreCursorFieldsInternal | undefined;
75
+ _endAt: FirestoreCursorFieldsInternal | undefined;
76
+ _endBefore: FirestoreCursorFieldsInternal | undefined;
77
+
78
+ hasInequality: false | FilterDef;
79
+ hasNotEqual: boolean;
80
+ hasArrayContains: boolean;
81
+ hasArrayContainsAny: boolean;
82
+ hasIn: boolean;
83
+ hasNotIn: boolean;
84
+
85
+ constructor() {
86
+ this._limit = undefined;
87
+ this._limitToLast = undefined;
88
+ this._filters = [];
89
+ this._orders = [];
90
+ this._type = 'collection';
91
+ this._startAt = undefined;
92
+ this._startAfter = undefined;
93
+ this._endAt = undefined;
94
+ this._endBefore = undefined;
95
+
96
+ this.hasInequality = false;
97
+ this.hasNotEqual = false;
98
+ this.hasArrayContains = false;
99
+ this.hasArrayContainsAny = false;
100
+ this.hasIn = false;
101
+ this.hasNotIn = false;
102
+ }
103
+
104
+ _copy(): QueryModifiers {
105
+ const newInstance = new QueryModifiers();
106
+ newInstance._limit = this._limit;
107
+ newInstance._limitToLast = this._limitToLast;
108
+ newInstance._filters = [...this._filters];
109
+ newInstance._orders = [...this._orders];
110
+ newInstance._type = this._type;
111
+ newInstance._startAt = this._startAt;
112
+ newInstance._startAfter = this._startAfter;
113
+ newInstance._endAt = this._endAt;
114
+ newInstance._endBefore = this._endBefore;
115
+ return newInstance;
116
+ }
117
+
118
+ get filters(): FirestoreFilterSpecInternal[] {
119
+ return this._filters.map(f => ({
120
+ ...f,
121
+ fieldPath: f.fieldPath instanceof FieldPath ? f.fieldPath._toArray() : f.fieldPath,
122
+ }));
123
+ }
124
+
125
+ get orders(): FirestoreOrderSpecInternal[] {
126
+ return this._orders.map(f => ({
127
+ ...f,
128
+ fieldPath: f.fieldPath instanceof FieldPath ? f.fieldPath._toArray() : f.fieldPath,
129
+ }));
130
+ }
131
+
132
+ get options(): FirestoreQueryOptionsInternal {
133
+ const options: FirestoreQueryOptionsInternal = {};
134
+
135
+ if (this._limit) {
136
+ options.limit = this._limit;
137
+ }
138
+
139
+ if (this._limitToLast) {
140
+ options.limitToLast = this._limitToLast;
141
+ }
142
+
143
+ if (this._startAt) {
144
+ options.startAt = this._startAt;
145
+ }
146
+ if (this._startAfter) {
147
+ options.startAfter = this._startAfter;
148
+ }
149
+ if (this._endAt) {
150
+ options.endAt = this._endAt;
151
+ }
152
+ if (this._endBefore) {
153
+ options.endBefore = this._endBefore;
154
+ }
155
+
156
+ return options;
157
+ }
158
+
159
+ get type(): string {
160
+ return this._type;
161
+ }
162
+
163
+ setFieldsCursor(
164
+ cursor: 'startAt' | 'startAfter' | 'endAt' | 'endBefore',
165
+ fields: FirestoreCursorFieldsInternal,
166
+ ): this {
167
+ (this as unknown as Record<string, FirestoreCursorFieldsInternal | undefined>)[`_${cursor}`] =
168
+ buildNativeArray(fields);
169
+ return this;
170
+ }
171
+
172
+ hasStart(): boolean {
173
+ return !!(this._startAt || this._startAfter);
174
+ }
175
+
176
+ hasEnd(): boolean {
177
+ return !!(this._endAt || this._endBefore);
178
+ }
179
+
180
+ asCollectionGroupQuery(): this {
181
+ this._type = 'collectionGroup';
182
+ return this;
183
+ }
184
+
185
+ isCollectionGroupQuery(): boolean {
186
+ return this._type === 'collectionGroup';
187
+ }
188
+
189
+ isValidLimit(limit: unknown): boolean {
190
+ return !isNumber(limit) || Math.floor(limit as number) !== limit || (limit as number) <= 0;
191
+ }
192
+
193
+ limit(limit: number): this {
194
+ this._limitToLast = undefined;
195
+ this._limit = limit;
196
+ return this;
197
+ }
198
+
199
+ isValidLimitToLast(limit: unknown): boolean {
200
+ return !isNumber(limit) || Math.floor(limit as number) !== limit || (limit as number) <= 0;
201
+ }
202
+
203
+ validatelimitToLast(): void {
204
+ if (this._limitToLast) {
205
+ if (!this._orders.length) {
206
+ throw new Error(
207
+ 'firebase.firestore().collection().limitToLast() queries require specifying at least one firebase.firestore().collection().orderBy() clause',
208
+ );
209
+ }
210
+ }
211
+ }
212
+
213
+ limitToLast(limitToLast: number): this {
214
+ this._limit = undefined;
215
+ this._limitToLast = limitToLast;
216
+ return this;
217
+ }
218
+
219
+ isValidOperator(operator: string): boolean {
220
+ return !!OPERATORS[operator];
221
+ }
222
+
223
+ isEqualOperator(operator: string): boolean {
224
+ return OPERATORS[operator] === 'EQUAL';
225
+ }
226
+
227
+ isNotEqualOperator(operator: string): boolean {
228
+ return OPERATORS[operator] === 'NOT_EQUAL';
229
+ }
230
+
231
+ isInOperator(operator: string): boolean {
232
+ return (
233
+ OPERATORS[operator] === 'IN' ||
234
+ OPERATORS[operator] === 'ARRAY_CONTAINS_ANY' ||
235
+ OPERATORS[operator] === 'NOT_IN'
236
+ );
237
+ }
238
+
239
+ where(fieldPath: FieldPath, opStr: string, value: DocumentFieldValueInternal): this {
240
+ const filter: FilterDef = {
241
+ fieldPath,
242
+ operator: OPERATORS[opStr] ?? opStr,
243
+ value: generateNativeData(value, true),
244
+ };
245
+
246
+ this._filters = this._filters.concat(filter);
247
+ return this;
248
+ }
249
+
250
+ filterWhere(filter: FilterDef): this {
251
+ this._filters = this._filters.concat(filter);
252
+ return this;
253
+ }
254
+
255
+ validateWhere(): void {
256
+ if (this._filters.length > 0) {
257
+ this._filterCheck(this._filters);
258
+ }
259
+ }
260
+
261
+ _filterCheck(filters: FilterDef[]): void {
262
+ for (let i = 0; i < filters.length; i++) {
263
+ const filter = filters[i]!;
264
+
265
+ if (filter.queries) {
266
+ this._filterCheck(filter.queries as FilterDef[]);
267
+ continue;
268
+ }
269
+
270
+ if (!INEQUALITY[filter.operator]) {
271
+ continue;
272
+ }
273
+
274
+ if (filter.operator === OPERATORS['!=']) {
275
+ if (this.hasNotEqual) {
276
+ throw new Error("Invalid query. You cannot use more than one '!=' inequality filter.");
277
+ }
278
+ this.hasNotEqual = true;
279
+ }
280
+
281
+ if (!this.hasInequality) {
282
+ this.hasInequality = filter;
283
+ continue;
284
+ }
285
+ }
286
+
287
+ for (let i = 0; i < filters.length; i++) {
288
+ const filter = filters[i]!;
289
+
290
+ if (filter.operator === OPERATORS['array-contains']) {
291
+ if (this.hasArrayContains) {
292
+ throw new Error('Invalid query. Queries only support a single array-contains filter.');
293
+ }
294
+ this.hasArrayContains = true;
295
+ }
296
+
297
+ if (filter.operator === OPERATORS['array-contains-any']) {
298
+ if (this.hasArrayContainsAny) {
299
+ throw new Error(
300
+ "Invalid query. You cannot use more than one 'array-contains-any' filter.",
301
+ );
302
+ }
303
+
304
+ if (this.hasNotIn) {
305
+ throw new Error(
306
+ "Invalid query. You cannot use 'array-contains-any' filters with 'not-in' filters.",
307
+ );
308
+ }
309
+
310
+ this.hasArrayContainsAny = true;
311
+ }
312
+
313
+ if (filter.operator === OPERATORS.in) {
314
+ if (this.hasNotIn) {
315
+ throw new Error("Invalid query. You cannot use 'in' filters with 'not-in' filters.");
316
+ }
317
+
318
+ this.hasIn = true;
319
+ }
320
+
321
+ if (filter.operator === OPERATORS['not-in']) {
322
+ if (this.hasNotIn) {
323
+ throw new Error("Invalid query. You cannot use more than one 'not-in' filter.");
324
+ }
325
+
326
+ if (this.hasNotEqual) {
327
+ throw new Error(
328
+ "Invalid query. You cannot use 'not-in' filters with '!=' inequality filters",
329
+ );
330
+ }
331
+
332
+ if (this.hasIn) {
333
+ throw new Error("Invalid query. You cannot use 'not-in' filters with 'in' filters.");
334
+ }
335
+
336
+ if (this.hasArrayContainsAny) {
337
+ throw new Error(
338
+ "Invalid query. You cannot use 'not-in' filters with 'array-contains-any' filters.",
339
+ );
340
+ }
341
+
342
+ this.hasNotIn = true;
343
+ }
344
+ }
345
+ }
346
+
347
+ isValidDirection(directionStr: string): boolean {
348
+ return !!DIRECTIONS[directionStr.toLowerCase()];
349
+ }
350
+
351
+ orderBy(fieldPath: FieldPath, directionStr?: string): this {
352
+ const dir = directionStr ? DIRECTIONS[directionStr.toLowerCase()] : DIRECTIONS.asc;
353
+ const order: OrderDef = {
354
+ fieldPath: fieldPath,
355
+ direction: dir ?? 'ASCENDING',
356
+ };
357
+
358
+ this._orders = this._orders.concat(order);
359
+ return this;
360
+ }
361
+
362
+ validateOrderBy(): void {
363
+ this._validateOrderByCheck(this._filters);
364
+ }
365
+
366
+ _validateOrderByCheck(filters: FilterDef[]): void {
367
+ if (this._orders.length > 1) {
368
+ const orders = this._orders.map($ => $.fieldPath._toPath());
369
+ const set = new Set(orders);
370
+
371
+ if (set.size !== orders.length) {
372
+ throw new Error('Invalid query. Order by clause cannot contain duplicate fields.');
373
+ }
374
+ }
375
+
376
+ if (filters.length === 0) {
377
+ return;
378
+ }
379
+
380
+ for (let i = 0; i < filters.length; i++) {
381
+ const filter = filters[i]!;
382
+
383
+ if (filter.queries) {
384
+ this._validateOrderByCheck(filter.queries as FilterDef[]);
385
+ continue;
386
+ }
387
+ const filterFieldPath = (filter.fieldPath as FieldPath)._toPath();
388
+
389
+ for (let k = 0; k < this._orders.length; k++) {
390
+ const order = this._orders[k]!;
391
+ const orderFieldPath = order.fieldPath;
392
+ if (filter.operator === OPERATORS['==']) {
393
+ if (filterFieldPath === orderFieldPath._toPath()) {
394
+ throw new Error(
395
+ `Invalid query. Query.orderBy() parameter: ${orderFieldPath} cannot be the same as your Query.where() fieldPath parameter: ${filterFieldPath}`,
396
+ );
397
+ }
398
+ }
399
+
400
+ if (
401
+ filterFieldPath === DOCUMENT_ID._toPath() &&
402
+ orderFieldPath._toPath() !== DOCUMENT_ID._toPath()
403
+ ) {
404
+ throw new Error(
405
+ "Invalid query. Query.where() fieldPath parameter: 'FirestoreFieldPath' cannot be used in conjunction with a different Query.orderBy() parameter",
406
+ );
407
+ }
408
+ }
409
+ }
410
+ }
411
+ }
@@ -16,49 +16,86 @@
16
16
  */
17
17
 
18
18
  import {
19
+ createDeprecationProxy,
19
20
  isBoolean,
20
21
  isFunction,
21
22
  isObject,
22
23
  isUndefined,
23
- createDeprecationProxy,
24
24
  } from '@react-native-firebase/app/dist/module/common';
25
- import FirestoreDocumentChange from './FirestoreDocumentChange';
26
- import FirestoreDocumentSnapshot from './FirestoreDocumentSnapshot';
27
- import FirestoreSnapshotMetadata from './FirestoreSnapshotMetadata';
25
+ import DocumentChange from './FirestoreDocumentChange';
26
+ import DocumentSnapshot from './FirestoreDocumentSnapshot';
27
+ import SnapshotMetadata from './FirestoreSnapshotMetadata';
28
+
29
+ import type Query from './FirestoreQuery';
30
+ import type { DocumentData, FirestoreDataConverter } from './types/firestore';
31
+ import type { FirestoreInternal } from './types/internal';
32
+
33
+ export interface QuerySnapshotNativeData {
34
+ source?: string;
35
+ excludesMetadataChanges?: boolean;
36
+ changes: Array<{
37
+ type: string;
38
+ doc: { path: string; data?: unknown; metadata?: [boolean, boolean]; exists?: boolean };
39
+ ni: number;
40
+ oi: number;
41
+ isMetadataChange?: boolean;
42
+ }>;
43
+ documents: Array<{
44
+ path: string;
45
+ data?: unknown;
46
+ metadata?: [boolean, boolean];
47
+ exists?: boolean;
48
+ }>;
49
+ metadata: [boolean, boolean];
50
+ }
28
51
 
29
- export default class FirestoreQuerySnapshot {
30
- constructor(firestore, query, nativeData) {
52
+ export default class QuerySnapshot {
53
+ _query: Query;
54
+ _source: string | undefined;
55
+ _excludesMetadataChanges: boolean | undefined;
56
+ _changes: DocumentChange[];
57
+ _docs: DocumentSnapshot[];
58
+ _metadata: SnapshotMetadata;
59
+
60
+ constructor(
61
+ firestore: FirestoreInternal,
62
+ query: Query,
63
+ nativeData: QuerySnapshotNativeData,
64
+ converter: FirestoreDataConverter<DocumentData, DocumentData> | null,
65
+ ) {
31
66
  this._query = query;
32
67
  this._source = nativeData.source;
33
68
  this._excludesMetadataChanges = nativeData.excludesMetadataChanges;
34
- this._changes = nativeData.changes.map($ => new FirestoreDocumentChange(firestore, $));
35
- this._docs = nativeData.documents.map($ =>
36
- createDeprecationProxy(new FirestoreDocumentSnapshot(firestore, $)),
69
+ this._changes = nativeData.changes.map(
70
+ (c: QuerySnapshotNativeData['changes'][0]) => new DocumentChange(firestore, c, converter),
37
71
  );
38
- this._metadata = new FirestoreSnapshotMetadata(nativeData.metadata);
72
+ this._docs = nativeData.documents.map((doc: QuerySnapshotNativeData['documents'][0]) =>
73
+ createDeprecationProxy(new DocumentSnapshot(firestore, doc, converter)),
74
+ ) as DocumentSnapshot[];
75
+ this._metadata = new SnapshotMetadata(nativeData.metadata ?? [false, false]);
39
76
  }
40
77
 
41
- get docs() {
78
+ get docs(): DocumentSnapshot[] {
42
79
  return this._docs;
43
80
  }
44
81
 
45
- get empty() {
82
+ get empty(): boolean {
46
83
  return this._docs.length === 0;
47
84
  }
48
85
 
49
- get metadata() {
86
+ get metadata(): SnapshotMetadata {
50
87
  return this._metadata;
51
88
  }
52
89
 
53
- get query() {
90
+ get query(): Query {
54
91
  return this._query;
55
92
  }
56
93
 
57
- get size() {
94
+ get size(): number {
58
95
  return this._docs.length;
59
96
  }
60
97
 
61
- docChanges(options) {
98
+ docChanges(options?: { includeMetadataChanges?: boolean }): DocumentChange[] {
62
99
  if (!isUndefined(options) && !isObject(options)) {
63
100
  throw new Error(
64
101
  "firebase.firestore() QuerySnapshot.docChanges(*) 'options' expected an object.",
@@ -74,10 +111,9 @@ export default class FirestoreQuerySnapshot {
74
111
  );
75
112
  }
76
113
 
77
- includeMetaDataChanges = options.includeMetadataChanges;
114
+ includeMetaDataChanges = options.includeMetadataChanges ?? false;
78
115
  }
79
116
 
80
- // A get query should always return the document changes from native
81
117
  if (this._source === 'get') {
82
118
  return this._changes;
83
119
  }
@@ -89,16 +125,14 @@ export default class FirestoreQuerySnapshot {
89
125
  }
90
126
 
91
127
  return this._changes.filter($ => {
92
- // Remove all changes that have come from metadata changes list
93
128
  if (!includeMetaDataChanges) {
94
129
  return $._isMetadataChange === false;
95
130
  }
96
-
97
131
  return true;
98
132
  });
99
133
  }
100
134
 
101
- forEach(callback, thisArg) {
135
+ forEach(callback: (doc: DocumentSnapshot, index: number) => void, thisArg?: unknown): void {
102
136
  if (!isFunction(callback)) {
103
137
  throw new Error(
104
138
  "firebase.firestore() QuerySnapshot.forEach(*) 'callback' expected a function.",
@@ -108,19 +142,17 @@ export default class FirestoreQuerySnapshot {
108
142
  const cb = thisArg ? callback.bind(thisArg) : callback;
109
143
 
110
144
  for (let i = 0; i < this._docs.length; i++) {
111
- cb(this._docs[i], i);
145
+ cb(this._docs[i]!, i);
112
146
  }
113
147
  }
114
148
 
115
- // send '...args' through as it may contain our namespace deprecation marker
116
- isEqual(other, ...args) {
117
- if (!(other instanceof FirestoreQuerySnapshot)) {
149
+ isEqual(other: QuerySnapshot, ...args: unknown[]): boolean {
150
+ if (!(other instanceof QuerySnapshot)) {
118
151
  throw new Error(
119
152
  "firebase.firestore() QuerySnapshot.isEqual(*) 'other' expected a QuerySnapshot instance.",
120
153
  );
121
154
  }
122
155
 
123
- // Simple checks first
124
156
  if (
125
157
  this.empty !== other.empty ||
126
158
  this.size !== other.size ||
@@ -129,14 +161,11 @@ export default class FirestoreQuerySnapshot {
129
161
  return false;
130
162
  }
131
163
 
132
- // Expensive check
133
- // Each doc must be in order & have the same data
134
164
  for (let i = 0; i < this.docs.length; i++) {
135
- const thisDoc = this.docs[i];
136
- const otherDoc = other.docs[i];
165
+ const thisDoc = this.docs[i]!;
166
+ const otherDoc = other.docs[i]!;
137
167
 
138
- // send '...args' through as it may contain our namespace deprecation marker
139
- if (!thisDoc.isEqual(otherDoc, ...args)) {
168
+ if (!(thisDoc.isEqual as (...a: unknown[]) => boolean)(otherDoc, ...args)) {
140
169
  return false;
141
170
  }
142
171
  }
@@ -17,21 +17,23 @@
17
17
 
18
18
  import { isUndefined } from '@react-native-firebase/app/dist/module/common';
19
19
 
20
- export default class FirestoreSnapshotMetadata {
21
- constructor(metadata) {
20
+ export default class SnapshotMetadata {
21
+ _metadata: [boolean, boolean];
22
+
23
+ constructor(metadata: [boolean, boolean]) {
22
24
  this._metadata = metadata;
23
25
  }
24
26
 
25
- get fromCache() {
27
+ get fromCache(): boolean {
26
28
  return this._metadata[0];
27
29
  }
28
30
 
29
- get hasPendingWrites() {
31
+ get hasPendingWrites(): boolean {
30
32
  return this._metadata[1];
31
33
  }
32
34
 
33
- isEqual(other) {
34
- if (isUndefined(other) || !(other instanceof FirestoreSnapshotMetadata)) {
35
+ isEqual(other: SnapshotMetadata): boolean {
36
+ if (isUndefined(other) || !(other instanceof SnapshotMetadata)) {
35
37
  throw new Error(
36
38
  "firebase.firestore() SnapshotMetadata.isEqual(*) 'other' expected instance of SnapshotMetadata",
37
39
  );
@@ -17,35 +17,42 @@
17
17
 
18
18
  import { createDeprecationProxy } from '@react-native-firebase/app/dist/module/common';
19
19
  import { getReactNativeModule } from '@react-native-firebase/app/dist/module/internal/nativeModule';
20
- import FirestoreBlob from './FirestoreBlob';
21
- import FirestoreFieldPath from './FirestoreFieldPath';
22
- import FirestoreFieldValue from './FirestoreFieldValue';
20
+ import Blob from './FirestoreBlob';
21
+ import FieldPath from './FieldPath';
22
+ import FieldValue from './FieldValue';
23
+ import { Filter } from './FirestoreFilter';
23
24
  import FirestoreGeoPoint from './FirestoreGeoPoint';
24
25
  import FirestoreTimestamp from './FirestoreTimestamp';
25
- import { Filter } from './FirestoreFilter';
26
26
  import FirestoreVectorValue from './FirestoreVectorValue';
27
- export default {
28
- Blob: FirestoreBlob,
29
- FieldPath: FirestoreFieldPath,
30
- FieldValue: createDeprecationProxy(FirestoreFieldValue),
27
+ import type { LogLevel } from './types/firestore';
28
+ import type { RNFBFirestoreModule } from './types/internal';
29
+
30
+ type FirestoreLogLevel = LogLevel;
31
+
32
+ const FirestoreStatics = {
33
+ Blob: Blob,
34
+ FieldPath: FieldPath,
35
+ FieldValue: createDeprecationProxy(FieldValue),
31
36
  GeoPoint: FirestoreGeoPoint,
32
37
  Timestamp: createDeprecationProxy(FirestoreTimestamp),
33
38
  Filter: createDeprecationProxy(Filter),
34
39
  VectorValue: FirestoreVectorValue,
35
- vector(values) {
40
+ vector(values?: number[]): FirestoreVectorValue {
36
41
  return new FirestoreVectorValue(values);
37
42
  },
38
43
 
39
44
  CACHE_SIZE_UNLIMITED: -1,
40
45
 
41
- setLogLevel(logLevel) {
46
+ setLogLevel(logLevel: FirestoreLogLevel): void {
42
47
  if (logLevel !== 'debug' && logLevel !== 'error' && logLevel !== 'silent') {
43
48
  throw new Error(
44
49
  "firebase.firestore.setLogLevel(*) 'logLevel' expected one of 'debug', 'error' or 'silent'",
45
50
  );
46
51
  }
47
52
 
48
- const native = getReactNativeModule('RNFBFirestoreModule');
53
+ const native = getReactNativeModule('RNFBFirestoreModule') as unknown as RNFBFirestoreModule;
49
54
  native.setLogLevel(logLevel);
50
55
  },
51
56
  };
57
+
58
+ export default FirestoreStatics;