@react-native-firebase/firestore 23.8.8 → 24.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -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
|
@@ -16,37 +16,71 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import {
|
|
19
|
+
createDeprecationProxy,
|
|
20
|
+
filterModularArgument,
|
|
19
21
|
isArray,
|
|
20
22
|
isNull,
|
|
21
23
|
isObject,
|
|
22
24
|
isString,
|
|
23
25
|
isUndefined,
|
|
24
|
-
filterModularArgument,
|
|
25
|
-
createDeprecationProxy,
|
|
26
26
|
} from '@react-native-firebase/app/dist/module/common';
|
|
27
27
|
import NativeError from '@react-native-firebase/app/dist/module/internal/NativeFirebaseError';
|
|
28
|
-
import {
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import FirestoreQuerySnapshot from './FirestoreQuerySnapshot';
|
|
32
|
-
import { parseSnapshotArgs } from './utils';
|
|
28
|
+
import { AggregateQuery } from './FirestoreAggregate';
|
|
29
|
+
import DocumentSnapshot from './FirestoreDocumentSnapshot';
|
|
30
|
+
import FieldPath, { fromDotSeparatedString } from './FieldPath';
|
|
33
31
|
import { _Filter, generateFilters } from './FirestoreFilter';
|
|
32
|
+
import QueryModifiers from './FirestoreQueryModifiers';
|
|
33
|
+
import QuerySnapshot, { type QuerySnapshotNativeData } from './FirestoreQuerySnapshot';
|
|
34
|
+
import { parseSnapshotArgs, validateWithConverter } from './utils';
|
|
35
|
+
|
|
36
|
+
import type FirestorePath from './FirestorePath';
|
|
37
|
+
import type { DocumentData, FirestoreDataConverter } from './types/firestore';
|
|
38
|
+
import type {
|
|
39
|
+
FirestoreInternal,
|
|
40
|
+
DocumentFieldValueInternal,
|
|
41
|
+
FirestoreSyncEventErrorInternal,
|
|
42
|
+
FirestoreSyncEventBodyInternal,
|
|
43
|
+
} from './types/internal';
|
|
34
44
|
|
|
35
45
|
let _id = 0;
|
|
36
46
|
|
|
37
|
-
export default class
|
|
38
|
-
|
|
47
|
+
export default class Query {
|
|
48
|
+
_firestore: FirestoreInternal;
|
|
49
|
+
_collectionPath: FirestorePath;
|
|
50
|
+
_modifiers: QueryModifiers;
|
|
51
|
+
_queryName: string | undefined;
|
|
52
|
+
_converter: FirestoreDataConverter<DocumentData, DocumentData> | null;
|
|
53
|
+
|
|
54
|
+
/** Satisfies Query<DocumentData, DocumentData> for AggregateQuerySnapshot and similar. */
|
|
55
|
+
readonly type = 'query' as const;
|
|
56
|
+
|
|
57
|
+
constructor(
|
|
58
|
+
firestore: FirestoreInternal,
|
|
59
|
+
collectionPath: FirestorePath,
|
|
60
|
+
modifiers: QueryModifiers,
|
|
61
|
+
queryName?: string,
|
|
62
|
+
converter?: FirestoreDataConverter<DocumentData, DocumentData> | null,
|
|
63
|
+
) {
|
|
39
64
|
this._firestore = firestore;
|
|
40
65
|
this._collectionPath = collectionPath;
|
|
41
66
|
this._modifiers = modifiers;
|
|
42
67
|
this._queryName = queryName;
|
|
68
|
+
this._converter = converter ?? null;
|
|
43
69
|
}
|
|
44
70
|
|
|
45
|
-
get firestore() {
|
|
71
|
+
get firestore(): FirestoreInternal {
|
|
46
72
|
return this._firestore;
|
|
47
73
|
}
|
|
48
74
|
|
|
49
|
-
|
|
75
|
+
get converter(): FirestoreDataConverter<DocumentData, DocumentData> | null {
|
|
76
|
+
return this._converter;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
_handleQueryCursor(
|
|
80
|
+
cursor: 'startAt' | 'startAfter' | 'endAt' | 'endBefore',
|
|
81
|
+
docOrField: DocumentSnapshot | DocumentFieldValueInternal,
|
|
82
|
+
fields: DocumentFieldValueInternal[],
|
|
83
|
+
): QueryModifiers {
|
|
50
84
|
const modifiers = this._modifiers._copy();
|
|
51
85
|
|
|
52
86
|
if (isUndefined(docOrField)) {
|
|
@@ -55,8 +89,7 @@ export default class FirestoreQuery {
|
|
|
55
89
|
);
|
|
56
90
|
}
|
|
57
91
|
|
|
58
|
-
|
|
59
|
-
if (docOrField instanceof FirestoreDocumentSnapshot) {
|
|
92
|
+
if (docOrField instanceof DocumentSnapshot) {
|
|
60
93
|
if (fields.length > 0) {
|
|
61
94
|
throw new Error(
|
|
62
95
|
`firebase.firestore().collection().${cursor}(*) Too many arguments provided. Expected DocumentSnapshot or list of field values.`,
|
|
@@ -72,40 +105,47 @@ export default class FirestoreQuery {
|
|
|
72
105
|
}
|
|
73
106
|
|
|
74
107
|
const currentOrders = modifiers.orders;
|
|
75
|
-
|
|
76
|
-
const values = [];
|
|
108
|
+
const values: DocumentFieldValueInternal[] = [];
|
|
77
109
|
|
|
78
110
|
for (let i = 0; i < currentOrders.length; i++) {
|
|
79
|
-
const order = currentOrders[i]
|
|
80
|
-
|
|
81
|
-
|
|
111
|
+
const order = currentOrders[i]!;
|
|
112
|
+
const pathStr = Array.isArray(order.fieldPath)
|
|
113
|
+
? order.fieldPath.join('.')
|
|
114
|
+
: String(order.fieldPath);
|
|
115
|
+
if (pathStr === '__name__') {
|
|
82
116
|
continue;
|
|
83
117
|
}
|
|
84
118
|
|
|
85
|
-
const value = documentSnapshot.get(
|
|
119
|
+
const value = documentSnapshot.get(
|
|
120
|
+
Array.isArray(order.fieldPath)
|
|
121
|
+
? new FieldPath(...order.fieldPath)
|
|
122
|
+
: (order.fieldPath as string | FieldPath),
|
|
123
|
+
);
|
|
86
124
|
|
|
87
125
|
if (value === undefined) {
|
|
88
126
|
throw new Error(
|
|
89
|
-
`firebase.firestore().collection().${cursor}(*) You are trying to start or end a query using a document for which the field '${
|
|
127
|
+
`firebase.firestore().collection().${cursor}(*) You are trying to start or end a query using a document for which the field '${pathStr}' (used as the orderBy) does not exist.`,
|
|
90
128
|
);
|
|
91
129
|
}
|
|
92
130
|
|
|
93
131
|
values.push(value);
|
|
94
132
|
}
|
|
95
133
|
|
|
96
|
-
// Based on https://github.com/invertase/react-native-firebase/issues/2854#issuecomment-552986650
|
|
97
134
|
if (modifiers._orders.length) {
|
|
98
|
-
const lastOrder = modifiers._orders[modifiers._orders.length - 1]
|
|
99
|
-
|
|
100
|
-
|
|
135
|
+
const lastOrder = modifiers._orders[modifiers._orders.length - 1]!;
|
|
136
|
+
const lastPathStr =
|
|
137
|
+
lastOrder.fieldPath instanceof FieldPath
|
|
138
|
+
? lastOrder.fieldPath._toPath()
|
|
139
|
+
: String(lastOrder.fieldPath);
|
|
140
|
+
if (lastPathStr !== '__name__') {
|
|
101
141
|
modifiers._orders.push({
|
|
102
|
-
fieldPath: '__name__',
|
|
142
|
+
fieldPath: new FieldPath('__name__'),
|
|
103
143
|
direction: lastOrder.direction,
|
|
104
144
|
});
|
|
105
145
|
}
|
|
106
146
|
} else {
|
|
107
147
|
modifiers._orders.push({
|
|
108
|
-
fieldPath: '__name__',
|
|
148
|
+
fieldPath: new FieldPath('__name__'),
|
|
109
149
|
direction: 'ASCENDING',
|
|
110
150
|
});
|
|
111
151
|
}
|
|
@@ -119,10 +159,6 @@ export default class FirestoreQuery {
|
|
|
119
159
|
return modifiers.setFieldsCursor(cursor, values);
|
|
120
160
|
}
|
|
121
161
|
|
|
122
|
-
/**
|
|
123
|
-
* Assumes list of field values to query by. Orders must be of equal length.
|
|
124
|
-
*/
|
|
125
|
-
|
|
126
162
|
const allFields = [docOrField].concat(fields);
|
|
127
163
|
|
|
128
164
|
if (allFields.length > modifiers.orders.length) {
|
|
@@ -134,40 +170,47 @@ export default class FirestoreQuery {
|
|
|
134
170
|
return modifiers.setFieldsCursor(cursor, allFields);
|
|
135
171
|
}
|
|
136
172
|
|
|
137
|
-
count() {
|
|
173
|
+
count(): ReturnType<typeof createDeprecationProxy> {
|
|
138
174
|
return createDeprecationProxy(
|
|
139
|
-
new
|
|
175
|
+
new AggregateQuery(this._firestore, this, this._collectionPath, this._modifiers),
|
|
140
176
|
);
|
|
141
177
|
}
|
|
142
178
|
|
|
143
|
-
countFromServer() {
|
|
144
|
-
// deprecation warning called in count()
|
|
179
|
+
countFromServer(): ReturnType<Query['count']> {
|
|
145
180
|
return this.count();
|
|
146
181
|
}
|
|
147
182
|
|
|
148
|
-
endAt(
|
|
183
|
+
endAt(
|
|
184
|
+
docOrField: DocumentSnapshot | DocumentFieldValueInternal,
|
|
185
|
+
...fields: DocumentFieldValueInternal[]
|
|
186
|
+
): ReturnType<typeof createDeprecationProxy> {
|
|
149
187
|
return createDeprecationProxy(
|
|
150
|
-
new
|
|
188
|
+
new Query(
|
|
151
189
|
this._firestore,
|
|
152
190
|
this._collectionPath,
|
|
153
191
|
this._handleQueryCursor('endAt', docOrField, filterModularArgument(fields)),
|
|
154
192
|
this._queryName,
|
|
193
|
+
this._converter,
|
|
155
194
|
),
|
|
156
195
|
);
|
|
157
196
|
}
|
|
158
197
|
|
|
159
|
-
endBefore(
|
|
198
|
+
endBefore(
|
|
199
|
+
docOrField: DocumentSnapshot | DocumentFieldValueInternal,
|
|
200
|
+
...fields: DocumentFieldValueInternal[]
|
|
201
|
+
): ReturnType<typeof createDeprecationProxy> {
|
|
160
202
|
return createDeprecationProxy(
|
|
161
|
-
new
|
|
203
|
+
new Query(
|
|
162
204
|
this._firestore,
|
|
163
205
|
this._collectionPath,
|
|
164
206
|
this._handleQueryCursor('endBefore', docOrField, filterModularArgument(fields)),
|
|
165
207
|
this._queryName,
|
|
208
|
+
this._converter,
|
|
166
209
|
),
|
|
167
210
|
);
|
|
168
211
|
}
|
|
169
212
|
|
|
170
|
-
get(options) {
|
|
213
|
+
get(options?: { source?: 'default' | 'server' | 'cache' }): Promise<QuerySnapshot> {
|
|
171
214
|
if (!isUndefined(options) && !isObject(options)) {
|
|
172
215
|
throw new Error(
|
|
173
216
|
"firebase.firestore().collection().get(*) 'options' must be an object is provided.",
|
|
@@ -196,7 +239,15 @@ export default class FirestoreQuery {
|
|
|
196
239
|
this._modifiers.options,
|
|
197
240
|
options,
|
|
198
241
|
)
|
|
199
|
-
.then(
|
|
242
|
+
.then(
|
|
243
|
+
(data: unknown) =>
|
|
244
|
+
new QuerySnapshot(
|
|
245
|
+
this._firestore,
|
|
246
|
+
this,
|
|
247
|
+
data as QuerySnapshotNativeData,
|
|
248
|
+
this._converter,
|
|
249
|
+
),
|
|
250
|
+
);
|
|
200
251
|
}
|
|
201
252
|
|
|
202
253
|
this._modifiers.validatelimitToLast();
|
|
@@ -210,30 +261,36 @@ export default class FirestoreQuery {
|
|
|
210
261
|
this._modifiers.options,
|
|
211
262
|
options,
|
|
212
263
|
)
|
|
213
|
-
.then(
|
|
264
|
+
.then(
|
|
265
|
+
(data: unknown) =>
|
|
266
|
+
new QuerySnapshot(
|
|
267
|
+
this._firestore,
|
|
268
|
+
this,
|
|
269
|
+
data as QuerySnapshotNativeData,
|
|
270
|
+
this._converter,
|
|
271
|
+
),
|
|
272
|
+
);
|
|
214
273
|
}
|
|
215
274
|
|
|
216
|
-
isEqual(other) {
|
|
217
|
-
if (!(other instanceof
|
|
275
|
+
isEqual(other: Query): boolean {
|
|
276
|
+
if (!(other instanceof Query)) {
|
|
218
277
|
throw new Error(
|
|
219
278
|
"firebase.firestore().collection().isEqual(*) 'other' expected a Query instance.",
|
|
220
279
|
);
|
|
221
280
|
}
|
|
222
281
|
|
|
223
|
-
// Carry out lightweight checks first
|
|
224
282
|
if (
|
|
225
283
|
this.firestore.app.name !== other.firestore.app.name ||
|
|
226
284
|
this._modifiers.type !== other._modifiers.type ||
|
|
227
285
|
this._modifiers.filters.length !== other._modifiers.filters.length ||
|
|
228
286
|
this._modifiers.orders.length !== other._modifiers.orders.length ||
|
|
229
287
|
this._collectionPath.relativeName !== other._collectionPath.relativeName ||
|
|
288
|
+
this._converter !== other._converter ||
|
|
230
289
|
Object.keys(this._modifiers.options).length !== Object.keys(other._modifiers.options).length
|
|
231
290
|
) {
|
|
232
291
|
return false;
|
|
233
292
|
}
|
|
234
293
|
|
|
235
|
-
// Carry out potentially expensive checks
|
|
236
|
-
// noinspection RedundantIfStatementJS
|
|
237
294
|
if (
|
|
238
295
|
JSON.stringify(this._modifiers.filters) !== JSON.stringify(other._modifiers.filters) ||
|
|
239
296
|
JSON.stringify(this._modifiers.orders) !== JSON.stringify(other._modifiers.orders) ||
|
|
@@ -245,7 +302,7 @@ export default class FirestoreQuery {
|
|
|
245
302
|
return true;
|
|
246
303
|
}
|
|
247
304
|
|
|
248
|
-
limit(limit) {
|
|
305
|
+
limit(limit: number): ReturnType<typeof createDeprecationProxy> {
|
|
249
306
|
if (this._modifiers.isValidLimit(limit)) {
|
|
250
307
|
throw new Error(
|
|
251
308
|
"firebase.firestore().collection().limit(*) 'limit' must be a positive integer value.",
|
|
@@ -255,11 +312,11 @@ export default class FirestoreQuery {
|
|
|
255
312
|
const modifiers = this._modifiers._copy().limit(limit);
|
|
256
313
|
|
|
257
314
|
return createDeprecationProxy(
|
|
258
|
-
new
|
|
315
|
+
new Query(this._firestore, this._collectionPath, modifiers, this._queryName, this._converter),
|
|
259
316
|
);
|
|
260
317
|
}
|
|
261
318
|
|
|
262
|
-
limitToLast(limitToLast) {
|
|
319
|
+
limitToLast(limitToLast: number): ReturnType<typeof createDeprecationProxy> {
|
|
263
320
|
if (this._modifiers.isValidLimitToLast(limitToLast)) {
|
|
264
321
|
throw new Error(
|
|
265
322
|
"firebase.firestore().collection().limitToLast(*) 'limitToLast' must be a positive integer value.",
|
|
@@ -269,15 +326,15 @@ export default class FirestoreQuery {
|
|
|
269
326
|
const modifiers = this._modifiers._copy().limitToLast(limitToLast);
|
|
270
327
|
|
|
271
328
|
return createDeprecationProxy(
|
|
272
|
-
new
|
|
329
|
+
new Query(this._firestore, this._collectionPath, modifiers, this._queryName, this._converter),
|
|
273
330
|
);
|
|
274
331
|
}
|
|
275
332
|
|
|
276
|
-
onSnapshot(...args) {
|
|
277
|
-
let snapshotListenOptions;
|
|
278
|
-
let callback;
|
|
279
|
-
let onNext;
|
|
280
|
-
let onError;
|
|
333
|
+
onSnapshot(...args: unknown[]): () => void {
|
|
334
|
+
let snapshotListenOptions: { includeMetadataChanges?: boolean };
|
|
335
|
+
let callback: (snapshot: QuerySnapshot | null, error: Error | null) => void;
|
|
336
|
+
let onNext: (snapshot: QuerySnapshot) => void;
|
|
337
|
+
let onError: (error: Error) => void;
|
|
281
338
|
|
|
282
339
|
this._modifiers.validatelimitToLast();
|
|
283
340
|
|
|
@@ -288,15 +345,15 @@ export default class FirestoreQuery {
|
|
|
288
345
|
onNext = options.onNext;
|
|
289
346
|
onError = options.onError;
|
|
290
347
|
} catch (e) {
|
|
291
|
-
throw new Error(`firebase.firestore().collection().onSnapshot(*) ${e.message}`);
|
|
348
|
+
throw new Error(`firebase.firestore().collection().onSnapshot(*) ${(e as Error).message}`);
|
|
292
349
|
}
|
|
293
350
|
|
|
294
|
-
function handleSuccess(querySnapshot) {
|
|
351
|
+
function handleSuccess(querySnapshot: QuerySnapshot): void {
|
|
295
352
|
callback(querySnapshot, null);
|
|
296
353
|
onNext(querySnapshot);
|
|
297
354
|
}
|
|
298
355
|
|
|
299
|
-
function handleError(error) {
|
|
356
|
+
function handleError(error: Error): void {
|
|
300
357
|
callback(null, error);
|
|
301
358
|
onError(error);
|
|
302
359
|
}
|
|
@@ -305,21 +362,23 @@ export default class FirestoreQuery {
|
|
|
305
362
|
|
|
306
363
|
const onSnapshotSubscription = this._firestore.emitter.addListener(
|
|
307
364
|
this._firestore.eventNameForApp(`firestore_collection_sync_event:${listenerId}`),
|
|
308
|
-
event => {
|
|
309
|
-
|
|
310
|
-
|
|
365
|
+
(event: { body: FirestoreSyncEventBodyInternal }) => {
|
|
366
|
+
const body = event.body as {
|
|
367
|
+
error?: FirestoreSyncEventErrorInternal;
|
|
368
|
+
snapshot?: QuerySnapshotNativeData;
|
|
369
|
+
};
|
|
370
|
+
if (body.error) {
|
|
371
|
+
handleError(NativeError.fromEvent(body.error, 'firestore'));
|
|
311
372
|
} else {
|
|
312
|
-
const
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
event.body.snapshot,
|
|
316
|
-
);
|
|
373
|
+
const snapshot = body.snapshot;
|
|
374
|
+
if (!snapshot) return;
|
|
375
|
+
const querySnapshot = new QuerySnapshot(this._firestore, this, snapshot, this._converter);
|
|
317
376
|
handleSuccess(querySnapshot);
|
|
318
377
|
}
|
|
319
378
|
},
|
|
320
379
|
);
|
|
321
380
|
|
|
322
|
-
const unsubscribe = () => {
|
|
381
|
+
const unsubscribe = (): void => {
|
|
323
382
|
onSnapshotSubscription.remove();
|
|
324
383
|
this._firestore.native.collectionOffSnapshot(listenerId);
|
|
325
384
|
};
|
|
@@ -349,20 +408,25 @@ export default class FirestoreQuery {
|
|
|
349
408
|
return unsubscribe;
|
|
350
409
|
}
|
|
351
410
|
|
|
352
|
-
orderBy(
|
|
353
|
-
|
|
411
|
+
orderBy(
|
|
412
|
+
fieldPath: string | FieldPath,
|
|
413
|
+
directionStr?: string,
|
|
414
|
+
): ReturnType<typeof createDeprecationProxy> {
|
|
415
|
+
if (!isString(fieldPath) && !(fieldPath instanceof FieldPath)) {
|
|
354
416
|
throw new Error(
|
|
355
417
|
"firebase.firestore().collection().orderBy(*) 'fieldPath' must be a string or instance of FieldPath.",
|
|
356
418
|
);
|
|
357
419
|
}
|
|
358
420
|
|
|
359
|
-
let path;
|
|
421
|
+
let path: FieldPath;
|
|
360
422
|
|
|
361
423
|
if (isString(fieldPath)) {
|
|
362
424
|
try {
|
|
363
425
|
path = fromDotSeparatedString(fieldPath);
|
|
364
426
|
} catch (e) {
|
|
365
|
-
throw new Error(
|
|
427
|
+
throw new Error(
|
|
428
|
+
`firebase.firestore().collection().orderBy(*) 'fieldPath' ${(e as Error).message}.`,
|
|
429
|
+
);
|
|
366
430
|
}
|
|
367
431
|
} else {
|
|
368
432
|
path = fieldPath;
|
|
@@ -391,40 +455,52 @@ export default class FirestoreQuery {
|
|
|
391
455
|
try {
|
|
392
456
|
modifiers.validateOrderBy();
|
|
393
457
|
} catch (e) {
|
|
394
|
-
throw new Error(`firebase.firestore().collection().orderBy() ${e.message}`);
|
|
458
|
+
throw new Error(`firebase.firestore().collection().orderBy() ${(e as Error).message}`);
|
|
395
459
|
}
|
|
396
460
|
|
|
397
461
|
return createDeprecationProxy(
|
|
398
|
-
new
|
|
462
|
+
new Query(this._firestore, this._collectionPath, modifiers, this._queryName, this._converter),
|
|
399
463
|
);
|
|
400
464
|
}
|
|
401
465
|
|
|
402
|
-
startAfter(
|
|
466
|
+
startAfter(
|
|
467
|
+
docOrField: DocumentSnapshot | DocumentFieldValueInternal,
|
|
468
|
+
...fields: DocumentFieldValueInternal[]
|
|
469
|
+
): ReturnType<typeof createDeprecationProxy> {
|
|
403
470
|
return createDeprecationProxy(
|
|
404
|
-
new
|
|
471
|
+
new Query(
|
|
405
472
|
this._firestore,
|
|
406
473
|
this._collectionPath,
|
|
407
474
|
this._handleQueryCursor('startAfter', docOrField, filterModularArgument(fields)),
|
|
408
475
|
this._queryName,
|
|
476
|
+
this._converter,
|
|
409
477
|
),
|
|
410
478
|
);
|
|
411
479
|
}
|
|
412
480
|
|
|
413
|
-
startAt(
|
|
481
|
+
startAt(
|
|
482
|
+
docOrField: DocumentSnapshot | DocumentFieldValueInternal,
|
|
483
|
+
...fields: DocumentFieldValueInternal[]
|
|
484
|
+
): ReturnType<typeof createDeprecationProxy> {
|
|
414
485
|
return createDeprecationProxy(
|
|
415
|
-
new
|
|
486
|
+
new Query(
|
|
416
487
|
this._firestore,
|
|
417
488
|
this._collectionPath,
|
|
418
489
|
this._handleQueryCursor('startAt', docOrField, filterModularArgument(fields)),
|
|
419
490
|
this._queryName,
|
|
491
|
+
this._converter,
|
|
420
492
|
),
|
|
421
493
|
);
|
|
422
494
|
}
|
|
423
495
|
|
|
424
|
-
where(
|
|
496
|
+
where(
|
|
497
|
+
fieldPathOrFilter: string | FieldPath | _Filter,
|
|
498
|
+
opStr?: string,
|
|
499
|
+
value?: DocumentFieldValueInternal,
|
|
500
|
+
): ReturnType<typeof createDeprecationProxy> {
|
|
425
501
|
if (
|
|
426
502
|
!isString(fieldPathOrFilter) &&
|
|
427
|
-
!(fieldPathOrFilter instanceof
|
|
503
|
+
!(fieldPathOrFilter instanceof FieldPath) &&
|
|
428
504
|
!(fieldPathOrFilter instanceof _Filter)
|
|
429
505
|
) {
|
|
430
506
|
throw new Error(
|
|
@@ -432,77 +508,109 @@ export default class FirestoreQuery {
|
|
|
432
508
|
);
|
|
433
509
|
}
|
|
434
510
|
|
|
435
|
-
let modifiers;
|
|
511
|
+
let modifiers: QueryModifiers;
|
|
512
|
+
|
|
436
513
|
if (fieldPathOrFilter instanceof _Filter && fieldPathOrFilter.queries) {
|
|
437
|
-
//AND or OR filter
|
|
438
514
|
const filters = generateFilters(fieldPathOrFilter, this._modifiers);
|
|
439
515
|
modifiers = this._modifiers._copy().filterWhere(filters);
|
|
440
516
|
} else {
|
|
517
|
+
let path: FieldPath;
|
|
518
|
+
let op = opStr;
|
|
519
|
+
let val = value;
|
|
520
|
+
|
|
441
521
|
if (fieldPathOrFilter instanceof _Filter) {
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
fieldPathOrFilter = fieldPathOrFilter.fieldPath;
|
|
522
|
+
op = fieldPathOrFilter.operator as string;
|
|
523
|
+
val = fieldPathOrFilter.value;
|
|
524
|
+
fieldPathOrFilter = fieldPathOrFilter.fieldPath as FieldPath;
|
|
446
525
|
}
|
|
447
|
-
let path;
|
|
448
526
|
|
|
449
527
|
if (isString(fieldPathOrFilter)) {
|
|
450
528
|
try {
|
|
451
529
|
path = fromDotSeparatedString(fieldPathOrFilter);
|
|
452
530
|
} catch (e) {
|
|
453
|
-
throw new Error(
|
|
531
|
+
throw new Error(
|
|
532
|
+
`firebase.firestore().collection().where(*) 'fieldPath' ${(e as Error).message}.`,
|
|
533
|
+
);
|
|
454
534
|
}
|
|
455
535
|
} else {
|
|
456
536
|
path = fieldPathOrFilter;
|
|
457
537
|
}
|
|
458
538
|
|
|
459
|
-
if (!this._modifiers.isValidOperator(
|
|
539
|
+
if (!this._modifiers.isValidOperator(op!)) {
|
|
460
540
|
throw new Error(
|
|
461
541
|
"firebase.firestore().collection().where(_, *) 'opStr' is invalid. Expected one of '==', '>', '>=', '<', '<=', '!=', 'array-contains', 'not-in', 'array-contains-any' or 'in'.",
|
|
462
542
|
);
|
|
463
543
|
}
|
|
464
544
|
|
|
465
|
-
if (isUndefined(
|
|
545
|
+
if (isUndefined(val)) {
|
|
466
546
|
throw new Error(
|
|
467
547
|
"firebase.firestore().collection().where(_, _, *) 'value' argument expected.",
|
|
468
548
|
);
|
|
469
549
|
}
|
|
470
550
|
|
|
471
551
|
if (
|
|
472
|
-
isNull(
|
|
473
|
-
!this._modifiers.isEqualOperator(
|
|
474
|
-
!this._modifiers.isNotEqualOperator(
|
|
552
|
+
isNull(val) &&
|
|
553
|
+
!this._modifiers.isEqualOperator(op!) &&
|
|
554
|
+
!this._modifiers.isNotEqualOperator(op!)
|
|
475
555
|
) {
|
|
476
556
|
throw new Error(
|
|
477
557
|
"firebase.firestore().collection().where(_, _, *) 'value' is invalid. You can only perform equals comparisons on null",
|
|
478
558
|
);
|
|
479
559
|
}
|
|
480
560
|
|
|
481
|
-
if (this._modifiers.isInOperator(
|
|
482
|
-
if (!isArray(
|
|
561
|
+
if (this._modifiers.isInOperator(op!)) {
|
|
562
|
+
if (!isArray(val) || !(val as DocumentFieldValueInternal[]).length) {
|
|
483
563
|
throw new Error(
|
|
484
|
-
`firebase.firestore().collection().where(_, _, *) 'value' is invalid. A non-empty array is required for '${
|
|
564
|
+
`firebase.firestore().collection().where(_, _, *) 'value' is invalid. A non-empty array is required for '${op}' filters.`,
|
|
485
565
|
);
|
|
486
566
|
}
|
|
487
567
|
|
|
488
|
-
if (
|
|
568
|
+
if ((val as DocumentFieldValueInternal[]).length > 30) {
|
|
489
569
|
throw new Error(
|
|
490
|
-
`firebase.firestore().collection().where(_, _, *) 'value' is invalid. '${
|
|
570
|
+
`firebase.firestore().collection().where(_, _, *) 'value' is invalid. '${op}' filters support a maximum of 30 elements in the value array.`,
|
|
491
571
|
);
|
|
492
572
|
}
|
|
493
573
|
}
|
|
494
574
|
|
|
495
|
-
modifiers = this._modifiers._copy().where(path,
|
|
575
|
+
modifiers = this._modifiers._copy().where(path, op!, val);
|
|
496
576
|
}
|
|
497
577
|
|
|
498
578
|
try {
|
|
499
579
|
modifiers.validateWhere();
|
|
500
580
|
} catch (e) {
|
|
501
|
-
throw new Error(`firebase.firestore().collection().where() ${e.message}`);
|
|
581
|
+
throw new Error(`firebase.firestore().collection().where() ${(e as Error).message}`);
|
|
502
582
|
}
|
|
503
583
|
|
|
504
584
|
return createDeprecationProxy(
|
|
505
|
-
new
|
|
585
|
+
new Query(this._firestore, this._collectionPath, modifiers, this._queryName, this._converter),
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
withConverter(
|
|
590
|
+
converter: FirestoreDataConverter<DocumentData, DocumentData> | null | unknown,
|
|
591
|
+
): Query {
|
|
592
|
+
if (isUndefined(converter) || isNull(converter)) {
|
|
593
|
+
return new Query(
|
|
594
|
+
this._firestore,
|
|
595
|
+
this._collectionPath,
|
|
596
|
+
this._modifiers,
|
|
597
|
+
this._queryName,
|
|
598
|
+
null,
|
|
599
|
+
);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
try {
|
|
603
|
+
validateWithConverter(converter);
|
|
604
|
+
} catch (e) {
|
|
605
|
+
throw new Error(`firebase.firestore().collection().withConverter() ${(e as Error).message}`);
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
return new Query(
|
|
609
|
+
this._firestore,
|
|
610
|
+
this._collectionPath,
|
|
611
|
+
this._modifiers,
|
|
612
|
+
this._queryName,
|
|
613
|
+
converter as FirestoreDataConverter<DocumentData, DocumentData>,
|
|
506
614
|
);
|
|
507
615
|
}
|
|
508
616
|
}
|