react-query-firebase 2.3.1 → 2.3.2

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/package.json CHANGED
@@ -74,5 +74,5 @@
74
74
  "docs:build": "vitepress build docs",
75
75
  "docs:preview": "vitepress preview docs"
76
76
  },
77
- "version": "2.3.1"
77
+ "version": "2.3.2"
78
78
  }
@@ -1,9 +1,10 @@
1
1
  import { FirebaseFirestoreTypes } from "@react-native-firebase/firestore";
2
2
  import { ReactNativeFirebase } from "@react-native-firebase/app";
3
+ import { AppModel } from "../../types";
3
4
  /**
4
5
  * @inline
5
6
  */
6
- export type UseGetRealtimeDocDataOptions<AppModelType extends FirebaseFirestoreTypes.DocumentData = FirebaseFirestoreTypes.DocumentData> = {
7
+ export type UseGetRealtimeDocDataOptions<AppModelType extends AppModel = AppModel> = {
7
8
  /**
8
9
  * A slash-separated path to a document. Has to be omitted to use
9
10
  */
@@ -11,7 +12,7 @@ export type UseGetRealtimeDocDataOptions<AppModelType extends FirebaseFirestoreT
11
12
  /**
12
13
  * A reference to a collection.
13
14
  */
14
- reference?: FirebaseFirestoreTypes.CollectionReference<AppModelType> | FirebaseFirestoreTypes.DocumentReference<AppModelType>;
15
+ reference?: FirebaseFirestoreTypes.DocumentReference<AppModelType>;
15
16
  /**
16
17
  * Additional path segments that will be applied relative
17
18
  * to the first argument.
@@ -54,4 +55,4 @@ export type UseGetRealtimeDocDataResult<AppModelType> = {
54
55
  * };
55
56
  * ```
56
57
  */
57
- export declare const useGetRealtimeDocData: <AppModelType extends FirebaseFirestoreTypes.DocumentData = FirebaseFirestoreTypes.DocumentData>({ path, pathSegments, reference, onError }: UseGetRealtimeDocDataOptions<AppModelType>) => UseGetRealtimeDocDataResult<AppModelType>;
58
+ export declare const useGetRealtimeDocData: <AppModelType extends AppModel = AppModel>({ path, pathSegments, reference, onError }: UseGetRealtimeDocDataOptions<AppModelType>) => UseGetRealtimeDocDataResult<AppModelType>;
@@ -3,13 +3,12 @@ import { FirebaseFirestoreTypes, onSnapshot } from "@react-native-firebase/fires
3
3
  import { useEffect, useMemo, useState } from "react";
4
4
  import { ReactNativeFirebase } from "@react-native-firebase/app";
5
5
  import { useDocReference } from "./useDocReference";
6
+ import { AppModel } from "../../types";
6
7
 
7
8
  /**
8
9
  * @inline
9
10
  */
10
- export type UseGetRealtimeDocDataOptions<
11
- AppModelType extends FirebaseFirestoreTypes.DocumentData = FirebaseFirestoreTypes.DocumentData
12
- > = {
11
+ export type UseGetRealtimeDocDataOptions<AppModelType extends AppModel = AppModel> = {
13
12
  /**
14
13
  * A slash-separated path to a document. Has to be omitted to use
15
14
  */
@@ -17,9 +16,7 @@ export type UseGetRealtimeDocDataOptions<
17
16
  /**
18
17
  * A reference to a collection.
19
18
  */
20
- reference?:
21
- | FirebaseFirestoreTypes.CollectionReference<AppModelType>
22
- | FirebaseFirestoreTypes.DocumentReference<AppModelType>;
19
+ reference?: FirebaseFirestoreTypes.DocumentReference<AppModelType>;
23
20
  /**
24
21
  * Additional path segments that will be applied relative
25
22
  * to the first argument.
@@ -64,9 +61,7 @@ export type UseGetRealtimeDocDataResult<AppModelType> = {
64
61
  * };
65
62
  * ```
66
63
  */
67
- export const useGetRealtimeDocData = <
68
- AppModelType extends FirebaseFirestoreTypes.DocumentData = FirebaseFirestoreTypes.DocumentData
69
- >({
64
+ export const useGetRealtimeDocData = <AppModelType extends AppModel = AppModel>({
70
65
  path,
71
66
  pathSegments,
72
67
  reference,
@@ -5,11 +5,11 @@ import { AppModel } from "../../types";
5
5
  /**
6
6
  * @inline
7
7
  */
8
- type UseInfiniteQueryOptions<AppModelType extends AppModel = AppModel, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = {
8
+ type UseInfiniteQueryOptions<AppModelType extends AppModel = AppModel, TQueryKey extends QueryKey = QueryKey> = {
9
9
  /**
10
10
  * Reqct-query options that must include queryKey and shall not define queryFn
11
11
  */
12
- options: Omit<UseReactInfiniteQueryOptions<AppModelType[], Error, InfiniteData<AppModelType[]>, AppModelType[], TQueryKey, TPageParam>, "queryFn"> & Required<Pick<UseReactInfiniteQueryOptions<AppModelType[], Error, InfiniteData<AppModelType[]>, AppModelType[], TQueryKey, TPageParam>, "queryKey">>;
12
+ options: Omit<UseReactInfiniteQueryOptions<AppModelType[], Error, InfiniteData<AppModelType[]>, AppModelType[], TQueryKey, QueryConstraint>, "queryFn"> & Required<Pick<UseReactInfiniteQueryOptions<AppModelType[], Error, InfiniteData<AppModelType[]>, AppModelType[], TQueryKey, QueryConstraint>, "queryKey">>;
13
13
  /**
14
14
  * Reference to a Firestore collection
15
15
  */
@@ -45,5 +45,5 @@ type UseInfiniteQueryOptions<AppModelType extends AppModel = AppModel, TQueryKey
45
45
  * };
46
46
  * ```
47
47
  */
48
- export declare const useInfiniteQuery: <AppModelType extends AppModel = AppModel, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>({ options, collectionReference, queryConstraints, compositeFilter }: UseInfiniteQueryOptions<AppModelType, TQueryKey, TPageParam>) => UseInfiniteQueryResult<InfiniteData<AppModelType[]>>;
48
+ export declare const useInfiniteQuery: <AppModelType extends AppModel = AppModel, TQueryKey extends QueryKey = QueryKey>({ options, collectionReference, queryConstraints, compositeFilter }: UseInfiniteQueryOptions<AppModelType, TQueryKey>) => UseInfiniteQueryResult<InfiniteData<AppModelType[]>>;
49
49
  export {};
@@ -19,11 +19,7 @@ import { AppModel } from "../../types";
19
19
  /**
20
20
  * @inline
21
21
  */
22
- type UseInfiniteQueryOptions<
23
- AppModelType extends AppModel = AppModel,
24
- TQueryKey extends QueryKey = QueryKey,
25
- TPageParam = unknown
26
- > = {
22
+ type UseInfiniteQueryOptions<AppModelType extends AppModel = AppModel, TQueryKey extends QueryKey = QueryKey> = {
27
23
  /**
28
24
  * Reqct-query options that must include queryKey and shall not define queryFn
29
25
  */
@@ -34,7 +30,7 @@ type UseInfiniteQueryOptions<
34
30
  InfiniteData<AppModelType[]>,
35
31
  AppModelType[],
36
32
  TQueryKey,
37
- TPageParam
33
+ QueryConstraint
38
34
  >,
39
35
  "queryFn"
40
36
  > &
@@ -46,7 +42,7 @@ type UseInfiniteQueryOptions<
46
42
  InfiniteData<AppModelType[]>,
47
43
  AppModelType[],
48
44
  TQueryKey,
49
- TPageParam
45
+ QueryConstraint
50
46
  >,
51
47
  "queryKey"
52
48
  >
@@ -90,18 +86,12 @@ type UseInfiniteQueryOptions<
90
86
  * };
91
87
  * ```
92
88
  */
93
- export const useInfiniteQuery = <
94
- AppModelType extends AppModel = AppModel,
95
- TQueryKey extends QueryKey = QueryKey,
96
- TPageParam = unknown
97
- >({
89
+ export const useInfiniteQuery = <AppModelType extends AppModel = AppModel, TQueryKey extends QueryKey = QueryKey>({
98
90
  options,
99
91
  collectionReference,
100
92
  queryConstraints = [],
101
93
  compositeFilter
102
- }: UseInfiniteQueryOptions<AppModelType, TQueryKey, TPageParam>): UseInfiniteQueryResult<
103
- InfiniteData<AppModelType[]>
104
- > => {
94
+ }: UseInfiniteQueryOptions<AppModelType, TQueryKey>): UseInfiniteQueryResult<InfiniteData<AppModelType[]>> => {
105
95
  return useInfiniteReactQuery({
106
96
  ...options,
107
97
  queryFn: async ({ pageParam }) => {
@@ -1,9 +1,10 @@
1
- import { CollectionReference, DocumentData, DocumentReference } from "firebase/firestore";
1
+ import { DocumentReference } from "firebase/firestore";
2
2
  import { FirebaseError } from "firebase/app";
3
+ import { AppModel } from "../../types";
3
4
  /**
4
5
  * @inline
5
6
  */
6
- export type UseGetRealtimeDocDataOptions<AppModelType, DbModelType extends DocumentData = DocumentData> = {
7
+ export type UseGetRealtimeDocDataOptions<AppModelType extends AppModel = AppModel> = {
7
8
  /**
8
9
  * A slash-separated path to a document. Has to be omitted to use
9
10
  */
@@ -11,7 +12,7 @@ export type UseGetRealtimeDocDataOptions<AppModelType, DbModelType extends Docum
11
12
  /**
12
13
  * A reference to a collection.
13
14
  */
14
- reference?: CollectionReference<AppModelType, DbModelType> | DocumentReference<AppModelType, DbModelType>;
15
+ reference?: DocumentReference<AppModelType, AppModelType>;
15
16
  /**
16
17
  * Additional path segments that will be applied relative
17
18
  * to the first argument.
@@ -37,7 +38,7 @@ export type UseGetRealtimeDocDataResult<AppModelType> = {
37
38
  *
38
39
  * @group Hook
39
40
  *
40
- * @param {UseGetRealtimeDocDataOptions<AppModelType, DbModelType>} options
41
+ * @param {UseGetRealtimeDocDataOptions<AppModelType>} options
41
42
  *
42
43
  * @returns {UseGetRealtimeDocDataResult<AppModelType>}
43
44
  *
@@ -54,4 +55,4 @@ export type UseGetRealtimeDocDataResult<AppModelType> = {
54
55
  * };
55
56
  * ```
56
57
  */
57
- export declare const useGetRealtimeDocData: <AppModelType, DbModelType extends DocumentData = DocumentData>({ path, pathSegments, reference, onError }: UseGetRealtimeDocDataOptions<AppModelType, DbModelType>) => UseGetRealtimeDocDataResult<AppModelType>;
58
+ export declare const useGetRealtimeDocData: <AppModelType extends AppModel = AppModel>({ path, pathSegments, reference, onError }: UseGetRealtimeDocDataOptions<AppModelType>) => UseGetRealtimeDocDataResult<AppModelType>;
@@ -6,7 +6,7 @@ import { useDocReference } from "./useDocReference";
6
6
  *
7
7
  * @group Hook
8
8
  *
9
- * @param {UseGetRealtimeDocDataOptions<AppModelType, DbModelType>} options
9
+ * @param {UseGetRealtimeDocDataOptions<AppModelType>} options
10
10
  *
11
11
  * @returns {UseGetRealtimeDocDataResult<AppModelType>}
12
12
  *
@@ -1,13 +1,14 @@
1
- import { CollectionReference, DocumentData, DocumentReference, onSnapshot } from "firebase/firestore";
1
+ import { DocumentReference, onSnapshot } from "firebase/firestore";
2
2
 
3
3
  import { useEffect, useMemo, useState } from "react";
4
4
  import { FirebaseError } from "firebase/app";
5
5
  import { useDocReference } from "./useDocReference";
6
+ import { AppModel } from "../../types";
6
7
 
7
8
  /**
8
9
  * @inline
9
10
  */
10
- export type UseGetRealtimeDocDataOptions<AppModelType, DbModelType extends DocumentData = DocumentData> = {
11
+ export type UseGetRealtimeDocDataOptions<AppModelType extends AppModel = AppModel> = {
11
12
  /**
12
13
  * A slash-separated path to a document. Has to be omitted to use
13
14
  */
@@ -15,7 +16,7 @@ export type UseGetRealtimeDocDataOptions<AppModelType, DbModelType extends Docum
15
16
  /**
16
17
  * A reference to a collection.
17
18
  */
18
- reference?: CollectionReference<AppModelType, DbModelType> | DocumentReference<AppModelType, DbModelType>;
19
+ reference?: DocumentReference<AppModelType, AppModelType>;
19
20
  /**
20
21
  * Additional path segments that will be applied relative
21
22
  * to the first argument.
@@ -43,7 +44,7 @@ export type UseGetRealtimeDocDataResult<AppModelType> = {
43
44
  *
44
45
  * @group Hook
45
46
  *
46
- * @param {UseGetRealtimeDocDataOptions<AppModelType, DbModelType>} options
47
+ * @param {UseGetRealtimeDocDataOptions<AppModelType>} options
47
48
  *
48
49
  * @returns {UseGetRealtimeDocDataResult<AppModelType>}
49
50
  *
@@ -60,12 +61,12 @@ export type UseGetRealtimeDocDataResult<AppModelType> = {
60
61
  * };
61
62
  * ```
62
63
  */
63
- export const useGetRealtimeDocData = <AppModelType, DbModelType extends DocumentData = DocumentData>({
64
+ export const useGetRealtimeDocData = <AppModelType extends AppModel = AppModel>({
64
65
  path,
65
66
  pathSegments,
66
67
  reference,
67
68
  onError
68
- }: UseGetRealtimeDocDataOptions<AppModelType, DbModelType>): UseGetRealtimeDocDataResult<AppModelType> => {
69
+ }: UseGetRealtimeDocDataOptions<AppModelType>): UseGetRealtimeDocDataResult<AppModelType> => {
69
70
  const ref = useDocReference({ path, reference, pathSegments });
70
71
  const [doc, setDoc] = useState<AppModelType | null>(null);
71
72
  const [isError, setIsError] = useState(false);