@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
@@ -1,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  /*
2
4
  * Copyright (c) 2016-present Invertase Limited & Contributors
3
5
  *
@@ -15,49 +17,36 @@
15
17
  *
16
18
  */
17
19
 
18
- import {
19
- hasOwnProperty,
20
- isArray,
21
- isBoolean,
22
- isFunction,
23
- isObject,
24
- isString,
25
- isUndefined,
26
- } from '@react-native-firebase/app/dist/module/common';
27
- import FirestoreFieldPath, { fromDotSeparatedString } from '../FirestoreFieldPath';
28
-
20
+ import { hasOwnProperty, isArray, isBoolean, isFunction, isObject, isString, isUndefined } from '@react-native-firebase/app/dist/module/common';
21
+ import FieldPath, { fromDotSeparatedString } from "../FieldPath.js";
29
22
  export function extractFieldPathData(data, segments) {
30
23
  if (!isObject(data)) {
31
24
  return undefined;
32
25
  }
33
-
34
- const pathValue = data[segments[0]];
35
-
26
+ const key = segments[0];
27
+ if (key === undefined) return undefined;
28
+ const pathValue = data[key];
36
29
  if (segments.length === 1) {
37
30
  return pathValue;
38
31
  }
39
-
40
32
  return extractFieldPathData(pathValue, segments.slice(1));
41
33
  }
