react-query-firebase 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +44 -0
- package/dist/src/FirebaseContext.d.ts +13 -0
- package/dist/src/FirebaseContext.js +3 -0
- package/dist/src/FirebaseContextProvider.d.ts +28 -0
- package/dist/src/FirebaseContextProvider.js +46 -0
- package/dist/src/analytics/index.d.ts +1 -0
- package/dist/src/analytics/index.js +1 -0
- package/dist/src/analytics/useLogEvent.d.ts +10 -0
- package/dist/src/analytics/useLogEvent.js +14 -0
- package/dist/src/auth/index.d.ts +9 -0
- package/dist/src/auth/index.js +9 -0
- package/dist/src/auth/mutation-keys.d.ts +7 -0
- package/dist/src/auth/mutation-keys.js +19 -0
- package/dist/src/auth/useAuthStateReady.d.ts +1 -0
- package/dist/src/auth/useAuthStateReady.js +14 -0
- package/dist/src/auth/useCreateUserWitEmailAndPasswordMutation.d.ts +8 -0
- package/dist/src/auth/useCreateUserWitEmailAndPasswordMutation.js +12 -0
- package/dist/src/auth/useCurrentUser.d.ts +1 -0
- package/dist/src/auth/useCurrentUser.js +15 -0
- package/dist/src/auth/useSendEmailVerificationMutation.d.ts +7 -0
- package/dist/src/auth/useSendEmailVerificationMutation.js +10 -0
- package/dist/src/auth/useSignInWitEmailAndPasswordMutation.d.ts +8 -0
- package/dist/src/auth/useSignInWitEmailAndPasswordMutation.js +12 -0
- package/dist/src/auth/useSignInWitRedirectMutation.d.ts +8 -0
- package/dist/src/auth/useSignInWitRedirectMutation.js +12 -0
- package/dist/src/auth/useSignOutMutation.d.ts +3 -0
- package/dist/src/auth/useSignOutMutation.js +12 -0
- package/dist/src/auth/useUpdateProfileMutation.d.ts +8 -0
- package/dist/src/auth/useUpdateProfileMutation.js +10 -0
- package/dist/src/firestore/index.d.ts +14 -0
- package/dist/src/firestore/index.js +14 -0
- package/dist/src/firestore/useAddDocMutation.d.ts +12 -0
- package/dist/src/firestore/useAddDocMutation.js +15 -0
- package/dist/src/firestore/useBatchWrite.d.ts +8 -0
- package/dist/src/firestore/useBatchWrite.js +14 -0
- package/dist/src/firestore/useCollectionReference.d.ts +7 -0
- package/dist/src/firestore/useCollectionReference.js +13 -0
- package/dist/src/firestore/useCompositeFilter.d.ts +20 -0
- package/dist/src/firestore/useCompositeFilter.js +26 -0
- package/dist/src/firestore/useCountQuery.d.ts +10 -0
- package/dist/src/firestore/useCountQuery.js +17 -0
- package/dist/src/firestore/useDeleteDocMutation.d.ts +11 -0
- package/dist/src/firestore/useDeleteDocMutation.js +16 -0
- package/dist/src/firestore/useDocReference.d.ts +7 -0
- package/dist/src/firestore/useDocReference.js +21 -0
- package/dist/src/firestore/useDocReferences.d.ts +7 -0
- package/dist/src/firestore/useDocReferences.js +15 -0
- package/dist/src/firestore/useGetDocData.d.ts +10 -0
- package/dist/src/firestore/useGetDocData.js +10 -0
- package/dist/src/firestore/useInfiniteQuery.d.ts +11 -0
- package/dist/src/firestore/useInfiniteQuery.js +21 -0
- package/dist/src/firestore/useQuery.d.ts +11 -0
- package/dist/src/firestore/useQuery.js +20 -0
- package/dist/src/firestore/useRunTransaction.d.ts +8 -0
- package/dist/src/firestore/useRunTransaction.js +12 -0
- package/dist/src/firestore/useSetDocMutation.d.ts +11 -0
- package/dist/src/firestore/useSetDocMutation.js +16 -0
- package/dist/src/firestore/useUpdateDocMutation.d.ts +12 -0
- package/dist/src/firestore/useUpdateDocMutation.js +18 -0
- package/dist/src/firestore/utils/getDocData.d.ts +4 -0
- package/dist/src/firestore/utils/getDocData.js +8 -0
- package/dist/src/firestore/utils/getDocRef.d.ts +8 -0
- package/dist/src/firestore/utils/getDocRef.js +14 -0
- package/dist/src/firestore/utils/getDocSnap.d.ts +4 -0
- package/dist/src/firestore/utils/getDocSnap.js +9 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.js +10 -0
- package/dist/src/remoteConfig/index.d.ts +2 -0
- package/dist/src/remoteConfig/index.js +2 -0
- package/dist/src/remoteConfig/useFetchAndActivate.d.ts +4 -0
- package/dist/src/remoteConfig/useFetchAndActivate.js +22 -0
- package/dist/src/remoteConfig/useGetValue.d.ts +1 -0
- package/dist/src/remoteConfig/useGetValue.js +9 -0
- package/dist/src/useAnalytics.d.ts +1 -0
- package/dist/src/useAnalytics.js +6 -0
- package/dist/src/useAuth.d.ts +1 -0
- package/dist/src/useAuth.js +6 -0
- package/dist/src/useFirebase.d.ts +1 -0
- package/dist/src/useFirebase.js +6 -0
- package/dist/src/useFirestore.d.ts +1 -0
- package/dist/src/useFirestore.js +6 -0
- package/dist/src/useRemoteConfig.d.ts +1 -0
- package/dist/src/useRemoteConfig.js +6 -0
- package/package.json +57 -0
- package/src/FirebaseContext.ts +18 -0
- package/src/FirebaseContextProvider.tsx +91 -0
- package/src/analytics/index.ts +1 -0
- package/src/analytics/useLogEvent.ts +27 -0
- package/src/auth/index.ts +9 -0
- package/src/auth/mutation-keys.ts +19 -0
- package/src/auth/useAuthStateReady.ts +19 -0
- package/src/auth/useCreateUserWitEmailAndPasswordMutation.ts +26 -0
- package/src/auth/useCurrentUser.ts +19 -0
- package/src/auth/useIdToken.ts +35 -0
- package/src/auth/useReauthenticateWitCredentialMutation.ts +23 -0
- package/src/auth/useReauthenticateWitRedirectMutation.ts +29 -0
- package/src/auth/useSendEmailVerificationMutation.ts +22 -0
- package/src/auth/useSignInWitEmailAndPasswordMutation.ts +27 -0
- package/src/auth/useSignInWitRedirectMutation.ts +27 -0
- package/src/auth/useSignOutMutation.ts +18 -0
- package/src/auth/useUpdateProfileMutation.ts +23 -0
- package/src/firestore/index.ts +14 -0
- package/src/firestore/useAddDocMutation.ts +51 -0
- package/src/firestore/useBatchWrite.ts +24 -0
- package/src/firestore/useCollectionReference.ts +26 -0
- package/src/firestore/useCompositeFilter.ts +68 -0
- package/src/firestore/useCountQuery.ts +51 -0
- package/src/firestore/useDeleteDocMutation.ts +40 -0
- package/src/firestore/useDocReference.ts +44 -0
- package/src/firestore/useDocReferences.ts +28 -0
- package/src/firestore/useGetDocData.ts +33 -0
- package/src/firestore/useInfiniteQuery.ts +84 -0
- package/src/firestore/useQuery.ts +58 -0
- package/src/firestore/useRunTransaction.ts +24 -0
- package/src/firestore/useSetDocMutation.ts +43 -0
- package/src/firestore/useUpdateDocMutation copy.ts +51 -0
- package/src/firestore/useUpdateDocMutation.ts +55 -0
- package/src/firestore/utils/getDocData.ts +25 -0
- package/src/firestore/utils/getDocRef.ts +35 -0
- package/src/firestore/utils/getDocSnap.ts +25 -0
- package/src/index.ts +10 -0
- package/src/remoteConfig/index.ts +2 -0
- package/src/remoteConfig/useFetchAndActivate.ts +27 -0
- package/src/remoteConfig/useGetValue.ts +10 -0
- package/src/useAnalytics.ts +8 -0
- package/src/useAuth.ts +8 -0
- package/src/useFirebase.ts +8 -0
- package/src/useFirestore.ts +7 -0
- package/src/useRemoteConfig.ts +7 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[](https://github.com/vpishuk/react-query-firebase/actions/workflows/main.yaml)
|
|
2
|
+
|
|
3
|
+
# react-query-firebase
|
|
4
|
+
|
|
5
|
+
This module offers a set of hooks to work with [Firebase](https://firebase.google.com/) platorrm.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Run the following command to install:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
npm i react-query-firebase
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
TODO:
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## Contribution guidelines
|
|
21
|
+
|
|
22
|
+
You are encouraged to contribute to this project as soon as you see any defects or issues.
|
|
23
|
+
|
|
24
|
+
## Code Editor Configuration
|
|
25
|
+
|
|
26
|
+
This repository contains configuration for VSCode editor. It doesn't mean that you cannot use a different tool. Feel free to push configurations for your favourite code editor.
|
|
27
|
+
|
|
28
|
+
## Commands
|
|
29
|
+
|
|
30
|
+
1. To build : `npm run build`
|
|
31
|
+
2. To lint use: `npm run lint`
|
|
32
|
+
3. To initialize pre-commit hooks use: `npm run prepare`
|
|
33
|
+
|
|
34
|
+
## Workflow
|
|
35
|
+
|
|
36
|
+
Before you get started make sure that there is noone working on an issue you are going to address.
|
|
37
|
+
|
|
38
|
+
As a first step, clone the repository and run `npm i && npm run prepare` command to install all dependencies and initialize pre-commit hooks.
|
|
39
|
+
|
|
40
|
+
Create a branch to work on your code changes.
|
|
41
|
+
|
|
42
|
+
Once you are done with coding, create pull request and get an approval.
|
|
43
|
+
|
|
44
|
+
Lastly, enjoy your changes.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Auth } from "firebase/auth";
|
|
2
|
+
import { Analytics } from "firebase/analytics";
|
|
3
|
+
import { Firestore } from "firebase/firestore";
|
|
4
|
+
import { FirebaseApp } from "firebase/app";
|
|
5
|
+
import { RemoteConfig } from "firebase/remote-config";
|
|
6
|
+
export type FirebaseContextValue = {
|
|
7
|
+
auth: Auth;
|
|
8
|
+
analytics: Analytics;
|
|
9
|
+
firebase: FirebaseApp;
|
|
10
|
+
remoteConfig: RemoteConfig;
|
|
11
|
+
firestore: Firestore;
|
|
12
|
+
};
|
|
13
|
+
export declare const FirebaseContext: import("react").Context<Partial<FirebaseContextValue>>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from "react";
|
|
2
|
+
import { RemoteConfigSettings } from "firebase/remote-config";
|
|
3
|
+
import { FirebaseOptions } from "firebase/app";
|
|
4
|
+
type FirestorEmulatorConfig = {
|
|
5
|
+
host: string;
|
|
6
|
+
port: number;
|
|
7
|
+
};
|
|
8
|
+
type AuthEmulatorConfig = {
|
|
9
|
+
host: string;
|
|
10
|
+
};
|
|
11
|
+
type Emulators = {
|
|
12
|
+
firestore?: FirestorEmulatorConfig;
|
|
13
|
+
auth?: AuthEmulatorConfig;
|
|
14
|
+
};
|
|
15
|
+
type FirebaseContextProvider = PropsWithChildren & {
|
|
16
|
+
emulators?: Emulators;
|
|
17
|
+
options: FirebaseOptions;
|
|
18
|
+
authEnabled?: boolean;
|
|
19
|
+
analyticsEnabled?: boolean;
|
|
20
|
+
firestoreEnabled?: boolean;
|
|
21
|
+
remoteConfigSettings?: RemoteConfigSettings;
|
|
22
|
+
remoteConfigDefaults?: {
|
|
23
|
+
[key: string]: string | number | boolean;
|
|
24
|
+
};
|
|
25
|
+
remoteConfigEnabled?: boolean;
|
|
26
|
+
};
|
|
27
|
+
export declare const FirebaseContextProvider: React.FC<FirebaseContextProvider>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { FirebaseContext } from "./FirebaseContext";
|
|
3
|
+
import { connectAuthEmulator, getAuth } from "firebase/auth";
|
|
4
|
+
import { getAnalytics } from "firebase/analytics";
|
|
5
|
+
import { getRemoteConfig } from "firebase/remote-config";
|
|
6
|
+
import { connectFirestoreEmulator, getFirestore } from "firebase/firestore";
|
|
7
|
+
import { initializeApp } from "firebase/app";
|
|
8
|
+
export const FirebaseContextProvider = ({ emulators, options, children, authEnabled = true, firestoreEnabled = true, analyticsEnabled = true, remoteConfigEnabled = true, remoteConfigSettings, remoteConfigDefaults = {} }) => {
|
|
9
|
+
const firebase = useMemo(() => {
|
|
10
|
+
return initializeApp(options);
|
|
11
|
+
}, [options]);
|
|
12
|
+
const contextValue = useMemo(() => {
|
|
13
|
+
const value = {};
|
|
14
|
+
if (firestoreEnabled) {
|
|
15
|
+
const firestore = getFirestore(firebase);
|
|
16
|
+
if (emulators?.firestore?.host && emulators?.firestore?.port) {
|
|
17
|
+
connectFirestoreEmulator(firestore, emulators.firestore.host, emulators.firestore.port);
|
|
18
|
+
}
|
|
19
|
+
value.firestore = firestore;
|
|
20
|
+
}
|
|
21
|
+
if (authEnabled) {
|
|
22
|
+
const auth = getAuth(firebase);
|
|
23
|
+
if (emulators?.auth?.host) {
|
|
24
|
+
connectAuthEmulator(auth, emulators?.auth?.host, {
|
|
25
|
+
disableWarnings: true
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
value.auth = auth;
|
|
29
|
+
}
|
|
30
|
+
if (analyticsEnabled && options.measurementId && typeof window !== "undefined") {
|
|
31
|
+
const analytics = getAnalytics(firebase);
|
|
32
|
+
value.analytics = analytics;
|
|
33
|
+
}
|
|
34
|
+
if (remoteConfigEnabled && typeof window !== "undefined") {
|
|
35
|
+
const remoteConfig = getRemoteConfig(firebase);
|
|
36
|
+
if (remoteConfigSettings) {
|
|
37
|
+
remoteConfig.settings.fetchTimeoutMillis = remoteConfigSettings.fetchTimeoutMillis;
|
|
38
|
+
remoteConfig.settings.minimumFetchIntervalMillis = remoteConfigSettings.minimumFetchIntervalMillis;
|
|
39
|
+
remoteConfig.defaultConfig = remoteConfigDefaults;
|
|
40
|
+
}
|
|
41
|
+
value.remoteConfig = remoteConfig;
|
|
42
|
+
}
|
|
43
|
+
return { firebase, ...value };
|
|
44
|
+
}, [firebase]);
|
|
45
|
+
return React.createElement(FirebaseContext.Provider, { value: contextValue }, children);
|
|
46
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useLogEvent";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useLogEvent";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { logEvent } from "firebase/analytics";
|
|
2
|
+
import { useAnalytics } from "../useAnalytics";
|
|
3
|
+
import { useCallback, useMemo } from "react";
|
|
4
|
+
export const useLogEvent = ({ eventName, eventParams }) => {
|
|
5
|
+
const analytics = useAnalytics();
|
|
6
|
+
const logEventCallback = useCallback(() => {
|
|
7
|
+
if (analytics) {
|
|
8
|
+
logEvent(analytics, eventName, eventParams);
|
|
9
|
+
}
|
|
10
|
+
}, [eventName, eventParams]);
|
|
11
|
+
return useMemo(() => ({
|
|
12
|
+
logEvent: logEventCallback
|
|
13
|
+
}), [logEventCallback]);
|
|
14
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./mutation-keys";
|
|
2
|
+
export * from "./useCreateUserWitEmailAndPasswordMutation";
|
|
3
|
+
export * from "./useSendEmailVerificationMutation";
|
|
4
|
+
export * from "./useSignInWitEmailAndPasswordMutation";
|
|
5
|
+
export * from "./useCurrentUser";
|
|
6
|
+
export * from "./useAuthStateReady";
|
|
7
|
+
export * from "./useSignInWitRedirectMutation";
|
|
8
|
+
export * from "./useUpdateProfileMutation";
|
|
9
|
+
export * from "./useSignOutMutation";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./mutation-keys";
|
|
2
|
+
export * from "./useCreateUserWitEmailAndPasswordMutation";
|
|
3
|
+
export * from "./useSendEmailVerificationMutation";
|
|
4
|
+
export * from "./useSignInWitEmailAndPasswordMutation";
|
|
5
|
+
export * from "./useCurrentUser";
|
|
6
|
+
export * from "./useAuthStateReady";
|
|
7
|
+
export * from "./useSignInWitRedirectMutation";
|
|
8
|
+
export * from "./useUpdateProfileMutation";
|
|
9
|
+
export * from "./useSignOutMutation";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const CREATE_USER_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY: readonly ["FIREBASE", "AUTH", "CREATE_USER_WITH_EMAIL_AND_PASSWORD_MUTATION"];
|
|
2
|
+
export declare const SEND_EMAIL_VERIFICATION_MUTATION_KEY: readonly ["FIREBASE", "AUTH", "SEND_EMAIL_VERIFICATION_MUTATION"];
|
|
3
|
+
export declare const SIGN_IN_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY: readonly ["FIREBASE", "AUTH", "SIGN_IN_WITH_EMAIL_AND_PASSWORD_MUTATION"];
|
|
4
|
+
export declare const SIGN_IN_WITH_REDIRECT_MUTATION_KEY: readonly ["FIREBASE", "AUTH", "SIGN_IN_WITH_REDIRECT_MUTATION"];
|
|
5
|
+
export declare const SIGN_OUT_MUTATION_KEY: readonly ["FIREBASE", "AUTH", "SIGN_OUT"];
|
|
6
|
+
export declare const REAUTHENTICATE_WITH_REDIRECT_MUTATION_KEY: readonly ["FIREBASE", "AUTH", "REAUTHENTICATE_WITH_REDIRECT"];
|
|
7
|
+
export declare const REAUTHENTICATE_WITH_CREDENTIAL_MUTATION_KEY: readonly ["FIREBASE", "AUTH", "REAUTHENTICATE_WITH_CREDENTIAL"];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const CREATE_USER_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY = [
|
|
2
|
+
"FIREBASE",
|
|
3
|
+
"AUTH",
|
|
4
|
+
"CREATE_USER_WITH_EMAIL_AND_PASSWORD_MUTATION"
|
|
5
|
+
];
|
|
6
|
+
export const SEND_EMAIL_VERIFICATION_MUTATION_KEY = ["FIREBASE", "AUTH", "SEND_EMAIL_VERIFICATION_MUTATION"];
|
|
7
|
+
export const SIGN_IN_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY = [
|
|
8
|
+
"FIREBASE",
|
|
9
|
+
"AUTH",
|
|
10
|
+
"SIGN_IN_WITH_EMAIL_AND_PASSWORD_MUTATION"
|
|
11
|
+
];
|
|
12
|
+
export const SIGN_IN_WITH_REDIRECT_MUTATION_KEY = ["FIREBASE", "AUTH", "SIGN_IN_WITH_REDIRECT_MUTATION"];
|
|
13
|
+
export const SIGN_OUT_MUTATION_KEY = ["FIREBASE", "AUTH", "SIGN_OUT"];
|
|
14
|
+
export const REAUTHENTICATE_WITH_REDIRECT_MUTATION_KEY = ["FIREBASE", "AUTH", "REAUTHENTICATE_WITH_REDIRECT"];
|
|
15
|
+
export const REAUTHENTICATE_WITH_CREDENTIAL_MUTATION_KEY = [
|
|
16
|
+
"FIREBASE",
|
|
17
|
+
"AUTH",
|
|
18
|
+
"REAUTHENTICATE_WITH_CREDENTIAL"
|
|
19
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useAuthStateReady: () => boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useAuth } from "../useAuth";
|
|
2
|
+
import { useCallback, useEffect, useState } from "react";
|
|
3
|
+
export const useAuthStateReady = () => {
|
|
4
|
+
const firebaseAuth = useAuth();
|
|
5
|
+
const [isAuthStateReady, setIsAuthStateReady] = useState(false);
|
|
6
|
+
const callback = useCallback(async () => {
|
|
7
|
+
await firebaseAuth.authStateReady();
|
|
8
|
+
setIsAuthStateReady(true);
|
|
9
|
+
}, [isAuthStateReady]);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
callback();
|
|
12
|
+
}, [callback]);
|
|
13
|
+
return isAuthStateReady;
|
|
14
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
+
import { UserCredential } from "firebase/auth";
|
|
3
|
+
import { FirebaseError } from "firebase/app";
|
|
4
|
+
export type UseCreateUserWitEmailAndPasswordMutationVariables = {
|
|
5
|
+
email: string;
|
|
6
|
+
password: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const useCreateUserWitEmailAndPasswordMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<UserCredential, FirebaseError, UseCreateUserWitEmailAndPasswordMutationVariables, TContext>, "mutationKey" | "mutationFn">) => import("@tanstack/react-query").UseMutationResult<UserCredential, FirebaseError, UseCreateUserWitEmailAndPasswordMutationVariables, TContext>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useMutation } from "@tanstack/react-query";
|
|
2
|
+
import { createUserWithEmailAndPassword } from "firebase/auth";
|
|
3
|
+
import { useAuth } from "../useAuth";
|
|
4
|
+
import { CREATE_USER_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY } from "./mutation-keys";
|
|
5
|
+
export const useCreateUserWitEmailAndPasswordMutation = (options = {}) => {
|
|
6
|
+
const firebaseAuth = useAuth();
|
|
7
|
+
return useMutation({
|
|
8
|
+
...options,
|
|
9
|
+
mutationFn: async ({ email, password }) => await createUserWithEmailAndPassword(firebaseAuth, email, password),
|
|
10
|
+
mutationKey: CREATE_USER_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY
|
|
11
|
+
});
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useCurrentUser: () => import("firebase/auth").User | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useAuth } from "../useAuth";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
export const useCurrentUser = () => {
|
|
4
|
+
const firebaseAuth = useAuth();
|
|
5
|
+
const [currentUser, setCurrentUser] = useState(firebaseAuth.currentUser);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const unsubscribe = firebaseAuth.onAuthStateChanged((user) => {
|
|
8
|
+
setCurrentUser(user);
|
|
9
|
+
});
|
|
10
|
+
return () => {
|
|
11
|
+
unsubscribe();
|
|
12
|
+
};
|
|
13
|
+
}, [currentUser?.uid ?? ""]);
|
|
14
|
+
return currentUser;
|
|
15
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
+
import { User } from "firebase/auth";
|
|
3
|
+
import { FirebaseError } from "firebase/app";
|
|
4
|
+
export type UseSendEmailVerificationMutationVariables = {
|
|
5
|
+
user: User;
|
|
6
|
+
};
|
|
7
|
+
export declare const useSendEmailVerificationMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<void, FirebaseError, UseSendEmailVerificationMutationVariables, TContext>, "queryKey" | "queryFn">) => import("@tanstack/react-query").UseMutationResult<void, FirebaseError, UseSendEmailVerificationMutationVariables, TContext>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useMutation } from "@tanstack/react-query";
|
|
2
|
+
import { sendEmailVerification } from "firebase/auth";
|
|
3
|
+
import { SEND_EMAIL_VERIFICATION_MUTATION_KEY } from "./mutation-keys";
|
|
4
|
+
export const useSendEmailVerificationMutation = (options = {}) => {
|
|
5
|
+
return useMutation({
|
|
6
|
+
...options,
|
|
7
|
+
mutationFn: async ({ user }) => await sendEmailVerification(user),
|
|
8
|
+
mutationKey: SEND_EMAIL_VERIFICATION_MUTATION_KEY
|
|
9
|
+
});
|
|
10
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
+
import { UserCredential } from "firebase/auth";
|
|
3
|
+
import { FirebaseError } from "firebase/app";
|
|
4
|
+
export type UseSignInWitEmailAndPasswordMutationVariables = {
|
|
5
|
+
email: string;
|
|
6
|
+
password: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const useSignInWitEmailAndPasswordMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<UserCredential, FirebaseError, UseSignInWitEmailAndPasswordMutationVariables, TContext>, "mutationKey" | "mutationFn">) => import("@tanstack/react-query").UseMutationResult<UserCredential, FirebaseError, UseSignInWitEmailAndPasswordMutationVariables, TContext>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useMutation } from "@tanstack/react-query";
|
|
2
|
+
import { signInWithEmailAndPassword } from "firebase/auth";
|
|
3
|
+
import { useAuth } from "../useAuth";
|
|
4
|
+
import { SIGN_IN_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY } from "./mutation-keys";
|
|
5
|
+
export const useSignInWitEmailAndPasswordMutation = (options = {}) => {
|
|
6
|
+
const firebaseAuth = useAuth();
|
|
7
|
+
return useMutation({
|
|
8
|
+
...options,
|
|
9
|
+
mutationFn: async ({ email, password }) => signInWithEmailAndPassword(firebaseAuth, email, password),
|
|
10
|
+
mutationKey: SIGN_IN_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY
|
|
11
|
+
});
|
|
12
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
+
import { AuthProvider, PopupRedirectResolver } from "firebase/auth";
|
|
3
|
+
import { FirebaseError } from "firebase/app";
|
|
4
|
+
export type UseSignInWitRedirectMutationVariables = {
|
|
5
|
+
authProvider: AuthProvider;
|
|
6
|
+
popupRedirectResolver?: PopupRedirectResolver;
|
|
7
|
+
};
|
|
8
|
+
export declare const useSignInWitRedirectMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<void, FirebaseError, UseSignInWitRedirectMutationVariables, TContext>, "mutationKey" | "mutationFn">) => import("@tanstack/react-query").UseMutationResult<void, FirebaseError, UseSignInWitRedirectMutationVariables, TContext>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useMutation } from "@tanstack/react-query";
|
|
2
|
+
import { signInWithRedirect } from "firebase/auth";
|
|
3
|
+
import { useAuth } from "../useAuth";
|
|
4
|
+
import { SIGN_IN_WITH_REDIRECT_MUTATION_KEY } from "./mutation-keys";
|
|
5
|
+
export const useSignInWitRedirectMutation = (options = {}) => {
|
|
6
|
+
const firebaseAuth = useAuth();
|
|
7
|
+
return useMutation({
|
|
8
|
+
...options,
|
|
9
|
+
mutationFn: async ({ authProvider, popupRedirectResolver }) => signInWithRedirect(firebaseAuth, authProvider, popupRedirectResolver),
|
|
10
|
+
mutationKey: SIGN_IN_WITH_REDIRECT_MUTATION_KEY
|
|
11
|
+
});
|
|
12
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
+
import { FirebaseError } from "firebase/app";
|
|
3
|
+
export declare const useSignOutMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<void, FirebaseError, void, TContext>, "queryKey" | "queryFn">) => import("@tanstack/react-query").UseMutationResult<void, FirebaseError, void, TContext>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useMutation } from "@tanstack/react-query";
|
|
2
|
+
import { signOut } from "firebase/auth";
|
|
3
|
+
import { SIGN_OUT_MUTATION_KEY } from "./mutation-keys";
|
|
4
|
+
import { useAuth } from "../useAuth";
|
|
5
|
+
export const useSignOutMutation = (options = {}) => {
|
|
6
|
+
const firebaseAuth = useAuth();
|
|
7
|
+
return useMutation({
|
|
8
|
+
...options,
|
|
9
|
+
mutationFn: async () => await signOut(firebaseAuth),
|
|
10
|
+
mutationKey: SIGN_OUT_MUTATION_KEY
|
|
11
|
+
});
|
|
12
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
+
import { User } from "firebase/auth";
|
|
3
|
+
import { FirebaseError } from "firebase/app";
|
|
4
|
+
export type UseUpdateProfileMutationVariables = {
|
|
5
|
+
displayName?: string;
|
|
6
|
+
user: User;
|
|
7
|
+
};
|
|
8
|
+
export declare const useUpdateProfileMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<void, FirebaseError, UseUpdateProfileMutationVariables, TContext>, "mutationKey" | "mutationFn">) => import("@tanstack/react-query").UseMutationResult<void, FirebaseError, UseUpdateProfileMutationVariables, TContext>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useMutation } from "@tanstack/react-query";
|
|
2
|
+
import { updateProfile } from "firebase/auth";
|
|
3
|
+
import { CREATE_USER_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY } from "./mutation-keys";
|
|
4
|
+
export const useUpdateProfileMutation = (options = {}) => {
|
|
5
|
+
return useMutation({
|
|
6
|
+
...options,
|
|
7
|
+
mutationFn: async ({ displayName, user }) => await updateProfile(user, { displayName }),
|
|
8
|
+
mutationKey: CREATE_USER_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY
|
|
9
|
+
});
|
|
10
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./useAddDocMutation";
|
|
2
|
+
export * from "./useBatchWrite";
|
|
3
|
+
export * from "./useCollectionReference";
|
|
4
|
+
export * from "./useCompositeFilter";
|
|
5
|
+
export * from "./useCountQuery";
|
|
6
|
+
export * from "./useDeleteDocMutation";
|
|
7
|
+
export * from "./useDocReference";
|
|
8
|
+
export * from "./useDocReferences";
|
|
9
|
+
export * from "./useGetDocData";
|
|
10
|
+
export * from "./useInfiniteQuery";
|
|
11
|
+
export * from "./useQuery";
|
|
12
|
+
export * from "./useRunTransaction";
|
|
13
|
+
export * from "./useSetDocMutation";
|
|
14
|
+
export * from "./useUpdateDocMutation";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./useAddDocMutation";
|
|
2
|
+
export * from "./useBatchWrite";
|
|
3
|
+
export * from "./useCollectionReference";
|
|
4
|
+
export * from "./useCompositeFilter";
|
|
5
|
+
export * from "./useCountQuery";
|
|
6
|
+
export * from "./useDeleteDocMutation";
|
|
7
|
+
export * from "./useDocReference";
|
|
8
|
+
export * from "./useDocReferences";
|
|
9
|
+
export * from "./useGetDocData";
|
|
10
|
+
export * from "./useInfiniteQuery";
|
|
11
|
+
export * from "./useQuery";
|
|
12
|
+
export * from "./useRunTransaction";
|
|
13
|
+
export * from "./useSetDocMutation";
|
|
14
|
+
export * from "./useUpdateDocMutation";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
+
import { DocumentData, WithFieldValue, CollectionReference, FirestoreDataConverter } from "firebase/firestore";
|
|
3
|
+
import { FirebaseError } from "firebase/app";
|
|
4
|
+
export type UseAddDocMutationValues<AppModelType> = {
|
|
5
|
+
data: WithFieldValue<AppModelType>;
|
|
6
|
+
};
|
|
7
|
+
export type UseAddDocMutationOptions<AppModelType extends DocumentData = DocumentData, DbModelType extends DocumentData = DocumentData, TContext = unknown> = {
|
|
8
|
+
reference: CollectionReference<AppModelType, DbModelType>;
|
|
9
|
+
converter?: FirestoreDataConverter<AppModelType, DbModelType>;
|
|
10
|
+
options?: Omit<UseMutationOptions<AppModelType, FirebaseError, UseAddDocMutationValues<AppModelType>, TContext>, "mutationFn" | "mutationKey">;
|
|
11
|
+
};
|
|
12
|
+
export declare const useAddDocMutation: <AppModelType extends DocumentData = DocumentData, DbModelType extends DocumentData = DocumentData, TContext = unknown>({ reference, converter, options }: UseAddDocMutationOptions<AppModelType, DbModelType, TContext>) => import("@tanstack/react-query").UseMutationResult<AppModelType, FirebaseError, UseAddDocMutationValues<AppModelType>, TContext>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useMutation } from "@tanstack/react-query";
|
|
2
|
+
import { addDoc, getDoc } from "firebase/firestore";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
export const useAddDocMutation = ({ reference, converter, options = {} }) => {
|
|
5
|
+
const mutationKey = useMemo(() => [reference.path], [reference.path]);
|
|
6
|
+
return useMutation({
|
|
7
|
+
...options,
|
|
8
|
+
mutationFn: async ({ data }) => {
|
|
9
|
+
const docRef = await addDoc(reference, data);
|
|
10
|
+
const docSnap = await getDoc(converter ? docRef.withConverter(converter) : docRef);
|
|
11
|
+
return docSnap.data();
|
|
12
|
+
},
|
|
13
|
+
mutationKey
|
|
14
|
+
});
|
|
15
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
+
import { WriteBatch } from "firebase/firestore";
|
|
3
|
+
import { FirebaseError } from "firebase/app";
|
|
4
|
+
export type UseBatchWriteVariables = (batch: WriteBatch) => Promise<void> | void;
|
|
5
|
+
export type UseBatchWriteOptions<TContext = unknown> = {
|
|
6
|
+
options?: Omit<UseMutationOptions<void, FirebaseError, UseBatchWriteVariables, TContext>, "mutationFn">;
|
|
7
|
+
};
|
|
8
|
+
export declare const useBatchWrite: <TContext = unknown>({ options }?: UseBatchWriteOptions<TContext>) => import("@tanstack/react-query").UseMutationResult<void, FirebaseError, UseBatchWriteVariables, TContext>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useMutation } from "@tanstack/react-query";
|
|
2
|
+
import { writeBatch } from "firebase/firestore";
|
|
3
|
+
import { useFirestore } from "../useFirestore";
|
|
4
|
+
export const useBatchWrite = ({ options = {} } = {}) => {
|
|
5
|
+
const db = useFirestore();
|
|
6
|
+
return useMutation({
|
|
7
|
+
...options,
|
|
8
|
+
mutationFn: async (batchWriteFn) => {
|
|
9
|
+
const batch = writeBatch(db);
|
|
10
|
+
await batchWriteFn(batch);
|
|
11
|
+
return batch.commit();
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CollectionReference, DocumentData, DocumentReference } from "firebase/firestore";
|
|
2
|
+
export type UseCollectionReferenceOptions<AppModelType, DbModelType extends DocumentData = DocumentData> = {
|
|
3
|
+
reference?: CollectionReference<AppModelType, DbModelType> | DocumentReference<AppModelType, DbModelType>;
|
|
4
|
+
path: string;
|
|
5
|
+
pathSegments?: string[];
|
|
6
|
+
};
|
|
7
|
+
export declare const useCollectionReference: <AppModelType, DbModelType extends DocumentData = DocumentData>({ path, reference, pathSegments }: UseCollectionReferenceOptions<AppModelType, DbModelType>) => CollectionReference<DocumentData, DocumentData>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { collection } from "firebase/firestore";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useFirestore } from "../useFirestore";
|
|
4
|
+
export const useCollectionReference = ({ path, reference, pathSegments }) => {
|
|
5
|
+
const db = useFirestore();
|
|
6
|
+
return useMemo(() => {
|
|
7
|
+
return !reference
|
|
8
|
+
? collection(db, path || "", ...(pathSegments || []))
|
|
9
|
+
: reference.type === "collection"
|
|
10
|
+
? collection(reference, path, ...(pathSegments || []))
|
|
11
|
+
: collection(reference, path, ...(pathSegments || []));
|
|
12
|
+
}, [path, reference?.path, pathSegments]);
|
|
13
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DocumentData, QueryCompositeFilterConstraint, WhereFilterOp } from "firebase/firestore";
|
|
2
|
+
type CompositeFilterDocumentData = DocumentData;
|
|
3
|
+
export type QueryElement<DbModelType extends CompositeFilterDocumentData = CompositeFilterDocumentData> = Partial<QueryCompositeFilterConstraint> & {
|
|
4
|
+
children?: QueryElement[];
|
|
5
|
+
field?: keyof (DbModelType & {
|
|
6
|
+
documentId?: string[];
|
|
7
|
+
});
|
|
8
|
+
value?: DbModelType[keyof DbModelType];
|
|
9
|
+
op?: WhereFilterOp;
|
|
10
|
+
};
|
|
11
|
+
export type CompositeFilter<DbModelType extends CompositeFilterDocumentData = CompositeFilterDocumentData> = QueryCompositeFilterConstraint & {
|
|
12
|
+
children: QueryElement<DbModelType & {
|
|
13
|
+
documentId?: string[];
|
|
14
|
+
}>[];
|
|
15
|
+
};
|
|
16
|
+
export type UseCompositeFilter<DbModelType extends CompositeFilterDocumentData = CompositeFilterDocumentData> = {
|
|
17
|
+
query?: CompositeFilter<DbModelType>;
|
|
18
|
+
};
|
|
19
|
+
export declare const useCompositeFilter: <DbModelType extends CompositeFilterDocumentData = DocumentData>({ query }: UseCompositeFilter<DbModelType>) => QueryCompositeFilterConstraint | undefined;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { and, documentId, or, where } from "firebase/firestore";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
const buildCompositeQuery = (query) => {
|
|
4
|
+
if (query.children) {
|
|
5
|
+
const queryConstraints = query.children
|
|
6
|
+
.map((subQuery) => buildCompositeQuery(subQuery))
|
|
7
|
+
.filter((constraint) => !!constraint);
|
|
8
|
+
if (queryConstraints.length <= 0) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return query.type === "or" ? or(...queryConstraints) : and(...queryConstraints);
|
|
12
|
+
}
|
|
13
|
+
if (query.field && query.op) {
|
|
14
|
+
return where(query.field === "documentId" ? documentId() : query.field, query.op, query.value);
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
};
|
|
18
|
+
export const useCompositeFilter = ({ query }) => {
|
|
19
|
+
return useMemo(() => {
|
|
20
|
+
const queryConstraints = (query?.children?.map?.((subQuery) => buildCompositeQuery(subQuery))?.filter)?.((constraint) => !!constraint) ?? [];
|
|
21
|
+
if (queryConstraints.length <= 0) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
return query?.type === "or" ? or(...queryConstraints) : and(...queryConstraints);
|
|
25
|
+
}, [query]);
|
|
26
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DocumentData, Query, QueryCompositeFilterConstraint, QueryConstraint, QueryNonFilterConstraint } from "firebase/firestore";
|
|
2
|
+
import { UseQueryResult, UseQueryOptions as UseReactQueryOptions } from "@tanstack/react-query";
|
|
3
|
+
type UseCountQueryOptions<AppModelType extends DocumentData = DocumentData, DbModelType extends DocumentData = DocumentData> = {
|
|
4
|
+
options: Omit<UseReactQueryOptions<number, Error, number>, "queryFn"> & Required<Pick<UseReactQueryOptions<number, Error, number>, "queryKey">>;
|
|
5
|
+
query: Query<AppModelType, DbModelType>;
|
|
6
|
+
queryConstraints?: QueryConstraint[] | QueryNonFilterConstraint[];
|
|
7
|
+
compositeFilter?: QueryCompositeFilterConstraint;
|
|
8
|
+
};
|
|
9
|
+
export declare const useCountQuery: <AppModelType extends DocumentData = DocumentData, DbModelType extends DocumentData = DocumentData>({ options, query: queryReference, queryConstraints, compositeFilter }: UseCountQueryOptions<AppModelType, DbModelType>) => UseQueryResult<number>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { getCountFromServer, query } from "firebase/firestore";
|
|
2
|
+
import { useQuery as useReactQuery } from "@tanstack/react-query";
|
|
3
|
+
export const useCountQuery = ({ options, query: queryReference, queryConstraints = [], compositeFilter }) => {
|
|
4
|
+
return useReactQuery({
|
|
5
|
+
...options,
|
|
6
|
+
queryFn: async () => {
|
|
7
|
+
const queryToExecute = compositeFilter
|
|
8
|
+
? query(queryReference, compositeFilter, ...queryConstraints)
|
|
9
|
+
: query(queryReference, ...queryConstraints);
|
|
10
|
+
const querySnapshot = await getCountFromServer(queryToExecute);
|
|
11
|
+
if (querySnapshot) {
|
|
12
|
+
return querySnapshot.data().count;
|
|
13
|
+
}
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
+
import { DocumentData, WithFieldValue, DocumentReference } from "firebase/firestore";
|
|
3
|
+
import { FirebaseError } from "firebase/app";
|
|
4
|
+
export type UseDeleteDocMutationValues<AppModelType> = {
|
|
5
|
+
data: WithFieldValue<AppModelType>;
|
|
6
|
+
};
|
|
7
|
+
export type UseDeleteDocMutationOptions<AppModelType extends DocumentData = DocumentData, DbModelType extends DocumentData = DocumentData, TContext = unknown> = {
|
|
8
|
+
reference: DocumentReference<AppModelType, DbModelType> | null;
|
|
9
|
+
options?: Omit<UseMutationOptions<void, FirebaseError, void, TContext>, "mutationFn" | "mutationKey">;
|
|
10
|
+
};
|
|
11
|
+
export declare const useDeleteDocMutation: <AppModelType extends DocumentData = DocumentData, DbModelType extends DocumentData = DocumentData, TContext = unknown>({ reference, options }: UseDeleteDocMutationOptions<AppModelType, DbModelType, TContext>) => import("@tanstack/react-query").UseMutationResult<void, FirebaseError, void, TContext>;
|