@gravity-ui/data-source 0.8.2 → 0.9.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/build/cjs/core/types/DataSource.d.ts +8 -8
  2. package/build/cjs/core/types/DataSource.js.map +1 -1
  3. package/build/cjs/core/utils/withCatch.d.ts +4 -1
  4. package/build/cjs/core/utils/withCatch.js +2 -0
  5. package/build/cjs/core/utils/withCatch.js.map +1 -1
  6. package/build/cjs/react/components/AsyncBoundary/AsyncBoundary.d.ts +3 -0
  7. package/build/cjs/react/components/AsyncBoundary/AsyncBoundary.js +35 -0
  8. package/build/cjs/react/components/AsyncBoundary/AsyncBoundary.js.map +1 -0
  9. package/build/cjs/react/components/AsyncBoundary/index.d.ts +3 -0
  10. package/build/cjs/react/components/AsyncBoundary/index.js +20 -0
  11. package/build/cjs/react/components/AsyncBoundary/index.js.map +1 -0
  12. package/build/cjs/react/components/AsyncBoundary/types.d.ts +13 -0
  13. package/build/cjs/react/components/AsyncBoundary/types.js +6 -0
  14. package/build/cjs/react/components/AsyncBoundary/types.js.map +1 -0
  15. package/build/cjs/react/components/AsyncBoundary/withAsyncBoundary.d.ts +3 -0
  16. package/build/cjs/react/components/AsyncBoundary/withAsyncBoundary.js +26 -0
  17. package/build/cjs/react/components/AsyncBoundary/withAsyncBoundary.js.map +1 -0
  18. package/build/cjs/react/components/EmptyView/EmptyView.d.ts +2 -0
  19. package/build/cjs/react/components/EmptyView/EmptyView.js +10 -0
  20. package/build/cjs/react/components/EmptyView/EmptyView.js.map +1 -0
  21. package/build/cjs/react/components/EmptyView/index.d.ts +1 -0
  22. package/build/cjs/react/components/EmptyView/index.js +13 -0
  23. package/build/cjs/react/components/EmptyView/index.js.map +1 -0
  24. package/build/cjs/react/components/types.d.ts +1 -1
  25. package/build/cjs/react/components/types.js.map +1 -1
  26. package/build/cjs/react/index.d.ts +5 -3
  27. package/build/cjs/react/index.js +27 -3
  28. package/build/cjs/react/index.js.map +1 -1
  29. package/build/cjs/react-query/components/QueryAsyncBoundary/QueryAsyncBoundary.d.ts +3 -0
  30. package/build/cjs/react-query/components/QueryAsyncBoundary/QueryAsyncBoundary.js +23 -0
  31. package/build/cjs/react-query/components/QueryAsyncBoundary/QueryAsyncBoundary.js.map +1 -0
  32. package/build/cjs/react-query/components/QueryAsyncBoundary/index.d.ts +3 -0
  33. package/build/cjs/react-query/components/QueryAsyncBoundary/index.js +20 -0
  34. package/build/cjs/react-query/components/QueryAsyncBoundary/index.js.map +1 -0
  35. package/build/cjs/react-query/components/QueryAsyncBoundary/types.d.ts +8 -0
  36. package/build/cjs/react-query/components/QueryAsyncBoundary/types.js +6 -0
  37. package/build/cjs/react-query/components/QueryAsyncBoundary/types.js.map +1 -0
  38. package/build/cjs/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.d.ts +3 -0
  39. package/build/cjs/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.js +26 -0
  40. package/build/cjs/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.js.map +1 -0
  41. package/build/cjs/react-query/hooks/useSuspenseQueryData.d.ts +9 -0
  42. package/build/cjs/react-query/hooks/useSuspenseQueryData.js +22 -0
  43. package/build/cjs/react-query/hooks/useSuspenseQueryData.js.map +1 -0
  44. package/build/cjs/react-query/impl/infinite/hooks.js +5 -1
  45. package/build/cjs/react-query/impl/infinite/hooks.js.map +1 -1
  46. package/build/cjs/react-query/impl/infinite/types.d.ts +1 -0
  47. package/build/cjs/react-query/impl/infinite/types.js.map +1 -1
  48. package/build/cjs/react-query/impl/plain/hooks.js +5 -1
  49. package/build/cjs/react-query/impl/plain/hooks.js.map +1 -1
  50. package/build/cjs/react-query/impl/plain/types.d.ts +1 -0
  51. package/build/cjs/react-query/impl/plain/types.js.map +1 -1
  52. package/build/cjs/react-query/index.d.ts +2 -0
  53. package/build/cjs/react-query/index.js +35 -0
  54. package/build/cjs/react-query/index.js.map +1 -1
  55. package/build/cjs/react-query/types/options.d.ts +5 -0
  56. package/build/cjs/react-query/types/options.js.map +1 -1
  57. package/build/cjs/react-query/utils/warn.d.ts +1 -0
  58. package/build/cjs/react-query/utils/warn.js +15 -0
  59. package/build/cjs/react-query/utils/warn.js.map +1 -0
  60. package/build/cjs/react-query/utils/warnDisabledRefetch.d.ts +1 -0
  61. package/build/cjs/react-query/utils/warnDisabledRefetch.js +27 -0
  62. package/build/cjs/react-query/utils/warnDisabledRefetch.js.map +1 -0
  63. package/build/cjs/react-query/utils/wrapRefetch.d.ts +2 -0
  64. package/build/cjs/react-query/utils/wrapRefetch.js +29 -0
  65. package/build/cjs/react-query/utils/wrapRefetch.js.map +1 -0
  66. package/build/esm/core/types/DataSource.d.ts +8 -8
  67. package/build/esm/core/types/DataSource.js.map +1 -1
  68. package/build/esm/core/utils/withCatch.d.ts +4 -1
  69. package/build/esm/core/utils/withCatch.js +2 -0
  70. package/build/esm/core/utils/withCatch.js.map +1 -1
  71. package/build/esm/react/components/AsyncBoundary/AsyncBoundary.d.ts +3 -0
  72. package/build/esm/react/components/AsyncBoundary/AsyncBoundary.js +28 -0
  73. package/build/esm/react/components/AsyncBoundary/AsyncBoundary.js.map +1 -0
  74. package/build/esm/react/components/AsyncBoundary/index.d.ts +3 -0
  75. package/build/esm/react/components/AsyncBoundary/index.js +3 -0
  76. package/build/esm/react/components/AsyncBoundary/index.js.map +1 -0
  77. package/build/esm/react/components/AsyncBoundary/types.d.ts +13 -0
  78. package/build/esm/react/components/AsyncBoundary/types.js +2 -0
  79. package/build/esm/react/components/AsyncBoundary/types.js.map +1 -0
  80. package/build/esm/react/components/AsyncBoundary/withAsyncBoundary.d.ts +3 -0
  81. package/build/esm/react/components/AsyncBoundary/withAsyncBoundary.js +19 -0
  82. package/build/esm/react/components/AsyncBoundary/withAsyncBoundary.js.map +1 -0
  83. package/build/esm/react/components/EmptyView/EmptyView.d.ts +2 -0
  84. package/build/esm/react/components/EmptyView/EmptyView.js +4 -0
  85. package/build/esm/react/components/EmptyView/EmptyView.js.map +1 -0
  86. package/build/esm/react/components/EmptyView/index.d.ts +1 -0
  87. package/build/esm/react/components/EmptyView/index.js +2 -0
  88. package/build/esm/react/components/EmptyView/index.js.map +1 -0
  89. package/build/esm/react/components/types.d.ts +1 -1
  90. package/build/esm/react/components/types.js.map +1 -1
  91. package/build/esm/react/index.d.ts +5 -3
  92. package/build/esm/react/index.js +4 -2
  93. package/build/esm/react/index.js.map +1 -1
  94. package/build/esm/react-query/components/QueryAsyncBoundary/QueryAsyncBoundary.d.ts +3 -0
  95. package/build/esm/react-query/components/QueryAsyncBoundary/QueryAsyncBoundary.js +16 -0
  96. package/build/esm/react-query/components/QueryAsyncBoundary/QueryAsyncBoundary.js.map +1 -0
  97. package/build/esm/react-query/components/QueryAsyncBoundary/index.d.ts +3 -0
  98. package/build/esm/react-query/components/QueryAsyncBoundary/index.js +3 -0
  99. package/build/esm/react-query/components/QueryAsyncBoundary/index.js.map +1 -0
  100. package/build/esm/react-query/components/QueryAsyncBoundary/types.d.ts +8 -0
  101. package/build/esm/react-query/components/QueryAsyncBoundary/types.js +2 -0
  102. package/build/esm/react-query/components/QueryAsyncBoundary/types.js.map +1 -0
  103. package/build/esm/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.d.ts +3 -0
  104. package/build/esm/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.js +19 -0
  105. package/build/esm/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.js.map +1 -0
  106. package/build/esm/react-query/hooks/useSuspenseQueryData.d.ts +9 -0
  107. package/build/esm/react-query/hooks/useSuspenseQueryData.js +15 -0
  108. package/build/esm/react-query/hooks/useSuspenseQueryData.js.map +1 -0
  109. package/build/esm/react-query/impl/infinite/hooks.js +6 -2
  110. package/build/esm/react-query/impl/infinite/hooks.js.map +1 -1
  111. package/build/esm/react-query/impl/infinite/types.d.ts +1 -0
  112. package/build/esm/react-query/impl/infinite/types.js.map +1 -1
  113. package/build/esm/react-query/impl/plain/hooks.js +6 -2
  114. package/build/esm/react-query/impl/plain/hooks.js.map +1 -1
  115. package/build/esm/react-query/impl/plain/types.d.ts +1 -0
  116. package/build/esm/react-query/impl/plain/types.js.map +1 -1
  117. package/build/esm/react-query/index.d.ts +2 -0
  118. package/build/esm/react-query/index.js +2 -0
  119. package/build/esm/react-query/index.js.map +1 -1
  120. package/build/esm/react-query/types/options.d.ts +5 -0
  121. package/build/esm/react-query/types/options.js.map +1 -1
  122. package/build/esm/react-query/utils/warn.d.ts +1 -0
  123. package/build/esm/react-query/utils/warn.js +9 -0
  124. package/build/esm/react-query/utils/warn.js.map +1 -0
  125. package/build/esm/react-query/utils/warnDisabledRefetch.d.ts +1 -0
  126. package/build/esm/react-query/utils/warnDisabledRefetch.js +20 -0
  127. package/build/esm/react-query/utils/warnDisabledRefetch.js.map +1 -0
  128. package/build/esm/react-query/utils/wrapRefetch.d.ts +2 -0
  129. package/build/esm/react-query/utils/wrapRefetch.js +22 -0
  130. package/build/esm/react-query/utils/wrapRefetch.js.map +1 -0
  131. package/build/plugin/esbuild.d.mts +7 -0
  132. package/build/plugin/esbuild.mjs +6 -0
  133. package/build/plugin/factory-2tSt4Rte.mjs +513 -0
  134. package/build/plugin/index-mY40Sgl5.d.mts +24 -0
  135. package/build/plugin/index.d.mts +7 -0
  136. package/build/plugin/index.mjs +6 -0
  137. package/build/plugin/rollup.d.mts +6 -0
  138. package/build/plugin/rollup.mjs +6 -0
  139. package/build/plugin/rspack.d.mts +7 -0
  140. package/build/plugin/rspack.mjs +6 -0
  141. package/build/plugin/typings/client.d.ts +11 -0
  142. package/build/plugin/vite.d.mts +6 -0
  143. package/build/plugin/vite.mjs +6 -0
  144. package/build/plugin/webpack.d.mts +7 -0
  145. package/build/plugin/webpack.mjs +6 -0
  146. package/package.json +54 -5
  147. package/build/cjs/core/utils/__tests__/composeFullKey.test.js +0 -34
  148. package/build/cjs/core/utils/__tests__/composeFullKey.test.js.map +0 -1
  149. package/build/cjs/core/utils/__tests__/composeKey.test.js +0 -32
  150. package/build/cjs/core/utils/__tests__/composeKey.test.js.map +0 -1
  151. package/build/cjs/core/utils/__tests__/getError.test.js +0 -31
  152. package/build/cjs/core/utils/__tests__/getError.test.js.map +0 -1
  153. package/build/cjs/core/utils/__tests__/getStatus.test.js +0 -49
  154. package/build/cjs/core/utils/__tests__/getStatus.test.js.map +0 -1
  155. package/build/cjs/core/utils/__tests__/hasTag.test.js +0 -31
  156. package/build/cjs/core/utils/__tests__/hasTag.test.js.map +0 -1
  157. package/build/cjs/core/utils/__tests__/mergeStatuses.test.js +0 -25
  158. package/build/cjs/core/utils/__tests__/mergeStatuses.test.js.map +0 -1
  159. package/build/cjs/core/utils/__tests__/skipContext.test.js +0 -70
  160. package/build/cjs/core/utils/__tests__/skipContext.test.js.map +0 -1
  161. package/build/cjs/core/utils/__tests__/withCancellation.test.js +0 -106
  162. package/build/cjs/core/utils/__tests__/withCancellation.test.js.map +0 -1
  163. package/build/cjs/core/utils/__tests__/withCatch.test.js +0 -208
  164. package/build/cjs/core/utils/__tests__/withCatch.test.js.map +0 -1
  165. package/build/cjs/react/__tests__/DataManagerContext.test.js +0 -47
  166. package/build/cjs/react/__tests__/DataManagerContext.test.js.map +0 -1
  167. package/build/cjs/react/__tests__/withDataManager.test.js +0 -61
  168. package/build/cjs/react/__tests__/withDataManager.test.js.map +0 -1
  169. package/build/cjs/react/components/DataInfiniteLoader/__tests__/DataInfiniteLoader.test.js +0 -187
  170. package/build/cjs/react/components/DataInfiniteLoader/__tests__/DataInfiniteLoader.test.js.map +0 -1
  171. package/build/cjs/react/components/DataLoader/__tests__/DataLoader.test.js +0 -119
  172. package/build/cjs/react/components/DataLoader/__tests__/DataLoader.test.js.map +0 -1
  173. package/build/cjs/react-query/__tests__/createQueryNormalizer.test.js +0 -177
  174. package/build/cjs/react-query/__tests__/createQueryNormalizer.test.js.map +0 -1
  175. package/build/cjs/react-query/__tests__/normalizationEdgeCases.test.js +0 -100
  176. package/build/cjs/react-query/__tests__/normalizationEdgeCases.test.js.map +0 -1
  177. package/build/cjs/react-query/__tests__/subscriptions.test.js +0 -1180
  178. package/build/cjs/react-query/__tests__/subscriptions.test.js.map +0 -1
  179. package/build/cjs/react-query/__tests__/threeLevelIntegration.test.js +0 -659
  180. package/build/cjs/react-query/__tests__/threeLevelIntegration.test.js.map +0 -1
  181. package/build/cjs/react-query/__tests__/updateQueriesFromMutationData.test.js +0 -229
  182. package/build/cjs/react-query/__tests__/updateQueriesFromMutationData.test.js.map +0 -1
  183. package/build/cjs/react-query/hooks/__tests__/useQueryContext.test.js +0 -55
  184. package/build/cjs/react-query/hooks/__tests__/useQueryContext.test.js.map +0 -1
  185. package/build/cjs/react-query/hooks/__tests__/useQueryData.test.js +0 -97
  186. package/build/cjs/react-query/hooks/__tests__/useQueryData.test.js.map +0 -1
  187. package/build/cjs/react-query/hooks/__tests__/useQueryResponses.test.js +0 -77
  188. package/build/cjs/react-query/hooks/__tests__/useQueryResponses.test.js.map +0 -1
  189. package/build/cjs/react-query/hooks/__tests__/useRefetchAll.test.js +0 -79
  190. package/build/cjs/react-query/hooks/__tests__/useRefetchAll.test.js.map +0 -1
  191. package/build/cjs/react-query/hooks/__tests__/useRefetchErrored.test.js +0 -117
  192. package/build/cjs/react-query/hooks/__tests__/useRefetchErrored.test.js.map +0 -1
  193. package/build/cjs/react-query/hooks/__tests__/useRefetchInterval.test.js +0 -156
  194. package/build/cjs/react-query/hooks/__tests__/useRefetchInterval.test.js.map +0 -1
  195. package/build/cjs/react-query/utils/__tests__/checkMutationObjectsKeys.test.js +0 -295
  196. package/build/cjs/react-query/utils/__tests__/checkMutationObjectsKeys.test.js.map +0 -1
  197. package/build/cjs/react-query/utils/__tests__/formatNullableValue.test.js +0 -27
  198. package/build/cjs/react-query/utils/__tests__/formatNullableValue.test.js.map +0 -1
  199. package/build/cjs/react-query/utils/__tests__/getProgressiveRefetch.test.js +0 -76
  200. package/build/cjs/react-query/utils/__tests__/getProgressiveRefetch.test.js.map +0 -1
  201. package/build/cjs/react-query/utils/__tests__/normalizeStatus.test.js +0 -30
  202. package/build/cjs/react-query/utils/__tests__/normalizeStatus.test.js.map +0 -1
  203. package/build/cjs/react-query/utils/__tests__/notReachable.test.js +0 -35
  204. package/build/cjs/react-query/utils/__tests__/notReachable.test.js.map +0 -1
  205. package/build/cjs/react-query/utils/__tests__/parseNullableValue.test.js +0 -27
  206. package/build/cjs/react-query/utils/__tests__/parseNullableValue.test.js.map +0 -1
  207. package/build/cjs/setupTests.d.ts +0 -1
  208. package/build/cjs/setupTests.js +0 -4
  209. package/build/cjs/setupTests.js.map +0 -1
  210. package/build/esm/core/utils/__tests__/composeFullKey.test.js +0 -32
  211. package/build/esm/core/utils/__tests__/composeFullKey.test.js.map +0 -1
  212. package/build/esm/core/utils/__tests__/composeKey.test.js +0 -30
  213. package/build/esm/core/utils/__tests__/composeKey.test.js.map +0 -1
  214. package/build/esm/core/utils/__tests__/getError.test.js +0 -29
  215. package/build/esm/core/utils/__tests__/getError.test.js.map +0 -1
  216. package/build/esm/core/utils/__tests__/getStatus.test.js +0 -47
  217. package/build/esm/core/utils/__tests__/getStatus.test.js.map +0 -1
  218. package/build/esm/core/utils/__tests__/hasTag.test.js +0 -29
  219. package/build/esm/core/utils/__tests__/hasTag.test.js.map +0 -1
  220. package/build/esm/core/utils/__tests__/mergeStatuses.test.js +0 -23
  221. package/build/esm/core/utils/__tests__/mergeStatuses.test.js.map +0 -1
  222. package/build/esm/core/utils/__tests__/skipContext.test.js +0 -67
  223. package/build/esm/core/utils/__tests__/skipContext.test.js.map +0 -1
  224. package/build/esm/core/utils/__tests__/withCancellation.test.js +0 -104
  225. package/build/esm/core/utils/__tests__/withCancellation.test.js.map +0 -1
  226. package/build/esm/core/utils/__tests__/withCatch.test.js +0 -205
  227. package/build/esm/core/utils/__tests__/withCatch.test.js.map +0 -1
  228. package/build/esm/react/__tests__/DataManagerContext.test.js +0 -44
  229. package/build/esm/react/__tests__/DataManagerContext.test.js.map +0 -1
  230. package/build/esm/react/__tests__/withDataManager.test.js +0 -58
  231. package/build/esm/react/__tests__/withDataManager.test.js.map +0 -1
  232. package/build/esm/react/components/DataInfiniteLoader/__tests__/DataInfiniteLoader.test.js +0 -184
  233. package/build/esm/react/components/DataInfiniteLoader/__tests__/DataInfiniteLoader.test.js.map +0 -1
  234. package/build/esm/react/components/DataLoader/__tests__/DataLoader.test.js +0 -116
  235. package/build/esm/react/components/DataLoader/__tests__/DataLoader.test.js.map +0 -1
  236. package/build/esm/react-query/__tests__/createQueryNormalizer.test.js +0 -174
  237. package/build/esm/react-query/__tests__/createQueryNormalizer.test.js.map +0 -1
  238. package/build/esm/react-query/__tests__/normalizationEdgeCases.test.js +0 -98
  239. package/build/esm/react-query/__tests__/normalizationEdgeCases.test.js.map +0 -1
  240. package/build/esm/react-query/__tests__/subscriptions.test.js +0 -1176
  241. package/build/esm/react-query/__tests__/subscriptions.test.js.map +0 -1
  242. package/build/esm/react-query/__tests__/threeLevelIntegration.test.js +0 -656
  243. package/build/esm/react-query/__tests__/threeLevelIntegration.test.js.map +0 -1
  244. package/build/esm/react-query/__tests__/updateQueriesFromMutationData.test.js +0 -227
  245. package/build/esm/react-query/__tests__/updateQueriesFromMutationData.test.js.map +0 -1
  246. package/build/esm/react-query/hooks/__tests__/useQueryContext.test.js +0 -52
  247. package/build/esm/react-query/hooks/__tests__/useQueryContext.test.js.map +0 -1
  248. package/build/esm/react-query/hooks/__tests__/useQueryData.test.js +0 -95
  249. package/build/esm/react-query/hooks/__tests__/useQueryData.test.js.map +0 -1
  250. package/build/esm/react-query/hooks/__tests__/useQueryResponses.test.js +0 -74
  251. package/build/esm/react-query/hooks/__tests__/useQueryResponses.test.js.map +0 -1
  252. package/build/esm/react-query/hooks/__tests__/useRefetchAll.test.js +0 -77
  253. package/build/esm/react-query/hooks/__tests__/useRefetchAll.test.js.map +0 -1
  254. package/build/esm/react-query/hooks/__tests__/useRefetchErrored.test.js +0 -115
  255. package/build/esm/react-query/hooks/__tests__/useRefetchErrored.test.js.map +0 -1
  256. package/build/esm/react-query/hooks/__tests__/useRefetchInterval.test.js +0 -154
  257. package/build/esm/react-query/hooks/__tests__/useRefetchInterval.test.js.map +0 -1
  258. package/build/esm/react-query/utils/__tests__/checkMutationObjectsKeys.test.js +0 -292
  259. package/build/esm/react-query/utils/__tests__/checkMutationObjectsKeys.test.js.map +0 -1
  260. package/build/esm/react-query/utils/__tests__/formatNullableValue.test.js +0 -25
  261. package/build/esm/react-query/utils/__tests__/formatNullableValue.test.js.map +0 -1
  262. package/build/esm/react-query/utils/__tests__/getProgressiveRefetch.test.js +0 -74
  263. package/build/esm/react-query/utils/__tests__/getProgressiveRefetch.test.js.map +0 -1
  264. package/build/esm/react-query/utils/__tests__/normalizeStatus.test.js +0 -28
  265. package/build/esm/react-query/utils/__tests__/normalizeStatus.test.js.map +0 -1
  266. package/build/esm/react-query/utils/__tests__/notReachable.test.js +0 -33
  267. package/build/esm/react-query/utils/__tests__/notReachable.test.js.map +0 -1
  268. package/build/esm/react-query/utils/__tests__/parseNullableValue.test.js +0 -25
  269. package/build/esm/react-query/utils/__tests__/parseNullableValue.test.js.map +0 -1
  270. package/build/esm/setupTests.d.ts +0 -1
  271. package/build/esm/setupTests.js +0 -2
  272. package/build/esm/setupTests.js.map +0 -1
