@chat-lab/ui 0.1.0-beta.36 → 0.1.0-beta.37

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.
Files changed (234) hide show
  1. package/dist/_virtual/index4.cjs +2 -5
  2. package/dist/_virtual/index4.cjs.map +1 -1
  3. package/dist/_virtual/index4.js +2 -5
  4. package/dist/_virtual/index4.js.map +1 -1
  5. package/dist/_virtual/index5.cjs +5 -2
  6. package/dist/_virtual/index5.cjs.map +1 -1
  7. package/dist/_virtual/index5.js +5 -2
  8. package/dist/_virtual/index5.js.map +1 -1
  9. package/dist/adk/components/Debug/Events/index.cjs +2 -2
  10. package/dist/adk/components/Debug/Events/index.cjs.map +1 -1
  11. package/dist/adk/components/Debug/Events/index.js +2 -2
  12. package/dist/adk/components/Debug/Events/index.js.map +1 -1
  13. package/dist/adk/components/Debug/Trace/TraceDetail.cjs +0 -1
  14. package/dist/adk/components/Debug/Trace/TraceDetail.cjs.map +1 -1
  15. package/dist/adk/components/Debug/Trace/TraceDetail.d.ts.map +1 -1
  16. package/dist/adk/components/Debug/Trace/TraceDetail.js +0 -1
  17. package/dist/adk/components/Debug/Trace/TraceDetail.js.map +1 -1
  18. package/dist/adk/components/Debug/Trace/TraceMessageGroup.cjs +2 -2
  19. package/dist/adk/components/Debug/Trace/TraceMessageGroup.cjs.map +1 -1
  20. package/dist/adk/components/Debug/Trace/TraceMessageGroup.js +2 -2
  21. package/dist/adk/components/Debug/Trace/TraceMessageGroup.js.map +1 -1
  22. package/dist/adk/components/Debug/Trace/index.cjs +10 -7
  23. package/dist/adk/components/Debug/Trace/index.cjs.map +1 -1
  24. package/dist/adk/components/Debug/Trace/index.d.ts +1 -1
  25. package/dist/adk/components/Debug/Trace/index.d.ts.map +1 -1
  26. package/dist/adk/components/Debug/Trace/index.js +10 -7
  27. package/dist/adk/components/Debug/Trace/index.js.map +1 -1
  28. package/dist/adk/components/Debug/Trace/types.d.ts +1 -0
  29. package/dist/adk/components/Debug/Trace/types.d.ts.map +1 -1
  30. package/dist/adk/components/Debug/Trace/utils.cjs +3 -1
  31. package/dist/adk/components/Debug/Trace/utils.cjs.map +1 -1
  32. package/dist/adk/components/Debug/Trace/utils.d.ts.map +1 -1
  33. package/dist/adk/components/Debug/Trace/utils.js +3 -1
  34. package/dist/adk/components/Debug/Trace/utils.js.map +1 -1
  35. package/dist/adk/components/Debug/index.cjs.map +1 -1
  36. package/dist/adk/components/Debug/index.d.ts +3 -1
  37. package/dist/adk/components/Debug/index.d.ts.map +1 -1
  38. package/dist/adk/components/Debug/index.js.map +1 -1
  39. package/dist/adk/hooks/useEvents.cjs +8 -2
  40. package/dist/adk/hooks/useEvents.cjs.map +1 -1
  41. package/dist/adk/hooks/useEvents.d.ts +1 -1
  42. package/dist/adk/hooks/useEvents.d.ts.map +1 -1
  43. package/dist/adk/hooks/useEvents.js +8 -2
  44. package/dist/adk/hooks/useEvents.js.map +1 -1
  45. package/dist/components/Chatkit/index.cjs +4 -10
  46. package/dist/components/Chatkit/index.cjs.map +1 -1
  47. package/dist/components/Chatkit/index.d.ts.map +1 -1
  48. package/dist/components/Chatkit/index.js +4 -10
  49. package/dist/components/Chatkit/index.js.map +1 -1
  50. package/dist/components/Chatkit/types.d.ts +1 -0
  51. package/dist/components/Chatkit/types.d.ts.map +1 -1
  52. package/dist/components/ThreadOptionsMenu.cjs +10 -23
  53. package/dist/components/ThreadOptionsMenu.cjs.map +1 -1
  54. package/dist/components/ThreadOptionsMenu.d.ts.map +1 -1
  55. package/dist/components/ThreadOptionsMenu.js +11 -24
  56. package/dist/components/ThreadOptionsMenu.js.map +1 -1
  57. package/dist/components/assistant-ui/thread.cjs +1 -1
  58. package/dist/components/assistant-ui/thread.cjs.map +1 -1
  59. package/dist/components/assistant-ui/thread.js +1 -1
  60. package/dist/components/assistant-ui/thread.js.map +1 -1
  61. package/dist/index.css +1 -1
  62. package/dist/node_modules/.pnpm/@cloudfun_web-sdk@3.1.7_@volcengine_console-web-sdk@6.2.0/node_modules/@cloudfun/web-sdk/lib/util.cjs +1 -1
  63. package/dist/node_modules/.pnpm/@cloudfun_web-sdk@3.1.7_@volcengine_console-web-sdk@6.2.0/node_modules/@cloudfun/web-sdk/lib/util.js +1 -1
  64. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/index.cjs +1 -1
  65. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/index.js +1 -1
  66. package/dist/node_modules/ahooks/es/createUpdateEffect/index.cjs +27 -0
  67. package/dist/node_modules/ahooks/es/createUpdateEffect/index.cjs.map +1 -0
  68. package/dist/node_modules/ahooks/es/createUpdateEffect/index.js +22 -0
  69. package/dist/node_modules/ahooks/es/createUpdateEffect/index.js.map +1 -0
  70. package/dist/node_modules/ahooks/es/useCreation/index.cjs +22 -0
  71. package/dist/node_modules/ahooks/es/useCreation/index.cjs.map +1 -0
  72. package/dist/node_modules/ahooks/es/useCreation/index.js +20 -0
  73. package/dist/node_modules/ahooks/es/useCreation/index.js.map +1 -0
  74. package/dist/node_modules/ahooks/es/useEventListener/index.cjs +41 -0
  75. package/dist/node_modules/ahooks/es/useEventListener/index.cjs.map +1 -0
  76. package/dist/node_modules/ahooks/es/useEventListener/index.js +39 -0
  77. package/dist/node_modules/ahooks/es/useEventListener/index.js.map +1 -0
  78. package/dist/node_modules/ahooks/es/useLatest/index.cjs +12 -0
  79. package/dist/node_modules/ahooks/es/useLatest/index.cjs.map +1 -0
  80. package/dist/node_modules/ahooks/es/useLatest/index.js +10 -0
  81. package/dist/node_modules/ahooks/es/useLatest/index.js.map +1 -0
  82. package/dist/node_modules/ahooks/es/useMemoizedFn/index.cjs +32 -0
  83. package/dist/node_modules/ahooks/es/useMemoizedFn/index.cjs.map +1 -0
  84. package/dist/node_modules/ahooks/es/useMemoizedFn/index.js +30 -0
  85. package/dist/node_modules/ahooks/es/useMemoizedFn/index.js.map +1 -0
  86. package/dist/node_modules/ahooks/es/useMount/index.cjs +25 -0
  87. package/dist/node_modules/ahooks/es/useMount/index.cjs.map +1 -0
  88. package/dist/node_modules/ahooks/es/useMount/index.js +23 -0
  89. package/dist/node_modules/ahooks/es/useMount/index.js.map +1 -0
  90. package/dist/node_modules/ahooks/es/useRafState/index.cjs +23 -0
  91. package/dist/node_modules/ahooks/es/useRafState/index.cjs.map +1 -0
  92. package/dist/node_modules/ahooks/es/useRafState/index.js +21 -0
  93. package/dist/node_modules/ahooks/es/useRafState/index.js.map +1 -0
  94. package/dist/node_modules/ahooks/es/useRequest/index.cjs +8 -0
  95. package/dist/node_modules/ahooks/es/useRequest/index.cjs.map +1 -0
  96. package/dist/node_modules/ahooks/es/useRequest/index.js +6 -0
  97. package/dist/node_modules/ahooks/es/useRequest/index.js.map +1 -0
  98. package/dist/node_modules/ahooks/es/useRequest/src/Fetch.cjs +150 -0
  99. package/dist/node_modules/ahooks/es/useRequest/src/Fetch.cjs.map +1 -0
  100. package/dist/node_modules/ahooks/es/useRequest/src/Fetch.js +148 -0
  101. package/dist/node_modules/ahooks/es/useRequest/src/Fetch.js.map +1 -0
  102. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useAutoRunPlugin.cjs +51 -0
  103. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useAutoRunPlugin.cjs.map +1 -0
  104. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useAutoRunPlugin.js +49 -0
  105. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useAutoRunPlugin.js.map +1 -0
  106. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useCachePlugin.cjs +127 -0
  107. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useCachePlugin.cjs.map +1 -0
  108. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useCachePlugin.js +125 -0
  109. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useCachePlugin.js.map +1 -0
  110. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useDebouncePlugin.cjs +64 -0
  111. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useDebouncePlugin.cjs.map +1 -0
  112. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useDebouncePlugin.js +62 -0
  113. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useDebouncePlugin.js.map +1 -0
  114. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useLoadingDelayPlugin.cjs +44 -0
  115. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useLoadingDelayPlugin.cjs.map +1 -0
  116. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useLoadingDelayPlugin.js +42 -0
  117. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useLoadingDelayPlugin.js.map +1 -0
  118. package/dist/node_modules/ahooks/es/useRequest/src/plugins/usePollingPlugin.cjs +66 -0
  119. package/dist/node_modules/ahooks/es/useRequest/src/plugins/usePollingPlugin.cjs.map +1 -0
  120. package/dist/node_modules/ahooks/es/useRequest/src/plugins/usePollingPlugin.js +64 -0
  121. package/dist/node_modules/ahooks/es/useRequest/src/plugins/usePollingPlugin.js.map +1 -0
  122. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useRefreshOnWindowFocusPlugin.cjs +34 -0
  123. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useRefreshOnWindowFocusPlugin.cjs.map +1 -0
  124. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useRefreshOnWindowFocusPlugin.js +32 -0
  125. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useRefreshOnWindowFocusPlugin.js.map +1 -0
  126. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useRetryPlugin.cjs +51 -0
  127. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useRetryPlugin.cjs.map +1 -0
  128. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useRetryPlugin.js +49 -0
  129. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useRetryPlugin.js.map +1 -0
  130. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useThrottlePlugin.cjs +58 -0
  131. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useThrottlePlugin.cjs.map +1 -0
  132. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useThrottlePlugin.js +56 -0
  133. package/dist/node_modules/ahooks/es/useRequest/src/plugins/useThrottlePlugin.js.map +1 -0
  134. package/dist/node_modules/ahooks/es/useRequest/src/useRequest.cjs +38 -0
  135. package/dist/node_modules/ahooks/es/useRequest/src/useRequest.cjs.map +1 -0
  136. package/dist/node_modules/ahooks/es/useRequest/src/useRequest.js +36 -0
  137. package/dist/node_modules/ahooks/es/useRequest/src/useRequest.js.map +1 -0
  138. package/dist/node_modules/ahooks/es/useRequest/src/useRequestImplement.cjs +58 -0
  139. package/dist/node_modules/ahooks/es/useRequest/src/useRequestImplement.cjs.map +1 -0
  140. package/dist/node_modules/ahooks/es/useRequest/src/useRequestImplement.js +56 -0
  141. package/dist/node_modules/ahooks/es/useRequest/src/useRequestImplement.js.map +1 -0
  142. package/dist/node_modules/ahooks/es/useRequest/src/utils/cache.cjs +26 -0
  143. package/dist/node_modules/ahooks/es/useRequest/src/utils/cache.cjs.map +1 -0
  144. package/dist/node_modules/ahooks/es/useRequest/src/utils/cache.js +23 -0
  145. package/dist/node_modules/ahooks/es/useRequest/src/utils/cache.js.map +1 -0
  146. package/dist/node_modules/ahooks/es/useRequest/src/utils/cachePromise.cjs +24 -0
  147. package/dist/node_modules/ahooks/es/useRequest/src/utils/cachePromise.cjs.map +1 -0
  148. package/dist/node_modules/ahooks/es/useRequest/src/utils/cachePromise.js +21 -0
  149. package/dist/node_modules/ahooks/es/useRequest/src/utils/cachePromise.js.map +1 -0
  150. package/dist/node_modules/ahooks/es/useRequest/src/utils/cacheSubscribe.cjs +22 -0
  151. package/dist/node_modules/ahooks/es/useRequest/src/utils/cacheSubscribe.cjs.map +1 -0
  152. package/dist/node_modules/ahooks/es/useRequest/src/utils/cacheSubscribe.js +19 -0
  153. package/dist/node_modules/ahooks/es/useRequest/src/utils/cacheSubscribe.js.map +1 -0
  154. package/dist/node_modules/ahooks/es/useRequest/src/utils/isDocumentVisible.cjs +13 -0
  155. package/dist/node_modules/ahooks/es/useRequest/src/utils/isDocumentVisible.cjs.map +1 -0
  156. package/dist/node_modules/ahooks/es/useRequest/src/utils/isDocumentVisible.js +11 -0
  157. package/dist/node_modules/ahooks/es/useRequest/src/utils/isDocumentVisible.js.map +1 -0
  158. package/dist/node_modules/ahooks/es/useRequest/src/utils/isOnline.cjs +14 -0
  159. package/dist/node_modules/ahooks/es/useRequest/src/utils/isOnline.cjs.map +1 -0
  160. package/dist/node_modules/ahooks/es/useRequest/src/utils/isOnline.js +12 -0
  161. package/dist/node_modules/ahooks/es/useRequest/src/utils/isOnline.js.map +1 -0
  162. package/dist/node_modules/ahooks/es/useRequest/src/utils/limit.cjs +23 -0
  163. package/dist/node_modules/ahooks/es/useRequest/src/utils/limit.cjs.map +1 -0
  164. package/dist/node_modules/ahooks/es/useRequest/src/utils/limit.js +21 -0
  165. package/dist/node_modules/ahooks/es/useRequest/src/utils/limit.js.map +1 -0
  166. package/dist/node_modules/ahooks/es/useRequest/src/utils/subscribeFocus.cjs +26 -0
  167. package/dist/node_modules/ahooks/es/useRequest/src/utils/subscribeFocus.cjs.map +1 -0
  168. package/dist/node_modules/ahooks/es/useRequest/src/utils/subscribeFocus.js +24 -0
  169. package/dist/node_modules/ahooks/es/useRequest/src/utils/subscribeFocus.js.map +1 -0
  170. package/dist/node_modules/ahooks/es/useRequest/src/utils/subscribeReVisible.cjs +23 -0
  171. package/dist/node_modules/ahooks/es/useRequest/src/utils/subscribeReVisible.cjs.map +1 -0
  172. package/dist/node_modules/ahooks/es/useRequest/src/utils/subscribeReVisible.js +21 -0
  173. package/dist/node_modules/ahooks/es/useRequest/src/utils/subscribeReVisible.js.map +1 -0
  174. package/dist/node_modules/ahooks/es/useSize/index.cjs +34 -0
  175. package/dist/node_modules/ahooks/es/useSize/index.cjs.map +1 -0
  176. package/dist/node_modules/ahooks/es/useSize/index.js +32 -0
  177. package/dist/node_modules/ahooks/es/useSize/index.js.map +1 -0
  178. package/dist/node_modules/ahooks/es/useUnmount/index.cjs +22 -0
  179. package/dist/node_modules/ahooks/es/useUnmount/index.cjs.map +1 -0
  180. package/dist/node_modules/ahooks/es/useUnmount/index.js +20 -0
  181. package/dist/node_modules/ahooks/es/useUnmount/index.js.map +1 -0
  182. package/dist/node_modules/ahooks/es/useUpdate/index.cjs +13 -0
  183. package/dist/node_modules/ahooks/es/useUpdate/index.cjs.map +1 -0
  184. package/dist/node_modules/ahooks/es/useUpdate/index.js +11 -0
  185. package/dist/node_modules/ahooks/es/useUpdate/index.js.map +1 -0
  186. package/dist/node_modules/ahooks/es/useUpdateEffect/index.cjs +9 -0
  187. package/dist/node_modules/ahooks/es/useUpdateEffect/index.cjs.map +1 -0
  188. package/dist/node_modules/ahooks/es/useUpdateEffect/index.js +7 -0
  189. package/dist/node_modules/ahooks/es/useUpdateEffect/index.js.map +1 -0
  190. package/dist/node_modules/ahooks/es/useVirtualList/index.cjs +123 -0
  191. package/dist/node_modules/ahooks/es/useVirtualList/index.cjs.map +1 -0
  192. package/dist/node_modules/ahooks/es/useVirtualList/index.js +121 -0
  193. package/dist/node_modules/ahooks/es/useVirtualList/index.js.map +1 -0
  194. package/dist/node_modules/ahooks/es/utils/createEffectWithTarget.cjs +53 -0
  195. package/dist/node_modules/ahooks/es/utils/createEffectWithTarget.cjs.map +1 -0
  196. package/dist/node_modules/ahooks/es/utils/createEffectWithTarget.js +51 -0
  197. package/dist/node_modules/ahooks/es/utils/createEffectWithTarget.js.map +1 -0
  198. package/dist/node_modules/ahooks/es/utils/depsAreSame.cjs +16 -0
  199. package/dist/node_modules/ahooks/es/utils/depsAreSame.cjs.map +1 -0
  200. package/dist/node_modules/ahooks/es/utils/depsAreSame.js +14 -0
  201. package/dist/node_modules/ahooks/es/utils/depsAreSame.js.map +1 -0
  202. package/dist/node_modules/ahooks/es/utils/domTarget.cjs +27 -0
  203. package/dist/node_modules/ahooks/es/utils/domTarget.cjs.map +1 -0
  204. package/dist/node_modules/ahooks/es/utils/domTarget.js +25 -0
  205. package/dist/node_modules/ahooks/es/utils/domTarget.js.map +1 -0
  206. package/dist/node_modules/ahooks/es/utils/index.cjs +10 -0
  207. package/dist/node_modules/ahooks/es/utils/index.cjs.map +1 -0
  208. package/dist/node_modules/ahooks/es/utils/index.js +7 -0
  209. package/dist/node_modules/ahooks/es/utils/index.js.map +1 -0
  210. package/dist/node_modules/ahooks/es/utils/isBrowser.cjs +9 -0
  211. package/dist/node_modules/ahooks/es/utils/isBrowser.cjs.map +1 -0
  212. package/dist/node_modules/ahooks/es/utils/isBrowser.js +7 -0
  213. package/dist/node_modules/ahooks/es/utils/isBrowser.js.map +1 -0
  214. package/dist/node_modules/ahooks/es/utils/isDev.cjs +7 -0
  215. package/dist/node_modules/ahooks/es/utils/isDev.cjs.map +1 -0
  216. package/dist/node_modules/ahooks/es/utils/isDev.js +5 -0
  217. package/dist/node_modules/ahooks/es/utils/isDev.js.map +1 -0
  218. package/dist/node_modules/ahooks/es/utils/useEffectWithTarget.cjs +10 -0
  219. package/dist/node_modules/ahooks/es/utils/useEffectWithTarget.cjs.map +1 -0
  220. package/dist/node_modules/ahooks/es/utils/useEffectWithTarget.js +8 -0
  221. package/dist/node_modules/ahooks/es/utils/useEffectWithTarget.js.map +1 -0
  222. package/dist/node_modules/ahooks/es/utils/useIsomorphicLayoutEffectWithTarget.cjs +13 -0
  223. package/dist/node_modules/ahooks/es/utils/useIsomorphicLayoutEffectWithTarget.cjs.map +1 -0
  224. package/dist/node_modules/ahooks/es/utils/useIsomorphicLayoutEffectWithTarget.js +11 -0
  225. package/dist/node_modules/ahooks/es/utils/useIsomorphicLayoutEffectWithTarget.js.map +1 -0
  226. package/dist/node_modules/ahooks/es/utils/useLayoutEffectWithTarget.cjs +10 -0
  227. package/dist/node_modules/ahooks/es/utils/useLayoutEffectWithTarget.cjs.map +1 -0
  228. package/dist/node_modules/ahooks/es/utils/useLayoutEffectWithTarget.js +8 -0
  229. package/dist/node_modules/ahooks/es/utils/useLayoutEffectWithTarget.js.map +1 -0
  230. package/dist/packages/core/dist/index.cjs +23 -32
  231. package/dist/packages/core/dist/index.cjs.map +1 -1
  232. package/dist/packages/core/dist/index.js +23 -32
  233. package/dist/packages/core/dist/index.js.map +1 -1
  234. package/package.json +1 -1
