@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.
- package/CHANGELOG.md +35 -0
- package/RNFBFirestore.podspec +2 -1
- package/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestoreCollectionModule.java +17 -4
- package/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestoreDocumentModule.java +2 -2
- package/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestorePipelineExecutor.java +1243 -0
- package/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestorePipelineNodeBuilder.java +3919 -0
- package/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestorePipelineParser.java +1735 -0
- package/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestoreSerialize.java +1 -1
- package/dist/module/FieldPath.js +59 -0
- package/dist/module/FieldPath.js.map +1 -0
- package/dist/module/FieldValue.js +82 -0
- package/dist/module/FieldValue.js.map +1 -0
- package/{lib → dist/module}/FirestoreAggregate.js +31 -43
- package/dist/module/FirestoreAggregate.js.map +1 -0
- package/dist/module/FirestoreBlob.js +56 -0
- package/dist/module/FirestoreBlob.js.map +1 -0
- package/dist/module/FirestoreCollectionReference.js +70 -0
- package/dist/module/FirestoreCollectionReference.js.map +1 -0
- package/{lib → dist/module}/FirestoreDocumentChange.js +12 -15
- package/dist/module/FirestoreDocumentChange.js.map +1 -0
- package/dist/module/FirestoreDocumentReference.js +170 -0
- package/dist/module/FirestoreDocumentReference.js.map +1 -0
- package/dist/module/FirestoreDocumentSnapshot.js +88 -0
- package/dist/module/FirestoreDocumentSnapshot.js.map +1 -0
- package/dist/module/FirestoreFilter.js +146 -0
- package/dist/module/FirestoreFilter.js.map +1 -0
- package/dist/module/FirestoreGeoPoint.js +80 -0
- package/dist/module/FirestoreGeoPoint.js.map +1 -0
- package/{lib → dist/module}/FirestorePath.js +5 -12
- package/dist/module/FirestorePath.js.map +1 -0
- package/{lib → dist/module}/FirestorePersistentCacheIndexManager.js +11 -4
- package/dist/module/FirestorePersistentCacheIndexManager.js.map +1 -0
- package/dist/module/FirestoreQuery.js +298 -0
- package/dist/module/FirestoreQuery.js.map +1 -0
- package/{lib → dist/module}/FirestoreQueryModifiers.js +25 -136
- package/dist/module/FirestoreQueryModifiers.js.map +1 -0
- package/dist/module/FirestoreQuerySnapshot.js +98 -0
- package/dist/module/FirestoreQuerySnapshot.js.map +1 -0
- package/dist/module/FirestoreSnapshotMetadata.js +38 -0
- package/dist/module/FirestoreSnapshotMetadata.js.map +1 -0
- package/dist/module/FirestoreStatics.js +50 -0
- package/dist/module/FirestoreStatics.js.map +1 -0
- package/{lib → dist/module}/FirestoreTimestamp.js +39 -39
- package/dist/module/FirestoreTimestamp.js.map +1 -0
- package/dist/module/FirestoreTransaction.js +113 -0
- package/dist/module/FirestoreTransaction.js.map +1 -0
- package/dist/module/FirestoreTransactionHandler.js +137 -0
- package/dist/module/FirestoreTransactionHandler.js.map +1 -0
- package/dist/module/FirestoreVectorValue.js +75 -0
- package/dist/module/FirestoreVectorValue.js.map +1 -0
- package/dist/module/FirestoreWriteBatch.js +113 -0
- package/dist/module/FirestoreWriteBatch.js.map +1 -0
- package/dist/module/LoadBundleTask.js +70 -0
- package/dist/module/LoadBundleTask.js.map +1 -0
- package/dist/module/index.js +31 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/modular/Bytes.js +67 -0
- package/dist/module/modular/Bytes.js.map +1 -0
- package/dist/module/modular/FieldPath.js +25 -0
- package/dist/module/modular/FieldPath.js.map +1 -0
- package/dist/module/modular/FieldValue.js +37 -0
- package/dist/module/modular/FieldValue.js.map +1 -0
- package/dist/module/modular/GeoPoint.js +22 -0
- package/dist/module/modular/GeoPoint.js.map +1 -0
- package/dist/module/modular/Timestamp.js +22 -0
- package/dist/module/modular/Timestamp.js.map +1 -0
- package/dist/module/modular/VectorValue.js +25 -0
- package/dist/module/modular/VectorValue.js.map +1 -0
- package/dist/module/modular/query.js +222 -0
- package/dist/module/modular/query.js.map +1 -0
- package/dist/module/modular/snapshot.js +32 -0
- package/dist/module/modular/snapshot.js.map +1 -0
- package/dist/module/modular.js +229 -0
- package/dist/module/modular.js.map +1 -0
- package/dist/module/namespaced.js +298 -0
- package/dist/module/namespaced.js.map +1 -0
- package/dist/module/package.json +1 -0
- package/dist/module/pipelines/expressions.js +1273 -0
- package/dist/module/pipelines/expressions.js.map +1 -0
- package/dist/module/pipelines/index.js +32 -0
- package/dist/module/pipelines/index.js.map +1 -0
- package/dist/module/pipelines/pipeline-result.js +58 -0
- package/dist/module/pipelines/pipeline-result.js.map +1 -0
- package/dist/module/pipelines/pipeline-source.js +4 -0
- package/dist/module/pipelines/pipeline-source.js.map +1 -0
- package/dist/module/pipelines/pipeline.js +4 -0
- package/dist/module/pipelines/pipeline.js.map +1 -0
- package/dist/module/pipelines/pipeline_impl.js +42 -0
- package/dist/module/pipelines/pipeline_impl.js.map +1 -0
- package/dist/module/pipelines/pipeline_options.js +4 -0
- package/dist/module/pipelines/pipeline_options.js.map +1 -0
- package/dist/module/pipelines/pipeline_runtime.js +526 -0
- package/dist/module/pipelines/pipeline_runtime.js.map +1 -0
- package/dist/module/pipelines/pipeline_support.js +71 -0
- package/dist/module/pipelines/pipeline_support.js.map +1 -0
- package/dist/module/pipelines/pipeline_validate.js +183 -0
- package/dist/module/pipelines/pipeline_validate.js.map +1 -0
- package/dist/module/pipelines/stage_options.js +4 -0
- package/dist/module/pipelines/stage_options.js.map +1 -0
- package/dist/module/pipelines/types.js +2 -0
- package/dist/module/pipelines/types.js.map +1 -0
- package/dist/module/types/firestore.js +4 -0
- package/dist/module/types/firestore.js.map +1 -0
- package/dist/module/types/internal.js +4 -0
- package/dist/module/types/internal.js.map +1 -0
- package/dist/module/types/namespaced.js +338 -0
- package/dist/module/types/namespaced.js.map +1 -0
- package/{lib → dist/module}/utils/index.js +59 -114
- package/dist/module/utils/index.js.map +1 -0
- package/{lib → dist/module}/utils/serialize.js +58 -116
- package/dist/module/utils/serialize.js.map +1 -0
- package/{lib → dist/module}/utils/typemap.js +6 -20
- package/dist/module/utils/typemap.js.map +1 -0
- package/dist/module/version.js +5 -0
- package/dist/module/version.js.map +1 -0
- package/dist/module/web/RNFBFirestoreModule.android.js +5 -0
- package/dist/module/web/RNFBFirestoreModule.android.js.map +1 -0
- package/dist/module/web/RNFBFirestoreModule.ios.js +5 -0
- package/dist/module/web/RNFBFirestoreModule.ios.js.map +1 -0
- package/dist/module/web/RNFBFirestoreModule.js +387 -0
- package/dist/module/web/RNFBFirestoreModule.js.map +1 -0
- package/{lib → dist/module}/web/convert.js +60 -94
- package/dist/module/web/convert.js.map +1 -0
- package/dist/module/web/pipelines/pipeline.js +34 -0
- package/dist/module/web/pipelines/pipeline.js.map +1 -0
- package/dist/module/web/pipelines/pipeline_bridge_factory.js +217 -0
- package/dist/module/web/pipelines/pipeline_bridge_factory.js.map +1 -0
- package/dist/module/web/pipelines/pipeline_node_builder.js +294 -0
- package/dist/module/web/pipelines/pipeline_node_builder.js.map +1 -0
- package/dist/module/web/pipelines/pipeline_parser.js +21 -0
- package/dist/module/web/pipelines/pipeline_parser.js.map +1 -0
- package/dist/module/web/pipelines/pipeline_snapshot_serializer.js +89 -0
- package/dist/module/web/pipelines/pipeline_snapshot_serializer.js.map +1 -0
- package/dist/module/web/query.js +95 -0
- package/dist/module/web/query.js.map +1 -0
- package/dist/typescript/lib/FieldPath.d.ts +10 -0
- package/dist/typescript/lib/FieldPath.d.ts.map +1 -0
- package/dist/typescript/lib/FieldValue.d.ts +17 -0
- package/dist/typescript/lib/FieldValue.d.ts.map +1 -0
- package/dist/typescript/lib/FirestoreAggregate.d.ts +40 -0
- package/dist/typescript/lib/FirestoreAggregate.d.ts.map +1 -0
- package/dist/typescript/lib/FirestoreBlob.d.ts +11 -0
- package/dist/typescript/lib/FirestoreBlob.d.ts.map +1 -0
- package/dist/typescript/lib/FirestoreCollectionReference.d.ts +15 -0
- package/dist/typescript/lib/FirestoreCollectionReference.d.ts.map +1 -0
- package/dist/typescript/lib/FirestoreDocumentChange.d.ts +27 -0
- package/dist/typescript/lib/FirestoreDocumentChange.d.ts.map +1 -0
- package/dist/typescript/lib/FirestoreDocumentReference.d.ts +30 -0
- package/dist/typescript/lib/FirestoreDocumentReference.d.ts.map +1 -0
- package/dist/typescript/lib/FirestoreDocumentSnapshot.d.ts +30 -0
- package/dist/typescript/lib/FirestoreDocumentSnapshot.d.ts.map +1 -0
- package/dist/typescript/lib/FirestoreFilter.d.ts +52 -0
- package/dist/typescript/lib/FirestoreFilter.d.ts.map +1 -0
- package/dist/typescript/lib/FirestoreGeoPoint.d.ts +22 -0
- package/dist/typescript/lib/FirestoreGeoPoint.d.ts.map +1 -0
- package/dist/typescript/lib/FirestorePath.d.ts +12 -0
- package/dist/typescript/lib/FirestorePath.d.ts.map +1 -0
- package/dist/typescript/lib/FirestorePersistentCacheIndexManager.d.ts +16 -0
- package/dist/typescript/lib/FirestorePersistentCacheIndexManager.d.ts.map +1 -0
- package/dist/typescript/lib/FirestoreQuery.d.ts +39 -0
- package/dist/typescript/lib/FirestoreQuery.d.ts.map +1 -0
- package/dist/typescript/lib/FirestoreQueryModifiers.d.ts +59 -0
- package/dist/typescript/lib/FirestoreQueryModifiers.d.ts.map +1 -0
- package/dist/typescript/lib/FirestoreQuerySnapshot.d.ts +49 -0
- package/dist/typescript/lib/FirestoreQuerySnapshot.d.ts.map +1 -0
- package/dist/typescript/lib/FirestoreSnapshotMetadata.d.ts +8 -0
- package/dist/typescript/lib/FirestoreSnapshotMetadata.d.ts.map +1 -0
- package/dist/typescript/lib/FirestoreStatics.d.ts +23 -0
- package/dist/typescript/lib/FirestoreStatics.d.ts.map +1 -0
- package/dist/typescript/lib/FirestoreTimestamp.d.ts +33 -0
- package/dist/typescript/lib/FirestoreTimestamp.d.ts.map +1 -0
- package/dist/typescript/lib/FirestoreTransaction.d.ts +42 -0
- package/dist/typescript/lib/FirestoreTransaction.d.ts.map +1 -0
- package/dist/typescript/lib/FirestoreTransactionHandler.d.ts +26 -0
- package/dist/typescript/lib/FirestoreTransactionHandler.d.ts.map +1 -0
- package/dist/typescript/lib/FirestoreVectorValue.d.ts +17 -0
- package/dist/typescript/lib/FirestoreVectorValue.d.ts.map +1 -0
- package/dist/typescript/lib/FirestoreWriteBatch.d.ts +21 -0
- package/dist/typescript/lib/FirestoreWriteBatch.d.ts.map +1 -0
- package/dist/typescript/lib/LoadBundleTask.d.ts +16 -0
- package/dist/typescript/lib/LoadBundleTask.d.ts.map +1 -0
- package/dist/typescript/lib/index.d.ts +6 -0
- package/dist/typescript/lib/index.d.ts.map +1 -0
- package/dist/typescript/lib/modular/Bytes.d.ts +22 -0
- package/dist/typescript/lib/modular/Bytes.d.ts.map +1 -0
- package/dist/typescript/lib/modular/FieldPath.d.ts +4 -0
- package/dist/typescript/lib/modular/FieldPath.d.ts.map +1 -0
- package/dist/typescript/lib/modular/FieldValue.d.ts +8 -0
- package/dist/typescript/lib/modular/FieldValue.d.ts.map +1 -0
- package/dist/typescript/lib/modular/GeoPoint.d.ts +3 -0
- package/dist/typescript/lib/modular/GeoPoint.d.ts.map +1 -0
- package/dist/typescript/lib/modular/Timestamp.d.ts +3 -0
- package/dist/typescript/lib/modular/Timestamp.d.ts.map +1 -0
- package/dist/typescript/lib/modular/VectorValue.d.ts +4 -0
- package/dist/typescript/lib/modular/VectorValue.d.ts.map +1 -0
- package/dist/typescript/lib/modular/query.d.ts +93 -0
- package/dist/typescript/lib/modular/query.d.ts.map +1 -0
- package/dist/typescript/lib/modular/snapshot.d.ts +30 -0
- package/dist/typescript/lib/modular/snapshot.d.ts.map +1 -0
- package/dist/typescript/lib/modular.d.ts +69 -0
- package/dist/typescript/lib/modular.d.ts.map +1 -0
- package/dist/typescript/lib/namespaced.d.ts +13 -0
- package/dist/typescript/lib/namespaced.d.ts.map +1 -0
- package/dist/typescript/lib/pipelines/expressions.d.ts +723 -0
- package/dist/typescript/lib/pipelines/expressions.d.ts.map +1 -0
- package/dist/typescript/lib/pipelines/index.d.ts +31 -0
- package/dist/typescript/lib/pipelines/index.d.ts.map +1 -0
- package/dist/typescript/lib/pipelines/pipeline-result.d.ts +30 -0
- package/dist/typescript/lib/pipelines/pipeline-result.d.ts.map +1 -0
- package/dist/typescript/lib/pipelines/pipeline-source.d.ts +64 -0
- package/dist/typescript/lib/pipelines/pipeline-source.d.ts.map +1 -0
- package/dist/typescript/lib/pipelines/pipeline.d.ts +61 -0
- package/dist/typescript/lib/pipelines/pipeline.d.ts.map +1 -0
- package/dist/typescript/lib/pipelines/pipeline_impl.d.ts +21 -0
- package/dist/typescript/lib/pipelines/pipeline_impl.d.ts.map +1 -0
- package/dist/typescript/lib/pipelines/pipeline_options.d.ts +17 -0
- package/dist/typescript/lib/pipelines/pipeline_options.d.ts.map +1 -0
- package/dist/typescript/lib/pipelines/pipeline_runtime.d.ts +10 -0
- package/dist/typescript/lib/pipelines/pipeline_runtime.d.ts.map +1 -0
- package/dist/typescript/lib/pipelines/pipeline_support.d.ts +7 -0
- package/dist/typescript/lib/pipelines/pipeline_support.d.ts.map +1 -0
- package/dist/typescript/lib/pipelines/pipeline_validate.d.ts +9 -0
- package/dist/typescript/lib/pipelines/pipeline_validate.d.ts.map +1 -0
- package/dist/typescript/lib/pipelines/stage_options.d.ts +326 -0
- package/dist/typescript/lib/pipelines/stage_options.d.ts.map +1 -0
- package/dist/typescript/lib/pipelines/types.d.ts +10 -0
- package/dist/typescript/lib/pipelines/types.d.ts.map +1 -0
- package/dist/typescript/lib/types/firestore.d.ts +263 -0
- package/dist/typescript/lib/types/firestore.d.ts.map +1 -0
- package/dist/typescript/lib/types/internal.d.ts +483 -0
- package/dist/typescript/lib/types/internal.d.ts.map +1 -0
- package/dist/typescript/lib/types/namespaced.d.ts +2285 -0
- package/dist/typescript/lib/types/namespaced.d.ts.map +1 -0
- package/dist/typescript/lib/utils/index.d.ts +15 -0
- package/dist/typescript/lib/utils/index.d.ts.map +1 -0
- package/dist/typescript/lib/utils/serialize.d.ts +17 -0
- package/dist/typescript/lib/utils/serialize.d.ts.map +1 -0
- package/dist/typescript/lib/utils/typemap.d.ts +3 -0
- package/dist/typescript/lib/utils/typemap.d.ts.map +1 -0
- package/dist/typescript/lib/version.d.ts +2 -0
- package/dist/typescript/lib/version.d.ts.map +1 -0
- package/dist/typescript/lib/web/RNFBFirestoreModule.android.d.ts +3 -0
- package/dist/typescript/lib/web/RNFBFirestoreModule.android.d.ts.map +1 -0
- package/dist/typescript/lib/web/RNFBFirestoreModule.d.ts +75 -0
- package/dist/typescript/lib/web/RNFBFirestoreModule.d.ts.map +1 -0
- package/dist/typescript/lib/web/RNFBFirestoreModule.ios.d.ts +3 -0
- package/dist/typescript/lib/web/RNFBFirestoreModule.ios.d.ts.map +1 -0
- package/dist/typescript/lib/web/convert.d.ts +14 -0
- package/dist/typescript/lib/web/convert.d.ts.map +1 -0
- package/dist/typescript/lib/web/pipelines/pipeline.d.ts +4 -0
- package/dist/typescript/lib/web/pipelines/pipeline.d.ts.map +1 -0
- package/dist/typescript/lib/web/pipelines/pipeline_bridge_factory.d.ts +5 -0
- package/dist/typescript/lib/web/pipelines/pipeline_bridge_factory.d.ts.map +1 -0
- package/dist/typescript/lib/web/pipelines/pipeline_node_builder.d.ts +5 -0
- package/dist/typescript/lib/web/pipelines/pipeline_node_builder.d.ts.map +1 -0
- package/dist/typescript/lib/web/pipelines/pipeline_parser.d.ts +3 -0
- package/dist/typescript/lib/web/pipelines/pipeline_parser.d.ts.map +1 -0
- package/dist/typescript/lib/web/pipelines/pipeline_snapshot_serializer.d.ts +4 -0
- package/dist/typescript/lib/web/pipelines/pipeline_snapshot_serializer.d.ts.map +1 -0
- package/dist/typescript/lib/web/query.d.ts +23 -0
- package/dist/typescript/lib/web/query.d.ts.map +1 -0
- package/dist/typescript/package.json +1 -0
- package/ios/RNFBFirestore/RNFBFirestoreCollectionModule.m +52 -2
- package/ios/RNFBFirestore/RNFBFirestorePipelineBridgeFactory.swift +384 -0
- package/ios/RNFBFirestore/RNFBFirestorePipelineCallHandler.swift +86 -0
- package/ios/RNFBFirestore/RNFBFirestorePipelineNodeBuilder.swift +1500 -0
- package/ios/RNFBFirestore/RNFBFirestorePipelineParser.swift +1352 -0
- package/ios/RNFBFirestore/RNFBFirestorePipelineSnapshotSerializer.swift +98 -0
- package/lib/{FirestoreFieldPath.js → FieldPath.ts} +10 -12
- package/lib/{FirestoreFieldValue.js → FieldValue.ts} +22 -19
- package/lib/FirestoreAggregate.ts +124 -0
- package/lib/FirestoreBlob.ts +73 -0
- package/lib/FirestoreCollectionReference.ts +99 -0
- package/lib/FirestoreDocumentChange.ts +71 -0
- package/lib/FirestoreDocumentReference.ts +310 -0
- package/lib/FirestoreDocumentSnapshot.ts +149 -0
- package/lib/FirestoreFilter.ts +232 -0
- package/lib/{FirestoreGeoPoint.js → FirestoreGeoPoint.ts} +48 -8
- package/lib/FirestorePath.ts +54 -0
- package/lib/FirestorePersistentCacheIndexManager.ts +46 -0
- package/lib/{FirestoreQuery.js → FirestoreQuery.ts} +208 -100
- package/lib/FirestoreQueryModifiers.ts +411 -0
- package/lib/{FirestoreQuerySnapshot.js → FirestoreQuerySnapshot.ts} +61 -32
- package/lib/{FirestoreSnapshotMetadata.js → FirestoreSnapshotMetadata.ts} +8 -6
- package/lib/{FirestoreStatics.js → FirestoreStatics.ts} +18 -11
- package/lib/FirestoreTimestamp.ts +161 -0
- package/lib/{FirestoreTransaction.js → FirestoreTransaction.ts} +64 -27
- package/lib/{FirestoreTransactionHandler.js → FirestoreTransactionHandler.ts} +54 -75
- package/lib/{FirestoreVectorValue.js → FirestoreVectorValue.ts} +36 -15
- package/lib/{FirestoreWriteBatch.js → FirestoreWriteBatch.ts} +45 -21
- package/lib/LoadBundleTask.ts +85 -0
- package/lib/index.ts +71 -0
- package/lib/modular/Bytes.ts +81 -0
- package/lib/modular/FieldPath.ts +24 -0
- package/lib/modular/FieldValue.ts +40 -0
- package/lib/modular/GeoPoint.ts +20 -0
- package/lib/modular/Timestamp.ts +20 -0
- package/lib/modular/VectorValue.ts +24 -0
- package/lib/modular/query.ts +368 -0
- package/lib/modular/snapshot.ts +137 -0
- package/lib/modular.ts +552 -0
- package/lib/{index.js → namespaced.ts} +170 -80
- package/lib/pipelines/expressions.ts +2321 -0
- package/lib/pipelines/index.ts +203 -0
- package/lib/pipelines/pipeline-result.ts +78 -0
- package/lib/pipelines/pipeline-source.ts +83 -0
- package/lib/pipelines/pipeline.ts +99 -0
- package/lib/pipelines/pipeline_impl.ts +46 -0
- package/lib/pipelines/pipeline_options.ts +32 -0
- package/lib/pipelines/pipeline_runtime.ts +863 -0
- package/lib/pipelines/pipeline_support.ts +134 -0
- package/lib/pipelines/pipeline_validate.ts +242 -0
- package/lib/pipelines/stage_options.ts +376 -0
- package/lib/pipelines/types.ts +26 -0
- package/lib/types/firestore.ts +477 -0
- package/lib/types/internal.ts +747 -0
- package/lib/{index.d.ts → types/namespaced.ts} +280 -79
- package/lib/utils/index.ts +244 -0
- package/lib/utils/serialize.ts +314 -0
- package/lib/utils/typemap.ts +65 -0
- package/lib/version.ts +2 -0
- package/lib/web/{RNFBFirestoreModule.js → RNFBFirestoreModule.ts} +222 -234
- package/lib/web/convert.ts +287 -0
- package/lib/web/pipelines/pipeline.ts +47 -0
- package/lib/web/pipelines/pipeline_bridge_factory.ts +377 -0
- package/lib/web/pipelines/pipeline_node_builder.ts +413 -0
- package/lib/web/pipelines/pipeline_parser.ts +23 -0
- package/lib/web/pipelines/pipeline_snapshot_serializer.ts +133 -0
- package/lib/web/query.ts +150 -0
- package/package.json +46 -7
- package/tsconfig.json +35 -0
- package/lib/FirestoreBlob.js +0 -107
- package/lib/FirestoreCollectionReference.js +0 -70
- package/lib/FirestoreDocumentReference.js +0 -222
- package/lib/FirestoreDocumentSnapshot.js +0 -132
- package/lib/FirestoreFilter.js +0 -156
- package/lib/modular/Bytes.d.ts +0 -11
- package/lib/modular/Bytes.js +0 -62
- package/lib/modular/FieldPath.d.ts +0 -20
- package/lib/modular/FieldPath.js +0 -7
- package/lib/modular/FieldValue.d.ts +0 -67
- package/lib/modular/FieldValue.js +0 -41
- package/lib/modular/GeoPoint.d.ts +0 -17
- package/lib/modular/GeoPoint.js +0 -3
- package/lib/modular/Timestamp.d.ts +0 -85
- package/lib/modular/Timestamp.js +0 -3
- package/lib/modular/VectorValue.d.ts +0 -30
- package/lib/modular/VectorValue.js +0 -11
- package/lib/modular/index.d.ts +0 -788
- package/lib/modular/index.js +0 -410
- package/lib/modular/query.d.ts +0 -370
- package/lib/modular/query.js +0 -233
- package/lib/modular/snapshot.d.ts +0 -256
- package/lib/modular/snapshot.js +0 -33
- package/lib/modular/utils/observer.js +0 -16
- package/lib/version.js +0 -2
- package/lib/web/query.js +0 -112
- /package/lib/web/{RNFBFirestoreModule.android.js → RNFBFirestoreModule.android.ts} +0 -0
- /package/lib/web/{RNFBFirestoreModule.ios.js → RNFBFirestoreModule.ios.ts} +0 -0
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/dist/module/common';
|
|
19
|
+
import { _Filter, Filter } from '../FirestoreFilter';
|
|
20
|
+
import type {
|
|
21
|
+
DocumentData,
|
|
22
|
+
DocumentReference,
|
|
23
|
+
DocumentSnapshot,
|
|
24
|
+
OrderByDirection,
|
|
25
|
+
Query,
|
|
26
|
+
QueryConstraintType,
|
|
27
|
+
QuerySnapshot,
|
|
28
|
+
WhereFilterOp,
|
|
29
|
+
} from '../types/firestore';
|
|
30
|
+
import type {
|
|
31
|
+
DocumentReferenceDeleteInternal,
|
|
32
|
+
DocumentReferenceGetInternal,
|
|
33
|
+
QueryFilterConstraintWithFilterInternal,
|
|
34
|
+
QueryInternal,
|
|
35
|
+
QueryWithMethodInternal,
|
|
36
|
+
QueryWithWhereInternal,
|
|
37
|
+
ReferenceIsEqualInternal,
|
|
38
|
+
} from '../types/internal';
|
|
39
|
+
import type { FieldPath } from './FieldPath';
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Abstraction of a constraint that can be applied to a Firestore query.
|
|
43
|
+
* Not exported — public API matches firebase-js-sdk ({@link QueryConstraint} only).
|
|
44
|
+
*/
|
|
45
|
+
abstract class AppliableConstraint {
|
|
46
|
+
abstract _apply<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(
|
|
47
|
+
query: Query<AppModelType, DbModelType>,
|
|
48
|
+
): Query<AppModelType, DbModelType>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* A `QueryConstraint` is used to narrow the set of documents returned by a
|
|
53
|
+
* Firestore query. `QueryConstraint`s are created by invoking {@link where},
|
|
54
|
+
* {@link orderBy}, {@link startAt}, {@link startAfter}, {@link endBefore},
|
|
55
|
+
* {@link endAt}, {@link limit}, {@link limitToLast} and can then be passed to
|
|
56
|
+
* {@link query} to create a new query instance that also contains this `QueryConstraint`.
|
|
57
|
+
*/
|
|
58
|
+
export abstract class QueryConstraint extends AppliableConstraint {
|
|
59
|
+
abstract readonly type: QueryConstraintType;
|
|
60
|
+
|
|
61
|
+
_apply<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(
|
|
62
|
+
_queryRef: Query<AppModelType, DbModelType>,
|
|
63
|
+
): Query<AppModelType, DbModelType> {
|
|
64
|
+
throw new Error('_apply must be implemented by subclass');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Shared _apply for orderBy/limit/startAt/endAt/where. Not exported — implementation detail.
|
|
70
|
+
*/
|
|
71
|
+
abstract class QueryConstraintBase extends QueryConstraint {
|
|
72
|
+
abstract readonly type: QueryConstraintType;
|
|
73
|
+
private readonly _args: unknown[];
|
|
74
|
+
|
|
75
|
+
protected constructor(...args: unknown[]) {
|
|
76
|
+
super();
|
|
77
|
+
this._args = args;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
_apply<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(
|
|
81
|
+
query: Query<AppModelType, DbModelType>,
|
|
82
|
+
): Query<AppModelType, DbModelType> {
|
|
83
|
+
const method = (query as unknown as QueryWithMethodInternal<AppModelType, DbModelType>)[
|
|
84
|
+
this.type
|
|
85
|
+
];
|
|
86
|
+
if (!method) {
|
|
87
|
+
throw new Error(`Query method '${this.type}' is not available on query instance.`);
|
|
88
|
+
}
|
|
89
|
+
return method.call(query, ...this._args, MODULAR_DEPRECATION_ARG);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export class QueryCompositeFilterConstraint extends AppliableConstraint {
|
|
94
|
+
/**
|
|
95
|
+
* @internal
|
|
96
|
+
*/
|
|
97
|
+
protected constructor(
|
|
98
|
+
/** The type of this query constraint */
|
|
99
|
+
readonly type: 'or' | 'and',
|
|
100
|
+
private readonly _queryConstraints: QueryFilterConstraint[],
|
|
101
|
+
) {
|
|
102
|
+
super();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
static _create(
|
|
106
|
+
type: 'or' | 'and',
|
|
107
|
+
_queryConstraints: QueryFilterConstraint[],
|
|
108
|
+
): QueryCompositeFilterConstraint {
|
|
109
|
+
// Validate nested OR filters when creating the constraint
|
|
110
|
+
if (type === 'or') {
|
|
111
|
+
const filters = _queryConstraints.map(constraint => {
|
|
112
|
+
if (constraint instanceof QueryCompositeFilterConstraint) {
|
|
113
|
+
return constraint._filter;
|
|
114
|
+
}
|
|
115
|
+
return (constraint as unknown as QueryFilterConstraintWithFilterInternal)._filter;
|
|
116
|
+
});
|
|
117
|
+
// This will throw if nested OR filters are detected
|
|
118
|
+
Filter.or(...filters);
|
|
119
|
+
}
|
|
120
|
+
return new QueryCompositeFilterConstraint(type, _queryConstraints);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
_apply<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(
|
|
124
|
+
query: Query<AppModelType, DbModelType>,
|
|
125
|
+
): Query<AppModelType, DbModelType> {
|
|
126
|
+
const filters = this._queryConstraints.map(constraint => {
|
|
127
|
+
if (constraint instanceof QueryCompositeFilterConstraint) {
|
|
128
|
+
return constraint._filter;
|
|
129
|
+
}
|
|
130
|
+
return (constraint as unknown as QueryFilterConstraintWithFilterInternal)._filter;
|
|
131
|
+
});
|
|
132
|
+
const _filter = this.type === 'or' ? Filter.or(...filters) : Filter.and(...filters);
|
|
133
|
+
const where = (query as unknown as QueryWithWhereInternal<AppModelType, DbModelType>).where;
|
|
134
|
+
return where.call(query, _filter, MODULAR_DEPRECATION_ARG);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
get _filter(): _Filter {
|
|
138
|
+
const filters = this._queryConstraints.map(constraint => {
|
|
139
|
+
if (constraint instanceof QueryCompositeFilterConstraint) {
|
|
140
|
+
return constraint._filter;
|
|
141
|
+
}
|
|
142
|
+
return (constraint as unknown as QueryFilterConstraintWithFilterInternal)._filter;
|
|
143
|
+
});
|
|
144
|
+
return this.type === 'or' ? Filter.or(...filters) : Filter.and(...filters);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export class QueryOrderByConstraint extends QueryConstraintBase {
|
|
149
|
+
readonly type = 'orderBy';
|
|
150
|
+
|
|
151
|
+
constructor(fieldPath: string | FieldPath, directionStr?: OrderByDirection) {
|
|
152
|
+
super(fieldPath, directionStr);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export class QueryLimitConstraint extends QueryConstraintBase {
|
|
157
|
+
readonly type: 'limit' | 'limitToLast';
|
|
158
|
+
|
|
159
|
+
constructor(type: 'limit' | 'limitToLast', limitValue: number) {
|
|
160
|
+
super(limitValue);
|
|
161
|
+
this.type = type;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export class QueryStartAtConstraint extends QueryConstraintBase {
|
|
166
|
+
readonly type: 'startAt' | 'startAfter';
|
|
167
|
+
|
|
168
|
+
constructor(type: 'startAt' | 'startAfter', ...docOrFields: Array<unknown | DocumentSnapshot>) {
|
|
169
|
+
super(...docOrFields);
|
|
170
|
+
this.type = type;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export class QueryEndAtConstraint extends QueryConstraintBase {
|
|
175
|
+
readonly type: 'endAt' | 'endBefore';
|
|
176
|
+
|
|
177
|
+
constructor(type: 'endAt' | 'endBefore', ...fieldValues: unknown[]) {
|
|
178
|
+
super(...fieldValues);
|
|
179
|
+
this.type = type;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export class QueryFieldFilterConstraint extends QueryConstraintBase {
|
|
184
|
+
readonly type = 'where';
|
|
185
|
+
readonly _filter: _Filter;
|
|
186
|
+
|
|
187
|
+
constructor(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: unknown) {
|
|
188
|
+
super(fieldPath, opStr, value);
|
|
189
|
+
this._filter = Filter(fieldPath, opStr, value);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export type QueryFilterConstraint = QueryFieldFilterConstraint | QueryCompositeFilterConstraint;
|
|
194
|
+
export type QueryNonFilterConstraint =
|
|
195
|
+
| QueryOrderByConstraint
|
|
196
|
+
| QueryLimitConstraint
|
|
197
|
+
| QueryStartAtConstraint
|
|
198
|
+
| QueryEndAtConstraint;
|
|
199
|
+
|
|
200
|
+
export function query<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(
|
|
201
|
+
queryRef: Query<AppModelType, DbModelType>,
|
|
202
|
+
compositeFilter: QueryCompositeFilterConstraint,
|
|
203
|
+
...queryConstraints: QueryNonFilterConstraint[]
|
|
204
|
+
): Query<AppModelType, DbModelType>;
|
|
205
|
+
export function query<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(
|
|
206
|
+
queryRef: Query<AppModelType, DbModelType>,
|
|
207
|
+
...queryConstraints: QueryConstraint[]
|
|
208
|
+
): Query<AppModelType, DbModelType>;
|
|
209
|
+
export function query<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(
|
|
210
|
+
queryRef: Query<AppModelType, DbModelType>,
|
|
211
|
+
queryConstraint: QueryCompositeFilterConstraint | QueryConstraint | undefined,
|
|
212
|
+
...additionalQueryConstraints: Array<QueryConstraint | QueryNonFilterConstraint>
|
|
213
|
+
): Query<AppModelType, DbModelType> {
|
|
214
|
+
let queryConstraints: AppliableConstraint[] = [];
|
|
215
|
+
|
|
216
|
+
if (queryConstraint instanceof AppliableConstraint) {
|
|
217
|
+
queryConstraints.push(queryConstraint);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
queryConstraints = queryConstraints.concat(additionalQueryConstraints);
|
|
221
|
+
|
|
222
|
+
let constrainedQuery = queryRef;
|
|
223
|
+
for (const constraint of queryConstraints) {
|
|
224
|
+
if (!constraint) {
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
constrainedQuery = constraint._apply(constrainedQuery);
|
|
228
|
+
}
|
|
229
|
+
return constrainedQuery;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export function where(
|
|
233
|
+
fieldPath: string | FieldPath,
|
|
234
|
+
opStr: WhereFilterOp,
|
|
235
|
+
value: unknown,
|
|
236
|
+
): QueryFieldFilterConstraint {
|
|
237
|
+
return new QueryFieldFilterConstraint(fieldPath, opStr, value);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export function or(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint {
|
|
241
|
+
return QueryCompositeFilterConstraint._create('or', queryConstraints);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export function and(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint {
|
|
245
|
+
return QueryCompositeFilterConstraint._create('and', queryConstraints);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export function orderBy(
|
|
249
|
+
fieldPath: string | FieldPath,
|
|
250
|
+
directionStr?: OrderByDirection,
|
|
251
|
+
): QueryOrderByConstraint {
|
|
252
|
+
return new QueryOrderByConstraint(fieldPath, directionStr);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export function startAt<
|
|
256
|
+
AppModelType = DocumentData,
|
|
257
|
+
DbModelType extends DocumentData = DocumentData,
|
|
258
|
+
>(snapshot: DocumentSnapshot<AppModelType, DbModelType>): QueryStartAtConstraint;
|
|
259
|
+
export function startAt(...fieldValues: unknown[]): QueryStartAtConstraint;
|
|
260
|
+
export function startAt(...docOrFields: Array<unknown | DocumentSnapshot>): QueryStartAtConstraint {
|
|
261
|
+
return new QueryStartAtConstraint('startAt', ...docOrFields);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export function startAfter<
|
|
265
|
+
AppModelType = DocumentData,
|
|
266
|
+
DbModelType extends DocumentData = DocumentData,
|
|
267
|
+
>(snapshot: DocumentSnapshot<AppModelType, DbModelType>): QueryStartAtConstraint;
|
|
268
|
+
export function startAfter(...fieldValues: unknown[]): QueryStartAtConstraint;
|
|
269
|
+
export function startAfter(
|
|
270
|
+
...docOrFields: Array<unknown | DocumentSnapshot>
|
|
271
|
+
): QueryStartAtConstraint {
|
|
272
|
+
return new QueryStartAtConstraint('startAfter', ...docOrFields);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export function endAt<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(
|
|
276
|
+
snapshot: DocumentSnapshot<AppModelType, DbModelType>,
|
|
277
|
+
): QueryEndAtConstraint;
|
|
278
|
+
export function endAt(...fieldValues: unknown[]): QueryEndAtConstraint;
|
|
279
|
+
export function endAt(...args: unknown[]): QueryEndAtConstraint {
|
|
280
|
+
return new QueryEndAtConstraint('endAt', ...args);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export function endBefore<
|
|
284
|
+
AppModelType = DocumentData,
|
|
285
|
+
DbModelType extends DocumentData = DocumentData,
|
|
286
|
+
>(snapshot: DocumentSnapshot<AppModelType, DbModelType>): QueryEndAtConstraint;
|
|
287
|
+
export function endBefore(...fieldValues: unknown[]): QueryEndAtConstraint;
|
|
288
|
+
export function endBefore(...fieldValues: unknown[]): QueryEndAtConstraint {
|
|
289
|
+
return new QueryEndAtConstraint('endBefore', ...fieldValues);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export function limit(limitValue: number): QueryLimitConstraint {
|
|
293
|
+
return new QueryLimitConstraint('limit', limitValue);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export function limitToLast(limitValue: number): QueryLimitConstraint {
|
|
297
|
+
return new QueryLimitConstraint('limitToLast', limitValue);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export function getDoc<
|
|
301
|
+
AppModelType = DocumentData,
|
|
302
|
+
DbModelType extends DocumentData = DocumentData,
|
|
303
|
+
>(
|
|
304
|
+
reference: DocumentReference<AppModelType, DbModelType>,
|
|
305
|
+
): Promise<DocumentSnapshot<AppModelType, DbModelType>> {
|
|
306
|
+
const get = (reference as unknown as DocumentReferenceGetInternal<AppModelType, DbModelType>).get;
|
|
307
|
+
return get.call(reference, { source: 'default' }, MODULAR_DEPRECATION_ARG);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export function getDocFromCache<
|
|
311
|
+
AppModelType = DocumentData,
|
|
312
|
+
DbModelType extends DocumentData = DocumentData,
|
|
313
|
+
>(
|
|
314
|
+
reference: DocumentReference<AppModelType, DbModelType>,
|
|
315
|
+
): Promise<DocumentSnapshot<AppModelType, DbModelType>> {
|
|
316
|
+
const get = (reference as unknown as DocumentReferenceGetInternal<AppModelType, DbModelType>).get;
|
|
317
|
+
return get.call(reference, { source: 'cache' }, MODULAR_DEPRECATION_ARG);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export function getDocFromServer<
|
|
321
|
+
AppModelType = DocumentData,
|
|
322
|
+
DbModelType extends DocumentData = DocumentData,
|
|
323
|
+
>(
|
|
324
|
+
reference: DocumentReference<AppModelType, DbModelType>,
|
|
325
|
+
): Promise<DocumentSnapshot<AppModelType, DbModelType>> {
|
|
326
|
+
const get = (reference as unknown as DocumentReferenceGetInternal<AppModelType, DbModelType>).get;
|
|
327
|
+
return get.call(reference, { source: 'server' }, MODULAR_DEPRECATION_ARG);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export function getDocs<
|
|
331
|
+
AppModelType = DocumentData,
|
|
332
|
+
DbModelType extends DocumentData = DocumentData,
|
|
333
|
+
>(queryRef: Query<AppModelType, DbModelType>): Promise<QuerySnapshot<AppModelType, DbModelType>> {
|
|
334
|
+
const get = (queryRef as unknown as QueryInternal<AppModelType, DbModelType>).get;
|
|
335
|
+
return get.call(queryRef, { source: 'default' }, MODULAR_DEPRECATION_ARG);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export function getDocsFromCache<
|
|
339
|
+
AppModelType = DocumentData,
|
|
340
|
+
DbModelType extends DocumentData = DocumentData,
|
|
341
|
+
>(queryRef: Query<AppModelType, DbModelType>): Promise<QuerySnapshot<AppModelType, DbModelType>> {
|
|
342
|
+
const get = (queryRef as unknown as QueryInternal<AppModelType, DbModelType>).get;
|
|
343
|
+
return get.call(queryRef, { source: 'cache' }, MODULAR_DEPRECATION_ARG);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export function getDocsFromServer<
|
|
347
|
+
AppModelType = DocumentData,
|
|
348
|
+
DbModelType extends DocumentData = DocumentData,
|
|
349
|
+
>(queryRef: Query<AppModelType, DbModelType>): Promise<QuerySnapshot<AppModelType, DbModelType>> {
|
|
350
|
+
const get = (queryRef as unknown as QueryInternal<AppModelType, DbModelType>).get;
|
|
351
|
+
return get.call(queryRef, { source: 'server' }, MODULAR_DEPRECATION_ARG);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export function deleteDoc<
|
|
355
|
+
AppModelType = DocumentData,
|
|
356
|
+
DbModelType extends DocumentData = DocumentData,
|
|
357
|
+
>(reference: DocumentReference<AppModelType, DbModelType>): Promise<void> {
|
|
358
|
+
const remove = (reference as unknown as DocumentReferenceDeleteInternal).delete;
|
|
359
|
+
return remove.call(reference, MODULAR_DEPRECATION_ARG);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export function queryEqual<
|
|
363
|
+
AppModelType = DocumentData,
|
|
364
|
+
DbModelType extends DocumentData = DocumentData,
|
|
365
|
+
>(left: Query<AppModelType, DbModelType>, right: Query<AppModelType, DbModelType>): boolean {
|
|
366
|
+
const isEqual = (left as unknown as ReferenceIsEqualInternal).isEqual;
|
|
367
|
+
return isEqual.call(left, right, MODULAR_DEPRECATION_ARG);
|
|
368
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/dist/module/common';
|
|
19
|
+
import type {
|
|
20
|
+
DocumentSnapshot,
|
|
21
|
+
DocumentData,
|
|
22
|
+
DocumentReference,
|
|
23
|
+
FirestoreError,
|
|
24
|
+
Query,
|
|
25
|
+
QuerySnapshot,
|
|
26
|
+
SnapshotListenOptions,
|
|
27
|
+
Unsubscribe,
|
|
28
|
+
} from '../types/firestore';
|
|
29
|
+
import type { ReferenceIsEqualInternal, ReferenceWithOnSnapshotInternal } from '../types/internal';
|
|
30
|
+
|
|
31
|
+
export { default as DocumentSnapshot } from '../FirestoreDocumentSnapshot';
|
|
32
|
+
export { default as QuerySnapshot } from '../FirestoreQuerySnapshot';
|
|
33
|
+
export { default as SnapshotMetadata } from '../FirestoreSnapshotMetadata';
|
|
34
|
+
|
|
35
|
+
export function onSnapshot<
|
|
36
|
+
AppModelType = DocumentData,
|
|
37
|
+
DbModelType extends DocumentData = DocumentData,
|
|
38
|
+
>(
|
|
39
|
+
reference: DocumentReference<AppModelType, DbModelType>,
|
|
40
|
+
observer: {
|
|
41
|
+
next?: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void;
|
|
42
|
+
error?: (error: FirestoreError) => void;
|
|
43
|
+
complete?: () => void;
|
|
44
|
+
},
|
|
45
|
+
): Unsubscribe;
|
|
46
|
+
export function onSnapshot<
|
|
47
|
+
AppModelType = DocumentData,
|
|
48
|
+
DbModelType extends DocumentData = DocumentData,
|
|
49
|
+
>(
|
|
50
|
+
reference: DocumentReference<AppModelType, DbModelType>,
|
|
51
|
+
options: SnapshotListenOptions,
|
|
52
|
+
observer: {
|
|
53
|
+
next?: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void;
|
|
54
|
+
error?: (error: FirestoreError) => void;
|
|
55
|
+
complete?: () => void;
|
|
56
|
+
},
|
|
57
|
+
): Unsubscribe;
|
|
58
|
+
export function onSnapshot<
|
|
59
|
+
AppModelType = DocumentData,
|
|
60
|
+
DbModelType extends DocumentData = DocumentData,
|
|
61
|
+
>(
|
|
62
|
+
reference: DocumentReference<AppModelType, DbModelType>,
|
|
63
|
+
onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void,
|
|
64
|
+
onError?: (error: FirestoreError) => void,
|
|
65
|
+
onCompletion?: () => void,
|
|
66
|
+
): Unsubscribe;
|
|
67
|
+
export function onSnapshot<
|
|
68
|
+
AppModelType = DocumentData,
|
|
69
|
+
DbModelType extends DocumentData = DocumentData,
|
|
70
|
+
>(
|
|
71
|
+
reference: DocumentReference<AppModelType, DbModelType>,
|
|
72
|
+
options: SnapshotListenOptions,
|
|
73
|
+
onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void,
|
|
74
|
+
onError?: (error: FirestoreError) => void,
|
|
75
|
+
onCompletion?: () => void,
|
|
76
|
+
): Unsubscribe;
|
|
77
|
+
export function onSnapshot<
|
|
78
|
+
AppModelType = DocumentData,
|
|
79
|
+
DbModelType extends DocumentData = DocumentData,
|
|
80
|
+
>(
|
|
81
|
+
query: Query<AppModelType, DbModelType>,
|
|
82
|
+
observer: {
|
|
83
|
+
next?: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
|
|
84
|
+
error?: (error: FirestoreError) => void;
|
|
85
|
+
complete?: () => void;
|
|
86
|
+
},
|
|
87
|
+
): Unsubscribe;
|
|
88
|
+
export function onSnapshot<
|
|
89
|
+
AppModelType = DocumentData,
|
|
90
|
+
DbModelType extends DocumentData = DocumentData,
|
|
91
|
+
>(
|
|
92
|
+
query: Query<AppModelType, DbModelType>,
|
|
93
|
+
options: SnapshotListenOptions,
|
|
94
|
+
observer: {
|
|
95
|
+
next?: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
|
|
96
|
+
error?: (error: FirestoreError) => void;
|
|
97
|
+
complete?: () => void;
|
|
98
|
+
},
|
|
99
|
+
): Unsubscribe;
|
|
100
|
+
export function onSnapshot<
|
|
101
|
+
AppModelType = DocumentData,
|
|
102
|
+
DbModelType extends DocumentData = DocumentData,
|
|
103
|
+
>(
|
|
104
|
+
query: Query<AppModelType, DbModelType>,
|
|
105
|
+
onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void,
|
|
106
|
+
onError?: (error: FirestoreError) => void,
|
|
107
|
+
onCompletion?: () => void,
|
|
108
|
+
): Unsubscribe;
|
|
109
|
+
export function onSnapshot<
|
|
110
|
+
AppModelType = DocumentData,
|
|
111
|
+
DbModelType extends DocumentData = DocumentData,
|
|
112
|
+
>(
|
|
113
|
+
query: Query<AppModelType, DbModelType>,
|
|
114
|
+
options: SnapshotListenOptions,
|
|
115
|
+
onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void,
|
|
116
|
+
onError?: (error: FirestoreError) => void,
|
|
117
|
+
onCompletion?: () => void,
|
|
118
|
+
): Unsubscribe;
|
|
119
|
+
export function onSnapshot<
|
|
120
|
+
AppModelType = DocumentData,
|
|
121
|
+
DbModelType extends DocumentData = DocumentData,
|
|
122
|
+
>(
|
|
123
|
+
reference: Query<AppModelType, DbModelType> | DocumentReference<AppModelType, DbModelType>,
|
|
124
|
+
...args: unknown[]
|
|
125
|
+
): Unsubscribe {
|
|
126
|
+
const onSnapshotMethod = (reference as unknown as ReferenceWithOnSnapshotInternal).onSnapshot;
|
|
127
|
+
|
|
128
|
+
return onSnapshotMethod.call(reference, ...args, MODULAR_DEPRECATION_ARG);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function snapshotEqual<AppModelType, DbModelType extends DocumentData>(
|
|
132
|
+
left: DocumentSnapshot<AppModelType, DbModelType> | QuerySnapshot<AppModelType, DbModelType>,
|
|
133
|
+
right: DocumentSnapshot<AppModelType, DbModelType> | QuerySnapshot<AppModelType, DbModelType>,
|
|
134
|
+
): boolean {
|
|
135
|
+
const isEqual = (left as unknown as ReferenceIsEqualInternal).isEqual;
|
|
136
|
+
return isEqual.call(left, right, MODULAR_DEPRECATION_ARG);
|
|
137
|
+
}
|