@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
|
@@ -263,7 +263,7 @@ public class ReactNativeFirebaseFirestoreSerialize {
|
|
|
263
263
|
* @param map Map<String, Object>
|
|
264
264
|
* @return WritableMap
|
|
265
265
|
*/
|
|
266
|
-
|
|
266
|
+
static WritableMap objectMapToWritable(Map<String, Object> map) {
|
|
267
267
|
WritableMap writableMap = Arguments.createMap();
|
|
268
268
|
|
|
269
269
|
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this library except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { isString } from '@react-native-firebase/app/dist/module/common';
|
|
21
|
+
const RESERVED = new RegExp('[~*/\\[\\]]');
|
|
22
|
+
export default class FieldPath {
|
|
23
|
+
constructor(...segments) {
|
|
24
|
+
if (segments.length === 0) {
|
|
25
|
+
throw new Error('firebase.firestore.FieldPath cannot construct FieldPath with no segments.');
|
|
26
|
+
}
|
|
27
|
+
for (let i = 0; i < segments.length; i++) {
|
|
28
|
+
const segment = segments[i];
|
|
29
|
+
if (!isString(segment) || segment === '') {
|
|
30
|
+
throw new Error(`firebase.firestore.FieldPath invalid segment at index ${i}, expected a non-empty string.`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
this._segments = segments;
|
|
34
|
+
}
|
|
35
|
+
isEqual(other) {
|
|
36
|
+
if (!(other instanceof FieldPath)) {
|
|
37
|
+
throw new Error("firebase.firestore.FieldPath.isEqual(*) 'other' expected instance of FieldPath.");
|
|
38
|
+
}
|
|
39
|
+
return this._toPath() === other._toPath();
|
|
40
|
+
}
|
|
41
|
+
_toPath() {
|
|
42
|
+
return this._segments.join('.');
|
|
43
|
+
}
|
|
44
|
+
_toArray() {
|
|
45
|
+
return this._segments;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export const DOCUMENT_ID = new FieldPath('__name__');
|
|
49
|
+
export function fromDotSeparatedString(path) {
|
|
50
|
+
if (path === '' || path.startsWith('.') || path.endsWith('.') || path.indexOf('..') > 0) {
|
|
51
|
+
throw new Error("Invalid field path. Paths must not be empty, begin with '.', end with '.', or contain '..'.");
|
|
52
|
+
}
|
|
53
|
+
const found = path.search(RESERVED);
|
|
54
|
+
if (found > 0) {
|
|
55
|
+
throw new Error(`Invalid field path (${path}). Paths must not contain '~', '*', '/', '[', or ']'.`);
|
|
56
|
+
}
|
|
57
|
+
return new FieldPath(...path.split('.'));
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=FieldPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isString","RESERVED","RegExp","FieldPath","constructor","segments","length","Error","i","segment","_segments","isEqual","other","_toPath","join","_toArray","DOCUMENT_ID","fromDotSeparatedString","path","startsWith","endsWith","indexOf","found","search","split"],"sourceRoot":"../../lib","sources":["FieldPath.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,+CAA+C;AAExE,MAAMC,QAAQ,GAAG,IAAIC,MAAM,CAAC,aAAa,CAAC;AAE1C,eAAe,MAAMC,SAAS,CAAC;EAG7BC,WAAWA,CAAC,GAAGC,QAAkB,EAAE;IACjC,IAAIA,QAAQ,CAACC,MAAM,KAAK,CAAC,EAAE;MACzB,MAAM,IAAIC,KAAK,CAAC,2EAA2E,CAAC;IAC9F;IAEA,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,QAAQ,CAACC,MAAM,EAAEE,CAAC,EAAE,EAAE;MACxC,MAAMC,OAAO,GAAGJ,QAAQ,CAACG,CAAC,CAAC;MAC3B,IAAI,CAACR,QAAQ,CAACS,OAAO,CAAC,IAAIA,OAAO,KAAK,EAAE,EAAE;QACxC,MAAM,IAAIF,KAAK,CACb,yDAAyDC,CAAC,gCAC5D,CAAC;MACH;IACF;IAEA,IAAI,CAACE,SAAS,GAAGL,QAAQ;EAC3B;EAEAM,OAAOA,CAACC,KAAgB,EAAW;IACjC,IAAI,EAAEA,KAAK,YAAYT,SAAS,CAAC,EAAE;MACjC,MAAM,IAAII,KAAK,CACb,iFACF,CAAC;IACH;IAEA,OAAO,IAAI,CAACM,OAAO,CAAC,CAAC,KAAKD,KAAK,CAACC,OAAO,CAAC,CAAC;EAC3C;EAEAA,OAAOA,CAAA,EAAW;IAChB,OAAO,IAAI,CAACH,SAAS,CAACI,IAAI,CAAC,GAAG,CAAC;EACjC;EAEAC,QAAQA,CAAA,EAAa;IACnB,OAAO,IAAI,CAACL,SAAS;EACvB;AACF;AAEA,OAAO,MAAMM,WAAW,GAAG,IAAIb,SAAS,CAAC,UAAU,CAAC;AAEpD,OAAO,SAASc,sBAAsBA,CAACC,IAAY,EAAa;EAC9D,IAAIA,IAAI,KAAK,EAAE,IAAIA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC,IAAID,IAAI,CAACE,QAAQ,CAAC,GAAG,CAAC,IAAIF,IAAI,CAACG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;IACvF,MAAM,IAAId,KAAK,CACb,6FACF,CAAC;EACH;EAEA,MAAMe,KAAK,GAAGJ,IAAI,CAACK,MAAM,CAACtB,QAAQ,CAAC;EAEnC,IAAIqB,KAAK,GAAG,CAAC,EAAE;IACb,MAAM,IAAIf,KAAK,CACb,uBAAuBW,IAAI,uDAC7B,CAAC;EACH;EAEA,OAAO,IAAIf,SAAS,CAAC,GAAGe,IAAI,CAACM,KAAK,CAAC,GAAG,CAAC,CAAC;AAC1C","ignoreList":[]}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this library except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { isArray, isNumber } from '@react-native-firebase/app/dist/module/common';
|
|
21
|
+
import { buildNativeArray, provideFieldValueClass } from "./utils/serialize.js";
|
|
22
|
+
export const TypeFieldValueDelete = 'delete';
|
|
23
|
+
export const TypeFieldValueIncrement = 'increment';
|
|
24
|
+
export const TypeFieldValueRemove = 'array_remove';
|
|
25
|
+
export const TypeFieldValueUnion = 'array_union';
|
|
26
|
+
export const TypeFieldValueTimestamp = 'timestamp';
|
|
27
|
+
function validateArrayElements(elements) {
|
|
28
|
+
for (let i = 0; i < elements.length; i++) {
|
|
29
|
+
const element = elements[i];
|
|
30
|
+
if (element instanceof FieldValue) {
|
|
31
|
+
throw new Error('FieldValue instance cannot be used with other FieldValue methods.');
|
|
32
|
+
}
|
|
33
|
+
if (isArray(element)) {
|
|
34
|
+
throw new Error('Nested arrays are not supported');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export default class FieldValue {
|
|
39
|
+
constructor(internal = false, type = '', elements) {
|
|
40
|
+
if (internal === false) {
|
|
41
|
+
throw new Error('firebase.firestore.FieldValue constructor is private, use FieldValue.<field>() instead.');
|
|
42
|
+
}
|
|
43
|
+
this._type = type;
|
|
44
|
+
this._elements = elements;
|
|
45
|
+
}
|
|
46
|
+
static delete() {
|
|
47
|
+
return new FieldValue(true, TypeFieldValueDelete);
|
|
48
|
+
}
|
|
49
|
+
static increment(n) {
|
|
50
|
+
if (!isNumber(n)) {
|
|
51
|
+
throw new Error("firebase.firestore.FieldValue.increment(*) 'n' expected a number value.");
|
|
52
|
+
}
|
|
53
|
+
return new FieldValue(true, TypeFieldValueIncrement, n);
|
|
54
|
+
}
|
|
55
|
+
static serverTimestamp() {
|
|
56
|
+
return new FieldValue(true, TypeFieldValueTimestamp);
|
|
57
|
+
}
|
|
58
|
+
static arrayUnion(...elements) {
|
|
59
|
+
try {
|
|
60
|
+
validateArrayElements(elements);
|
|
61
|
+
} catch (e) {
|
|
62
|
+
throw new Error(`firebase.firestore.FieldValue.arrayUnion(*) 'elements' called with invalid data. ${e.message}`);
|
|
63
|
+
}
|
|
64
|
+
return new FieldValue(true, TypeFieldValueUnion, buildNativeArray(elements));
|
|
65
|
+
}
|
|
66
|
+
static arrayRemove(...elements) {
|
|
67
|
+
try {
|
|
68
|
+
validateArrayElements(elements);
|
|
69
|
+
} catch (e) {
|
|
70
|
+
throw new Error(`firebase.firestore.FieldValue.arrayRemove(*) 'elements' called with invalid data. ${e.message}`);
|
|
71
|
+
}
|
|
72
|
+
return new FieldValue(true, TypeFieldValueRemove, buildNativeArray(elements));
|
|
73
|
+
}
|
|
74
|
+
isEqual(other) {
|
|
75
|
+
if (!(other instanceof FieldValue)) {
|
|
76
|
+
throw new Error("firebase.firestore.FieldValue.isEqual(*) 'other' expected a FieldValue instance.");
|
|
77
|
+
}
|
|
78
|
+
return this._type === other._type && JSON.stringify(this._elements) === JSON.stringify(other._elements);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
provideFieldValueClass(FieldValue);
|
|
82
|
+
//# sourceMappingURL=FieldValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isArray","isNumber","buildNativeArray","provideFieldValueClass","TypeFieldValueDelete","TypeFieldValueIncrement","TypeFieldValueRemove","TypeFieldValueUnion","TypeFieldValueTimestamp","validateArrayElements","elements","i","length","element","FieldValue","Error","constructor","internal","type","_type","_elements","delete","increment","n","serverTimestamp","arrayUnion","e","message","arrayRemove","isEqual","other","JSON","stringify"],"sourceRoot":"../../lib","sources":["FieldValue.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,EAAEC,QAAQ,QAAQ,+CAA+C;AACjF,SAASC,gBAAgB,EAAEC,sBAAsB,QAAQ,sBAAmB;AAE5E,OAAO,MAAMC,oBAAoB,GAAG,QAAQ;AAC5C,OAAO,MAAMC,uBAAuB,GAAG,WAAW;AAClD,OAAO,MAAMC,oBAAoB,GAAG,cAAc;AAClD,OAAO,MAAMC,mBAAmB,GAAG,aAAa;AAChD,OAAO,MAAMC,uBAAuB,GAAG,WAAW;AAElD,SAASC,qBAAqBA,CAACC,QAAmB,EAAQ;EACxD,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,QAAQ,CAACE,MAAM,EAAED,CAAC,EAAE,EAAE;IACxC,MAAME,OAAO,GAAGH,QAAQ,CAACC,CAAC,CAAC;IAE3B,IAAIE,OAAO,YAAYC,UAAU,EAAE;MACjC,MAAM,IAAIC,KAAK,CAAC,mEAAmE,CAAC;IACtF;IAEA,IAAIf,OAAO,CAACa,OAAO,CAAC,EAAE;MACpB,MAAM,IAAIE,KAAK,CAAC,iCAAiC,CAAC;IACpD;EACF;AACF;AAEA,eAAe,MAAMD,UAAU,CAAC;EAI9BE,WAAWA,CAACC,QAAQ,GAAG,KAAK,EAAEC,IAAI,GAAG,EAAE,EAAER,QAAkB,EAAE;IAC3D,IAAIO,QAAQ,KAAK,KAAK,EAAE;MACtB,MAAM,IAAIF,KAAK,CACb,yFACF,CAAC;IACH;IAEA,IAAI,CAACI,KAAK,GAAGD,IAAI;IACjB,IAAI,CAACE,SAAS,GAAGV,QAAQ;EAC3B;EAEA,OAAOW,MAAMA,CAAA,EAAe;IAC1B,OAAO,IAAIP,UAAU,CAAC,IAAI,EAAEV,oBAAoB,CAAC;EACnD;EAEA,OAAOkB,SAASA,CAACC,CAAS,EAAc;IACtC,IAAI,CAACtB,QAAQ,CAACsB,CAAC,CAAC,EAAE;MAChB,MAAM,IAAIR,KAAK,CAAC,yEAAyE,CAAC;IAC5F;IAEA,OAAO,IAAID,UAAU,CAAC,IAAI,EAAET,uBAAuB,EAAEkB,CAAC,CAAC;EACzD;EAEA,OAAOC,eAAeA,CAAA,EAAe;IACnC,OAAO,IAAIV,UAAU,CAAC,IAAI,EAAEN,uBAAuB,CAAC;EACtD;EAEA,OAAOiB,UAAUA,CAAC,GAAGf,QAAmB,EAAc;IACpD,IAAI;MACFD,qBAAqB,CAACC,QAAQ,CAAC;IACjC,CAAC,CAAC,OAAOgB,CAAC,EAAE;MACV,MAAM,IAAIX,KAAK,CACb,oFAAqFW,CAAC,CAAWC,OAAO,EAC1G,CAAC;IACH;IAEA,OAAO,IAAIb,UAAU,CAAC,IAAI,EAAEP,mBAAmB,EAAEL,gBAAgB,CAACQ,QAAQ,CAAC,CAAC;EAC9E;EAEA,OAAOkB,WAAWA,CAAC,GAAGlB,QAAmB,EAAc;IACrD,IAAI;MACFD,qBAAqB,CAACC,QAAQ,CAAC;IACjC,CAAC,CAAC,OAAOgB,CAAC,EAAE;MACV,MAAM,IAAIX,KAAK,CACb,qFAAsFW,CAAC,CAAWC,OAAO,EAC3G,CAAC;IACH;IAEA,OAAO,IAAIb,UAAU,CAAC,IAAI,EAAER,oBAAoB,EAAEJ,gBAAgB,CAACQ,QAAQ,CAAC,CAAC;EAC/E;EAEAmB,OAAOA,CAACC,KAAiB,EAAW;IAClC,IAAI,EAAEA,KAAK,YAAYhB,UAAU,CAAC,EAAE;MAClC,MAAM,IAAIC,KAAK,CACb,kFACF,CAAC;IACH;IAEA,OACE,IAAI,CAACI,KAAK,KAAKW,KAAK,CAACX,KAAK,IAC1BY,IAAI,CAACC,SAAS,CAAC,IAAI,CAACZ,SAAS,CAAC,KAAKW,IAAI,CAACC,SAAS,CAACF,KAAK,CAACV,SAAS,CAAC;EAEtE;AACF;AAEAjB,sBAAsB,CAACW,UAA0D,CAAC","ignoreList":[]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
/*
|
|
2
4
|
* Copyright (c) 2022-present Invertase Limited & Contributors
|
|
3
5
|
*
|
|
@@ -15,78 +17,64 @@
|
|
|
15
17
|
*
|
|
16
18
|
*/
|
|
17
19
|
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
export class FirestoreAggregateQuery {
|
|
20
|
+
import FieldPath, { fromDotSeparatedString } from "./FieldPath.js";
|
|
21
|
+
export class AggregateQuery {
|
|
21
22
|
constructor(firestore, query, collectionPath, modifiers) {
|
|
22
23
|
this._firestore = firestore;
|
|
23
24
|
this._query = query;
|
|
24
25
|
this._collectionPath = collectionPath;
|
|
25
26
|
this._modifiers = modifiers;
|
|
26
27
|
}
|
|
27
|
-
|
|
28
28
|
get query() {
|
|
29
29
|
return this._query;
|
|
30
30
|
}
|
|
31
|
-
|
|
32
31
|
get() {
|
|
33
|
-
return this._firestore.native
|
|
34
|
-
.collectionCount(
|
|
35
|
-
this._collectionPath.relativeName,
|
|
36
|
-
this._modifiers.type,
|
|
37
|
-
this._modifiers.filters,
|
|
38
|
-
this._modifiers.orders,
|
|
39
|
-
this._modifiers.options,
|
|
40
|
-
)
|
|
41
|
-
.then(data => new FirestoreAggregateQuerySnapshot(this._query, data, true));
|
|
32
|
+
return this._firestore.native.collectionCount(this._collectionPath.relativeName, this._modifiers.type, this._modifiers.filters, this._modifiers.orders, this._modifiers.options).then(data => new AggregateQuerySnapshot(this._query, data, true));
|
|
42
33
|
}
|
|
43
34
|
}
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
export class AggregateQuerySnapshot {
|
|
36
|
+
type = 'AggregateQuerySnapshot';
|
|
46
37
|
constructor(query, data, isGetCountFromServer) {
|
|
47
38
|
this._query = query;
|
|
48
39
|
this._data = data;
|
|
49
40
|
this._isGetCountFromServer = isGetCountFromServer;
|
|
50
41
|
}
|
|
51
|
-
|
|
42
|
+
get query() {
|
|
43
|
+
return this._query;
|
|
44
|
+
}
|
|
52
45
|
data() {
|
|
53
46
|
if (this._isGetCountFromServer) {
|
|
54
|
-
return {
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
return {
|
|
48
|
+
count: this._data.count
|
|
49
|
+
};
|
|
57
50
|
}
|
|
51
|
+
return {
|
|
52
|
+
...this._data
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
_fieldsProto() {
|
|
56
|
+
return {
|
|
57
|
+
...this._data
|
|
58
|
+
};
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
|
-
|
|
61
|
-
export const AggregateType = {
|
|
62
|
-
SUM: 'sum',
|
|
63
|
-
AVG: 'average',
|
|
64
|
-
COUNT: 'count',
|
|
65
|
-
};
|
|
66
|
-
|
|
67
61
|
export class AggregateField {
|
|
68
|
-
|
|
69
|
-
aggregateType;
|
|
70
|
-
_fieldPath;
|
|
62
|
+
type = 'AggregateField';
|
|
71
63
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
* @param _fieldPath Optionally specifies the field that is aggregated.
|
|
76
|
-
* @internal
|
|
77
|
-
*/
|
|
78
|
-
constructor(aggregateType, fieldPath) {
|
|
64
|
+
// Phantom property to anchor the type parameter T for AggregateSpecData inference.
|
|
65
|
+
|
|
66
|
+
constructor(aggregateType = 'count', fieldPath) {
|
|
79
67
|
this.aggregateType = aggregateType;
|
|
80
|
-
this.
|
|
68
|
+
this._internalFieldPath = fieldPath;
|
|
81
69
|
}
|
|
82
70
|
}
|
|
83
|
-
|
|
84
71
|
export function fieldPathFromArgument(path) {
|
|
85
|
-
if (path instanceof
|
|
72
|
+
if (path instanceof FieldPath) {
|
|
86
73
|
return path;
|
|
87
|
-
}
|
|
74
|
+
}
|
|
75
|
+
if (typeof path === 'string') {
|
|
88
76
|
return fromDotSeparatedString(path);
|
|
89
|
-
} else {
|
|
90
|
-
throw new Error('Field path arguments must be of type `string` or `FieldPath`');
|
|
91
77
|
}
|
|
78
|
+
throw new Error('Field path arguments must be of type `string` or `FieldPath`');
|
|
92
79
|
}
|
|
80
|
+
//# sourceMappingURL=FirestoreAggregate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FieldPath","fromDotSeparatedString","AggregateQuery","constructor","firestore","query","collectionPath","modifiers","_firestore","_query","_collectionPath","_modifiers","get","native","collectionCount","relativeName","type","filters","orders","options","then","data","AggregateQuerySnapshot","isGetCountFromServer","_data","_isGetCountFromServer","count","_fieldsProto","AggregateField","aggregateType","fieldPath","_internalFieldPath","fieldPathFromArgument","path","Error"],"sourceRoot":"../../lib","sources":["FirestoreAggregate.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,OAAOA,SAAS,IAAIC,sBAAsB,QAAQ,gBAAa;AAO/D,OAAO,MAAMC,cAAc,CAAC;EAM1BC,WAAWA,CACTC,SAA4B,EAC5BC,KAAY,EACZC,cAA6B,EAC7BC,SAAyB,EACzB;IACA,IAAI,CAACC,UAAU,GAAGJ,SAAS;IAC3B,IAAI,CAACK,MAAM,GAAGJ,KAAK;IACnB,IAAI,CAACK,eAAe,GAAGJ,cAAc;IACrC,IAAI,CAACK,UAAU,GAAGJ,SAAS;EAC7B;EAEA,IAAIF,KAAKA,CAAA,EAAU;IACjB,OAAO,IAAI,CAACI,MAAM;EACpB;EAEAG,GAAGA,CAAA,EAAoC;IACrC,OAAO,IAAI,CAACJ,UAAU,CAACK,MAAM,CAC1BC,eAAe,CACd,IAAI,CAACJ,eAAe,CAACK,YAAY,EACjC,IAAI,CAACJ,UAAU,CAACK,IAAI,EACpB,IAAI,CAACL,UAAU,CAACM,OAAO,EACvB,IAAI,CAACN,UAAU,CAACO,MAAM,EACtB,IAAI,CAACP,UAAU,CAACQ,OAClB,CAAC,CACAC,IAAI,CAAEC,IAAwB,IAAK,IAAIC,sBAAsB,CAAC,IAAI,CAACb,MAAM,EAAEY,IAAI,EAAE,IAAI,CAAC,CAAC;EAC5F;AACF;AAEA,OAAO,MAAMC,sBAAsB,CAIjC;EACSN,IAAI,GAAG,wBAAwB;EAKxCb,WAAWA,CACTE,KAAgD,EAChDgB,IAAgD,EAChDE,oBAA6B,EAC7B;IACA,IAAI,CAACd,MAAM,GAAGJ,KAAK;IACnB,IAAI,CAACmB,KAAK,GAAGH,IAAI;IACjB,IAAI,CAACI,qBAAqB,GAAGF,oBAAoB;EACnD;EAEA,IAAIlB,KAAKA,CAAA,EAA8C;IACrD,OAAO,IAAI,CAACI,MAAM;EACpB;EAEAY,IAAIA,CAAA,EAAyC;IAC3C,IAAI,IAAI,CAACI,qBAAqB,EAAE;MAC9B,OAAO;QAAEC,KAAK,EAAE,IAAI,CAACF,KAAK,CAACE;MAAM,CAAC;IACpC;IACA,OAAO;MAAE,GAAG,IAAI,CAACF;IAAM,CAAC;EAC1B;EAEAG,YAAYA,CAAA,EAA4B;IACtC,OAAO;MAAE,GAAG,IAAI,CAACH;IAAM,CAAC;EAC1B;AACF;AAEA,OAAO,MAAMI,cAAc,CAAc;EAC9BZ,IAAI,GAAG,gBAAgB;;EAGhC;;EAGAb,WAAWA,CAAC0B,aAA4B,GAAG,OAAO,EAAEC,SAAqB,EAAE;IACzE,IAAI,CAACD,aAAa,GAAGA,aAAa;IAClC,IAAI,CAACE,kBAAkB,GAAGD,SAAS;EACrC;AACF;AAEA,OAAO,SAASE,qBAAqBA,CAACC,IAAwB,EAAa;EACzE,IAAIA,IAAI,YAAYjC,SAAS,EAAE;IAC7B,OAAOiC,IAAI;EACb;EACA,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IAC5B,OAAOhC,sBAAsB,CAACgC,IAAI,CAAC;EACrC;EACA,MAAM,IAAIC,KAAK,CAAC,8DAA8D,CAAC;AACjF","ignoreList":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this library except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { Base64, isString } from '@react-native-firebase/app/dist/module/common';
|
|
21
|
+
export default class Blob {
|
|
22
|
+
constructor(internal = false, binaryString) {
|
|
23
|
+
if (internal === false) {
|
|
24
|
+
throw new Error('firebase.firestore.Blob constructor is private, use Blob.<field>() instead.');
|
|
25
|
+
}
|
|
26
|
+
this._binaryString = binaryString ?? '';
|
|
27
|
+
}
|
|
28
|
+
static fromBase64String(base64) {
|
|
29
|
+
if (!isString(base64) || base64.length < 1) {
|
|
30
|
+
throw new Error('firestore.Blob.fromBase64String expects a string of at least 1 character in length');
|
|
31
|
+
}
|
|
32
|
+
return new Blob(true, Base64.atob(base64));
|
|
33
|
+
}
|
|
34
|
+
static fromUint8Array(array) {
|
|
35
|
+
if (!(array instanceof Uint8Array)) {
|
|
36
|
+
throw new Error('firestore.Blob.fromUint8Array expects an instance of Uint8Array');
|
|
37
|
+
}
|
|
38
|
+
return new Blob(true, Array.prototype.map.call(array, byte => String.fromCharCode(byte)).join(''));
|
|
39
|
+
}
|
|
40
|
+
isEqual(blob) {
|
|
41
|
+
if (!(blob instanceof Blob)) {
|
|
42
|
+
throw new Error('firestore.Blob.isEqual expects an instance of Blob');
|
|
43
|
+
}
|
|
44
|
+
return this._binaryString === blob._binaryString;
|
|
45
|
+
}
|
|
46
|
+
toBase64() {
|
|
47
|
+
return Base64.btoa(this._binaryString);
|
|
48
|
+
}
|
|
49
|
+
toUint8Array() {
|
|
50
|
+
return new Uint8Array(this._binaryString.split('').map(char => char.charCodeAt(0)));
|
|
51
|
+
}
|
|
52
|
+
toString() {
|
|
53
|
+
return `firestore.Blob(base64: ${this.toBase64()})`;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=FirestoreBlob.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Base64","isString","Blob","constructor","internal","binaryString","Error","_binaryString","fromBase64String","base64","length","atob","fromUint8Array","array","Uint8Array","Array","prototype","map","call","byte","String","fromCharCode","join","isEqual","blob","toBase64","btoa","toUint8Array","split","char","charCodeAt","toString"],"sourceRoot":"../../lib","sources":["FirestoreBlob.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,MAAM,EAAEC,QAAQ,QAAQ,+CAA+C;AAEhF,eAAe,MAAMC,IAAI,CAAC;EAGxBC,WAAWA,CAACC,QAAQ,GAAG,KAAK,EAAEC,YAAqB,EAAE;IACnD,IAAID,QAAQ,KAAK,KAAK,EAAE;MACtB,MAAM,IAAIE,KAAK,CACb,6EACF,CAAC;IACH;IAEA,IAAI,CAACC,aAAa,GAAGF,YAAY,IAAI,EAAE;EACzC;EAEA,OAAOG,gBAAgBA,CAACC,MAAc,EAAQ;IAC5C,IAAI,CAACR,QAAQ,CAACQ,MAAM,CAAC,IAAIA,MAAM,CAACC,MAAM,GAAG,CAAC,EAAE;MAC1C,MAAM,IAAIJ,KAAK,CACb,oFACF,CAAC;IACH;IAEA,OAAO,IAAIJ,IAAI,CAAC,IAAI,EAAEF,MAAM,CAACW,IAAI,CAACF,MAAM,CAAC,CAAC;EAC5C;EAEA,OAAOG,cAAcA,CAACC,KAAiB,EAAQ;IAC7C,IAAI,EAAEA,KAAK,YAAYC,UAAU,CAAC,EAAE;MAClC,MAAM,IAAIR,KAAK,CAAC,iEAAiE,CAAC;IACpF;IAEA,OAAO,IAAIJ,IAAI,CACb,IAAI,EACJa,KAAK,CAACC,SAAS,CAACC,GAAG,CAACC,IAAI,CAACL,KAAK,EAAGM,IAAY,IAAKC,MAAM,CAACC,YAAY,CAACF,IAAI,CAAC,CAAC,CAACG,IAAI,CAAC,EAAE,CACtF,CAAC;EACH;EAEAC,OAAOA,CAACC,IAAU,EAAW;IAC3B,IAAI,EAAEA,IAAI,YAAYtB,IAAI,CAAC,EAAE;MAC3B,MAAM,IAAII,KAAK,CAAC,oDAAoD,CAAC;IACvE;IAEA,OAAO,IAAI,CAACC,aAAa,KAAKiB,IAAI,CAACjB,aAAa;EAClD;EAEAkB,QAAQA,CAAA,EAAW;IACjB,OAAOzB,MAAM,CAAC0B,IAAI,CAAC,IAAI,CAACnB,aAAa,CAAC;EACxC;EAEAoB,YAAYA,CAAA,EAAe;IACzB,OAAO,IAAIb,UAAU,CAAC,IAAI,CAACP,aAAa,CAACqB,KAAK,CAAC,EAAE,CAAC,CAACX,GAAG,CAACY,IAAI,IAAIA,IAAI,CAACC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;EACrF;EAEAC,QAAQA,CAAA,EAAW;IACjB,OAAO,0BAA0B,IAAI,CAACN,QAAQ,CAAC,CAAC,GAAG;EACrD;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this library except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { generateFirestoreId, isObject, isNull, isUndefined } from '@react-native-firebase/app/dist/module/common';
|
|
21
|
+
import DocumentReference, { provideCollectionReferenceClass } from "./FirestoreDocumentReference.js";
|
|
22
|
+
import Query from "./FirestoreQuery.js";
|
|
23
|
+
import QueryModifiers from "./FirestoreQueryModifiers.js";
|
|
24
|
+
import { validateWithConverter } from "./utils/index.js";
|
|
25
|
+
export default class CollectionReference extends Query {
|
|
26
|
+
constructor(firestore, collectionPath, converter) {
|
|
27
|
+
super(firestore, collectionPath, new QueryModifiers(), undefined, converter);
|
|
28
|
+
}
|
|
29
|
+
get id() {
|
|
30
|
+
return this._collectionPath.id;
|
|
31
|
+
}
|
|
32
|
+
get parent() {
|
|
33
|
+
const parent = this._collectionPath.parent();
|
|
34
|
+
if (!parent) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return new DocumentReference(this._firestore, parent);
|
|
38
|
+
}
|
|
39
|
+
get path() {
|
|
40
|
+
return this._collectionPath.relativeName;
|
|
41
|
+
}
|
|
42
|
+
add(data) {
|
|
43
|
+
if (!isObject(data)) {
|
|
44
|
+
throw new Error("firebase.firestore().collection().add(*) 'data' must be an object.");
|
|
45
|
+
}
|
|
46
|
+
const documentRef = this.doc();
|
|
47
|
+
return documentRef.set(data).then(() => Promise.resolve(documentRef));
|
|
48
|
+
}
|
|
49
|
+
doc(documentPath) {
|
|
50
|
+
const newPath = documentPath ?? generateFirestoreId();
|
|
51
|
+
const path = this._collectionPath.child(newPath);
|
|
52
|
+
if (!path.isDocument) {
|
|
53
|
+
throw new Error("firebase.firestore().collection().doc(*) 'documentPath' must point to a document.");
|
|
54
|
+
}
|
|
55
|
+
return new DocumentReference(this._firestore, path, this._converter);
|
|
56
|
+
}
|
|
57
|
+
withConverter(converter) {
|
|
58
|
+
if (isUndefined(converter) || isNull(converter)) {
|
|
59
|
+
return new CollectionReference(this._firestore, this._collectionPath, null);
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
validateWithConverter(converter);
|
|
63
|
+
} catch (e) {
|
|
64
|
+
throw new Error(`firebase.firestore().collection().withConverter() ${e.message}`);
|
|
65
|
+
}
|
|
66
|
+
return new CollectionReference(this._firestore, this._collectionPath, converter);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
provideCollectionReferenceClass(CollectionReference);
|
|
70
|
+
//# sourceMappingURL=FirestoreCollectionReference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["generateFirestoreId","isObject","isNull","isUndefined","DocumentReference","provideCollectionReferenceClass","Query","QueryModifiers","validateWithConverter","CollectionReference","constructor","firestore","collectionPath","converter","undefined","id","_collectionPath","parent","_firestore","path","relativeName","add","data","Error","documentRef","doc","set","then","Promise","resolve","documentPath","newPath","child","isDocument","_converter","withConverter","e","message"],"sourceRoot":"../../lib","sources":["FirestoreCollectionReference.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,mBAAmB,EACnBC,QAAQ,EACRC,MAAM,EACNC,WAAW,QACN,+CAA+C;AACtD,OAAOC,iBAAiB,IAAIC,+BAA+B,QAAQ,iCAA8B;AACjG,OAAOC,KAAK,MAAM,qBAAkB;AACpC,OAAOC,cAAc,MAAM,8BAA2B;AACtD,SAASC,qBAAqB,QAAQ,kBAAS;AAM/C,eAAe,MAAMC,mBAAmB,SAASH,KAAK,CAAC;EACrDI,WAAWA,CACTC,SAA4B,EAC5BC,cAA6B,EAC7BC,SAAqE,EACrE;IACA,KAAK,CAACF,SAAS,EAAEC,cAAc,EAAE,IAAIL,cAAc,CAAC,CAAC,EAAEO,SAAS,EAAED,SAAS,CAAC;EAC9E;EAEA,IAAIE,EAAEA,CAAA,EAAW;IACf,OAAO,IAAI,CAACC,eAAe,CAACD,EAAE;EAChC;EAEA,IAAIE,MAAMA,CAAA,EAA6B;IACrC,MAAMA,MAAM,GAAG,IAAI,CAACD,eAAe,CAACC,MAAM,CAAC,CAAC;IAC5C,IAAI,CAACA,MAAM,EAAE;MACX,OAAO,IAAI;IACb;IACA,OAAO,IAAIb,iBAAiB,CAAC,IAAI,CAACc,UAAU,EAAED,MAAM,CAAC;EACvD;EAEA,IAAIE,IAAIA,CAAA,EAAW;IACjB,OAAO,IAAI,CAACH,eAAe,CAACI,YAAY;EAC1C;EAEAC,GAAGA,CAACC,IAA6B,EAA8B;IAC7D,IAAI,CAACrB,QAAQ,CAACqB,IAAI,CAAC,EAAE;MACnB,MAAM,IAAIC,KAAK,CAAC,oEAAoE,CAAC;IACvF;IAEA,MAAMC,WAAW,GAAG,IAAI,CAACC,GAAG,CAAC,CAAC;IAC9B,OAAOD,WAAW,CAACE,GAAG,CAACJ,IAAI,CAAC,CAACK,IAAI,CAAC,MAAMC,OAAO,CAACC,OAAO,CAACL,WAAW,CAAC,CAAC;EACvE;EAEAC,GAAGA,CAACK,YAAqB,EAAqB;IAC5C,MAAMC,OAAO,GAAGD,YAAY,IAAI9B,mBAAmB,CAAC,CAAC;IACrD,MAAMmB,IAAI,GAAG,IAAI,CAACH,eAAe,CAACgB,KAAK,CAACD,OAAO,CAAC;IAEhD,IAAI,CAACZ,IAAI,CAACc,UAAU,EAAE;MACpB,MAAM,IAAIV,KAAK,CACb,mFACF,CAAC;IACH;IAEA,OAAO,IAAInB,iBAAiB,CAAC,IAAI,CAACc,UAAU,EAAEC,IAAI,EAAE,IAAI,CAACe,UAAU,CAAC;EACtE;EAEAC,aAAaA,CAACtB,SAAkB,EAAuB;IACrD,IAAIV,WAAW,CAACU,SAAS,CAAC,IAAIX,MAAM,CAACW,SAAS,CAAC,EAAE;MAC/C,OAAO,IAAIJ,mBAAmB,CAAC,IAAI,CAACS,UAAU,EAAE,IAAI,CAACF,eAAe,EAAE,IAAI,CAAC;IAC7E;IAEA,IAAI;MACFR,qBAAqB,CAACK,SAAS,CAAC;IAClC,CAAC,CAAC,OAAOuB,CAAC,EAAE;MACV,MAAM,IAAIb,KAAK,CAAC,qDAAsDa,CAAC,CAAWC,OAAO,EAAE,CAAC;IAC9F;IAEA,OAAO,IAAI5B,mBAAmB,CAC5B,IAAI,CAACS,UAAU,EACf,IAAI,CAACF,eAAe,EACpBH,SACF,CAAC;EACH;AACF;AAEAR,+BAA+B,CAACI,mBAAmB,CAAC","ignoreList":[]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
/*
|
|
2
4
|
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
5
|
*
|
|
@@ -14,37 +16,32 @@
|
|
|
14
16
|
* limitations under the License.
|
|
15
17
|
*
|
|
16
18
|
*/
|
|
17
|
-
import { createDeprecationProxy } from '@react-native-firebase/app/dist/module/common';
|
|
18
|
-
import FirestoreDocumentSnapshot from './FirestoreDocumentSnapshot';
|
|
19
19
|
|
|
20
|
+
import { createDeprecationProxy } from '@react-native-firebase/app/dist/module/common';
|
|
21
|
+
import DocumentSnapshot from "./FirestoreDocumentSnapshot.js";
|
|
20
22
|
const TYPE_MAP = {
|
|
21
23
|
a: 'added',
|
|
22
24
|
m: 'modified',
|
|
23
|
-
r: 'removed'
|
|
25
|
+
r: 'removed'
|
|
24
26
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
constructor(firestore, nativeData) {
|
|
27
|
+
export default class DocumentChange {
|
|
28
|
+
constructor(firestore, nativeData, converter) {
|
|
28
29
|
this._firestore = firestore;
|
|
29
30
|
this._nativeData = nativeData;
|
|
30
|
-
this._isMetadataChange = nativeData.isMetadataChange;
|
|
31
|
+
this._isMetadataChange = nativeData.isMetadataChange ?? false;
|
|
32
|
+
this._converter = converter;
|
|
31
33
|
}
|
|
32
|
-
|
|
33
34
|
get doc() {
|
|
34
|
-
return createDeprecationProxy(
|
|
35
|
-
new FirestoreDocumentSnapshot(this._firestore, this._nativeData.doc),
|
|
36
|
-
);
|
|
35
|
+
return createDeprecationProxy(new DocumentSnapshot(this._firestore, this._nativeData.doc, this._converter));
|
|
37
36
|
}
|
|
38
|
-
|
|
39
37
|
get newIndex() {
|
|
40
38
|
return this._nativeData.ni;
|
|
41
39
|
}
|
|
42
|
-
|
|
43
40
|
get oldIndex() {
|
|
44
41
|
return this._nativeData.oi;
|
|
45
42
|
}
|
|
46
|
-
|
|
47
43
|
get type() {
|
|
48
|
-
return TYPE_MAP[this._nativeData.type];
|
|
44
|
+
return TYPE_MAP[this._nativeData.type] ?? 'modified';
|
|
49
45
|
}
|
|
50
46
|
}
|
|
47
|
+
//# sourceMappingURL=FirestoreDocumentChange.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createDeprecationProxy","DocumentSnapshot","TYPE_MAP","a","m","r","DocumentChange","constructor","firestore","nativeData","converter","_firestore","_nativeData","_isMetadataChange","isMetadataChange","_converter","doc","newIndex","ni","oldIndex","oi","type"],"sourceRoot":"../../lib","sources":["FirestoreDocumentChange.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,sBAAsB,QAAQ,+CAA+C;AACtF,OAAOC,gBAAgB,MAAM,gCAA6B;AAI1D,MAAMC,QAA0D,GAAG;EACjEC,CAAC,EAAE,OAAO;EACVC,CAAC,EAAE,UAAU;EACbC,CAAC,EAAE;AACL,CAAC;AAUD,eAAe,MAAMC,cAAc,CAAC;EAMlCC,WAAWA,CACTC,SAA4B,EAC5BC,UAAoC,EACpCC,SAAoE,EACpE;IACA,IAAI,CAACC,UAAU,GAAGH,SAAS;IAC3B,IAAI,CAACI,WAAW,GAAGH,UAAU;IAC7B,IAAI,CAACI,iBAAiB,GAAGJ,UAAU,CAACK,gBAAgB,IAAI,KAAK;IAC7D,IAAI,CAACC,UAAU,GAAGL,SAAS;EAC7B;EAEA,IAAIM,GAAGA,CAAA,EAAqB;IAC1B,OAAOhB,sBAAsB,CAC3B,IAAIC,gBAAgB,CAAC,IAAI,CAACU,UAAU,EAAE,IAAI,CAACC,WAAW,CAACI,GAAG,EAAE,IAAI,CAACD,UAAU,CAC7E,CAAC;EACH;EAEA,IAAIE,QAAQA,CAAA,EAAW;IACrB,OAAO,IAAI,CAACL,WAAW,CAACM,EAAE;EAC5B;EAEA,IAAIC,QAAQA,CAAA,EAAW;IACrB,OAAO,IAAI,CAACP,WAAW,CAACQ,EAAE;EAC5B;EAEA,IAAIC,IAAIA,CAAA,EAAqC;IAC3C,OAAOnB,QAAQ,CAAC,IAAI,CAACU,WAAW,CAACS,IAAI,CAAC,IAAI,UAAU;EACtD;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this library except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { isObject, isString, isUndefined, isNull, createDeprecationProxy, filterModularArgument } from '@react-native-firebase/app/dist/module/common';
|
|
21
|
+
import NativeError from '@react-native-firebase/app/dist/module/internal/NativeFirebaseError';
|
|
22
|
+
import { parseSetOptions, parseSnapshotArgs, parseUpdateArgs, validateWithConverter, applyFirestoreDataConverter } from "./utils/index.js";
|
|
23
|
+
import { buildNativeMap, provideDocumentReferenceClass } from "./utils/serialize.js";
|
|
24
|
+
let FirestoreCollectionReference = null;
|
|
25
|
+
export function provideCollectionReferenceClass(collectionReference) {
|
|
26
|
+
FirestoreCollectionReference = collectionReference;
|
|
27
|
+
}
|
|
28
|
+
let FirestoreDocumentSnapshotClass = null;
|
|
29
|
+
export function provideDocumentSnapshotClass(documentSnapshot) {
|
|
30
|
+
FirestoreDocumentSnapshotClass = documentSnapshot;
|
|
31
|
+
}
|
|
32
|
+
let _id = 0;
|
|
33
|
+
export default class DocumentReference {
|
|
34
|
+
constructor(firestore, documentPath, converter) {
|
|
35
|
+
this._firestore = firestore;
|
|
36
|
+
this._documentPath = documentPath;
|
|
37
|
+
this._converter = converter === undefined ? null : converter;
|
|
38
|
+
}
|
|
39
|
+
get firestore() {
|
|
40
|
+
return this._firestore;
|
|
41
|
+
}
|
|
42
|
+
get converter() {
|
|
43
|
+
return this._converter;
|
|
44
|
+
}
|
|
45
|
+
get id() {
|
|
46
|
+
return this._documentPath.id;
|
|
47
|
+
}
|
|
48
|
+
get parent() {
|
|
49
|
+
const parentPath = this._documentPath.parent();
|
|
50
|
+
return new FirestoreCollectionReference(this._firestore, parentPath, this._converter);
|
|
51
|
+
}
|
|
52
|
+
get path() {
|
|
53
|
+
return this._documentPath.relativeName;
|
|
54
|
+
}
|
|
55
|
+
collection(collectionPath) {
|
|
56
|
+
if (!isString(collectionPath)) {
|
|
57
|
+
throw new Error("firebase.firestore().doc().collection(*) 'collectionPath' must be a string value.");
|
|
58
|
+
}
|
|
59
|
+
if (collectionPath === '') {
|
|
60
|
+
throw new Error("firebase.firestore().doc().collection(*) 'collectionPath' must be a non-empty string.");
|
|
61
|
+
}
|
|
62
|
+
const path = this._documentPath.child(collectionPath);
|
|
63
|
+
if (!path.isCollection) {
|
|
64
|
+
throw new Error("firebase.firestore().doc().collection(*) 'collectionPath' must point to a collection.");
|
|
65
|
+
}
|
|
66
|
+
return new FirestoreCollectionReference(this._firestore, path);
|
|
67
|
+
}
|
|
68
|
+
delete() {
|
|
69
|
+
return this._firestore.native.documentDelete(this.path);
|
|
70
|
+
}
|
|
71
|
+
get(options) {
|
|
72
|
+
if (!isUndefined(options) && !isObject(options)) {
|
|
73
|
+
throw new Error("firebase.firestore().doc().get(*) 'options' must be an object is provided.");
|
|
74
|
+
}
|
|
75
|
+
if (options && options.source && options.source !== 'default' && options.source !== 'server' && options.source !== 'cache') {
|
|
76
|
+
throw new Error("firebase.firestore().doc().get(*) 'options' GetOptions.source must be one of 'default', 'server' or 'cache'.");
|
|
77
|
+
}
|
|
78
|
+
return this._firestore.native.documentGet(this.path, options).then(data => createDeprecationProxy(new FirestoreDocumentSnapshotClass(this._firestore, data, this._converter)));
|
|
79
|
+
}
|
|
80
|
+
isEqual(other) {
|
|
81
|
+
if (!(other instanceof DocumentReference)) {
|
|
82
|
+
throw new Error("firebase.firestore().doc().isEqual(*) 'other' expected a DocumentReference instance.");
|
|
83
|
+
}
|
|
84
|
+
return !(this.path !== other.path || this.firestore.app.name !== other.firestore.app.name || this.firestore.app.options.projectId !== other.firestore.app.options.projectId || this.converter !== other.converter);
|
|
85
|
+
}
|
|
86
|
+
onSnapshot(...args) {
|
|
87
|
+
let snapshotListenOptions;
|
|
88
|
+
let callback;
|
|
89
|
+
let onNext;
|
|
90
|
+
let onError;
|
|
91
|
+
try {
|
|
92
|
+
const options = parseSnapshotArgs(args);
|
|
93
|
+
snapshotListenOptions = options.snapshotListenOptions;
|
|
94
|
+
callback = options.callback;
|
|
95
|
+
onNext = options.onNext;
|
|
96
|
+
onError = options.onError;
|
|
97
|
+
} catch (e) {
|
|
98
|
+
throw new Error(`firebase.firestore().doc().onSnapshot(*) ${e.message}`);
|
|
99
|
+
}
|
|
100
|
+
function handleSuccess(documentSnapshot) {
|
|
101
|
+
callback(documentSnapshot, null);
|
|
102
|
+
onNext(documentSnapshot);
|
|
103
|
+
}
|
|
104
|
+
function handleError(error) {
|
|
105
|
+
callback(null, error);
|
|
106
|
+
onError(error);
|
|
107
|
+
}
|
|
108
|
+
const listenerId = _id++;
|
|
109
|
+
const onSnapshotSubscription = this._firestore.emitter.addListener(this._firestore.eventNameForApp(`firestore_document_sync_event:${listenerId}`), event => {
|
|
110
|
+
if (event.body.error) {
|
|
111
|
+
handleError(NativeError.fromEvent(event.body.error, 'firestore'));
|
|
112
|
+
} else {
|
|
113
|
+
const snapshot = event.body.snapshot;
|
|
114
|
+
if (!snapshot) return;
|
|
115
|
+
const documentSnapshot = createDeprecationProxy(new FirestoreDocumentSnapshotClass(this._firestore, snapshot, this._converter));
|
|
116
|
+
handleSuccess(documentSnapshot);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
const unsubscribe = () => {
|
|
120
|
+
onSnapshotSubscription.remove();
|
|
121
|
+
this._firestore.native.documentOffSnapshot(listenerId);
|
|
122
|
+
};
|
|
123
|
+
this._firestore.native.documentOnSnapshot(this.path, listenerId, snapshotListenOptions);
|
|
124
|
+
return unsubscribe;
|
|
125
|
+
}
|
|
126
|
+
set(data, options) {
|
|
127
|
+
let setOptions;
|
|
128
|
+
try {
|
|
129
|
+
setOptions = parseSetOptions(options);
|
|
130
|
+
} catch (e) {
|
|
131
|
+
throw new Error(`firebase.firestore().doc().set(_, *) ${e.message}.`);
|
|
132
|
+
}
|
|
133
|
+
let converted = data;
|
|
134
|
+
try {
|
|
135
|
+
converted = applyFirestoreDataConverter(data, this._converter, setOptions);
|
|
136
|
+
} catch (e) {
|
|
137
|
+
throw new Error(`firebase.firestore().doc().set(*) 'withConverter.toFirestore' threw an error: ${e.message}.`);
|
|
138
|
+
}
|
|
139
|
+
if (!isObject(converted)) {
|
|
140
|
+
throw new Error("firebase.firestore().doc().set(*) 'data' must be an object.");
|
|
141
|
+
}
|
|
142
|
+
return this._firestore.native.documentSet(this.path, buildNativeMap(converted, this._firestore._settings.ignoreUndefinedProperties), setOptions);
|
|
143
|
+
}
|
|
144
|
+
update(...args) {
|
|
145
|
+
const updatedArgs = filterModularArgument(args);
|
|
146
|
+
if (updatedArgs.length === 0) {
|
|
147
|
+
throw new Error('firebase.firestore().doc().update(*) expected at least 1 argument but was called with 0 arguments.');
|
|
148
|
+
}
|
|
149
|
+
let data;
|
|
150
|
+
try {
|
|
151
|
+
data = parseUpdateArgs(updatedArgs);
|
|
152
|
+
} catch (e) {
|
|
153
|
+
throw new Error(`firebase.firestore().doc().update(*) ${e.message}`);
|
|
154
|
+
}
|
|
155
|
+
return this._firestore.native.documentUpdate(this.path, buildNativeMap(data, this._firestore._settings.ignoreUndefinedProperties));
|
|
156
|
+
}
|
|
157
|
+
withConverter(converter) {
|
|
158
|
+
if (isUndefined(converter) || isNull(converter)) {
|
|
159
|
+
return new DocumentReference(this._firestore, this._documentPath, null);
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
validateWithConverter(converter);
|
|
163
|
+
} catch (e) {
|
|
164
|
+
throw new Error(`firebase.firestore().doc().withConverter() ${e.message}`);
|
|
165
|
+
}
|
|
166
|
+
return new DocumentReference(this._firestore, this._documentPath, converter);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
provideDocumentReferenceClass(DocumentReference);
|
|
170
|
+
//# sourceMappingURL=FirestoreDocumentReference.js.map
|