@@ -14,6 +14,7 @@ export type AnyPageParam = Partial<any>;
14
14
  type ResultWrapper<TResult, TRequest, TResponse, TData, TError> = TResult extends InfiniteQueryObserverResult<InfiniteData<ActualData<TData, TResponse>, Partial<TRequest>>, TError> ? Overwrite<TResult, {
15
15
  status: DataLoaderStatus;
16
16
  data: Array<FlatArray<Array<ActualData<TData, TResponse>>, 1>>;
17
+ refetch: () => Promise<void>;
17
18
  }> & {
18
19
  originalStatus: TResult['status'];
19
20
  originalData: TResult['data'];
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\n DefaultError,\n InfiniteData,\n InfiniteQueryObserverOptions,\n InfiniteQueryObserverResult,\n QueryFunctionContext,\n QueryKey,\n} from '@tanstack/react-query';\nimport type {Assign, Overwrite} from 'utility-types';\n\nimport type {ActualData, DataLoaderStatus, DataSource, DataSourceKey} from '../../../core';\nimport type {QueryDataSourceContext} from '../../types/base';\nimport type {QueryDataAdditionalOptions} from '../../types/options';\n\nexport type InfiniteQueryObserverExtendedOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = Assign<\n InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey, TPageParam>,\n QueryDataAdditionalOptions<\n TQueryFnData,\n TError,\n InfiniteData<TQueryData, TPageParam>,\n TQueryKey\n >\n>;\n\nexport type InfiniteQueryDataSource<TParams, TRequest, TResponse, TData, TError> = DataSource<\n QueryDataSourceContext,\n TParams,\n TRequest,\n TResponse,\n TData,\n TError,\n InfiniteQueryObserverExtendedOptions<\n NoInfer<TResponse>,\n NoInfer<TError>,\n InfiniteData<ActualData<NoInfer<TData>, NoInfer<TResponse>>, Partial<TRequest>>,\n NoInfer<TResponse>,\n DataSourceKey,\n Partial<NoInfer<TRequest>>\n >,\n ResultWrapper<\n InfiniteQueryObserverResult<\n InfiniteData<ActualData<NoInfer<TData>, NoInfer<TResponse>>, Partial<TRequest>>,\n NoInfer<TError>\n >,\n NoInfer<TRequest>,\n NoInfer<TResponse>,\n NoInfer<TData>,\n NoInfer<TError>\n >,\n QueryFunctionContext<DataSourceKey, Partial<NoInfer<TRequest>>>\n> & {\n type: 'infinite';\n next: (\n lastPage: NoInfer<TResponse>,\n allPages: NoInfer<TResponse>[],\n ) => Partial<NoInfer<TRequest>> | null | undefined;\n prev?: (\n firstPage: NoInfer<TResponse>,\n allPages: NoInfer<TResponse>[],\n ) => Partial<NoInfer<TRequest>> | null | undefined;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyInfiniteQueryDataSource = InfiniteQueryDataSource<any, any, any, any, any>;\n\n// It is used instead of `Partial<DataSourceRequest<TDataSource>>` because TS can't calculate type\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyPageParam = Partial<any>;\n\ntype ResultWrapper<TResult, TRequest, TResponse, TData, TError> =\n TResult extends InfiniteQueryObserverResult<\n InfiniteData<ActualData<TData, TResponse>, Partial<TRequest>>,\n TError\n >\n ? Overwrite<\n TResult,\n {\n status: DataLoaderStatus;\n data: Array<FlatArray<Array<ActualData<TData, TResponse>>, 1>>;\n }\n > & {\n originalStatus: TResult['status'];\n originalData: TResult['data'];\n }\n : never;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\n DefaultError,\n InfiniteData,\n InfiniteQueryObserverOptions,\n InfiniteQueryObserverResult,\n QueryFunctionContext,\n QueryKey,\n} from '@tanstack/react-query';\nimport type {Assign, Overwrite} from 'utility-types';\n\nimport type {ActualData, DataLoaderStatus, DataSource, DataSourceKey} from '../../../core';\nimport type {QueryDataSourceContext} from '../../types/base';\nimport type {QueryDataAdditionalOptions} from '../../types/options';\n\nexport type InfiniteQueryObserverExtendedOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = Assign<\n InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey, TPageParam>,\n QueryDataAdditionalOptions<\n TQueryFnData,\n TError,\n InfiniteData<TQueryData, TPageParam>,\n TQueryKey\n >\n>;\n\nexport type InfiniteQueryDataSource<TParams, TRequest, TResponse, TData, TError> = DataSource<\n QueryDataSourceContext,\n TParams,\n TRequest,\n TResponse,\n TData,\n TError,\n InfiniteQueryObserverExtendedOptions<\n NoInfer<TResponse>,\n NoInfer<TError>,\n InfiniteData<ActualData<NoInfer<TData>, NoInfer<TResponse>>, Partial<TRequest>>,\n NoInfer<TResponse>,\n DataSourceKey,\n Partial<NoInfer<TRequest>>\n >,\n ResultWrapper<\n InfiniteQueryObserverResult<\n InfiniteData<ActualData<NoInfer<TData>, NoInfer<TResponse>>, Partial<TRequest>>,\n NoInfer<TError>\n >,\n NoInfer<TRequest>,\n NoInfer<TResponse>,\n NoInfer<TData>,\n NoInfer<TError>\n >,\n QueryFunctionContext<DataSourceKey, Partial<NoInfer<TRequest>>>\n> & {\n type: 'infinite';\n next: (\n lastPage: NoInfer<TResponse>,\n allPages: NoInfer<TResponse>[],\n ) => Partial<NoInfer<TRequest>> | null | undefined;\n prev?: (\n firstPage: NoInfer<TResponse>,\n allPages: NoInfer<TResponse>[],\n ) => Partial<NoInfer<TRequest>> | null | undefined;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyInfiniteQueryDataSource = InfiniteQueryDataSource<any, any, any, any, any>;\n\n// It is used instead of `Partial<DataSourceRequest<TDataSource>>` because TS can't calculate type\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyPageParam = Partial<any>;\n\ntype ResultWrapper<TResult, TRequest, TResponse, TData, TError> =\n TResult extends InfiniteQueryObserverResult<\n InfiniteData<ActualData<TData, TResponse>, Partial<TRequest>>,\n TError\n >\n ? Overwrite<\n TResult,\n {\n status: DataLoaderStatus;\n data: Array<FlatArray<Array<ActualData<TData, TResponse>>, 1>>;\n refetch: () => Promise<void>;\n }\n > & {\n originalStatus: TResult['status'];\n originalData: TResult['data'];\n }\n : never;\n"],"mappings":"","ignoreList":[]}
@@ -9,6 +9,8 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
9
9
  var _reactQuery = require("@tanstack/react-query");
10
10
  var _useRefetchInterval2 = require("../../hooks/useRefetchInterval");
11
11
  var _normalizeStatus = require("../../utils/normalizeStatus");
12
+ var _warnDisabledRefetch = require("../../utils/warnDisabledRefetch");
13
+ var _wrapRefetch = require("../../utils/wrapRefetch");
12
14
  var _utils = require("./utils");
13
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
16
  var _excluded = ["queryFn", "refetchInterval"];
@@ -28,9 +30,11 @@ var usePlainQueryData = exports.usePlainQueryData = function usePlainQueryData(c
28
30
  var extendedOptions = (0, _utils.composeOptions)(context, dataSource, params, options);
29
31
  var composedOptions = usePlainQueryDataOptions(extendedOptions);
30
32
  var state = (0, _reactQuery.useQuery)(composedOptions);
33
+ var isDisabled = composedOptions.enabled === false || composedOptions.queryFn === _reactQuery.skipToken;
31
34
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
32
35
  status: (0, _normalizeStatus.normalizeStatus)(state.status, state.fetchStatus),
33
- originalStatus: state.status
36
+ originalStatus: state.status,
37
+ refetch: isDisabled ? _warnDisabledRefetch.warnDisabledRefetch : (0, _wrapRefetch.wrapRefetch)(state.refetch)
34
38
  });