42
-
43
34
  export function parseUpdateArgs(args) {
44
35
  let data = {};
45
36
  if (args.length === 1) {
46
37
  if (!isObject(args[0])) {
47
38
  throw new Error('if using a single update argument, it must be an object.');
48
39
  }
49
- [data] = args;
40
+ data = args[0];
50
41
  } else if (args.length % 2 === 1) {
51
- throw new Error(
52
- 'the update arguments must be either a single object argument, or equal numbers of key/value pairs.',
53
- );
42
+ throw new Error('the update arguments must be either a single object argument, or equal numbers of key/value pairs.');
54
43
  } else {
55
44
  for (let i = 0; i < args.length; i += 2) {
56
45
  const key = args[i];
57
46
  const value = args[i + 1];
58
47
  if (isString(key)) {
59
48
  data[key] = value;
60
- } else if (key instanceof FirestoreFieldPath) {
49
+ } else if (key instanceof FieldPath) {
61
50
  data[key._toPath()] = value;
62
51
  } else {
63
52
  throw new Error(`argument at index ${i} must be a string or FieldPath`);
@@ -66,180 +55,136 @@ export function parseUpdateArgs(args) {
66
55
  }
67
56
  return data;
68
57
  }
69
-
70
- /**
71
- *
72
- * @param options
73
- */
74
58
  export function parseSetOptions(options) {
75
59
  const out = {};
76
-
77
60
  if (isUndefined(options)) {
78
61
  return out;
79
62
  }
80
-
81
63
  if (!isObject(options)) {
82
64
  throw new Error("'options' must be an object.");
83
65
  }
84
-
85
- if (hasOwnProperty(options, 'merge') && hasOwnProperty(options, 'mergeFields')) {
66
+ const opts = options;
67
+ if (hasOwnProperty(opts, 'merge') && hasOwnProperty(opts, 'mergeFields')) {
86
68
  throw new Error("'options' must not contain both 'merge' & 'mergeFields'.");
87
69
  }
88
-
89
- if (!isUndefined(options.merge)) {
90
- if (!isBoolean(options.merge)) {
70
+ if (!isUndefined(opts.merge)) {
71
+ if (!isBoolean(opts.merge)) {
91
72
  throw new Error("'options.merge' must be a boolean value.");
92
73
  }
93
-
94
- out.merge = options.merge;
74
+ out.merge = opts.merge;
95
75
  }
96
-
97
- if (!isUndefined(options.mergeFields)) {
98
- if (!isArray(options.mergeFields)) {
76
+ if (!isUndefined(opts.mergeFields)) {
77
+ if (!isArray(opts.mergeFields)) {
99
78
  throw new Error("'options.mergeFields' must be an array.");
100
79
  }
101
-
102
80
  out.mergeFields = [];
103
-
104
- for (let i = 0; i < options.mergeFields.length; i++) {
105
- const field = options.mergeFields[i];
106
- if (!isString(field) && !(field instanceof FirestoreFieldPath)) {
107
- throw new Error(
108
- `'options.mergeFields' all fields must be of type string or FieldPath, but the value at index ${i} was ${typeof field}`,
109
- );
81
+ const mergeFields = opts.mergeFields;
82
+ for (let i = 0; i < mergeFields.length; i++) {
83
+ const field = mergeFields[i];
84
+ if (!isString(field) && !(field instanceof FieldPath)) {
85
+ throw new Error(`'options.mergeFields' all fields must be of type string or FieldPath, but the value at index ${i} was ${typeof field}`);
110
86
  }
111
-
112
- let path = field;
113
-
114
- if (isString(path)) {
87
+ if (field instanceof FieldPath) {
88
+ out.mergeFields.push(field._toPath());
89
+ } else {
115
90
  try {
116
- path = fromDotSeparatedString(field);
91
+ fromDotSeparatedString(field);
117
92
  } catch (e) {
118
93
  throw new Error(`'options.mergeFields' ${e.message}`);
119
94
  }
120
- }
121
-
122
- if (field instanceof FirestoreFieldPath) {
123
- out.mergeFields.push(field._toPath());
124
- } else {
125
95
  out.mergeFields.push(field);
126
96
  }
127
97
  }
128
98
  }
129
-
130
99
  return out;
131
100
  }
132
-
133
- // function buildFieldPathData(segments, value) {
134
- // if (segments.length === 1) {
135
- // return {
136
- // [segments[0]]: value,
137
- // };
138
- // }
139
- // return {
140
- // [segments[0]]: buildFieldPathData(segments.slice(1), value),
141
- // };
142
- // }
143
-
101
+ export function applyFirestoreDataConverter(data, converter, options) {
102
+ if (converter && converter.toFirestore) {
103
+ return converter.toFirestore(data, options);
104
+ }
105
+ return data;
106
+ }
144
107
  function isPartialObserver(input) {
145
108
  if (input == null) {
146
109
  return false;
147
110
  }
148
- return input.next != null || input.error != null || input.complete != null;
111
+ const o = input;
112
+ return o.next != null || o.error != null || o.complete != null;
149
113
  }
150
-
151
114
  export function parseSnapshotArgs(args) {
152
115
  if (args.length === 0) {
153
116
  throw new Error('expected at least one argument.');
154
117
  }
155
-
156
- // Ignore onComplete as its never used
157
118
  const NOOP = () => {};
158
119
  const snapshotListenOptions = {};
159
120
  let callback = NOOP;
160
121
  let onError = NOOP;
161
122
  let onNext = NOOP;
162
-
163
- /**
164
- * .onSnapshot(Function...
165
- */
166
123
  if (isFunction(args[0])) {
167
- /**
168
- * .onSnapshot((snapshot) => {}, (error) => {}
169
- */
170
124
  if (isFunction(args[1])) {
171
125
  onNext = args[0];
172
126
  onError = args[1];
173
127
  } else {
174
- /**
175
- * .onSnapshot((snapshot, error) => {})
176
- */
177
128
  callback = args[0];
178
129
  }
179
130
  }
180
-
181
- /**
182
- * .onSnapshot({ complete: () => {}, error: (e) => {}, next: (snapshot) => {} })
183
- */
184
131
  if (isObject(args[0]) && isPartialObserver(args[0])) {
185
132
  const observer = args[0];
186
133
  if (observer.error) {
187
- onError = isFunction(observer.error) ? observer.error.bind(observer) : observer.error;
134
+ onError = typeof observer.error === 'function' ? observer.error.bind(observer) : observer.error;
188
135
  }
189
136
  if (observer.next) {
190
- onNext = isFunction(observer.next) ? observer.next.bind(observer) : observer.next;
137
+ onNext = typeof observer.next === 'function' ? observer.next.bind(observer) : observer.next;
191
138
  }
192
139
  }
193
-
194
- /**
195
- * .onSnapshot(SnapshotListenOptions, ...
196
- */
197
140
  if (isObject(args[0]) && !isPartialObserver(args[0])) {
198
- snapshotListenOptions.includeMetadataChanges =
199
- args[0].includeMetadataChanges == null ? false : args[0].includeMetadataChanges;
141
+ const opts = args[0];
142
+ snapshotListenOptions.includeMetadataChanges = opts.includeMetadataChanges == null ? false : opts.includeMetadataChanges;
200
143
  if (isFunction(args[1])) {
201
- /**
202
- * .onSnapshot(SnapshotListenOptions, Function);
203
- */
204
144
  if (isFunction(args[2])) {
205
- /**
206
- * .onSnapshot(SnapshotListenOptions, (snapshot) => {}, (error) => {});
207
- */
208
145
  onNext = args[1];
209
146
  onError = args[2];
210
147
  } else {
211
- /**
212
- * .onSnapshot(SnapshotListenOptions, (s, e) => {};
213
- */
214
148
  callback = args[1];
215
149
  }
216
150
  } else if (isPartialObserver(args[1])) {
217
- /**
218
- * .onSnapshot(SnapshotListenOptions, { complete: () => {}, error: (e) => {}, next: (snapshot) => {} });
219
- */
220
151
  const observer = args[1];
221
152
  if (observer.error) {
222
- onError = isFunction(observer.error) ? observer.error.bind(observer) : observer.error;
153
+ onError = typeof observer.error === 'function' ? observer.error.bind(observer) : observer.error;
223
154
  }
224
155
  if (observer.next) {
225
- onNext = isFunction(observer.next) ? observer.next.bind(observer) : observer.next;
156
+ onNext = typeof observer.next === 'function' ? observer.next.bind(observer) : observer.next;
226
157
  }
227
158
  }
228
159
  }
229
-
230
160
  if (hasOwnProperty(snapshotListenOptions, 'includeMetadataChanges')) {
231
161
  if (!isBoolean(snapshotListenOptions.includeMetadataChanges)) {
232
162
  throw new Error("'options' SnapshotOptions.includeMetadataChanges must be a boolean value.");
233
163
  }
234
164
  }
235
-
236
165
  if (!isFunction(onNext)) {
237
166
  throw new Error("'observer.next' or 'onNext' expected a function.");
238
167
  }
239
-
240
168
  if (!isFunction(onError)) {
241
169
  throw new Error("'observer.error' or 'onError' expected a function.");
242
170
  }
243
-
244
- return { snapshotListenOptions, callback, onNext, onError };
171
+ return {
172
+ snapshotListenOptions,
173
+ callback,
174
+ onNext,
175
+ onError
176
+ };
177
+ }
178
+ export function validateWithConverter(converter) {
179
+ if (isUndefined(converter) || !isObject(converter)) {
180
+ throw new Error('expected an object value.');
181
+ }
182
+ const c = converter;
183
+ if (!isFunction(c.toFirestore)) {
184
+ throw new Error("'toFirestore' expected a function.");
185
+ }
186
+ if (!isFunction(c.fromFirestore)) {
187
+ throw new Error("'fromFirestore' expected a function.");
188
+ }
245
189
  }
190
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["hasOwnProperty","isArray","isBoolean","isFunction","isObject","isString","isUndefined","FieldPath","fromDotSeparatedString","extractFieldPathData","data","segments","undefined","key","pathValue","length","slice","parseUpdateArgs","args","Error","i","value","_toPath","parseSetOptions","options","out","opts","merge","mergeFields","field","push","e","message","applyFirestoreDataConverter","converter","toFirestore","isPartialObserver","input","o","next","error","complete","parseSnapshotArgs","NOOP","snapshotListenOptions","callback","onError","onNext","observer","bind","includeMetadataChanges","validateWithConverter","c","fromFirestore"],"sourceRoot":"../../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7F;IACF;EACF;EAEA,IAAIvC,cAAc,CAAC4C,qBAAqB,EAAE,wBAAwB,CAAC,EAAE;IACnE,IAAI,CAAC1C,SAAS,CAAC0C,qBAAqB,CAACM,sBAAsB,CAAC,EAAE;MAC5D,MAAM,IAAI/B,KAAK,CAAC,2EAA2E,CAAC;IAC9F;EACF;EAEA,IAAI,CAAChB,UAAU,CAAC4C,MAAM,CAAC,EAAE;IACvB,MAAM,IAAI5B,KAAK,CAAC,kDAAkD,CAAC;EACrE;EAEA,IAAI,CAAChB,UAAU,CAAC2C,OAAO,CAAC,EAAE;IACxB,MAAM,IAAI3B,KAAK,CAAC,oDAAoD,CAAC;EACvE;EAEA,OAAO;IAAEyB,qBAAqB;IAAEC,QAAQ;IAAEE,MAAM;IAAED;EAAQ,CAAC;AAC7D;AAEA,OAAO,SAASK,qBAAqBA,CAACjB,SAAkB,EAAQ;EAC9D,IAAI5B,WAAW,CAAC4B,SAAS,CAAC,IAAI,CAAC9B,QAAQ,CAAC8B,SAAS,CAAC,EAAE;IAClD,MAAM,IAAIf,KAAK,CAAC,2BAA2B,CAAC;EAC9C;EAEA,MAAMiC,CAAC,GAAGlB,SAAiD;EAC3D,IAAI,CAAC/B,UAAU,CAACiD,CAAC,CAACjB,WAAW,CAAC,EAAE;IAC9B,MAAM,IAAIhB,KAAK,CAAC,oCAAoC,CAAC;EACvD;EAEA,IAAI,CAAChB,UAAU,CAACiD,CAAC,CAACC,aAAa,CAAC,EAAE;IAChC,MAAM,IAAIlC,KAAK,CAAC,sCAAsC,CAAC;EACzD;AACF","ignoreList":[]}
@@ -1,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  /*
2
4
  * Copyright (c) 2016-present Invertase Limited & Contributors
3
5
  *
@@ -15,56 +17,35 @@
15
17
  *
16
18
  */
17
19
 
18
- import {
19
- isArray,
20
- isBoolean,
21
- isDate,
22
- isNull,
23
- isNumber,
24
- isObject,
25
- isString,
26
- isUndefined,
27
- } from '@react-native-firebase/app/dist/module/common';
28
- import FirestoreBlob from '../FirestoreBlob';
29
- import { DOCUMENT_ID } from '../FirestoreFieldPath';
30
- import FirestoreGeoPoint from '../FirestoreGeoPoint';
31
- import FirestorePath from '../FirestorePath';
32
- import FirestoreTimestamp from '../FirestoreTimestamp';
33
- import { getTypeMapInt, getTypeMapName } from './typemap';
34
- import { Bytes } from '../modular/Bytes';
35
- import FirestoreVectorValue from '../FirestoreVectorValue';
36
-
37
- // To avoid React Native require cycle warnings
20
+ import { isArray, isBoolean, isDate, isNull, isNumber, isObject, isString, isUndefined } from '@react-native-firebase/app/dist/module/common';
21
+ import Blob from "../FirestoreBlob.js";
22
+ import { DOCUMENT_ID } from "../FieldPath.js";
23
+ import FirestoreGeoPoint from "../FirestoreGeoPoint.js";
24
+ import FirestorePath from "../FirestorePath.js";
25
+ import FirestoreTimestamp from "../FirestoreTimestamp.js";
26
+ import { getTypeMapInt, getTypeMapName } from "./typemap.js";
27
+ import { Bytes } from "../modular/Bytes.js";
28
+ import FirestoreVectorValue from "../FirestoreVectorValue.js";
38
29
  let FirestoreDocumentReference = null;
39
30
  export function provideDocumentReferenceClass(documentReference) {
40
31
  FirestoreDocumentReference = documentReference;
41
32
  }
42
-
43
33
  let FirestoreFieldValue = null;
44
34
  export function provideFieldValueClass(fieldValue) {
45
35
  FirestoreFieldValue = fieldValue;
46
36
  }
47
-
48
- /**
49
- *
50
- * @param data
51
- * @param ignoreUndefined
52
- */
53
37
  export function buildNativeMap(data, ignoreUndefined) {
54
38
  const nativeData = {};
55
39
  if (data) {
56
40
  const keys = Object.keys(data);
57
41
  for (let i = 0; i < keys.length; i++) {
58
42
  const key = keys[i];
59
-
60
43
  if (typeof data[key] === 'undefined') {
61
44
  if (!ignoreUndefined) {
62
45
  throw new Error('Unsupported field value: undefined');
63
- } else {
64
- continue;
65
46
  }
47
+ continue;
66
48
  }
67
-
68
49
  const typeMap = generateNativeData(data[key], ignoreUndefined);
69
50
  if (typeMap) {
70
51
  nativeData[key] = typeMap;
@@ -73,12 +54,6 @@ export function buildNativeMap(data, ignoreUndefined) {
73
54
  }
74
55
  return nativeData;
75
56
  }
76
-
77
- /**
78
- *
79
- * @param array
80
- * @returns {Array}
81
- */
82
57
  export function buildNativeArray(array, ignoreUndefined) {
83
58
  const nativeArray = [];
84
59
  if (array) {
@@ -87,9 +62,8 @@ export function buildNativeArray(array, ignoreUndefined) {
87
62
  if (typeof value === 'undefined') {
88
63
  if (!ignoreUndefined) {
89
64
  throw new Error('Unsupported field value: undefined');
90
- } else {
91
- continue;
92
65
  }
66
+ continue;
93
67
  }
94
68
  const typeMap = generateNativeData(value, ignoreUndefined);
95
69
  if (typeMap) {
@@ -99,49 +73,26 @@ export function buildNativeArray(array, ignoreUndefined) {
99
73
  }
100
74
  return nativeArray;
101
75
  }
102
-
103
- /**
104
- * Creates a lightweight array of an object value to be sent over the bridge.
105
- * The type is convered to an integer which is handled on the native side
106
- * to create the correct types.
107
- *
108
- * Example: [7, 'some string'];
109
- *
110
- * @param value
111
- * @param ignoreUndefined
112
- * @returns {*}
113
- */
114
76
  export function generateNativeData(value, ignoreUndefined) {
115
77
  if (Number.isNaN(value)) {
116
78
  return getTypeMapInt('nan');
117
79
  }
118
-
119
80
  if (value === Number.NEGATIVE_INFINITY) {
120
81
  return getTypeMapInt('-infinity');
121
82
  }
122
-
123
83
  if (value === Number.POSITIVE_INFINITY) {
124
84
  return getTypeMapInt('infinity');
125
85
  }
126
-
127
86
  if (isNull(value) || isUndefined(value)) {
128
87
  return getTypeMapInt('null');
129
88
  }
130
-
131
89
  if (value === DOCUMENT_ID) {
132
90
  return getTypeMapInt('documentid');
133
91
  }
134
-
135
92
  if (isBoolean(value)) {
136
- if (value === true) {
137
- return getTypeMapInt('booleanTrue');
138
- }
139
- return getTypeMapInt('booleanFalse');
93
+ return value ? getTypeMapInt('booleanTrue') : getTypeMapInt('booleanFalse');
140
94
  }
141
-
142
95
  if (isNumber(value)) {
143
- // mirror the JS SDK's integer detection algorithm
144
- // https://github.com/firebase/firebase-js-sdk/blob/086df7c7e0299cedd9f3cff9080f46ca25cab7cd/packages/firestore/src/remote/number_serializer.ts#L56
145
96
  if (value === 0 && 1 / value === -Infinity) {
146
97
  return getTypeMapInt('negativeZero');
147
98
  }
@@ -150,64 +101,61 @@ export function generateNativeData(value, ignoreUndefined) {
150
101
  }
151
102
  return getTypeMapInt('double', value);
152
103
  }
153
-
154
104
  if (isString(value)) {
155
- if (value === '') {
156
- return getTypeMapInt('stringEmpty');
157
- }
158
- return getTypeMapInt('string', value);
105
+ return value === '' ? getTypeMapInt('stringEmpty') : getTypeMapInt('string', value);
159
106
  }
160
-
161
107
  if (isArray(value)) {
162
108
  return getTypeMapInt('array', buildNativeArray(value, ignoreUndefined));
163
109
  }
164
-
165
110
  if (isObject(value)) {
166
- if (value instanceof FirestoreDocumentReference) {
111
+ if (FirestoreDocumentReference && value instanceof FirestoreDocumentReference) {
167
112
  return getTypeMapInt('reference', value.path);
168
113
  }
169
-
170
114
  if (value instanceof FirestoreGeoPoint) {
171
115
  return getTypeMapInt('geopoint', [value.latitude, value.longitude]);
172
116
  }
173
-
174
- // Handle Date objects are Timestamps as per web sdk
175
117
  if (isDate(value)) {
176
118
  const timestamp = FirestoreTimestamp.fromDate(value);
177
119
  return getTypeMapInt('timestamp', [timestamp.seconds, timestamp.nanoseconds]);
178
120
  }
179
-
180
121
  if (value instanceof FirestoreTimestamp) {
181
122
  return getTypeMapInt('timestamp', [value.seconds, value.nanoseconds]);
182
123
  }
183
-
184
- // Modular API uses Bytes instead of Blob
185
- if (value instanceof FirestoreBlob || value instanceof Bytes) {
124
+ if (value instanceof Blob || value instanceof Bytes) {
186
125
  return getTypeMapInt('blob', value.toBase64());
187
126
  }
188
-
189
- if (value instanceof FirestoreFieldValue) {
127
+ if (FirestoreFieldValue && value instanceof FirestoreFieldValue) {
190
128
  return getTypeMapInt('fieldvalue', [value._type, value._elements]);
191
129
  }
192
-
193
130
  if (value instanceof FirestoreVectorValue) {
194
131
  return getTypeMapInt('vector', value.toArray());
195
132
  }
196
-
197
133
  return getTypeMapInt('object', buildNativeMap(value, ignoreUndefined));
198
134
  }
199
135
 
200
136
  // eslint-disable-next-line no-console
201
137
  console.warn(`Unknown data type received ${value}`);
202
-
203
138
  return getTypeMapInt('unknown');
204
139
  }
205
-
206
- /**
207
- *
208
- * @param firestore
209
- * @param nativeData
210
- */
140
+ function getArrayLikeEntries(value) {
141
+ if (isArray(value)) {
142
+ return value;
143
+ }
144
+ if (isObject(value) && !isArray(value)) {
145
+ const record = value;
146
+ if (!Object.prototype.hasOwnProperty.call(record, '0')) {
147
+ return undefined;
148
+ }
149
+ const entries = [];
150
+ let index = 0;
151
+ while (Object.prototype.hasOwnProperty.call(record, String(index))) {
152
+ entries.push(record[String(index)]);
153
+ index += 1;
154
+ }
155
+ return entries;
156
+ }
157
+ return undefined;
158
+ }
211
159
  export function parseNativeMap(firestore, nativeData) {
212
160
  let data;
213
161
  if (nativeData) {
@@ -220,38 +168,25 @@ export function parseNativeMap(firestore, nativeData) {
220
168
  }
221
169
  return data;
222
170
  }
223
-
224
- /**
225
- *
226
- * @param firestore
227
- * @param nativeArray
228
- * @returns {Array}
229
- */
230
171
  export function parseNativeArray(firestore, nativeArray) {
231
172
  const array = [];
232
- if (nativeArray) {
233
- for (let i = 0; i < nativeArray.length; i++) {
234
- array.push(parseNativeData(firestore, nativeArray[i]));
173
+ const normalizedArray = getArrayLikeEntries(nativeArray) ?? [];
174
+ if (normalizedArray) {
175
+ for (let i = 0; i < normalizedArray.length; i++) {
176
+ array.push(parseNativeData(firestore, normalizedArray[i]));
235
177
  }
236
178
  }
237
179
  return array;
238
180
  }
239
-
240
- /**
241
- * Data returned from native is constructed in the same way it sent to keep
242
- * payloads over the bridge as small as possible. The index matches to a type
243
- * which is then created on JS land.
244
- *
245
- * Example: [7, 'string']
246
- *
247
- * @param firestore
248
- * @param nativeArray
249
- * @returns *
250
- */
251
181
  export function parseNativeData(firestore, nativeArray) {
252
- const [int, value] = nativeArray;
182
+ const normalizedTypeMap = getArrayLikeEntries(nativeArray);
183
+ if (!normalizedTypeMap || !isNumber(normalizedTypeMap[0])) {
184
+ // eslint-disable-next-line no-console
185
+ console.warn('Unknown data type received from native channel: malformed type map');
186
+ return undefined;
187
+ }
188
+ const [int, value] = normalizedTypeMap;
253
189
  const type = getTypeMapName(int);
254
-
255
190
  switch (type) {
256
191
  case 'nan':
257
192
  return NaN;
@@ -273,15 +208,21 @@ export function parseNativeData(firestore, nativeArray) {
273
208
  case 'stringEmpty':
274
209
  return '';
275
210
  case 'array':
276
- return parseNativeArray(firestore, value);
211
+ return parseNativeArray(firestore, getArrayLikeEntries(value) ?? []);
277
212
  case 'object':
278
213
  return parseNativeMap(firestore, value);
279
214
  case 'reference':
280
215
  return new FirestoreDocumentReference(firestore, FirestorePath.fromName(value));
281
216
  case 'geopoint':
282
- return new FirestoreGeoPoint(value[0], value[1]);
217
+ {
218
+ const v = getArrayLikeEntries(value) ?? [];
219
+ return new FirestoreGeoPoint(v[0] ?? 0, v[1] ?? 0);
220
+ }
283
221
  case 'timestamp':
284
- return new FirestoreTimestamp(value[0], value[1]);
222
+ {
223
+ const v = getArrayLikeEntries(value) ?? [];
224
+ return new FirestoreTimestamp(v[0] ?? 0, v[1] ?? 0);
225
+ }
285
226
  case 'blob':
286
227
  return Bytes.fromBase64String(value);
287
228
  case 'vector':
@@ -292,3 +233,4 @@ export function parseNativeData(firestore, nativeArray) {
292
233
  return value;
293
234
  }
294
235
  }
236
+ //# sourceMappingURL=serialize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["isArray","isBoolean","isDate","isNull","isNumber","isObject","isString","isUndefined","Blob","DOCUMENT_ID","FirestoreGeoPoint","FirestorePath","FirestoreTimestamp","getTypeMapInt","getTypeMapName","Bytes","FirestoreVectorValue","FirestoreDocumentReference","provideDocumentReferenceClass","documentReference","FirestoreFieldValue","provideFieldValueClass","fieldValue","buildNativeMap","data","ignoreUndefined","nativeData","keys","Object","i","length","key","Error","typeMap","generateNativeData","buildNativeArray","array","nativeArray","value","push","Number","isNaN","NEGATIVE_INFINITY","POSITIVE_INFINITY","Infinity","isSafeInteger","path","latitude","longitude","timestamp","fromDate","seconds","nanoseconds","toBase64","_type","_elements","toArray","console","warn","getArrayLikeEntries","record","prototype","hasOwnProperty","call","undefined","entries","index","String","parseNativeMap","firestore","typeArray","parseNativeData","parseNativeArray","normalizedArray","normalizedTypeMap","int","type","NaN","fromName","v","fromBase64String"],"sourceRoot":"../../../lib","sources":["utils/serialize.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,OAAO,EACPC,SAAS,EACTC,MAAM,EACNC,MAAM,EACNC,QAAQ,EACRC,QAAQ,EACRC,QAAQ,EACRC,WAAW,QACN,+CAA+C;AAGtD,OAAOC,IAAI,MAAM,qBAAkB;AACnC,SAASC,WAAW,QAAQ,iBAAc;AAC1C,OAAOC,iBAAiB,MAAM,yBAAsB;AACpD,OAAOC,aAAa,MAAM,qBAAkB;AAC5C,OAAOC,kBAAkB,MAAM,0BAAuB;AACtD,SAASC,aAAa,EAAEC,cAAc,QAAQ,cAAW;AACzD,SAASC,KAAK,QAAQ,qBAAkB;AACxC,OAAOC,oBAAoB,MAAM,4BAAyB;AAE1D,IAAIC,0BAMI,GAAG,IAAI;AAEf,OAAO,SAASC,6BAA6BA,CAC3CC,iBAMQ,EACF;EACNF,0BAA0B,GAAGE,iBAAiB;AAChD;AAEA,IAAIC,mBAEI,GAAG,IAAI;AAEf,OAAO,SAASC,sBAAsBA,CACpCC,UAAsF,EAChF;EACNF,mBAAmB,GAAGE,UAAU;AAClC;AAEA,OAAO,SAASC,cAAcA,CAC5BC,IAAgD,EAChDC,eAAyB,EACA;EACzB,MAAMC,UAAmC,GAAG,CAAC,CAAC;EAC9C,IAAIF,IAAI,EAAE;IACR,MAAMG,IAAI,GAAGC,MAAM,CAACD,IAAI,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