@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,526 @@
1
+ "use strict";
2
+
3
+ /*
4
+ * Copyright (c) 2016-present Invertase Limited & Contributors
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this library except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ *
18
+ */
19
+
20
+ import { isArray, isIOS, isNumber, isObject, isString, isUndefined } from '@react-native-firebase/app/dist/module/common';
21
+ import FirestorePath from "../FirestorePath.js";
22
+ import FirestoreTimestamp from "../FirestoreTimestamp.js";
23
+ import DocumentReferenceClass from "../FirestoreDocumentReference.js";
24
+ import FieldPath, { fromDotSeparatedString } from "../FieldPath.js";
25
+ import { extractFieldPathData } from "../utils/index.js";
26
+ import { parseNativeMap } from "../utils/serialize.js";
27
+ import { getFirestore } from "../modular.js";
28
+ import { getIOSUnsupportedPipelineFunctions } from "./pipeline_support.js";
29
+ import { validateExecuteOptions, validateSerializedPipeline } from "./pipeline_validate.js";
30
+ const PIPELINE_RUNTIME_SYMBOL = Symbol.for('RNFBFirestorePipelineRuntime');
31
+ const PIPELINE_RUNTIME_INSTALLER_SYMBOL = Symbol.for('RNFBFirestorePipelineRuntimeInstaller');
32
+ function isRuntimePipeline(value) {
33
+ return isObject(value) && value[PIPELINE_RUNTIME_SYMBOL] === true;
34
+ }
35
+ function isRecord(value) {
36
+ return isObject(value) && !isArray(value);
37
+ }
38
+ function hasAnyKey(value, keys) {
39
+ return keys.some(key => Object.prototype.hasOwnProperty.call(value, key));
40
+ }
41
+ function assertSameFirestoreInstance(actual, expected, method) {
42
+ if (actual !== expected) {
43
+ throw new Error(`firebase.firestore().pipeline().${method}(*) cannot use a reference from a different Firestore instance.`);
44
+ }
45
+ }
46
+ function getFirestoreReference(value) {
47
+ if (isRecord(value) && isRecord(value.firestore) && isString(value.path) && value.path.length > 0) {
48
+ return {
49
+ firestore: value.firestore,
50
+ path: value.path
51
+ };
52
+ }
53
+ return undefined;
54
+ }
55
+ function parseTimestamp(value) {
56
+ if (value instanceof FirestoreTimestamp) {
57
+ return value;
58
+ }
59
+ if (isNumber(value)) {
60
+ return FirestoreTimestamp.fromMillis(value);
61
+ }
62
+ if (isArray(value)) {
63
+ const seconds = Number(value[0] ?? 0);
64
+ const nanoseconds = Number(value[1] ?? 0);
65
+ return new FirestoreTimestamp(seconds, nanoseconds);
66
+ }
67
+ if (isRecord(value)) {
68
+ const seconds = Number(value.seconds ?? 0);
69
+ const nanoseconds = Number(value.nanoseconds ?? 0);
70
+ return new FirestoreTimestamp(seconds, nanoseconds);
71
+ }
72
+ return undefined;
73
+ }
74
+ function getNativeTypeMapArray(value) {
75
+ if (isArray(value) && value.length > 0 && isNumber(value[0])) {
76
+ return value;
77
+ }
78
+ if (isRecord(value) && isNumber(value[0])) {
79
+ return [value[0], value[1]];
80
+ }
81
+ return undefined;
82
+ }
83
+ function isNativeTypeMapValue(value) {
84
+ return getNativeTypeMapArray(value) !== undefined;
85
+ }
86
+ function isNativeTypeMapObject(value) {
87
+ if (!isRecord(value)) {
88
+ return false;
89
+ }
90
+ const values = Object.values(value);
91
+ if (values.length === 0) {
92
+ return true;
93
+ }
94
+ return values.every(isNativeTypeMapValue);
95
+ }
96
+ function fieldPathToSegments(fieldPath) {
97
+ if (isString(fieldPath)) {
98
+ return fromDotSeparatedString(fieldPath)._segments;
99
+ }
100
+ if (fieldPath instanceof FieldPath) {
101
+ return fieldPath._segments;
102
+ }
103
+ if (isRecord(fieldPath) && isString(fieldPath.path)) {
104
+ return fromDotSeparatedString(fieldPath.path)._segments;
105
+ }
106
+ throw new Error("firebase.firestore().pipeline().execute().result.get(*) 'fieldPath' must be a string, FieldPath, or field().");
107
+ }
108
+ class RuntimePipelineResult {
109
+ constructor(firestore, nativeResult) {
110
+ if (isNativeTypeMapObject(nativeResult.data)) {
111
+ const normalizedData = Object.fromEntries(Object.entries(nativeResult.data ?? {}).map(([key, value]) => [key, getNativeTypeMapArray(value) ?? value]));
112
+ this._data = parseNativeMap(firestore, normalizedData);
113
+ } else {
114
+ this._data = nativeResult.data ?? {};
115
+ }
116
+ if (isString(nativeResult.path)) {
117
+ this.ref = new DocumentReferenceClass(firestore, FirestorePath.fromName(nativeResult.path));
118
+ }
119
+ this.id = isString(nativeResult.id) ? nativeResult.id : this.ref?.id;
120
+ this.createTime = parseTimestamp(nativeResult.createTime);
121
+ this.updateTime = parseTimestamp(nativeResult.updateTime);
122
+ }
123
+ data() {
124
+ return this._data;
125
+ }
126
+ get(fieldPath) {
127
+ return extractFieldPathData(this._data, fieldPathToSegments(fieldPath));
128
+ }
129
+ }
130
+ function serializeValue(value, visiting) {
131
+ if (value instanceof FirestoreTimestamp) {
132
+ return {
133
+ seconds: value.seconds,
134
+ nanoseconds: value.nanoseconds
135
+ };
136
+ }
137
+ if (value instanceof FieldPath) {
138
+ return {
139
+ segments: value._toArray()
140
+ };
141
+ }
142
+ if (isRuntimePipeline(value)) {
143
+ return value.serialize(visiting);
144
+ }
145
+ if (isArray(value)) {
146
+ return value.map(entry => serializeValue(entry, visiting));
147
+ }
148
+ if (isRecord(value)) {
149
+ if (visiting.has(value)) {
150
+ throw new Error('firebase.firestore().pipeline() failed to serialize arguments because of a circular value.');
151
+ }
152
+
153
+ // Explicit wire format for aliased expressions so native (Android) always receives expr, alias, as.
154
+ const rec = value;
155
+ if (rec.__kind === 'aliasedExpression' && rec.expr !== undefined && rec.alias !== undefined) {
156
+ visiting.add(value);
157
+ const inner = rec.expr;
158
+ // Flat form for simple field path: { path, alias, as } so native does not need to parse nested expr.
159
+ if (inner && typeof inner === 'object' && (inner.__kind === 'expression' || inner.exprType === 'Field') && typeof inner.path === 'string' && inner.path.length > 0) {
160
+ visiting.delete(value);
161
+ return {
162
+ path: inner.path,
163
+ alias: rec.alias,
164
+ as: rec.alias
165
+ };
166
+ }
167
+ const result = {
168
+ expr: serializeValue(rec.expr, visiting),
169
+ alias: rec.alias,
170
+ as: rec.alias
171
+ };
172
+ visiting.delete(value);
173
+ return result;
174
+ }
175
+
176
+ // Convert document/collection references to a stable path representation.
177
+ if (isString(value.path) && isObject(value.firestore)) {
178
+ return {
179
+ path: value.path
180
+ };
181
+ }
182
+ visiting.add(value);
183
+ const output = {};
184
+ const entries = Object.entries(value);
185
+ for (const [key, entryValue] of entries) {
186
+ if (!isUndefined(entryValue)) {
187
+ output[key] = serializeValue(entryValue, visiting);
188
+ }
189
+ }
190
+ visiting.delete(value);
191
+ // Ensure aliased expressions have both "alias" and "as" for native (e.g. Android coerceSelectable).
192
+ if (typeof output.alias !== 'undefined' && (typeof output.expr !== 'undefined' || output.__kind === 'aliasedExpression')) {
193
+ output.as = output.alias;
194
+ }
195
+ return output;
196
+ }
197
+ return value;
198
+ }
199
+ function ensureNonEmptyString(path, method) {
200
+ if (!isString(path) || path.length === 0) {
201
+ throw new Error(`firebase.firestore().pipeline().${method}(*) expected a non-empty string.`);
202
+ }
203
+ return path;
204
+ }
205
+ function asQueryInternals(query) {
206
+ return query;
207
+ }
208
+ class RuntimePipelineImpl {
209
+ [PIPELINE_RUNTIME_SYMBOL] = true;
210
+ constructor(firestore, source, stages = []) {
211
+ this.firestore = firestore;
212
+ this._source = source;
213
+ this._stages = stages;
214
+ }
215
+ append(stage, options) {
216
+ return new RuntimePipelineImpl(this.firestore, this._source, [...this._stages, {
217
+ stage,
218
+ options
219
+ }]);
220
+ }
221
+ serialize(visiting = new WeakSet()) {
222
+ if (visiting.has(this)) {
223
+ throw new Error('firebase.firestore().pipeline() cannot union a pipeline with itself.');
224
+ }
225
+ visiting.add(this);
226
+ const stages = this._stages.map(stage => ({
227
+ stage: stage.stage,
228
+ options: serializeValue(stage.options, visiting)
229
+ }));
230
+ const source = serializeValue(this._source, visiting);
231
+ visiting.delete(this);
232
+ return {
233
+ source,
234
+ stages
235
+ };
236
+ }
237
+ where(conditionOrOptions) {
238
+ const condition = isRecord(conditionOrOptions) && hasAnyKey(conditionOrOptions, ['condition']) ? conditionOrOptions.condition : conditionOrOptions;
239
+ return this.append('where', {
240
+ condition
241
+ });
242
+ }
243
+ select(...selectionOrOptions) {
244
+ const first = selectionOrOptions[0];
245
+ const selections = selectionOrOptions.length === 1 && isRecord(first) && hasAnyKey(first, ['selection', 'selections']) ? (first.selection ?? first.selections) || [] : selectionOrOptions;
246
+ return this.append('select', {
247
+ selections
248
+ });
249
+ }
250
+ addFields(...fieldOrOptions) {
251
+ const first = fieldOrOptions[0];
252
+ const fields = fieldOrOptions.length === 1 && isRecord(first) && hasAnyKey(first, ['field', 'fields']) ? (first.field ?? first.fields) || [] : fieldOrOptions;
253
+ return this.append('addFields', {
254
+ fields
255
+ });
256
+ }
257
+ removeFields(...fieldOrOptions) {
258
+ const first = fieldOrOptions[0];
259
+ const fields = fieldOrOptions.length === 1 && isRecord(first) && hasAnyKey(first, ['field', 'fields']) ? (first.field ?? first.fields) || [] : fieldOrOptions;
260
+ return this.append('removeFields', {
261
+ fields
262
+ });
263
+ }
264
+ sort(...orderingOrOptions) {
265
+ const first = orderingOrOptions[0];
266
+ const orderings = orderingOrOptions.length === 1 && isRecord(first) && hasAnyKey(first, ['ordering', 'orderings']) ? (first.ordering ?? first.orderings) || [] : orderingOrOptions;
267
+ return this.append('sort', {
268
+ orderings
269
+ });
270
+ }
271
+ limit(nOrOptions) {
272
+ const limit = isNumber(nOrOptions) ? nOrOptions : Number(nOrOptions.n ?? nOrOptions.limit ?? 0);
273
+ return this.append('limit', {
274
+ limit
275
+ });
276
+ }
277
+ offset(nOrOptions) {
278
+ const offset = isNumber(nOrOptions) ? nOrOptions : Number(nOrOptions.n ?? nOrOptions.offset ?? 0);
279
+ return this.append('offset', {
280
+ offset
281
+ });
282
+ }
283
+ aggregate(...accumulatorOrOptions) {
284
+ const first = accumulatorOrOptions[0];
285
+ const isOptionsRecord = accumulatorOrOptions.length === 1 && isRecord(first) && hasAnyKey(first, ['accumulators', 'accumulator', 'groups', 'group']);
286
+ const accumulators = isOptionsRecord ? (first.accumulators ?? first.accumulator) || [] : accumulatorOrOptions;
287
+ const groups = isOptionsRecord ? first.groups ?? first.group : undefined;
288
+ return this.append('aggregate', {
289
+ accumulators,
290
+ groups
291
+ });
292
+ }
293
+ distinct(...groupOrOptions) {
294
+ const first = groupOrOptions[0];
295
+ const groups = groupOrOptions.length === 1 && isRecord(first) && hasAnyKey(first, ['groups', 'group']) ? (first.groups ?? first.group) || [] : groupOrOptions;
296
+ return this.append('distinct', {
297
+ groups
298
+ });
299
+ }
300
+ findNearest(options) {
301
+ return this.append('findNearest', options);
302
+ }
303
+ replaceWith(fieldNameOrExprOrOptions) {
304
+ if (isString(fieldNameOrExprOrOptions)) {
305
+ return this.append('replaceWith', {
306
+ map: fieldNameOrExprOrOptions
307
+ });
308
+ }
309
+ if (isRecord(fieldNameOrExprOrOptions) && hasAnyKey(fieldNameOrExprOrOptions, ['map', 'expr', 'fieldName'])) {
310
+ const map = fieldNameOrExprOrOptions.map ?? fieldNameOrExprOrOptions.expr ?? fieldNameOrExprOrOptions.fieldName;
311
+ return this.append('replaceWith', {
312
+ map
313
+ });
314
+ }
315
+ return this.append('replaceWith', {
316
+ map: fieldNameOrExprOrOptions
317
+ });
318
+ }
319
+ sample(nOrOptions) {
320
+ if (isNumber(nOrOptions)) {
321
+ return this.append('sample', {
322
+ documents: nOrOptions
323
+ });
324
+ }
325
+ return this.append('sample', nOrOptions);
326
+ }
327
+ union(otherOrOptions) {
328
+ const other = isRuntimePipeline(otherOrOptions) ? otherOrOptions : otherOrOptions.pipeline;
329
+ if (!other || !isRuntimePipeline(other)) {
330
+ throw new Error('firebase.firestore().pipeline().union(*) expected a pipeline created from firestore.pipeline().');
331
+ }
332
+ if (other.firestore !== this.firestore) {
333
+ throw new Error('firebase.firestore().pipeline().union(*) cannot combine pipelines from different Firestore instances.');
334
+ }
335
+ return this.append('union', {
336
+ other
337
+ });
338
+ }
339
+ unnest(selectableOrOptions, indexField) {
340
+ const isOptionsObject = isRecord(selectableOrOptions) && (Object.prototype.hasOwnProperty.call(selectableOrOptions, 'indexField') || Object.prototype.hasOwnProperty.call(selectableOrOptions, 'selectable') && !hasAnyKey(selectableOrOptions, ['__kind', 'exprType', 'path', 'name', 'args', 'alias']));
341
+ if (isOptionsObject) {
342
+ return this.append('unnest', selectableOrOptions);
343
+ }
344
+ return this.append('unnest', {
345
+ selectable: selectableOrOptions,
346
+ indexField
347
+ });
348
+ }
349
+ rawStage(name, params, options) {
350
+ return this.append('rawStage', {
351
+ name,
352
+ params,
353
+ options: options ?? {}
354
+ });
355
+ }
356
+ }
357
+ class RuntimePipelineSourceImpl {
358
+ constructor(firestore) {
359
+ this._firestore = firestore;
360
+ }
361
+ collection(pathOrCollectionRefOrOptions) {
362
+ if (isString(pathOrCollectionRefOrOptions)) {
363
+ return new RuntimePipelineImpl(this._firestore, {
364
+ source: 'collection',
365
+ path: ensureNonEmptyString(pathOrCollectionRefOrOptions, 'collection')
366
+ });
367
+ }
368
+ if (!isRecord(pathOrCollectionRefOrOptions)) {
369
+ throw new Error('firebase.firestore().pipeline().collection(*) expected a path, CollectionReference, or options object.');
370
+ }
371
+ const collectionRef = getFirestoreReference(pathOrCollectionRefOrOptions.collectionRef) ?? getFirestoreReference(pathOrCollectionRefOrOptions);
372
+ if (collectionRef) {
373
+ assertSameFirestoreInstance(collectionRef.firestore, this._firestore, 'collection');
374
+ }
375
+ const path = isString(pathOrCollectionRefOrOptions.path) ? pathOrCollectionRefOrOptions.path : isRecord(pathOrCollectionRefOrOptions.collectionRef) && isString(pathOrCollectionRefOrOptions.collectionRef.path) ? pathOrCollectionRefOrOptions.collectionRef.path : undefined;
376
+ return new RuntimePipelineImpl(this._firestore, {
377
+ source: 'collection',
378
+ path: ensureNonEmptyString(path, 'collection'),
379
+ rawOptions: isRecord(pathOrCollectionRefOrOptions.rawOptions) ? pathOrCollectionRefOrOptions.rawOptions : undefined
380
+ });
381
+ }
382
+ collectionGroup(collectionIdOrOptions) {
383
+ if (isString(collectionIdOrOptions)) {
384
+ return new RuntimePipelineImpl(this._firestore, {
385
+ source: 'collectionGroup',
386
+ collectionId: ensureNonEmptyString(collectionIdOrOptions, 'collectionGroup')
387
+ });
388
+ }
389
+ if (!isRecord(collectionIdOrOptions)) {
390
+ throw new Error('firebase.firestore().pipeline().collectionGroup(*) expected a collectionId string or options object.');
391
+ }
392
+ return new RuntimePipelineImpl(this._firestore, {
393
+ source: 'collectionGroup',
394
+ collectionId: ensureNonEmptyString(collectionIdOrOptions.collectionId, 'collectionGroup'),
395
+ rawOptions: isRecord(collectionIdOrOptions.rawOptions) ? collectionIdOrOptions.rawOptions : undefined
396
+ });
397
+ }
398
+ database(options) {
399
+ return new RuntimePipelineImpl(this._firestore, {
400
+ source: 'database',
401
+ rawOptions: isRecord(options?.rawOptions) ? options.rawOptions : undefined
402
+ });
403
+ }
404
+ documents(docsOrOptions) {
405
+ const docs = isArray(docsOrOptions) ? docsOrOptions : (docsOrOptions.docs ?? docsOrOptions.documents) || [];
406
+ if (!isArray(docs) || docs.length === 0) {
407
+ throw new Error('firebase.firestore().pipeline().documents(*) expected at least one document path or DocumentReference.');
408
+ }
409
+ const documents = docs.map((doc, index) => {
410
+ if (isString(doc) && doc.length > 0) {
411
+ return doc;
412
+ }
413
+ if (isRecord(doc) && isString(doc.path) && doc.path.length > 0) {
414
+ const documentRef = getFirestoreReference(doc);
415
+ if (documentRef) {
416
+ assertSameFirestoreInstance(documentRef.firestore, this._firestore, 'documents');
417
+ }
418
+ return doc.path;
419
+ }
420
+ throw new Error(`firebase.firestore().pipeline().documents(*) invalid value at index ${index}. Expected a document path or DocumentReference.`);
421
+ });
422
+ return new RuntimePipelineImpl(this._firestore, {
423
+ source: 'documents',
424
+ documents
425
+ });
426
+ }
427
+ createFrom(query) {
428
+ const internals = asQueryInternals(query);
429
+ if (!internals || !internals._collectionPath || !internals._modifiers) {
430
+ throw new Error('firebase.firestore().pipeline().createFrom(*) expected a Query from @react-native-firebase/firestore.');
431
+ }
432
+ if (internals._firestore !== this._firestore) {
433
+ throw new Error('firebase.firestore().pipeline().createFrom(*) cannot use a Query from a different Firestore instance.');
434
+ }
435
+ return new RuntimePipelineImpl(this._firestore, {
436
+ source: 'query',
437
+ path: internals._collectionPath.relativeName,
438
+ queryType: internals._modifiers.type,
439
+ filters: internals._modifiers.filters,
440
+ orders: internals._modifiers.orders,
441
+ options: internals._modifiers.options
442
+ });
443
+ }
444
+ }
445
+ export function createPipelineSource(firestore) {
446
+ return new RuntimePipelineSourceImpl(firestore);
447
+ }
448
+ export function installPipelineRuntime(firestoreInstance) {
449
+ let firestore = firestoreInstance;
450
+ if (!firestore) {
451
+ try {
452
+ firestore = getFirestore();
453
+ } catch {
454
+ return;
455
+ }
456
+ }
457
+ const prototype = Object.getPrototypeOf(firestore);
458
+ if (!prototype || prototype.__rnfbFirestorePipelineInstalled__) {
459
+ return;
460
+ }
461
+ Object.defineProperty(prototype, 'pipeline', {
462
+ value() {
463
+ return createPipelineSource(this);
464
+ },
465
+ configurable: true,
466
+ enumerable: false,
467
+ writable: true
468
+ });
469
+ Object.defineProperty(prototype, '__rnfbFirestorePipelineInstalled__', {
470
+ value: true,
471
+ configurable: true,
472
+ enumerable: false,
473
+ writable: true
474
+ });
475
+ }
476
+ export function registerPipelineRuntimeInstaller() {
477
+ const runtimeGlobal = globalThis;
478
+ runtimeGlobal[PIPELINE_RUNTIME_INSTALLER_SYMBOL] = installPipelineRuntime;
479
+ }
480
+ function parseExecuteInput(pipelineOrOptions) {
481
+ if (isRuntimePipeline(pipelineOrOptions)) {
482
+ return {
483
+ runtimePipeline: pipelineOrOptions,
484
+ executeOptions: {}
485
+ };
486
+ }
487
+ if (!isRecord(pipelineOrOptions)) {
488
+ throw new Error('firebase.firestore().pipeline().execute(*) expected a Pipeline or PipelineExecuteOptions.');
489
+ }
490
+ const runtimePipeline = pipelineOrOptions.pipeline;
491
+ if (!isRuntimePipeline(runtimePipeline)) {
492
+ throw new Error('firebase.firestore().pipeline().execute(*) expected options.pipeline to be created from firestore.pipeline().');
493
+ }
494
+ return {
495
+ runtimePipeline,
496
+ executeOptions: validateExecuteOptions({
497
+ indexMode: pipelineOrOptions.indexMode,
498
+ rawOptions: pipelineOrOptions.rawOptions
499
+ }) ?? {}
500
+ };
501
+ }
502
+ export async function executeRuntimePipeline(pipelineOrOptions) {
503
+ const {
504
+ runtimePipeline,
505
+ executeOptions
506
+ } = parseExecuteInput(pipelineOrOptions);
507
+ const serializedPipeline = runtimePipeline.serialize();
508
+ validateSerializedPipeline(serializedPipeline);
509
+ if (isIOS) {
510
+ const unsupportedFunctions = getIOSUnsupportedPipelineFunctions(serializedPipeline);
511
+ if (unsupportedFunctions.length) {
512
+ throw new Error(`pipelineExecute() does not support these functions on iOS yet: ${unsupportedFunctions.join(', ')}.`);
513
+ }
514
+ }
515
+ const nativeResponse = await runtimePipeline.firestore.native.pipelineExecute(serializedPipeline, executeOptions);
516
+ const executionTime = parseTimestamp(nativeResponse?.executionTime);
517
+ if (!executionTime) {
518
+ throw new Error('firebase.firestore().pipeline().execute(*) expected pipelineExecute() to return executionTime.');
519
+ }
520
+ const results = (nativeResponse?.results ?? []).map(result => new RuntimePipelineResult(runtimePipeline.firestore, result));
521
+ return {
522
+ results,
523
+ executionTime
524
+ };
525
+ }
526
+ //# sourceMappingURL=pipeline_runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["isArray","isIOS","isNumber","isObject","isString","isUndefined","FirestorePath","FirestoreTimestamp","DocumentReferenceClass","FieldPath","fromDotSeparatedString","extractFieldPathData","parseNativeMap","getFirestore","getIOSUnsupportedPipelineFunctions","validateExecuteOptions","validateSerializedPipeline","PIPELINE_RUNTIME_SYMBOL","Symbol","for","PIPELINE_RUNTIME_INSTALLER_SYMBOL","isRuntimePipeline","value","isRecord","hasAnyKey","keys","some","key","Object","prototype","hasOwnProperty","call","assertSameFirestoreInstance","actual","expected","method","Error","getFirestoreReference","firestore","path","length","undefined","parseTimestamp","fromMillis","seconds","Number","nanoseconds","getNativeTypeMapArray","isNativeTypeMapValue","isNativeTypeMapObject","values","every","fieldPathToSegments","fieldPath","_segments","RuntimePipelineResult","constructor","nativeResult","data","normalizedData","fromEntries","entries","map","_data","ref","fromName","id","createTime","updateTime","get","serializeValue","visiting","segments","_toArray","serialize","entry","has","rec","__kind","expr","alias","add","inner","exprType","delete","as","result","output","entryValue","ensureNonEmptyString","asQueryInternals","query","RuntimePipelineImpl","source","stages","_source","_stages","append","stage","options","WeakSet","where","conditionOrOptions","condition","select","selectionOrOptions","first","selections","selection","addFields","fieldOrOptions","fields","field","removeFields","sort","orderingOrOptions","orderings","ordering","limit","nOrOptions","n","offset","aggregate","accumulatorOrOptions","isOptionsRecord","accumulators","accumulator","groups","group","distinct","groupOrOptions","findNearest","replaceWith","fieldNameOrExprOrOptions","fieldName","sample","documents","union","otherOrOptions","other","pipeline","unnest","selectableOrOptions","indexField","isOptionsObject","selectable","rawStage","name","params","RuntimePipelineSourceImpl","_firestore","collection","pathOrCollectionRefOrOptions","collectionRef","rawOptions","collectionGroup","collectionIdOrOptions","collectionId","database","docsOrOptions","docs","doc","index","documentRef","createFrom","internals","_collectionPath","_modifiers","relativeName","queryType","type","filters","orders","createPipelineSource","installPipelineRuntime","firestoreInstance","getPrototypeOf","__rnfbFirestorePipelineInstalled__","defineProperty","configurable","enumerable","writable","registerPipelineRuntimeInstaller","runtimeGlobal","globalThis","parseExecuteInput","pipelineOrOptions","runtimePipeline","executeOptions","indexMode","executeRuntimePipeline","serializedPipeline","unsupportedFunctions","join","nativeResponse","native","pipelineExecute","executionTime","results"],"sourceRoot":"../../../lib","sources":["pipelines/pipeline_runtime.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,OAAO,EACPC,KAAK,EACLC,QAAQ,EACRC,QAAQ,EACRC,QAAQ,EACRC,WAAW,QACN,+CAA+C;AAmBtD,OAAOC,aAAa,MAAM,qBAAkB;AAC5C,OAAOC,kBAAkB,MAAM,0BAAuB;AACtD,OAAOC,sBAAsB,MAAM,kCAA+B;AAClE,OAAOC,SAAS,IAAIC,sBAAsB,QAAQ,iBAAc;AAChE,SAASC,oBAAoB,QAAQ,mBAAU;AAC/C,SAASC,cAAc,QAAQ,uBAAoB;AA6BnD,SAASC,YAAY,QAAQ,eAAY;AACzC,SAASC,kCAAkC,QAAQ,uBAAoB;AACvE,SAASC,sBAAsB,EAAEC,0BAA0B,QAAQ,wBAAqB;AAExF,MAAMC,uBAAuB,GAAGC,MAAM,CAACC,GAAG,CAAC,8BAA8B,CAAC;AAC1E,MAAMC,iCAAiC,GAAGF,MAAM,CAACC,GAAG,CAAC,uCAAuC,CAAC;AAiB7F,SAASE,iBAAiBA,CAACC,KAAc,EAA4B;EACnE,OAAOnB,QAAQ,CAACmB,KAAK,CAAC,IAAKA,KAAK,CAAgCL,uBAAuB,CAAC,KAAK,IAAI;AACnG;AAEA,SAASM,QAAQA,CAACD,KAAc,EAAoC;EAClE,OAAOnB,QAAQ,CAACmB,KAAK,CAAC,IAAI,CAACtB,OAAO,CAACsB,KAAK,CAAC;AAC3C;AAEA,SAASE,SAASA,CAACF,KAA8B,EAAEG,IAAc,EAAW;EAC1E,OAAO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,kEAAkE4J,oBAAoB,CAACC,IAAI,CAAC,IAAI,CAAC,GACnG,CAAC;IACH;EACF;EAEA,MAAMC,cAAc,GAAI,MAAMP,eAAe,CAACrJ,SAAS,CAAC6J,MAAM,CAACC,eAAe,CAC5EL,kBAAkB,EAClBH,cACF,CAAuC;EAEvC,MAAMS,aAAa,GAAG3J,cAAc,CAACwJ,cAAc,EAAEG,aAAa,CAAC;EACnE,IAAI,CAACA,aAAa,EAAE;IAClB,MAAM,IAAIjK,KAAK,CACb,gGACF,CAAC;EACH;EACA,MAAMkK,OAAO,GAAG,CAACJ,cAAc,EAAEI,OAAO,IAAI,EAAE,EAAExI,GAAG,CACjDwB,MAAM,IAAI,IAAI/B,qBAAqB,CAACoI,eAAe,CAACrJ,SAAS,EAAEgD,MAAM,CACvE,CAAC;EAED,OAAO;IACLgH,OAAO;IACPD;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ /*
4
+ * Copyright (c) 2016-present Invertase Limited & Contributors
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this library except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ *
18
+ */
19
+
20
+ export const PIPELINE_SOURCE_TYPES = ['collection', 'collectionGroup', 'database', 'documents', 'query'];
21
+ export const PIPELINE_STAGE_TYPES = ['where', 'select', 'addFields', 'removeFields', 'sort', 'limit', 'offset', 'aggregate', 'distinct', 'findNearest', 'replaceWith', 'sample', 'union', 'unnest', 'rawStage'];
22
+ export const PIPELINE_UNSUPPORTED_BASE_MESSAGE = 'Some Firestore pipeline features are not supported by this native implementation yet.';
23
+
24
+ // Keep this in sync with iOS native support in
25
+ // `RNFBFirestorePipelineNodeBuilder.swift`.
26
+ // Remove entries once the iOS node builder/runtime path supports them.
27
+ const IOS_UNSUPPORTED_FUNCTION_NAMES = new Set(['arrayGet', 'conditional', 'round', 'stringRepeat', 'substring', 'timestampAdd', 'timestampSubtract', 'trunc']);
28
+ export function createPipelineUnsupportedMessage(pipeline) {
29
+ const firstStage = pipeline?.stages?.[0];
30
+ if (firstStage?.stage && typeof firstStage.stage === 'string') {
31
+ return `${PIPELINE_UNSUPPORTED_BASE_MESSAGE} Unsupported stage: ${firstStage.stage}.`;
32
+ }
33
+ const source = pipeline?.source?.source;
34
+ if (source && typeof source === 'string') {
35
+ return `${PIPELINE_UNSUPPORTED_BASE_MESSAGE} Unsupported source: ${source}.`;
36
+ }
37
+ return PIPELINE_UNSUPPORTED_BASE_MESSAGE;
38
+ }
39
+ export function getIOSUnsupportedPipelineFunctions(pipeline) {
40
+ if (!pipeline) {
41
+ return [];
42
+ }
43
+ const unsupported = new Set();
44
+ collectIOSUnsupportedFunctions(pipeline, unsupported);
45
+ return Array.from(unsupported).sort();
46
+ }
47
+ function collectIOSUnsupportedFunctions(value, unsupported) {
48
+ if (Array.isArray(value)) {
49
+ value.forEach(entry => collectIOSUnsupportedFunctions(entry, unsupported));
50
+ return;
51
+ }
52
+ if (!value || typeof value !== 'object') {
53
+ return;
54
+ }
55
+ const objectValue = value;
56
+ if (isSerializedFunctionExpression(objectValue)) {
57
+ if (IOS_UNSUPPORTED_FUNCTION_NAMES.has(objectValue.name)) {
58
+ unsupported.add(objectValue.name);
59
+ }
60
+ if (Array.isArray(objectValue.args)) {
61
+ objectValue.args.forEach(entry => collectIOSUnsupportedFunctions(entry, unsupported));
62
+ }
63
+ }
64
+ Object.values(objectValue).forEach(entry => {
65
+ collectIOSUnsupportedFunctions(entry, unsupported);
66
+ });
67
+ }
68
+ function isSerializedFunctionExpression(value) {
69
+ return typeof value.name === 'string' && (value.exprType === 'Function' || value.__kind === 'expression');
70
+ }
71
+ //# sourceMappingURL=pipeline_support.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["PIPELINE_SOURCE_TYPES","PIPELINE_STAGE_TYPES","PIPELINE_UNSUPPORTED_BASE_MESSAGE","IOS_UNSUPPORTED_FUNCTION_NAMES","Set","createPipelineUnsupportedMessage","pipeline","firstStage","stages","stage","source","getIOSUnsupportedPipelineFunctions","unsupported","collectIOSUnsupportedFunctions","Array","from","sort","value","isArray","forEach","entry","objectValue","isSerializedFunctionExpression","has","name","add","args","Object","values","exprType","__kind"],"sourceRoot":"../../../lib","sources":["pipelines/pipeline_support.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,OAAO,MAAMA,qBAAqB,GAAG,CACnC,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,OAAO,CACC;AAEV,OAAO,MAAMC,oBAAoB,GAAG,CAClC,OAAO,EACP,QAAQ,EACR,WAAW,EACX,cAAc,EACd,MAAM,EACN,OAAO,EACP,QAAQ,EACR,WAAW,EACX,UAAU,EACV,aAAa,EACb,aAAa,EACb,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,UAAU,CACF;AAEV,OAAO,MAAMC,iCAAiC,GAC5C,uFAAuF;;AAEzF;AACA;AACA;AACA,MAAMC,8BAA8B,GAAG,IAAIC,GAAG,CAAS,CACrD,UAAU,EACV,aAAa,EACb,OAAO,EACP,cAAc,EACd,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,OAAO,CACR,CAAC;AAEF,OAAO,SAASC,gCAAgCA,CAC9CC,QAAqD,EAC7C;EACR,MAAMC,UAAU,GAAGD,QAAQ,EAAEE,MAAM,GAAG,CAAC,CAAC;EACxC,IAAID,UAAU,EAAEE,KAAK,IAAI,OAAOF,UAAU,CAACE,KAAK,KAAK,QAAQ,EAAE;IAC7D,OAAO,GAAGP,iCAAiC,uBAAuBK,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