35
39
  };
36
40
  // #sourceMappingURL=hooks.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_reactQuery","require","_useRefetchInterval2","_normalizeStatus","_utils","_interopRequireDefault","e","__esModule","default","usePlainQueryDataOptions","composedOptions","queryFnOption","queryFn","refetchIntervalOption","refetchInterval","restOptions","_objectWithoutProperties","_excluded","_useRefetchInterval","useRefetchInterval","_objectSpread","usePlainQueryData","exports","context","dataSource","params","options","extendedOptions","composeOptions","state","useQuery","status","normalizeStatus","fetchStatus","originalStatus"],"sources":["hooks.ts"],"sourcesContent":["import {type QueryObserverOptions, useQuery} from '@tanstack/react-query';\n\nimport type {\n DataSourceContext,\n DataSourceData,\n DataSourceError,\n DataSourceKey,\n DataSourceOptions,\n DataSourceParams,\n DataSourceResponse,\n DataSourceState,\n} from '../../../core';\nimport {useRefetchInterval} from '../../hooks/useRefetchInterval';\nimport {normalizeStatus} from '../../utils/normalizeStatus';\n\nimport type {AnyPlainQueryDataSource, QueryObserverExtendedOptions} from './types';\nimport {composeOptions} from './utils';\n\nconst usePlainQueryDataOptions = <TDataSource extends AnyPlainQueryDataSource>(\n composedOptions: QueryObserverExtendedOptions<\n DataSourceResponse<TDataSource>,\n DataSourceError<TDataSource>,\n DataSourceData<TDataSource>,\n DataSourceResponse<TDataSource>,\n DataSourceKey\n >,\n): QueryObserverOptions<\n DataSourceResponse<TDataSource>,\n DataSourceError<TDataSource>,\n DataSourceData<TDataSource>,\n DataSourceResponse<TDataSource>,\n DataSourceKey\n> => {\n const {\n queryFn: queryFnOption,\n refetchInterval: refetchIntervalOption,\n ...restOptions\n } = composedOptions;\n\n const {queryFn, refetchInterval} = useRefetchInterval(refetchIntervalOption, queryFnOption);\n\n return {...restOptions, queryFn, refetchInterval};\n};\n\nexport const usePlainQueryData = <TDataSource extends AnyPlainQueryDataSource>(\n context: DataSourceContext<TDataSource>,\n dataSource: TDataSource,\n params: DataSourceParams<TDataSource>,\n options?: Partial<DataSourceOptions<TDataSource>>,\n): DataSourceState<TDataSource> => {\n const extendedOptions = composeOptions(context, dataSource, params, options);\n const composedOptions = usePlainQueryDataOptions(extendedOptions);\n const state = useQuery(composedOptions);\n\n return {\n ...state,\n status: normalizeStatus(state.status, state.fetchStatus),\n originalStatus: state.status,\n } as DataSourceState<TDataSource>;\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAYA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AAGA,IAAAG,MAAA,GAAAH,OAAA;AAAsC,SAAAI,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;;AAEtC,IAAMG,wBAAwB,GAAG,SAA3BA,wBAAwBA,CAC1BC,eAMC,EAOA;EACD,IACaC,aAAa,GAGtBD,eAAe,CAHfE,OAAO;IACUC,qBAAqB,GAEtCH,eAAe,CAFfI,eAAe;IACZC,WAAW,OAAAC,iCAAA,EACdN,eAAe,EAAAO,SAAA;EAEnB,IAAAC,mBAAA,GAAmC,IAAAC,uCAAkB,EAACN,qBAAqB,EAAEF,aAAa,CAAC;IAApFC,OAAO,GAAAM,mBAAA,CAAPN,OAAO;IAAEE,eAAe,GAAAI,mBAAA,CAAfJ,eAAe;EAE/B,WAAAM,sBAAA,MAAAA,sBAAA,MAAWL,WAAW;IAAEH,OAAO,EAAPA,OAAO;IAAEE,eAAe,EAAfA;EAAe;AACpD,CAAC;AAEM,IAAMO,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,SAApBA,iBAAiBA,CAC1BE,OAAuC,EACvCC,UAAuB,EACvBC,MAAqC,EACrCC,OAAiD,EAClB;EAC/B,IAAMC,eAAe,GAAG,IAAAC,qBAAc,EAACL,OAAO,EAAEC,UAAU,EAAEC,MAAM,EAAEC,OAAO,CAAC;EAC5E,IAAMhB,eAAe,GAAGD,wBAAwB,CAACkB,eAAe,CAAC;EACjE,IAAME,KAAK,GAAG,IAAAC,oBAAQ,EAACpB,eAAe,CAAC;EAEvC,WAAAU,sBAAA,MAAAA,sBAAA,MACOS,KAAK;IACRE,MAAM,EAAE,IAAAC,gCAAe,EAACH,KAAK,CAACE,MAAM,EAAEF,KAAK,CAACI,WAAW,CAAC;IACxDC,cAAc,EAAEL,KAAK,CAACE;EAAM;AAEpC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_reactQuery","require","_useRefetchInterval2","_normalizeStatus","_warnDisabledRefetch","_wrapRefetch","_utils","_interopRequireDefault","e","__esModule","default","usePlainQueryDataOptions","composedOptions","queryFnOption","queryFn","refetchIntervalOption","refetchInterval","restOptions","_objectWithoutProperties","_excluded","_useRefetchInterval","useRefetchInterval","_objectSpread","usePlainQueryData","exports","context","dataSource","params","options","extendedOptions","composeOptions","state","useQuery","isDisabled","enabled","skipToken","status","normalizeStatus","fetchStatus","originalStatus","refetch","warnDisabledRefetch","wrapRefetch"],"sources":["hooks.ts"],"sourcesContent":["import {type QueryObserverOptions, skipToken, useQuery} from '@tanstack/react-query';\n\nimport type {\n DataSourceContext,\n DataSourceData,\n DataSourceError,\n DataSourceKey,\n DataSourceOptions,\n DataSourceParams,\n DataSourceResponse,\n DataSourceState,\n} from '../../../core';\nimport {useRefetchInterval} from '../../hooks/useRefetchInterval';\nimport {normalizeStatus} from '../../utils/normalizeStatus';\nimport {warnDisabledRefetch} from '../../utils/warnDisabledRefetch';\nimport {wrapRefetch} from '../../utils/wrapRefetch';\n\nimport type {AnyPlainQueryDataSource, QueryObserverExtendedOptions} from './types';\nimport {composeOptions} from './utils';\n\nconst usePlainQueryDataOptions = <TDataSource extends AnyPlainQueryDataSource>(\n composedOptions: QueryObserverExtendedOptions<\n DataSourceResponse<TDataSource>,\n DataSourceError<TDataSource>,\n DataSourceData<TDataSource>,\n DataSourceResponse<TDataSource>,\n DataSourceKey\n >,\n): QueryObserverOptions<\n DataSourceResponse<TDataSource>,\n DataSourceError<TDataSource>,\n DataSourceData<TDataSource>,\n DataSourceResponse<TDataSource>,\n DataSourceKey\n> => {\n const {\n queryFn: queryFnOption,\n refetchInterval: refetchIntervalOption,\n ...restOptions\n } = composedOptions;\n\n const {queryFn, refetchInterval} = useRefetchInterval(refetchIntervalOption, queryFnOption);\n\n return {...restOptions, queryFn, refetchInterval};\n};\n\nexport const usePlainQueryData = <TDataSource extends AnyPlainQueryDataSource>(\n context: DataSourceContext<TDataSource>,\n dataSource: TDataSource,\n params: DataSourceParams<TDataSource>,\n options?: Partial<DataSourceOptions<TDataSource>>,\n): DataSourceState<TDataSource> => {\n const extendedOptions = composeOptions(context, dataSource, params, options);\n const composedOptions = usePlainQueryDataOptions(extendedOptions);\n const state = useQuery(composedOptions);\n\n const isDisabled = composedOptions.enabled === false || composedOptions.queryFn === skipToken;\n\n return {\n ...state,\n status: normalizeStatus(state.status, state.fetchStatus),\n originalStatus: state.status,\n refetch: isDisabled ? warnDisabledRefetch : wrapRefetch(state.refetch),\n } as DataSourceState<TDataSource>;\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAYA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAGA,IAAAK,MAAA,GAAAL,OAAA;AAAsC,SAAAM,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;;AAEtC,IAAMG,wBAAwB,GAAG,SAA3BA,wBAAwBA,CAC1BC,eAMC,EAOA;EACD,IACaC,aAAa,GAGtBD,eAAe,CAHfE,OAAO;IACUC,qBAAqB,GAEtCH,eAAe,CAFfI,eAAe;IACZC,WAAW,OAAAC,iCAAA,EACdN,eAAe,EAAAO,SAAA;EAEnB,IAAAC,mBAAA,GAAmC,IAAAC,uCAAkB,EAACN,qBAAqB,EAAEF,aAAa,CAAC;IAApFC,OAAO,GAAAM,mBAAA,CAAPN,OAAO;IAAEE,eAAe,GAAAI,mBAAA,CAAfJ,eAAe;EAE/B,WAAAM,sBAAA,MAAAA,sBAAA,MAAWL,WAAW;IAAEH,OAAO,EAAPA,OAAO;IAAEE,eAAe,EAAfA;EAAe;AACpD,CAAC;AAEM,IAAMO,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,SAApBA,iBAAiBA,CAC1BE,OAAuC,EACvCC,UAAuB,EACvBC,MAAqC,EACrCC,OAAiD,EAClB;EAC/B,IAAMC,eAAe,GAAG,IAAAC,qBAAc,EAACL,OAAO,EAAEC,UAAU,EAAEC,MAAM,EAAEC,OAAO,CAAC;EAC5E,IAAMhB,eAAe,GAAGD,wBAAwB,CAACkB,eAAe,CAAC;EACjE,IAAME,KAAK,GAAG,IAAAC,oBAAQ,EAACpB,eAAe,CAAC;EAEvC,IAAMqB,UAAU,GAAGrB,eAAe,CAACsB,OAAO,KAAK,KAAK,IAAItB,eAAe,CAACE,OAAO,KAAKqB,qBAAS;EAE7F,WAAAb,sBAAA,MAAAA,sBAAA,MACOS,KAAK;IACRK,MAAM,EAAE,IAAAC,gCAAe,EAACN,KAAK,CAACK,MAAM,EAAEL,KAAK,CAACO,WAAW,CAAC;IACxDC,cAAc,EAAER,KAAK,CAACK,MAAM;IAC5BI,OAAO,EAAEP,UAAU,GAAGQ,wCAAmB,GAAG,IAAAC,wBAAW,EAACX,KAAK,CAACS,OAAO;EAAC;AAE9E,CAAC","ignoreList":[]}
