react-query-firebase 2.13.3 → 2.14.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/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/react-native/analytics/index.d.ts +3 -0
- package/dist/react-native/analytics/index.js +3 -0
- package/{react-native/analytics/useAnalytics.ts → dist/react-native/analytics/useAnalytics.js} +1 -3
- package/{react-native → dist/react-native}/analytics/useLogEvent.js +1 -1
- package/{react-native → dist/react-native}/analytics/useSetAnalyticsCollectionEnabled.js +1 -1
- package/dist/react-native/auth/index.d.ts +19 -0
- package/dist/react-native/auth/index.js +19 -0
- package/{react-native/auth/useAuth.ts → dist/react-native/auth/useAuth.js} +1 -3
- package/{react-native → dist/react-native}/auth/useAuthStateReady.js +1 -1
- package/{react-native → dist/react-native}/auth/useCreateUserWitEmailAndPasswordMutation.js +2 -2
- package/{react-native → dist/react-native}/auth/useCurrentUser.js +1 -1
- package/{react-native → dist/react-native}/auth/useIdToken.js +2 -2
- package/{react-native → dist/react-native}/auth/useLinkWithCredentialMutation.js +1 -1
- package/{react-native → dist/react-native}/auth/useReauthenticateWitCredentialMutation.js +1 -1
- package/{react-native → dist/react-native}/auth/useReauthenticateWitRedirectMutation.js +1 -1
- package/{react-native → dist/react-native}/auth/useSendEmailVerificationMutation.js +1 -1
- package/{react-native → dist/react-native}/auth/useSignInAnonymouslyMutation.js +2 -2
- package/{react-native → dist/react-native}/auth/useSignInWitEmailAndPasswordMutation.js +2 -2
- package/{react-native → dist/react-native}/auth/useSignInWitRedirectMutation.js +2 -2
- package/{react-native → dist/react-native}/auth/useSignInWithCredentialMutation.js +2 -2
- package/{react-native → dist/react-native}/auth/useSignOutMutation.js +2 -2
- package/{react-native → dist/react-native}/auth/useUpdateProfileMutation.js +1 -1
- package/{react-native → dist/react-native}/context/FirebaseContextProvider.js +1 -1
- package/dist/react-native/context/index.d.ts +1 -0
- package/dist/react-native/context/index.js +1 -0
- package/dist/react-native/firestore/index.d.ts +23 -0
- package/dist/react-native/firestore/index.js +23 -0
- package/{react-native → dist/react-native}/firestore/useAddDocMutation.d.ts +1 -1
- package/{react-native → dist/react-native}/firestore/useBatchWrite.js +1 -1
- package/{react-native → dist/react-native}/firestore/useCollectionReference.d.ts +1 -1
- package/{react-native → dist/react-native}/firestore/useCollectionReference.js +1 -1
- package/{react-native → dist/react-native}/firestore/useCompositeFilter.d.ts +2 -2
- package/{react-native → dist/react-native}/firestore/useCompositeFilter.js +1 -1
- package/{react-native → dist/react-native}/firestore/useCountQuery.d.ts +2 -2
- package/{react-native → dist/react-native}/firestore/useDeleteDocMutation.d.ts +1 -1
- package/{react-native → dist/react-native}/firestore/useDocReference.d.ts +2 -2
- package/{react-native → dist/react-native}/firestore/useDocReference.js +2 -2
- package/{react-native → dist/react-native}/firestore/useDocReferences.d.ts +2 -2
- package/{react-native → dist/react-native}/firestore/useDocReferences.js +2 -2
- package/{web → dist/react-native}/firestore/useEnsureDoc.d.ts +2 -2
- package/{react-native → dist/react-native}/firestore/useEnsureDoc.js +3 -3
- package/{react-native/firestore/useFirestore.ts → dist/react-native/firestore/useFirestore.js} +1 -2
- package/{react-native → dist/react-native}/firestore/useGetDocData.d.ts +2 -2
- package/{web → dist/react-native}/firestore/useGetDocData.js +2 -2
- package/{react-native → dist/react-native}/firestore/useGetRealtimeDocData.d.ts +1 -1
- package/{react-native → dist/react-native}/firestore/useGetRealtimeDocData.js +1 -1
- package/{react-native → dist/react-native}/firestore/useInfiniteQuery.d.ts +2 -2
- package/{react-native → dist/react-native}/firestore/useQuery.d.ts +2 -2
- package/{react-native → dist/react-native}/firestore/useQueryConstraints.d.ts +2 -2
- package/{react-native → dist/react-native}/firestore/useQueryConstraints.js +1 -1
- package/{react-native → dist/react-native}/firestore/useRunTransaction.js +1 -1
- package/{react-native → dist/react-native}/firestore/useSetDocMutation.d.ts +1 -1
- package/{react-native → dist/react-native}/firestore/useUpdateDocMutation.d.ts +1 -1
- package/{react-native → dist/react-native}/firestore/utils/buildCompositeFilter.d.ts +1 -1
- package/{react-native → dist/react-native}/firestore/utils/buildQueryConstraint.d.ts +1 -1
- package/{react-native → dist/react-native}/firestore/utils/getDocData.d.ts +2 -2
- package/{react-native → dist/react-native}/firestore/utils/getDocData.js +1 -1
- package/{react-native → dist/react-native}/firestore/utils/getDocRef.d.ts +1 -1
- package/{react-native → dist/react-native}/firestore/utils/getDocSnap.d.ts +2 -2
- package/{react-native → dist/react-native}/firestore/utils/getDocSnap.js +1 -1
- package/dist/react-native/index.d.ts +5 -0
- package/dist/react-native/index.js +5 -0
- package/dist/react-native/remoteConfig/index.d.ts +3 -0
- package/dist/react-native/remoteConfig/index.js +3 -0
- package/{react-native → dist/react-native}/remoteConfig/useFetchAndActivate.js +1 -1
- package/{react-native → dist/react-native}/remoteConfig/useGetValue.js +1 -1
- package/{react-native/remoteConfig/useRemoteConfig.ts → dist/react-native/remoteConfig/useRemoteConfig.js} +1 -2
- package/{types → dist/types}/QueryConstraints.d.ts +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/web/analytics/index.d.ts +3 -0
- package/dist/web/analytics/index.js +3 -0
- package/{web/analytics/useAnalytics.ts → dist/web/analytics/useAnalytics.js} +1 -3
- package/{web → dist/web}/analytics/useLogEvent.js +1 -1
- package/{web → dist/web}/analytics/useSetAnalyticsCollectionEnabled.js +1 -1
- package/dist/web/auth/index.d.ts +20 -0
- package/dist/web/auth/index.js +20 -0
- package/{web/auth/useAuth.ts → dist/web/auth/useAuth.js} +1 -3
- package/{web → dist/web}/auth/useAuthStateReady.js +1 -1
- package/{web → dist/web}/auth/useCreateUserWitEmailAndPasswordMutation.js +2 -2
- package/{web → dist/web}/auth/useCurrentUser.js +1 -1
- package/{web → dist/web}/auth/useGetRedirectResultMutation.js +2 -2
- package/{web → dist/web}/auth/useIdToken.js +2 -2
- package/{web → dist/web}/auth/useLinkWithCredentialMutation.js +1 -1
- package/{web → dist/web}/auth/useReauthenticateWitCredentialMutation.js +1 -1
- package/{web → dist/web}/auth/useReauthenticateWitRedirectMutation.js +1 -1
- package/{web → dist/web}/auth/useSendEmailVerificationMutation.js +1 -1
- package/{web → dist/web}/auth/useSignInAnonymouslyMutation.js +2 -2
- package/{web → dist/web}/auth/useSignInWitEmailAndPasswordMutation.js +2 -2
- package/{web → dist/web}/auth/useSignInWitRedirectMutation.js +2 -2
- package/{web → dist/web}/auth/useSignInWithCredentialMutation.js +2 -2
- package/{web → dist/web}/auth/useSignOutMutation.js +2 -2
- package/{web → dist/web}/auth/useUpdateProfileMutation.js +1 -1
- package/{web → dist/web}/context/FirebaseContextProvider.js +1 -1
- package/dist/web/context/index.d.ts +1 -0
- package/dist/web/context/index.js +1 -0
- package/dist/web/firestore/index.d.ts +23 -0
- package/dist/web/firestore/index.js +23 -0
- package/{web → dist/web}/firestore/useAddDocMutation.d.ts +1 -1
- package/{web → dist/web}/firestore/useBatchWrite.js +1 -1
- package/{web → dist/web}/firestore/useCollectionReference.d.ts +1 -1
- package/{web → dist/web}/firestore/useCollectionReference.js +1 -1
- package/{web → dist/web}/firestore/useCompositeFilter.d.ts +2 -2
- package/{web → dist/web}/firestore/useCompositeFilter.js +1 -1
- package/{web → dist/web}/firestore/useCountQuery.d.ts +2 -2
- package/{web → dist/web}/firestore/useDeleteDocMutation.d.ts +1 -1
- package/{web → dist/web}/firestore/useDocReference.d.ts +2 -2
- package/{web → dist/web}/firestore/useDocReference.js +2 -2
- package/{web → dist/web}/firestore/useDocReferences.d.ts +2 -2
- package/{web → dist/web}/firestore/useDocReferences.js +2 -2
- package/{react-native → dist/web}/firestore/useEnsureDoc.d.ts +2 -2
- package/{web → dist/web}/firestore/useEnsureDoc.js +3 -3
- package/{web/firestore/useFirestore.ts → dist/web/firestore/useFirestore.js} +1 -2
- package/{web → dist/web}/firestore/useGetDocData.d.ts +2 -2
- package/{react-native → dist/web}/firestore/useGetDocData.js +2 -2
- package/{web → dist/web}/firestore/useGetRealtimeDocData.d.ts +1 -1
- package/{web → dist/web}/firestore/useGetRealtimeDocData.js +1 -1
- package/{web → dist/web}/firestore/useInfiniteQuery.d.ts +2 -2
- package/{web → dist/web}/firestore/useQuery.d.ts +2 -2
- package/{web → dist/web}/firestore/useQueryConstraints.d.ts +2 -2
- package/{web → dist/web}/firestore/useQueryConstraints.js +1 -1
- package/{web → dist/web}/firestore/useRunTransaction.js +1 -1
- package/{web → dist/web}/firestore/useSetDocMutation.d.ts +1 -1
- package/{web → dist/web}/firestore/useUpdateDocMutation.d.ts +1 -1
- package/{web → dist/web}/firestore/utils/buildCompositeFilter.d.ts +1 -1
- package/{web → dist/web}/firestore/utils/buildQueryConstraint.d.ts +1 -1
- package/{web → dist/web}/firestore/utils/getDocData.d.ts +2 -2
- package/{web → dist/web}/firestore/utils/getDocData.js +1 -1
- package/{web → dist/web}/firestore/utils/getDocRef.d.ts +1 -1
- package/{web → dist/web}/firestore/utils/getDocSnap.d.ts +2 -2
- package/{web → dist/web}/firestore/utils/getDocSnap.js +1 -1
- package/dist/web/index.d.ts +5 -0
- package/dist/web/index.js +5 -0
- package/dist/web/remoteConfig/index.d.ts +3 -0
- package/dist/web/remoteConfig/index.js +3 -0
- package/{web → dist/web}/remoteConfig/useFetchAndActivate.js +1 -1
- package/{web → dist/web}/remoteConfig/useGetValue.js +1 -1
- package/{web/remoteConfig/useRemoteConfig.ts → dist/web/remoteConfig/useRemoteConfig.js} +1 -2
- package/package.json +37 -17
- package/react-native/analytics/index.d.ts +0 -3
- package/react-native/analytics/index.js +0 -3
- package/react-native/analytics/index.ts +0 -3
- package/react-native/analytics/useAnalytics.js +0 -10
- package/react-native/analytics/useLogEvent.ts +0 -34
- package/react-native/analytics/useSetAnalyticsCollectionEnabled.ts +0 -22
- package/react-native/auth/index.d.ts +0 -19
- package/react-native/auth/index.js +0 -19
- package/react-native/auth/index.ts +0 -19
- package/react-native/auth/mutation-keys.ts +0 -22
- package/react-native/auth/useAppleAuthProviderCredential.ts +0 -31
- package/react-native/auth/useAuth.js +0 -10
- package/react-native/auth/useAuthStateReady.ts +0 -39
- package/react-native/auth/useCreateUserWitEmailAndPasswordMutation.ts +0 -38
- package/react-native/auth/useCurrentUser.ts +0 -26
- package/react-native/auth/useEmailAuthProviderCredential.ts +0 -38
- package/react-native/auth/useFacebookAuthProviderCredential.ts +0 -31
- package/react-native/auth/useIdToken.ts +0 -83
- package/react-native/auth/useLinkWithCredentialMutation.ts +0 -35
- package/react-native/auth/useReauthenticateWitCredentialMutation.ts +0 -36
- package/react-native/auth/useReauthenticateWitRedirectMutation.ts +0 -42
- package/react-native/auth/useSendEmailVerificationMutation.ts +0 -33
- package/react-native/auth/useSignInAnonymouslyMutation.ts +0 -52
- package/react-native/auth/useSignInWitEmailAndPasswordMutation.ts +0 -39
- package/react-native/auth/useSignInWitRedirectMutation.ts +0 -38
- package/react-native/auth/useSignInWithCredentialMutation.ts +0 -36
- package/react-native/auth/useSignOutMutation.ts +0 -28
- package/react-native/auth/useUpdateProfileMutation.ts +0 -30
- package/react-native/context/FirebaseContext.ts +0 -25
- package/react-native/context/FirebaseContextProvider.tsx +0 -264
- package/react-native/context/index.d.ts +0 -1
- package/react-native/context/index.js +0 -1
- package/react-native/context/index.ts +0 -1
- package/react-native/firestore/index.d.ts +0 -23
- package/react-native/firestore/index.js +0 -23
- package/react-native/firestore/index.ts +0 -23
- package/react-native/firestore/useAddDocMutation.ts +0 -80
- package/react-native/firestore/useBatchWrite.ts +0 -58
- package/react-native/firestore/useCollectionReference.ts +0 -58
- package/react-native/firestore/useCompositeFilter.ts +0 -60
- package/react-native/firestore/useCountQuery.ts +0 -85
- package/react-native/firestore/useDeleteDocMutation.ts +0 -71
- package/react-native/firestore/useDocReference.ts +0 -42
- package/react-native/firestore/useDocReferences.ts +0 -40
- package/react-native/firestore/useEnsureDoc.ts +0 -79
- package/react-native/firestore/useFirestore.js +0 -13
- package/react-native/firestore/useGetDocData.ts +0 -52
- package/react-native/firestore/useGetRealtimeDocData.ts +0 -106
- package/react-native/firestore/useInfiniteQuery.ts +0 -115
- package/react-native/firestore/useQuery.ts +0 -89
- package/react-native/firestore/useQueryConstraints.ts +0 -44
- package/react-native/firestore/useRunTransaction.ts +0 -55
- package/react-native/firestore/useSetDocMutation.ts +0 -76
- package/react-native/firestore/useUpdateDocMutation.ts +0 -77
- package/react-native/firestore/utils/buildCompositeFilter.ts +0 -75
- package/react-native/firestore/utils/buildQueryConstraint.ts +0 -54
- package/react-native/firestore/utils/getDocData.ts +0 -33
- package/react-native/firestore/utils/getDocRef.ts +0 -41
- package/react-native/firestore/utils/getDocSnap.ts +0 -34
- package/react-native/index.d.ts +0 -1
- package/react-native/index.js +0 -1
- package/react-native/index.ts +0 -1
- package/react-native/remoteConfig/index.d.ts +0 -3
- package/react-native/remoteConfig/index.js +0 -3
- package/react-native/remoteConfig/index.ts +0 -3
- package/react-native/remoteConfig/useFetchAndActivate.ts +0 -36
- package/react-native/remoteConfig/useGetValue.ts +0 -16
- package/react-native/remoteConfig/useRemoteConfig.js +0 -10
- package/types/AppModel.ts +0 -10
- package/types/QueryConstraints.ts +0 -57
- package/types/index.d.ts +0 -2
- package/types/index.js +0 -2
- package/types/index.ts +0 -2
- package/web/analytics/index.d.ts +0 -3
- package/web/analytics/index.js +0 -3
- package/web/analytics/index.ts +0 -3
- package/web/analytics/useAnalytics.js +0 -10
- package/web/analytics/useLogEvent.ts +0 -34
- package/web/analytics/useSetAnalyticsCollectionEnabled.ts +0 -22
- package/web/auth/index.d.ts +0 -20
- package/web/auth/index.js +0 -20
- package/web/auth/index.ts +0 -20
- package/web/auth/mutation-keys.ts +0 -23
- package/web/auth/useAppleAuthProviderCredential.ts +0 -32
- package/web/auth/useAuth.js +0 -10
- package/web/auth/useAuthStateReady.ts +0 -30
- package/web/auth/useCreateUserWitEmailAndPasswordMutation.ts +0 -33
- package/web/auth/useCurrentUser.ts +0 -25
- package/web/auth/useEmailAuthProviderCredential.ts +0 -38
- package/web/auth/useFacebookAuthProviderCredential.ts +0 -31
- package/web/auth/useGetRedirectResultMutation.ts +0 -27
- package/web/auth/useIdToken.ts +0 -83
- package/web/auth/useLinkWithCredentialMutation.ts +0 -30
- package/web/auth/useReauthenticateWitCredentialMutation.ts +0 -31
- package/web/auth/useReauthenticateWitRedirectMutation.ts +0 -37
- package/web/auth/useSendEmailVerificationMutation.ts +0 -28
- package/web/auth/useSignInAnonymouslyMutation.ts +0 -49
- package/web/auth/useSignInWitEmailAndPasswordMutation.ts +0 -34
- package/web/auth/useSignInWitRedirectMutation.ts +0 -33
- package/web/auth/useSignInWithCredentialMutation.ts +0 -31
- package/web/auth/useSignOutMutation.ts +0 -25
- package/web/auth/useUpdateProfileMutation.ts +0 -30
- package/web/context/FirebaseContext.ts +0 -25
- package/web/context/FirebaseContextProvider.tsx +0 -263
- package/web/context/index.d.ts +0 -1
- package/web/context/index.js +0 -1
- package/web/context/index.ts +0 -1
- package/web/firestore/index.d.ts +0 -23
- package/web/firestore/index.js +0 -23
- package/web/firestore/index.ts +0 -23
- package/web/firestore/useAddDocMutation.ts +0 -74
- package/web/firestore/useBatchWrite.ts +0 -58
- package/web/firestore/useCollectionReference.ts +0 -58
- package/web/firestore/useCompositeFilter.ts +0 -55
- package/web/firestore/useCountQuery.ts +0 -90
- package/web/firestore/useDeleteDocMutation.ts +0 -69
- package/web/firestore/useDocReference.ts +0 -43
- package/web/firestore/useDocReferences.ts +0 -40
- package/web/firestore/useEnsureDoc.ts +0 -92
- package/web/firestore/useFirestore.js +0 -13
- package/web/firestore/useGetDocData.ts +0 -52
- package/web/firestore/useGetRealtimeDocData.ts +0 -105
- package/web/firestore/useInfiniteQuery.ts +0 -117
- package/web/firestore/useQuery.ts +0 -94
- package/web/firestore/useQueryConstraints.ts +0 -44
- package/web/firestore/useRunTransaction.ts +0 -56
- package/web/firestore/useSetDocMutation.ts +0 -77
- package/web/firestore/useUpdateDocMutation.ts +0 -78
- package/web/firestore/utils/buildCompositeFilter.ts +0 -73
- package/web/firestore/utils/buildQueryConstraint.ts +0 -55
- package/web/firestore/utils/getDocData.ts +0 -33
- package/web/firestore/utils/getDocRef.ts +0 -43
- package/web/firestore/utils/getDocSnap.ts +0 -34
- package/web/index.d.ts +0 -1
- package/web/index.js +0 -1
- package/web/index.ts +0 -1
- package/web/remoteConfig/index.d.ts +0 -3
- package/web/remoteConfig/index.js +0 -3
- package/web/remoteConfig/index.ts +0 -3
- package/web/remoteConfig/useFetchAndActivate.ts +0 -36
- package/web/remoteConfig/useGetValue.ts +0 -16
- package/web/remoteConfig/useRemoteConfig.js +0 -10
- /package/{react-native → dist/react-native}/analytics/useAnalytics.d.ts +0 -0
- /package/{react-native → dist/react-native}/analytics/useLogEvent.d.ts +0 -0
- /package/{react-native → dist/react-native}/analytics/useSetAnalyticsCollectionEnabled.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/mutation-keys.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/mutation-keys.js +0 -0
- /package/{react-native → dist/react-native}/auth/useAppleAuthProviderCredential.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useAppleAuthProviderCredential.js +0 -0
- /package/{react-native → dist/react-native}/auth/useAuth.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useAuthStateReady.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useCreateUserWitEmailAndPasswordMutation.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useCurrentUser.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useEmailAuthProviderCredential.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useEmailAuthProviderCredential.js +0 -0
- /package/{react-native → dist/react-native}/auth/useFacebookAuthProviderCredential.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useFacebookAuthProviderCredential.js +0 -0
- /package/{react-native → dist/react-native}/auth/useIdToken.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useLinkWithCredentialMutation.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useReauthenticateWitCredentialMutation.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useReauthenticateWitRedirectMutation.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useSendEmailVerificationMutation.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useSignInAnonymouslyMutation.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useSignInWitEmailAndPasswordMutation.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useSignInWitRedirectMutation.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useSignInWithCredentialMutation.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useSignOutMutation.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useUpdateProfileMutation.d.ts +0 -0
- /package/{react-native → dist/react-native}/context/FirebaseContext.d.ts +0 -0
- /package/{react-native → dist/react-native}/context/FirebaseContext.js +0 -0
- /package/{react-native → dist/react-native}/context/FirebaseContextProvider.d.ts +0 -0
- /package/{react-native → dist/react-native}/firestore/useAddDocMutation.js +0 -0
- /package/{react-native → dist/react-native}/firestore/useBatchWrite.d.ts +0 -0
- /package/{react-native → dist/react-native}/firestore/useCountQuery.js +0 -0
- /package/{react-native → dist/react-native}/firestore/useDeleteDocMutation.js +0 -0
- /package/{react-native → dist/react-native}/firestore/useFirestore.d.ts +0 -0
- /package/{react-native → dist/react-native}/firestore/useInfiniteQuery.js +0 -0
- /package/{react-native → dist/react-native}/firestore/useQuery.js +0 -0
- /package/{react-native → dist/react-native}/firestore/useRunTransaction.d.ts +0 -0
- /package/{react-native → dist/react-native}/firestore/useSetDocMutation.js +0 -0
- /package/{react-native → dist/react-native}/firestore/useUpdateDocMutation.js +0 -0
- /package/{react-native → dist/react-native}/firestore/utils/buildCompositeFilter.js +0 -0
- /package/{react-native → dist/react-native}/firestore/utils/buildQueryConstraint.js +0 -0
- /package/{react-native → dist/react-native}/firestore/utils/getDocRef.js +0 -0
- /package/{react-native → dist/react-native}/remoteConfig/useFetchAndActivate.d.ts +0 -0
- /package/{react-native → dist/react-native}/remoteConfig/useGetValue.d.ts +0 -0
- /package/{react-native → dist/react-native}/remoteConfig/useRemoteConfig.d.ts +0 -0
- /package/{types → dist/types}/AppModel.d.ts +0 -0
- /package/{types → dist/types}/AppModel.js +0 -0
- /package/{types → dist/types}/QueryConstraints.js +0 -0
- /package/{web → dist/web}/analytics/useAnalytics.d.ts +0 -0
- /package/{web → dist/web}/analytics/useLogEvent.d.ts +0 -0
- /package/{web → dist/web}/analytics/useSetAnalyticsCollectionEnabled.d.ts +0 -0
- /package/{web → dist/web}/auth/mutation-keys.d.ts +0 -0
- /package/{web → dist/web}/auth/mutation-keys.js +0 -0
- /package/{web → dist/web}/auth/useAppleAuthProviderCredential.d.ts +0 -0
- /package/{web → dist/web}/auth/useAppleAuthProviderCredential.js +0 -0
- /package/{web → dist/web}/auth/useAuth.d.ts +0 -0
- /package/{web → dist/web}/auth/useAuthStateReady.d.ts +0 -0
- /package/{web → dist/web}/auth/useCreateUserWitEmailAndPasswordMutation.d.ts +0 -0
- /package/{web → dist/web}/auth/useCurrentUser.d.ts +0 -0
- /package/{web → dist/web}/auth/useEmailAuthProviderCredential.d.ts +0 -0
- /package/{web → dist/web}/auth/useEmailAuthProviderCredential.js +0 -0
- /package/{web → dist/web}/auth/useFacebookAuthProviderCredential.d.ts +0 -0
- /package/{web → dist/web}/auth/useFacebookAuthProviderCredential.js +0 -0
- /package/{web → dist/web}/auth/useGetRedirectResultMutation.d.ts +0 -0
- /package/{web → dist/web}/auth/useIdToken.d.ts +0 -0
- /package/{web → dist/web}/auth/useLinkWithCredentialMutation.d.ts +0 -0
- /package/{web → dist/web}/auth/useReauthenticateWitCredentialMutation.d.ts +0 -0
- /package/{web → dist/web}/auth/useReauthenticateWitRedirectMutation.d.ts +0 -0
- /package/{web → dist/web}/auth/useSendEmailVerificationMutation.d.ts +0 -0
- /package/{web → dist/web}/auth/useSignInAnonymouslyMutation.d.ts +0 -0
- /package/{web → dist/web}/auth/useSignInWitEmailAndPasswordMutation.d.ts +0 -0
- /package/{web → dist/web}/auth/useSignInWitRedirectMutation.d.ts +0 -0
- /package/{web → dist/web}/auth/useSignInWithCredentialMutation.d.ts +0 -0
- /package/{web → dist/web}/auth/useSignOutMutation.d.ts +0 -0
- /package/{web → dist/web}/auth/useUpdateProfileMutation.d.ts +0 -0
- /package/{web → dist/web}/context/FirebaseContext.d.ts +0 -0
- /package/{web → dist/web}/context/FirebaseContext.js +0 -0
- /package/{web → dist/web}/context/FirebaseContextProvider.d.ts +0 -0
- /package/{web → dist/web}/firestore/useAddDocMutation.js +0 -0
- /package/{web → dist/web}/firestore/useBatchWrite.d.ts +0 -0
- /package/{web → dist/web}/firestore/useCountQuery.js +0 -0
- /package/{web → dist/web}/firestore/useDeleteDocMutation.js +0 -0
- /package/{web → dist/web}/firestore/useFirestore.d.ts +0 -0
- /package/{web → dist/web}/firestore/useInfiniteQuery.js +0 -0
- /package/{web → dist/web}/firestore/useQuery.js +0 -0
- /package/{web → dist/web}/firestore/useRunTransaction.d.ts +0 -0
- /package/{web → dist/web}/firestore/useSetDocMutation.js +0 -0
- /package/{web → dist/web}/firestore/useUpdateDocMutation.js +0 -0
- /package/{web → dist/web}/firestore/utils/buildCompositeFilter.js +0 -0
- /package/{web → dist/web}/firestore/utils/buildQueryConstraint.js +0 -0
- /package/{web → dist/web}/firestore/utils/getDocRef.js +0 -0
- /package/{web → dist/web}/remoteConfig/useFetchAndActivate.d.ts +0 -0
- /package/{web → dist/web}/remoteConfig/useGetValue.d.ts +0 -0
- /package/{web → dist/web}/remoteConfig/useRemoteConfig.d.ts +0 -0
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
import React, { PropsWithChildren, useEffect, useMemo } from "react";
|
|
2
|
-
import { connectAuthEmulator, getAuth } from "@react-native-firebase/auth";
|
|
3
|
-
import {
|
|
4
|
-
FirebaseAnalyticsTypes,
|
|
5
|
-
setAnalyticsCollectionEnabled,
|
|
6
|
-
setConsent,
|
|
7
|
-
getAnalytics
|
|
8
|
-
} from "@react-native-firebase/analytics";
|
|
9
|
-
import { FirebaseRemoteConfigTypes, getRemoteConfig } from "@react-native-firebase/remote-config";
|
|
10
|
-
import { connectFirestoreEmulator, getFirestore } from "@react-native-firebase/firestore";
|
|
11
|
-
import { ReactNativeFirebase, getApp } from "@react-native-firebase/app";
|
|
12
|
-
import { FirebaseContext, FirebaseContextValue } from "./FirebaseContext";
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @inline
|
|
16
|
-
* @see https://firebase.google.com/docs/reference/js/firestore_.firestoresettings
|
|
17
|
-
*/
|
|
18
|
-
export type FirestoreSettings = {
|
|
19
|
-
cacheSizeBytes?: number;
|
|
20
|
-
experimentalAutoDetectLongPolling?: boolean;
|
|
21
|
-
experimentalForceLongPolling?: boolean;
|
|
22
|
-
experimentalLongPollingOptions?: {
|
|
23
|
-
timeoutSeconds: number;
|
|
24
|
-
};
|
|
25
|
-
host?: string;
|
|
26
|
-
ignoreUndefinedProperties?: boolean;
|
|
27
|
-
localCache?: {
|
|
28
|
-
kind: "memory" | "persistent";
|
|
29
|
-
};
|
|
30
|
-
ssl?: boolean;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @inline
|
|
35
|
-
*/
|
|
36
|
-
export type FirebaseContextProviderFirestoreEmulatorConfig = {
|
|
37
|
-
/**
|
|
38
|
-
* Host to connect to Firebase Firestore Emulator
|
|
39
|
-
*/
|
|
40
|
-
host: string;
|
|
41
|
-
/**
|
|
42
|
-
* Port to connect to Firebase Firestore Emulator
|
|
43
|
-
*/
|
|
44
|
-
port: number;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* @inline
|
|
49
|
-
*/
|
|
50
|
-
export type FirebaseContextProviderAuthEmulatorConfig = {
|
|
51
|
-
/**
|
|
52
|
-
* Host to connect to Firebase Auth Emulator
|
|
53
|
-
*/
|
|
54
|
-
host: string;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* @inline
|
|
59
|
-
*/
|
|
60
|
-
export type FirebaseContextProviderEmulators = {
|
|
61
|
-
/**
|
|
62
|
-
* Defines configuration for Firebase Firestore emulator. Optional.
|
|
63
|
-
*/
|
|
64
|
-
firestore?: FirebaseContextProviderFirestoreEmulatorConfig;
|
|
65
|
-
/**
|
|
66
|
-
* Defines configuration for Firebase Auth emulator. Optional
|
|
67
|
-
*/
|
|
68
|
-
auth?: FirebaseContextProviderAuthEmulatorConfig;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* @inline
|
|
73
|
-
*/
|
|
74
|
-
export type FirebaseContextProviderProps = PropsWithChildren & {
|
|
75
|
-
/**
|
|
76
|
-
* Defines configuration for firebase emulators
|
|
77
|
-
*/
|
|
78
|
-
emulators?: FirebaseContextProviderEmulators;
|
|
79
|
-
/**
|
|
80
|
-
* Configuration options for Firebase initialization. {@link https://firebase.google.com/docs/web/setup#config-object | Learn about the Firebase config object}
|
|
81
|
-
*/
|
|
82
|
-
options?: ReactNativeFirebase.FirebaseAppOptions;
|
|
83
|
-
/**
|
|
84
|
-
* Flag indicating whether Firebase Auth should be enabled.
|
|
85
|
-
*/
|
|
86
|
-
authEnabled?: boolean;
|
|
87
|
-
/**
|
|
88
|
-
* Flag indicating whether Firebase Analytics should be enabled.
|
|
89
|
-
* @defaultValue `true`
|
|
90
|
-
*/
|
|
91
|
-
analyticsEnabled?: boolean;
|
|
92
|
-
/**
|
|
93
|
-
* Default user consent settings. Make sure to either use a consent platform or install custom consent form for a certain regions.
|
|
94
|
-
* @defaultValue {
|
|
95
|
-
* ad_personalization: "denied",
|
|
96
|
-
* ad_storage: "denied",
|
|
97
|
-
* ad_user_data: "denied",
|
|
98
|
-
* analytics_storage: "denied",
|
|
99
|
-
* functionality_storage: "denied",
|
|
100
|
-
* personalization_storage: "denied",
|
|
101
|
-
* security_storage: "denied"
|
|
102
|
-
* }
|
|
103
|
-
*/
|
|
104
|
-
consentSettings?: FirebaseAnalyticsTypes.ConsentSettings;
|
|
105
|
-
/**
|
|
106
|
-
* Specifies custom configurations for your Cloud Firestore instance.
|
|
107
|
-
* You must set these before invoking any other methods.
|
|
108
|
-
* {@link https://firebase.google.com/docs/reference/js/firestore_.firestoresettings}
|
|
109
|
-
* @defaultValue {}
|
|
110
|
-
*/
|
|
111
|
-
firestoreSettings?: FirestoreSettings;
|
|
112
|
-
/**
|
|
113
|
-
* Flag indicating whether Firebase Firestore should be enabled.
|
|
114
|
-
* @defaultValue `true`
|
|
115
|
-
*/
|
|
116
|
-
firestoreEnabled?: boolean;
|
|
117
|
-
/**
|
|
118
|
-
* Configuration options for Firebase Remote Config Settings. {@link https://firebase.google.com/docs/reference/js/remote-config.remoteconfigsettings | Learn about the Firebase Remote COnfig Settings object}
|
|
119
|
-
* @defaultValue `true`
|
|
120
|
-
*/
|
|
121
|
-
remoteConfigSettings?: FirebaseRemoteConfigTypes.ConfigSettings;
|
|
122
|
-
/**
|
|
123
|
-
* Configuration options for Firebase Remote Config Defaults.
|
|
124
|
-
*/
|
|
125
|
-
remoteConfigDefaults?: { [key: string]: string | number | boolean };
|
|
126
|
-
/**
|
|
127
|
-
* Flag indicating whether Firebase Remote Config should be enabled.
|
|
128
|
-
* @defaultValue `true`
|
|
129
|
-
*/
|
|
130
|
-
remoteConfigEnabled?: boolean;
|
|
131
|
-
/**
|
|
132
|
-
* Firebase persistence type
|
|
133
|
-
* Applicable only for web version. Unsupported in native.
|
|
134
|
-
* @defaultValue 'LOCAL'
|
|
135
|
-
*/
|
|
136
|
-
authPersistenceType?: "SESSION" | "LOCAL" | "NONE" | "COOKIE";
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* FirebaseContextProvider component configures and provides Firebase services to its children.
|
|
141
|
-
* Initializes Firebase app and enables optional Firebase services such as Firestore, Auth, Analytics,
|
|
142
|
-
* and Remote Config based on the provided configuration and parameters.
|
|
143
|
-
*
|
|
144
|
-
* @group Component
|
|
145
|
-
*
|
|
146
|
-
* @param {FirebaseContextProviderProps} props
|
|
147
|
-
*
|
|
148
|
-
* @returns {FirebaseContextProvider<FirebaseContextProviderProps>}
|
|
149
|
-
*
|
|
150
|
-
* @example
|
|
151
|
-
* ```jsx
|
|
152
|
-
* const firebaseConfig = {};
|
|
153
|
-
* export const App = () => {
|
|
154
|
-
* return (
|
|
155
|
-
* <FirebaseContextProvider options={firebaseConfig}>
|
|
156
|
-
* <ChildComponent />
|
|
157
|
-
* </FirebaseContextProvider>
|
|
158
|
-
* );
|
|
159
|
-
* };
|
|
160
|
-
* ```
|
|
161
|
-
*/
|
|
162
|
-
export const FirebaseContextProvider: React.FC<FirebaseContextProviderProps> = ({
|
|
163
|
-
emulators,
|
|
164
|
-
children,
|
|
165
|
-
authEnabled = true,
|
|
166
|
-
firestoreEnabled = true,
|
|
167
|
-
analyticsEnabled = true,
|
|
168
|
-
consentSettings = {},
|
|
169
|
-
remoteConfigEnabled = true,
|
|
170
|
-
remoteConfigSettings,
|
|
171
|
-
remoteConfigDefaults = {},
|
|
172
|
-
firestoreSettings
|
|
173
|
-
}) => {
|
|
174
|
-
const internalFirebase = useMemo(() => getApp(), []);
|
|
175
|
-
|
|
176
|
-
useEffect(() => {
|
|
177
|
-
setConsent(getAnalytics(internalFirebase), {
|
|
178
|
-
ad_personalization: false,
|
|
179
|
-
ad_storage: false,
|
|
180
|
-
ad_user_data: false,
|
|
181
|
-
analytics_storage: false,
|
|
182
|
-
functionality_storage: false,
|
|
183
|
-
personalization_storage: false,
|
|
184
|
-
security_storage: false,
|
|
185
|
-
...consentSettings
|
|
186
|
-
});
|
|
187
|
-
}, [consentSettings, internalFirebase]);
|
|
188
|
-
|
|
189
|
-
const internalFirestore = useMemo(() => {
|
|
190
|
-
if (firestoreEnabled) {
|
|
191
|
-
if (emulators?.firestore?.host && emulators?.firestore?.port) {
|
|
192
|
-
connectFirestoreEmulator(
|
|
193
|
-
getFirestore(internalFirebase),
|
|
194
|
-
emulators.firestore.host,
|
|
195
|
-
emulators.firestore.port
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
const localFirestore = getFirestore(internalFirebase);
|
|
200
|
-
if (firestoreSettings) {
|
|
201
|
-
localFirestore.settings(firestoreSettings);
|
|
202
|
-
}
|
|
203
|
-
return localFirestore;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
return null;
|
|
207
|
-
}, [emulators, firestoreEnabled, internalFirebase, firestoreSettings]);
|
|
208
|
-
|
|
209
|
-
const internalAuth = useMemo(() => {
|
|
210
|
-
if (authEnabled) {
|
|
211
|
-
const localAuth = getAuth(internalFirebase);
|
|
212
|
-
if (emulators?.auth?.host) {
|
|
213
|
-
connectAuthEmulator(localAuth, emulators?.auth?.host, {
|
|
214
|
-
disableWarnings: true
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
return localAuth;
|
|
218
|
-
}
|
|
219
|
-
return null;
|
|
220
|
-
}, [emulators?.auth, authEnabled, internalFirebase]);
|
|
221
|
-
|
|
222
|
-
const internalAnalytics = useMemo(() => {
|
|
223
|
-
if (analyticsEnabled) {
|
|
224
|
-
return getAnalytics(internalFirebase);
|
|
225
|
-
}
|
|
226
|
-
return null;
|
|
227
|
-
}, [analyticsEnabled, internalFirebase]);
|
|
228
|
-
|
|
229
|
-
const internalRemoteConfig = useMemo(() => {
|
|
230
|
-
if (remoteConfigEnabled) {
|
|
231
|
-
const localRemoteConfig = getRemoteConfig(internalFirebase);
|
|
232
|
-
if (remoteConfigSettings) {
|
|
233
|
-
localRemoteConfig.settings.fetchTimeMillis = remoteConfigSettings.fetchTimeMillis;
|
|
234
|
-
localRemoteConfig.settings.minimumFetchIntervalMillis = remoteConfigSettings.minimumFetchIntervalMillis;
|
|
235
|
-
localRemoteConfig.defaultConfig = remoteConfigDefaults;
|
|
236
|
-
}
|
|
237
|
-
return localRemoteConfig;
|
|
238
|
-
}
|
|
239
|
-
return null;
|
|
240
|
-
}, [remoteConfigEnabled, remoteConfigSettings, remoteConfigDefaults, internalFirebase]);
|
|
241
|
-
|
|
242
|
-
const contextValue = useMemo(
|
|
243
|
-
() => ({
|
|
244
|
-
firebase: internalFirebase,
|
|
245
|
-
auth: internalAuth,
|
|
246
|
-
analytics: internalAnalytics,
|
|
247
|
-
firestore: internalFirestore,
|
|
248
|
-
remoteConfig: internalRemoteConfig
|
|
249
|
-
}),
|
|
250
|
-
[internalFirebase, internalAuth, internalAnalytics, internalFirestore, internalRemoteConfig]
|
|
251
|
-
);
|
|
252
|
-
|
|
253
|
-
useEffect(() => {
|
|
254
|
-
if (contextValue.analytics) {
|
|
255
|
-
setAnalyticsCollectionEnabled(contextValue.analytics, !!consentSettings?.analytics_storage);
|
|
256
|
-
}
|
|
257
|
-
}, [consentSettings, contextValue.analytics]);
|
|
258
|
-
|
|
259
|
-
return (
|
|
260
|
-
<FirebaseContext.Provider value={contextValue as unknown as FirebaseContextValue}>
|
|
261
|
-
{children}
|
|
262
|
-
</FirebaseContext.Provider>
|
|
263
|
-
);
|
|
264
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./FirebaseContextProvider";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./FirebaseContextProvider";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./FirebaseContextProvider";
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export * from "./useFirestore";
|
|
2
|
-
export * from "./useAddDocMutation";
|
|
3
|
-
export * from "./useBatchWrite";
|
|
4
|
-
export * from "./useCollectionReference";
|
|
5
|
-
export * from "./useCompositeFilter";
|
|
6
|
-
export * from "./useCountQuery";
|
|
7
|
-
export * from "./useDeleteDocMutation";
|
|
8
|
-
export * from "./useDocReference";
|
|
9
|
-
export * from "./useDocReferences";
|
|
10
|
-
export * from "./useGetDocData";
|
|
11
|
-
export * from "./useInfiniteQuery";
|
|
12
|
-
export * from "./useQuery";
|
|
13
|
-
export * from "./useRunTransaction";
|
|
14
|
-
export * from "./useSetDocMutation";
|
|
15
|
-
export * from "./useUpdateDocMutation";
|
|
16
|
-
export * from "./useGetRealtimeDocData";
|
|
17
|
-
export * from "./useQueryConstraints";
|
|
18
|
-
export * from "./utils/getDocData";
|
|
19
|
-
export * from "./utils/getDocSnap";
|
|
20
|
-
export * from "./utils/getDocRef";
|
|
21
|
-
export * from "./utils/buildQueryConstraint";
|
|
22
|
-
export * from "./utils/buildCompositeFilter";
|
|
23
|
-
export * from "./useEnsureDoc";
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export * from "./useFirestore";
|
|
2
|
-
export * from "./useAddDocMutation";
|
|
3
|
-
export * from "./useBatchWrite";
|
|
4
|
-
export * from "./useCollectionReference";
|
|
5
|
-
export * from "./useCompositeFilter";
|
|
6
|
-
export * from "./useCountQuery";
|
|
7
|
-
export * from "./useDeleteDocMutation";
|
|
8
|
-
export * from "./useDocReference";
|
|
9
|
-
export * from "./useDocReferences";
|
|
10
|
-
export * from "./useGetDocData";
|
|
11
|
-
export * from "./useInfiniteQuery";
|
|
12
|
-
export * from "./useQuery";
|
|
13
|
-
export * from "./useRunTransaction";
|
|
14
|
-
export * from "./useSetDocMutation";
|
|
15
|
-
export * from "./useUpdateDocMutation";
|
|
16
|
-
export * from "./useGetRealtimeDocData";
|
|
17
|
-
export * from "./useQueryConstraints";
|
|
18
|
-
export * from "./utils/getDocData";
|
|
19
|
-
export * from "./utils/getDocSnap";
|
|
20
|
-
export * from "./utils/getDocRef";
|
|
21
|
-
export * from "./utils/buildQueryConstraint";
|
|
22
|
-
export * from "./utils/buildCompositeFilter";
|
|
23
|
-
export * from "./useEnsureDoc";
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export * from "./useFirestore";
|
|
2
|
-
export * from "./useAddDocMutation";
|
|
3
|
-
export * from "./useBatchWrite";
|
|
4
|
-
export * from "./useCollectionReference";
|
|
5
|
-
export * from "./useCompositeFilter";
|
|
6
|
-
export * from "./useCountQuery";
|
|
7
|
-
export * from "./useDeleteDocMutation";
|
|
8
|
-
export * from "./useDocReference";
|
|
9
|
-
export * from "./useDocReferences";
|
|
10
|
-
export * from "./useGetDocData";
|
|
11
|
-
export * from "./useInfiniteQuery";
|
|
12
|
-
export * from "./useQuery";
|
|
13
|
-
export * from "./useRunTransaction";
|
|
14
|
-
export * from "./useSetDocMutation";
|
|
15
|
-
export * from "./useUpdateDocMutation";
|
|
16
|
-
export * from "./useGetRealtimeDocData";
|
|
17
|
-
export * from "./useQueryConstraints";
|
|
18
|
-
export * from "./utils/getDocData";
|
|
19
|
-
export * from "./utils/getDocSnap";
|
|
20
|
-
export * from "./utils/getDocRef";
|
|
21
|
-
export * from "./utils/buildQueryConstraint";
|
|
22
|
-
export * from "./utils/buildCompositeFilter";
|
|
23
|
-
export * from "./useEnsureDoc";
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
-
import { FirebaseFirestoreTypes, addDoc, WithFieldValue, getDoc } from "@react-native-firebase/firestore";
|
|
3
|
-
|
|
4
|
-
import { ReactNativeFirebase } from "@react-native-firebase/app";
|
|
5
|
-
import { useMemo } from "react";
|
|
6
|
-
import { AppModel } from "../../types";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @inline
|
|
10
|
-
*/
|
|
11
|
-
export type UseAddDocMutationValues<AppModelType> = {
|
|
12
|
-
/**
|
|
13
|
-
* Data to write
|
|
14
|
-
*/
|
|
15
|
-
data: WithFieldValue<AppModelType>;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @inline
|
|
20
|
-
*/
|
|
21
|
-
export type UseAddDocMutationOptions<AppModelType extends AppModel = AppModel, TContext = unknown> = {
|
|
22
|
-
/**
|
|
23
|
-
* Reference to a collection where document must be added
|
|
24
|
-
*/
|
|
25
|
-
collectionReference: FirebaseFirestoreTypes.CollectionReference<AppModelType>;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Options for useMutation hook excluding mutationFn. MutationKey will be equal to reference.path by default.
|
|
29
|
-
*/
|
|
30
|
-
options?: Omit<
|
|
31
|
-
UseMutationOptions<
|
|
32
|
-
AppModelType,
|
|
33
|
-
ReactNativeFirebase.NativeFirebaseError,
|
|
34
|
-
UseAddDocMutationValues<AppModelType>,
|
|
35
|
-
TContext
|
|
36
|
-
>,
|
|
37
|
-
"mutationFn"
|
|
38
|
-
>;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Executes a mutation and returns added document
|
|
43
|
-
*
|
|
44
|
-
* @group Hook
|
|
45
|
-
*
|
|
46
|
-
* @param {UseAddDocMutationOptions<AppModelType>} options - Configuration options for the mutation.
|
|
47
|
-
*
|
|
48
|
-
* @returns {UseMutationResult<AppModelType, Error, UseAddDocMutationValues<AppModelType>, TContext>} A mutation result
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* ```jsx
|
|
52
|
-
* export const MyComponent = () => {
|
|
53
|
-
* const {mutate} = useAddDocMutation({
|
|
54
|
-
* options: {
|
|
55
|
-
* },
|
|
56
|
-
* reference: collection(),
|
|
57
|
-
* });
|
|
58
|
-
*
|
|
59
|
-
* // ....
|
|
60
|
-
* mutate({data: {test: 'value'}});
|
|
61
|
-
* // ....
|
|
62
|
-
* };
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
export const useAddDocMutation = <AppModelType extends AppModel = AppModel, TContext = unknown>({
|
|
66
|
-
collectionReference,
|
|
67
|
-
options = {}
|
|
68
|
-
}: UseAddDocMutationOptions<AppModelType, TContext>) => {
|
|
69
|
-
const mutationKey = useMemo(() => [collectionReference.path], [collectionReference.path]);
|
|
70
|
-
|
|
71
|
-
return useMutation({
|
|
72
|
-
mutationKey,
|
|
73
|
-
...options,
|
|
74
|
-
mutationFn: async ({ data }) => {
|
|
75
|
-
const docRef = await addDoc<AppModelType, AppModelType>(collectionReference, data);
|
|
76
|
-
const docSnap = await getDoc(docRef);
|
|
77
|
-
return { ...(docSnap.data() as AppModelType), uid: docRef.id } as AppModelType;
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
-
import { writeBatch, FirebaseFirestoreTypes } from "@react-native-firebase/firestore";
|
|
3
|
-
|
|
4
|
-
import { ReactNativeFirebase } from "@react-native-firebase/app";
|
|
5
|
-
import { useFirestore } from "./useFirestore";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @inline
|
|
9
|
-
*/
|
|
10
|
-
export type UseBatchWriteVariables = (batch: FirebaseFirestoreTypes.WriteBatch) => Promise<void> | void;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @inline
|
|
14
|
-
*/
|
|
15
|
-
export type UseBatchWriteOptions = {
|
|
16
|
-
options?: Omit<
|
|
17
|
-
UseMutationOptions<void, ReactNativeFirebase.NativeFirebaseError, UseBatchWriteVariables>,
|
|
18
|
-
"mutationFn"
|
|
19
|
-
>;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Custom hook to perform batch write operations using Firestore.
|
|
24
|
-
*
|
|
25
|
-
* @group Hook
|
|
26
|
-
*
|
|
27
|
-
* @param {UseBatchWriteOptions} options - Configuration options for the query.
|
|
28
|
-
*
|
|
29
|
-
* @returns {UseMutationResult<void, Error, UseAddDocMutationValues<AppModelType>>} A mutation result
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```jsx
|
|
33
|
-
* export const MyComponent = () => {
|
|
34
|
-
* const {mutate} = useBatchWrite({
|
|
35
|
-
* options: {
|
|
36
|
-
* },
|
|
37
|
-
* });
|
|
38
|
-
*
|
|
39
|
-
* // ....
|
|
40
|
-
* mutate(() => {
|
|
41
|
-
* ref.update({...})
|
|
42
|
-
* });
|
|
43
|
-
* // ....
|
|
44
|
-
* };
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
export const useBatchWrite = ({ options = {} }: UseBatchWriteOptions = {}) => {
|
|
48
|
-
const db = useFirestore();
|
|
49
|
-
|
|
50
|
-
return useMutation({
|
|
51
|
-
...options,
|
|
52
|
-
mutationFn: async (batchWriteFn) => {
|
|
53
|
-
const batch = writeBatch(db);
|
|
54
|
-
await batchWriteFn(batch);
|
|
55
|
-
return batch.commit();
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { collection, FirebaseFirestoreTypes } from "@react-native-firebase/firestore";
|
|
2
|
-
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
import { AppModel } from "../../types";
|
|
5
|
-
import { useFirestore } from "./useFirestore";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @inline
|
|
9
|
-
*/
|
|
10
|
-
export type UseCollectionReferenceOptions<AppModelType extends AppModel = AppModel> = {
|
|
11
|
-
/**
|
|
12
|
-
* CollectionReference or DocumentReference that is used as a root to lookup a sub-collection
|
|
13
|
-
*/
|
|
14
|
-
reference?:
|
|
15
|
-
| FirebaseFirestoreTypes.CollectionReference<AppModelType>
|
|
16
|
-
| FirebaseFirestoreTypes.DocumentReference<AppModelType>;
|
|
17
|
-
/**
|
|
18
|
-
* A slash-separated path to a collection.
|
|
19
|
-
*/
|
|
20
|
-
path: string;
|
|
21
|
-
/**
|
|
22
|
-
* Additional path segments that will be applied relative
|
|
23
|
-
*/
|
|
24
|
-
pathSegments?: string[];
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Gets a `CollectionReference` instance that refers to a subcollection of
|
|
29
|
-
* `reference` at the specified relative path.
|
|
30
|
-
*
|
|
31
|
-
* @group Hook
|
|
32
|
-
*
|
|
33
|
-
* @param {UseCollectionReferenceOptions<AppModelType>} options - Options
|
|
34
|
-
*
|
|
35
|
-
* @returns {FirebaseFirestoreTypes.CollectionReference<AppModelType, AppModelType>} A reference to a Firestore collection
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```jsx
|
|
39
|
-
* export const MyComponent = () => {
|
|
40
|
-
* const ref = useCollectionReference({
|
|
41
|
-
* path: 'todos'
|
|
42
|
-
* });
|
|
43
|
-
* };
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
export const useCollectionReference = <AppModelType extends AppModel = AppModel>({
|
|
47
|
-
path,
|
|
48
|
-
reference,
|
|
49
|
-
pathSegments
|
|
50
|
-
}: UseCollectionReferenceOptions<AppModelType>) => {
|
|
51
|
-
const db = useFirestore();
|
|
52
|
-
|
|
53
|
-
return useMemo(() => {
|
|
54
|
-
return !reference
|
|
55
|
-
? collection(db, path || "", ...(pathSegments || []))
|
|
56
|
-
: collection(reference, path, ...(pathSegments || []));
|
|
57
|
-
}, [db, reference, path, pathSegments]) as FirebaseFirestoreTypes.CollectionReference<AppModelType>;
|
|
58
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { and, or } from "@react-native-firebase/firestore";
|
|
2
|
-
import { useMemo } from "react";
|
|
3
|
-
import { AppModel } from "../../types";
|
|
4
|
-
import { buildCompositeFilter, CompositeFilter, QueryFilterConstraint } from "./utils/buildCompositeFilter";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @inline
|
|
8
|
-
*/
|
|
9
|
-
export type UseCompositeFilter<AppModelType extends AppModel = AppModel> = {
|
|
10
|
-
query?: CompositeFilter<AppModelType>;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* A custom hook that constructs a composite or where query filter based on the provided query structure.
|
|
15
|
-
* It recursively builds query constraints using logical "or" or "and" operators.
|
|
16
|
-
*
|
|
17
|
-
* @group Hook
|
|
18
|
-
*
|
|
19
|
-
* @param {QueryElement<AppModelType>} query
|
|
20
|
-
*
|
|
21
|
-
* @returns {QueryFilterConstraint | null}
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```jsx
|
|
25
|
-
* export const MyComponent = () => {
|
|
26
|
-
* const filter = useCompositeFilter({
|
|
27
|
-
* operator: "AND",
|
|
28
|
-
* children: [
|
|
29
|
-
* {
|
|
30
|
-
* field: "field",
|
|
31
|
-
* value: "value",
|
|
32
|
-
* op: "=="
|
|
33
|
-
* },
|
|
34
|
-
* ...(query ? [query] : [])
|
|
35
|
-
* ]
|
|
36
|
-
* });
|
|
37
|
-
* console.log(filter);
|
|
38
|
-
* };
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export const useCompositeFilter = <AppModelType extends AppModel = AppModel>({
|
|
42
|
-
query
|
|
43
|
-
}: UseCompositeFilter<AppModelType>): QueryFilterConstraint | undefined => {
|
|
44
|
-
return useMemo(() => {
|
|
45
|
-
const queryConstraints =
|
|
46
|
-
query?.children
|
|
47
|
-
?.map?.((subQuery) => buildCompositeFilter(subQuery))
|
|
48
|
-
?.filter?.((constraint) => !!constraint) ?? [];
|
|
49
|
-
|
|
50
|
-
if (queryConstraints.length <= 0) {
|
|
51
|
-
return undefined;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (queryConstraints.length <= 1) {
|
|
55
|
-
return queryConstraints[0];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return query?.operator === "OR" ? or(...queryConstraints) : and(...queryConstraints);
|
|
59
|
-
}, [query]);
|
|
60
|
-
};
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FirebaseFirestoreTypes,
|
|
3
|
-
getCountFromServer,
|
|
4
|
-
query,
|
|
5
|
-
QueryConstraint,
|
|
6
|
-
QueryNonFilterConstraint
|
|
7
|
-
} from "@react-native-firebase/firestore";
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
UseQueryResult,
|
|
11
|
-
useQuery as useReactQuery,
|
|
12
|
-
UseQueryOptions as UseReactQueryOptions
|
|
13
|
-
} from "@tanstack/react-query";
|
|
14
|
-
import { AppModel } from "../../types";
|
|
15
|
-
import { QueryFilterConstraint } from "./utils/buildCompositeFilter";
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @inline
|
|
19
|
-
*/
|
|
20
|
-
type UseCountQueryOptions<AppModelType extends AppModel = AppModel> = {
|
|
21
|
-
/**
|
|
22
|
-
* Reqct-query options that must include queryKey and shall not define queryFn
|
|
23
|
-
*/
|
|
24
|
-
options: Omit<UseReactQueryOptions<number, Error, number>, "queryFn"> &
|
|
25
|
-
Required<Pick<UseReactQueryOptions<number, Error, number>, "queryKey">>;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Reference to a Firestore collection
|
|
29
|
-
*/
|
|
30
|
-
collectionReference: FirebaseFirestoreTypes.CollectionReference<AppModelType>;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Non composite filter constraints such as limit, order, where
|
|
34
|
-
*/
|
|
35
|
-
queryConstraints?: QueryConstraint[] | QueryNonFilterConstraint[];
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Composite filter
|
|
39
|
-
*/
|
|
40
|
-
compositeFilter?: QueryFilterConstraint;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Executes a query with specified constraints and returns the count of matched documents.
|
|
45
|
-
*
|
|
46
|
-
* @group Hook
|
|
47
|
-
*
|
|
48
|
-
* @param {UseCountQueryOptions<AppModelType>} options - Configuration options for the query.
|
|
49
|
-
*
|
|
50
|
-
* @returns {UseQueryResult<number>} An object containing the number of documents that match the query.
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```jsx
|
|
54
|
-
* export const MyComponent = () => {
|
|
55
|
-
* const count = useCountQuery({
|
|
56
|
-
* options: {
|
|
57
|
-
* queryKey: ['key']
|
|
58
|
-
* },
|
|
59
|
-
* collectionReference: collection(),
|
|
60
|
-
* });
|
|
61
|
-
* console.log(count);
|
|
62
|
-
* };
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
export const useCountQuery = <AppModelType extends AppModel = AppModel>({
|
|
66
|
-
options,
|
|
67
|
-
collectionReference,
|
|
68
|
-
queryConstraints = [],
|
|
69
|
-
compositeFilter
|
|
70
|
-
}: UseCountQueryOptions<AppModelType>): UseQueryResult<number> => {
|
|
71
|
-
return useReactQuery({
|
|
72
|
-
...options,
|
|
73
|
-
queryFn: async () => {
|
|
74
|
-
const queryToExecute = compositeFilter
|
|
75
|
-
? query(collectionReference, compositeFilter, ...(queryConstraints as QueryNonFilterConstraint[]))
|
|
76
|
-
: query(collectionReference, ...(queryConstraints as QueryConstraint[]));
|
|
77
|
-
|
|
78
|
-
const querySnapshot = await getCountFromServer(queryToExecute);
|
|
79
|
-
if (querySnapshot) {
|
|
80
|
-
return querySnapshot.data().count;
|
|
81
|
-
}
|
|
82
|
-
return 0;
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
};
|