react-query-firebase 2.13.2 → 2.13.4
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 +3 -3
- 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 +2 -2
- 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 +3 -4
- package/{react-native → dist/react-native}/firestore/useDocReference.js +6 -8
- 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 +1 -0
- package/dist/react-native/index.js +1 -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 +4 -8
- 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 +3 -3
- 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 +2 -2
- 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 +3 -4
- package/{web → dist/web}/firestore/useDocReference.js +6 -8
- 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 +1 -0
- package/dist/web/index.js +1 -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 +45 -16
- 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 -50
- 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 -35
- 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 -50
- 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,55 +0,0 @@
|
|
|
1
|
-
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
-
import { runTransaction, FirebaseFirestoreTypes } from "@react-native-firebase/firestore";
|
|
3
|
-
|
|
4
|
-
import { useFirestore } from "./useFirestore";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @inline
|
|
8
|
-
*/
|
|
9
|
-
export type UseRunTransactionValues = <T = unknown>(transaction: FirebaseFirestoreTypes.Transaction) => T;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @inline
|
|
13
|
-
*/
|
|
14
|
-
export type UseRunTransactionOptions<T = unknown, TContext = unknown> = {
|
|
15
|
-
/**
|
|
16
|
-
* Reqct-mutation options that shall omit mutationFn
|
|
17
|
-
*/
|
|
18
|
-
options?: Omit<UseMutationOptions<T, Error, UseRunTransactionValues, TContext>, "mutationFn">;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Executes a Firestore transaction
|
|
23
|
-
*
|
|
24
|
-
* @group Hook
|
|
25
|
-
*
|
|
26
|
-
* @param {UseRunTransactionOptions<T>} options - Configuration options for the mutation.
|
|
27
|
-
*
|
|
28
|
-
* @returns {UseMutationResult<T, Error>} An object representing mutation
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```jsx
|
|
32
|
-
* export const MyComponent = () => {
|
|
33
|
-
* const doc = useGetDocData({
|
|
34
|
-
* options: {
|
|
35
|
-
* queryKey: ['key']
|
|
36
|
-
* },
|
|
37
|
-
* reference: collection(),
|
|
38
|
-
* path: 'id'
|
|
39
|
-
* });
|
|
40
|
-
* console.log(doc);
|
|
41
|
-
* };
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
export const useRunTransaction = <T = unknown, TContext = unknown>({
|
|
45
|
-
options = {}
|
|
46
|
-
}: UseRunTransactionOptions<T, TContext>) => {
|
|
47
|
-
const db = useFirestore();
|
|
48
|
-
|
|
49
|
-
return useMutation({
|
|
50
|
-
...options,
|
|
51
|
-
mutationFn: async (transactionFn) => {
|
|
52
|
-
return runTransaction<T>(db, transactionFn);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
-
import { FirebaseFirestoreTypes, getDoc, setDoc, WithFieldValue } from "@react-native-firebase/firestore";
|
|
3
|
-
|
|
4
|
-
import { useMemo } from "react";
|
|
5
|
-
import { AppModel } from "../../types";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @inline
|
|
9
|
-
*/
|
|
10
|
-
export type UseSetDocMutationValues<AppModelType extends AppModel = AppModel> = {
|
|
11
|
-
/**
|
|
12
|
-
* Data to write
|
|
13
|
-
*/
|
|
14
|
-
data: WithFieldValue<AppModelType>;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @inline
|
|
19
|
-
*/
|
|
20
|
-
export type UseSetDocMutationOptions<AppModelType extends AppModel = AppModel, TContext = unknown> = {
|
|
21
|
-
/**
|
|
22
|
-
* Reference to a document that must be written
|
|
23
|
-
*/
|
|
24
|
-
reference: FirebaseFirestoreTypes.DocumentReference<AppModelType> | null;
|
|
25
|
-
/**
|
|
26
|
-
* Options for useMutation hook excluding mutationFn.
|
|
27
|
-
*/
|
|
28
|
-
options?: Omit<
|
|
29
|
-
UseMutationOptions<AppModelType, Error, UseSetDocMutationValues<AppModelType>, TContext>,
|
|
30
|
-
"mutationFn"
|
|
31
|
-
>;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Executes a mutation and returns added document
|
|
36
|
-
*
|
|
37
|
-
* @group Hook
|
|
38
|
-
*
|
|
39
|
-
* @param {UseSetDocMutationOptions<AppModelType>} options - Configuration options for mutation.
|
|
40
|
-
*
|
|
41
|
-
* @returns {UseMutationResult<AppModelType, Error, UseAddDocMutationValues<AppModelType>, TContext>} A mutation result
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```jsx
|
|
45
|
-
* export const MyComponent = () => {
|
|
46
|
-
* const {mutate} = useSetDocMutation({
|
|
47
|
-
* options: {
|
|
48
|
-
* },
|
|
49
|
-
* reference: collection().doc(),
|
|
50
|
-
* });
|
|
51
|
-
*
|
|
52
|
-
* // ....
|
|
53
|
-
* mutate({data: {test: 'value'}});
|
|
54
|
-
* // ....
|
|
55
|
-
* };
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
export const useSetDocMutation = <AppModelType extends AppModel = AppModel, TContext = unknown>({
|
|
59
|
-
reference,
|
|
60
|
-
options
|
|
61
|
-
}: UseSetDocMutationOptions<AppModelType, TContext>) => {
|
|
62
|
-
const mutationKey = useMemo(() => [reference?.path], [reference?.path]);
|
|
63
|
-
|
|
64
|
-
return useMutation({
|
|
65
|
-
...options,
|
|
66
|
-
mutationKey,
|
|
67
|
-
mutationFn: async ({ data }) => {
|
|
68
|
-
if (!reference) {
|
|
69
|
-
throw new Error("Reference is undefined");
|
|
70
|
-
}
|
|
71
|
-
await setDoc<AppModelType>(reference, data);
|
|
72
|
-
const docSnap = await getDoc(reference);
|
|
73
|
-
return { ...(docSnap.data() as AppModelType), uid: docSnap.id };
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
-
import { FirebaseFirestoreTypes, updateDoc, getDoc, UpdateData } from "@react-native-firebase/firestore";
|
|
3
|
-
|
|
4
|
-
import { useMemo } from "react";
|
|
5
|
-
import { AppModel } from "../../types";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @inline
|
|
9
|
-
*/
|
|
10
|
-
export type UseUpdateDocMutationValues<AppModelType extends AppModel = AppModel> = {
|
|
11
|
-
/**
|
|
12
|
-
* Data to write
|
|
13
|
-
*/
|
|
14
|
-
data: UpdateData<AppModelType>;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @inline
|
|
19
|
-
*/
|
|
20
|
-
export type UseUpdateDocMutationOptions<AppModelType extends AppModel = AppModel, TContext = unknown> = {
|
|
21
|
-
/**
|
|
22
|
-
* Reference to a document that must be updated
|
|
23
|
-
*/
|
|
24
|
-
reference: FirebaseFirestoreTypes.DocumentReference<AppModelType> | null;
|
|
25
|
-
/**
|
|
26
|
-
* Options for useMutation hook excluding mutationFn.
|
|
27
|
-
*/
|
|
28
|
-
options?: Omit<
|
|
29
|
-
UseMutationOptions<AppModelType, Error, UseUpdateDocMutationValues<AppModelType>, TContext>,
|
|
30
|
-
"mutationFn"
|
|
31
|
-
>;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Executes a mutation and returns updated document
|
|
36
|
-
*
|
|
37
|
-
* @group Hook
|
|
38
|
-
*
|
|
39
|
-
* @param {UseUpdateDocMutationOptions<AppModelType>} options - Configuration options for mutation.
|
|
40
|
-
*
|
|
41
|
-
* @returns {UseMutationResult<AppModelType, Error, UseAddDocMutationValues<AppModelType>, TContext>} A mutation result
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```jsx
|
|
45
|
-
* export const MyComponent = () => {
|
|
46
|
-
* const {mutate} = useUpdateDocMutation({
|
|
47
|
-
* options: {
|
|
48
|
-
* },
|
|
49
|
-
* reference: collection().doc(),
|
|
50
|
-
* });
|
|
51
|
-
*
|
|
52
|
-
* // ....
|
|
53
|
-
* mutate({data: {test: 'value'}});
|
|
54
|
-
* // ....
|
|
55
|
-
* };
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
export const useUpdateDocMutation = <AppModelType extends AppModel = AppModel, TContext = unknown>({
|
|
59
|
-
reference,
|
|
60
|
-
options = {}
|
|
61
|
-
}: UseUpdateDocMutationOptions<AppModelType, TContext>) => {
|
|
62
|
-
const mutationKey = useMemo(() => [reference?.path], [reference?.path]);
|
|
63
|
-
|
|
64
|
-
return useMutation({
|
|
65
|
-
...options,
|
|
66
|
-
mutationFn: async ({ data }) => {
|
|
67
|
-
if (!reference) {
|
|
68
|
-
throw new Error("Reference is undefined");
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
await updateDoc<AppModelType>(reference, data);
|
|
72
|
-
const docSnap = await getDoc(reference);
|
|
73
|
-
return { ...(docSnap.data() as AppModelType), uid: docSnap.id };
|
|
74
|
-
},
|
|
75
|
-
mutationKey
|
|
76
|
-
});
|
|
77
|
-
};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { FirebaseFirestoreTypes, and, or, where, FieldPath } from "@react-native-firebase/firestore";
|
|
2
|
-
import { AppModel } from "../../../types";
|
|
3
|
-
|
|
4
|
-
export type QueryFilterConstraint =
|
|
5
|
-
| FirebaseFirestoreTypes.QueryCompositeFilterConstraint
|
|
6
|
-
| FirebaseFirestoreTypes.QueryFilterConstraint;
|
|
7
|
-
|
|
8
|
-
export type QueryElement<AppModelType extends AppModel = AppModel> = {
|
|
9
|
-
operator?: "OR" | "AND";
|
|
10
|
-
children?: QueryElement[];
|
|
11
|
-
field?: keyof (AppModelType & { documentId?: string[] });
|
|
12
|
-
value?: AppModelType[keyof AppModelType];
|
|
13
|
-
op?: FirebaseFirestoreTypes.WhereFilterOp;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export type CompositeFilter<AppModelType extends AppModel = AppModel> = {
|
|
17
|
-
operator: "OR" | "AND";
|
|
18
|
-
children: QueryElement<AppModelType & { documentId?: string[] }>[];
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Constructs a composite or where query filter based on the provided query structure.
|
|
23
|
-
* It recursively builds query constraints using logical "or" or "and" operators.
|
|
24
|
-
*
|
|
25
|
-
* @group Utility
|
|
26
|
-
*
|
|
27
|
-
* @param {QueryElement<AppModelType>} query
|
|
28
|
-
*
|
|
29
|
-
* @returns {QueryFilterConstraint | null}
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```jsx
|
|
33
|
-
* export const MyComponent = () => {
|
|
34
|
-
* const filter = buildCompositeFilter({
|
|
35
|
-
* operator: "AND",
|
|
36
|
-
* children: [
|
|
37
|
-
* {
|
|
38
|
-
* field: "field",
|
|
39
|
-
* value: "value",
|
|
40
|
-
* op: "=="
|
|
41
|
-
* },
|
|
42
|
-
* ...(query ? [query] : [])
|
|
43
|
-
* ]
|
|
44
|
-
* });
|
|
45
|
-
* console.log(filter);
|
|
46
|
-
* };
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
export const buildCompositeFilter = <AppModelType extends AppModel = AppModel>(
|
|
50
|
-
query: QueryElement<AppModelType>
|
|
51
|
-
): QueryFilterConstraint | null => {
|
|
52
|
-
if (query.children) {
|
|
53
|
-
const queryConstraints = query.children.map(buildCompositeFilter).filter((constraint) => !!constraint);
|
|
54
|
-
|
|
55
|
-
if (queryConstraints.length <= 0) {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (queryConstraints.length <= 1) {
|
|
60
|
-
return queryConstraints[0];
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return (query as CompositeFilter).operator === "OR" ? or(...queryConstraints) : and(...queryConstraints);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (query.field && query.op) {
|
|
67
|
-
return where(
|
|
68
|
-
query.field === "documentId" ? new FieldPath("__name__") : (query.field as string),
|
|
69
|
-
query.op,
|
|
70
|
-
query.value
|
|
71
|
-
) as unknown as FirebaseFirestoreTypes.QueryFilterConstraint;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return null;
|
|
75
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type QueryNonFilterConstraint,
|
|
3
|
-
orderBy,
|
|
4
|
-
startAt,
|
|
5
|
-
startAfter,
|
|
6
|
-
endAt,
|
|
7
|
-
endBefore,
|
|
8
|
-
limit,
|
|
9
|
-
limitToLast
|
|
10
|
-
} from "@react-native-firebase/firestore";
|
|
11
|
-
import { AppModel, type NonFilterQueryConstraint } from "../../../types";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* A generic mothod to build query constraints for firebase
|
|
15
|
-
*
|
|
16
|
-
* @group Utility
|
|
17
|
-
*
|
|
18
|
-
* @param {NonFilterQueryConstraint<AppModelType>} constraint
|
|
19
|
-
*
|
|
20
|
-
* @returns {FirebaseFirestoreTypes.QueryNonFilterConstraint}
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```jsx
|
|
24
|
-
* const firebaseConfig = {};
|
|
25
|
-
* export const constraint = useMemo(() => {
|
|
26
|
-
* return buildQueryConstraint({
|
|
27
|
-
* type: 'limit',
|
|
28
|
-
* limit: 1
|
|
29
|
-
* });
|
|
30
|
-
* };
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export const buildQueryConstraint = <AppModelType extends AppModel = AppModel>(
|
|
34
|
-
constraint: NonFilterQueryConstraint<AppModelType>
|
|
35
|
-
): QueryNonFilterConstraint => {
|
|
36
|
-
switch (constraint.type) {
|
|
37
|
-
case "orderBy":
|
|
38
|
-
return orderBy(constraint.fieldPath as string, constraint.directionStr);
|
|
39
|
-
case "startAt":
|
|
40
|
-
return startAt(...constraint.arguments);
|
|
41
|
-
case "startAfter":
|
|
42
|
-
return startAfter(...constraint.arguments);
|
|
43
|
-
case "endAt":
|
|
44
|
-
return endAt(...constraint.arguments);
|
|
45
|
-
case "endBefore":
|
|
46
|
-
return endBefore(...constraint.arguments);
|
|
47
|
-
case "limit":
|
|
48
|
-
return limit(constraint.limit);
|
|
49
|
-
case "limitToLast":
|
|
50
|
-
return limitToLast(constraint.limit);
|
|
51
|
-
default:
|
|
52
|
-
throw new Error(`Unsupported constaint ${JSON.stringify(constraint)}`);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { getDocSnap, GetDocSnapOptions } from "./getDocSnap";
|
|
2
|
-
import { AppModel } from "../../../types";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @inline
|
|
6
|
-
*/
|
|
7
|
-
export type GetDocDataOptions<AppModelType extends AppModel = AppModel> = GetDocSnapOptions<AppModelType>;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Asynchronously retrieves document data from a specified database reference.
|
|
11
|
-
* Utilizes the helper function `getDocSnap` to fetch the document snapshot and
|
|
12
|
-
* checks if the document exists before returning its data.
|
|
13
|
-
*
|
|
14
|
-
* @group Utility
|
|
15
|
-
*
|
|
16
|
-
* @param {GetDocDataOptions<AppModelType>} options - The options for fetching document data.
|
|
17
|
-
*
|
|
18
|
-
* @returns {Promise<AppModelType | null>} Returns a promise that resolves to the document data if it exists, or null if the document does not exist.
|
|
19
|
-
*/
|
|
20
|
-
export const getDocData = async <AppModelType extends AppModel = AppModel>({
|
|
21
|
-
db,
|
|
22
|
-
reference,
|
|
23
|
-
path,
|
|
24
|
-
pathSegments
|
|
25
|
-
}: GetDocDataOptions<AppModelType>) => {
|
|
26
|
-
const docSnap = await getDocSnap<AppModelType>({ db, reference, path, pathSegments });
|
|
27
|
-
|
|
28
|
-
if (docSnap && docSnap?.exists()) {
|
|
29
|
-
return { ...docSnap.data(), uid: docSnap.id } as AppModelType;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return null;
|
|
33
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { doc, FirebaseFirestoreTypes } from "@react-native-firebase/firestore";
|
|
2
|
-
import { AppModel } from "../../../types";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @inline
|
|
6
|
-
*/
|
|
7
|
-
export type GetDocRefOptions<AppModelType extends AppModel = AppModel> = {
|
|
8
|
-
db: FirebaseFirestoreTypes.Module;
|
|
9
|
-
reference?:
|
|
10
|
-
| FirebaseFirestoreTypes.CollectionReference<AppModelType>
|
|
11
|
-
| FirebaseFirestoreTypes.DocumentReference<AppModelType>;
|
|
12
|
-
path?: string;
|
|
13
|
-
pathSegments?: string[];
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Retrieves a document reference based on provided database options.
|
|
18
|
-
* Either `reference` or `path`.
|
|
19
|
-
*
|
|
20
|
-
* @group Utility
|
|
21
|
-
*
|
|
22
|
-
* @param {GetDocRefOptions<AppModelType>} options - The options for building doc reference.
|
|
23
|
-
*
|
|
24
|
-
* @returns {DocumentReference<AppModelType, AppModelType>} Returns a document reference
|
|
25
|
-
*/
|
|
26
|
-
export const getDocRef = <AppModelType extends AppModel = AppModel>({
|
|
27
|
-
db,
|
|
28
|
-
reference,
|
|
29
|
-
path,
|
|
30
|
-
pathSegments
|
|
31
|
-
}: GetDocRefOptions<AppModelType>) => {
|
|
32
|
-
if ((!reference && !path) || (reference && !path)) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const docRef = !reference
|
|
37
|
-
? doc(db, path as string, ...(pathSegments || []))
|
|
38
|
-
: doc(reference, path, ...(pathSegments || []));
|
|
39
|
-
|
|
40
|
-
return docRef as FirebaseFirestoreTypes.DocumentReference<AppModelType>;
|
|
41
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { getDoc as firestoreGetDoc } from "@react-native-firebase/firestore";
|
|
2
|
-
import { getDocRef, GetDocRefOptions } from "./getDocRef";
|
|
3
|
-
import { AppModel } from "../../../types";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @inline
|
|
7
|
-
*/
|
|
8
|
-
export type GetDocSnapOptions<AppModelType extends AppModel = AppModel> = GetDocRefOptions<AppModelType>;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Asynchronously retrieves a document snapshot from Firestore using a specified document reference
|
|
12
|
-
* or path information. This function handles getting the appropriate document reference based on
|
|
13
|
-
* the parameters provided, and then fetches the document data from Firestore.
|
|
14
|
-
*
|
|
15
|
-
* @group Utility
|
|
16
|
-
*
|
|
17
|
-
* @param {GetDocSnapOptions<AppModelType>} options - The options for retrieving the document snapshot
|
|
18
|
-
*
|
|
19
|
-
* @returns {Promise<DocumentSnapshot<AppModelType, AppModelType> | null>} Returns a document reference
|
|
20
|
-
*/
|
|
21
|
-
export const getDocSnap = async <AppModelType extends AppModel = AppModel>({
|
|
22
|
-
db,
|
|
23
|
-
reference,
|
|
24
|
-
path,
|
|
25
|
-
pathSegments
|
|
26
|
-
}: GetDocSnapOptions<AppModelType>) => {
|
|
27
|
-
const docRef = await getDocRef<AppModelType>({ db, reference, path, pathSegments });
|
|
28
|
-
|
|
29
|
-
if (docRef) {
|
|
30
|
-
return await firestoreGetDoc(docRef);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return null;
|
|
34
|
-
};
|
package/react-native/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./context";
|
package/react-native/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./context";
|
package/react-native/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./context";
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { useRemoteConfig } from "./useRemoteConfig";
|
|
2
|
-
import { ensureInitialized, fetchAndActivate } from "@react-native-firebase/remote-config";
|
|
3
|
-
import { useCallback, useMemo, useState } from "react";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Custom hook to fetch and activate remote configuration settings.
|
|
7
|
-
* Initializes remote configuration, fetches, activates it, and tracks the fetch status.
|
|
8
|
-
* @returns {Object} An object containing:
|
|
9
|
-
* - {Function} fetchAndActivate - Callback function to fetch and activate remote configuration.
|
|
10
|
-
* - {Boolean} isFetched - Boolean representing whether the fetch-and-activate process completed.
|
|
11
|
-
*/
|
|
12
|
-
export const useFetchAndActivate = () => {
|
|
13
|
-
const remoteConfig = useRemoteConfig();
|
|
14
|
-
const [isFetched, setIsFetched] = useState(false);
|
|
15
|
-
|
|
16
|
-
const fetchAndActivateCallback = useCallback(async () => {
|
|
17
|
-
try {
|
|
18
|
-
if (remoteConfig) {
|
|
19
|
-
await ensureInitialized(remoteConfig);
|
|
20
|
-
await fetchAndActivate(remoteConfig);
|
|
21
|
-
setIsFetched(true);
|
|
22
|
-
}
|
|
23
|
-
} catch (e) {
|
|
24
|
-
setIsFetched(true);
|
|
25
|
-
console.log(`Cannot read remote config: ${(e as Error)?.message}`);
|
|
26
|
-
}
|
|
27
|
-
}, [remoteConfig]);
|
|
28
|
-
|
|
29
|
-
return useMemo(
|
|
30
|
-
() => ({
|
|
31
|
-
fetchAndActivate: fetchAndActivateCallback,
|
|
32
|
-
isFetched
|
|
33
|
-
}),
|
|
34
|
-
[isFetched, fetchAndActivateCallback]
|
|
35
|
-
);
|
|
36
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { getValue } from "@react-native-firebase/remote-config";
|
|
2
|
-
import { useRemoteConfig } from "./useRemoteConfig";
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Custom hook to retrieve a value associated with a specified key from remote configuration.
|
|
7
|
-
* Utilizes memoization to optimize performance by recalculating the result only if dependencies change.
|
|
8
|
-
* @param {string} key - The key for which the corresponding value is to be fetched from the remote configuration.
|
|
9
|
-
* @returns {any | null} The value associated with the specified key if available, otherwise null.
|
|
10
|
-
*/
|
|
11
|
-
export const useGetValue = (key: string) => {
|
|
12
|
-
const remoteConfig = useRemoteConfig();
|
|
13
|
-
return useMemo(() => {
|
|
14
|
-
return remoteConfig ? getValue(remoteConfig, key) : null;
|
|
15
|
-
}, [remoteConfig, key]);
|
|
16
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { useContext } from "react";
|
|
2
|
-
import { FirebaseContext } from "../context/FirebaseContext";
|
|
3
|
-
/**
|
|
4
|
-
* Hook to access the Firebase Remote Config instance from the context.
|
|
5
|
-
* @returns {RemoteConfig} The remoteConfig object from the Firebase context.
|
|
6
|
-
*/
|
|
7
|
-
export const useRemoteConfig = () => {
|
|
8
|
-
const { remoteConfig } = useContext(FirebaseContext);
|
|
9
|
-
return remoteConfig;
|
|
10
|
-
};
|
package/types/AppModel.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { AppModel } from "./AppModel";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Order by constraint
|
|
5
|
-
* @group Query Constraints
|
|
6
|
-
*/
|
|
7
|
-
export type OrderByConstraint<AppModelType extends AppModel = AppModel> = {
|
|
8
|
-
/**
|
|
9
|
-
* Type of a constraint
|
|
10
|
-
*/
|
|
11
|
-
type: "orderBy";
|
|
12
|
-
/**
|
|
13
|
-
* Field path to use for ordering
|
|
14
|
-
*/
|
|
15
|
-
fieldPath: keyof AppModelType;
|
|
16
|
-
/**
|
|
17
|
-
* Direction of ordering: asc or desc
|
|
18
|
-
*/
|
|
19
|
-
directionStr: "asc" | "desc";
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Start from value constraint
|
|
24
|
-
* @group Query Constraints
|
|
25
|
-
*/
|
|
26
|
-
export type StartConstraint = {
|
|
27
|
-
type: "startAt" | "startAfter";
|
|
28
|
-
arguments: unknown[];
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* End by value constraint
|
|
33
|
-
* @group Query Constraints
|
|
34
|
-
*/
|
|
35
|
-
export type EndConstraint = {
|
|
36
|
-
type: "endAt" | "endBefore";
|
|
37
|
-
arguments: unknown[];
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Limit constraint
|
|
42
|
-
* @group Query Constraints
|
|
43
|
-
*/
|
|
44
|
-
export type LimitConstraint = {
|
|
45
|
-
type: "limitToLast" | "limit";
|
|
46
|
-
limit: number;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Non filtering query constaints
|
|
51
|
-
* @group Query Constraints
|
|
52
|
-
*/
|
|
53
|
-
export type NonFilterQueryConstraint<AppModelType extends AppModel = AppModel> =
|
|
54
|
-
| OrderByConstraint<AppModelType>
|
|
55
|
-
| StartConstraint
|
|
56
|
-
| EndConstraint
|
|
57
|
-
| LimitConstraint;
|
package/types/index.d.ts
DELETED
package/types/index.js
DELETED
package/types/index.ts
DELETED
package/web/analytics/index.d.ts
DELETED
package/web/analytics/index.js
DELETED
package/web/analytics/index.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { useContext } from "react";
|
|
2
|
-
import { FirebaseContext } from "../context/FirebaseContext";
|
|
3
|
-
/**
|
|
4
|
-
* Hook to access Firebase analytics from the Firebase context.
|
|
5
|
-
* @returns {any} The analytics object from the Firebase context.
|
|
6
|
-
*/
|
|
7
|
-
export const useAnalytics = () => {
|
|
8
|
-
const { analytics } = useContext(FirebaseContext);
|
|
9
|
-
return analytics;
|
|
10
|
-
};
|