@@ -10,6 +10,7 @@ export type PlainQueryDataSource<TParams, TRequest, TResponse, TData, TError> =
10
10
  export type AnyPlainQueryDataSource = PlainQueryDataSource<any, any, any, any, any>;
11
11
  type ResultWrapper<TResult, TResponse, TData, TError> = TResult extends QueryObserverResult<ActualData<TData, TResponse>, TError> ? Overwrite<TResult, {
12
12
  status: DataLoaderStatus;
13
+ refetch: () => Promise<void>;
13
14
  }> & {
14
15
  originalStatus: TResult['status'];
15
16
  } : never;
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\n DefaultError,\n QueryFunctionContext,\n QueryKey,\n QueryObserverOptions,\n QueryObserverResult,\n} from '@tanstack/react-query';\nimport type {Assign, Overwrite} from 'utility-types';\n\nimport type {ActualData, DataLoaderStatus, DataSource, DataSourceKey} from '../../../core';\nimport type {QueryDataSourceContext} from '../../types/base';\nimport type {QueryDataAdditionalOptions} from '../../types/options';\n\nexport type QueryObserverExtendedOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = never,\n> = Assign<\n QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey, TPageParam>,\n QueryDataAdditionalOptions<TQueryFnData, TError, TQueryData, TQueryKey>\n>;\n\nexport type PlainQueryDataSource<TParams, TRequest, TResponse, TData, TError> = DataSource<\n QueryDataSourceContext,\n TParams,\n TRequest,\n TResponse,\n TData,\n TError,\n QueryObserverExtendedOptions<\n NoInfer<TResponse>,\n NoInfer<TError>,\n ActualData<NoInfer<TData>, NoInfer<TResponse>>,\n NoInfer<TResponse>,\n DataSourceKey\n >,\n ResultWrapper<\n QueryObserverResult<ActualData<NoInfer<TData>, NoInfer<TResponse>>, NoInfer<TError>>,\n NoInfer<TResponse>,\n NoInfer<TData>,\n NoInfer<TError>\n >,\n QueryFunctionContext<DataSourceKey>\n> & {\n type: 'plain';\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyPlainQueryDataSource = PlainQueryDataSource<any, any, any, any, any>;\n\ntype ResultWrapper<TResult, TResponse, TData, TError> =\n TResult extends QueryObserverResult<ActualData<TData, TResponse>, TError>\n ? Overwrite<TResult, {status: DataLoaderStatus}> & {originalStatus: TResult['status']}\n : never;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\n DefaultError,\n QueryFunctionContext,\n QueryKey,\n QueryObserverOptions,\n QueryObserverResult,\n} from '@tanstack/react-query';\nimport type {Assign, Overwrite} from 'utility-types';\n\nimport type {ActualData, DataLoaderStatus, DataSource, DataSourceKey} from '../../../core';\nimport type {QueryDataSourceContext} from '../../types/base';\nimport type {QueryDataAdditionalOptions} from '../../types/options';\n\nexport type QueryObserverExtendedOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = never,\n> = Assign<\n QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey, TPageParam>,\n QueryDataAdditionalOptions<TQueryFnData, TError, TQueryData, TQueryKey>\n>;\n\nexport type PlainQueryDataSource<TParams, TRequest, TResponse, TData, TError> = DataSource<\n QueryDataSourceContext,\n TParams,\n TRequest,\n TResponse,\n TData,\n TError,\n QueryObserverExtendedOptions<\n NoInfer<TResponse>,\n NoInfer<TError>,\n ActualData<NoInfer<TData>, NoInfer<TResponse>>,\n NoInfer<TResponse>,\n DataSourceKey\n >,\n ResultWrapper<\n QueryObserverResult<ActualData<NoInfer<TData>, NoInfer<TResponse>>, NoInfer<TError>>,\n NoInfer<TResponse>,\n NoInfer<TData>,\n NoInfer<TError>\n >,\n QueryFunctionContext<DataSourceKey>\n> & {\n type: 'plain';\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyPlainQueryDataSource = PlainQueryDataSource<any, any, any, any, any>;\n\ntype ResultWrapper<TResult, TResponse, TData, TError> =\n TResult extends QueryObserverResult<ActualData<TData, TResponse>, TError>\n ? Overwrite<\n TResult,\n {\n status: DataLoaderStatus;\n refetch: () => Promise<void>;\n }\n > & {originalStatus: TResult['status']}\n : never;\n"],"mappings":"","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ export * from './components/QueryAsyncBoundary';
1
2
  export type { QueryDataSourceContext, AnyQueryDataSource } from './types/base';
2
3
  export type { RefetchIntervalFunction, RefetchInterval } from './types/refetch-interval';
3
4
  export { useQueryContext } from './hooks/useQueryContext';
@@ -5,6 +6,7 @@ export { useQueryData } from './hooks/useQueryData';
5
6
  export { useQueryResponses } from './hooks/useQueryResponses';
6
7
  export { useRefetchAll } from './hooks/useRefetchAll';
7
8
  export { useRefetchErrored } from './hooks/useRefetchErrored';
9
+ export { useSuspenseQueryData } from './hooks/useSuspenseQueryData';
8
10
  export type { InfiniteQueryDataSource, AnyInfiniteQueryDataSource } from './impl/infinite/types';
9
11
  export { makeInfiniteQueryDataSource } from './impl/infinite/factory';
10
12
  export { composeOptions as composeInfiniteQueryOptions } from './impl/infinite/utils';
@@ -3,6 +3,22 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _exportNames = {
7
+ useQueryContext: true,
8
+ useQueryData: true,
9
+ useQueryResponses: true,
10
+ useRefetchAll: true,
11
+ useRefetchErrored: true,
12
+ useSuspenseQueryData: true,
13
+ makeInfiniteQueryDataSource: true,
14
+ composeInfiniteQueryOptions: true,
15
+ makePlainQueryDataSource: true,
16
+ composePlainQueryOptions: true,
17
+ normalizeStatus: true,
18
+ getProgressiveRefetch: true,
19
+ ClientDataManager: true,
20
+ DataSourceProvider: true
21
+ };
6
22
  Object.defineProperty(exports, "ClientDataManager", {
7
23
  enumerable: true,
8
24
  get: function () {
@@ -81,11 +97,30 @@ Object.defineProperty(exports, "useRefetchErrored", {
81
97
  return _useRefetchErrored.useRefetchErrored;
82
98
  }
83
99
  });
100
+ Object.defineProperty(exports, "useSuspenseQueryData", {
101
+ enumerable: true,
102
+ get: function () {
103
+ return _useSuspenseQueryData.useSuspenseQueryData;
104
+ }
105
+ });
106
+ var _QueryAsyncBoundary = require("./components/QueryAsyncBoundary");
107
+ Object.keys(_QueryAsyncBoundary).forEach(function (key) {
108
+ if (key === "default" || key === "__esModule") return;
109
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
110
+ if (key in exports && exports[key] === _QueryAsyncBoundary[key]) return;
111
+ Object.defineProperty(exports, key, {
112
+ enumerable: true,
113
+ get: function () {
114
+ return _QueryAsyncBoundary[key];
115
+ }
116
+ });
117
+ });
84
118
  var _useQueryContext = require("./hooks/useQueryContext");
85
119
  var _useQueryData = require("./hooks/useQueryData");
86
120
  var _useQueryResponses = require("./hooks/useQueryResponses");
87
121
  var _useRefetchAll = require("./hooks/useRefetchAll");
88
122
  var _useRefetchErrored = require("./hooks/useRefetchErrored");
123
+ var _useSuspenseQueryData = require("./hooks/useSuspenseQueryData");
89
124
  var _factory = require("./impl/infinite/factory");
90
125
  var _utils = require("./impl/infinite/utils");
91
126
  var _factory2 = require("./impl/plain/factory");
@@ -1 +1 @@
1
- {"version":3,"names":["_useQueryContext","require","_useQueryData","_useQueryResponses","_useRefetchAll","_useRefetchErrored","_factory","_utils","_factory2","_utils2","_normalizeStatus","_getProgressiveRefetch","_ClientDataManager","_DataSourceProvider"],"sources":["index.ts"],"sourcesContent":["export type {QueryDataSourceContext, AnyQueryDataSource} from './types/base';\nexport type {RefetchIntervalFunction, RefetchInterval} from './types/refetch-interval';\n\nexport {useQueryContext} from './hooks/useQueryContext';\nexport {useQueryData} from './hooks/useQueryData';\nexport {useQueryResponses} from './hooks/useQueryResponses';\nexport {useRefetchAll} from './hooks/useRefetchAll';\nexport {useRefetchErrored} from './hooks/useRefetchErrored';\n\nexport type {InfiniteQueryDataSource, AnyInfiniteQueryDataSource} from './impl/infinite/types';\nexport {makeInfiniteQueryDataSource} from './impl/infinite/factory';\nexport {composeOptions as composeInfiniteQueryOptions} from './impl/infinite/utils';\n\nexport type {PlainQueryDataSource, AnyPlainQueryDataSource} from './impl/plain/types';\nexport {makePlainQueryDataSource} from './impl/plain/factory';\nexport {composeOptions as composePlainQueryOptions} from './impl/plain/utils';\n\nexport {normalizeStatus} from './utils/normalizeStatus';\nexport type {ProgressiveRefetchOptions} from './utils/getProgressiveRefetch';\nexport {getProgressiveRefetch} from './utils/getProgressiveRefetch';\n\nexport type {ClientDataManagerConfig} from './ClientDataManager';\nexport {ClientDataManager} from './ClientDataManager';\n\nexport {DataSourceProvider} from './DataSourceProvider';\n\nexport type {QueryNormalizer} from './types/normalizer';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AAGA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAGA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAEA,IAAAS,gBAAA,GAAAT,OAAA;AAEA,IAAAU,sBAAA,GAAAV,OAAA;AAGA,IAAAW,kBAAA,GAAAX,OAAA;AAEA,IAAAY,mBAAA,GAAAZ,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_QueryAsyncBoundary","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_useQueryContext","_useQueryData","_useQueryResponses","_useRefetchAll","_useRefetchErrored","_useSuspenseQueryData","_factory","_utils","_factory2","_utils2","_normalizeStatus","_getProgressiveRefetch","_ClientDataManager","_DataSourceProvider"],"sources":["index.ts"],"sourcesContent":["export * from './components/QueryAsyncBoundary';\n\nexport type {QueryDataSourceContext, AnyQueryDataSource} from './types/base';\nexport type {RefetchIntervalFunction, RefetchInterval} from './types/refetch-interval';\n\nexport {useQueryContext} from './hooks/useQueryContext';\nexport {useQueryData} from './hooks/useQueryData';\nexport {useQueryResponses} from './hooks/useQueryResponses';\nexport {useRefetchAll} from './hooks/useRefetchAll';\nexport {useRefetchErrored} from './hooks/useRefetchErrored';\nexport {useSuspenseQueryData} from './hooks/useSuspenseQueryData';\n\nexport type {InfiniteQueryDataSource, AnyInfiniteQueryDataSource} from './impl/infinite/types';\nexport {makeInfiniteQueryDataSource} from './impl/infinite/factory';\nexport {composeOptions as composeInfiniteQueryOptions} from './impl/infinite/utils';\n\nexport type {PlainQueryDataSource, AnyPlainQueryDataSource} from './impl/plain/types';\nexport {makePlainQueryDataSource} from './impl/plain/factory';\nexport {composeOptions as composePlainQueryOptions} from './impl/plain/utils';\n\nexport {normalizeStatus} from './utils/normalizeStatus';\nexport type {ProgressiveRefetchOptions} from './utils/getProgressiveRefetch';\nexport {getProgressiveRefetch} from './utils/getProgressiveRefetch';\n\nexport type {ClientDataManagerConfig} from './ClientDataManager';\nexport {ClientDataManager} from './ClientDataManager';\n\nexport {DataSourceProvider} from './DataSourceProvider';\n\nexport type {QueryNormalizer} from './types/normalizer';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,mBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,mBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,mBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AAKA,IAAAS,gBAAA,GAAAb,OAAA;AACA,IAAAc,aAAA,GAAAd,OAAA;AACA,IAAAe,kBAAA,GAAAf,OAAA;AACA,IAAAgB,cAAA,GAAAhB,OAAA;AACA,IAAAiB,kBAAA,GAAAjB,OAAA;AACA,IAAAkB,qBAAA,GAAAlB,OAAA;AAGA,IAAAmB,QAAA,GAAAnB,OAAA;AACA,IAAAoB,MAAA,GAAApB,OAAA;AAGA,IAAAqB,SAAA,GAAArB,OAAA;AACA,IAAAsB,OAAA,GAAAtB,OAAA;AAEA,IAAAuB,gBAAA,GAAAvB,OAAA;AAEA,IAAAwB,sBAAA,GAAAxB,OAAA;AAGA,IAAAyB,kBAAA,GAAAzB,OAAA;AAEA,IAAA0B,mBAAA,GAAA1B,OAAA","ignoreList":[]}
@@ -3,6 +3,11 @@ import type { OptimisticConfig } from '../../core/types/Normalizer';
3
3
  import type { RefetchInterval } from './refetch-interval';
4
4
  export interface QueryDataAdditionalOptions<TQueryFnData = unknown, TError = DefaultError, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> {
5
5
  refetchInterval?: RefetchInterval<TQueryFnData, TError, TQueryData, TQueryKey>;
6
+ /**
7
+ * @deprecated The use of the enabled option is deprecated.
8
+ * It is recommended to use idle as query parameters to control query state.
9
+ */
10
+ enabled?: boolean;
6
11
  /** Normalization configuration (enable/disable) */
7
12
  normalize?: boolean;
8
13
  /** Optimistic data update configuration */
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["options.ts"],"sourcesContent":["import type {DefaultError, QueryKey} from '@tanstack/react-query';\n\nimport type {OptimisticConfig} from '../../core/types/Normalizer';\n\nimport type {RefetchInterval} from './refetch-interval';\n\nexport interface QueryDataAdditionalOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> {\n refetchInterval?: RefetchInterval<TQueryFnData, TError, TQueryData, TQueryKey>;\n /** Normalization configuration (enable/disable) */\n normalize?: boolean;\n /** Optimistic data update configuration */\n optimistic?: boolean | OptimisticConfig;\n /** Invalidate data configuration */\n invalidate?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["options.ts"],"sourcesContent":["import type {DefaultError, QueryKey} from '@tanstack/react-query';\n\nimport type {OptimisticConfig} from '../../core/types/Normalizer';\n\nimport type {RefetchInterval} from './refetch-interval';\n\nexport interface QueryDataAdditionalOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> {\n refetchInterval?: RefetchInterval<TQueryFnData, TError, TQueryData, TQueryKey>;\n /**\n * @deprecated The use of the enabled option is deprecated.\n * It is recommended to use idle as query parameters to control query state.\n */\n enabled?: boolean;\n /** Normalization configuration (enable/disable) */\n normalize?: boolean;\n /** Optimistic data update configuration */\n optimistic?: boolean | OptimisticConfig;\n /** Invalidate data configuration */\n invalidate?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export declare function warn(msg: string): void;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.warn = warn;
7
+ function warn(msg) {
8
+ if (!msg || process.env.NODE_ENV === 'production') {
9
+ return;
10
+ }
11
+
12
+ // eslint-disable-next-line no-console
13
+ console.warn(msg);
14
+ }
15
+ // #sourceMappingURL=warn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["warn","msg","process","env","NODE_ENV","console"],"sources":["warn.ts"],"sourcesContent":["export function warn(msg: string) {\n if (!msg || process.env.NODE_ENV === 'production') {\n return;\n }\n\n // eslint-disable-next-line no-console\n console.warn(msg);\n}\n"],"mappings":";;;;;;AAAO,SAASA,IAAIA,CAACC,GAAW,EAAE;EAC9B,IAAI,CAACA,GAAG,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IAC/C;EACJ;;EAEA;EACAC,OAAO,CAACL,IAAI,CAACC,GAAG,CAAC;AACrB","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export declare const warnDisabledRefetch: () => Promise<void>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.warnDisabledRefetch = void 0;
7
+ var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
8
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
9
+ var _warn = require("./warn");
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ var warnDisabledRefetch = exports.warnDisabledRefetch = /*#__PURE__*/function () {
12
+ var _ref = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
13
+ return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
14
+ while (1) switch (_context.prev = _context.next) {
15
+ case 0:
16
+ (0, _warn.warn)('Disabled refetch is called');
17
+ case 1:
18
+ case "end":
19
+ return _context.stop();
20
+ }
21
+ }, _callee);
22
+ }));
23
+ return function warnDisabledRefetch() {
24
+ return _ref.apply(this, arguments);
25
+ };
26
+ }();
27
+ // #sourceMappingURL=warnDisabledRefetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_warn","require","_interopRequireDefault","e","__esModule","default","warnDisabledRefetch","exports","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","wrap","_callee$","_context","prev","next","warn","stop","apply","arguments"],"sources":["warnDisabledRefetch.ts"],"sourcesContent":["import {warn} from './warn';\n\nexport const warnDisabledRefetch = async (): Promise<void> => {\n warn('Disabled refetch is called');\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAA2B,SAAAC,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpB,IAAMG,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA;EAAA,IAAAE,IAAA,OAAAC,0BAAA,mBAAAC,4BAAA,IAAAC,IAAA,CAAG,SAAAC,QAAA;IAAA,WAAAF,4BAAA,IAAAG,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAC/B,IAAAC,UAAI,EAAC,4BAA4B,CAAC;QAAC;QAAA;UAAA,OAAAH,QAAA,CAAAI,IAAA;MAAA;IAAA,GAAAP,OAAA;EAAA,CACtC;EAAA,gBAFYN,mBAAmBA,CAAA;IAAA,OAAAE,IAAA,CAAAY,KAAA,OAAAC,SAAA;EAAA;AAAA,GAE/B","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ import type { QueryObserverResult, RefetchOptions } from '@tanstack/react-query';
2
+ export declare function wrapRefetch<TData, TError>(refetch: (options?: RefetchOptions) => Promise<QueryObserverResult<TData, TError>>): (options?: RefetchOptions) => Promise<void>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.wrapRefetch = wrapRefetch;
7
+ var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
8
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ function wrapRefetch(refetch) {
11
+ return /*#__PURE__*/function () {
12
+ var _ref = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(options) {
13
+ return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
14
+ while (1) switch (_context.prev = _context.next) {
15
+ case 0:
16
+ _context.next = 2;
17
+ return refetch(options);
18
+ case 2:
19
+ case "end":
20
+ return _context.stop();
21
+ }
22
+ }, _callee);
23
+ }));
24
+ return function (_x) {
25
+ return _ref.apply(this, arguments);
26
+ };
27
+ }();
28
+ }
29
+ // #sourceMappingURL=wrapRefetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["wrapRefetch","refetch","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","options","wrap","_callee$","_context","prev","next","stop","_x","apply","arguments"],"sources":["wrapRefetch.ts"],"sourcesContent":["import type {QueryObserverResult, RefetchOptions} from '@tanstack/react-query';\n\nexport function wrapRefetch<TData, TError>(\n refetch: (options?: RefetchOptions) => Promise<QueryObserverResult<TData, TError>>,\n): (options?: RefetchOptions) => Promise<void> {\n return async (options?: RefetchOptions) => {\n await refetch(options);\n };\n}\n"],"mappings":";;;;;;;;;AAEO,SAASA,WAAWA,CACvBC,OAAkF,EACvC;EAC3C;IAAA,IAAAC,IAAA,OAAAC,0BAAA,mBAAAC,4BAAA,IAAAC,IAAA,CAAO,SAAAC,QAAOC,OAAwB;MAAA,WAAAH,4BAAA,IAAAI,IAAA,UAAAC,SAAAC,QAAA;QAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;UAAA;YAAAF,QAAA,CAAAE,IAAA;YAAA,OAC5BX,OAAO,CAACM,OAAO,CAAC;UAAA;UAAA;YAAA,OAAAG,QAAA,CAAAG,IAAA;QAAA;MAAA,GAAAP,OAAA;IAAA,CACzB;IAAA,iBAAAQ,EAAA;MAAA,OAAAZ,IAAA,CAAAa,KAAA,OAAAC,SAAA;IAAA;EAAA;AACL","ignoreList":[]}
@@ -15,14 +15,14 @@ export interface DataSource<TContext, TParams, TRequest, TResponse, TData, TErro
15
15
  }
