@refinedev/core 4.51.0 → 4.52.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 (254) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/LICENSE +21 -0
  3. package/dist/components/authenticated/index.d.mts.map +75 -1
  4. package/dist/components/autoSaveIndicator/index.d.cts.map +1 -1
  5. package/dist/components/autoSaveIndicator/index.d.mts.map +24 -1
  6. package/dist/components/autoSaveIndicator/index.d.ts.map +1 -1
  7. package/dist/components/canAccess/index.d.mts.map +52 -1
  8. package/dist/components/containers/index.d.mts.map +2 -1
  9. package/dist/components/containers/refine/index.d.mts.map +11 -1
  10. package/dist/components/gh-banner/index.d.mts.map +7 -1
  11. package/dist/components/gh-banner/styles.d.mts.map +2 -1
  12. package/dist/components/index.d.mts.map +10 -1
  13. package/dist/components/layoutWrapper/defaultLayout/index.d.mts.map +4 -1
  14. package/dist/components/layoutWrapper/index.d.mts.map +46 -1
  15. package/dist/components/pages/auth/components/forgotPassword/index.d.mts.map +7 -1
  16. package/dist/components/pages/auth/components/index.d.mts.map +5 -1
  17. package/dist/components/pages/auth/components/login/index.d.mts.map +7 -1
  18. package/dist/components/pages/auth/components/register/index.d.mts.map +7 -1
  19. package/dist/components/pages/auth/components/updatePassword/index.d.mts.map +7 -1
  20. package/dist/components/pages/auth/index.d.mts.map +12 -1
  21. package/dist/components/pages/auth/types.d.mts.map +179 -1
  22. package/dist/components/pages/config-error/index.d.mts.map +3 -1
  23. package/dist/components/pages/config-success/index.d.mts.map +6 -1
  24. package/dist/components/pages/error/index.d.mts.map +9 -1
  25. package/dist/components/pages/index.d.mts.map +7 -1
  26. package/dist/components/pages/login/index.d.mts.map +13 -1
  27. package/dist/components/pages/ready/index.d.mts.map +8 -1
  28. package/dist/components/pages/welcome/index.d.mts.map +3 -1
  29. package/dist/components/routeChangeHandler/index.d.mts.map +3 -1
  30. package/dist/components/telemetry/index.d.mts.map +3 -1
  31. package/dist/components/telemetry/types.d.mts.map +16 -1
  32. package/dist/components/undoableQueue/index.d.mts.map +6 -1
  33. package/dist/contexts/accessControl/index.d.mts.map +7 -1
  34. package/dist/contexts/accessControl/types.d.mts.map +84 -1
  35. package/dist/contexts/auditLog/index.d.mts.map +5 -1
  36. package/dist/contexts/auditLog/types.d.mts.map +41 -1
  37. package/dist/contexts/auth/index.d.mts.map +18 -1
  38. package/dist/contexts/auth/types.d.mts.map +101 -1
  39. package/dist/contexts/data/index.d.mts.map +10 -1
  40. package/dist/contexts/data/types.d.mts.map +347 -1
  41. package/dist/contexts/i18n/index.d.mts.map +7 -1
  42. package/dist/contexts/i18n/types.d.mts.map +13 -1
  43. package/dist/contexts/live/index.d.mts.map +5 -1
  44. package/dist/contexts/live/types.d.mts.map +96 -1
  45. package/dist/contexts/notification/index.d.mts.map +7 -1
  46. package/dist/contexts/notification/types.d.mts.map +27 -1
  47. package/dist/contexts/refine/index.d.mts.map +6 -1
  48. package/dist/contexts/refine/types.d.mts.map +325 -1
  49. package/dist/contexts/resource/index.d.mts.map +7 -1
  50. package/dist/contexts/resource/types.d.mts.map +168 -1
  51. package/dist/contexts/router/index.d.mts.map +7 -1
  52. package/dist/contexts/router/legacy/index.d.mts.map +6 -1
  53. package/dist/contexts/router/legacy/types.d.mts.map +47 -1
  54. package/dist/contexts/router/picker/index.d.mts.map +15 -1
  55. package/dist/contexts/router/types.d.mts.map +67 -1
  56. package/dist/contexts/undoableQueue/index.d.mts.map +6 -1
  57. package/dist/contexts/undoableQueue/types.d.mts.map +21 -1
  58. package/dist/contexts/unsavedWarn/index.d.mts.map +5 -1
  59. package/dist/contexts/unsavedWarn/types.d.mts.map +5 -1
  60. package/dist/definitions/helpers/async-debounce/index.d.mts.map +18 -1
  61. package/dist/definitions/helpers/check-router-prop-misuse/index.d.mts.map +4 -1
  62. package/dist/definitions/helpers/defer-execution/index.d.mts.map +9 -1
  63. package/dist/definitions/helpers/downloadInBrowser/index.d.mts.map +2 -1
  64. package/dist/definitions/helpers/flatten-object-keys/index.d.mts.map +4 -1
  65. package/dist/definitions/helpers/generateDocumentTitle/index.d.mts.map +7 -1
  66. package/dist/definitions/helpers/handleMultiple/index.d.mts.map +6 -1
  67. package/dist/definitions/helpers/handlePaginationParams/index.d.mts.map +9 -1
  68. package/dist/definitions/helpers/handleRefineOptions/index.d.mts.map +26 -1
  69. package/dist/definitions/helpers/handleUseParams/index.d.mts.map +2 -1
  70. package/dist/definitions/helpers/hasPermission/index.d.mts.map +2 -1
  71. package/dist/definitions/helpers/humanizeString/index.d.mts.map +2 -1
  72. package/dist/definitions/helpers/importCSVMapper/index.d.mts.map +3 -1
  73. package/dist/definitions/helpers/index.d.mts.map +34 -1
  74. package/dist/definitions/helpers/keys/index.d.mts.map +64 -1
  75. package/dist/definitions/helpers/legacy-resource-transform/index.d.mts.map +9 -1
  76. package/dist/definitions/helpers/menu/create-resource-key.d.mts.map +3 -1
  77. package/dist/definitions/helpers/menu/create-tree.d.mts.map +13 -1
  78. package/dist/definitions/helpers/pick-resource/index.d.mts.map +8 -1
  79. package/dist/definitions/helpers/pickDataProvider/index.d.mts.map +6 -1
  80. package/dist/definitions/helpers/pickNotDeprecated/index.d.mts.map +2 -1
  81. package/dist/definitions/helpers/prepare-query-context/index.d.mts.map +3 -1
  82. package/dist/definitions/helpers/property-path-to-array/index.d.mts.map +2 -1
  83. package/dist/definitions/helpers/queryKeys/index.d.mts.map +7 -1
  84. package/dist/definitions/helpers/redirectPage/index.d.mts.map +11 -1
  85. package/dist/definitions/helpers/routeGenerator/index.d.mts.map +7 -1
  86. package/dist/definitions/helpers/router/check-by-segments.d.mts.map +9 -1
  87. package/dist/definitions/helpers/router/compose-route.d.mts.map +11 -1
  88. package/dist/definitions/helpers/router/get-action-routes-from-resource.d.mts.map +16 -1
  89. package/dist/definitions/helpers/router/get-default-action-path.d.mts.map +8 -1
  90. package/dist/definitions/helpers/router/get-parent-prefix-for-resource.d.mts.map +7 -1
  91. package/dist/definitions/helpers/router/get-parent-resource.d.mts.map +7 -1
  92. package/dist/definitions/helpers/router/index.d.mts.map +10 -1
  93. package/dist/definitions/helpers/router/is-parameter.d.mts.map +5 -1
  94. package/dist/definitions/helpers/router/is-segment-counts-same.d.mts.map +5 -1
  95. package/dist/definitions/helpers/router/match-resource-from-route.d.mts.map +15 -1
  96. package/dist/definitions/helpers/router/pick-matched-route.d.mts.map +8 -1
  97. package/dist/definitions/helpers/router/pick-route-params.d.mts.map +6 -1
  98. package/dist/definitions/helpers/router/prepare-route-params.d.mts.map +8 -1
  99. package/dist/definitions/helpers/router/remove-leading-trailing-slashes.d.mts.map +5 -1
  100. package/dist/definitions/helpers/router/split-to-segments.d.mts.map +5 -1
  101. package/dist/definitions/helpers/safe-translate/index.d.mts.map +3 -1
  102. package/dist/definitions/helpers/sanitize-resource/index.d.mts.map +8 -1
  103. package/dist/definitions/helpers/sequentialPromises/index.d.mts.map +5 -1
  104. package/dist/definitions/helpers/treeView/createTreeView/index.d.mts.map +6 -1
  105. package/dist/definitions/helpers/treeView/index.d.mts.map +2 -1
  106. package/dist/definitions/helpers/useActiveAuthProvider/index.d.cts +7 -7
  107. package/dist/definitions/helpers/useActiveAuthProvider/index.d.mts +7 -7
  108. package/dist/definitions/helpers/useActiveAuthProvider/index.d.mts.map +34 -1
  109. package/dist/definitions/helpers/useActiveAuthProvider/index.d.ts +7 -7
  110. package/dist/definitions/helpers/useInfinitePagination/index.d.mts.map +4 -1
  111. package/dist/definitions/helpers/useMediaQuery/index.d.mts.map +2 -1
  112. package/dist/definitions/helpers/useUserFriendlyName/index.d.mts.map +6 -1
  113. package/dist/definitions/helpers/userFriendlyResourceName/index.d.mts.map +7 -1
  114. package/dist/definitions/helpers/userFriendlySeconds/index.d.mts.map +2 -1
  115. package/dist/definitions/index.d.mts.map +4 -1
  116. package/dist/definitions/table/index.d.mts.map +34 -1
  117. package/dist/definitions/upload/file2Base64/index.d.mts.map +2 -1
  118. package/dist/definitions/upload/index.d.mts.map +2 -1
  119. package/dist/hooks/accessControl/index.d.mts.map +3 -1
  120. package/dist/hooks/accessControl/useCan/index.d.mts.map +18 -1
  121. package/dist/hooks/accessControl/useCanWithoutCache.d.mts.map +3 -1
  122. package/dist/hooks/auditLog/index.d.mts.map +3 -1
  123. package/dist/hooks/auditLog/useLog/index.d.mts.map +27 -1
  124. package/dist/hooks/auditLog/useLogList/index.d.mts.map +22 -1
  125. package/dist/hooks/auth/index.d.mts.map +11 -1
  126. package/dist/hooks/auth/useForgotPassword/index.d.mts.map +22 -1
  127. package/dist/hooks/auth/useGetIdentity/index.d.mts.map +21 -1
  128. package/dist/hooks/auth/useInvalidateAuthStore/index.d.mts.map +2 -1
  129. package/dist/hooks/auth/useIsAuthenticated/index.d.mts.map +25 -1
  130. package/dist/hooks/auth/useIsExistAuthentication/index.d.mts.map +6 -1
  131. package/dist/hooks/auth/useLogin/index.d.mts.map +22 -1
  132. package/dist/hooks/auth/useLogout/index.d.mts.map +26 -1
  133. package/dist/hooks/auth/useOnError/index.d.mts.map +22 -1
  134. package/dist/hooks/auth/usePermissions/index.d.mts.map +24 -1
  135. package/dist/hooks/auth/useRegister/index.d.mts.map +22 -1
  136. package/dist/hooks/auth/useUpdatePassword/index.d.mts.map +23 -1
  137. package/dist/hooks/breadcrumb/index.d.mts.map +18 -1
  138. package/dist/hooks/button/actionable-button/index.d.mts.map +8 -1
  139. package/dist/hooks/button/button-can-access/index.d.mts.map +22 -1
  140. package/dist/hooks/button/delete-button/index.d.mts.map +28 -1
  141. package/dist/hooks/button/index.d.mts.map +13 -1
  142. package/dist/hooks/button/navigation-button/index.d.mts.map +28 -1
  143. package/dist/hooks/button/refresh-button/index.d.mts.map +14 -1
  144. package/dist/hooks/data/index.d.cts +12 -12
  145. package/dist/hooks/data/index.d.cts.map +1 -1
  146. package/dist/hooks/data/index.d.mts +12 -12
  147. package/dist/hooks/data/index.d.mts.map +15 -1
  148. package/dist/hooks/data/index.d.ts +12 -12
  149. package/dist/hooks/data/index.d.ts.map +1 -1
  150. package/dist/hooks/data/useApiUrl.d.mts.map +2 -1
  151. package/dist/hooks/data/useCreate.d.mts.map +49 -1
  152. package/dist/hooks/data/useCreateMany.d.mts.map +31 -1
  153. package/dist/hooks/data/useCustom.d.mts.map +63 -1
  154. package/dist/hooks/data/useCustomMutation.d.mts.map +42 -1
  155. package/dist/hooks/data/useDataProvider.d.mts.map +7 -1
  156. package/dist/hooks/data/useDelete.d.mts.map +65 -1
  157. package/dist/hooks/data/useDeleteMany.d.mts.map +65 -1
  158. package/dist/hooks/data/useInfiniteList.d.mts.map +74 -1
  159. package/dist/hooks/data/useList.d.mts.map +73 -1
  160. package/dist/hooks/data/useMany.d.mts.map +48 -1
  161. package/dist/hooks/data/useOne.d.mts.map +50 -1
  162. package/dist/hooks/data/useUpdate.d.mts.map +83 -1
  163. package/dist/hooks/data/useUpdateMany.d.cts +1 -1
  164. package/dist/hooks/data/useUpdateMany.d.cts.map +1 -1
  165. package/dist/hooks/data/useUpdateMany.d.mts +1 -1
  166. package/dist/hooks/data/useUpdateMany.d.mts.map +84 -1
  167. package/dist/hooks/data/useUpdateMany.d.ts +1 -1
  168. package/dist/hooks/data/useUpdateMany.d.ts.map +1 -1
  169. package/dist/hooks/deepMemo/index.d.mts.map +7 -1
  170. package/dist/hooks/export/index.d.mts.map +99 -1
  171. package/dist/hooks/export/types.d.mts.map +21 -1
  172. package/dist/hooks/form/index.d.mts.map +18 -1
  173. package/dist/hooks/form/types.d.mts.map +146 -1
  174. package/dist/hooks/i18n/index.d.mts.map +5 -1
  175. package/dist/hooks/i18n/useGetLocale.d.mts.map +9 -1
  176. package/dist/hooks/i18n/useSetLocale.d.mts.map +8 -1
  177. package/dist/hooks/i18n/useTranslate.d.mts.map +11 -1
  178. package/dist/hooks/i18n/useTranslation.d.mts.map +18 -1
  179. package/dist/hooks/import/index.d.mts.map +101 -1
  180. package/dist/hooks/index.d.mts.map +31 -1
  181. package/dist/hooks/invalidate/index.d.mts.map +12 -1
  182. package/dist/hooks/legacy-router/index.d.mts.map +2 -1
  183. package/dist/hooks/legacy-router/useRouterContext.d.mts.map +10 -1
  184. package/dist/hooks/live/index.d.mts.map +5 -1
  185. package/dist/hooks/live/useLiveMode/index.d.mts.map +3 -1
  186. package/dist/hooks/live/usePublish/index.d.mts.map +3 -1
  187. package/dist/hooks/live/useResourceSubscription/index.d.mts.map +43 -1
  188. package/dist/hooks/live/useSubscription/index.d.mts.map +57 -1
  189. package/dist/hooks/memoized/index.d.mts.map +6 -1
  190. package/dist/hooks/menu/index.d.mts.map +2 -1
  191. package/dist/hooks/menu/useMenu.d.mts.map +28 -1
  192. package/dist/hooks/modal/index.d.mts.map +2 -1
  193. package/dist/hooks/modal/useModal/index.d.mts.map +13 -1
  194. package/dist/hooks/navigation/index.d.mts.map +28 -1
  195. package/dist/hooks/notification/index.d.mts.map +4 -1
  196. package/dist/hooks/notification/useCancelNotification/index.d.mts.map +8 -1
  197. package/dist/hooks/notification/useHandleNotification/index.d.mts.map +3 -1
  198. package/dist/hooks/notification/useNotification/index.d.mts.map +3 -1
  199. package/dist/hooks/redirection/index.d.mts.map +11 -1
  200. package/dist/hooks/refine/index.d.mts.map +6 -1
  201. package/dist/hooks/refine/useMutationMode.d.mts.map +16 -1
  202. package/dist/hooks/refine/useRefineContext.d.cts +1 -1
  203. package/dist/hooks/refine/useRefineContext.d.mts +1 -1
  204. package/dist/hooks/refine/useRefineContext.d.mts.map +20 -1
  205. package/dist/hooks/refine/useRefineContext.d.ts +1 -1
  206. package/dist/hooks/refine/useSyncWithLocation.d.mts.map +13 -1
  207. package/dist/hooks/refine/useTitle.d.mts.map +10 -1
  208. package/dist/hooks/refine/useWarnAboutChange/index.d.mts.map +16 -1
  209. package/dist/hooks/resource/index.d.mts.map +3 -1
  210. package/dist/hooks/resource/useResource/index.d.mts.map +63 -1
  211. package/dist/hooks/resource/useResourceWithRoute/index.d.mts.map +8 -1
  212. package/dist/hooks/router/index.d.mts.map +8 -1
  213. package/dist/hooks/router/use-back/index.d.mts.map +2 -1
  214. package/dist/hooks/router/use-get-to-path/index.d.mts.map +19 -1
  215. package/dist/hooks/router/use-go/index.d.mts.map +33 -1
  216. package/dist/hooks/router/use-link/index.d.mts.map +6 -1
  217. package/dist/hooks/router/use-parse/index.d.mts.map +5 -1
  218. package/dist/hooks/router/use-parsed/index.d.mts.map +2 -1
  219. package/dist/hooks/router/use-router-misuse-warning/index.d.mts.map +3 -1
  220. package/dist/hooks/router/use-to-path/index.d.mts.map +18 -1
  221. package/dist/hooks/show/index.d.mts.map +17 -1
  222. package/dist/hooks/show/types.d.mts.map +52 -1
  223. package/dist/hooks/show/useShow.d.mts.map +57 -1
  224. package/dist/hooks/use-refine-options/index.d.mts.map +2 -1
  225. package/dist/hooks/use-resource-params/index.d.mts.map +43 -1
  226. package/dist/hooks/use-resource-params/use-action/index.d.mts.map +12 -1
  227. package/dist/hooks/use-resource-params/use-id/index.d.mts.map +12 -1
  228. package/dist/hooks/useKeys/index.d.mts.map +5 -1
  229. package/dist/hooks/useLoadingOvertime/index.d.mts.map +49 -1
  230. package/dist/hooks/useMeta/index.d.mts.map +19 -1
  231. package/dist/hooks/useSelect/index.d.cts +6 -0
  232. package/dist/hooks/useSelect/index.d.cts.map +1 -1
  233. package/dist/hooks/useSelect/index.d.mts +6 -0
  234. package/dist/hooks/useSelect/index.d.mts.map +137 -1
  235. package/dist/hooks/useSelect/index.d.ts +6 -0
  236. package/dist/hooks/useSelect/index.d.ts.map +1 -1
  237. package/dist/hooks/useTable/index.d.mts.map +167 -1
  238. package/dist/hooks/useTelemetryData/index.d.mts.map +3 -1
  239. package/dist/index.cjs +18 -18
  240. package/dist/index.cjs.map +1 -1
  241. package/dist/index.d.cts +8 -7
  242. package/dist/index.d.cts.map +1 -1
  243. package/dist/index.d.mts +8 -7
  244. package/dist/index.d.mts.map +25 -1
  245. package/dist/index.d.ts +8 -7
  246. package/dist/index.d.ts.map +1 -1
  247. package/dist/index.mjs +18 -18
  248. package/dist/index.mjs.map +1 -1
  249. package/package.json +12 -13
  250. package/src/components/autoSaveIndicator/index.tsx +21 -7
  251. package/src/hooks/data/index.ts +28 -12
  252. package/src/hooks/data/useUpdateMany.ts +1 -1
  253. package/src/hooks/useSelect/index.ts +15 -1
  254. package/src/index.tsx +39 -0
