react-query-firebase 2.0.3 → 2.1.1

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.
Files changed (182) hide show
  1. package/package.json +3 -2
  2. package/react-native/firestore/index.ts +1 -0
  3. package/react-native/firestore/useCompositeFilter.ts +3 -3
  4. package/react-native/firestore/useQueryConstraints.ts +84 -0
  5. package/react-native/index.d.ts +0 -4
  6. package/react-native/index.js +0 -4
  7. package/react-native/index.ts +0 -4
  8. package/types/AppModel.ts +7 -0
  9. package/types/QueryConstraints.ts +58 -0
  10. package/types/index.ts +2 -0
  11. package/web/firestore/index.ts +1 -0
  12. package/web/firestore/useCompositeFilter.ts +3 -3
  13. package/web/firestore/useQueryConstraints.ts +93 -0
  14. package/web/index.d.ts +0 -4
  15. package/web/index.js +0 -4
  16. package/web/index.ts +0 -4
  17. package/react-native/analytics/index.d.ts +0 -3
  18. package/react-native/analytics/index.js +0 -3
  19. package/react-native/analytics/useAnalytics.d.ts +0 -5
  20. package/react-native/analytics/useAnalytics.js +0 -10
  21. package/react-native/analytics/useLogEvent.d.ts +0 -17
  22. package/react-native/analytics/useLogEvent.js +0 -21
  23. package/react-native/analytics/useSetAnalyticsCollectionEnabled.d.ts +0 -10
  24. package/react-native/analytics/useSetAnalyticsCollectionEnabled.js +0 -16
  25. package/react-native/auth/index.d.ts +0 -12
  26. package/react-native/auth/index.js +0 -12
  27. package/react-native/auth/mutation-keys.d.ts +0 -7
  28. package/react-native/auth/mutation-keys.js +0 -19
  29. package/react-native/auth/useAuth.d.ts +0 -5
  30. package/react-native/auth/useAuth.js +0 -10
  31. package/react-native/auth/useCreateUserWitEmailAndPasswordMutation.d.ts +0 -15
  32. package/react-native/auth/useCreateUserWitEmailAndPasswordMutation.js +0 -19
  33. package/react-native/auth/useCurrentUser.d.ts +0 -6
  34. package/react-native/auth/useCurrentUser.js +0 -20
  35. package/react-native/auth/useIdToken.d.ts +0 -30
  36. package/react-native/auth/useIdToken.js +0 -66
  37. package/react-native/auth/useReauthenticateWitCredentialMutation.d.ts +0 -16
  38. package/react-native/auth/useReauthenticateWitCredentialMutation.js +0 -18
  39. package/react-native/auth/useReauthenticateWitRedirectMutation.d.ts +0 -17
  40. package/react-native/auth/useReauthenticateWitRedirectMutation.js +0 -18
  41. package/react-native/auth/useSendEmailVerificationMutation.d.ts +0 -13
  42. package/react-native/auth/useSendEmailVerificationMutation.js +0 -16
  43. package/react-native/auth/useSignInWitEmailAndPasswordMutation.d.ts +0 -15
  44. package/react-native/auth/useSignInWitEmailAndPasswordMutation.js +0 -19
  45. package/react-native/auth/useSignInWitRedirectMutation.d.ts +0 -14
  46. package/react-native/auth/useSignInWitRedirectMutation.js +0 -18
  47. package/react-native/auth/useSignOutMutation.d.ts +0 -10
  48. package/react-native/auth/useSignOutMutation.js +0 -19
  49. package/react-native/auth/useUpdateProfileMutation.d.ts +0 -15
  50. package/react-native/auth/useUpdateProfileMutation.js +0 -17
  51. package/react-native/firestore/index.d.ts +0 -16
  52. package/react-native/firestore/index.js +0 -16
  53. package/react-native/firestore/useAddDocMutation.d.ts +0 -21
  54. package/react-native/firestore/useAddDocMutation.js +0 -25
  55. package/react-native/firestore/useBatchWrite.d.ts +0 -15
  56. package/react-native/firestore/useBatchWrite.js +0 -21
  57. package/react-native/firestore/useCollectionReference.d.ts +0 -18
  58. package/react-native/firestore/useCollectionReference.js +0 -22
  59. package/react-native/firestore/useCompositeFilter.d.ts +0 -32
  60. package/react-native/firestore/useCompositeFilter.js +0 -42
  61. package/react-native/firestore/useCountQuery.d.ts +0 -23
  62. package/react-native/firestore/useCountQuery.js +0 -30
  63. package/react-native/firestore/useDeleteDocMutation.d.ts +0 -18
  64. package/react-native/firestore/useDeleteDocMutation.js +0 -23
  65. package/react-native/firestore/useDocReference.d.ts +0 -19
  66. package/react-native/firestore/useDocReference.js +0 -36
  67. package/react-native/firestore/useDocReferences.d.ts +0 -23
  68. package/react-native/firestore/useDocReferences.js +0 -29
  69. package/react-native/firestore/useFirestore.d.ts +0 -7
  70. package/react-native/firestore/useFirestore.js +0 -12
  71. package/react-native/firestore/useGetDocData.d.ts +0 -18
  72. package/react-native/firestore/useGetDocData.js +0 -18
  73. package/react-native/firestore/useGetRealtimeDocData.d.ts +0 -57
  74. package/react-native/firestore/useGetRealtimeDocData.js +0 -56
  75. package/react-native/firestore/useInfiniteQuery.d.ts +0 -17
  76. package/react-native/firestore/useInfiniteQuery.js +0 -28
  77. package/react-native/firestore/useQuery.d.ts +0 -24
  78. package/react-native/firestore/useQuery.js +0 -34
  79. package/react-native/firestore/useRunTransaction.d.ts +0 -15
  80. package/react-native/firestore/useRunTransaction.js +0 -19
  81. package/react-native/firestore/useSetDocMutation.d.ts +0 -20
  82. package/react-native/firestore/useSetDocMutation.js +0 -25
  83. package/react-native/firestore/useUpdateDocMutation.d.ts +0 -30
  84. package/react-native/firestore/useUpdateDocMutation.js +0 -37
  85. package/react-native/firestore/utils/getDocData.d.ts +0 -18
  86. package/react-native/firestore/utils/getDocData.js +0 -22
  87. package/react-native/firestore/utils/getDocRef.d.ts +0 -19
  88. package/react-native/firestore/utils/getDocRef.js +0 -21
  89. package/react-native/firestore/utils/getDocSnap.d.ts +0 -20
  90. package/react-native/firestore/utils/getDocSnap.js +0 -25
  91. package/react-native/remoteConfig/index.d.ts +0 -3
  92. package/react-native/remoteConfig/index.js +0 -3
  93. package/react-native/remoteConfig/useFetchAndActivate.d.ts +0 -11
  94. package/react-native/remoteConfig/useFetchAndActivate.js +0 -31
  95. package/react-native/remoteConfig/useGetValue.d.ts +0 -7
  96. package/react-native/remoteConfig/useGetValue.js +0 -15
  97. package/react-native/remoteConfig/useRemoteConfig.d.ts +0 -5
  98. package/react-native/remoteConfig/useRemoteConfig.js +0 -10
  99. package/web/analytics/index.d.ts +0 -3
  100. package/web/analytics/index.js +0 -3
  101. package/web/analytics/useAnalytics.d.ts +0 -5
  102. package/web/analytics/useAnalytics.js +0 -10
  103. package/web/analytics/useLogEvent.d.ts +0 -17
  104. package/web/analytics/useLogEvent.js +0 -21
  105. package/web/analytics/useSetAnalyticsCollectionEnabled.d.ts +0 -10
  106. package/web/analytics/useSetAnalyticsCollectionEnabled.js +0 -16
  107. package/web/auth/index.d.ts +0 -13
  108. package/web/auth/index.js +0 -13
  109. package/web/auth/mutation-keys.d.ts +0 -7
  110. package/web/auth/mutation-keys.js +0 -19
  111. package/web/auth/useAuth.d.ts +0 -5
  112. package/web/auth/useAuth.js +0 -10
  113. package/web/auth/useAuthStateReady.d.ts +0 -6
  114. package/web/auth/useAuthStateReady.js +0 -19
  115. package/web/auth/useCreateUserWitEmailAndPasswordMutation.d.ts +0 -15
  116. package/web/auth/useCreateUserWitEmailAndPasswordMutation.js +0 -19
  117. package/web/auth/useCurrentUser.d.ts +0 -6
  118. package/web/auth/useCurrentUser.js +0 -20
  119. package/web/auth/useIdToken.d.ts +0 -30
  120. package/web/auth/useIdToken.js +0 -66
  121. package/web/auth/useReauthenticateWitCredentialMutation.d.ts +0 -16
  122. package/web/auth/useReauthenticateWitCredentialMutation.js +0 -18
  123. package/web/auth/useReauthenticateWitRedirectMutation.d.ts +0 -17
  124. package/web/auth/useReauthenticateWitRedirectMutation.js +0 -18
  125. package/web/auth/useSendEmailVerificationMutation.d.ts +0 -13
  126. package/web/auth/useSendEmailVerificationMutation.js +0 -16
  127. package/web/auth/useSignInWitEmailAndPasswordMutation.d.ts +0 -15
  128. package/web/auth/useSignInWitEmailAndPasswordMutation.js +0 -19
  129. package/web/auth/useSignInWitRedirectMutation.d.ts +0 -14
  130. package/web/auth/useSignInWitRedirectMutation.js +0 -18
  131. package/web/auth/useSignOutMutation.d.ts +0 -10
  132. package/web/auth/useSignOutMutation.js +0 -19
  133. package/web/auth/useUpdateProfileMutation.d.ts +0 -15
  134. package/web/auth/useUpdateProfileMutation.js +0 -17
  135. package/web/firestore/index.d.ts +0 -16
  136. package/web/firestore/index.js +0 -16
  137. package/web/firestore/useAddDocMutation.d.ts +0 -23
  138. package/web/firestore/useAddDocMutation.js +0 -26
  139. package/web/firestore/useBatchWrite.d.ts +0 -15
  140. package/web/firestore/useBatchWrite.js +0 -21
  141. package/web/firestore/useCollectionReference.d.ts +0 -18
  142. package/web/firestore/useCollectionReference.js +0 -24
  143. package/web/firestore/useCompositeFilter.d.ts +0 -32
  144. package/web/firestore/useCompositeFilter.js +0 -41
  145. package/web/firestore/useCountQuery.d.ts +0 -23
  146. package/web/firestore/useCountQuery.js +0 -30
  147. package/web/firestore/useDeleteDocMutation.d.ts +0 -18
  148. package/web/firestore/useDeleteDocMutation.js +0 -23
  149. package/web/firestore/useDocReference.d.ts +0 -19
  150. package/web/firestore/useDocReference.js +0 -45
  151. package/web/firestore/useDocReferences.d.ts +0 -23
  152. package/web/firestore/useDocReferences.js +0 -31
  153. package/web/firestore/useFirestore.d.ts +0 -7
  154. package/web/firestore/useFirestore.js +0 -12
  155. package/web/firestore/useGetDocData.d.ts +0 -18
  156. package/web/firestore/useGetDocData.js +0 -18
  157. package/web/firestore/useGetRealtimeDocData.d.ts +0 -57
  158. package/web/firestore/useGetRealtimeDocData.js +0 -56
  159. package/web/firestore/useInfiniteQuery.d.ts +0 -18
  160. package/web/firestore/useInfiniteQuery.js +0 -28
  161. package/web/firestore/useQuery.d.ts +0 -25
  162. package/web/firestore/useQuery.js +0 -34
  163. package/web/firestore/useRunTransaction.d.ts +0 -15
  164. package/web/firestore/useRunTransaction.js +0 -19
  165. package/web/firestore/useSetDocMutation.d.ts +0 -20
  166. package/web/firestore/useSetDocMutation.js +0 -25
  167. package/web/firestore/useUpdateDocMutation.d.ts +0 -31
  168. package/web/firestore/useUpdateDocMutation.js +0 -37
  169. package/web/firestore/utils/getDocData.d.ts +0 -18
  170. package/web/firestore/utils/getDocData.js +0 -22
  171. package/web/firestore/utils/getDocRef.d.ts +0 -19
  172. package/web/firestore/utils/getDocRef.js +0 -25
  173. package/web/firestore/utils/getDocSnap.d.ts +0 -20
  174. package/web/firestore/utils/getDocSnap.js +0 -25
  175. package/web/remoteConfig/index.d.ts +0 -3
  176. package/web/remoteConfig/index.js +0 -3
  177. package/web/remoteConfig/useFetchAndActivate.d.ts +0 -11
  178. package/web/remoteConfig/useFetchAndActivate.js +0 -31
  179. package/web/remoteConfig/useGetValue.d.ts +0 -7
  180. package/web/remoteConfig/useGetValue.js +0 -15
  181. package/web/remoteConfig/useRemoteConfig.d.ts +0 -5
  182. package/web/remoteConfig/useRemoteConfig.js +0 -10