16
16
  export type AnyDataSource = DataSource<any, any, any, any, any, any, any, any, any>;
17
17
  export type DataSourceContext<TDataSource> = TDataSource extends DataSource<infer TContext, infer _TParams, infer _TRequest, infer _TResponse, infer _TData, infer _TError, infer _TOptions, infer _TState, infer _TFetchContext> ? TContext : never;
18
- export type DataSourceParams<TDataSource> = TDataSource extends DataSource<infer _TContenxt, infer TParams, infer TRequest, infer _TResponse, infer _TData, infer _TError, infer _TOptions, infer _TState, infer _TFetchContext> ? ActualParams<TParams, TRequest> : never;
19
- export type DataSourceRequest<TDataSource> = TDataSource extends DataSource<infer _TContenxt, infer _TParams, infer TRequest, infer _TResponse, infer _TData, infer _TError, infer _TOptions, infer _TState, infer _TFetchContext> ? TRequest : never;
20
- export type DataSourceResponse<TDataSource> = TDataSource extends DataSource<infer _TContenxt, infer _TParams, infer _TRequest, infer TResponse, infer _TData, infer _TError, infer _TOptions, infer _TState, infer _TFetchContext> ? TResponse : never;
21
- export type DataSourceData<TDataSource> = TDataSource extends DataSource<infer _TContenxt, infer _TParams, infer _TRequest, infer TResponse, infer TData, infer _TError, infer _TOptions, infer _TState, infer _TFetchContext> ? ActualData<TData, TResponse> : never;
22
- export type DataSourceError<TDataSource> = TDataSource extends DataSource<infer _TContenxt, infer _TParams, infer _TRequest, infer _TResponse, infer _TData, infer TError, infer _TOptions, infer _TState, infer _TFetchContext> ? TError : never;
23
- export type DataSourceOptions<TDataSource> = TDataSource extends DataSource<infer _TContenxt, infer _TParams, infer _TRequest, infer _TResponse, infer _TData, infer _TError, infer TOptions, infer _TState, infer _TFetchContext> ? TOptions : never;
24
- export type DataSourceState<TDataSource> = TDataSource extends DataSource<infer _TContenxt, infer _TParams, infer _TRequest, infer _TResponse, infer _TData, infer _TError, infer _TOptions, infer TState, infer _TFetchContext> ? TState : never;
25
- export type DataSourceFetchContext<TDataSource> = TDataSource extends DataSource<infer _TContenxt, infer _TParams, infer _TRequest, infer _TResponse, infer _TData, infer _TError, infer _TOptions, infer _TState, infer TFetchContext> ? TFetchContext : never;
18
+ export type DataSourceParams<TDataSource> = TDataSource extends DataSource<infer _TContext, infer TParams, infer TRequest, infer _TResponse, infer _TData, infer _TError, infer _TOptions, infer _TState, infer _TFetchContext> ? ActualParams<TParams, TRequest> : never;
19
+ export type DataSourceRequest<TDataSource> = TDataSource extends DataSource<infer _TContext, infer _TParams, infer TRequest, infer _TResponse, infer _TData, infer _TError, infer _TOptions, infer _TState, infer _TFetchContext> ? TRequest : never;
20
+ export type DataSourceResponse<TDataSource> = TDataSource extends DataSource<infer _TContext, infer _TParams, infer _TRequest, infer TResponse, infer _TData, infer _TError, infer _TOptions, infer _TState, infer _TFetchContext> ? TResponse : never;
21
+ export type DataSourceData<TDataSource> = TDataSource extends DataSource<infer _TContext, infer _TParams, infer _TRequest, infer TResponse, infer TData, infer _TError, infer _TOptions, infer _TState, infer _TFetchContext> ? ActualData<TData, TResponse> : never;
22
+ export type DataSourceError<TDataSource> = TDataSource extends DataSource<infer _TContext, infer _TParams, infer _TRequest, infer _TResponse, infer _TData, infer TError, infer _TOptions, infer _TState, infer _TFetchContext> ? TError : never;
23
+ export type DataSourceOptions<TDataSource> = TDataSource extends DataSource<infer _TContext, infer _TParams, infer _TRequest, infer _TResponse, infer _TData, infer _TError, infer TOptions, infer _TState, infer _TFetchContext> ? TOptions : never;
24
+ export type DataSourceState<TDataSource> = TDataSource extends DataSource<infer _TContext, infer _TParams, infer _TRequest, infer _TResponse, infer _TData, infer _TError, infer _TOptions, infer TState, infer _TFetchContext> ? TState : never;
25
+ export type DataSourceFetchContext<TDataSource> = TDataSource extends DataSource<infer _TContext, infer _TParams, infer _TRequest, infer _TResponse, infer _TData, infer _TError, infer _TOptions, infer _TState, infer TFetchContext> ? TFetchContext : never;
26
26
  export type ActualParams<TParams, TRequest> = (unknown extends TParams ? TRequest : TParams) | typeof idle;
