@ahoo-wang/fetcher-react 1.9.3 → 1.9.5

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 CHANGED
@@ -164,8 +164,8 @@ const [user, setUser] = useKeyStorage(userStorage);
164
164
  ```typescript
165
165
  function useFetcher<R>(
166
166
  request: FetchRequest,
167
- options?: UseFetcherOptions
168
- ): UseFetcherResult<R>
167
+ options?: UseFetcherOptions,
168
+ ): UseFetcherResult<R>;
169
169
  ```
170
170
 
171
171
  A React hook that provides data fetching capabilities with automatic state management.
@@ -193,7 +193,9 @@ An object containing:
193
193
  ### useKeyStorage
194
194
 
195
195
  ```typescript jsx
196
- function useKeyStorage<T>(keyStorage: KeyStorage<T>): [T | null, (value: T) => void]
196
+ function useKeyStorage<T>(
197
+ keyStorage: KeyStorage<T>,
198
+ ): [T | null, (value: T) => void];
197
199
  ```
198
200
 
199
201
  A React hook that provides state management for a KeyStorage instance.
@@ -208,4 +210,4 @@ A React hook that provides state management for a KeyStorage instance.
208
210
 
209
211
  ## License
210
212
 
211
- [Apache 2.0](https://github.com/Ahoo-Wang/fetcher/blob/main/LICENSE)
213
+ [Apache 2.0](https://github.com/Ahoo-Wang/fetcher/blob/main/LICENSE)
package/README.zh-CN.md CHANGED
@@ -40,7 +40,7 @@ const MyComponent = () => {
40
40
 
41
41
  if (loading) return <div>加载中...</div>;
42
42
  if (error) return <div>错误: {error.message}</div>;
43
-
43
+
44
44
  return (
45
45
  <div>
46
46
  <pre>{JSON.stringify(result, null, 2)}</pre>
@@ -71,7 +71,7 @@ const MyComponent = () => {
71
71
 
72
72
  if (loading) return <div>提交中...</div>;
73
73
  if (error) return <div>错误: {error.message}</div>;
74
-
74
+
75
75
  return (
76
76
  <div>
77
77
  {result && <pre>{JSON.stringify(result, null, 2)}</pre>}
@@ -96,7 +96,7 @@ const UserProfile = ({ userId }: { userId: string }) => {
96
96
 
97
97
  if (loading) return <div>加载中...</div>;
98
98
  if (error) return <div>错误: {error.message}</div>;
99
-
99
+
100
100
  return (
101
101
  <div>
102
102
  <h1>{result?.name}</h1>
@@ -158,8 +158,8 @@ const [user, setUser] = useKeyStorage(userStorage);
158
158
  ```typescript
159
159
  function useFetcher<R>(
160
160
  request: FetchRequest,
161
- options?: UseFetcherOptions
162
- ): UseFetcherResult<R>
161
+ options?: UseFetcherOptions,
162
+ ): UseFetcherResult<R>;
163
163
  ```
164
164
 
165
165
  提供数据获取功能并自动管理状态的 React hook。
@@ -186,7 +186,9 @@ function useFetcher<R>(
186
186
  ### useKeyStorage
187
187
 
188
188
  ```typescript jsx
189
- function useKeyStorage<T>(keyStorage: KeyStorage<T>): [T | null, (value: T) => void]
189
+ function useKeyStorage<T>(
190
+ keyStorage: KeyStorage<T>,
191
+ ): [T | null, (value: T) => void];
190
192
  ```
191
193
 
192
194
  为 KeyStorage 实例提供状态管理的 React hook。
@@ -201,4 +203,4 @@ function useKeyStorage<T>(keyStorage: KeyStorage<T>): [T | null, (value: T) => v
201
203
 
202
204
  ## 许可证
203
205
 
204
- [Apache 2.0](https://github.com/Ahoo-Wang/fetcher/blob/main/LICENSE)
206
+ [Apache 2.0](https://github.com/Ahoo-Wang/fetcher/blob/main/LICENSE)
@@ -1 +1 @@
1
- {"version":3,"file":"useFetcher.d.ts","sourceRoot":"","sources":["../../src/fetcher/useFetcher.ts"],"names":[],"mappings":"AAaA,OAAO,EAEL,cAAc,EACd,aAAa,EACb,YAAY,EACZ,cAAc,EACf,MAAM,oBAAoB,CAAC;AAI5B;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,cAAc,EAAE,cAAc;IACvE;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,gEAAgE;IAChE,OAAO,EAAE,OAAO,CAAC;IAEjB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,aAAa,CAAC;IAEzB,oGAAoG;IACpG,MAAM,CAAC,EAAE,CAAC,CAAC;IAEX,mFAAmF;IACnF,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;OAGG;IACH,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7B,qDAAqD;IACrD,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAmErG"}
1
+ {"version":3,"file":"useFetcher.d.ts","sourceRoot":"","sources":["../../src/fetcher/useFetcher.ts"],"names":[],"mappings":"AAaA,OAAO,EAEL,cAAc,EACd,aAAa,EACb,YAAY,EAEZ,cAAc,EACf,MAAM,oBAAoB,CAAC;AAI5B;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,cAAc,EAAE,cAAc;IACvE;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,gEAAgE;IAChE,OAAO,EAAE,OAAO,CAAC;IAEjB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,aAAa,CAAC;IAEzB,oGAAoG;IACpG,MAAM,CAAC,EAAE,CAAC,CAAC;IAEX,mFAAmF;IACnF,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;OAGG;IACH,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7B,qDAAqD;IACrD,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAC1B,OAAO,EAAE,YAAY,EACrB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,gBAAgB,CAAC,CAAC,CAAC,CA2ErB"}
package/dist/index.es.js CHANGED
@@ -4,14 +4,7 @@ function S(t) {
4
4
  const e = u(
5
5
  (n) => t.addListener(n),
6
6
  [t]
7
- ), s = u(
8
- () => t.get(),
9
- [t]
10
- ), a = F(
11
- e,
12
- s,
13
- s
14
- ), f = u(
7
+ ), s = u(() => t.get(), [t]), a = F(e, s, s), f = u(
15
8
  (n) => t.set(n),
16
9
  [t]
17
10
  );
@@ -28,7 +21,9 @@ function L() {
28
21
  }, []), e;
29
22
  }
30
23
  function V(t, e) {
31
- const { fetcher: s = p, immediate: a = !0 } = e || {}, [f, n] = i(!1), [m, d] = i(void 0), [x, g] = i(void 0), [C, E] = i(void 0), c = L(), r = h(), b = A(s), l = u(async () => {
24
+ const { fetcher: s = p, immediate: a = !0 } = e || {}, [f, n] = i(!1), [m, d] = i(void 0), [x, g] = i(
25
+ void 0
26
+ ), [C, E] = i(void 0), c = L(), r = h(), b = A(s), l = u(async () => {
32
27
  r.current && r.current.abort(), r.current = t.abortController ?? new AbortController(), t.abortController = r.current, c() && (n(!0), d(void 0));
33
28
  try {
34
29
  const o = await b.exchange(t, e);
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../src/storage/useKeyStorage.ts","../../../node_modules/.pnpm/react-use@17.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-use/esm/useMountedState.js","../src/fetcher/useFetcher.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useCallback, useSyncExternalStore } from 'react';\nimport { KeyStorage } from '@ahoo-wang/fetcher-storage';\n\n/**\n * A React hook that provides state management for a KeyStorage instance.\n * Subscribes to storage changes and returns the current value along with a setter function.\n *\n * @template T - The type of value stored in the key storage\n * @param keyStorage - The KeyStorage instance to subscribe to and manage\n * @returns A tuple containing the current stored value and a function to update it\n */\nexport function useKeyStorage<T>(\n keyStorage: KeyStorage<T>,\n): [T | null, (value: T) => void] {\n const subscribe = useCallback(\n (callback: () => void) => keyStorage.addListener(callback),\n [keyStorage],\n );\n const getSnapshot = useCallback(\n () => keyStorage.get(),\n [keyStorage],\n );\n const value = useSyncExternalStore(\n subscribe,\n getSnapshot,\n getSnapshot,\n );\n const setValue = useCallback(\n (value: T) => keyStorage.set(value),\n [keyStorage],\n );\n return [value, setValue];\n}","import { useCallback, useEffect, useRef } from 'react';\nexport default function useMountedState() {\n var mountedRef = useRef(false);\n var get = useCallback(function () { return mountedRef.current; }, []);\n useEffect(function () {\n mountedRef.current = true;\n return function () {\n mountedRef.current = false;\n };\n }, []);\n return get;\n}\n","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n fetcher as defaultFetcher,\n FetcherCapable,\n FetchExchange,\n FetchRequest, getFetcher,\n RequestOptions,\n} from '@ahoo-wang/fetcher';\nimport { useRef, useCallback, useEffect, useState } from 'react';\nimport { useMountedState } from 'react-use';\n\n/**\n * Configuration options for the useFetcher hook.\n * Extends RequestOptions and FetcherCapable interfaces.\n */\nexport interface UseFetcherOptions extends RequestOptions, FetcherCapable {\n /**\n * Whether the fetch operation should execute immediately upon component mount.\n * Defaults to true.\n */\n readonly immediate?: boolean;\n}\n\n/**\n * The result object returned by the useFetcher hook.\n * @template R - The type of the data returned by the fetch operation\n */\nexport interface UseFetcherResult<R> {\n /** Indicates if the fetch operation is currently in progress */\n loading: boolean;\n\n /** The FetchExchange object representing the ongoing fetch operation */\n exchange?: FetchExchange;\n\n /** The data returned by the fetch operation, or undefined if not yet loaded or an error occurred */\n result?: R;\n\n /** Any error that occurred during the fetch operation, or undefined if no error */\n error?: unknown;\n\n /**\n * Function to manually trigger the fetch operation.\n * Useful for fetching data on demand rather than automatically.\n */\n execute: () => Promise<void>;\n\n /** Function to cancel the ongoing fetch operation */\n cancel: () => void;\n}\n\nexport function useFetcher<R>(request: FetchRequest, options?: UseFetcherOptions): UseFetcherResult<R> {\n const { fetcher = defaultFetcher, immediate = true } = options || {};\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<unknown>(undefined);\n const [exchange, setExchange] = useState<FetchExchange | undefined>(undefined);\n const [result, setResult] = useState<R | undefined>(undefined);\n const isMounted = useMountedState();\n const abortControllerRef = useRef<AbortController | undefined>();\n\n const currentFetcher = getFetcher(fetcher);\n /**\n * Execute the fetch operation.\n * Cancels any ongoing fetch before starting a new one.\n */\n const execute = useCallback(async () => {\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n }\n abortControllerRef.current = request.abortController ?? new AbortController();\n request.abortController = abortControllerRef.current;\n if (isMounted()) {\n setLoading(true);\n setError(undefined);\n }\n try {\n const exchange = await currentFetcher.exchange(request, options);\n if (isMounted()) {\n setExchange(exchange);\n }\n const result = await exchange.extractResult<R>();\n if (isMounted()) {\n setResult(result);\n }\n } catch (error) {\n if (error instanceof Error && error.name === 'AbortError') {\n return;\n }\n if (isMounted()) {\n setError(error);\n }\n } finally {\n if (isMounted()) {\n setLoading(false);\n }\n if (abortControllerRef.current === request.abortController) {\n abortControllerRef.current = undefined;\n }\n }\n }, [currentFetcher, request, isMounted, options]);\n /**\n * Cancel the ongoing fetch operation if one is in progress.\n */\n const cancel = useCallback(() => {\n abortControllerRef.current?.abort();\n }, []);\n useEffect(() => {\n if (immediate) {\n execute();\n }\n return () => {\n abortControllerRef.current?.abort();\n abortControllerRef.current = undefined;\n };\n }, [execute, request, immediate]);\n return {\n loading, exchange, result, error, execute, cancel,\n };\n}"],"names":["useKeyStorage","keyStorage","subscribe","useCallback","callback","getSnapshot","value","useSyncExternalStore","setValue","useMountedState","mountedRef","useRef","get","useEffect","useFetcher","request","options","fetcher","defaultFetcher","immediate","loading","setLoading","useState","error","setError","exchange","setExchange","result","setResult","isMounted","abortControllerRef","currentFetcher","getFetcher","execute","cancel"],"mappings":";;AAwBO,SAASA,EACdC,GACgC;AAChC,QAAMC,IAAYC;AAAA,IAChB,CAACC,MAAyBH,EAAW,YAAYG,CAAQ;AAAA,IACzD,CAACH,CAAU;AAAA,EAAA,GAEPI,IAAcF;AAAA,IAClB,MAAMF,EAAW,IAAA;AAAA,IACjB,CAACA,CAAU;AAAA,EAAA,GAEPK,IAAQC;AAAA,IACZL;AAAA,IACAG;AAAA,IACAA;AAAA,EAAA,GAEIG,IAAWL;AAAA,IACf,CAACG,MAAaL,EAAW,IAAIK,CAAK;AAAA,IAClC,CAACL,CAAU;AAAA,EAAA;AAEb,SAAO,CAACK,GAAOE,CAAQ;AACzB;AC5Ce,SAASC,IAAkB;AACtC,MAAIC,IAAaC,EAAO,EAAK,GACzBC,IAAMT,EAAY,WAAY;AAAE,WAAOO,EAAW;AAAA,EAAS,GAAG,EAAE;AACpE,SAAAG,EAAU,WAAY;AAClB,WAAAH,EAAW,UAAU,IACd,WAAY;AACf,MAAAA,EAAW,UAAU;AAAA,IACzB;AAAA,EACJ,GAAG,CAAA,CAAE,GACEE;AACX;ACmDO,SAASE,EAAcC,GAAuBC,GAAkD;AACrG,QAAM,EAAA,SAAEC,IAAUC,GAAgB,WAAAC,IAAY,GAAA,IAASH,KAAW,CAAA,GAC5D,CAACI,GAASC,CAAU,IAAIC,EAAS,EAAK,GACtC,CAACC,GAAOC,CAAQ,IAAIF,EAAkB,MAAS,GAC/C,CAACG,GAAUC,CAAW,IAAIJ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yStorage.ts","../../../node_modules/.pnpm/react-use@17.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-use/esm/useMountedState.js","../src/fetcher/useFetcher.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useCallback, useSyncExternalStore } from 'react';\nimport { KeyStorage } from '@ahoo-wang/fetcher-storage';\n\n/**\n * A React hook that provides state management for a KeyStorage instance.\n * Subscribes to storage changes and returns the current value along with a setter function.\n *\n * @template T - The type of value stored in the key storage\n * @param keyStorage - The KeyStorage instance to subscribe to and manage\n * @returns A tuple containing the current stored value and a function to update it\n */\nexport function useKeyStorage<T>(\n keyStorage: KeyStorage<T>,\n): [T | null, (value: T) => void] {\n const subscribe = useCallback(\n (callback: () => void) => keyStorage.addListener(callback),\n [keyStorage],\n );\n const getSnapshot = useCallback(() => keyStorage.get(), [keyStorage]);\n const value = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n const setValue = useCallback(\n (value: T) => keyStorage.set(value),\n [keyStorage],\n );\n return [value, setValue];\n}\n","import { useCallback, useEffect, useRef } from 'react';\nexport default function useMountedState() {\n var mountedRef = useRef(false);\n var get = useCallback(function () { return mountedRef.current; }, []);\n useEffect(function () {\n mountedRef.current = true;\n return function () {\n mountedRef.current = false;\n };\n }, []);\n return get;\n}\n","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n fetcher as defaultFetcher,\n FetcherCapable,\n FetchExchange,\n FetchRequest,\n getFetcher,\n RequestOptions,\n} from '@ahoo-wang/fetcher';\nimport { useRef, useCallback, useEffect, useState } from 'react';\nimport { useMountedState } from 'react-use';\n\n/**\n * Configuration options for the useFetcher hook.\n * Extends RequestOptions and FetcherCapable interfaces.\n */\nexport interface UseFetcherOptions extends RequestOptions, FetcherCapable {\n /**\n * Whether the fetch operation should execute immediately upon component mount.\n * Defaults to true.\n */\n readonly immediate?: boolean;\n}\n\n/**\n * The result object returned by the useFetcher hook.\n * @template R - The type of the data returned by the fetch operation\n */\nexport interface UseFetcherResult<R> {\n /** Indicates if the fetch operation is currently in progress */\n loading: boolean;\n\n /** The FetchExchange object representing the ongoing fetch operation */\n exchange?: FetchExchange;\n\n /** The data returned by the fetch operation, or undefined if not yet loaded or an error occurred */\n result?: R;\n\n /** Any error that occurred during the fetch operation, or undefined if no error */\n error?: unknown;\n\n /**\n * Function to manually trigger the fetch operation.\n * Useful for fetching data on demand rather than automatically.\n */\n execute: () => Promise<void>;\n\n /** Function to cancel the ongoing fetch operation */\n cancel: () => void;\n}\n\nexport function useFetcher<R>(\n request: FetchRequest,\n options?: UseFetcherOptions,\n): UseFetcherResult<R> {\n const { fetcher = defaultFetcher, immediate = true } = options || {};\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<unknown>(undefined);\n const [exchange, setExchange] = useState<FetchExchange | undefined>(\n undefined,\n );\n const [result, setResult] = useState<R | undefined>(undefined);\n const isMounted = useMountedState();\n const abortControllerRef = useRef<AbortController | undefined>();\n\n const currentFetcher = getFetcher(fetcher);\n /**\n * Execute the fetch operation.\n * Cancels any ongoing fetch before starting a new one.\n */\n const execute = useCallback(async () => {\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n }\n abortControllerRef.current =\n request.abortController ?? new AbortController();\n request.abortController = abortControllerRef.current;\n if (isMounted()) {\n setLoading(true);\n setError(undefined);\n }\n try {\n const exchange = await currentFetcher.exchange(request, options);\n if (isMounted()) {\n setExchange(exchange);\n }\n const result = await exchange.extractResult<R>();\n if (isMounted()) {\n setResult(result);\n }\n } catch (error) {\n if (error instanceof Error && error.name === 'AbortError') {\n return;\n }\n if (isMounted()) {\n setError(error);\n }\n } finally {\n if (isMounted()) {\n setLoading(false);\n }\n if (abortControllerRef.current === request.abortController) {\n abortControllerRef.current = undefined;\n }\n }\n }, [currentFetcher, request, isMounted, options]);\n /**\n * Cancel the ongoing fetch operation if one is in progress.\n */\n const cancel = useCallback(() => {\n abortControllerRef.current?.abort();\n }, []);\n useEffect(() => {\n if (immediate) {\n execute();\n }\n return () => {\n abortControllerRef.current?.abort();\n abortControllerRef.current = undefined;\n };\n }, [execute, request, immediate]);\n return {\n loading,\n exchange,\n result,\n error,\n execute,\n cancel,\n };\n}\n"],"names":["useKeyStorage","keyStorage","subscribe","useCallback","callback","getSnapshot","value","useSyncExternalStore","setValue","useMountedState","mountedRef","useRef","get","useEffect","useFetcher","request","options","fetcher","defaultFetcher","immediate","loading","setLoading","useState","error","setError","exchange","setExchange","result","setResult","isMounted","abortControllerRef","currentFetcher","getFetcher","execute","cancel"],"mappings":";;AAwBO,SAASA,EACdC,GACgC;AAChC,QAAMC,IAAYC;AAAA,IAChB,CAACC,MAAyBH,EAAW,YAAYG,CAAQ;AAAA,IACzD,CAACH,CAAU;AAAA,EAAA,GAEPI,IAAcF,EAAY,MAAMF,EAAW,OAAO,CAACA,CAAU,CAAC,GAC9DK,IAAQC,EAAqBL,GAAWG,GAAaA,CAAW,GAChEG,IAAWL;AAAA,IACf,CAACG,MAAaL,EAAW,IAAIK,CAAK;AAAA,IAClC,CAACL,CAAU;AAAA,EAAA;AAEb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ACzCe,EAAmB,UAAU;AAAA,IAEjC;AAAA,EACF,GAAG,CAACC,GAAgBhB,GAASc,GAAWb,CAAO,CAAC,GAI1CkB,IAAS/B,EAAY,MAAM;AAC/B,IAAA2B,EAAmB,SAAS,MAAA;AAAA,EAC9B,GAAG,CAAA,CAAE;AACL,SAAAjB,EAAU,OACJM,KACFc,EAAA,GAEK,MAAM;AACX,IAAAH,EAAmB,SAAS,MAAA,GAC5BA,EAAmB,UAAU;AAAA,EAC/B,IACC,CAACG,GAASlB,GAASI,CAAS,CAAC,GACzB;AAAA,IACL,SAAAC;AAAA,IACA,UAAAK;AAAA,IACA,QAAAE;AAAA,IACA,OAAAJ;AAAA,IACA,SAAAU;AAAA,IACA,QAAAC;AAAA,EAAA;AAEJ;","x_google_ignoreList":[1]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../src/storage/useKeyStorage.ts","../../../node_modules/.pnpm/react-use@17.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-use/esm/useMountedState.js","../src/fetcher/useFetcher.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useCallback, useSyncExternalStore } from 'react';\nimport { KeyStorage } from '@ahoo-wang/fetcher-storage';\n\n/**\n * A React hook that provides state management for a KeyStorage instance.\n * Subscribes to storage changes and returns the current value along with a setter function.\n *\n * @template T - The type of value stored in the key storage\n * @param keyStorage - The KeyStorage instance to subscribe to and manage\n * @returns A tuple containing the current stored value and a function to update it\n */\nexport function useKeyStorage<T>(\n keyStorage: KeyStorage<T>,\n): [T | null, (value: T) => void] {\n const subscribe = useCallback(\n (callback: () => void) => keyStorage.addListener(callback),\n [keyStorage],\n );\n const getSnapshot = useCallback(\n () => keyStorage.get(),\n [keyStorage],\n );\n const value = useSyncExternalStore(\n subscribe,\n getSnapshot,\n getSnapshot,\n );\n const setValue = useCallback(\n (value: T) => keyStorage.set(value),\n [keyStorage],\n );\n return [value, setValue];\n}","import { useCallback, useEffect, useRef } from 'react';\nexport default function useMountedState() {\n var mountedRef = useRef(false);\n var get = useCallback(function () { return mountedRef.current; }, []);\n useEffect(function () {\n mountedRef.current = true;\n return function () {\n mountedRef.current = false;\n };\n }, []);\n return get;\n}\n","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n fetcher as defaultFetcher,\n FetcherCapable,\n FetchExchange,\n FetchRequest, getFetcher,\n RequestOptions,\n} from '@ahoo-wang/fetcher';\nimport { useRef, useCallback, useEffect, useState } from 'react';\nimport { useMountedState } from 'react-use';\n\n/**\n * Configuration options for the useFetcher hook.\n * Extends RequestOptions and FetcherCapable interfaces.\n */\nexport interface UseFetcherOptions extends RequestOptions, FetcherCapable {\n /**\n * Whether the fetch operation should execute immediately upon component mount.\n * Defaults to true.\n */\n readonly immediate?: boolean;\n}\n\n/**\n * The result object returned by the useFetcher hook.\n * @template R - The type of the data returned by the fetch operation\n */\nexport interface UseFetcherResult<R> {\n /** Indicates if the fetch operation is currently in progress */\n loading: boolean;\n\n /** The FetchExchange object representing the ongoing fetch operation */\n exchange?: FetchExchange;\n\n /** The data returned by the fetch operation, or undefined if not yet loaded or an error occurred */\n result?: R;\n\n /** Any error that occurred during the fetch operation, or undefined if no error */\n error?: unknown;\n\n /**\n * Function to manually trigger the fetch operation.\n * Useful for fetching data on demand rather than automatically.\n */\n execute: () => Promise<void>;\n\n /** Function to cancel the ongoing fetch operation */\n cancel: () => void;\n}\n\nexport function useFetcher<R>(request: FetchRequest, options?: UseFetcherOptions): UseFetcherResult<R> {\n const { fetcher = defaultFetcher, immediate = true } = options || {};\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<unknown>(undefined);\n const [exchange, setExchange] = useState<FetchExchange | undefined>(undefined);\n const [result, setResult] = useState<R | undefined>(undefined);\n const isMounted = useMountedState();\n const abortControllerRef = useRef<AbortController | undefined>();\n\n const currentFetcher = getFetcher(fetcher);\n /**\n * Execute the fetch operation.\n * Cancels any ongoing fetch before starting a new one.\n */\n const execute = useCallback(async () => {\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n }\n abortControllerRef.current = request.abortController ?? new AbortController();\n request.abortController = abortControllerRef.current;\n if (isMounted()) {\n setLoading(true);\n setError(undefined);\n }\n try {\n const exchange = await currentFetcher.exchange(request, options);\n if (isMounted()) {\n setExchange(exchange);\n }\n const result = await exchange.extractResult<R>();\n if (isMounted()) {\n setResult(result);\n }\n } catch (error) {\n if (error instanceof Error && error.name === 'AbortError') {\n return;\n }\n if (isMounted()) {\n setError(error);\n }\n } finally {\n if (isMounted()) {\n setLoading(false);\n }\n if (abortControllerRef.current === request.abortController) {\n abortControllerRef.current = undefined;\n }\n }\n }, [currentFetcher, request, isMounted, options]);\n /**\n * Cancel the ongoing fetch operation if one is in progress.\n */\n const cancel = useCallback(() => {\n abortControllerRef.current?.abort();\n }, []);\n useEffect(() => {\n if (immediate) {\n execute();\n }\n return () => {\n abortControllerRef.current?.abort();\n abortControllerRef.current = undefined;\n };\n }, [execute, request, immediate]);\n return {\n loading, exchange, result, error, execute, cancel,\n };\n}"],"names":["useKeyStorage","keyStorage","subscribe","useCallback","callback","getSnapshot","value","useSyncExternalStore","setValue","useMountedState","mountedRef","useRef","get","useEffect","useFetcher","request","options","fetcher","defaultFetcher","immediate","loading","setLoading","useState","error","setError","exchange","setExchange","result","setResult","isMounted","abortControllerRef","currentFetcher","getFetcher","execute","cancel"],"mappings":"uUAwBO,SAASA,EACdC,EACgC,CAChC,MAAMC,EAAYC,EAAAA,YACfC,GAAyBH,EAAW,YAAYG,CAAQ,EACzD,CAACH,CAAU,CAAA,EAEPI,EAAcF,EAAAA,YAClB,IAAMF,EAAW,IAAA,EACjB,CAACA,CAAU,CAAA,EAEPK,EAAQC,EAAAA,qBACZL,EACAG,EACAA,CAAA,EAEIG,EAAWL,EAAAA,YACdG,GAAaL,EAAW,IAAIK,CAAK,EAClC,CAACL,CAAU,CAAA,EAEb,MAAO,CAACK,EAAOE,CAAQ,CACzB,CC5Ce,SAASC,GAAkB,CACtC,IAAIC,EAAaC,EAAAA,OAAO,EAAK,EACzBC,EAAMT,EAAAA,YAAY,UAAY,CAAE,OAAOO,EAAW,OAAS,EAAG,EAAE,EACpEG,OAAAA,EAAAA,UAAU,UAAY,CAClB,OAAAH,EAAW,QAAU,GACd,UAAY,CACfA,EAAW,QAAU,EACzB,CACJ,EAAG,CAAA,CAAE,EACEE,CACX,CCmDO,SAASE,EAAcC,EAAuBC,EAAkD,CACrG,KAAM,CAAA,QAAEC,EAAUC,EAAAA,QAAgB,UAAAC,EAAY,EAAA,EAASH,GAAW,CAAA,EAC5D,CAACI,EAASC,CAAU,EAAIC,EAAAA,SAAS,EAAK,EACtC,CAACC,EAAOC,CAAQ,EAAIF,EAAAA,SAAkB,MAAS,EAC/C,CAACG,EAAUC,CAAW,EAAIJ,EAAAA,SAAoC,MAAS,EACvE,CAACK,EAAQC,CAAS,EAAIN,EAAAA,SAAwB,MAAS,EACvDO,EAAYpB,EAAA,EACZqB,EAAqBnB,EAAAA,OAAA,EAErBoB,EAAiBC,EAAAA,WAAWf,CAAO,EAKnCgB,EAAU9B,EAAAA,YAAY,SAAY,CAClC2B,EAAmB,SACrBA,EAAmB,QAAQ,MAAA,EAE7BA,EAAmB,QAAUf,EAAQ,iBAAmB,IAAI,gBAC5DA,EAAQ,gBAAkBe,EAAmB,QACzCD,MACFR,EAAW,EAAI,EACfG,EAAS,MAAS,GAEpB,GAAI,CACF,MAAMC,EAAW,MAAMM,EAAe,SAAShB,EAASC,CAAO,EAC3Da,KACFH,EAAYD,CAAQ,EAEtB,MAAME,EAAS,MAAMF,EAAS,cAAA,EAC1BI,KACFD,EAAUD,CAAM,CAEpB,OAASJ,EAAO,CACd,GAAIA,aAAiB,OAASA,EAAM,OAAS,aAC3C,OAEEM,KACFL,EAASD,CAAK,CAElB,QAAA,CACMM,KACFR,EAAW,EAAK,EAEdS,EAAmB,UAAYf,EAAQ,kBACzCe,EAAmB,QAAU,OAEjC,CACF,EAAG,CAACC,EAAgBhB,EAASc,EAAWb,CAAO,CAAC,EAI1CkB,EAAS/B,EAAAA,YAAY,IAAM,CAC/B2B,EAAmB,SAAS,MAAA,CAC9B,EAAG,CAAA,CAAE,EACLjB,OAAAA,EAAAA,UAAU,KACJM,GACFc,EAAA,EAEK,IAAM,CACXH,EAAmB,SAAS,MAAA,EAC5BA,EAAmB,QAAU,MAC/B,GACC,CAACG,EAASlB,EAASI,CAAS,CAAC,EACzB,CACL,QAAAC,EAAS,SAAAK,EAAU,OAAAE,EAAQ,MAAAJ,EAAO,QAAAU,EAAS,OAAAC,CAAA,CAE/C","x_google_ignoreList":[1]}
1
+ {"version":3,"file":"index.umd.js","sources":["../src/storage/useKeyStorage.ts","../../../node_modules/.pnpm/react-use@17.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-use/esm/useMountedState.js","../src/fetcher/useFetcher.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useCallback, useSyncExternalStore } from 'react';\nimport { KeyStorage } from '@ahoo-wang/fetcher-storage';\n\n/**\n * A React hook that provides state management for a KeyStorage instance.\n * Subscribes to storage changes and returns the current value along with a setter function.\n *\n * @template T - The type of value stored in the key storage\n * @param keyStorage - The KeyStorage instance to subscribe to and manage\n * @returns A tuple containing the current stored value and a function to update it\n */\nexport function useKeyStorage<T>(\n keyStorage: KeyStorage<T>,\n): [T | null, (value: T) => void] {\n const subscribe = useCallback(\n (callback: () => void) => keyStorage.addListener(callback),\n [keyStorage],\n );\n const getSnapshot = useCallback(() => keyStorage.get(), [keyStorage]);\n const value = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n const setValue = useCallback(\n (value: T) => keyStorage.set(value),\n [keyStorage],\n );\n return [value, setValue];\n}\n","import { useCallback, useEffect, useRef } from 'react';\nexport default function useMountedState() {\n var mountedRef = useRef(false);\n var get = useCallback(function () { return mountedRef.current; }, []);\n useEffect(function () {\n mountedRef.current = true;\n return function () {\n mountedRef.current = false;\n };\n }, []);\n return get;\n}\n","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n fetcher as defaultFetcher,\n FetcherCapable,\n FetchExchange,\n FetchRequest,\n getFetcher,\n RequestOptions,\n} from '@ahoo-wang/fetcher';\nimport { useRef, useCallback, useEffect, useState } from 'react';\nimport { useMountedState } from 'react-use';\n\n/**\n * Configuration options for the useFetcher hook.\n * Extends RequestOptions and FetcherCapable interfaces.\n */\nexport interface UseFetcherOptions extends RequestOptions, FetcherCapable {\n /**\n * Whether the fetch operation should execute immediately upon component mount.\n * Defaults to true.\n */\n readonly immediate?: boolean;\n}\n\n/**\n * The result object returned by the useFetcher hook.\n * @template R - The type of the data returned by the fetch operation\n */\nexport interface UseFetcherResult<R> {\n /** Indicates if the fetch operation is currently in progress */\n loading: boolean;\n\n /** The FetchExchange object representing the ongoing fetch operation */\n exchange?: FetchExchange;\n\n /** The data returned by the fetch operation, or undefined if not yet loaded or an error occurred */\n result?: R;\n\n /** Any error that occurred during the fetch operation, or undefined if no error */\n error?: unknown;\n\n /**\n * Function to manually trigger the fetch operation.\n * Useful for fetching data on demand rather than automatically.\n */\n execute: () => Promise<void>;\n\n /** Function to cancel the ongoing fetch operation */\n cancel: () => void;\n}\n\nexport function useFetcher<R>(\n request: FetchRequest,\n options?: UseFetcherOptions,\n): UseFetcherResult<R> {\n const { fetcher = defaultFetcher, immediate = true } = options || {};\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<unknown>(undefined);\n const [exchange, setExchange] = useState<FetchExchange | undefined>(\n undefined,\n );\n const [result, setResult] = useState<R | undefined>(undefined);\n const isMounted = useMountedState();\n const abortControllerRef = useRef<AbortController | undefined>();\n\n const currentFetcher = getFetcher(fetcher);\n /**\n * Execute the fetch operation.\n * Cancels any ongoing fetch before starting a new one.\n */\n const execute = useCallback(async () => {\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n }\n abortControllerRef.current =\n request.abortController ?? new AbortController();\n request.abortController = abortControllerRef.current;\n if (isMounted()) {\n setLoading(true);\n setError(undefined);\n }\n try {\n const exchange = await currentFetcher.exchange(request, options);\n if (isMounted()) {\n setExchange(exchange);\n }\n const result = await exchange.extractResult<R>();\n if (isMounted()) {\n setResult(result);\n }\n } catch (error) {\n if (error instanceof Error && error.name === 'AbortError') {\n return;\n }\n if (isMounted()) {\n setError(error);\n }\n } finally {\n if (isMounted()) {\n setLoading(false);\n }\n if (abortControllerRef.current === request.abortController) {\n abortControllerRef.current = undefined;\n }\n }\n }, [currentFetcher, request, isMounted, options]);\n /**\n * Cancel the ongoing fetch operation if one is in progress.\n */\n const cancel = useCallback(() => {\n abortControllerRef.current?.abort();\n }, []);\n useEffect(() => {\n if (immediate) {\n execute();\n }\n return () => {\n abortControllerRef.current?.abort();\n abortControllerRef.current = undefined;\n };\n }, [execute, request, immediate]);\n return {\n loading,\n exchange,\n result,\n error,\n execute,\n cancel,\n };\n}\n"],"names":["useKeyStorage","keyStorage","subscribe","useCallback","callback","getSnapshot","value","useSyncExternalStore","setValue","useMountedState","mountedRef","useRef","get","useEffect","useFetcher","request","options","fetcher","defaultFetcher","immediate","loading","setLoading","useState","error","setError","exchange","setExchange","result","setResult","isMounted","abortControllerRef","currentFetcher","getFetcher","execute","cancel"],"mappings":"uUAwBO,SAASA,EACdC,EACgC,CAChC,MAAMC,EAAYC,EAAAA,YACfC,GAAyBH,EAAW,YAAYG,CAAQ,EACzD,CAACH,CAAU,CAAA,EAEPI,EAAcF,EAAAA,YAAY,IAAMF,EAAW,MAAO,CAACA,CAAU,CAAC,EAC9DK,EAAQC,EAAAA,qBAAqBL,EAAWG,EAAaA,CAAW,EAChEG,EAAWL,EAAAA,YACdG,GAAaL,EAAW,IAAIK,CAAK,EAClC,CAACL,CAAU,CAAA,EAEb,MAAO,CAACK,EAAOE,CAAQ,CACzB,CCrCe,SAASC,GAAkB,CACtC,IAAIC,EAAaC,EAAAA,OAAO,EAAK,EACzBC,EAAMT,EAAAA,YAAY,UAAY,CAAE,OAAOO,EAAW,OAAS,EAAG,EAAE,EACpEG,OAAAA,EAAAA,UAAU,UAAY,CAClB,OAAAH,EAAW,QAAU,GACd,UAAY,CACfA,EAAW,QAAU,EACz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A,EAAmB,QAAU,MAC/B,GACC,CAACG,EAASlB,EAASI,CAAS,CAAC,EACzB,CACL,QAAAC,EACA,SAAAK,EACA,OAAAE,EACA,MAAAJ,EACA,QAAAU,EACA,OAAAC,CAAA,CAEJ","x_google_ignoreList":[1]}
@@ -1 +1 @@
1
- {"version":3,"file":"useKeyStorage.d.ts","sourceRoot":"","sources":["../../src/storage/useKeyStorage.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GACxB,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,CAmBhC"}
1
+ {"version":3,"file":"useKeyStorage.d.ts","sourceRoot":"","sources":["../../src/storage/useKeyStorage.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GACxB,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,CAYhC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahoo-wang/fetcher-react",
3
- "version": "1.9.3",
3
+ "version": "1.9.5",
4
4
  "description": "React integration for Fetcher HTTP client. Provides React Hooks and components for seamless data fetching with automatic re-rendering and loading states.",
5
5
  "keywords": [
6
6
  "fetch",
@@ -38,8 +38,8 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "react-use": "^17.6.0",
41
- "@ahoo-wang/fetcher-storage": "1.9.3",
42
- "@ahoo-wang/fetcher": "1.9.3"
41
+ "@ahoo-wang/fetcher": "1.9.5",
42
+ "@ahoo-wang/fetcher-storage": "1.9.5"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": ">=16.8.0",