reactfire 4.0.0 → 4.0.1-exp.f6d2351
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/README.md +12 -3
- package/dist/SuspenseSubject.d.ts +21 -21
- package/dist/auth.d.ts +104 -104
- package/dist/database.d.ts +23 -23
- package/dist/firebaseApp.d.ts +14 -14
- package/dist/firestore.d.ts +35 -35
- package/dist/functions.d.ts +12 -0
- package/dist/index.d.ts +36 -35
- package/dist/index.js +2337 -5
- package/dist/index.js.map +1 -0
- package/dist/index.umd.cjs +122 -0
- package/dist/index.umd.cjs.map +1 -0
- package/dist/performance.d.ts +7 -7
- package/dist/{remote-config/index.d.ts → remote-config.d.ts} +30 -35
- package/dist/sdk.d.ts +70 -43
- package/dist/storage.d.ts +26 -26
- package/dist/useObservable.d.ts +41 -41
- package/package.json +56 -54
- package/src/SuspenseSubject.ts +6 -4
- package/src/auth.tsx +6 -6
- package/src/firebaseApp.tsx +2 -2
- package/src/functions.tsx +26 -0
- package/src/index.ts +1 -0
- package/src/{remote-config/index.tsx → remote-config.tsx} +4 -16
- package/src/sdk.tsx +26 -27
- package/src/storage.tsx +2 -24
- package/src/useObservable.ts +48 -28
- package/dist/reactfire.cjs.development.js +0 -2147
- package/dist/reactfire.cjs.development.js.map +0 -1
- package/dist/reactfire.cjs.production.min.js +0 -2
- package/dist/reactfire.cjs.production.min.js.map +0 -1
- package/dist/reactfire.esm.js +0 -2089
- package/dist/reactfire.esm.js.map +0 -1
- package/dist/remote-config/getValue.d.ts +0 -10
- package/src/remote-config/getValue.tsx +0 -58
package/README.md
CHANGED
|
@@ -28,7 +28,6 @@ Depending on your targeted platforms you may need to install polyfills. The most
|
|
|
28
28
|
## Docs
|
|
29
29
|
|
|
30
30
|
- [**Quickstart**](./docs/quickstart.md)
|
|
31
|
-
- Advanced: If you're using Concurrent Mode, check out the [Concurrent Mode quickstart](./docs/quickstart-concurrent-mode.md)
|
|
32
31
|
- [**Common Use Cases**](./docs/use.md)
|
|
33
32
|
- [**API Reference**](./docs/reference)
|
|
34
33
|
- [**v3 -> v4 Upgrade Guide**](./docs/upgrade-guide.md)
|
|
@@ -92,7 +91,17 @@ This repository is maintained by Googlers but is not a supported Firebase produc
|
|
|
92
91
|
|
|
93
92
|
### Extra Experimental [concurrent mode](https://reactjs.org/docs/concurrent-mode-suspense.html) features
|
|
94
93
|
|
|
94
|
+
These features are marked as *extra experimental* because they use experimental React features that [will not be stable until sometime after React 18 is released](https://github.com/reactwg/react-18/discussions/47#:~:text=Likely%20after%20React%2018.0%3A%20Suspense%20for%20Data%20Fetching).
|
|
95
|
+
|
|
95
96
|
- **Loading states handled by `<Suspense>`** - ReactFire's hooks throw promises
|
|
96
|
-
that Suspense can catch.
|
|
97
|
-
[handle
|
|
97
|
+
that Suspense can catch. Let React
|
|
98
|
+
[handle loading states for you](https://reactjs.org/docs/concurrent-mode-suspense.html).
|
|
98
99
|
- **Automatically instrument your `Suspense` load times** - Need to automatically instrument your `Suspense` load times with [RUM](https://firebase.google.com/docs/perf-mon)? Use `<SuspenseWithPerf />`.
|
|
100
|
+
|
|
101
|
+
Enable concurrent mode features by following the [concurrent mode setup guide](https://reactjs.org/docs/concurrent-mode-adoption.html#installation) and then setting the `suspense` prop in `FirebaseAppProvider`:
|
|
102
|
+
|
|
103
|
+
```jsx
|
|
104
|
+
<FirebaseAppProvider firebaseConfig={firebaseConfig} suspense={true}>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
See concurrent mode code samples in [example/withSuspense](https://github.com/FirebaseExtended/reactfire/tree/main/example/withSuspense)
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { Observable, Subject, Subscriber, Subscription } from 'rxjs';
|
|
2
|
-
export declare class SuspenseSubject<T> extends Subject<T> {
|
|
3
|
-
private _timeoutWindow;
|
|
4
|
-
private _value;
|
|
5
|
-
private _hasValue;
|
|
6
|
-
private _timeoutHandler;
|
|
7
|
-
private _firstEmission;
|
|
8
|
-
private _error;
|
|
9
|
-
private _innerObservable;
|
|
10
|
-
private _warmupSubscription;
|
|
11
|
-
private _innerSubscriber;
|
|
12
|
-
private _resolveFirstEmission;
|
|
13
|
-
constructor(innerObservable: Observable<T>, _timeoutWindow: number);
|
|
14
|
-
get hasValue(): boolean;
|
|
15
|
-
get value(): T
|
|
16
|
-
get firstEmission(): Promise<void>;
|
|
17
|
-
private _next;
|
|
18
|
-
private _reset;
|
|
19
|
-
_subscribe(subscriber: Subscriber<T>): Subscription;
|
|
20
|
-
get ourError(): any;
|
|
21
|
-
}
|
|
1
|
+
import { Observable, Subject, Subscriber, Subscription } from 'rxjs';
|
|
2
|
+
export declare class SuspenseSubject<T> extends Subject<T> {
|
|
3
|
+
private _timeoutWindow;
|
|
4
|
+
private _value;
|
|
5
|
+
private _hasValue;
|
|
6
|
+
private _timeoutHandler;
|
|
7
|
+
private _firstEmission;
|
|
8
|
+
private _error;
|
|
9
|
+
private _innerObservable;
|
|
10
|
+
private _warmupSubscription;
|
|
11
|
+
private _innerSubscriber;
|
|
12
|
+
private _resolveFirstEmission;
|
|
13
|
+
constructor(innerObservable: Observable<T>, _timeoutWindow: number);
|
|
14
|
+
get hasValue(): boolean;
|
|
15
|
+
get value(): T;
|
|
16
|
+
get firstEmission(): Promise<void>;
|
|
17
|
+
private _next;
|
|
18
|
+
private _reset;
|
|
19
|
+
_subscribe(subscriber: Subscriber<T>): Subscription;
|
|
20
|
+
get ourError(): any;
|
|
21
|
+
}
|
package/dist/auth.d.ts
CHANGED
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ReactFireOptions, ObservableStatus } from './';
|
|
3
|
-
import type { Auth, User, IdTokenResult } from 'firebase/auth';
|
|
4
|
-
declare type Claims = IdTokenResult['claims'];
|
|
5
|
-
export declare function preloadUser(authResolver: () => Promise<Auth>): Promise<User | null | undefined>;
|
|
6
|
-
/**
|
|
7
|
-
* Subscribe to Firebase auth state changes, including token refresh
|
|
8
|
-
*
|
|
9
|
-
* @param options
|
|
10
|
-
*/
|
|
11
|
-
export declare function useUser<T = unknown>(options?: ReactFireOptions<T>): ObservableStatus<User | null>;
|
|
12
|
-
export declare function useIdTokenResult(user: User, forceRefresh?: boolean, options?: ReactFireOptions<IdTokenResult>): ObservableStatus<IdTokenResult>;
|
|
13
|
-
export interface AuthCheckProps {
|
|
14
|
-
fallback: React.ReactNode;
|
|
15
|
-
children: React.ReactNode;
|
|
16
|
-
requiredClaims?: Object;
|
|
17
|
-
}
|
|
18
|
-
export interface ClaimsCheckProps {
|
|
19
|
-
user: User;
|
|
20
|
-
fallback: React.ReactNode;
|
|
21
|
-
children: React.ReactNode;
|
|
22
|
-
requiredClaims: {
|
|
23
|
-
[key: string]: any;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export interface ClaimCheckErrors {
|
|
27
|
-
[key: string]: any[];
|
|
28
|
-
}
|
|
29
|
-
export declare type SigninCheckResult = {
|
|
30
|
-
signedIn: false;
|
|
31
|
-
hasRequiredClaims: false;
|
|
32
|
-
errors: {};
|
|
33
|
-
user: null;
|
|
34
|
-
} | {
|
|
35
|
-
signedIn: true;
|
|
36
|
-
hasRequiredClaims: boolean;
|
|
37
|
-
errors: ClaimCheckErrors;
|
|
38
|
-
user: User;
|
|
39
|
-
};
|
|
40
|
-
export interface SignInCheckOptionsBasic extends ReactFireOptions<SigninCheckResult> {
|
|
41
|
-
forceRefresh?: boolean;
|
|
42
|
-
}
|
|
43
|
-
export interface SignInCheckOptionsClaimsObject extends SignInCheckOptionsBasic {
|
|
44
|
-
requiredClaims: Claims;
|
|
45
|
-
}
|
|
46
|
-
export interface ClaimsValidator {
|
|
47
|
-
(claims: Claims): {
|
|
48
|
-
hasRequiredClaims: boolean;
|
|
49
|
-
errors: ClaimCheckErrors | {};
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
export interface SignInCheckOptionsClaimsValidator extends SignInCheckOptionsBasic {
|
|
53
|
-
validateCustomClaims: ClaimsValidator;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Subscribe to the signed-in status of a user.
|
|
57
|
-
*
|
|
58
|
-
* ```ts
|
|
59
|
-
* const { status, data:signInCheckResult } = useSigninCheck();
|
|
60
|
-
*
|
|
61
|
-
* if (status === 'loading') {
|
|
62
|
-
* return <LoadingSpinner />}
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* if (signInCheckResult.signedIn === true) {
|
|
66
|
-
* return <ProfilePage user={signInCheckResult.user}/>
|
|
67
|
-
* } else {
|
|
68
|
-
* return <SignInForm />
|
|
69
|
-
* }
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* Optionally check [custom claims](https://firebase.google.com/docs/auth/admin/custom-claims) of a user as well.
|
|
73
|
-
*
|
|
74
|
-
* ```ts
|
|
75
|
-
* // pass in an object describing the custom claims a user must have
|
|
76
|
-
* const {status, data: signInCheckResult} = useSignInCheck({requiredClaims: {admin: true}});
|
|
77
|
-
*
|
|
78
|
-
* // pass in a custom claims validator function
|
|
79
|
-
* const {status, data: signInCheckResult} = useSignInCheck({validateCustomClaims: (userClaims) => {
|
|
80
|
-
* // custom validation logic...
|
|
81
|
-
* }});
|
|
82
|
-
*
|
|
83
|
-
* // You can optionally force-refresh the token
|
|
84
|
-
* const {status, data: signInCheckResult} = useSignInCheck({forceRefresh: true, requiredClaims: {admin: true}});
|
|
85
|
-
* ```
|
|
86
|
-
*/
|
|
87
|
-
export declare function useSigninCheck(options?: SignInCheckOptionsBasic | SignInCheckOptionsClaimsObject | SignInCheckOptionsClaimsValidator): ObservableStatus<SigninCheckResult>;
|
|
88
|
-
/**
|
|
89
|
-
* @deprecated Use `useSignInCheck` instead
|
|
90
|
-
*
|
|
91
|
-
* Conditionally render children based on [custom claims](https://firebase.google.com/docs/auth/admin/custom-claims).
|
|
92
|
-
*
|
|
93
|
-
* Meant for Concurrent mode only (`<FirebaseAppProvider suspense=true />`). [More detail](https://github.com/FirebaseExtended/reactfire/issues/325#issuecomment-827654376).
|
|
94
|
-
*/
|
|
95
|
-
export declare function ClaimsCheck({ user, fallback, children, requiredClaims }: ClaimsCheckProps): JSX.Element;
|
|
96
|
-
/**
|
|
97
|
-
* @deprecated Use `useSignInCheck` instead
|
|
98
|
-
*
|
|
99
|
-
* Conditionally render children based on signed-in status and [custom claims](https://firebase.google.com/docs/auth/admin/custom-claims).
|
|
100
|
-
*
|
|
101
|
-
* Meant for Concurrent mode only (`<FirebaseAppProvider suspense=true />`). [More detail](https://github.com/FirebaseExtended/reactfire/issues/325#issuecomment-827654376).
|
|
102
|
-
*/
|
|
103
|
-
export declare function AuthCheck({ fallback, children, requiredClaims }: AuthCheckProps): JSX.Element;
|
|
104
|
-
export {};
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ReactFireOptions, ObservableStatus } from './';
|
|
3
|
+
import type { Auth, User, IdTokenResult } from 'firebase/auth';
|
|
4
|
+
declare type Claims = IdTokenResult['claims'];
|
|
5
|
+
export declare function preloadUser(authResolver: () => Promise<Auth>): Promise<User | null | undefined>;
|
|
6
|
+
/**
|
|
7
|
+
* Subscribe to Firebase auth state changes, including token refresh
|
|
8
|
+
*
|
|
9
|
+
* @param options
|
|
10
|
+
*/
|
|
11
|
+
export declare function useUser<T = unknown>(options?: ReactFireOptions<T>): ObservableStatus<User | null>;
|
|
12
|
+
export declare function useIdTokenResult(user: User, forceRefresh?: boolean, options?: ReactFireOptions<IdTokenResult>): ObservableStatus<IdTokenResult>;
|
|
13
|
+
export interface AuthCheckProps {
|
|
14
|
+
fallback: React.ReactNode;
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
requiredClaims?: Object;
|
|
17
|
+
}
|
|
18
|
+
export interface ClaimsCheckProps {
|
|
19
|
+
user: User;
|
|
20
|
+
fallback: React.ReactNode;
|
|
21
|
+
children: React.ReactNode;
|
|
22
|
+
requiredClaims: {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface ClaimCheckErrors {
|
|
27
|
+
[key: string]: any[];
|
|
28
|
+
}
|
|
29
|
+
export declare type SigninCheckResult = {
|
|
30
|
+
signedIn: false;
|
|
31
|
+
hasRequiredClaims: false;
|
|
32
|
+
errors: {};
|
|
33
|
+
user: null;
|
|
34
|
+
} | {
|
|
35
|
+
signedIn: true;
|
|
36
|
+
hasRequiredClaims: boolean;
|
|
37
|
+
errors: ClaimCheckErrors;
|
|
38
|
+
user: User;
|
|
39
|
+
};
|
|
40
|
+
export interface SignInCheckOptionsBasic extends ReactFireOptions<SigninCheckResult> {
|
|
41
|
+
forceRefresh?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface SignInCheckOptionsClaimsObject extends SignInCheckOptionsBasic {
|
|
44
|
+
requiredClaims: Claims;
|
|
45
|
+
}
|
|
46
|
+
export interface ClaimsValidator {
|
|
47
|
+
(claims: Claims): {
|
|
48
|
+
hasRequiredClaims: boolean;
|
|
49
|
+
errors: ClaimCheckErrors | {};
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export interface SignInCheckOptionsClaimsValidator extends SignInCheckOptionsBasic {
|
|
53
|
+
validateCustomClaims: ClaimsValidator;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Subscribe to the signed-in status of a user.
|
|
57
|
+
*
|
|
58
|
+
* ```ts
|
|
59
|
+
* const { status, data:signInCheckResult } = useSigninCheck();
|
|
60
|
+
*
|
|
61
|
+
* if (status === 'loading') {
|
|
62
|
+
* return <LoadingSpinner />}
|
|
63
|
+
*
|
|
64
|
+
*
|
|
65
|
+
* if (signInCheckResult.signedIn === true) {
|
|
66
|
+
* return <ProfilePage user={signInCheckResult.user}/>
|
|
67
|
+
* } else {
|
|
68
|
+
* return <SignInForm />
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* Optionally check [custom claims](https://firebase.google.com/docs/auth/admin/custom-claims) of a user as well.
|
|
73
|
+
*
|
|
74
|
+
* ```ts
|
|
75
|
+
* // pass in an object describing the custom claims a user must have
|
|
76
|
+
* const {status, data: signInCheckResult} = useSignInCheck({requiredClaims: {admin: true}});
|
|
77
|
+
*
|
|
78
|
+
* // pass in a custom claims validator function
|
|
79
|
+
* const {status, data: signInCheckResult} = useSignInCheck({validateCustomClaims: (userClaims) => {
|
|
80
|
+
* // custom validation logic...
|
|
81
|
+
* }});
|
|
82
|
+
*
|
|
83
|
+
* // You can optionally force-refresh the token
|
|
84
|
+
* const {status, data: signInCheckResult} = useSignInCheck({forceRefresh: true, requiredClaims: {admin: true}});
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export declare function useSigninCheck(options?: SignInCheckOptionsBasic | SignInCheckOptionsClaimsObject | SignInCheckOptionsClaimsValidator): ObservableStatus<SigninCheckResult>;
|
|
88
|
+
/**
|
|
89
|
+
* @deprecated Use `useSignInCheck` instead
|
|
90
|
+
*
|
|
91
|
+
* Conditionally render children based on [custom claims](https://firebase.google.com/docs/auth/admin/custom-claims).
|
|
92
|
+
*
|
|
93
|
+
* Meant for Concurrent mode only (`<FirebaseAppProvider suspense=true />`). [More detail](https://github.com/FirebaseExtended/reactfire/issues/325#issuecomment-827654376).
|
|
94
|
+
*/
|
|
95
|
+
export declare function ClaimsCheck({ user, fallback, children, requiredClaims }: ClaimsCheckProps): JSX.Element;
|
|
96
|
+
/**
|
|
97
|
+
* @deprecated Use `useSignInCheck` instead
|
|
98
|
+
*
|
|
99
|
+
* Conditionally render children based on signed-in status and [custom claims](https://firebase.google.com/docs/auth/admin/custom-claims).
|
|
100
|
+
*
|
|
101
|
+
* Meant for Concurrent mode only (`<FirebaseAppProvider suspense=true />`). [More detail](https://github.com/FirebaseExtended/reactfire/issues/325#issuecomment-827654376).
|
|
102
|
+
*/
|
|
103
|
+
export declare function AuthCheck({ fallback, children, requiredClaims }: AuthCheckProps): JSX.Element;
|
|
104
|
+
export {};
|
package/dist/database.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { QueryChange } from 'rxfire/database';
|
|
2
|
-
import { ReactFireOptions, ObservableStatus } from './';
|
|
3
|
-
import type { Query as DatabaseQuery, DatabaseReference } from 'firebase/database';
|
|
4
|
-
/**
|
|
5
|
-
* Subscribe to a Realtime Database object
|
|
6
|
-
*
|
|
7
|
-
* @param ref - Reference to the DB object you want to listen to
|
|
8
|
-
* @param options
|
|
9
|
-
*/
|
|
10
|
-
export declare function useDatabaseObject<T = unknown>(ref: DatabaseReference, options?: ReactFireOptions<T>): ObservableStatus<QueryChange | T>;
|
|
11
|
-
export declare function useDatabaseObjectData<T>(ref: DatabaseReference, options?: ReactFireOptions<T>): ObservableStatus<T>;
|
|
12
|
-
/**
|
|
13
|
-
* Subscribe to a Realtime Database list
|
|
14
|
-
*
|
|
15
|
-
* @param ref - Reference to the DB List you want to listen to
|
|
16
|
-
* @param options
|
|
17
|
-
*/
|
|
18
|
-
export declare function useDatabaseList<T = {
|
|
19
|
-
[key: string]: unknown;
|
|
20
|
-
}>(ref: DatabaseReference | DatabaseQuery, options?: ReactFireOptions<T[]>): ObservableStatus<QueryChange[] | T[]>;
|
|
21
|
-
export declare function useDatabaseListData<T = {
|
|
22
|
-
[key: string]: unknown;
|
|
23
|
-
}>(ref: DatabaseReference | DatabaseQuery, options?: ReactFireOptions<T[]>): ObservableStatus<T[] | null>;
|
|
1
|
+
import { QueryChange } from 'rxfire/database';
|
|
2
|
+
import { ReactFireOptions, ObservableStatus } from './';
|
|
3
|
+
import type { Query as DatabaseQuery, DatabaseReference } from 'firebase/database';
|
|
4
|
+
/**
|
|
5
|
+
* Subscribe to a Realtime Database object
|
|
6
|
+
*
|
|
7
|
+
* @param ref - Reference to the DB object you want to listen to
|
|
8
|
+
* @param options
|
|
9
|
+
*/
|
|
10
|
+
export declare function useDatabaseObject<T = unknown>(ref: DatabaseReference, options?: ReactFireOptions<T>): ObservableStatus<QueryChange | T>;
|
|
11
|
+
export declare function useDatabaseObjectData<T>(ref: DatabaseReference, options?: ReactFireOptions<T>): ObservableStatus<T>;
|
|
12
|
+
/**
|
|
13
|
+
* Subscribe to a Realtime Database list
|
|
14
|
+
*
|
|
15
|
+
* @param ref - Reference to the DB List you want to listen to
|
|
16
|
+
* @param options
|
|
17
|
+
*/
|
|
18
|
+
export declare function useDatabaseList<T = {
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}>(ref: DatabaseReference | DatabaseQuery, options?: ReactFireOptions<T[]>): ObservableStatus<QueryChange[] | T[]>;
|
|
21
|
+
export declare function useDatabaseListData<T = {
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
}>(ref: DatabaseReference | DatabaseQuery, options?: ReactFireOptions<T[]>): ObservableStatus<T[] | null>;
|
package/dist/firebaseApp.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { FirebaseApp, FirebaseOptions } from 'firebase/app';
|
|
3
|
-
interface FirebaseAppProviderProps {
|
|
4
|
-
firebaseApp?: FirebaseApp;
|
|
5
|
-
firebaseConfig?: FirebaseOptions;
|
|
6
|
-
appName?: string;
|
|
7
|
-
suspense?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare const version:
|
|
10
|
-
export declare function FirebaseAppProvider(props: React.PropsWithChildren<FirebaseAppProviderProps>): JSX.Element;
|
|
11
|
-
export declare function useIsSuspenseEnabled(): boolean;
|
|
12
|
-
export declare function useSuspenseEnabledFromConfigAndContext(suspenseFromConfig?: boolean): boolean;
|
|
13
|
-
export declare function useFirebaseApp(): FirebaseApp;
|
|
14
|
-
export {};
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { FirebaseApp, FirebaseOptions } from 'firebase/app';
|
|
3
|
+
interface FirebaseAppProviderProps {
|
|
4
|
+
firebaseApp?: FirebaseApp;
|
|
5
|
+
firebaseConfig?: FirebaseOptions;
|
|
6
|
+
appName?: string;
|
|
7
|
+
suspense?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const version: string;
|
|
10
|
+
export declare function FirebaseAppProvider(props: React.PropsWithChildren<FirebaseAppProviderProps>): JSX.Element;
|
|
11
|
+
export declare function useIsSuspenseEnabled(): boolean;
|
|
12
|
+
export declare function useSuspenseEnabledFromConfigAndContext(suspenseFromConfig?: boolean): boolean;
|
|
13
|
+
export declare function useFirebaseApp(): FirebaseApp;
|
|
14
|
+
export {};
|
package/dist/firestore.d.ts
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { ReactFireOptions } from './';
|
|
2
|
-
import { ObservableStatus } from './useObservable';
|
|
3
|
-
import { Query as FirestoreQuery, QuerySnapshot, DocumentReference, DocumentData, DocumentSnapshot } from 'firebase/firestore';
|
|
4
|
-
/**
|
|
5
|
-
* Preload a subscription to a Firestore document reference.
|
|
6
|
-
*
|
|
7
|
-
* Use this to warm up `useFirestoreDoc` for a specific document
|
|
8
|
-
*/
|
|
9
|
-
export declare function preloadFirestoreDoc(refProvider: () => Promise<DocumentReference>): Promise<import("./SuspenseSubject").SuspenseSubject<DocumentSnapshot<DocumentData>>>;
|
|
10
|
-
/**
|
|
11
|
-
* Suscribe to Firestore Document changes
|
|
12
|
-
*
|
|
13
|
-
* You can preload data for this hook by calling `preloadFirestoreDoc`
|
|
14
|
-
*/
|
|
15
|
-
export declare function useFirestoreDoc<T = DocumentData>(ref: DocumentReference<T>, options?: ReactFireOptions<T>): ObservableStatus<DocumentSnapshot<T>>;
|
|
16
|
-
/**
|
|
17
|
-
* Get a firestore document and don't subscribe to changes
|
|
18
|
-
*/
|
|
19
|
-
export declare function useFirestoreDocOnce<T = DocumentData>(ref: DocumentReference<T>, options?: ReactFireOptions<T>): ObservableStatus<DocumentSnapshot<T>>;
|
|
20
|
-
/**
|
|
21
|
-
* Suscribe to Firestore Document changes and unwrap the document into a plain object
|
|
22
|
-
*/
|
|
23
|
-
export declare function useFirestoreDocData<T = unknown>(ref: DocumentReference<T>, options?: ReactFireOptions<T>): ObservableStatus<T>;
|
|
24
|
-
/**
|
|
25
|
-
* Get a Firestore document, unwrap the document into a plain object, and don't subscribe to changes
|
|
26
|
-
*/
|
|
27
|
-
export declare function useFirestoreDocDataOnce<T = unknown>(ref: DocumentReference<T>, options?: ReactFireOptions<T>): ObservableStatus<T>;
|
|
28
|
-
/**
|
|
29
|
-
* Subscribe to a Firestore collection
|
|
30
|
-
*/
|
|
31
|
-
export declare function useFirestoreCollection<T = DocumentData>(query: FirestoreQuery<T>, options?: ReactFireOptions<T[]>): ObservableStatus<QuerySnapshot<T>>;
|
|
32
|
-
/**
|
|
33
|
-
* Subscribe to a Firestore collection and unwrap the snapshot into an array.
|
|
34
|
-
*/
|
|
35
|
-
export declare function useFirestoreCollectionData<T = DocumentData>(query: FirestoreQuery<T>, options?: ReactFireOptions<T[]>): ObservableStatus<T[]>;
|
|
1
|
+
import { ReactFireOptions } from './';
|
|
2
|
+
import { ObservableStatus } from './useObservable';
|
|
3
|
+
import { Query as FirestoreQuery, QuerySnapshot, DocumentReference, DocumentData, DocumentSnapshot } from 'firebase/firestore';
|
|
4
|
+
/**
|
|
5
|
+
* Preload a subscription to a Firestore document reference.
|
|
6
|
+
*
|
|
7
|
+
* Use this to warm up `useFirestoreDoc` for a specific document
|
|
8
|
+
*/
|
|
9
|
+
export declare function preloadFirestoreDoc(refProvider: () => Promise<DocumentReference>): Promise<import("./SuspenseSubject").SuspenseSubject<DocumentSnapshot<DocumentData>>>;
|
|
10
|
+
/**
|
|
11
|
+
* Suscribe to Firestore Document changes
|
|
12
|
+
*
|
|
13
|
+
* You can preload data for this hook by calling `preloadFirestoreDoc`
|
|
14
|
+
*/
|
|
15
|
+
export declare function useFirestoreDoc<T = DocumentData>(ref: DocumentReference<T>, options?: ReactFireOptions<T>): ObservableStatus<DocumentSnapshot<T>>;
|
|
16
|
+
/**
|
|
17
|
+
* Get a firestore document and don't subscribe to changes
|
|
18
|
+
*/
|
|
19
|
+
export declare function useFirestoreDocOnce<T = DocumentData>(ref: DocumentReference<T>, options?: ReactFireOptions<T>): ObservableStatus<DocumentSnapshot<T>>;
|
|
20
|
+
/**
|
|
21
|
+
* Suscribe to Firestore Document changes and unwrap the document into a plain object
|
|
22
|
+
*/
|
|
23
|
+
export declare function useFirestoreDocData<T = unknown>(ref: DocumentReference<T>, options?: ReactFireOptions<T>): ObservableStatus<T>;
|
|
24
|
+
/**
|
|
25
|
+
* Get a Firestore document, unwrap the document into a plain object, and don't subscribe to changes
|
|
26
|
+
*/
|
|
27
|
+
export declare function useFirestoreDocDataOnce<T = unknown>(ref: DocumentReference<T>, options?: ReactFireOptions<T>): ObservableStatus<T>;
|
|
28
|
+
/**
|
|
29
|
+
* Subscribe to a Firestore collection
|
|
30
|
+
*/
|
|
31
|
+
export declare function useFirestoreCollection<T = DocumentData>(query: FirestoreQuery<T>, options?: ReactFireOptions<T[]>): ObservableStatus<QuerySnapshot<T>>;
|
|
32
|
+
/**
|
|
33
|
+
* Subscribe to a Firestore collection and unwrap the snapshot into an array.
|
|
34
|
+
*/
|
|
35
|
+
export declare function useFirestoreCollectionData<T = DocumentData>(query: FirestoreQuery<T>, options?: ReactFireOptions<T[]>): ObservableStatus<T[]>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactFireOptions, ObservableStatus } from './';
|
|
2
|
+
import type { HttpsCallableOptions } from 'firebase/functions';
|
|
3
|
+
/**
|
|
4
|
+
* Calls a callable function.
|
|
5
|
+
*
|
|
6
|
+
* @param functionName - The name of the function to call
|
|
7
|
+
* @param options
|
|
8
|
+
*/
|
|
9
|
+
export declare function useCallableFunctionResponse<RequestData, ResponseData>(functionName: string, options?: ReactFireOptions<ResponseData> & {
|
|
10
|
+
httpsCallableOptions?: HttpsCallableOptions;
|
|
11
|
+
data?: RequestData;
|
|
12
|
+
}): ObservableStatus<ResponseData>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
import { SuspenseSubject } from './SuspenseSubject';
|
|
2
|
-
import type { Query as FirestoreQuery } from 'firebase/firestore';
|
|
3
|
-
import type { Query as DatabaseQuery } from 'firebase/database';
|
|
4
|
-
export declare type ReactFireGlobals = {
|
|
5
|
-
_reactFireDatabaseCachedQueries: Array<DatabaseQuery>;
|
|
6
|
-
_reactFireFirestoreQueryCache: Array<FirestoreQuery>;
|
|
7
|
-
_reactFirePreloadedObservables: Map<string, SuspenseSubject<any>>;
|
|
8
|
-
};
|
|
9
|
-
export declare class ReactFireError extends Error {
|
|
10
|
-
readonly code: string;
|
|
11
|
-
customData?: Record<string, unknown> | undefined;
|
|
12
|
-
readonly name = "ReactFireError";
|
|
13
|
-
constructor(code: string, message: string, customData?: Record<string, unknown> | undefined);
|
|
14
|
-
}
|
|
15
|
-
export interface ReactFireOptions<T = unknown> {
|
|
16
|
-
idField?: string;
|
|
17
|
-
initialData?: T | any;
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated use initialData instead
|
|
20
|
-
*/
|
|
21
|
-
startWithValue?: T | any;
|
|
22
|
-
suspense?: boolean;
|
|
23
|
-
}
|
|
24
|
-
export declare function checkOptions(options: ReactFireOptions, field: string): any;
|
|
25
|
-
export declare function checkinitialData(options: ReactFireOptions): any;
|
|
26
|
-
export declare function checkIdField(options: ReactFireOptions): any;
|
|
27
|
-
export * from './auth';
|
|
28
|
-
export * from './database';
|
|
29
|
-
export * from './firebaseApp';
|
|
30
|
-
export * from './firestore';
|
|
31
|
-
export * from './
|
|
32
|
-
export * from './
|
|
33
|
-
export * from './
|
|
34
|
-
export * from './
|
|
35
|
-
export * from './
|
|
1
|
+
import { SuspenseSubject } from './SuspenseSubject';
|
|
2
|
+
import type { Query as FirestoreQuery } from 'firebase/firestore';
|
|
3
|
+
import type { Query as DatabaseQuery } from 'firebase/database';
|
|
4
|
+
export declare type ReactFireGlobals = {
|
|
5
|
+
_reactFireDatabaseCachedQueries: Array<DatabaseQuery>;
|
|
6
|
+
_reactFireFirestoreQueryCache: Array<FirestoreQuery>;
|
|
7
|
+
_reactFirePreloadedObservables: Map<string, SuspenseSubject<any>>;
|
|
8
|
+
};
|
|
9
|
+
export declare class ReactFireError extends Error {
|
|
10
|
+
readonly code: string;
|
|
11
|
+
customData?: Record<string, unknown> | undefined;
|
|
12
|
+
readonly name = "ReactFireError";
|
|
13
|
+
constructor(code: string, message: string, customData?: Record<string, unknown> | undefined);
|
|
14
|
+
}
|
|
15
|
+
export interface ReactFireOptions<T = unknown> {
|
|
16
|
+
idField?: string;
|
|
17
|
+
initialData?: T | any;
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated use initialData instead
|
|
20
|
+
*/
|
|
21
|
+
startWithValue?: T | any;
|
|
22
|
+
suspense?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare function checkOptions(options: ReactFireOptions, field: string): any;
|
|
25
|
+
export declare function checkinitialData(options: ReactFireOptions): any;
|
|
26
|
+
export declare function checkIdField(options: ReactFireOptions): any;
|
|
27
|
+
export * from './auth';
|
|
28
|
+
export * from './database';
|
|
29
|
+
export * from './firebaseApp';
|
|
30
|
+
export * from './firestore';
|
|
31
|
+
export * from './functions';
|
|
32
|
+
export * from './performance';
|
|
33
|
+
export * from './remote-config';
|
|
34
|
+
export * from './storage';
|
|
35
|
+
export * from './useObservable';
|
|
36
|
+
export * from './sdk';
|