27
27
  export type ActualData<TData, TResponse> = unknown extends TData ? TResponse : TData;
28
28
  export {};
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["DataSource.ts"],"sourcesContent":["import type {idle} from '../constants';\n\nexport type DataSourceKey = ReadonlyArray<unknown>;\nexport type DataSourceTag = string;\n\ndeclare const errorHintSymbol: unique symbol;\ndeclare const stateHintSymbol: unique symbol;\n\nexport interface DataSource<\n TContext,\n TParams,\n TRequest,\n TResponse,\n TData,\n TError,\n TOptions,\n TState,\n TFetchContext,\n> {\n readonly name: string;\n\n fetch: (\n context: TContext,\n fetchContext: TFetchContext,\n request: TRequest,\n ) => Promise<TResponse> | TResponse;\n tags?: (params: ActualParams<NoInfer<TParams>, NoInfer<TRequest>>) => DataSourceTag[];\n\n transformParams?: (params: TParams) => NoInfer<TRequest>;\n transformResponse?: (response: TResponse) => TData;\n\n options?: Partial<TOptions>;\n [stateHintSymbol]?: TState;\n [errorHintSymbol]?: TError;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyDataSource = DataSource<any, any, any, any, any, any, any, any, any>;\n\nexport type DataSourceContext<TDataSource> =\n TDataSource extends DataSource<\n infer TContext,\n infer _TParams,\n infer _TRequest,\n infer _TResponse,\n infer _TData,\n infer _TError,\n infer _TOptions,\n infer _TState,\n infer _TFetchContext\n >\n ? TContext\n : never;\n\nexport type DataSourceParams<TDataSource> =\n TDataSource extends DataSource<\n infer _TContenxt,\n infer TParams,\n infer TRequest,\n infer _TResponse,\n infer _TData,\n infer _TError,\n infer _TOptions,\n infer _TState,\n infer _TFetchContext\n >\n ? ActualParams<TParams, TRequest>\n : never;\n\nexport type DataSourceRequest<TDataSource> =\n TDataSource extends DataSource<\n infer _TContenxt,\n infer _TParams,\n infer TRequest,\n infer _TResponse,\n infer _TData,\n infer _TError,\n infer _TOptions,\n infer _TState,\n infer _TFetchContext\n >\n ? TRequest\n : never;\n\nexport type DataSourceResponse<TDataSource> =\n TDataSource extends DataSource<\n infer _TContenxt,\n infer _TParams,\n infer _TRequest,\n infer TResponse,\n infer _TData,\n infer _TError,\n infer _TOptions,\n infer _TState,\n infer _TFetchContext\n >\n ? TResponse\n : never;\n\nexport type DataSourceData<TDataSource> =\n TDataSource extends DataSource<\n infer _TContenxt,\n infer _TParams,\n infer _TRequest,\n infer TResponse,\n infer TData,\n infer _TError,\n infer _TOptions,\n infer _TState,\n infer _TFetchContext\n >\n ? ActualData<TData, TResponse>\n : never;\n\nexport type DataSourceError<TDataSource> =\n TDataSource extends DataSource<\n infer _TContenxt,\n infer _TParams,\n infer _TRequest,\n infer _TResponse,\n infer _TData,\n infer TError,\n infer _TOptions,\n infer _TState,\n infer _TFetchContext\n >\n ? TError\n : never;\n\nexport type DataSourceOptions<TDataSource> =\n TDataSource extends DataSource<\n infer _TContenxt,\n infer _TParams,\n infer _TRequest,\n infer _TResponse,\n infer _TData,\n infer _TError,\n infer TOptions,\n infer _TState,\n infer _TFetchContext\n >\n ? TOptions\n : never;\n\nexport type DataSourceState<TDataSource> =\n TDataSource extends DataSource<\n infer _TContenxt,\n infer _TParams,\n infer _TRequest,\n infer _TResponse,\n infer _TData,\n infer _TError,\n infer _TOptions,\n infer TState,\n infer _TFetchContext\n >\n ? TState\n : never;\n\nexport type DataSourceFetchContext<TDataSource> =\n TDataSource extends DataSource<\n infer _TContenxt,\n infer _TParams,\n infer _TRequest,\n infer _TResponse,\n infer _TData,\n infer _TError,\n infer _TOptions,\n infer _TState,\n infer TFetchContext\n >\n ? TFetchContext\n : never;\n\nexport type ActualParams<TParams, TRequest> =\n | (unknown extends TParams ? TRequest : TParams)\n | typeof idle;\n\nexport type ActualData<TData, TResponse> = unknown extends TData ? TResponse : TData;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["DataSource.ts"],"sourcesContent":["import type {idle} from '../constants';\n\nexport type DataSourceKey = ReadonlyArray<unknown>;\nexport type DataSourceTag = string;\n\ndeclare const errorHintSymbol: unique symbol;\ndeclare const stateHintSymbol: unique symbol;\n\nexport interface DataSource<\n TContext,\n TParams,\n TRequest,\n TResponse,\n TData,\n TError,\n TOptions,\n TState,\n TFetchContext,\n> {\n readonly name: string;\n\n fetch: (\n context: TContext,\n fetchContext: TFetchContext,\n request: TRequest,\n ) => Promise<TResponse> | TResponse;\n tags?: (params: ActualParams<NoInfer<TParams>, NoInfer<TRequest>>) => DataSourceTag[];\n\n transformParams?: (params: TParams) => NoInfer<TRequest>;\n transformResponse?: (response: TResponse) => TData;\n\n options?: Partial<TOptions>;\n [stateHintSymbol]?: TState;\n [errorHintSymbol]?: TError;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyDataSource = DataSource<any, any, any, any, any, any, any, any, any>;\n\nexport type DataSourceContext<TDataSource> =\n TDataSource extends DataSource<\n infer TContext,\n infer _TParams,\n infer _TRequest,\n infer _TResponse,\n infer _TData,\n infer _TError,\n infer _TOptions,\n infer _TState,\n infer _TFetchContext\n >\n ? TContext\n : never;\n\nexport type DataSourceParams<TDataSource> =\n TDataSource extends DataSource<\n infer _TContext,\n infer TParams,\n infer TRequest,\n infer _TResponse,\n infer _TData,\n infer _TError,\n infer _TOptions,\n infer _TState,\n infer _TFetchContext\n >\n ? ActualParams<TParams, TRequest>\n : never;\n\nexport type DataSourceRequest<TDataSource> =\n TDataSource extends DataSource<\n infer _TContext,\n infer _TParams,\n infer TRequest,\n infer _TResponse,\n infer _TData,\n infer _TError,\n infer _TOptions,\n infer _TState,\n infer _TFetchContext\n >\n ? TRequest\n : never;\n\nexport type DataSourceResponse<TDataSource> =\n TDataSource extends DataSource<\n infer _TContext,\n infer _TParams,\n infer _TRequest,\n infer TResponse,\n infer _TData,\n infer _TError,\n infer _TOptions,\n infer _TState,\n infer _TFetchContext\n >\n ? TResponse\n : never;\n\nexport type DataSourceData<TDataSource> =\n TDataSource extends DataSource<\n infer _TContext,\n infer _TParams,\n infer _TRequest,\n infer TResponse,\n infer TData,\n infer _TError,\n infer _TOptions,\n infer _TState,\n infer _TFetchContext\n >\n ? ActualData<TData, TResponse>\n : never;\n\nexport type DataSourceError<TDataSource> =\n TDataSource extends DataSource<\n infer _TContext,\n infer _TParams,\n infer _TRequest,\n infer _TResponse,\n infer _TData,\n infer TError,\n infer _TOptions,\n infer _TState,\n infer _TFetchContext\n >\n ? TError\n : never;\n\nexport type DataSourceOptions<TDataSource> =\n TDataSource extends DataSource<\n infer _TContext,\n infer _TParams,\n infer _TRequest,\n infer _TResponse,\n infer _TData,\n infer _TError,\n infer TOptions,\n infer _TState,\n infer _TFetchContext\n >\n ? TOptions\n : never;\n\nexport type DataSourceState<TDataSource> =\n TDataSource extends DataSource<\n infer _TContext,\n infer _TParams,\n infer _TRequest,\n infer _TResponse,\n infer _TData,\n infer _TError,\n infer _TOptions,\n infer TState,\n infer _TFetchContext\n >\n ? TState\n : never;\n\nexport type DataSourceFetchContext<TDataSource> =\n TDataSource extends DataSource<\n infer _TContext,\n infer _TParams,\n infer _TRequest,\n infer _TResponse,\n infer _TData,\n infer _TError,\n infer _TOptions,\n infer _TState,\n infer TFetchContext\n >\n ? TFetchContext\n : never;\n\nexport type ActualParams<TParams, TRequest> =\n | (unknown extends TParams ? TRequest : TParams)\n | typeof idle;\n\nexport type ActualData<TData, TResponse> = unknown extends TData ? TResponse : TData;\n"],"mappings":"","ignoreList":[]}
@@ -23,4 +23,7 @@
23
23
  * (error) => ({ error: true, message: error.message })
24
24
  * );
25
25
  */
26
- export declare function withCatch<TArgs extends unknown[], TFetchReturnType, TCatchReturnType>(fetchFn: (...args: TArgs) => Promise<TFetchReturnType>, onCatchFn: (reason: unknown) => TCatchReturnType): (...args: TArgs) => Promise<TFetchReturnType | TCatchReturnType>;
26
+ export declare function withCatch<TArgs extends unknown[], TFetchReturnType, TCatchReturnType>(fetchFn: (...args: TArgs) => Promise<TFetchReturnType>, onCatchFn: (reason: unknown) => TCatchReturnType): (...args: TArgs) => Promise<WithCatchMergedReturn<TFetchReturnType, TCatchReturnType>>;
27
+ /** If success is array-typed, an inferred `() => []` handler (`never[]`) is merged into the success type. */
28
+ type WithCatchMergedReturn<TSuccess, TCatch> = [TCatch] extends [never] ? TSuccess : [TSuccess] extends [readonly unknown[]] ? TCatch extends readonly never[] ? TSuccess : TSuccess | TCatch : TSuccess | TCatch;
29
+ export {};
@@ -28,4 +28,6 @@ export function withCatch(fetchFn, onCatchFn) {
28
28
  return fetchFn.apply(void 0, arguments)["catch"](onCatchFn);
29
29
  };
30
30
  }
