@ahoo-wang/fetcher-react 3.5.6 → 3.6.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/README.md +869 -483
- package/README.zh-CN.md +2139 -605
- package/dist/core/debounced/index.d.ts +4 -0
- package/dist/core/debounced/index.d.ts.map +1 -0
- package/dist/core/debounced/useDebouncedCallback.d.ts.map +1 -0
- package/dist/core/{useDebouncedExecutePromise.d.ts → debounced/useDebouncedExecutePromise.d.ts} +1 -1
- package/dist/core/debounced/useDebouncedExecutePromise.d.ts.map +1 -0
- package/dist/{wow/debounce → core/debounced}/useDebouncedQuery.d.ts +1 -2
- package/dist/core/debounced/useDebouncedQuery.d.ts.map +1 -0
- package/dist/core/index.d.ts +3 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/{wow → core}/useQuery.d.ts +2 -2
- package/dist/core/useQuery.d.ts.map +1 -0
- package/dist/{wow → core}/useQueryState.d.ts +1 -1
- package/dist/core/useQueryState.d.ts.map +1 -0
- package/dist/cosec/RouteGuard.d.ts +49 -0
- package/dist/cosec/RouteGuard.d.ts.map +1 -0
- package/dist/cosec/SecurityContext.d.ts +47 -14
- package/dist/cosec/SecurityContext.d.ts.map +1 -1
- package/dist/cosec/index.d.ts +1 -0
- package/dist/cosec/index.d.ts.map +1 -1
- package/dist/cosec/useSecurity.d.ts +60 -8
- package/dist/cosec/useSecurity.d.ts.map +1 -1
- package/dist/fetcher/debounced/index.d.ts +3 -0
- package/dist/fetcher/debounced/index.d.ts.map +1 -0
- package/dist/fetcher/{useDebouncedFetcher.d.ts → debounced/useDebouncedFetcher.d.ts} +2 -2
- package/dist/fetcher/debounced/useDebouncedFetcher.d.ts.map +1 -0
- package/dist/{wow/debounce → fetcher/debounced}/useDebouncedFetcherQuery.d.ts +1 -1
- package/dist/fetcher/debounced/useDebouncedFetcherQuery.d.ts.map +1 -0
- package/dist/fetcher/index.d.ts +2 -1
- package/dist/fetcher/index.d.ts.map +1 -1
- package/dist/{wow → fetcher}/useFetcherQuery.d.ts +3 -3
- package/dist/fetcher/useFetcherQuery.d.ts.map +1 -0
- package/dist/index.es.js +567 -538
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/wow/fetcher/index.d.ts +6 -0
- package/dist/wow/fetcher/index.d.ts.map +1 -0
- package/dist/wow/{useFetcherCountQuery.d.ts → fetcher/useFetcherCountQuery.d.ts} +2 -2
- package/dist/wow/fetcher/useFetcherCountQuery.d.ts.map +1 -0
- package/dist/wow/{useFetcherListQuery.d.ts → fetcher/useFetcherListQuery.d.ts} +2 -2
- package/dist/wow/fetcher/useFetcherListQuery.d.ts.map +1 -0
- package/dist/wow/{useFetcherListStreamQuery.d.ts → fetcher/useFetcherListStreamQuery.d.ts} +2 -2
- package/dist/wow/fetcher/useFetcherListStreamQuery.d.ts.map +1 -0
- package/dist/wow/{useFetcherPagedQuery.d.ts → fetcher/useFetcherPagedQuery.d.ts} +2 -2
- package/dist/wow/fetcher/useFetcherPagedQuery.d.ts.map +1 -0
- package/dist/wow/{useFetcherSingleQuery.d.ts → fetcher/useFetcherSingleQuery.d.ts} +2 -2
- package/dist/wow/fetcher/useFetcherSingleQuery.d.ts.map +1 -0
- package/dist/wow/index.d.ts +1 -10
- package/dist/wow/index.d.ts.map +1 -1
- package/dist/wow/useCountQuery.d.ts +1 -1
- package/dist/wow/useCountQuery.d.ts.map +1 -1
- package/dist/wow/useListQuery.d.ts +1 -1
- package/dist/wow/useListQuery.d.ts.map +1 -1
- package/dist/wow/useListStreamQuery.d.ts +1 -1
- package/dist/wow/useListStreamQuery.d.ts.map +1 -1
- package/dist/wow/usePagedQuery.d.ts +1 -1
- package/dist/wow/usePagedQuery.d.ts.map +1 -1
- package/dist/wow/useSingleQuery.d.ts +1 -1
- package/dist/wow/useSingleQuery.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/core/useDebouncedCallback.d.ts.map +0 -1
- package/dist/core/useDebouncedExecutePromise.d.ts.map +0 -1
- package/dist/fetcher/useDebouncedFetcher.d.ts.map +0 -1
- package/dist/wow/debounce/index.d.ts +0 -3
- package/dist/wow/debounce/index.d.ts.map +0 -1
- package/dist/wow/debounce/useDebouncedFetcherQuery.d.ts.map +0 -1
- package/dist/wow/debounce/useDebouncedQuery.d.ts.map +0 -1
- package/dist/wow/types.d.ts +0 -7
- package/dist/wow/types.d.ts.map +0 -1
- package/dist/wow/useFetcherCountQuery.d.ts.map +0 -1
- package/dist/wow/useFetcherListQuery.d.ts.map +0 -1
- package/dist/wow/useFetcherListStreamQuery.d.ts.map +0 -1
- package/dist/wow/useFetcherPagedQuery.d.ts.map +0 -1
- package/dist/wow/useFetcherQuery.d.ts.map +0 -1
- package/dist/wow/useFetcherSingleQuery.d.ts.map +0 -1
- package/dist/wow/useQuery.d.ts.map +0 -1
- package/dist/wow/useQueryState.d.ts.map +0 -1
- /package/dist/core/{useDebouncedCallback.d.ts → debounced/useDebouncedCallback.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/debounced/index.ts"],"names":[],"mappings":"AAaA,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDebouncedCallback.d.ts","sourceRoot":"","sources":["../../../src/core/debounced/useDebouncedCallback.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,2FAA2F;IAC3F,KAAK,EAAE,MAAM,CAAC;IACd,wGAAwG;IACxG,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4FAA4F;IAC5F,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,0BAA0B,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG;IAC3E,8EAA8E;IAC9E,QAAQ,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAC/C,0DAA0D;IAC1D,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;IAC5B,uEAAuE;IACvE,QAAQ,CAAC,SAAS,EAAE,MAAM,OAAO,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACpE,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,2BAA2B,GACnC,0BAA0B,CAAC,CAAC,CAAC,CAuF/B"}
|
package/dist/core/{useDebouncedExecutePromise.d.ts → debounced/useDebouncedExecutePromise.d.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UseExecutePromiseOptions, UseExecutePromiseReturn } from '
|
|
1
|
+
import { UseExecutePromiseOptions, UseExecutePromiseReturn } from '../useExecutePromise';
|
|
2
2
|
import { UseDebouncedCallbackOptions, UseDebouncedCallbackReturn } from './useDebouncedCallback';
|
|
3
3
|
import { FetcherError } from '@ahoo-wang/fetcher';
|
|
4
4
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDebouncedExecutePromise.d.ts","sourceRoot":"","sources":["../../../src/core/debounced/useDebouncedExecutePromise.ts"],"names":[],"mappings":"AAaA,OAAO,EAEL,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,2BAA2B,EAC3B,0BAA0B,EAC3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,QAAQ,EAAE,2BAA2B,CAAC;CACvC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,iCAAiC,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,CAC/D,SAAQ,wBAAwB,CAAC,CAAC,EAAE,CAAC,CAAC,EACpC,eAAe;CAAG;AAEtB;;;;;;;GAOG;AACH,MAAM,WAAW,gCAAgC,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,CAC9D,SAAQ,IAAI,CAAC,uBAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,EACpD,0BAA0B,CAAC,uBAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;CAAG;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,YAAY,EACtE,OAAO,EAAE,iCAAiC,CAAC,CAAC,EAAE,CAAC,CAAC,GAC/C,gCAAgC,CAAC,CAAC,EAAE,CAAC,CAAC,CAsBxC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FetcherError } from '@ahoo-wang/fetcher';
|
|
2
|
-
import { UseQueryOptions, UseQueryReturn } from '../
|
|
3
|
-
import { DebounceCapable, UseDebouncedCallbackReturn } from '../../core';
|
|
2
|
+
import { UseQueryOptions, UseQueryReturn, DebounceCapable, UseDebouncedCallbackReturn } from '../index';
|
|
4
3
|
/**
|
|
5
4
|
* Configuration options for the useDebouncedQuery hook
|
|
6
5
|
* @template Q - The type of the query parameters
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDebouncedQuery.d.ts","sourceRoot":"","sources":["../../../src/core/debounced/useDebouncedQuery.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAY,eAAe,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,EACL,eAAe,EAEf,0BAA0B,EAC3B,MAAM,UAAU,CAAC;AAGlB;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,CAC9D,SAAQ,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,eAAe;CAClD;AAED;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,CAC7D,SAAQ,IAAI,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,EAC9C,0BAA0B,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;CACjE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,EACtD,OAAO,EAAE,wBAAwB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GACzC,uBAAuB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CA4DlC"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
export * from './debounced';
|
|
1
2
|
export * from './useExecutePromise';
|
|
2
3
|
export * from './usePromiseState';
|
|
3
4
|
export * from './useRequestId';
|
|
4
5
|
export * from './useLatest';
|
|
5
6
|
export * from './useMounted';
|
|
6
7
|
export * from './useRefs';
|
|
7
|
-
export * from './useDebouncedCallback';
|
|
8
|
-
export * from './useDebouncedExecutePromise';
|
|
9
8
|
export * from './useForceUpdate';
|
|
9
|
+
export * from './useQuery';
|
|
10
|
+
export * from './useQueryState';
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAaA,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { UseExecutePromiseReturn, UseExecutePromiseOptions } from '
|
|
1
|
+
import { UseExecutePromiseReturn, UseExecutePromiseOptions } from './index';
|
|
2
2
|
import { AttributesCapable, FetcherError } from '@ahoo-wang/fetcher';
|
|
3
|
-
import { AutoExecuteCapable } from './types';
|
|
4
3
|
import { UseQueryStateReturn } from './useQueryState';
|
|
4
|
+
import { AutoExecuteCapable } from '../types';
|
|
5
5
|
/**
|
|
6
6
|
* Configuration options for the useQuery hook
|
|
7
7
|
* @template Q - The type of the query parameters
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useQuery.d.ts","sourceRoot":"","sources":["../../src/core/useQuery.ts"],"names":[],"mappings":"AAaA,OAAO,EAGL,uBAAuB,EACvB,wBAAwB,EAEzB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAiB,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,CACrD,SAAQ,wBAAwB,CAAC,CAAC,EAAE,CAAC,CAAC,EACpC,iBAAiB,EACjB,kBAAkB;IACpB,mCAAmC;IACnC,YAAY,EAAE,CAAC,CAAC;IAEhB,kFAAkF;IAClF,OAAO,EAAE,CACP,KAAK,EAAE,CAAC,EACR,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAChC,eAAe,CAAC,EAAE,eAAe,KAC9B,OAAO,CAAC,CAAC,CAAC,CAAC;CACjB;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc,CAC7B,CAAC,EACD,CAAC,EACD,CAAC,GAAG,YAAY,CAChB,SAAQ,uBAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAC7D,4DAA4D;IAC5D,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAGD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,EAC7C,OAAO,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAChC,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CA8DzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useQueryState.d.ts","sourceRoot":"","sources":["../../src/core/useQueryState.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C;;;GAGG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,CAAE,SAAQ,kBAAkB;IACjE,4DAA4D;IAC5D,YAAY,EAAE,CAAC,CAAC;IAChB,6FAA6F;IAC7F,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC,CAAC;IAClB,yFAAyF;IACzF,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAC/B,mBAAmB,CAAC,CAAC,CAAC,CA0BxB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the RouteGuard component.
|
|
4
|
+
*/
|
|
5
|
+
export interface RouteGuardProps {
|
|
6
|
+
/**
|
|
7
|
+
* The content to render when the user is authenticated.
|
|
8
|
+
*/
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* The fallback content to render when the user is not authenticated.
|
|
12
|
+
* If not provided, nothing will be rendered.
|
|
13
|
+
*/
|
|
14
|
+
fallback?: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Optional redirect function to call when user is not authenticated.
|
|
17
|
+
* This can be used to programmatically navigate to a login page.
|
|
18
|
+
*/
|
|
19
|
+
onUnauthorized?: () => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Route guard component that conditionally renders content based on authentication status.
|
|
23
|
+
*
|
|
24
|
+
* This component uses the SecurityContext to check if the user is authenticated.
|
|
25
|
+
* If authenticated, it renders the children. If not authenticated, it renders the fallback
|
|
26
|
+
* content (if provided) and optionally calls the onUnauthorized callback.
|
|
27
|
+
*
|
|
28
|
+
* @param children - The protected content to render when authenticated.
|
|
29
|
+
* @param fallback - Optional fallback content to render when not authenticated.
|
|
30
|
+
* @param onUnauthorized - Optional callback to execute when user is not authenticated.
|
|
31
|
+
* @returns The children if authenticated, fallback if provided, or null otherwise.
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* import { RouteGuard } from '@ahoo-wang/fetcher-react';
|
|
35
|
+
*
|
|
36
|
+
* function ProtectedPage() {
|
|
37
|
+
* return (
|
|
38
|
+
* <RouteGuard
|
|
39
|
+
* fallback={<div>Please log in to access this page.</div>}
|
|
40
|
+
* onUnauthorized={() => navigate('/login')}
|
|
41
|
+
* >
|
|
42
|
+
* <div>Protected content</div>
|
|
43
|
+
* </RouteGuard>
|
|
44
|
+
* );
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function RouteGuard({ children, fallback, onUnauthorized, }: RouteGuardProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
49
|
+
//# sourceMappingURL=RouteGuard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RouteGuard.d.ts","sourceRoot":"","sources":["../../src/cosec/RouteGuard.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,QAAQ,EACR,cAAc,GACf,EAAE,eAAe,2UAcjB"}
|
|
@@ -1,55 +1,88 @@
|
|
|
1
|
-
import { UseSecurityReturn } from './useSecurity';
|
|
1
|
+
import { UseSecurityOptions, UseSecurityReturn } from './useSecurity';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { TokenStorage } from '@ahoo-wang/fetcher-cosec';
|
|
4
4
|
/**
|
|
5
|
-
* Type alias for the security context value,
|
|
6
|
-
*
|
|
5
|
+
* Type alias for the security context value, representing the authentication state and methods.
|
|
6
|
+
* This is equivalent to the return type of the useSecurity hook, providing reactive access to:
|
|
7
|
+
* - Current authenticated user information (JWT payload)
|
|
8
|
+
* - Authentication status (boolean flag)
|
|
9
|
+
* - Sign-in method for authenticating users
|
|
10
|
+
* - Sign-out method for clearing authentication
|
|
11
|
+
*
|
|
12
|
+
* Used internally by the SecurityContext to type the context value.
|
|
7
13
|
*/
|
|
8
14
|
export type SecurityContext = UseSecurityReturn;
|
|
9
15
|
/**
|
|
10
16
|
* React context for managing authentication state across the component tree.
|
|
11
|
-
* This context
|
|
12
|
-
* without prop drilling.
|
|
17
|
+
* This context enables sharing of authentication state and methods between components
|
|
18
|
+
* without prop drilling. Components can access authentication data and methods through
|
|
19
|
+
* the useSecurityContext hook when wrapped by the SecurityProvider.
|
|
20
|
+
*
|
|
21
|
+
* The context value is undefined by default, requiring components to be wrapped by
|
|
22
|
+
* SecurityProvider to access authentication functionality.
|
|
13
23
|
*/
|
|
14
24
|
export declare const SecurityContext: import('react').Context<UseSecurityReturn | undefined>;
|
|
15
25
|
/**
|
|
16
|
-
*
|
|
26
|
+
* Configuration options for the SecurityProvider component.
|
|
27
|
+
* Extends UseSecurityOptions to include provider-specific settings like token storage and children.
|
|
17
28
|
*/
|
|
18
|
-
export interface SecurityContextOptions {
|
|
29
|
+
export interface SecurityContextOptions extends UseSecurityOptions {
|
|
19
30
|
/**
|
|
20
31
|
* The token storage instance used to manage authentication tokens.
|
|
21
|
-
* This should be a valid TokenStorage implementation that handles token persistence
|
|
32
|
+
* This should be a valid TokenStorage implementation that handles token persistence,
|
|
33
|
+
* retrieval, and lifecycle management across different storage backends (localStorage,
|
|
34
|
+
* sessionStorage, memory, etc.).
|
|
22
35
|
*/
|
|
23
36
|
tokenStorage: TokenStorage;
|
|
24
37
|
/**
|
|
25
38
|
* The child components that will have access to the security context.
|
|
39
|
+
* These components can use the useSecurityContext hook to access authentication state and methods.
|
|
26
40
|
*/
|
|
27
41
|
children: ReactNode;
|
|
28
42
|
}
|
|
29
43
|
/**
|
|
30
44
|
* Provider component that supplies authentication state and methods to its child components.
|
|
31
45
|
* This component wraps the application or a portion of it to provide access to authentication
|
|
32
|
-
* functionality through the useSecurityContext hook.
|
|
46
|
+
* functionality through the useSecurityContext hook. It internally uses the useSecurity hook
|
|
47
|
+
* to manage authentication state and makes it available via React context.
|
|
33
48
|
*
|
|
34
49
|
* @param tokenStorage - The token storage instance for managing authentication tokens.
|
|
50
|
+
* This should be a valid TokenStorage implementation that handles
|
|
51
|
+
* token persistence, retrieval, and lifecycle management across different
|
|
52
|
+
* storage backends (localStorage, sessionStorage, memory, etc.).
|
|
35
53
|
* @param children - The child components that will have access to the security context.
|
|
54
|
+
* These components can use the useSecurityContext hook to access authentication
|
|
55
|
+
* state and methods without prop drilling.
|
|
56
|
+
* @param useSecurityOptions - Optional configuration object containing lifecycle callbacks
|
|
57
|
+
* for sign-in and sign-out events. Extends UseSecurityOptions interface.
|
|
58
|
+
* @param useSecurityOptions.onSignIn - Callback function invoked when sign in is successful.
|
|
59
|
+
* @param useSecurityOptions.onSignOut - Callback function invoked when sign out occurs.
|
|
36
60
|
* @returns A React element that provides the security context to its children.
|
|
37
|
-
*
|
|
61
|
+
* The context value includes currentUser, authenticated status, signIn, and signOut methods.
|
|
62
|
+
* @throws {Error} May throw errors if tokenStorage operations fail during initialization,
|
|
63
|
+
* such as invalid tokens or storage access issues (implementation dependent).
|
|
38
64
|
* @example
|
|
39
65
|
* ```tsx
|
|
40
|
-
* import { SecurityProvider } from '@ahoo-wang/fetcher-react
|
|
66
|
+
* import { SecurityProvider } from '@ahoo-wang/fetcher-react';
|
|
41
67
|
* import { tokenStorage } from './tokenStorage';
|
|
68
|
+
* import { useNavigate } from 'react-router-dom';
|
|
42
69
|
*
|
|
43
70
|
* function App() {
|
|
71
|
+
* const navigate = useNavigate();
|
|
72
|
+
*
|
|
44
73
|
* return (
|
|
45
|
-
* <SecurityProvider
|
|
74
|
+
* <SecurityProvider
|
|
75
|
+
* tokenStorage={tokenStorage}
|
|
76
|
+
* onSignIn={() => navigate('/dashboard')}
|
|
77
|
+
* onSignOut={() => navigate('/login')}
|
|
78
|
+
* >
|
|
46
79
|
* <MyApp />
|
|
47
80
|
* </SecurityProvider>
|
|
48
81
|
* );
|
|
49
82
|
* }
|
|
50
83
|
* ```
|
|
51
84
|
*/
|
|
52
|
-
export declare function SecurityProvider({ tokenStorage, children, }: SecurityContextOptions): import("react/jsx-runtime").JSX.Element;
|
|
85
|
+
export declare function SecurityProvider({ tokenStorage, children, ...useSecurityOptions }: SecurityContextOptions): import("react/jsx-runtime").JSX.Element;
|
|
53
86
|
/**
|
|
54
87
|
* Hook to access the security context within components wrapped by SecurityProvider.
|
|
55
88
|
* This hook provides reactive access to authentication state and methods throughout the component tree.
|
|
@@ -58,7 +91,7 @@ export declare function SecurityProvider({ tokenStorage, children, }: SecurityCo
|
|
|
58
91
|
* @throws {Error} Throws an error if used outside of a SecurityProvider component.
|
|
59
92
|
* @example
|
|
60
93
|
* ```tsx
|
|
61
|
-
* import { useSecurityContext } from '@ahoo-wang/fetcher-react
|
|
94
|
+
* import { useSecurityContext } from '@ahoo-wang/fetcher-react';
|
|
62
95
|
*
|
|
63
96
|
* function UserProfile() {
|
|
64
97
|
* const { currentUser, authenticated, signOut } = useSecurityContext();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecurityContext.d.ts","sourceRoot":"","sources":["../../src/cosec/SecurityContext.tsx"],"names":[],"mappings":"AAaA,OAAO,
|
|
1
|
+
{"version":3,"file":"SecurityContext.d.ts","sourceRoot":"","sources":["../../src/cosec/SecurityContext.tsx"],"names":[],"mappings":"AAaA,OAAO,EAEL,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAiB,SAAS,EAAc,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD;;;;;;;;;GASG;AACH,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAEhD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,wDAE3B,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,sBAAuB,SAAQ,kBAAkB;IAChE;;;;;OAKG;IACH,YAAY,EAAE,YAAY,CAAC;IAE3B;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,YAAY,EACZ,QAAQ,EACR,GAAG,kBAAkB,EACtB,EAAE,sBAAsB,2CAOxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,kBAAkB,IAAI,eAAe,CAQpD"}
|
package/dist/cosec/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cosec/index.ts"],"names":[],"mappings":"AAaA,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cosec/index.ts"],"names":[],"mappings":"AAaA,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
|
|
@@ -1,11 +1,31 @@
|
|
|
1
1
|
import { TokenStorage, CompositeToken, CoSecJwtPayload } from '@ahoo-wang/fetcher-cosec';
|
|
2
|
+
/**
|
|
3
|
+
* Type representing a composite token provider.
|
|
4
|
+
* Can be either a direct composite token or a function that returns a promise of a composite token.
|
|
5
|
+
*/
|
|
6
|
+
type CompositeTokenProvider = CompositeToken | (() => Promise<CompositeToken>);
|
|
2
7
|
export declare const ANONYMOUS_USER: CoSecJwtPayload;
|
|
8
|
+
/**
|
|
9
|
+
* Options for configuring the useSecurity hook.
|
|
10
|
+
*/
|
|
11
|
+
export interface UseSecurityOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Callback function invoked when sign in is successful.
|
|
14
|
+
* This is called after the token has been successfully stored.
|
|
15
|
+
*/
|
|
16
|
+
onSignIn?: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* Callback function invoked when sign out occurs.
|
|
19
|
+
* This is called after the token has been removed.
|
|
20
|
+
*/
|
|
21
|
+
onSignOut?: () => void;
|
|
22
|
+
}
|
|
3
23
|
/**
|
|
4
24
|
* Return type for the useSecurity hook.
|
|
5
25
|
*/
|
|
6
26
|
export interface UseSecurityReturn {
|
|
7
27
|
/**
|
|
8
|
-
* The current authenticated user's JWT payload, or
|
|
28
|
+
* The current authenticated user's JWT payload, or ANONYMOUS_USER if not authenticated.
|
|
9
29
|
* Contains user information extracted from the access token.
|
|
10
30
|
*/
|
|
11
31
|
currentUser: CoSecJwtPayload;
|
|
@@ -15,10 +35,12 @@ export interface UseSecurityReturn {
|
|
|
15
35
|
*/
|
|
16
36
|
authenticated: boolean;
|
|
17
37
|
/**
|
|
18
|
-
* Function to sign in with a composite token.
|
|
19
|
-
* @param
|
|
38
|
+
* Function to sign in with a composite token or a function that returns a promise of composite token.
|
|
39
|
+
* @param compositeTokenProvider - Either a composite token containing access and refresh tokens,
|
|
40
|
+
* or a function that returns a promise resolving to a composite token.
|
|
41
|
+
* @returns A promise that resolves when the sign-in operation is complete.
|
|
20
42
|
*/
|
|
21
|
-
signIn: (
|
|
43
|
+
signIn: (compositeTokenProvider: CompositeTokenProvider) => Promise<void>;
|
|
22
44
|
/**
|
|
23
45
|
* Function to sign out the current user.
|
|
24
46
|
*/
|
|
@@ -34,6 +56,9 @@ export interface UseSecurityReturn {
|
|
|
34
56
|
* @param tokenStorage - The token storage instance used to manage authentication tokens.
|
|
35
57
|
* This should be a valid TokenStorage implementation that handles
|
|
36
58
|
* token persistence and retrieval.
|
|
59
|
+
* @param options - Optional configuration object containing lifecycle callbacks.
|
|
60
|
+
* @param options.onSignIn - Callback function invoked when sign in is successful.
|
|
61
|
+
* @param options.onSignOut - Callback function invoked when sign out occurs.
|
|
37
62
|
* @returns An object containing:
|
|
38
63
|
* - currentUser: The current authenticated user's JWT payload, or null if not authenticated.
|
|
39
64
|
* - authenticated: Boolean indicating whether the user is currently authenticated.
|
|
@@ -43,14 +68,40 @@ export interface UseSecurityReturn {
|
|
|
43
68
|
* or storage access issues (implementation dependent).
|
|
44
69
|
* @example
|
|
45
70
|
* ```typescript
|
|
46
|
-
* import { useSecurity } from '@ahoo-wang/fetcher-react
|
|
71
|
+
* import { useSecurity } from '@ahoo-wang/fetcher-react';
|
|
47
72
|
* import { tokenStorage } from './tokenStorage';
|
|
73
|
+
* import { useNavigate } from 'react-router-dom';
|
|
48
74
|
*
|
|
49
75
|
* function App() {
|
|
50
|
-
* const
|
|
76
|
+
* const navigate = useNavigate();
|
|
77
|
+
*
|
|
78
|
+
* const { currentUser, authenticated, signIn, signOut } = useSecurity(tokenStorage, {
|
|
79
|
+
* onSignIn: () => {
|
|
80
|
+
* // Redirect to dashboard after successful login
|
|
81
|
+
* navigate('/dashboard');
|
|
82
|
+
* },
|
|
83
|
+
* onSignOut: () => {
|
|
84
|
+
* // Redirect to login page after logout
|
|
85
|
+
* navigate('/login');
|
|
86
|
+
* }
|
|
87
|
+
* });
|
|
88
|
+
*
|
|
89
|
+
* const handleSignIn = async () => {
|
|
90
|
+
* // Direct token
|
|
91
|
+
* await signIn(compositeToken);
|
|
92
|
+
*
|
|
93
|
+
* // Or async function
|
|
94
|
+
* await signIn(async () => {
|
|
95
|
+
* const response = await fetch('/api/auth/login', {
|
|
96
|
+
* method: 'POST',
|
|
97
|
+
* body: JSON.stringify({ username, password })
|
|
98
|
+
* });
|
|
99
|
+
* return response.json();
|
|
100
|
+
* });
|
|
101
|
+
* };
|
|
51
102
|
*
|
|
52
103
|
* if (!authenticated) {
|
|
53
|
-
* return <button onClick={
|
|
104
|
+
* return <button onClick={handleSignIn}>Sign In</button>;
|
|
54
105
|
* }
|
|
55
106
|
*
|
|
56
107
|
* return (
|
|
@@ -62,5 +113,6 @@ export interface UseSecurityReturn {
|
|
|
62
113
|
* }
|
|
63
114
|
* ```
|
|
64
115
|
*/
|
|
65
|
-
export declare function useSecurity(tokenStorage: TokenStorage): UseSecurityReturn;
|
|
116
|
+
export declare function useSecurity(tokenStorage: TokenStorage, options?: UseSecurityOptions): UseSecurityReturn;
|
|
117
|
+
export {};
|
|
66
118
|
//# sourceMappingURL=useSecurity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSecurity.d.ts","sourceRoot":"","sources":["../../src/cosec/useSecurity.ts"],"names":[],"mappings":"AAeA,OAAO,EACL,YAAY,EACZ,cAAc,EACd,eAAe,EAChB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"useSecurity.d.ts","sourceRoot":"","sources":["../../src/cosec/useSecurity.ts"],"names":[],"mappings":"AAeA,OAAO,EACL,YAAY,EACZ,cAAc,EACd,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAGlC;;;GAGG;AACH,KAAK,sBAAsB,GAAG,cAAc,GAAG,CAAC,MAAM,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC;AAE/E,eAAO,MAAM,cAAc,EAAE,eAK5B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IAEtB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,WAAW,EAAE,eAAe,CAAC;IAE7B;;;OAGG;IACH,aAAa,EAAE,OAAO,CAAC;IAEvB;;;;;OAKG;IACH,MAAM,EAAE,CAAC,sBAAsB,EAAE,sBAAsB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1E;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,wBAAgB,WAAW,CACzB,YAAY,EAAE,YAAY,EAC1B,OAAO,GAAE,kBAAuB,GAC/B,iBAAiB,CA0BnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fetcher/debounced/index.ts"],"names":[],"mappings":"AAaA,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { UseFetcherOptions, UseFetcherReturn } from '
|
|
1
|
+
import { UseFetcherOptions, UseFetcherReturn } from '../useFetcher';
|
|
2
2
|
import { FetcherError } from '@ahoo-wang/fetcher';
|
|
3
|
-
import { DebounceCapable, UseDebouncedCallbackReturn } from '
|
|
3
|
+
import { DebounceCapable, UseDebouncedCallbackReturn } from '../../core';
|
|
4
4
|
/**
|
|
5
5
|
* Configuration options for the useDebouncedFetcher hook.
|
|
6
6
|
* Extends UseFetcherOptions with debouncing capabilities to control the rate
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDebouncedFetcher.d.ts","sourceRoot":"","sources":["../../../src/fetcher/debounced/useDebouncedFetcher.ts"],"names":[],"mappings":"AAaA,OAAO,EAAc,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACL,eAAe,EAEf,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AAGpB;;;;;;;GAOG;AACH,MAAM,WAAW,0BAA0B,CAAC,CAAC,EAAE,CAAC,GAAG,YAAY,CAC7D,SAAQ,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,EAC7B,eAAe;CAAG;AAEtB;;;;;;;GAOG;AACH,MAAM,WAAW,yBAAyB,CAAC,CAAC,EAAE,CAAC,GAAG,YAAY,CAC5D,SAAQ,IAAI,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,EAC7C,0BAA0B,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;CAAG;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,CAAC,GAAG,YAAY,EACrD,OAAO,EAAE,0BAA0B,CAAC,CAAC,EAAE,CAAC,CAAC,GACxC,yBAAyB,CAAC,CAAC,EAAE,CAAC,CAAC,CAiCjC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FetcherError } from '@ahoo-wang/fetcher';
|
|
2
2
|
import { DebounceCapable, UseDebouncedCallbackReturn } from '../../core';
|
|
3
|
-
import { UseFetcherQueryOptions, UseFetcherQueryReturn } from '../
|
|
3
|
+
import { UseFetcherQueryOptions, UseFetcherQueryReturn } from '../index';
|
|
4
4
|
/**
|
|
5
5
|
* Configuration options for the useDebouncedFetcherQuery hook.
|
|
6
6
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDebouncedFetcherQuery.d.ts","sourceRoot":"","sources":["../../../src/fetcher/debounced/useDebouncedFetcherQuery.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACL,eAAe,EAEf,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAEL,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;GAUG;AACH,MAAM,WAAW,+BAA+B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,CACrE,SAAQ,sBAAsB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,eAAe;CAAG;AAE7D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,8BAA8B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,CACpE,SACE,IAAI,CAAC,qBAAqB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,EAC/C,0BAA0B,CAAC,qBAAqB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;CAAG;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4FG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,EAC7D,OAAO,EAAE,+BAA+B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAChD,8BAA8B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CA+DzC"}
|
package/dist/fetcher/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fetcher/index.ts"],"names":[],"mappings":"AAaA,cAAc,cAAc,CAAC;AAC7B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fetcher/index.ts"],"names":[],"mappings":"AAaA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { UseFetcherOptions, UseFetcherReturn } from '
|
|
1
|
+
import { UseFetcherOptions, UseFetcherReturn } from './index';
|
|
2
2
|
import { FetcherError } from '@ahoo-wang/fetcher';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { UseQueryStateReturn } from '../core';
|
|
4
|
+
import { AutoExecuteCapable } from '../types';
|
|
5
5
|
/**
|
|
6
6
|
* Configuration options for the useFetcherQuery hook
|
|
7
7
|
* @template Q - The type of the query parameters
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetcherQuery.d.ts","sourceRoot":"","sources":["../../src/fetcher/useFetcherQuery.ts"],"names":[],"mappings":"AAaA,OAAO,EAAc,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAqC,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAA4B,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAExE,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,CAC5D,SAAQ,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,kBAAkB;IACnD,mDAAmD;IACnD,GAAG,EAAE,MAAM,CAAC;IACZ,kEAAkE;IAClE,YAAY,EAAE,CAAC,CAAC;CACjB;AAED;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,CAC3D,SAAQ,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC;IACtD,4DAA4D;IAC5D,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6EG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,EACpD,OAAO,EAAE,sBAAsB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GACvC,qBAAqB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CA6DhC"}
|