@@ -1 +1,42 @@
1
- {"version":3,"file":"useCustomMutation.d.ts","sourceRoot":"","sources":["../../../src/hooks/data/useCustomMutation.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAEvB,MAAM,uBAAuB,CAAC;AAY/B,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,SAAS,EACT,SAAS,EACT,QAAQ,EACT,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,EACL,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EAElC,MAAM,uBAAuB,CAAC;AAE/B,UAAU,uBAAuB;IAC/B,OAAO,CAAC,EAAE,EAAE,CAAC;CACd;AAED,KAAK,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,IAAI;IACxD,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC5C,MAAM,EAAE,UAAU,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,uBAAuB,CAAC;CAClC,GAAG,wBAAwB,CAC1B,cAAc,CAAC,KAAK,CAAC,EACrB,MAAM,EACN,QAAQ,CAAC,uBAAuB,GAAG,SAAS,CAAC,CAC9C,CAAC;AAEF,MAAM,MAAM,2BAA2B,CACrC,KAAK,SAAS,UAAU,GAAG,UAAU,EACrC,MAAM,SAAS,SAAS,GAAG,SAAS,EACpC,UAAU,GAAG,EAAE,IACb,iBAAiB,CACnB,cAAc,CAAC,KAAK,CAAC,EACrB,MAAM,EACN,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAClD,OAAO,CACR,CAAC;AAEF,MAAM,MAAM,sBAAsB,CAChC,KAAK,SAAS,UAAU,GAAG,UAAU,EACrC,MAAM,SAAS,SAAS,GAAG,SAAS,EACpC,UAAU,GAAG,EAAE,IACb;IACF,eAAe,CAAC,EAAE,IAAI,CACpB,kBAAkB,CAChB,cAAc,CAAC,KAAK,CAAC,EACrB,MAAM,EACN,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAClD,OAAO,CACR,EACD,YAAY,GAAG,SAAS,GAAG,WAAW,CACvC,CAAC;CACH,GAAG,8BAA8B,CAAC;AAEnC;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,iBAAiB,yIAO3B,uBACD,KAAK,EACL,MAAM,EACN,UAAU,CACX,KAAQ,4BAA4B,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,GAC7D,4BAmHD,CAAC"}
1
+ import { type UseMutationOptions, type UseMutationResult } from "@tanstack/react-query";
2
+ import type { BaseRecord, CreateResponse, HttpError, MetaQuery, Prettify } from "../../contexts/data/types";
3
+ import type { SuccessErrorNotification } from "../../contexts/notification/types";
4
+ import { type UseLoadingOvertimeOptionsProps, type UseLoadingOvertimeReturnType } from "../useLoadingOvertime";
5
+ interface UseCustomMutationConfig {
6
+ headers?: {};
7
+ }
8
+ type useCustomMutationParams<TData, TError, TVariables> = {
9
+ url: string;
10
+ method: "post" | "put" | "patch" | "delete";
11
+ values: TVariables;
12
+ /**
13
+ * Meta data for `dataProvider`
14
+ */
15
+ meta?: MetaQuery;
16
+ /**
17
+ * Meta data for `dataProvider`
18
+ * @deprecated `metaData` is deprecated with refine@4, refine will pass `meta` instead, however, we still support `metaData` for backward compatibility.
19
+ */
20
+ metaData?: MetaQuery;
21
+ dataProviderName?: string;
22
+ config?: UseCustomMutationConfig;
23
+ } & SuccessErrorNotification<CreateResponse<TData>, TError, Prettify<UseCustomMutationConfig & MetaQuery>>;
24
+ export type UseCustomMutationReturnType<TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}> = UseMutationResult<CreateResponse<TData>, TError, useCustomMutationParams<TData, TError, TVariables>, unknown>;
25
+ export type UseCustomMutationProps<TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}> = {
26
+ mutationOptions?: Omit<UseMutationOptions<CreateResponse<TData>, TError, useCustomMutationParams<TData, TError, TVariables>, unknown>, "mutationFn" | "onError" | "onSuccess">;
27
+ } & UseLoadingOvertimeOptionsProps;
28
+ /**
29
+ * `useCustomMutation` is a modified version of `react-query`'s {@link https://react-query.tanstack.com/reference/useMutation `useMutation`} for create mutations.
30
+ *
31
+ * It uses the `custom` method from the `dataProvider` which is passed to `<Refine>`.
32
+ *
33
+ * @see {@link https://refine.dev/docs/api-reference/core/hooks/data/useCustomMutation} for more details.
34
+ *
35
+ * @typeParam TData - Result data of the query extends {@link https://refine.dev/docs/api-reference/core/interfaceReferences#baserecord `BaseRecord`}
36
+ * @typeParam TError - Custom error object that extends {@link https://refine.dev/docs/api-reference/core/interfaceReferences/#httperror `HttpError`}
37
+ * @typeParam TVariables - Values for mutation function
38
+ *
39
+ */
40
+ export declare const useCustomMutation: <TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}>({ mutationOptions, overtimeOptions, }?: UseCustomMutationProps<TData, TError, TVariables>) => UseCustomMutationReturnType<TData, TError, TVariables> & UseLoadingOvertimeReturnType;
41
+ export {};
42
+ //# sourceMappingURL=useCustomMutation.d.ts.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"useDataProvider.d.ts","sourceRoot":"","sources":["../../../src/hooks/data/useDataProvider.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,2BAA2B,CAAC;AAC5E,eAAO,MAAM,eAAe,QAAO,CAAC;AAClC;;GAEG;AACH,gBAAgB,CAAC,EAAE,MAAM,KACtB,YAAY,CAgChB,CAAC"}
1
+ import { type DataProvider } from "../../contexts/data/types";
2
+ export declare const useDataProvider: () => ((
3
+ /**
4
+ * The name of the `data provider` you want to access
5
+ */
6
+ dataProviderName?: string) => DataProvider);
7
+ //# sourceMappingURL=useDataProvider.d.ts.map
@@ -1 +1,65 @@
1
- {"version":3,"file":"useDelete.d.ts","sourceRoot":"","sources":["../../../src/hooks/data/useDelete.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAGvB,MAAM,uBAAuB,CAAC;AAwB/B,OAAO,KAAK,EACV,OAAO,EACP,UAAU,EACV,iBAAiB,EAEjB,SAAS,EACT,UAAU,EACV,SAAS,EACT,YAAY,EACZ,WAAW,IAAI,aAAa,EAE7B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAElF,OAAO,EACL,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EAElC,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,IAAI;IACpD;;OAEG;IACH,EAAE,EAAE,OAAO,CAAC;IACZ;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IAChD;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,UAAU,CAAC,CAAC;IACtC;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB,GAAG,wBAAwB,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAExE,MAAM,MAAM,mBAAmB,CAC7B,KAAK,SAAS,UAAU,GAAG,UAAU,EACrC,MAAM,GAAG,SAAS,EAClB,UAAU,GAAG,EAAE,IACb,iBAAiB,CACnB,iBAAiB,CAAC,KAAK,CAAC,EACxB,MAAM,EACN,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EACvC,aAAa,CAAC,KAAK,CAAC,CACrB,GACC,4BAA4B,CAAC;AAE/B,MAAM,MAAM,cAAc,CACxB,KAAK,SAAS,UAAU,GAAG,UAAU,EACrC,MAAM,SAAS,SAAS,GAAG,SAAS,EACpC,UAAU,GAAG,EAAE,IACb;IACF,eAAe,CAAC,EAAE,IAAI,CACpB,kBAAkB,CAChB,iBAAiB,CAAC,KAAK,CAAC,EACxB,MAAM,EACN,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EACvC,aAAa,CAAC,KAAK,CAAC,CACrB,EACD,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,WAAW,GAAG,UAAU,CAClE,CAAC;CACH,GAAG,8BAA8B,CAAC;AAEnC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,SAAS,yIAOnB,eAAe,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,KAAQ,oBAClD,KAAK,EACL,MAAM,EACN,UAAU,CAqWX,CAAC"}
1
+ import { type UseMutationOptions, type UseMutationResult } from "@tanstack/react-query";
2
+ import type { BaseKey, BaseRecord, DeleteOneResponse, HttpError, IQueryKeys, MetaQuery, MutationMode, PrevContext as DeleteContext } from "../../contexts/data/types";
3
+ import type { SuccessErrorNotification } from "../../contexts/notification/types";
4
+ import { type UseLoadingOvertimeOptionsProps, type UseLoadingOvertimeReturnType } from "../useLoadingOvertime";
5
+ export type DeleteParams<TData, TError, TVariables> = {
6
+ /**
7
+ * id for mutation function
8
+ */
9
+ id: BaseKey;
10
+ /**
11
+ * Resource name for API data interactions
12
+ */
13
+ resource: string;
14
+ /**
15
+ * [Determines when mutations are executed](/advanced-tutorials/mutation-mode.md)
16
+ */
17
+ mutationMode?: MutationMode;
18
+ /**
19
+ * Duration in ms to wait before executing the mutation when `mutationMode = "undoable"`
20
+ */
21
+ undoableTimeout?: number;
22
+ /**
23
+ * Provides a function to cancel the mutation when `mutationMode = "undoable"`
24
+ */
25
+ onCancel?: (cancelMutation: () => void) => void;
26
+ /**
27
+ * Metadata query for dataProvider
28
+ */
29
+ meta?: MetaQuery;
30
+ /**
31
+ * @deprecated `metaData` is deprecated with refine@4, refine will pass `meta` instead, however, we still support `metaData` for backward compatibility.
32
+ */
33
+ metaData?: MetaQuery;
34
+ /**
35
+ * If there is more than one `dataProvider`, you should use the `dataProviderName` that you will use.
36
+ * @default "default"
37
+ */
38
+ dataProviderName?: string;
39
+ /**
40
+ * You can use it to manage the invalidations that will occur at the end of the mutation.
41
+ */
42
+ invalidates?: Array<keyof IQueryKeys>;
43
+ /**
44
+ * Values for mutation function
45
+ */
46
+ values?: TVariables;
47
+ } & SuccessErrorNotification<DeleteOneResponse<TData>, TError, BaseKey>;
48
+ export type UseDeleteReturnType<TData extends BaseRecord = BaseRecord, TError = HttpError, TVariables = {}> = UseMutationResult<DeleteOneResponse<TData>, TError, DeleteParams<TData, TError, TVariables>, DeleteContext<TData>> & UseLoadingOvertimeReturnType;
49
+ export type UseDeleteProps<TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}> = {
50
+ mutationOptions?: Omit<UseMutationOptions<DeleteOneResponse<TData>, TError, DeleteParams<TData, TError, TVariables>, DeleteContext<TData>>, "mutationFn" | "onError" | "onSuccess" | "onSettled" | "onMutate">;
51
+ } & UseLoadingOvertimeOptionsProps;
52
+ /**
53
+ * `useDelete` is a modified version of `react-query`'s {@link https://react-query.tanstack.com/reference/useMutation `useMutation`} for delete mutations.
54
+ *
55
+ * It uses `deleteOne` method as mutation function from the `dataProvider` which is passed to `<Refine>`.
56
+ *
57
+ * @see {@link https://refine.dev/docs/api-reference/core/hooks/data/useDelete} for more details.
58
+ *
59
+ * @typeParam TData - Result data of the query extends {@link https://refine.dev/docs/api-reference/core/interfaceReferences#baserecord `BaseRecord`}
60
+ * @typeParam TError - Custom error object that extends {@link https://refine.dev/docs/api-reference/core/interfaceReferences/#httperror `HttpError`}
61
+ * @typeParam TVariables - Values for params. default `{}`
62
+ *
63
+ */
64
+ export declare const useDelete: <TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}>({ mutationOptions, overtimeOptions, }?: UseDeleteProps<TData, TError, TVariables>) => UseDeleteReturnType<TData, TError, TVariables>;
65
+ //# sourceMappingURL=useDelete.d.ts.map
@@ -1 +1,65 @@
1
- {"version":3,"file":"useDeleteMany.d.ts","sourceRoot":"","sources":["../../../src/hooks/data/useDeleteMany.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAGvB,MAAM,uBAAuB,CAAC;AAyB/B,OAAO,KAAK,EACV,OAAO,EACP,UAAU,EACV,kBAAkB,EAElB,SAAS,EACT,UAAU,EACV,SAAS,EACT,YAAY,EACZ,WAAW,IAAI,aAAa,EAE7B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAElF,OAAO,EACL,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EAElC,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,IAAI;IACxD;;OAEG;IACH,GAAG,EAAE,OAAO,EAAE,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;I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,eAAO,MAAM,aAAa,yIAOvB,mBAAmB,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,KAAQ,wBACtD,KAAK,EACL,MAAM,EACN,UAAU,CAmYX,CAAC"}
1
+ import { type UseMutationOptions, type UseMutationResult } from "@tanstack/react-query";
2
+ import type { BaseKey, BaseRecord, DeleteManyResponse, HttpError, IQueryKeys, MetaQuery, MutationMode, PrevContext as DeleteContext } from "../../contexts/data/types";
3
+ import type { SuccessErrorNotification } from "../../contexts/notification/types";
4
+ import { type UseLoadingOvertimeOptionsProps, type UseLoadingOvertimeReturnType } from "../useLoadingOvertime";
5
+ export type DeleteManyParams<TData, TError, TVariables> = {
6
+ /**
7
+ * ids for mutation function
8
+ */
9
+ ids: BaseKey[];
10
+ /**
11
+ * Resource name for API data interactions
12
+ */
13
+ resource: string;
14
+ /**
15
+ * [Determines when mutations are executed](/advanced-tutorials/mutation-mode.md)
16
+ */
17
+ mutationMode?: MutationMode;
18
+ /**
19
+ * Duration in ms to wait before executing the mutation when `mutationMode = "undoable"`
20
+ */
21
+ undoableTimeout?: number;
22
+ /**
23
+ * Provides a function to cancel the mutation when `mutationMode = "undoable"`
24
+ */
25
+ onCancel?: (cancelMutation: () => void) => void;
26
+ /**
27
+ * Metadata query for dataProvider
28
+ */
29
+ meta?: MetaQuery;
30
+ /**
31
+ * @deprecated `metaData` is deprecated with refine@4, refine will pass `meta` instead, however, we still support `metaData` for backward compatibility.
32
+ */
33
+ metaData?: MetaQuery;
34
+ /**
35
+ * If there is more than one `dataProvider`, you should use the `dataProviderName` that you will use.
36
+ * @default "default"
37
+ */
38
+ dataProviderName?: string;
39
+ /**
40
+ * You can use it to manage the invalidations that will occur at the end of the mutation.
41
+ */
42
+ invalidates?: Array<keyof IQueryKeys>;
43
+ /**
44
+ * Values for mutation function
45
+ */
46
+ values?: TVariables;
47
+ } & SuccessErrorNotification<DeleteManyResponse<TData>, TError, BaseKey[]>;
48
+ export type UseDeleteManyReturnType<TData extends BaseRecord = BaseRecord, TError = HttpError, TVariables = {}> = UseMutationResult<DeleteManyResponse<TData>, TError, DeleteManyParams<TData, TError, TVariables>, unknown> & UseLoadingOvertimeReturnType;
49
+ export type UseDeleteManyProps<TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}> = {
50
+ mutationOptions?: Omit<UseMutationOptions<DeleteManyResponse<TData>, TError, DeleteManyParams<TData, TError, TVariables>, DeleteContext<TData>>, "mutationFn" | "onError" | "onSuccess" | "onSettled" | "onMutate">;
51
+ } & UseLoadingOvertimeOptionsProps;
52
+ /**
53
+ * `useDeleteMany` is a modified version of `react-query`'s {@link https://react-query.tanstack.com/reference/useMutation `useMutation`} for multiple delete mutations.
54
+ *
55
+ * It uses `deleteMany` method as mutation function from the `dataProvider` which is passed to `<Refine>`.
56
+ *
57
+ * @see {@link https://refine.dev/docs/api-reference/core/hooks/data/useDeleteMany} for more details.
58
+ *
59
+ * @typeParam TData - Result data of the query extends {@link https://refine.dev/docs/core/interfaceReferences#baserecord `BaseRecord`}
60
+ * @typeParam TError - Custom error object that extends {@link https://refine.dev/docs/core/interfaceReferences#httperror `HttpError`}
61
+ * @typeParam TVariables - Values for params. default `{}`
62
+ *
63
+ */
64
+ export declare const useDeleteMany: <TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}>({ mutationOptions, overtimeOptions, }?: UseDeleteManyProps<TData, TError, TVariables>) => UseDeleteManyReturnType<TData, TError, TVariables>;
65
+ //# sourceMappingURL=useDeleteMany.d.ts.map
@@ -1 +1,74 @@
1
- {"version":3,"file":"useInfiniteList.d.ts","sourceRoot":"","sources":["../../../src/hooks/data/useInfiniteList.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,2BAA2B,EAChC,KAAK,uBAAuB,EAE7B,MAAM,uBAAuB,CAAC;AAsB/B,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,QAAQ,EACR,eAAe,EACf,SAAS,EACT,SAAS,EACT,U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qBAAqB,CAAC,CAChC,GACD,aAAa,GACb,8BAA8B,CAAC;AAEjC;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,eAAe,kWAqBzB,qBACD,YAAY,EACZ,MAAM,EACN,KAAK,CACN,KAAG,4BAA4B,gBAAgB,KAAK,CAAC,EAAE,MAAM,CAAC,GAC7D,4BA+KD,CAAC"}
1
+ import { type InfiniteData, type InfiniteQueryObserverResult, type UseInfiniteQueryOptions } from "@tanstack/react-query";
2
+ import type { BaseRecord, CrudFilter, CrudSort, GetListResponse, HttpError, MetaQuery, Pagination, Prettify } from "../../contexts/data/types";
3
+ import type { LiveModeProps } from "../../contexts/live/types";
4
+ import type { SuccessErrorNotification } from "../../contexts/notification/types";
5
+ import { type UseLoadingOvertimeOptionsProps, type UseLoadingOvertimeReturnType } from "../useLoadingOvertime";
6
+ export interface UseInfiniteListConfig {
7
+ pagination?: Pagination;
8
+ hasPagination?: boolean;
9
+ sort?: CrudSort[];
10
+ filters?: CrudFilter[];
11
+ }
12
+ type BaseInfiniteListProps = {
13
+ /**
14
+ * Metadata query for `dataProvider`
15
+ */
16
+ meta?: MetaQuery;
17
+ /**
18
+ * Metadata query for `dataProvider`
19
+ * @deprecated `metaData` is deprecated with refine@4, refine will pass `meta` instead, however, we still support `metaData` for backward compatibility.
20
+ */
21
+ metaData?: MetaQuery;
22
+ /**
23
+ * Configuration for pagination, sorting and filtering
24
+ * @type [`useInfiniteListConfig`](/docs/api-reference/core/hooks/data/useInfiniteList/#config-parameters)
25
+ * @deprecated `config` property is deprecated. Use `pagination`, `hasPagination`, `sorters` and `filters` instead.
26
+ */
27
+ config?: UseInfiniteListConfig;
28
+ /**
29
+ * Pagination properties
30
+ */
31
+ pagination?: Pagination;
32
+ /**
33
+ * Whether to use server-side pagination or not
34
+ * @deprecated `hasPagination` property is deprecated. Use `pagination.mode` instead.
35
+ */
36
+ hasPagination?: boolean;
37
+ /**
38
+ * Sorter parameters
39
+ */
40
+ sorters?: CrudSort[];
41
+ /**
42
+ * Filter parameters
43
+ */
44
+ filters?: CrudFilter[];
45
+ /**
46
+ * If there is more than one `dataProvider`, you should use the `dataProviderName` that you will use
47
+ */
48
+ dataProviderName?: string;
49
+ };
50
+ export type UseInfiniteListProps<TQueryFnData, TError, TData> = {
51
+ /**
52
+ * Resource name for API data interactions
53
+ */
54
+ resource: string;
55
+ /**
56
+ * Tanstack Query's [useInfiniteQuery](https://tanstack.com/query/v4/docs/react/reference/useInfiniteQuery) options
57
+ */
58
+ queryOptions?: UseInfiniteQueryOptions<GetListResponse<TQueryFnData>, TError, GetListResponse<TData>>;
59
+ } & BaseInfiniteListProps & SuccessErrorNotification<InfiniteData<GetListResponse<TData>>, TError, Prettify<BaseInfiniteListProps>> & LiveModeProps & UseLoadingOvertimeOptionsProps;
60
+ /**
61
+ * `useInfiniteList` is a modified version of `react-query`'s {@link https://tanstack.com/query/latest/docs/react/guides/infinite-queries `useInfiniteQuery`} used for retrieving items from a `resource` with pagination, sort, and filter configurations.
62
+ *
63
+ * It uses the `getList` method as the query function from the `dataProvider` which is passed to `<Refine>`.
64
+ *
65
+ * @see {@link https://refine.dev/docs/api-reference/core/hooks/data/useInfiniteList} for more details.
66
+ *
67
+ * @typeParam TQueryFnData - Result data returned by the query function. Extends {@link https://refine.dev/docs/api-reference/core/interfaceReferences#baserecord `BaseRecord`}
68
+ * @typeParam TError - Custom error object that extends {@link https://refine.dev/docs/api-reference/core/interfaceReferences#httperror `HttpError`}
69
+ * @typeParam TData - Result data returned by the `select` function. Extends {@link https://refine.dev/docs/api-reference/core/interfaceReferences#baserecord `BaseRecord`}. Defaults to `TQueryFnData`
70
+ *
71
+ */
72
+ export declare const useInfiniteList: <TQueryFnData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TData extends BaseRecord = TQueryFnData>({ resource: resourceFromProp, config, filters, hasPagination, pagination, sorters, queryOptions, successNotification, errorNotification, meta, metaData, liveMode, onLiveEvent, liveParams, dataProviderName, overtimeOptions, }: UseInfiniteListProps<TQueryFnData, TError, TData>) => InfiniteQueryObserverResult<GetListResponse<TData>, TError> & UseLoadingOvertimeReturnType;
73
+ export {};
74
+ //# sourceMappingURL=useInfiniteList.d.ts.map
@@ -1 +1,73 @@
1
- {"version":3,"file":"useList.d.ts","sourceRoot":"","sources":["../../../src/hooks/data/useList.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EAErB,MAAM,uBAAuB,CAAC;AAoB/B,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,QAAQ,EACR,eAAe,EACf,SAAS,EACT,SAAS,EACT,UAAU,EACV,QAAQ,EACT,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,EACL,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EAElC,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;CACxB;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;OAIG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,IAAI;IACtD;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,YAAY,CAAC,EAAE,eAAe,CAC5B,eAAe,CAAC,YAAY,CAAC,EAC7B,MAAM,EACN,eAAe,CAAC,KAAK,CAAC,CACvB,CAAC;CACH,GAAG,aAAa,GACf,wBAAwB,CACtB,eAAe,CAAC,KAAK,CAAC,EACtB,MAAM,EACN,QAAQ,CAAC,aAAa,CAAC,CACxB,GACD,aAAa,GACb,8BAA8B,CAAC;AAEjC;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,OAAO,mWAqBjB,aAAa,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,KAAQ,oBAClD,gBAAgB,KAAK,CAAC,EACtB,MAAM,CACP,GACC,4BAwLD,CAAC"}
1
+ import { type QueryObserverResult, type UseQueryOptions } from "@tanstack/react-query";
2
+ import type { BaseRecord, CrudFilter, CrudSort, GetListResponse, HttpError, MetaQuery, Pagination, Prettify } from "../../contexts/data/types";
3
+ import type { LiveModeProps } from "../../contexts/live/types";
4
+ import type { SuccessErrorNotification } from "../../contexts/notification/types";
5
+ import { type UseLoadingOvertimeOptionsProps, type UseLoadingOvertimeReturnType } from "../useLoadingOvertime";
6
+ export interface UseListConfig {
7
+ pagination?: Pagination;
8
+ hasPagination?: boolean;
9
+ sort?: CrudSort[];
10
+ filters?: CrudFilter[];
11
+ }
12
+ export type BaseListProps = {
13
+ /**
14
+ * Configuration for pagination, sorting and filtering
15
+ * @type [`UseListConfig`](/docs/api-reference/core/hooks/data/useList/#config-parameters)
16
+ * @deprecated `config` property is deprecated. Use `pagination`, `hasPagination`, `sorters` and `filters` instead.
17
+ */
18
+ config?: UseListConfig;
19
+ /**
20
+ * Pagination properties
21
+ */
22
+ pagination?: Pagination;
23
+ /**
24
+ * Whether to use server-side pagination or not
25
+ * @deprecated `hasPagination` property is deprecated. Use `pagination.mode` instead.
26
+ */
27
+ hasPagination?: boolean;
28
+ /**
29
+ * Sorter parameters
30
+ */
31
+ sorters?: CrudSort[];
32
+ /**
33
+ * Filter parameters
34
+ */
35
+ filters?: CrudFilter[];
36
+ /**
37
+ * Meta data query for `dataProvider`
38
+ */
39
+ meta?: MetaQuery;
40
+ /**
41
+ * Meta data query for `dataProvider`
42
+ * @deprecated `metaData` is deprecated with refine@4, refine will pass `meta` instead, however, we still support `metaData` for backward compatibility.
43
+ */
44
+ metaData?: MetaQuery;
45
+ /**
46
+ * If there is more than one `dataProvider`, you should use the `dataProviderName` that you will use
47
+ */
48
+ dataProviderName?: string;
49
+ };
50
+ export type UseListProps<TQueryFnData, TError, TData> = {
51
+ /**
52
+ * Resource name for API data interactions
53
+ */
54
+ resource?: string;
55
+ /**
56
+ * Tanstack Query's [useQuery](https://tanstack.com/query/v4/docs/reference/useQuery) options
57
+ */
58
+ queryOptions?: UseQueryOptions<GetListResponse<TQueryFnData>, TError, GetListResponse<TData>>;
59
+ } & BaseListProps & SuccessErrorNotification<GetListResponse<TData>, TError, Prettify<BaseListProps>> & LiveModeProps & UseLoadingOvertimeOptionsProps;
60
+ /**
61
+ * `useList` is a modified version of `react-query`'s {@link https://react-query.tanstack.com/guides/queries `useQuery`} used for retrieving items from a `resource` with pagination, sort, and filter configurations.
62
+ *
63
+ * It uses the `getList` method as the query function from the `dataProvider` which is passed to `<Refine>`.
64
+ *
65
+ * @see {@link https://refine.dev/docs/api-reference/core/hooks/data/useList} for more details.
66
+ *
67
+ * @typeParam TQueryFnData - Result data returned by the query function. Extends {@link https://refine.dev/docs/api-reference/core/interfaceReferences#baserecord `BaseRecord`}
68
+ * @typeParam TError - Custom error object that extends {@link https://refine.dev/docs/api-reference/core/interfaceReferences#httperror `HttpError`}
69
+ * @typeParam TData - Result data returned by the `select` function. Extends {@link https://refine.dev/docs/api-reference/core/interfaceReferences#baserecord `BaseRecord`}. Defaults to `TQueryFnData`
70
+ *
71
+ */
72
+ export declare const useList: <TQueryFnData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TData extends BaseRecord = TQueryFnData>({ resource: resourceFromProp, config, filters, hasPagination, pagination, sorters, queryOptions, successNotification, errorNotification, meta, metaData, liveMode, onLiveEvent, liveParams, dataProviderName, overtimeOptions, }?: UseListProps<TQueryFnData, TError, TData>) => QueryObserverResult<GetListResponse<TData>, TError> & UseLoadingOvertimeReturnType;
73
+ //# sourceMappingURL=useList.d.ts.map
@@ -1 +1,48 @@
1
- {"version":3,"file":"useMany.d.ts","sourceRoot":"","sources":["../../../src/hooks/data/useMany.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EAErB,MAAM,uBAAuB,CAAC;AAoB/B,OAAO,KAAK,EACV,OAAO,EACP,UAAU,EACV,eAAe,EACf,SAAS,EACT,SAAS,EACV,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,EACL,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EAElC,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,IAAI;IACtD;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,GAAG,EAAE,OAAO,EAAE,CAAC;IACf;;OAEG;IACH,YAAY,CAAC,EAAE,eAAe,CAC5B,eAAe,CAAC,YAAY,CAAC,EAC7B,MAAM,EACN,eAAe,CAAC,KAAK,CAAC,CACvB,CAAC;IACF;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,GAAG,wBAAwB,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GACrE,aAAa,GACb,8BAA8B,CAAC;AAEjC;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,OAAO,kTAiBjB,aAAa,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,KAAG,oBAC7C,gBAAgB,KAAK,CAAC,EACtB,MAAM,CACP,GACC,4BAiID,CAAC"}
1
+ import { type QueryObserverResult, type UseQueryOptions } from "@tanstack/react-query";
2
+ import type { BaseKey, BaseRecord, GetManyResponse, HttpError, MetaQuery } from "../../contexts/data/types";
3
+ import type { LiveModeProps } from "../../contexts/live/types";
4
+ import type { SuccessErrorNotification } from "../../contexts/notification/types";
5
+ import { type UseLoadingOvertimeOptionsProps, type UseLoadingOvertimeReturnType } from "../useLoadingOvertime";
6
+ export type UseManyProps<TQueryFnData, TError, TData> = {
7
+ /**
8
+ * Resource name for API data interactions
9
+ */
10
+ resource: string;
11
+ /**
12
+ * ids of the item in the resource
13
+ * @type [`BaseKey[]`](/docs/api-reference/core/interfaceReferences/#basekey)
14
+ */
15
+ ids: BaseKey[];
16
+ /**
17
+ * react-query's [useQuery](https://tanstack.com/query/v4/docs/reference/useQuery) options
18
+ */
19
+ queryOptions?: UseQueryOptions<GetManyResponse<TQueryFnData>, TError, GetManyResponse<TData>>;
20
+ /**
21
+ * Metadata query for `dataProvider`,
22
+ */
23
+ meta?: MetaQuery;
24
+ /**
25
+ * Metadata query for `dataProvider`,
26
+ * @deprecated `metaData` is deprecated with refine@4, refine will pass `meta` instead, however, we still support `metaData` for backward compatibility.
27
+ */
28
+ metaData?: MetaQuery;
29
+ /**
30
+ * If there is more than one `dataProvider`, you should use the `dataProviderName` that you will use.
31
+ * @default "default"
32
+ */
33
+ dataProviderName?: string;
34
+ } & SuccessErrorNotification<GetManyResponse<TData>, TError, BaseKey[]> & LiveModeProps & UseLoadingOvertimeOptionsProps;
35
+ /**
36
+ * `useMany` is a modified version of `react-query`'s {@link https://react-query.tanstack.com/guides/queries `useQuery`} used for retrieving multiple items from a `resource`.
37
+ *
38
+ * It uses `getMany` method as query function from the `dataProvider` which is passed to `<Refine>`.
39
+ *
40
+ * @see {@link https://refine.dev/docs/api-reference/core/hooks/data/useMany} for more details.
41
+ *
42
+ * @typeParam TQueryFnData - Result data returned by the query function. Extends {@link https://refine.dev/docs/api-reference/core/interfaceReferences#baserecord `BaseRecord`}
43
+ * @typeParam TError - Custom error object that extends {@link https://refine.dev/docs/api-reference/core/interfaceReferences#httperror `HttpError`}
44
+ * @typeParam TData - Result data returned by the `select` function. Extends {@link https://refine.dev/docs/api-reference/core/interfaceReferences#baserecord `BaseRecord`}. Defaults to `TQueryFnData`
45
+ *
46
+ */
47
+ export declare const useMany: <TQueryFnData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TData extends BaseRecord = TQueryFnData>({ resource: resourceFromProp, ids, queryOptions, successNotification, errorNotification, meta, metaData, liveMode, onLiveEvent, liveParams, dataProviderName, overtimeOptions, }: UseManyProps<TQueryFnData, TError, TData>) => QueryObserverResult<GetManyResponse<TData>, TError> & UseLoadingOvertimeReturnType;
48
+ //# sourceMappingURL=useMany.d.ts.map
@@ -1 +1,50 @@
1
- {"version":3,"file":"useOne.d.ts","sourceRoot":"","sources":["../../../src/hooks/data/useOne.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EAErB,MAAM,uBAAuB,CAAC;AAmB/B,OAAO,KAAK,EACV,OAAO,EACP,UAAU,EACV,cAAc,EACd,SAAS,EACT,SAAS,EACT,QAAQ,EACT,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,EACL,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EAElC,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,IAAI;IACrD;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,EAAE,CAAC,EAAE,OAAO,CAAC;IACb;;OAEG;IACH,YAAY,CAAC,EAAE,eAAe,CAC5B,cAAc,CAAC,YAAY,CAAC,EAC5B,MAAM,EACN,cAAc,CAAC,KAAK,CAAC,CACtB,CAAC;IACF;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,GAAG,wBAAwB,CAC1B,cAAc,CAAC,KAAK,CAAC,EACrB,MAAM,EACN,QAAQ,CAAC;IAAE,EAAE,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,CAAC,CACvC,GACC,aAAa,GACb,8BAA8B,CAAC;AAEjC;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,MAAM,iTAiBhB,YAAY,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,KAAG,oBAC5C,eAAe,KAAK,CAAC,EACrB,MAAM,CACP,GACC,4BA0ID,CAAC"}
1
+ import { type QueryObserverResult, type UseQueryOptions } from "@tanstack/react-query";
2
+ import type { BaseKey, BaseRecord, GetOneResponse, HttpError, MetaQuery, Prettify } from "../../contexts/data/types";
3
+ import type { LiveModeProps } from "../../contexts/live/types";
4
+ import type { SuccessErrorNotification } from "../../contexts/notification/types";
5
+ import { type UseLoadingOvertimeOptionsProps, type UseLoadingOvertimeReturnType } from "../useLoadingOvertime";
6
+ export type UseOneProps<TQueryFnData, TError, TData> = {
7
+ /**
8
+ * Resource name for API data interactions
9
+ */
10
+ resource?: string;
11
+ /**
12
+ * id of the item in the resource
13
+ * @type [`BaseKey`](/docs/api-reference/core/interfaceReferences/#basekey)
14
+ */
15
+ id?: BaseKey;
16
+ /**
17
+ * react-query's [useQuery](https://tanstack.com/query/v4/docs/reference/useQuery) options
18
+ */
19
+ queryOptions?: UseQueryOptions<GetOneResponse<TQueryFnData>, TError, GetOneResponse<TData>>;
20
+ /**
21
+ * Metadata query for `dataProvider`,
22
+ */
23
+ meta?: MetaQuery;
24
+ /**
25
+ * Meta data query for `dataProvider`,
26
+ * @deprecated `metaData` is deprecated with refine@4, refine will pass `meta` instead, however, we still support `metaData` for backward compatibility.
27
+ */
28
+ metaData?: MetaQuery;
29
+ /**
30
+ * If there is more than one `dataProvider`, you should use the `dataProviderName` that you will use.
31
+ * @default `"default"``
32
+ */
33
+ dataProviderName?: string;
34
+ } & SuccessErrorNotification<GetOneResponse<TData>, TError, Prettify<{
35
+ id?: BaseKey;
36
+ } & MetaQuery>> & LiveModeProps & UseLoadingOvertimeOptionsProps;
37
+ /**
38
+ * `useOne` is a modified version of `react-query`'s {@link https://react-query.tanstack.com/guides/queries `useQuery`} used for retrieving single items from a `resource`.
39
+ *
40
+ * It uses `getOne` method as query function from the `dataProvider` which is passed to `<Refine>`.
41
+ *
42
+ * @see {@link https://refine.dev/docs/api-reference/core/hooks/data/useOne} for more details.
43
+ *
44
+ * @typeParam TQueryFnData - Result data returned by the query function. Extends {@link https://refine.dev/docs/api-reference/core/interfaceReferences#baserecord `BaseRecord`}
45
+ * @typeParam TError - Custom error object that extends {@link https://refine.dev/docs/api-reference/core/interfaceReferences#httperror `HttpError`}
46
+ * @typeParam TData - Result data returned by the `select` function. Extends {@link https://refine.dev/docs/api-reference/core/interfaceReferences#baserecord `BaseRecord`}. Defaults to `TQueryFnData`
47
+ *
48
+ */
49
+ export declare const useOne: <TQueryFnData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TData extends BaseRecord = TQueryFnData>({ resource: resourceFromProp, id, queryOptions, successNotification, errorNotification, meta, metaData, liveMode, onLiveEvent, liveParams, dataProviderName, overtimeOptions, }: UseOneProps<TQueryFnData, TError, TData>) => QueryObserverResult<GetOneResponse<TData>, TError> & UseLoadingOvertimeReturnType;
50
+ //# sourceMappingURL=useOne.d.ts.map
@@ -1 +1,83 @@
1
- {"version":3,"file":"useUpdate.d.ts","sourceRoot":"","sources":["../../../src/hooks/data/useUpdate.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAGvB,MAAM,uBAAuB,CAAC;AAwB/B,OAAO,KAAK,EACV,OAAO,EACP,UAAU,EACV,eAAe,EACf,eAAe,EACf,cAAc,EACd,SAAS,EACT,UAAU,EACV,SAAS,EACT,YAAY,EACZ,WAAW,IAAI,aAAa,EAE5B,cAAc,EACf,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAElF,OAAO,EACL,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EAElC,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,uBAAuB,CAAC,KAAK,EAAE,UAAU,IAAI;IACvD,IAAI,CAAC,EACD,CAAC,CACC,QAAQ,EAAE,eAAe,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,SAAS,EACnD,MAAM,EAAE,UAAU,EAClB,EAAE,EAAE,OAAO,KACR,eAAe,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GACnC,OAAO,CAAC;IACZ,IAAI,CAAC,EACD,CAAC,CACC,QAAQ,EAAE,eAAe,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,SAAS,EACnD,MAAM,EAAE,UAAU,EAClB,EAAE,EAAE,OAAO,KACR,eAAe,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GACnC,OAAO,CAAC;IACZ,MAAM,CAAC,EACH,CAAC,CACC,QAAQ,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,SAAS,EAClD,MAAM,EAAE,UAAU,EAClB,EAAE,EAAE,OAAO,KACR,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GACl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S,GAAG,SAAS,EACpC,UAAU,GAAG,EAAE,IACb;IACF,eAAe,CAAC,EAAE,IAAI,CACpB,kBAAkB,CAChB,cAAc,CAAC,KAAK,CAAC,EACrB,MAAM,EACN,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EACvC,aAAa,CAAC,KAAK,CAAC,CACrB,EACD,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,WAAW,GAAG,UAAU,CAClE,CAAC;CACH,GAAG,8BAA8B,CAAC;AAEnC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,SAAS,yIAOnB,eAAe,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,KAAQ,oBAClD,KAAK,EACL,MAAM,EACN,UAAU,CAsaX,CAAC"}
1
+ import { type UseMutationOptions, type UseMutationResult } from "@tanstack/react-query";
2
+ import type { BaseKey, BaseRecord, GetListResponse, GetManyResponse, GetOneResponse, HttpError, IQueryKeys, MetaQuery, MutationMode, PrevContext as UpdateContext, UpdateResponse } from "../../contexts/data/types";
3
+ import type { SuccessErrorNotification } from "../../contexts/notification/types";
4
+ import { type UseLoadingOvertimeOptionsProps, type UseLoadingOvertimeReturnType } from "../useLoadingOvertime";
5
+ export type OptimisticUpdateMapType<TData, TVariables> = {
6
+ list?: ((previous: GetListResponse<TData> | null | undefined, values: TVariables, id: BaseKey) => GetListResponse<TData> | null) | boolean;
7
+ many?: ((previous: GetManyResponse<TData> | null | undefined, values: TVariables, id: BaseKey) => GetManyResponse<TData> | null) | boolean;
8
+ detail?: ((previous: GetOneResponse<TData> | null | undefined, values: TVariables, id: BaseKey) => GetOneResponse<TData> | null) | boolean;
9
+ };
10
+ export type UpdateParams<TData, TError, TVariables> = {
11
+ /**
12
+ * Resource name for API data interactions
13
+ */
14
+ resource: string;
15
+ /**
16
+ * id for mutation function
17
+ */
18
+ id: BaseKey;
19
+ /**
20
+ * [Determines when mutations are executed](/advanced-tutorials/mutation-mode.md)
21
+ */
22
+ mutationMode?: MutationMode;
23
+ /**
24
+ * Duration in ms to wait before executing the mutation when `mutationMode = "undoable"`
25
+ */
26
+ undoableTimeout?: number;
27
+ /**
28
+ * Provides a function to cancel the mutation when `mutationMode = "undoable"`
29
+ */
30
+ onCancel?: (cancelMutation: () => void) => void;
31
+ /**
32
+ * Values for mutation function
33
+ */
34
+ values: TVariables;
35
+ /**
36
+ * Metadata query for dataProvider
37
+ */
38
+ meta?: MetaQuery;
39
+ /**
40
+ * Metadata query for dataProvider
41
+ * @deprecated `metaData` is deprecated with refine@4, refine will pass `meta` instead, however, we still support `metaData` for backward compatibility.
42
+ */
43
+ metaData?: MetaQuery;
44
+ /**
45
+ * If there is more than one `dataProvider`, you should use the `dataProviderName` that you will use.
46
+ * @default "default"
47
+ */
48
+ dataProviderName?: string;
49
+ /**
50
+ * You can use it to manage the invalidations that will occur at the end of the mutation.
51
+ */
52
+ invalidates?: Array<keyof IQueryKeys>;
53
+ /**
54
+ * You can use it to customize the optimistic update logic.
55
+ * @default {
56
+ * list: true,
57
+ * many: true,
58
+ * detail: true,
59
+ * }
60
+ */
61
+ optimisticUpdateMap?: OptimisticUpdateMapType<TData, TVariables>;
62
+ } & SuccessErrorNotification<UpdateResponse<TData>, TError, {
63
+ id: BaseKey;
64
+ values: TVariables;
65
+ }>;
66
+ export type UseUpdateReturnType<TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}> = UseMutationResult<UpdateResponse<TData>, TError, UpdateParams<TData, TError, TVariables>, UpdateContext<TData>> & UseLoadingOvertimeReturnType;
67
+ export type UseUpdateProps<TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}> = {
68
+ mutationOptions?: Omit<UseMutationOptions<UpdateResponse<TData>, TError, UpdateParams<TData, TError, TVariables>, UpdateContext<TData>>, "mutationFn" | "onError" | "onSuccess" | "onSettled" | "onMutate">;
69
+ } & UseLoadingOvertimeOptionsProps;
70
+ /**
71
+ * `useUpdate` is a modified version of `react-query`'s {@link https://react-query.tanstack.com/reference/useMutation `useMutation`} for update mutations.
72
+ *
73
+ * It uses `update` method as mutation function from the `dataProvider` which is passed to `<Refine>`.
74
+ *
75
+ * @see {@link https://refine.dev/docs/api-reference/core/hooks/data/useUpdate} for more details.
76
+ *
77
+ * @typeParam TData - Result data of the query extends {@link https://refine.dev/docs/api-reference/core/interfaceReferences#baserecord `BaseRecord`}
78
+ * @typeParam TError - Custom error object that extends {@link https://refine.dev/docs/api-reference/core/interfaceReferences/#httperror `HttpError`}
79
+ * @typeParam TVariables - Values for mutation function
80
+ *
81
+ */
82
+ export declare const useUpdate: <TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}>({ mutationOptions, overtimeOptions, }?: UseUpdateProps<TData, TError, TVariables>) => UseUpdateReturnType<TData, TError, TVariables>;
83
+ //# sourceMappingURL=useUpdate.d.ts.map
@@ -63,7 +63,7 @@ type UpdateManyParams<TData, TError, TVariables> = {
63
63
  ids: BaseKey[];
64
64
  values: TVariables;
65
65
  }>;
66
- type UseUpdateManyReturnType<TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}> = UseMutationResult<UpdateManyResponse<TData>, TError, UpdateManyParams<TData, TError, TVariables>, UpdateContext<TData>> & UseLoadingOvertimeReturnType;
66
+ export type UseUpdateManyReturnType<TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}> = UseMutationResult<UpdateManyResponse<TData>, TError, UpdateManyParams<TData, TError, TVariables>, UpdateContext<TData>> & UseLoadingOvertimeReturnType;
67
67
  export type UseUpdateManyProps<TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}> = {
68
68
  mutationOptions?: Omit<UseMutationOptions<UpdateManyResponse<TData>, TError, UpdateManyParams<TData, TError, TVariables>, UpdateContext<TData>>, "mutationFn" | "onError" | "onSuccess" | "onSettled" | "onMutate">;
69
69
  } & UseLoadingOvertimeOptionsProps;