31
+
32
+ /** If success is array-typed, an inferred `() => []` handler (`never[]`) is merged into the success type. */
31
33
  // #sourceMappingURL=withCatch.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["withCatch","fetchFn","onCatchFn","apply","arguments"],"sources":["withCatch.ts"],"sourcesContent":["/**\n * Creates a wrapper around a function that safely handles errors using a provided error handler.\n *\n * This utility function enhances a Promise-returning function by adding standardized error handling.\n * It catches any errors thrown by the original function and processes them through the provided\n * error handler, allowing for consistent error management across the application.\n *\n * @template TArgs - The argument types of the original function\n * @template TFetchReturnType - The return type of the original function's Promise\n * @template TCatchReturnType - The return type of the error handler function\n *\n * @param fetchFn - The original function that returns a Promise\n * @param onCatchFn - The error handler function that processes any caught errors\n *\n * @returns A new function with the same signature as the original function,\n * but with error handling applied. The returned function will resolve to either\n * the successful result of the original function or the result of the error handler.\n *\n * @example\n * // Basic usage with a string parameter\n * const fetchUser = withCatch(\n * someFetchFunction,\n * (error) => ({ error: true, message: error.message })\n * );\n */\nexport function withCatch<TArgs extends unknown[], TFetchReturnType, TCatchReturnType>(\n fetchFn: (...args: TArgs) => Promise<TFetchReturnType>,\n onCatchFn: (reason: unknown) => TCatchReturnType,\n): (...args: TArgs) => Promise<TFetchReturnType | TCatchReturnType> {\n return (...args) => {\n return fetchFn(...args).catch(onCatchFn) as Promise<TFetchReturnType | TCatchReturnType>;\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,SAASA,CACrBC,OAAsD,EACtDC,SAAgD,EACgB;EAChE,OAAO,YAAa;IAChB,OAAOD,OAAO,CAAAE,KAAA,SAAAC,SAAQ,CAAC,SAAM,CAACF,SAAS,CAAC;EAC5C,CAAC;AACL","ignoreList":[]}