@@ -1,20 +0,0 @@
1
- import { DocumentData } from "firebase/firestore";
2
- import { GetDocRefOptions } from "./getDocRef";
3
- export type GetDocSnapOptions<AppModelType extends DocumentData = DocumentData, DbModelType extends DocumentData = DocumentData> = GetDocRefOptions<AppModelType, DbModelType>;
4
- /**
5
- * Asynchronously retrieves a document snapshot from Firestore using a specified document reference
6
- * or path information. This function handles getting the appropriate document reference based on
7
- * the parameters provided, and then fetches the document data from Firestore.
8
- *
9
- * @param {GetDocSnapOptions<AppModelType, DbModelType>} options - An object containing options
10
- * for retrieving the document
11
- * snapshot.
12
- * @param {DocumentData} options.db - The Firestore database instance to perform the operation on.
13
- * @param {string} options.reference - A string representing a direct Firestore document reference.
14
- * @param {string} options.path - A Firestore path string leading to the document.
15
- * @param {string[]} options.pathSegments - An array of path segments to build the Firestore path.
16
- * @returns {Promise<DocumentData | null>} A promise that resolves to the document data if the
17
- * document exists, or `null` if the document does not exist
18
- * or if the reference could not be obtained.
19
- */
20
- export declare const getDocSnap: <AppModelType extends DocumentData = DocumentData, DbModelType extends DocumentData = DocumentData>({ db, reference, path, pathSegments }: GetDocSnapOptions<AppModelType, DbModelType>) => Promise<import("@firebase/firestore").DocumentSnapshot<AppModelType, DbModelType> | null>;
@@ -1,25 +0,0 @@
1
- import { getDoc as firestoreGetDoc } from "firebase/firestore";
2
- import { getDocRef } from "./getDocRef";
3
- /**
4
- * Asynchronously retrieves a document snapshot from Firestore using a specified document reference
5
- * or path information. This function handles getting the appropriate document reference based on
6
- * the parameters provided, and then fetches the document data from Firestore.
7
- *
8
- * @param {GetDocSnapOptions<AppModelType, DbModelType>} options - An object containing options
9
- * for retrieving the document
10
- * snapshot.
11
- * @param {DocumentData} options.db - The Firestore database instance to perform the operation on.
12
- * @param {string} options.reference - A string representing a direct Firestore document reference.
13
- * @param {string} options.path - A Firestore path string leading to the document.
14
- * @param {string[]} options.pathSegments - An array of path segments to build the Firestore path.
15
- * @returns {Promise<DocumentData | null>} A promise that resolves to the document data if the
16
- * document exists, or `null` if the document does not exist
17
- * or if the reference could not be obtained.
18
- */
19
- export const getDocSnap = async ({ db, reference, path, pathSegments }) => {
20
- const docRef = await getDocRef({ db, reference, path, pathSegments });
21
- if (docRef) {
22
- return await firestoreGetDoc(docRef);
23
- }
24
- return null;
25
- };
@@ -1,3 +0,0 @@
1
- export * from "./useFetchAndActivate";
2
- export * from "./useGetValue";
3
- export * from "./useRemoteConfig";
@@ -1,3 +0,0 @@
1
- export * from "./useFetchAndActivate";
2
- export * from "./useGetValue";
3
- export * from "./useRemoteConfig";
@@ -1,11 +0,0 @@
1
- /**
2
- * Custom hook to fetch and activate remote configuration settings.
3
- * Initializes remote configuration, fetches, activates it, and tracks the fetch status.
4
- * @returns {Object} An object containing:
5
- * - {Function} fetchAndActivate - Callback function to fetch and activate remote configuration.
6
- * - {Boolean} isFetched - Boolean representing whether the fetch-and-activate process completed.
7
- */
8
- export declare const useFetchAndActivate: () => {
9
- fetchAndActivate: () => Promise<void>;
10
- isFetched: boolean;
11
- };
@@ -1,31 +0,0 @@
1
- import { useRemoteConfig } from "./useRemoteConfig";
2
- import { ensureInitialized, fetchAndActivate } from "firebase/remote-config";
3
- import { useCallback, useMemo, useState } from "react";
4
- /**
5
- * Custom hook to fetch and activate remote configuration settings.
6
- * Initializes remote configuration, fetches, activates it, and tracks the fetch status.
7
- * @returns {Object} An object containing:
8
- * - {Function} fetchAndActivate - Callback function to fetch and activate remote configuration.
9
- * - {Boolean} isFetched - Boolean representing whether the fetch-and-activate process completed.
10
- */
11
- export const useFetchAndActivate = () => {
12
- const remoteConfig = useRemoteConfig();
13
- const [isFetched, setIsFetched] = useState(false);
14
- const fetchAndActivateCallback = useCallback(async () => {
15
- try {
16
- if (remoteConfig) {
17
- await ensureInitialized(remoteConfig);
18
- await fetchAndActivate(remoteConfig);
19
- setIsFetched(true);
20
- }
21
- }
22
- catch (e) {
23
- setIsFetched(true);
24
- console.log(`Cannot read remote config: ${e?.message}`);
25
- }
26
- }, [remoteConfig]);
27
- return useMemo(() => ({
28
- fetchAndActivate: fetchAndActivateCallback,
29
- isFetched
30
- }), [isFetched, fetchAndActivateCallback]);
31
- };
@@ -1,7 +0,0 @@
1
- /**
2
- * Custom hook to retrieve a value associated with a specified key from remote configuration.
3
- * Utilizes memoization to optimize performance by recalculating the result only if dependencies change.
4
- * @param {string} key - The key for which the corresponding value is to be fetched from the remote configuration.
5
- * @returns {any | null} The value associated with the specified key if available, otherwise null.
6
- */
7
- export declare const useGetValue: (key: string) => import("@firebase/remote-config").Value | null;
@@ -1,15 +0,0 @@
1
- import { getValue } from "firebase/remote-config";
2
- import { useRemoteConfig } from "./useRemoteConfig";
3
- import { useMemo } from "react";
4
- /**
5
- * Custom hook to retrieve a value associated with a specified key from remote configuration.
6
- * Utilizes memoization to optimize performance by recalculating the result only if dependencies change.
7
- * @param {string} key - The key for which the corresponding value is to be fetched from the remote configuration.
8
- * @returns {any | null} The value associated with the specified key if available, otherwise null.
9
- */
10
- export const useGetValue = (key) => {
11
- const remoteConfig = useRemoteConfig();
12
- return useMemo(() => {
13
- return remoteConfig ? getValue(remoteConfig, key) : null;
14
- }, [key, remoteConfig]);
15
- };
@@ -1,5 +0,0 @@
1
- /**
2
- * Hook to access the Firebase Remote Config instance from the context.
3
- * @returns {RemoteConfig} The remoteConfig object from the Firebase context.
4
- */
5
- export declare const useRemoteConfig: () => import("@firebase/remote-config").RemoteConfig;
@@ -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
- };