@@ -0,0 +1,51 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+
5
+ var useRetryPlugin = function (fetchInstance, _a) {
6
+ var retryInterval = _a.retryInterval, retryCount = _a.retryCount;
7
+ var timerRef = React.useRef(undefined);
8
+ var countRef = React.useRef(0);
9
+ var triggerByRetry = React.useRef(false);
10
+ if (!retryCount) {
11
+ return {};
12
+ }
13
+ return {
14
+ onBefore: function () {
15
+ if (!triggerByRetry.current) {
16
+ countRef.current = 0;
17
+ }
18
+ triggerByRetry.current = false;
19
+ if (timerRef.current) {
20
+ clearTimeout(timerRef.current);
21
+ }
22
+ },
23
+ onSuccess: function () {
24
+ countRef.current = 0;
25
+ },
26
+ onError: function () {
27
+ countRef.current += 1;
28
+ if (retryCount === -1 || countRef.current <= retryCount) {
29
+ // Exponential backoff
30
+ var timeout = retryInterval !== null && retryInterval !== void 0 ? retryInterval : Math.min(1000 * Math.pow(2, countRef.current), 30000);
31
+ timerRef.current = setTimeout(function () {
32
+ triggerByRetry.current = true;
33
+ fetchInstance.refresh();
34
+ }, timeout);
35
+ }
36
+ else {
37
+ countRef.current = 0;
38
+ }
39
+ },
40
+ onCancel: function () {
41
+ countRef.current = 0;
42
+ if (timerRef.current) {
43
+ clearTimeout(timerRef.current);
44
+ }
45
+ },
46
+ };
47
+ };
48
+ var useRetryPlugin$1 = useRetryPlugin;
49
+
50
+ module.exports = useRetryPlugin$1;
51
+ //# sourceMappingURL=useRetryPlugin.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRetryPlugin.cjs","sources":["../../../../../../../../../node_modules/ahooks/es/useRequest/src/plugins/useRetryPlugin.js"],"sourcesContent":["import { useRef } from 'react';\nvar useRetryPlugin = function (fetchInstance, _a) {\n var retryInterval = _a.retryInterval, retryCount = _a.retryCount;\n var timerRef = useRef(undefined);\n var countRef = useRef(0);\n var triggerByRetry = useRef(false);\n if (!retryCount) {\n return {};\n }\n return {\n onBefore: function () {\n if (!triggerByRetry.current) {\n countRef.current = 0;\n }\n triggerByRetry.current = false;\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n }\n },\n onSuccess: function () {\n countRef.current = 0;\n },\n onError: function () {\n countRef.current += 1;\n if (retryCount === -1 || countRef.current <= retryCount) {\n // Exponential backoff\n var timeout = retryInterval !== null && retryInterval !== void 0 ? retryInterval : Math.min(1000 * Math.pow(2, countRef.current), 30000);\n timerRef.current = setTimeout(function () {\n triggerByRetry.current = true;\n fetchInstance.refresh();\n }, timeout);\n }\n else {\n countRef.current = 0;\n }\n },\n onCancel: function () {\n countRef.current = 0;\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n }\n },\n };\n};\nexport default useRetryPlugin;\n"],"names":["useRef"],"mappings":";;;;AACA,IAAI,cAAc,GAAG,UAAU,aAAa,EAAE,EAAE,EAAE;AAClD,IAAI,IAAI,aAAa,GAAG,EAAE,CAAC,aAAa,EAAE,UAAU,GAAG,EAAE,CAAC,UAAU,CAAC;AACrE,IAAI,IAAI,QAAQ,GAAGA,YAAM,CAAC,SAAS,CAAC,CAAC;AACrC,IAAI,IAAI,QAAQ,GAAGA,YAAM,CAAC,CAAC,CAAC,CAAC;AAC7B,IAAI,IAAI,cAAc,GAAGA,YAAM,CAAC,KAAK,CAAC,CAAC;AACvC,IAAI,IAAI,CAAC,UAAU,EAAE;AACrB,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,OAAO;AACX,QAAQ,QAAQ,EAAE,YAAY;AAC9B,YAAY,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;AACzC,gBAAgB,QAAQ,CAAC,OAAO,GAAG,CAAC,CAAC;AACrC,aAAa;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}
@@ -0,0 +1,49 @@
1
+ import { useRef } from 'react';
2
+
3
+ var useRetryPlugin = function (fetchInstance, _a) {
4
+ var retryInterval = _a.retryInterval, retryCount = _a.retryCount;
5
+ var timerRef = useRef(undefined);
6
+ var countRef = useRef(0);
7
+ var triggerByRetry = useRef(false);
8
+ if (!retryCount) {
9
+ return {};
10
+ }
11
+ return {
12
+ onBefore: function () {
13
+ if (!triggerByRetry.current) {
14
+ countRef.current = 0;
15
+ }
16
+ triggerByRetry.current = false;
17
+ if (timerRef.current) {
18
+ clearTimeout(timerRef.current);
19
+ }
20
+ },
21
+ onSuccess: function () {
22
+ countRef.current = 0;
23
+ },
24
+ onError: function () {
25
+ countRef.current += 1;
26
+ if (retryCount === -1 || countRef.current <= retryCount) {
27
+ // Exponential backoff
28
+ var timeout = retryInterval !== null && retryInterval !== void 0 ? retryInterval : Math.min(1000 * Math.pow(2, countRef.current), 30000);
29
+ timerRef.current = setTimeout(function () {
30
+ triggerByRetry.current = true;
31
+ fetchInstance.refresh();
32
+ }, timeout);
33
+ }
34
+ else {
35
+ countRef.current = 0;
36
+ }
37
+ },
38
+ onCancel: function () {
39
+ countRef.current = 0;
40
+ if (timerRef.current) {
41
+ clearTimeout(timerRef.current);
42
+ }
43
+ },
44
+ };
45
+ };
46
+ var useRetryPlugin$1 = useRetryPlugin;
47
+
48
+ export { useRetryPlugin$1 as default };
49
+ //# sourceMappingURL=useRetryPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRetryPlugin.js","sources":["../../../../../../../../../node_modules/ahooks/es/useRequest/src/plugins/useRetryPlugin.js"],"sourcesContent":["import { useRef } from 'react';\nvar useRetryPlugin = function (fetchInstance, _a) {\n var retryInterval = _a.retryInterval, retryCount = _a.retryCount;\n var timerRef = useRef(undefined);\n var countRef = useRef(0);\n var triggerByRetry = useRef(false);\n if (!retryCount) {\n return {};\n }\n return {\n onBefore: function () {\n if (!triggerByRetry.current) {\n countRef.current = 0;\n }\n triggerByRetry.current = false;\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n }\n },\n onSuccess: function () {\n countRef.current = 0;\n },\n onError: function () {\n countRef.current += 1;\n if (retryCount === -1 || countRef.current <= retryCount) {\n // Exponential backoff\n var timeout = retryInterval !== null && retryInterval !== void 0 ? retryInterval : Math.min(1000 * Math.pow(2, countRef.current), 30000);\n timerRef.current = setTimeout(function () {\n triggerByRetry.current = true;\n fetchInstance.refresh();\n }, timeout);\n }\n else {\n countRef.current = 0;\n }\n },\n onCancel: function () {\n countRef.current = 0;\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n }\n },\n };\n};\nexport default useRetryPlugin;\n"],"names":[],"mappings":";;AACA,IAAI,cAAc,GAAG,UAAU,aAAa,EAAE,EAAE,EAAE;AAClD,IAAI,IAAI,aAAa,GAAG,EAAE,CAAC,aAAa,EAAE,UAAU,GAAG,EAAE,CAAC,UAAU,CAAC;AACrE,IAAI,IAAI,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AACrC,IAAI,IAAI,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAC7B,IAAI,IAAI,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AACvC,IAAI,IAAI,CAAC,UAAU,EAAE;AACrB,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,OAAO;AACX,QAAQ,QAAQ,EAAE,YAAY;AAC9B,YAAY,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;AACzC,gBAAgB,QAAQ,CAAC,OAAO,GAAG,CAAC,CAAC;AACrC,aAAa;AACb,YAAY,cAAc,CAAC,OAAO,GAAG,KAAK,CAAC;AAC3C,YAAY,IAAI,QAAQ,CAAC,OAAO,EAAE;AAClC,gBAAgB,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC/C,aAAa;AACb,SAAS;AACT,QAAQ,SAAS,EAAE,YAAY;AAC/B,YAAY,QAAQ,CAAC,OAAO,GAAG,CAAC,CAAC;AACjC,SAAS;AACT,QAAQ,OAAO,EAAE,YAAY;AAC7B,YAAY,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAClC,YAAY,IAAI,UAAU,KAAK,CAAC,CAAC,IAAI,QAAQ,CAAC,OAAO,IAAI,UAAU,EAAE;AACrE;AACA,gBAAgB,IAAI,OAAO,GAAG,aAAa,KAAK,IAAI,IAAI,aAAa,KAAK,KAAK,CAAC,GAAG,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC;AACzJ,gBAAgB,QAAQ,CAAC,OAAO,GAAG,UAAU,CAAC,YAAY;AAC1D,oBAAoB,cAAc,CAAC,OAAO,GAAG,IAAI,CAAC;AAClD,oBAAoB,aAAa,CAAC,OAAO,EAAE,CAAC;AAC5C,iBAAiB,EAAE,OAAO,CAAC,CAAC;AAC5B,aAAa;AACb,iBAAiB;AACjB,gBAAgB,QAAQ,CAAC,OAAO,GAAG,CAAC,CAAC;AACrC,aAAa;AACb,SAAS;AACT,QAAQ,QAAQ,EAAE,YAAY;AAC9B,YAAY,QAAQ,CAAC,OAAO,GAAG,CAAC,CAAC;AACjC,YAAY,IAAI,QAAQ,CAAC,OAAO,EAAE;AAClC,gBAAgB,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC/C,aAAa;AACb,SAAS;AACT,KAAK,CAAC;AACN,CAAC,CAAC;AACF,uBAAe,cAAc;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ var tslib_es6 = require('../../../../../.pnpm/@rollup_plugin-typescript@11.1.6_rollup@3.29.5_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.cjs');
4
+ var throttle = require('lodash/throttle');
5
+ var React = require('react');
6
+
7
+ var useThrottlePlugin = function (fetchInstance, _a) {
8
+ var throttleWait = _a.throttleWait, throttleLeading = _a.throttleLeading, throttleTrailing = _a.throttleTrailing;
9
+ var throttledRef = React.useRef(undefined);
10
+ var options = {};
11
+ if (throttleLeading !== undefined) {
12
+ options.leading = throttleLeading;
13
+ }
14
+ if (throttleTrailing !== undefined) {
15
+ options.trailing = throttleTrailing;
16
+ }
17
+ React.useEffect(function () {
18
+ if (throttleWait) {
19
+ var _originRunAsync_1 = fetchInstance.runAsync.bind(fetchInstance);
20
+ throttledRef.current = throttle(function (callback) {
21
+ callback();
22
+ }, throttleWait, options);
23
+ // throttle runAsync should be promise
24
+ // https://github.com/lodash/lodash/issues/4400#issuecomment-834800398
25
+ fetchInstance.runAsync = function () {
26
+ var args = [];
27
+ for (var _i = 0; _i < arguments.length; _i++) {
28
+ args[_i] = arguments[_i];
29
+ }
30
+ return new Promise(function (resolve, reject) {
31
+ var _a;
32
+ (_a = throttledRef.current) === null || _a === void 0 ? void 0 : _a.call(throttledRef, function () {
33
+ _originRunAsync_1.apply(void 0, tslib_es6.__spreadArray([], tslib_es6.__read(args), false)).then(resolve)
34
+ .catch(reject);
35
+ });
36
+ });
37
+ };
38
+ return function () {
39
+ var _a;
40
+ fetchInstance.runAsync = _originRunAsync_1;
41
+ (_a = throttledRef.current) === null || _a === void 0 ? void 0 : _a.cancel();
42
+ };
43
+ }
44
+ }, [throttleWait, throttleLeading, throttleTrailing]);
45
+ if (!throttleWait) {
46
+ return {};
47
+ }
48
+ return {
49
+ onCancel: function () {
50
+ var _a;
51
+ (_a = throttledRef.current) === null || _a === void 0 ? void 0 : _a.cancel();
52
+ },
53
+ };
54
+ };
55
+ var useThrottlePlugin$1 = useThrottlePlugin;
56
+
57
+ module.exports = useThrottlePlugin$1;
58
+ //# sourceMappingURL=useThrottlePlugin.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useThrottlePlugin.cjs","sources":["../../../../../../../../../node_modules/ahooks/es/useRequest/src/plugins/useThrottlePlugin.js"],"sourcesContent":["import { __read, __spreadArray } from \"tslib\";\nimport throttle from 'lodash/throttle';\nimport { useEffect, useRef } from 'react';\nvar useThrottlePlugin = function (fetchInstance, _a) {\n var throttleWait = _a.throttleWait, throttleLeading = _a.throttleLeading, throttleTrailing = _a.throttleTrailing;\n var throttledRef = useRef(undefined);\n var options = {};\n if (throttleLeading !== undefined) {\n options.leading = throttleLeading;\n }\n if (throttleTrailing !== undefined) {\n options.trailing = throttleTrailing;\n }\n useEffect(function () {\n if (throttleWait) {\n var _originRunAsync_1 = fetchInstance.runAsync.bind(fetchInstance);\n throttledRef.current = throttle(function (callback) {\n callback();\n }, throttleWait, options);\n // throttle runAsync should be promise\n // https://github.com/lodash/lodash/issues/4400#issuecomment-834800398\n fetchInstance.runAsync = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new Promise(function (resolve, reject) {\n var _a;\n (_a = throttledRef.current) === null || _a === void 0 ? void 0 : _a.call(throttledRef, function () {\n _originRunAsync_1.apply(void 0, __spreadArray([], __read(args), false)).then(resolve)\n .catch(reject);\n });\n });\n };\n return function () {\n var _a;\n fetchInstance.runAsync = _originRunAsync_1;\n (_a = throttledRef.current) === null || _a === void 0 ? void 0 : _a.cancel();\n };\n }\n }, [throttleWait, throttleLeading, throttleTrailing]);\n if (!throttleWait) {\n return {};\n }\n return {\n onCancel: function () {\n var _a;\n (_a = throttledRef.current) === null || _a === void 0 ? void 0 : _a.cancel();\n },\n };\n};\nexport default useThrottlePlugin;\n"],"names":["useRef","useEffect","__spreadArray","__read"],"mappings":";;;;;;AAGA,IAAI,iBAAiB,GAAG,UAAU,aAAa,EAAE,EAAE,EAAE;AACrD,IAAI,IAAI,YAAY,GAAG,EAAE,CAAC,YAAY,EAAE,eAAe,GAAG,EAAE,CAAC,eAAe,EAAE,gBAAgB,GAAG,EAAE,CAAC,gBAAgB,CAAC;AACrH,IAAI,IAAI,YAAY,GAAGA,YAAM,CAAC,SAAS,CAAC,CAAC;AACzC,IAAI,IAA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CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;AAC7G,6BAA6B,KAAK,CAAC,MAAM,CAAC,CAAC;AAC3C,qBAAqB,CAAC,CAAC;AACvB,iBAAiB,CAAC,CAAC;AACnB,aAAa,CAAC;AACd,YAAY,OAAO,YAAY;AAC/B,gBAAgB,IAAI,EAAE,CAAC;AACvB,gBAAgB,aAAa,CAAC,QAAQ,GAAG,iBAAiB,CAAC;AAC3D,gBAAgB,CAAC,EAAE,GAAG,YAAY,CAAC,OAAO,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;AAC7F,aAAa,CAAC;AACd,SAAS;AACT,KAAK,EAAE,CAAC,YAAY,EAAE,eAAe,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAC1D,IAAI,IAAI,CAAC,YAAY,EAAE;AACvB,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,OAAO;AACX,QAAQ,QAAQ,EAAE,YAAY;AAC9B,YAAY,IAAI,EAAE,CAAC;AACnB,YAAY,CAAC,EAAE,GAAG,YAAY,CAAC,OAAO,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;AACzF,SAAS;AACT,KAAK,CAAC;AACN,CAAC,CAAC;AACF,0BAAe,iBAAiB;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,56 @@
1
+ import { __spreadArray, __read } from '../../../../../.pnpm/@rollup_plugin-typescript@11.1.6_rollup@3.29.5_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js';
2
+ import throttle from 'lodash/throttle';
3
+ import { useRef, useEffect } from 'react';
4
+
5
+ var useThrottlePlugin = function (fetchInstance, _a) {
6
+ var throttleWait = _a.throttleWait, throttleLeading = _a.throttleLeading, throttleTrailing = _a.throttleTrailing;
7
+ var throttledRef = useRef(undefined);
8
+ var options = {};
9
+ if (throttleLeading !== undefined) {
10
+ options.leading = throttleLeading;
11
+ }
12
+ if (throttleTrailing !== undefined) {
13
+ options.trailing = throttleTrailing;
14
+ }
15
+ useEffect(function () {
16
+ if (throttleWait) {
17
+ var _originRunAsync_1 = fetchInstance.runAsync.bind(fetchInstance);
18
+ throttledRef.current = throttle(function (callback) {
19
+ callback();
20
+ }, throttleWait, options);
21
+ // throttle runAsync should be promise
22
+ // https://github.com/lodash/lodash/issues/4400#issuecomment-834800398
23
+ fetchInstance.runAsync = function () {
24
+ var args = [];
25
+ for (var _i = 0; _i < arguments.length; _i++) {
26
+ args[_i] = arguments[_i];
27
+ }
28
+ return new Promise(function (resolve, reject) {
29
+ var _a;
30
+ (_a = throttledRef.current) === null || _a === void 0 ? void 0 : _a.call(throttledRef, function () {
31
+ _originRunAsync_1.apply(void 0, __spreadArray([], __read(args), false)).then(resolve)
32
+ .catch(reject);
33
+ });
34
+ });
35
+ };
36
+ return function () {
37
+ var _a;
38
+ fetchInstance.runAsync = _originRunAsync_1;
39
+ (_a = throttledRef.current) === null || _a === void 0 ? void 0 : _a.cancel();
40
+ };
41
+ }
42
+ }, [throttleWait, throttleLeading, throttleTrailing]);
43
+ if (!throttleWait) {
44
+ return {};
45
+ }
46
+ return {
47
+ onCancel: function () {
48
+ var _a;
49
+ (_a = throttledRef.current) === null || _a === void 0 ? void 0 : _a.cancel();
50
+ },
51
+ };
52
+ };
53
+ var useThrottlePlugin$1 = useThrottlePlugin;
54
+
55
+ export { useThrottlePlugin$1 as default };
56
+ //# sourceMappingURL=useThrottlePlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useThrottlePlugin.js","sources":["../../../../../../../../../node_modules/ahooks/es/useRequest/src/plugins/useThrottlePlugin.js"],"sourcesContent":["import { __read, __spreadArray } from \"tslib\";\nimport throttle from 'lodash/throttle';\nimport { useEffect, useRef } from 'react';\nvar useThrottlePlugin = function (fetchInstance, _a) {\n var throttleWait = _a.throttleWait, throttleLeading = _a.throttleLeading, throttleTrailing = _a.throttleTrailing;\n var throttledRef = useRef(undefined);\n var options = {};\n if (throttleLeading !== undefined) {\n options.leading = throttleLeading;\n }\n if (throttleTrailing !== undefined) {\n options.trailing = throttleTrailing;\n }\n useEffect(function () {\n if (throttleWait) {\n var _originRunAsync_1 = fetchInstance.runAsync.bind(fetchInstance);\n throttledRef.current = throttle(function (callback) {\n callback();\n }, throttleWait, options);\n // throttle runAsync should be promise\n // https://github.com/lodash/lodash/issues/4400#issuecomment-834800398\n fetchInstance.runAsync = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new Promise(function (resolve, reject) {\n var _a;\n (_a = throttledRef.current) === null || _a === void 0 ? void 0 : _a.call(throttledRef, function () {\n _originRunAsync_1.apply(void 0, __spreadArray([], __read(args), false)).then(resolve)\n .catch(reject);\n });\n });\n };\n return function () {\n var _a;\n fetchInstance.runAsync = _originRunAsync_1;\n (_a = throttledRef.current) === null || _a === void 0 ? void 0 : _a.cancel();\n };\n }\n }, [throttleWait, throttleLeading, throttleTrailing]);\n if (!throttleWait) {\n return {};\n }\n return {\n onCancel: function () {\n var _a;\n (_a = throttledRef.current) === null || _a === void 0 ? void 0 : _a.cancel();\n },\n };\n};\nexport default useThrottlePlugin;\n"],"names":[],"mappings":";;;;AAGA,IAAI,iBAAiB,GAAG,UAAU,aAAa,EAAE,EAAE,EAAE;AACrD,IAAI,IAAI,YAAY,GAAG,EAAE,CAAC,YAAY,EAAE,eAAe,GAAG,EAAE,CAAC,eAAe,EAAE,gBAAgB,GAAG,EAAE,CAAC,gBAAgB,CAAC;AACrH,IAAI,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AACzC,IAAI,IAAI,OAAO,GAAG,EAAE,CAAC;AACrB,IAAI,IAAI,eAAe,KAAK,SAAS,EAAE;AACvC,QAAQ,OAAO,CAAC,OAAO,GAAG,eAAe,CAAC;AAC1C,KAAK;AACL,I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AAa,CAAC;AACd,YAAY,OAAO,YAAY;AAC/B,gBAAgB,IAAI,EAAE,CAAC;AACvB,gBAAgB,aAAa,CAAC,QAAQ,GAAG,iBAAiB,CAAC;AAC3D,gBAAgB,CAAC,EAAE,GAAG,YAAY,CAAC,OAAO,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;AAC7F,aAAa,CAAC;AACd,SAAS;AACT,KAAK,EAAE,CAAC,YAAY,EAAE,eAAe,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAC1D,IAAI,IAAI,CAAC,YAAY,EAAE;AACvB,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,OAAO;AACX,QAAQ,QAAQ,EAAE,YAAY;AAC9B,YAAY,IAAI,EAAE,CAAC;AACnB,YAAY,CAAC,EAAE,GAAG,YAAY,CAAC,OAAO,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;AACzF,SAAS;AACT,KAAK,CAAC;AACN,CAAC,CAAC;AACF,0BAAe,iBAAiB;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ var tslib_es6 = require('../../../../.pnpm/@rollup_plugin-typescript@11.1.6_rollup@3.29.5_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.cjs');
4
+ var useAutoRunPlugin = require('./plugins/useAutoRunPlugin.cjs');
5
+ var useCachePlugin = require('./plugins/useCachePlugin.cjs');
6
+ var useDebouncePlugin = require('./plugins/useDebouncePlugin.cjs');
7
+ var useLoadingDelayPlugin = require('./plugins/useLoadingDelayPlugin.cjs');
8
+ var usePollingPlugin = require('./plugins/usePollingPlugin.cjs');
9
+ var useRefreshOnWindowFocusPlugin = require('./plugins/useRefreshOnWindowFocusPlugin.cjs');
10
+ var useRetryPlugin = require('./plugins/useRetryPlugin.cjs');
11
+ var useThrottlePlugin = require('./plugins/useThrottlePlugin.cjs');
12
+ var useRequestImplement = require('./useRequestImplement.cjs');
13
+
14
+ // function useRequest<TData, TParams extends any[], TFormated, TTFormated extends TFormated = any>(
15
+ // service: Service<TData, TParams>,
16
+ // options: OptionsWithFormat<TData, TParams, TFormated, TTFormated>,
17
+ // plugins?: Plugin<TData, TParams>[],
18
+ // ): Result<TFormated, TParams>
19
+ // function useRequest<TData, TParams extends any[]>(
20
+ // service: Service<TData, TParams>,
21
+ // options?: OptionsWithoutFormat<TData, TParams>,
22
+ // plugins?: Plugin<TData, TParams>[],
23
+ // ): Result<TData, TParams>
24
+ function useRequest(service, options, plugins) {
25
+ return useRequestImplement(service, options, tslib_es6.__spreadArray(tslib_es6.__spreadArray([], tslib_es6.__read((plugins || [])), false), [
26
+ useDebouncePlugin,
27
+ useLoadingDelayPlugin,
28
+ usePollingPlugin,
29
+ useRefreshOnWindowFocusPlugin,
30
+ useThrottlePlugin,
31
+ useAutoRunPlugin,
32
+ useCachePlugin,
33
+ useRetryPlugin,
34
+ ], false));
35
+ }
36
+
37
+ module.exports = useRequest;
38
+ //# sourceMappingURL=useRequest.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRequest.cjs","sources":["../../../../../../../../node_modules/ahooks/es/useRequest/src/useRequest.js"],"sourcesContent":["import { __read, __spreadArray } from \"tslib\";\nimport useAutoRunPlugin from './plugins/useAutoRunPlugin';\nimport useCachePlugin from './plugins/useCachePlugin';\nimport useDebouncePlugin from './plugins/useDebouncePlugin';\nimport useLoadingDelayPlugin from './plugins/useLoadingDelayPlugin';\nimport usePollingPlugin from './plugins/usePollingPlugin';\nimport useRefreshOnWindowFocusPlugin from './plugins/useRefreshOnWindowFocusPlugin';\nimport useRetryPlugin from './plugins/useRetryPlugin';\nimport useThrottlePlugin from './plugins/useThrottlePlugin';\nimport useRequestImplement from './useRequestImplement';\n// function useRequest<TData, TParams extends any[], TFormated, TTFormated extends TFormated = any>(\n// service: Service<TData, TParams>,\n// options: OptionsWithFormat<TData, TParams, TFormated, TTFormated>,\n// plugins?: Plugin<TData, TParams>[],\n// ): Result<TFormated, TParams>\n// function useRequest<TData, TParams extends any[]>(\n// service: Service<TData, TParams>,\n// options?: OptionsWithoutFormat<TData, TParams>,\n// plugins?: Plugin<TData, TParams>[],\n// ): Result<TData, TParams>\nfunction useRequest(service, options, plugins) {\n return useRequestImplement(service, options, __spreadArray(__spreadArray([], __read((plugins || [])), false), [\n useDebouncePlugin,\n useLoadingDelayPlugin,\n usePollingPlugin,\n useRefreshOnWindowFocusPlugin,\n useThrottlePlugin,\n useAutoRunPlugin,\n useCachePlugin,\n useRetryPlugin,\n ], false));\n}\nexport default useRequest;\n"],"names":["__spreadArray","__read"],"mappings":";;;;;;;;;;;;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE;AAC/C,IAAI,OAAO,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAEA,uBAAa,CAACA,uBAAa,CAAC,EAAE,EAAEC,gBAAM,EAAE,OAAO,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE;AAClH,QAAQ,iBAAiB;AACzB,QAAQ,qBAAqB;AAC7B,QAAQ,gBAAgB;AACxB,QAAQ,6BAA6B;AACrC,QAAQ,iBAAiB;AACzB,QAAQ,gBAAgB;AACxB,QAAQ,cAAc;AACtB,QAAQ,cAAc;AACtB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AACf;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,36 @@
1
+ import { __spreadArray, __read } from '../../../../.pnpm/@rollup_plugin-typescript@11.1.6_rollup@3.29.5_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js';
2
+ import useAutoRunPlugin from './plugins/useAutoRunPlugin.js';
3
+ import useCachePlugin from './plugins/useCachePlugin.js';
4
+ import useDebouncePlugin from './plugins/useDebouncePlugin.js';
5
+ import useLoadingDelayPlugin from './plugins/useLoadingDelayPlugin.js';
6
+ import usePollingPlugin from './plugins/usePollingPlugin.js';
7
+ import useRefreshOnWindowFocusPlugin from './plugins/useRefreshOnWindowFocusPlugin.js';
8
+ import useRetryPlugin from './plugins/useRetryPlugin.js';
9
+ import useThrottlePlugin from './plugins/useThrottlePlugin.js';
10
+ import useRequestImplement from './useRequestImplement.js';
11
+
12
+ // function useRequest<TData, TParams extends any[], TFormated, TTFormated extends TFormated = any>(
13
+ // service: Service<TData, TParams>,
14
+ // options: OptionsWithFormat<TData, TParams, TFormated, TTFormated>,
15
+ // plugins?: Plugin<TData, TParams>[],
16
+ // ): Result<TFormated, TParams>
17
+ // function useRequest<TData, TParams extends any[]>(
18
+ // service: Service<TData, TParams>,
19
+ // options?: OptionsWithoutFormat<TData, TParams>,
20
+ // plugins?: Plugin<TData, TParams>[],
21
+ // ): Result<TData, TParams>
22
+ function useRequest(service, options, plugins) {
23
+ return useRequestImplement(service, options, __spreadArray(__spreadArray([], __read((plugins || [])), false), [
24
+ useDebouncePlugin,
25
+ useLoadingDelayPlugin,
26
+ usePollingPlugin,
27
+ useRefreshOnWindowFocusPlugin,
28
+ useThrottlePlugin,
29
+ useAutoRunPlugin,
30
+ useCachePlugin,
31
+ useRetryPlugin,
32
+ ], false));
33
+ }
34
+
35
+ export { useRequest as default };
36
+ //# sourceMappingURL=useRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRequest.js","sources":["../../../../../../../../node_modules/ahooks/es/useRequest/src/useRequest.js"],"sourcesContent":["import { __read, __spreadArray } from \"tslib\";\nimport useAutoRunPlugin from './plugins/useAutoRunPlugin';\nimport useCachePlugin from './plugins/useCachePlugin';\nimport useDebouncePlugin from './plugins/useDebouncePlugin';\nimport useLoadingDelayPlugin from './plugins/useLoadingDelayPlugin';\nimport usePollingPlugin from './plugins/usePollingPlugin';\nimport useRefreshOnWindowFocusPlugin from './plugins/useRefreshOnWindowFocusPlugin';\nimport useRetryPlugin from './plugins/useRetryPlugin';\nimport useThrottlePlugin from './plugins/useThrottlePlugin';\nimport useRequestImplement from './useRequestImplement';\n// function useRequest<TData, TParams extends any[], TFormated, TTFormated extends TFormated = any>(\n// service: Service<TData, TParams>,\n// options: OptionsWithFormat<TData, TParams, TFormated, TTFormated>,\n// plugins?: Plugin<TData, TParams>[],\n// ): Result<TFormated, TParams>\n// function useRequest<TData, TParams extends any[]>(\n// service: Service<TData, TParams>,\n// options?: OptionsWithoutFormat<TData, TParams>,\n// plugins?: Plugin<TData, TParams>[],\n// ): Result<TData, TParams>\nfunction useRequest(service, options, plugins) {\n return useRequestImplement(service, options, __spreadArray(__spreadArray([], __read((plugins || [])), false), [\n useDebouncePlugin,\n useLoadingDelayPlugin,\n usePollingPlugin,\n useRefreshOnWindowFocusPlugin,\n useThrottlePlugin,\n useAutoRunPlugin,\n useCachePlugin,\n useRetryPlugin,\n ], false));\n}\nexport default useRequest;\n"],"names":[],"mappings":";;;;;;;;;;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE;AAC/C,IAAI,OAAO,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE;AAClH,QAAQ,iBAAiB;AACzB,QAAQ,qBAAqB;AAC7B,QAAQ,gBAAgB;AACxB,QAAQ,6BAA6B;AACrC,QAAQ,iBAAiB;AACzB,QAAQ,gBAAgB;AACxB,QAAQ,cAAc;AACtB,QAAQ,cAAc;AACtB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AACf;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ var tslib_es6 = require('../../../../.pnpm/@rollup_plugin-typescript@11.1.6_rollup@3.29.5_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.cjs');
4
+ var index$2 = require('../../useCreation/index.cjs');
5
+ var index = require('../../useLatest/index.cjs');
6
+ var index$5 = require('../../useMemoizedFn/index.cjs');
7
+ var index$3 = require('../../useMount/index.cjs');
8
+ var index$4 = require('../../useUnmount/index.cjs');
9
+ var index$1 = require('../../useUpdate/index.cjs');
10
+ var isDev = require('../../utils/isDev.cjs');
11
+ var Fetch = require('./Fetch.cjs');
12
+
13
+ function useRequestImplement(service, options, plugins) {
14
+ if (options === void 0) { options = {}; }
15
+ if (plugins === void 0) { plugins = []; }
16
+ var _a = options.manual, manual = _a === void 0 ? false : _a, _b = options.ready, ready = _b === void 0 ? true : _b, rest = tslib_es6.__rest(options, ["manual", "ready"]);
17
+ if (isDev) {
18
+ if (options.defaultParams && !Array.isArray(options.defaultParams)) {
19
+ console.warn("expected defaultParams is array, got ".concat(typeof options.defaultParams));
20
+ }
21
+ }
22
+ var fetchOptions = tslib_es6.__assign({ manual: manual, ready: ready }, rest);
23
+ var serviceRef = index(service);
24
+ var update = index$1();
25
+ var fetchInstance = index$2(function () {
26
+ var initState = plugins.map(function (p) { var _a; return (_a = p === null || p === void 0 ? void 0 : p.onInit) === null || _a === void 0 ? void 0 : _a.call(p, fetchOptions); }).filter(Boolean);
27
+ return new Fetch(serviceRef, fetchOptions, update, Object.assign.apply(Object, tslib_es6.__spreadArray([{}], tslib_es6.__read(initState), false)));
28
+ }, []);
29
+ fetchInstance.options = fetchOptions;
30
+ // run all plugins hooks
31
+ fetchInstance.pluginImpls = plugins.map(function (p) { return p(fetchInstance, fetchOptions); });
32
+ index$3(function () {
33
+ if (!manual && ready) {
34
+ // useCachePlugin can set fetchInstance.state.params from cache when init
35
+ var params = fetchInstance.state.params || options.defaultParams || [];
36
+ // @ts-ignore
37
+ fetchInstance.run.apply(fetchInstance, tslib_es6.__spreadArray([], tslib_es6.__read(params), false));
38
+ }
39
+ });
40
+ index$4(function () {
41
+ fetchInstance.cancel();
42
+ });
43
+ return {
44
+ loading: fetchInstance.state.loading,
45
+ data: fetchInstance.state.data,
46
+ error: fetchInstance.state.error,
47
+ params: fetchInstance.state.params || [],
48
+ cancel: index$5(fetchInstance.cancel.bind(fetchInstance)),
49
+ refresh: index$5(fetchInstance.refresh.bind(fetchInstance)),
50
+ refreshAsync: index$5(fetchInstance.refreshAsync.bind(fetchInstance)),
51
+ run: index$5(fetchInstance.run.bind(fetchInstance)),
52
+ runAsync: index$5(fetchInstance.runAsync.bind(fetchInstance)),
53
+ mutate: index$5(fetchInstance.mutate.bind(fetchInstance)),
54
+ };
55
+ }
56
+
57
+ module.exports = useRequestImplement;
58
+ //# sourceMappingURL=useRequestImplement.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRequestImplement.cjs","sources":["../../../../../../../../node_modules/ahooks/es/useRequest/src/useRequestImplement.js"],"sourcesContent":["import { __assign, __read, __rest, __spreadArray } from \"tslib\";\nimport useCreation from '../../useCreation';\nimport useLatest from '../../useLatest';\nimport useMemoizedFn from '../../useMemoizedFn';\nimport useMount from '../../useMount';\nimport useUnmount from '../../useUnmount';\nimport useUpdate from '../../useUpdate';\nimport isDev from '../../utils/isDev';\nimport Fetch from './Fetch';\nfunction useRequestImplement(service, options, plugins) {\n if (options === void 0) { options = {}; }\n if (plugins === void 0) { plugins = []; }\n var _a = options.manual, manual = _a === void 0 ? false : _a, _b = options.ready, ready = _b === void 0 ? true : _b, rest = __rest(options, [\"manual\", \"ready\"]);\n if (isDev) {\n if (options.defaultParams && !Array.isArray(options.defaultParams)) {\n console.warn(\"expected defaultParams is array, got \".concat(typeof options.defaultParams));\n }\n }\n var fetchOptions = __assign({ manual: manual, ready: ready }, rest);\n var serviceRef = useLatest(service);\n var update = useUpdate();\n var fetchInstance = useCreation(function () {\n var initState = plugins.map(function (p) { var _a; return (_a = p === null || p === void 0 ? void 0 : p.onInit) === null || _a === void 0 ? void 0 : _a.call(p, fetchOptions); }).filter(Boolean);\n return new Fetch(serviceRef, fetchOptions, update, Object.assign.apply(Object, __spreadArray([{}], __read(initState), false)));\n }, []);\n fetchInstance.options = fetchOptions;\n // run all plugins hooks\n fetchInstance.pluginImpls = plugins.map(function (p) { return p(fetchInstance, fetchOptions); });\n useMount(function () {\n if (!manual && ready) {\n // useCachePlugin can set fetchInstance.state.params from cache when init\n var params = fetchInstance.state.params || options.defaultParams || [];\n // @ts-ignore\n fetchInstance.run.apply(fetchInstance, __spreadArray([], __read(params), false));\n }\n });\n useUnmount(function () {\n fetchInstance.cancel();\n });\n return {\n loading: fetchInstance.state.loading,\n data: fetchInstance.state.data,\n error: fetchInstance.state.error,\n params: fetchInstance.state.params || [],\n cancel: useMemoizedFn(fetchInstance.cancel.bind(fetchInstance)),\n refresh: useMemoizedFn(fetchInstance.refresh.bind(fetchInstance)),\n refreshAsync: useMemoizedFn(fetchInstance.refreshAsync.bind(fetchInstance)),\n run: useMemoizedFn(fetchInstance.run.bind(fetchInstance)),\n runAsync: useMemoizedFn(fetchInstance.runAsync.bind(fetchInstance)),\n mutate: useMemoizedFn(fetchInstance.mutate.bind(fetchInstance)),\n };\n}\nexport default useRequestImplement;\n"],"names":["__rest","__assign","useLatest","useUpdate","useCreation","__spreadArray","__read","useMount","useUnmount","useMemoizedFn"],"mappings":";;;;;;;;;;;;AASA,SAAS,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE;AACxD,IAAI,IAAI,OAAO,KAAK,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,CAAC,EAAE;AAC7C,IAAI,IAAI,OAAO,KAAK,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,CAAC,EAAE;AAC7C,IAAI,IAAI,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,GAAG,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,KAAK,GA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AEA,OAAa,CAAC,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACnF,QAAQ,GAAG,EAAEA,OAAa,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACjE,QAAQ,QAAQ,EAAEA,OAAa,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AAC3E,QAAQ,MAAM,EAAEA,OAAa,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACvE,KAAK,CAAC;AACN;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,56 @@
1
+ import { __rest, __assign, __spreadArray, __read } from '../../../../.pnpm/@rollup_plugin-typescript@11.1.6_rollup@3.29.5_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js';
2
+ import useCreation from '../../useCreation/index.js';
3
+ import useLatest from '../../useLatest/index.js';
4
+ import useMemoizedFn from '../../useMemoizedFn/index.js';
5
+ import useMount from '../../useMount/index.js';
6
+ import useUnmount from '../../useUnmount/index.js';
7
+ import useUpdate from '../../useUpdate/index.js';
8
+ import isDev from '../../utils/isDev.js';
9
+ import Fetch from './Fetch.js';
10
+
11
+ function useRequestImplement(service, options, plugins) {
12
+ if (options === void 0) { options = {}; }
13
+ if (plugins === void 0) { plugins = []; }
14
+ var _a = options.manual, manual = _a === void 0 ? false : _a, _b = options.ready, ready = _b === void 0 ? true : _b, rest = __rest(options, ["manual", "ready"]);
15
+ if (isDev) {
16
+ if (options.defaultParams && !Array.isArray(options.defaultParams)) {
17
+ console.warn("expected defaultParams is array, got ".concat(typeof options.defaultParams));
18
+ }
19
+ }
20
+ var fetchOptions = __assign({ manual: manual, ready: ready }, rest);
21
+ var serviceRef = useLatest(service);
22
+ var update = useUpdate();
23
+ var fetchInstance = useCreation(function () {
24
+ var initState = plugins.map(function (p) { var _a; return (_a = p === null || p === void 0 ? void 0 : p.onInit) === null || _a === void 0 ? void 0 : _a.call(p, fetchOptions); }).filter(Boolean);
25
+ return new Fetch(serviceRef, fetchOptions, update, Object.assign.apply(Object, __spreadArray([{}], __read(initState), false)));
26
+ }, []);
27
+ fetchInstance.options = fetchOptions;
28
+ // run all plugins hooks
29
+ fetchInstance.pluginImpls = plugins.map(function (p) { return p(fetchInstance, fetchOptions); });
30
+ useMount(function () {
31
+ if (!manual && ready) {
32
+ // useCachePlugin can set fetchInstance.state.params from cache when init
33
+ var params = fetchInstance.state.params || options.defaultParams || [];
34
+ // @ts-ignore
35
+ fetchInstance.run.apply(fetchInstance, __spreadArray([], __read(params), false));
36
+ }
37
+ });
38
+ useUnmount(function () {
39
+ fetchInstance.cancel();
40
+ });
41
+ return {
42
+ loading: fetchInstance.state.loading,
43
+ data: fetchInstance.state.data,
44
+ error: fetchInstance.state.error,
45
+ params: fetchInstance.state.params || [],
46
+ cancel: useMemoizedFn(fetchInstance.cancel.bind(fetchInstance)),
47
+ refresh: useMemoizedFn(fetchInstance.refresh.bind(fetchInstance)),
48
+ refreshAsync: useMemoizedFn(fetchInstance.refreshAsync.bind(fetchInstance)),
49
+ run: useMemoizedFn(fetchInstance.run.bind(fetchInstance)),
50
+ runAsync: useMemoizedFn(fetchInstance.runAsync.bind(fetchInstance)),
51
+ mutate: useMemoizedFn(fetchInstance.mutate.bind(fetchInstance)),
52
+ };
53
+ }
54
+
55
+ export { useRequestImplement as default };
56
+ //# sourceMappingURL=useRequestImplement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRequestImplement.js","sources":["../../../../../../../../node_modules/ahooks/es/useRequest/src/useRequestImplement.js"],"sourcesContent":["import { __assign, __read, __rest, __spreadArray } from \"tslib\";\nimport useCreation from '../../useCreation';\nimport useLatest from '../../useLatest';\nimport useMemoizedFn from '../../useMemoizedFn';\nimport useMount from '../../useMount';\nimport useUnmount from '../../useUnmount';\nimport useUpdate from '../../useUpdate';\nimport isDev from '../../utils/isDev';\nimport Fetch from './Fetch';\nfunction useRequestImplement(service, options, plugins) {\n if (options === void 0) { options = {}; }\n if (plugins === void 0) { plugins = []; }\n var _a = options.manual, manual = _a === void 0 ? false : _a, _b = options.ready, ready = _b === void 0 ? true : _b, rest = __rest(options, [\"manual\", \"ready\"]);\n if (isDev) {\n if (options.defaultParams && !Array.isArray(options.defaultParams)) {\n console.warn(\"expected defaultParams is array, got \".concat(typeof options.defaultParams));\n }\n }\n var fetchOptions = __assign({ manual: manual, ready: ready }, rest);\n var serviceRef = useLatest(service);\n var update = useUpdate();\n var fetchInstance = useCreation(function () {\n var initState = plugins.map(function (p) { var _a; return (_a = p === null || p === void 0 ? void 0 : p.onInit) === null || _a === void 0 ? void 0 : _a.call(p, fetchOptions); }).filter(Boolean);\n return new Fetch(serviceRef, fetchOptions, update, Object.assign.apply(Object, __spreadArray([{}], __read(initState), false)));\n }, []);\n fetchInstance.options = fetchOptions;\n // run all plugins hooks\n fetchInstance.pluginImpls = plugins.map(function (p) { return p(fetchInstance, fetchOptions); });\n useMount(function () {\n if (!manual && ready) {\n // useCachePlugin can set fetchInstance.state.params from cache when init\n var params = fetchInstance.state.params || options.defaultParams || [];\n // @ts-ignore\n fetchInstance.run.apply(fetchInstance, __spreadArray([], __read(params), false));\n }\n });\n useUnmount(function () {\n fetchInstance.cancel();\n });\n return {\n loading: fetchInstance.state.loading,\n data: fetchInstance.state.data,\n error: fetchInstance.state.error,\n params: fetchInstance.state.params || [],\n cancel: useMemoizedFn(fetchInstance.cancel.bind(fetchInstance)),\n refresh: useMemoizedFn(fetchInstance.refresh.bind(fetchInstance)),\n refreshAsync: useMemoizedFn(fetchInstance.refreshAsync.bind(fetchInstance)),\n run: useMemoizedFn(fetchInstance.run.bind(fetchInstance)),\n runAsync: useMemoizedFn(fetchInstance.runAsync.bind(fetchInstance)),\n mutate: useMemoizedFn(fetchInstance.mutate.bind(fetchInstance)),\n };\n}\nexport default useRequestImplement;\n"],"names":[],"mappings":";;;;;;;;;;AASA,SAAS,mBAAmB,CA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,CAAC,KAAK,CAAC,IAAI;AACtC,QAAQ,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,KAAK;AACxC,QAAQ,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE;AAChD,QAAQ,MAAM,EAAE,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACvE,QAAQ,OAAO,EAAE,aAAa,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACzE,QAAQ,YAAY,EAAE,aAAa,CAAC,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACnF,QAAQ,GAAG,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACjE,QAAQ,QAAQ,EAAE,aAAa,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AAC3E,QAAQ,MAAM,EAAE,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACvE,KAAK,CAAC;AACN;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ var tslib_es6 = require('../../../../../.pnpm/@rollup_plugin-typescript@11.1.6_rollup@3.29.5_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.cjs');
4
+
5
+ var cache = new Map();
6
+ var setCache = function (key, cacheTime, cachedData) {
7
+ var currentCache = cache.get(key);
8
+ if (currentCache === null || currentCache === void 0 ? void 0 : currentCache.timer) {
9
+ clearTimeout(currentCache.timer);
10
+ }
11
+ var timer = undefined;
12
+ if (cacheTime > -1) {
13
+ // if cache out, clear it
14
+ timer = setTimeout(function () {
15
+ cache.delete(key);
16
+ }, cacheTime);
17
+ }
18
+ cache.set(key, tslib_es6.__assign(tslib_es6.__assign({}, cachedData), { timer: timer }));
19
+ };
20
+ var getCache = function (key) {
21
+ return cache.get(key);
22
+ };
23
+
24
+ exports.getCache = getCache;
25
+ exports.setCache = setCache;
26
+ //# sourceMappingURL=cache.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.cjs","sources":["../../../../../../../../../node_modules/ahooks/es/useRequest/src/utils/cache.js"],"sourcesContent":["import { __assign } from \"tslib\";\nvar cache = new Map();\nvar setCache = function (key, cacheTime, cachedData) {\n var currentCache = cache.get(key);\n if (currentCache === null || currentCache === void 0 ? void 0 : currentCache.timer) {\n clearTimeout(currentCache.timer);\n }\n var timer = undefined;\n if (cacheTime > -1) {\n // if cache out, clear it\n timer = setTimeout(function () {\n cache.delete(key);\n }, cacheTime);\n }\n cache.set(key, __assign(__assign({}, cachedData), { timer: timer }));\n};\nvar getCache = function (key) {\n return cache.get(key);\n};\nvar clearCache = function (key) {\n if (key) {\n var cacheKeys = Array.isArray(key) ? key : [key];\n cacheKeys.forEach(function (cacheKey) { return cache.delete(cacheKey); });\n }\n else {\n cache.clear();\n }\n};\nexport { getCache, setCache, clearCache };\n"],"names":["__assign"],"mappings":";;;;AACA,IAAI,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;AACnB,IAAC,QAAQ,GAAG,UAAU,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE;AACrD,IAAI,IAAI,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACtC,IAAI,IAAI,YAAY,KAAK,IAAI,IAAI,YAAY,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,YAAY,CAAC,KAAK,EAAE;AACxF,QAAQ,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;AACzC,KAAK;AACL,IAAI,IAAI,KAAK,GAAG,SAAS,CAAC;AAC1B,IAAI,IAAI,SAAS,GAAG,CAAC,CAAC,EAAE;AACxB;AACA,QAAQ,KAAK,GAAG,UAAU,CAAC,YAAY;AACvC,YAAY,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC9B,SAAS,EAAE,SAAS,CAAC,CAAC;AACtB,KAAK;AACL,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,EAAEA,kBAAQ,CAACA,kBAAQ,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AACzE,EAAE;AACC,IAAC,QAAQ,GAAG,UAAU,GAAG,EAAE;AAC9B,IAAI,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC1B;;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,23 @@
1
+ import { __assign } from '../../../../../.pnpm/@rollup_plugin-typescript@11.1.6_rollup@3.29.5_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js';
2
+
3
+ var cache = new Map();
4
+ var setCache = function (key, cacheTime, cachedData) {
5
+ var currentCache = cache.get(key);
6
+ if (currentCache === null || currentCache === void 0 ? void 0 : currentCache.timer) {
7
+ clearTimeout(currentCache.timer);
8
+ }
9
+ var timer = undefined;
10
+ if (cacheTime > -1) {
11
+ // if cache out, clear it
12
+ timer = setTimeout(function () {
13
+ cache.delete(key);
14
+ }, cacheTime);
15
+ }
16
+ cache.set(key, __assign(__assign({}, cachedData), { timer: timer }));
17
+ };
18
+ var getCache = function (key) {
19
+ return cache.get(key);
20
+ };
21
+
22
+ export { getCache, setCache };
23
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.js","sources":["../../../../../../../../../node_modules/ahooks/es/useRequest/src/utils/cache.js"],"sourcesContent":["import { __assign } from \"tslib\";\nvar cache = new Map();\nvar setCache = function (key, cacheTime, cachedData) {\n var currentCache = cache.get(key);\n if (currentCache === null || currentCache === void 0 ? void 0 : currentCache.timer) {\n clearTimeout(currentCache.timer);\n }\n var timer = undefined;\n if (cacheTime > -1) {\n // if cache out, clear it\n timer = setTimeout(function () {\n cache.delete(key);\n }, cacheTime);\n }\n cache.set(key, __assign(__assign({}, cachedData), { timer: timer }));\n};\nvar getCache = function (key) {\n return cache.get(key);\n};\nvar clearCache = function (key) {\n if (key) {\n var cacheKeys = Array.isArray(key) ? key : [key];\n cacheKeys.forEach(function (cacheKey) { return cache.delete(cacheKey); });\n }\n else {\n cache.clear();\n }\n};\nexport { getCache, setCache, clearCache };\n"],"names":[],"mappings":";;AACA,IAAI,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;AACnB,IAAC,QAAQ,GAAG,UAAU,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE;AACrD,IAAI,IAAI,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACtC,IAAI,IAAI,YAAY,KAAK,IAAI,IAAI,YAAY,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,YAAY,CAAC,KAAK,EAAE;AACxF,QAAQ,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;AACzC,KAAK;AACL,IAAI,IAAI,KAAK,GAAG,SAAS,CAAC;AAC1B,IAAI,IAAI,SAAS,GAAG,CAAC,CAAC,EAAE;AACxB;AACA,QAAQ,KAAK,GAAG,UAAU,CAAC,YAAY;AACvC,YAAY,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC9B,SAAS,EAAE,SAAS,CAAC,CAAC;AACtB,KAAK;AACL,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AACzE,EAAE;AACC,IAAC,QAAQ,GAAG,UAAU,GAAG,EAAE;AAC9B,IAAI,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC1B;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ var cachePromise = new Map();
4
+ var getCachePromise = function (cacheKey) {
5
+ return cachePromise.get(cacheKey);
6
+ };
7
+ var setCachePromise = function (cacheKey, promise) {
8
+ // Should cache the same promise, cannot be promise.finally
9
+ // Because the promise.finally will change the reference of the promise
10
+ cachePromise.set(cacheKey, promise);
11
+ // no use promise.finally for compatibility
12
+ promise
13
+ .then(function (res) {
14
+ cachePromise.delete(cacheKey);
15
+ return res;
16
+ })
17
+ .catch(function () {
18
+ cachePromise.delete(cacheKey);
19
+ });
20
+ };
21
+
22
+ exports.getCachePromise = getCachePromise;
23
+ exports.setCachePromise = setCachePromise;
24
+ //# sourceMappingURL=cachePromise.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cachePromise.cjs","sources":["../../../../../../../../../node_modules/ahooks/es/useRequest/src/utils/cachePromise.js"],"sourcesContent":["var cachePromise = new Map();\nvar getCachePromise = function (cacheKey) {\n return cachePromise.get(cacheKey);\n};\nvar setCachePromise = function (cacheKey, promise) {\n // Should cache the same promise, cannot be promise.finally\n // Because the promise.finally will change the reference of the promise\n cachePromise.set(cacheKey, promise);\n // no use promise.finally for compatibility\n promise\n .then(function (res) {\n cachePromise.delete(cacheKey);\n return res;\n })\n .catch(function () {\n cachePromise.delete(cacheKey);\n });\n};\nexport { getCachePromise, setCachePromise };\n"],"names":[],"mappings":";;AAAA,IAAI,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC;AAC1B,IAAC,eAAe,GAAG,UAAU,QAAQ,EAAE;AAC1C,IAAI,OAAO,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACtC,EAAE;AACC,IAAC,eAAe,GAAG,UAAU,QAAQ,EAAE,OAAO,EAAE;AACnD;AACA;AACA,IAAI,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACxC;AACA,IAAI,OAAO;AACX,SAAS,IAAI,CAAC,UAAU,GAAG,EAAE;AAC7B,QAAQ,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACtC,QAAQ,OAAO,GAAG,CAAC;AACnB,KAAK,CAAC;AACN,SAAS,KAAK,CAAC,YAAY;AAC3B,QAAQ,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACtC,KAAK,CAAC,CAAC;AACP;;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,21 @@
1
+ var cachePromise = new Map();
2
+ var getCachePromise = function (cacheKey) {
3
+ return cachePromise.get(cacheKey);
4
+ };
5
+ var setCachePromise = function (cacheKey, promise) {
6
+ // Should cache the same promise, cannot be promise.finally
7
+ // Because the promise.finally will change the reference of the promise
8
+ cachePromise.set(cacheKey, promise);
9
+ // no use promise.finally for compatibility
10
+ promise
11
+ .then(function (res) {
12
+ cachePromise.delete(cacheKey);
13
+ return res;
14
+ })
15
+ .catch(function () {
16
+ cachePromise.delete(cacheKey);
17
+ });
18
+ };
19
+
20
+ export { getCachePromise, setCachePromise };
21
+ //# sourceMappingURL=cachePromise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cachePromise.js","sources":["../../../../../../../../../node_modules/ahooks/es/useRequest/src/utils/cachePromise.js"],"sourcesContent":["var cachePromise = new Map();\nvar getCachePromise = function (cacheKey) {\n return cachePromise.get(cacheKey);\n};\nvar setCachePromise = function (cacheKey, promise) {\n // Should cache the same promise, cannot be promise.finally\n // Because the promise.finally will change the reference of the promise\n cachePromise.set(cacheKey, promise);\n // no use promise.finally for compatibility\n promise\n .then(function (res) {\n cachePromise.delete(cacheKey);\n return res;\n })\n .catch(function () {\n cachePromise.delete(cacheKey);\n });\n};\nexport { getCachePromise, setCachePromise };\n"],"names":[],"mappings":"AAAA,IAAI,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC;AAC1B,IAAC,eAAe,GAAG,UAAU,QAAQ,EAAE;AAC1C,IAAI,OAAO,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACtC,EAAE;AACC,IAAC,eAAe,GAAG,UAAU,QAAQ,EAAE,OAAO,EAAE;AACnD;AACA;AACA,IAAI,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACxC;AACA,IAAI,OAAO;AACX,SAAS,IAAI,CAAC,UAAU,GAAG,EAAE;AAC7B,QAAQ,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACtC,QAAQ,OAAO,GAAG,CAAC;AACnB,KAAK,CAAC;AACN,SAAS,KAAK,CAAC,YAAY;AAC3B,QAAQ,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACtC,KAAK,CAAC,CAAC;AACP;;;;","x_google_ignoreList":[0]}