@@ -1 +1 @@
1
- {"version":3,"file":"useUpdateMany.d.ts","sourceR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C,KAAK,SAAS,UAAU,GAAG,UAAU,EACrC,MAAM,SAAS,SAAS,GAAG,SAAS,EACpC,UAAU,GAAG,EAAE,IACb,iBAAiB,CACnB,kBAAkB,CAAC,KAAK,CAAC,EACzB,MAAM,EACN,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAC3C,aAAa,CAAC,KAAK,CAAC,CACrB,GACC,4BAA4B,CAAC;AAE/B,MAAM,MAAM,kBAAkB,CAC5B,KAAK,SAAS,UAAU,GAAG,UAAU,EACrC,MAAM,SAAS,SAAS,GAAG,SAAS,EACpC,UAAU,GAAG,EAAE,IACb;IACF,eAAe,CAAC,EAAE,IAAI,CACpB,kBAAkB,CAChB,kBAAkB,CAAC,KAAK,CAAC,EACzB,MAAM,EACN,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAC3C,aAAa,CAAC,KAAK,CAAC,CACrB,EACD,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,WAAW,GAAG,UAAU,CAClE,CAAC;CACH,GAAG,8BAA8B,CAAC;AAEnC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,yIAOvB,mBAAmB,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,KAAQ,wBACtD,KAAK,EACL,MAAM,EACN,UAAU,CAocX,CAAC"}
@@ -63,7 +63,7 @@ type UpdateManyParams<TData, TError, TVariables> = {
63
63
  ids: BaseKey[];
64
64
  values: TVariables;
65
65
  }>;
66
- type UseUpdateManyReturnType<TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}> = UseMutationResult<UpdateManyResponse<TData>, TError, UpdateManyParams<TData, TError, TVariables>, UpdateContext<TData>> & UseLoadingOvertimeReturnType;
66
+ export type UseUpdateManyReturnType<TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}> = UseMutationResult<UpdateManyResponse<TData>, TError, UpdateManyParams<TData, TError, TVariables>, UpdateContext<TData>> & UseLoadingOvertimeReturnType;
67
67
  export type UseUpdateManyProps<TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}> = {
68
68
  mutationOptions?: Omit<UseMutationOptions<UpdateManyResponse<TData>, TError, UpdateManyParams<TData, TError, TVariables>, UpdateContext<TData>>, "mutationFn" | "onError" | "onSuccess" | "onSettled" | "onMutate">;
69
69
  } & UseLoadingOvertimeOptionsProps;