1
+ {"version":3,"names":["withCatch","fetchFn","onCatchFn","apply","arguments"],"sources":["withCatch.ts"],"sourcesContent":["/**\n * Creates a wrapper around a function that safely handles errors using a provided error handler.\n *\n * This utility function enhances a Promise-returning function by adding standardized error handling.\n * It catches any errors thrown by the original function and processes them through the provided\n * error handler, allowing for consistent error management across the application.\n *\n * @template TArgs - The argument types of the original function\n * @template TFetchReturnType - The return type of the original function's Promise\n * @template TCatchReturnType - The return type of the error handler function\n *\n * @param fetchFn - The original function that returns a Promise\n * @param onCatchFn - The error handler function that processes any caught errors\n *\n * @returns A new function with the same signature as the original function,\n * but with error handling applied. The returned function will resolve to either\n * the successful result of the original function or the result of the error handler.\n *\n * @example\n * // Basic usage with a string parameter\n * const fetchUser = withCatch(\n * someFetchFunction,\n * (error) => ({ error: true, message: error.message })\n * );\n */\nexport function withCatch<TArgs extends unknown[], TFetchReturnType, TCatchReturnType>(\n fetchFn: (...args: TArgs) => Promise<TFetchReturnType>,\n onCatchFn: (reason: unknown) => TCatchReturnType,\n): (...args: TArgs) => Promise<WithCatchMergedReturn<TFetchReturnType, TCatchReturnType>> {\n return (...args) => {\n return fetchFn(...args).catch(onCatchFn) as Promise<\n WithCatchMergedReturn<TFetchReturnType, TCatchReturnType>\n >;\n };\n}\n\n/** If success is array-typed, an inferred `() => []` handler (`never[]`) is merged into the success type. */\ntype WithCatchMergedReturn<TSuccess, TCatch> = [TCatch] extends [never]\n ? TSuccess\n : [TSuccess] extends [readonly unknown[]]\n ? TCatch extends readonly never[]\n ? TSuccess\n : TSuccess | TCatch\n : TSuccess | TCatch;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,SAASA,CACrBC,OAAsD,EACtDC,SAAgD,EACsC;EACtF,OAAO,YAAa;IAChB,OAAOD,OAAO,CAAAE,KAAA,SAAAC,SAAQ,CAAC,SAAM,CAACF,SAAS,CAAC;EAG5C,CAAC;AACL;;AAEA","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import type { AsyncBoundaryProps } from './types';
3
+ export declare const AsyncBoundary: React.FC<AsyncBoundaryProps>;
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { ErrorBoundary } from 'react-error-boundary';
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ export var AsyncBoundary = function AsyncBoundary(_ref) {
5
+ var LoadingView = _ref.LoadingView,
6
+ ErrorView = _ref.ErrorView,
7
+ onReset = _ref.onReset,
8
+ children = _ref.children;
9
+ var fallbackRender = React.useCallback(function (_ref2) {
10
+ var error = _ref2.error,
11
+ resetErrorBoundary = _ref2.resetErrorBoundary;
12
+ return /*#__PURE__*/_jsx(ErrorView, {
13
+ error: error,
14
+ action: {
15
+ handler: resetErrorBoundary
16
+ }
17
+ });
18
+ }, [ErrorView]);
19
+ return /*#__PURE__*/_jsx(ErrorBoundary, {
20
+ fallbackRender: fallbackRender,
21
+ onReset: onReset,
22
+ children: /*#__PURE__*/_jsx(React.Suspense, {
23
+ fallback: /*#__PURE__*/_jsx(LoadingView, {}),
24
+ children: children
25
+ })
26
+ });
27
+ };
28
+ // #sourceMappingURL=AsyncBoundary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","ErrorBoundary","jsx","_jsx","AsyncBoundary","_ref","LoadingView","ErrorView","onReset","children","fallbackRender","useCallback","_ref2","error","resetErrorBoundary","action","handler","Suspense","fallback"],"sources":["AsyncBoundary.tsx"],"sourcesContent":["import React from 'react';\n\nimport type {FallbackProps} from 'react-error-boundary';\nimport {ErrorBoundary} from 'react-error-boundary';\n\nimport type {AsyncBoundaryProps} from './types';\n\nexport const AsyncBoundary: React.FC<AsyncBoundaryProps> = ({\n LoadingView,\n ErrorView,\n onReset,\n children,\n}) => {\n const fallbackRender = React.useCallback(\n ({error, resetErrorBoundary}: FallbackProps) => (\n <ErrorView error={error} action={{handler: resetErrorBoundary}} />\n ),\n [ErrorView],\n );\n\n return (\n <ErrorBoundary fallbackRender={fallbackRender} onReset={onReset}>\n <React.Suspense fallback={<LoadingView />}>{children}</React.Suspense>\n </ErrorBoundary>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAGzB,SAAQC,aAAa,QAAO,sBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAInD,OAAO,IAAMC,aAA2C,GAAG,SAA9CA,aAA2CA,CAAAC,IAAA,EAKlD;EAAA,IAJFC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IACXC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IACPC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;EAER,IAAMC,cAAc,GAAGV,KAAK,CAACW,WAAW,CACpC,UAAAC,KAAA;IAAA,IAAEC,KAAK,GAAAD,KAAA,CAALC,KAAK;MAAEC,kBAAkB,GAAAF,KAAA,CAAlBE,kBAAkB;IAAA,oBACvBX,IAAA,CAACI,SAAS;MAACM,KAAK,EAAEA,KAAM;MAACE,MAAM,EAAE;QAACC,OAAO,EAAEF;MAAkB;IAAE,CAAE,CAAC;EAAA,CACrE,EACD,CAACP,SAAS,CACd,CAAC;EAED,oBACIJ,IAAA,CAACF,aAAa;IAACS,cAAc,EAAEA,cAAe;IAACF,OAAO,EAAEA,OAAQ;IAAAC,QAAA,eAC5DN,IAAA,CAACH,KAAK,CAACiB,QAAQ;MAACC,QAAQ,eAAEf,IAAA,CAACG,WAAW,IAAE,CAAE;MAAAG,QAAA,EAAEA;IAAQ,CAAiB;EAAC,CAC3D,CAAC;AAExB,CAAC","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ export type { AsyncBoundaryProps, AsyncBoundaryComponent } from './types';
2
+ export { AsyncBoundary } from './AsyncBoundary';
3
+ export { withAsyncBoundary } from './withAsyncBoundary';
@@ -0,0 +1,3 @@
1
+ export { AsyncBoundary } from './AsyncBoundary';
2
+ export { withAsyncBoundary } from './withAsyncBoundary';
3
+ // #sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AsyncBoundary","withAsyncBoundary"],"sources":["index.ts"],"sourcesContent":["export type {AsyncBoundaryProps, AsyncBoundaryComponent} from './types';\nexport {AsyncBoundary} from './AsyncBoundary';\nexport {withAsyncBoundary} from './withAsyncBoundary';\n"],"mappings":"AACA,SAAQA,aAAa,QAAO,iBAAiB;AAC7C,SAAQC,iBAAiB,QAAO,qBAAqB","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ import type { ComponentType, ReactNode } from 'react';
2
+ import type { ErrorViewProps } from '../types';
3
+ export interface AsyncBoundaryProps {
4
+ LoadingView: ComponentType;
5
+ ErrorView: ComponentType<ErrorViewProps>;
6
+ onReset?: () => void;
7
+ children: ReactNode;
8
+ }
9
+ export interface AsyncBoundaryComponent<TProps extends object> extends React.FC<TProps> {
10
+ Content: React.ComponentType<TProps>;
11
+ Loading: AsyncBoundaryProps['LoadingView'];
12
+ Error: AsyncBoundaryProps['ErrorView'];
13
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ // #sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {ComponentType, ReactNode} from 'react';\n\nimport type {ErrorViewProps} from '../types';\n\nexport interface AsyncBoundaryProps {\n LoadingView: ComponentType;\n ErrorView: ComponentType<ErrorViewProps>;\n onReset?: () => void;\n children: ReactNode;\n}\n\nexport interface AsyncBoundaryComponent<TProps extends object> extends React.FC<TProps> {\n Content: React.ComponentType<TProps>;\n Loading: AsyncBoundaryProps['LoadingView'];\n Error: AsyncBoundaryProps['ErrorView'];\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import type { AsyncBoundaryComponent, AsyncBoundaryProps } from './types';
3
+ export declare const withAsyncBoundary: <TProps extends object>(Component: React.ComponentType<TProps>, LoadingView: AsyncBoundaryProps["LoadingView"], ErrorView: AsyncBoundaryProps["ErrorView"]) => AsyncBoundaryComponent<TProps>;
@@ -0,0 +1,19 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import React from 'react';
3
+ import { AsyncBoundary } from './AsyncBoundary';
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ export var withAsyncBoundary = function withAsyncBoundary(Component, LoadingView, ErrorView) {
6
+ var WrappedComponent = function WrappedComponent(props) {
7
+ return /*#__PURE__*/_jsx(AsyncBoundary, {
8
+ LoadingView: LoadingView,
9
+ ErrorView: ErrorView,
10
+ children: /*#__PURE__*/_jsx(Component, _objectSpread({}, props))
11
+ });
12
+ };
13
+ WrappedComponent.displayName = "WithAsyncBoundary(".concat(Component.displayName || Component.name, ")");
14
+ WrappedComponent.Content = Component;
15
+ WrappedComponent.Loading = LoadingView;
16
+ WrappedComponent.Error = ErrorView;
17
+ return WrappedComponent;
18
+ };
19
+ // #sourceMappingURL=withAsyncBoundary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","AsyncBoundary","jsx","_jsx","withAsyncBoundary","Component","LoadingView","ErrorView","WrappedComponent","props","children","_objectSpread","displayName","concat","name","Content","Loading","Error"],"sources":["withAsyncBoundary.tsx"],"sourcesContent":["import React from 'react';\n\nimport {AsyncBoundary} from './AsyncBoundary';\nimport type {AsyncBoundaryComponent, AsyncBoundaryProps} from './types';\n\nexport const withAsyncBoundary = <TProps extends object>(\n Component: React.ComponentType<TProps>,\n LoadingView: AsyncBoundaryProps['LoadingView'],\n ErrorView: AsyncBoundaryProps['ErrorView'],\n) => {\n const WrappedComponent = ((props: TProps) => (\n <AsyncBoundary LoadingView={LoadingView} ErrorView={ErrorView}>\n <Component {...props} />\n </AsyncBoundary>\n )) as AsyncBoundaryComponent<TProps>;\n\n WrappedComponent.displayName = `WithAsyncBoundary(${Component.displayName || Component.name})`;\n\n WrappedComponent.Content = Component;\n WrappedComponent.Loading = LoadingView;\n WrappedComponent.Error = ErrorView;\n\n return WrappedComponent;\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAAQC,aAAa,QAAO,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAG9C,OAAO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAiBA,CAC1BC,SAAsC,EACtCC,WAA8C,EAC9CC,SAA0C,EACzC;EACD,IAAMC,gBAAgB,GAAI,SAApBA,gBAAgBA,CAAKC,KAAa;IAAA,oBACpCN,IAAA,CAACF,aAAa;MAACK,WAAW,EAAEA,WAAY;MAACC,SAAS,EAAEA,SAAU;MAAAG,QAAA,eAC1DP,IAAA,CAACE,SAAS,EAAAM,aAAA,KAAKF,KAAK,CAAG;IAAC,CACb,CAAC;EAAA,CACgB;EAEpCD,gBAAgB,CAACI,WAAW,wBAAAC,MAAA,CAAwBR,SAAS,CAACO,WAAW,IAAIP,SAAS,CAACS,IAAI,MAAG;EAE9FN,gBAAgB,CAACO,OAAO,GAAGV,SAAS;EACpCG,gBAAgB,CAACQ,OAAO,GAAGV,WAAW;EACtCE,gBAAgB,CAACS,KAAK,GAAGV,SAAS;EAElC,OAAOC,gBAAgB;AAC3B,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ import type React from 'react';
2
+ export declare const EmptyView: React.FC;
@@ -0,0 +1,4 @@
1
+ export var EmptyView = function EmptyView() {
2
+ return null;
3
+ };
4
+ // #sourceMappingURL=EmptyView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EmptyView"],"sources":["EmptyView.tsx"],"sourcesContent":["import type React from 'react';\n\nexport const EmptyView: React.FC = () => {\n return null;\n};\n"],"mappings":"AAEA,OAAO,IAAMA,SAAmB,GAAG,SAAtBA,SAAmBA,CAAA,EAAS;EACrC,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export { EmptyView } from './EmptyView';
@@ -0,0 +1,2 @@
1
+ export { EmptyView } from './EmptyView';
2
+ // #sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EmptyView"],"sources":["index.ts"],"sourcesContent":["export {EmptyView} from './EmptyView';\n"],"mappings":"AAAA,SAAQA,SAAS,QAAO,aAAa","ignoreList":[]}
@@ -3,7 +3,7 @@ export interface ErrorAction {
3
3
  handler: () => unknown;
4
4
  children?: ReactNode;
5
5
  }
6
- export interface ErrorViewProps<TError> {
6
+ export interface ErrorViewProps<TError = unknown> {
7
7
  error: TError | null;
8
8
  action?: ErrorAction;
9
9
  }
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {ReactNode} from 'react';\n\nexport interface ErrorAction {\n handler: () => unknown;\n children?: ReactNode;\n}\n\nexport interface ErrorViewProps<TError> {\n error: TError | null;\n action?: ErrorAction;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {ReactNode} from 'react';\n\nexport interface ErrorAction {\n handler: () => unknown;\n children?: ReactNode;\n}\n\nexport interface ErrorViewProps<TError = unknown> {\n error: TError | null;\n action?: ErrorAction;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,8 +1,10 @@
1
+ export * from './components/AsyncBoundary';
2
+ export * from './components/DataLoader';
3
+ export * from './components/DataInfiniteLoader';
4
+ export * from './components/EmptyView';
5
+ export type { ErrorAction, ErrorViewProps } from './components/types';
1
6
  export { DataManagerContext, useDataManager } from './DataManagerContext';
2
7
  export { DataManagerProvider } from './DataManagerProvider';
3
8
  export type { DataManagerProviderProps } from './DataManagerProvider';
4
9
  export type { WithDataManagerProps } from './withDataManager';
5
10
  export { withDataManager } from './withDataManager';
6
- export type { ErrorAction, ErrorViewProps } from './components/types';
7
- export * from './components/DataLoader';
8
- export * from './components/DataInfiniteLoader';
@@ -1,6 +1,8 @@
1
+ export * from './components/AsyncBoundary';
2
+ export * from './components/DataLoader';
3
+ export * from './components/DataInfiniteLoader';
4
+ export * from './components/EmptyView';
1
5
  export { DataManagerContext, useDataManager } from './DataManagerContext';
2
6
  export { DataManagerProvider } from './DataManagerProvider';
3
7
  export { withDataManager } from './withDataManager';
4
- export * from './components/DataLoader';
5
- export * from './components/DataInfiniteLoader';
6
8
  // #sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["DataManagerContext","useDataManager","DataManagerProvider","withDataManager"],"sources":["index.ts"],"sourcesContent":["export {DataManagerContext, useDataManager} from './DataManagerContext';\nexport {DataManagerProvider} from './DataManagerProvider';\nexport type {DataManagerProviderProps} from './DataManagerProvider';\n\nexport type {WithDataManagerProps} from './withDataManager';\nexport {withDataManager} from './withDataManager';\n\nexport type {ErrorAction, ErrorViewProps} from './components/types';\nexport * from './components/DataLoader';\nexport * from './components/DataInfiniteLoader';\n"],"mappings":"AAAA,SAAQA,kBAAkB,EAAEC,cAAc,QAAO,sBAAsB;AACvE,SAAQC,mBAAmB,QAAO,uBAAuB;AAIzD,SAAQC,eAAe,QAAO,mBAAmB;AAGjD,cAAc,yBAAyB;AACvC,cAAc,iCAAiC","ignoreList":[]}
1
+ {"version":3,"names":["DataManagerContext","useDataManager","DataManagerProvider","withDataManager"],"sources":["index.ts"],"sourcesContent":["export * from './components/AsyncBoundary';\nexport * from './components/DataLoader';\nexport * from './components/DataInfiniteLoader';\nexport * from './components/EmptyView';\nexport type {ErrorAction, ErrorViewProps} from './components/types';\n\nexport {DataManagerContext, useDataManager} from './DataManagerContext';\nexport {DataManagerProvider} from './DataManagerProvider';\nexport type {DataManagerProviderProps} from './DataManagerProvider';\nexport type {WithDataManagerProps} from './withDataManager';\nexport {withDataManager} from './withDataManager';\n"],"mappings":"AAAA,cAAc,4BAA4B;AAC1C,cAAc,yBAAyB;AACvC,cAAc,iCAAiC;AAC/C,cAAc,wBAAwB;AAGtC,SAAQA,kBAAkB,EAAEC,cAAc,QAAO,sBAAsB;AACvE,SAAQC,mBAAmB,QAAO,uBAAuB;AAGzD,SAAQC,eAAe,QAAO,mBAAmB","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import type { QueryAsyncBoundaryProps } from './types';
3
+ export declare const QueryAsyncBoundary: React.FC<QueryAsyncBoundaryProps>;