@refinedev/core 4.46.1 → 4.46.3-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 (270) hide show
  1. package/CHANGELOG.md +70 -1
  2. package/README.md +1 -1
  3. package/dist/components/authenticated/index.d.ts +3 -3
  4. package/dist/components/authenticated/index.d.ts.map +1 -1
  5. package/dist/components/canAccess/index.d.ts +5 -5
  6. package/dist/components/canAccess/index.d.ts.map +1 -1
  7. package/dist/components/containers/refine/index.d.ts +3 -3
  8. package/dist/components/gh-banner/index.d.ts +2 -2
  9. package/dist/components/gh-banner/index.d.ts.map +1 -1
  10. package/dist/components/pages/auth/components/forgotPassword/index.d.ts +1 -1
  11. package/dist/components/pages/auth/components/forgotPassword/index.d.ts.map +1 -1
  12. package/dist/components/pages/auth/components/login/index.d.ts +1 -1
  13. package/dist/components/pages/auth/components/login/index.d.ts.map +1 -1
  14. package/dist/components/pages/auth/components/register/index.d.ts +1 -1
  15. package/dist/components/pages/auth/components/register/index.d.ts.map +1 -1
  16. package/dist/components/pages/auth/components/updatePassword/index.d.ts +1 -1
  17. package/dist/components/pages/auth/components/updatePassword/index.d.ts.map +1 -1
  18. package/dist/components/pages/auth/index.d.ts +3 -3
  19. package/dist/components/pages/auth/index.d.ts.map +1 -1
  20. package/dist/components/routeChangeHandler/index.d.ts +0 -1
  21. package/dist/components/routeChangeHandler/index.d.ts.map +1 -1
  22. package/dist/contexts/accessControl/IAccessControlContext.d.ts +3 -3
  23. package/dist/contexts/accessControl/IAccessControlContext.d.ts.map +1 -1
  24. package/dist/contexts/auditLog/IAuditLogContext.d.ts +3 -3
  25. package/dist/contexts/auditLog/IAuditLogContext.d.ts.map +1 -1
  26. package/dist/contexts/auth/IAuthContext.d.ts +6 -6
  27. package/dist/contexts/auth/IAuthContext.d.ts.map +1 -1
  28. package/dist/contexts/data/IDataContext.d.ts +9 -9
  29. package/dist/contexts/data/IDataContext.d.ts.map +1 -1
  30. package/dist/contexts/legacy-router/IRouterContext.d.ts +1 -1
  31. package/dist/contexts/legacy-router/IRouterContext.d.ts.map +1 -1
  32. package/dist/contexts/live/ILiveContext.d.ts +2 -3
  33. package/dist/contexts/live/ILiveContext.d.ts.map +1 -1
  34. package/dist/contexts/notification/INotificationContext.d.ts +1 -1
  35. package/dist/contexts/notification/INotificationContext.d.ts.map +1 -1
  36. package/dist/contexts/resource/IResourceContext.d.ts +5 -5
  37. package/dist/contexts/resource/IResourceContext.d.ts.map +1 -1
  38. package/dist/contexts/translation/ITranslationContext.d.ts +2 -2
  39. package/dist/contexts/translation/ITranslationContext.d.ts.map +1 -1
  40. package/dist/contexts/undoableQueue/IUndoableQueueContext.d.ts +0 -1
  41. package/dist/contexts/undoableQueue/IUndoableQueueContext.d.ts.map +1 -1
  42. package/dist/definitions/helpers/flatten-object-keys/index.d.ts.map +1 -1
  43. package/dist/definitions/helpers/handlePaginationParams/index.d.ts +1 -1
  44. package/dist/definitions/helpers/handlePaginationParams/index.d.ts.map +1 -1
  45. package/dist/definitions/helpers/handleRefineOptions/index.d.ts +2 -2
  46. package/dist/definitions/helpers/handleRefineOptions/index.d.ts.map +1 -1
  47. package/dist/definitions/helpers/keys/index.d.ts +10 -10
  48. package/dist/definitions/helpers/keys/index.d.ts.map +1 -1
  49. package/dist/definitions/helpers/menu/create-tree.d.ts +2 -2
  50. package/dist/definitions/helpers/menu/create-tree.d.ts.map +1 -1
  51. package/dist/definitions/helpers/redirectPage/index.d.ts +1 -1
  52. package/dist/definitions/helpers/redirectPage/index.d.ts.map +1 -1
  53. package/dist/definitions/helpers/router/get-action-routes-from-resource.d.ts +1 -1
  54. package/dist/definitions/helpers/router/get-action-routes-from-resource.d.ts.map +1 -1
  55. package/dist/definitions/helpers/sequentialPromises/index.d.ts +2 -2
  56. package/dist/definitions/helpers/sequentialPromises/index.d.ts.map +1 -1
  57. package/dist/esm/index.js +7 -6
  58. package/dist/esm/index.js.map +1 -1
  59. package/dist/hooks/accessControl/useCan/index.d.ts +1 -1
  60. package/dist/hooks/accessControl/useCan/index.d.ts.map +1 -1
  61. package/dist/hooks/auditLog/useLog/index.d.ts +3 -3
  62. package/dist/hooks/auditLog/useLog/index.d.ts.map +1 -1
  63. package/dist/hooks/auditLog/useLogList/index.d.ts +1 -1
  64. package/dist/hooks/auditLog/useLogList/index.d.ts.map +1 -1
  65. package/dist/hooks/auth/useForgotPassword/index.d.ts +6 -6
  66. package/dist/hooks/auth/useForgotPassword/index.d.ts.map +1 -1
  67. package/dist/hooks/auth/useGetIdentity/index.d.ts +6 -6
  68. package/dist/hooks/auth/useGetIdentity/index.d.ts.map +1 -1
  69. package/dist/hooks/auth/useIsAuthenticated/index.d.ts +6 -6
  70. package/dist/hooks/auth/useIsAuthenticated/index.d.ts.map +1 -1
  71. package/dist/hooks/auth/useLogin/index.d.ts +6 -6
  72. package/dist/hooks/auth/useLogin/index.d.ts.map +1 -1
  73. package/dist/hooks/auth/useLogout/index.d.ts +7 -7
  74. package/dist/hooks/auth/useLogout/index.d.ts.map +1 -1
  75. package/dist/hooks/auth/useOnError/index.d.ts +6 -6
  76. package/dist/hooks/auth/useOnError/index.d.ts.map +1 -1
  77. package/dist/hooks/auth/usePermissions/index.d.ts +6 -6
  78. package/dist/hooks/auth/usePermissions/index.d.ts.map +1 -1
  79. package/dist/hooks/auth/useRegister/index.d.ts +6 -6
  80. package/dist/hooks/auth/useRegister/index.d.ts.map +1 -1
  81. package/dist/hooks/auth/useUpdatePassword/index.d.ts +6 -6
  82. package/dist/hooks/auth/useUpdatePassword/index.d.ts.map +1 -1
  83. package/dist/hooks/breadcrumb/index.d.ts +3 -3
  84. package/dist/hooks/breadcrumb/index.d.ts.map +1 -1
  85. package/dist/hooks/data/useCreate.d.ts +3 -3
  86. package/dist/hooks/data/useCreate.d.ts.map +1 -1
  87. package/dist/hooks/data/useCreateMany.d.ts +3 -3
  88. package/dist/hooks/data/useCreateMany.d.ts.map +1 -1
  89. package/dist/hooks/data/useCustom.d.ts +1 -1
  90. package/dist/hooks/data/useCustom.d.ts.map +1 -1
  91. package/dist/hooks/data/useCustomMutation.d.ts +3 -3
  92. package/dist/hooks/data/useCustomMutation.d.ts.map +1 -1
  93. package/dist/hooks/data/useDelete.d.ts +3 -3
  94. package/dist/hooks/data/useDelete.d.ts.map +1 -1
  95. package/dist/hooks/data/useDeleteMany.d.ts +3 -3
  96. package/dist/hooks/data/useDeleteMany.d.ts.map +1 -1
  97. package/dist/hooks/data/useInfiniteList.d.ts +2 -2
  98. package/dist/hooks/data/useInfiniteList.d.ts.map +1 -1
  99. package/dist/hooks/data/useList.d.ts +2 -2
  100. package/dist/hooks/data/useList.d.ts.map +1 -1
  101. package/dist/hooks/data/useMany.d.ts +1 -1
  102. package/dist/hooks/data/useMany.d.ts.map +1 -1
  103. package/dist/hooks/data/useOne.d.ts +1 -1
  104. package/dist/hooks/data/useOne.d.ts.map +1 -1
  105. package/dist/hooks/data/useUpdate.d.ts +3 -3
  106. package/dist/hooks/data/useUpdate.d.ts.map +1 -1
  107. package/dist/hooks/data/useUpdateMany.d.ts +3 -3
  108. package/dist/hooks/data/useUpdateMany.d.ts.map +1 -1
  109. package/dist/hooks/export/csvDownload.interface.d.ts +4 -4
  110. package/dist/hooks/export/csvDownload.interface.d.ts.map +1 -1
  111. package/dist/hooks/export/index.d.ts +2 -2
  112. package/dist/hooks/export/index.d.ts.map +1 -1
  113. package/dist/hooks/form/useForm.d.ts +4 -4
  114. package/dist/hooks/form/useForm.d.ts.map +1 -1
  115. package/dist/hooks/import/index.d.ts +9 -10
  116. package/dist/hooks/import/index.d.ts.map +1 -1
  117. package/dist/hooks/invalidate/index.d.ts +1 -1
  118. package/dist/hooks/invalidate/index.d.ts.map +1 -1
  119. package/dist/hooks/legacy-router/useRouterContext.d.ts +0 -1
  120. package/dist/hooks/legacy-router/useRouterContext.d.ts.map +1 -1
  121. package/dist/hooks/live/useResourceSubscription/index.d.ts +2 -2
  122. package/dist/hooks/live/useResourceSubscription/index.d.ts.map +1 -1
  123. package/dist/hooks/live/useSubscription/index.d.ts +1 -1
  124. package/dist/hooks/live/useSubscription/index.d.ts.map +1 -1
  125. package/dist/hooks/menu/useMenu.d.ts +3 -3
  126. package/dist/hooks/menu/useMenu.d.ts.map +1 -1
  127. package/dist/hooks/modal/useModal/index.d.ts +2 -2
  128. package/dist/hooks/modal/useModal/index.d.ts.map +1 -1
  129. package/dist/hooks/navigation/index.d.ts +1 -1
  130. package/dist/hooks/navigation/index.d.ts.map +1 -1
  131. package/dist/hooks/notification/useCancelNotification/index.d.ts +1 -2
  132. package/dist/hooks/notification/useCancelNotification/index.d.ts.map +1 -1
  133. package/dist/hooks/redirection/index.d.ts +1 -1
  134. package/dist/hooks/redirection/index.d.ts.map +1 -1
  135. package/dist/hooks/refine/useMutationMode.d.ts +1 -1
  136. package/dist/hooks/refine/useMutationMode.d.ts.map +1 -1
  137. package/dist/hooks/refine/useRefineContext.d.ts +0 -1
  138. package/dist/hooks/refine/useRefineContext.d.ts.map +1 -1
  139. package/dist/hooks/refine/useSyncWithLocation.d.ts +1 -1
  140. package/dist/hooks/refine/useSyncWithLocation.d.ts.map +1 -1
  141. package/dist/hooks/refine/useTitle.d.ts +0 -1
  142. package/dist/hooks/refine/useTitle.d.ts.map +1 -1
  143. package/dist/hooks/refine/useWarnAboutChange/index.d.ts +1 -1
  144. package/dist/hooks/refine/useWarnAboutChange/index.d.ts.map +1 -1
  145. package/dist/hooks/resource/useResource/index.d.ts +5 -5
  146. package/dist/hooks/resource/useResource/index.d.ts.map +1 -1
  147. package/dist/hooks/resource/useResourceWithRoute/index.d.ts +1 -1
  148. package/dist/hooks/resource/useResourceWithRoute/index.d.ts.map +1 -1
  149. package/dist/hooks/router/use-get-to-path/index.d.ts +2 -2
  150. package/dist/hooks/router/use-get-to-path/index.d.ts.map +1 -1
  151. package/dist/hooks/router/use-go/index.d.ts +6 -4
  152. package/dist/hooks/router/use-go/index.d.ts.map +1 -1
  153. package/dist/hooks/router/use-parse/index.d.ts +1 -1
  154. package/dist/hooks/router/use-parse/index.d.ts.map +1 -1
  155. package/dist/hooks/router/use-to-path/index.d.ts +1 -1
  156. package/dist/hooks/router/use-to-path/index.d.ts.map +1 -1
  157. package/dist/hooks/show/useShow.d.ts +2 -2
  158. package/dist/hooks/show/useShow.d.ts.map +1 -1
  159. package/dist/hooks/translate/useGetLocale.d.ts +1 -1
  160. package/dist/hooks/translate/useGetLocale.d.ts.map +1 -1
  161. package/dist/hooks/useLoadingOvertime/index.d.ts +6 -6
  162. package/dist/hooks/useLoadingOvertime/index.d.ts.map +1 -1
  163. package/dist/hooks/useSelect/index.d.ts +2 -2
  164. package/dist/hooks/useSelect/index.d.ts.map +1 -1
  165. package/dist/hooks/useTable/index.d.ts +5 -5
  166. package/dist/hooks/useTable/index.d.ts.map +1 -1
  167. package/dist/iife/index.js +7 -6
  168. package/dist/iife/index.js.map +1 -1
  169. package/dist/index.d.ts +1 -1
  170. package/dist/index.d.ts.map +1 -1
  171. package/dist/index.js +7 -6
  172. package/dist/index.js.map +1 -1
  173. package/dist/interfaces/actions.d.ts +6 -6
  174. package/dist/interfaces/actions.d.ts.map +1 -1
  175. package/dist/interfaces/auditLog/logData.d.ts +1 -1
  176. package/dist/interfaces/auditLog/logData.d.ts.map +1 -1
  177. package/dist/interfaces/auth.d.ts +12 -12
  178. package/dist/interfaces/auth.d.ts.map +1 -1
  179. package/dist/interfaces/autoSave.d.ts +4 -4
  180. package/dist/interfaces/autoSave.d.ts.map +1 -1
  181. package/dist/interfaces/bindings/access-control.d.ts +3 -3
  182. package/dist/interfaces/bindings/access-control.d.ts.map +1 -1
  183. package/dist/interfaces/bindings/auth.d.ts +8 -7
  184. package/dist/interfaces/bindings/auth.d.ts.map +1 -1
  185. package/dist/interfaces/bindings/data.d.ts +3 -3
  186. package/dist/interfaces/bindings/data.d.ts.map +1 -1
  187. package/dist/interfaces/bindings/i18n.d.ts +4 -4
  188. package/dist/interfaces/bindings/i18n.d.ts.map +1 -1
  189. package/dist/interfaces/bindings/index.d.ts +1 -1
  190. package/dist/interfaces/bindings/index.d.ts.map +1 -1
  191. package/dist/interfaces/bindings/live.d.ts +5 -5
  192. package/dist/interfaces/bindings/live.d.ts.map +1 -1
  193. package/dist/interfaces/bindings/notifications.d.ts +1 -1
  194. package/dist/interfaces/bindings/notifications.d.ts.map +1 -1
  195. package/dist/interfaces/bindings/resource.d.ts +7 -7
  196. package/dist/interfaces/bindings/resource.d.ts.map +1 -1
  197. package/dist/interfaces/bindings/router.d.ts +7 -8
  198. package/dist/interfaces/bindings/router.d.ts.map +1 -1
  199. package/dist/interfaces/customComponents.d.ts +3 -3
  200. package/dist/interfaces/customComponents.d.ts.map +1 -1
  201. package/dist/interfaces/errors/RefineError.d.ts +1 -1
  202. package/dist/interfaces/errors/RefineError.d.ts.map +1 -1
  203. package/dist/interfaces/form-url-params.d.ts +1 -1
  204. package/dist/interfaces/form-url-params.d.ts.map +1 -1
  205. package/dist/interfaces/index.d.ts +5 -5
  206. package/dist/interfaces/index.d.ts.map +1 -1
  207. package/dist/interfaces/live/LiveEvent.d.ts +1 -1
  208. package/dist/interfaces/live/LiveEvent.d.ts.map +1 -1
  209. package/dist/interfaces/live/LiveModeProps.d.ts +2 -2
  210. package/dist/interfaces/live/LiveModeProps.d.ts.map +1 -1
  211. package/dist/interfaces/metaData/fields.d.ts +1 -1
  212. package/dist/interfaces/metaData/fields.d.ts.map +1 -1
  213. package/dist/interfaces/metaData/graphqlQueryOptions.d.ts +48 -1
  214. package/dist/interfaces/metaData/graphqlQueryOptions.d.ts.map +1 -1
  215. package/dist/interfaces/metaData/metaDataQuery.d.ts +1 -1
  216. package/dist/interfaces/metaData/metaDataQuery.d.ts.map +1 -1
  217. package/dist/interfaces/metaData/metaQuery.d.ts +1 -1
  218. package/dist/interfaces/metaData/metaQuery.d.ts.map +1 -1
  219. package/dist/interfaces/metaData/nestedField.d.ts +1 -1
  220. package/dist/interfaces/metaData/nestedField.d.ts.map +1 -1
  221. package/dist/interfaces/metaData/variableOptions.d.ts +1 -1
  222. package/dist/interfaces/metaData/variableOptions.d.ts.map +1 -1
  223. package/dist/interfaces/mutationMode.d.ts +6 -6
  224. package/dist/interfaces/mutationMode.d.ts.map +1 -1
  225. package/dist/interfaces/optimistic-update-map.d.ts +2 -2
  226. package/dist/interfaces/optimistic-update-map.d.ts.map +1 -1
  227. package/dist/interfaces/prettify.d.ts +1 -1
  228. package/dist/interfaces/prettify.d.ts.map +1 -1
  229. package/dist/interfaces/resourceErrorRouterParams.d.ts +1 -1
  230. package/dist/interfaces/resourceErrorRouterParams.d.ts.map +1 -1
  231. package/dist/interfaces/resourceRouterParams.d.ts +1 -1
  232. package/dist/interfaces/resourceRouterParams.d.ts.map +1 -1
  233. package/dist/interfaces/successErrorNotification.d.ts +1 -1
  234. package/dist/interfaces/successErrorNotification.d.ts.map +1 -1
  235. package/dist/interfaces/telemetry.d.ts +1 -1
  236. package/dist/interfaces/telemetry.d.ts.map +1 -1
  237. package/dist/interfaces/textTransformers.d.ts +1 -1
  238. package/dist/interfaces/textTransformers.d.ts.map +1 -1
  239. package/package.json +1 -1
  240. package/src/components/containers/refine/index.tsx +3 -3
  241. package/src/contexts/auth/IAuthContext.ts +1 -1
  242. package/src/definitions/helpers/flatten-object-keys/index.ts +2 -0
  243. package/src/hooks/accessControl/useCan/index.ts +10 -12
  244. package/src/hooks/auditLog/useLogList/index.ts +10 -12
  245. package/src/hooks/auth/useForgotPassword/index.ts +51 -54
  246. package/src/hooks/auth/useGetIdentity/index.ts +23 -26
  247. package/src/hooks/auth/useIsAuthenticated/index.ts +20 -20
  248. package/src/hooks/auth/useLogin/index.ts +33 -35
  249. package/src/hooks/auth/useLogout/index.ts +32 -34
  250. package/src/hooks/auth/useOnError/index.ts +29 -33
  251. package/src/hooks/auth/usePermissions/index.ts +19 -22
  252. package/src/hooks/auth/useRegister/index.ts +60 -66
  253. package/src/hooks/auth/useUpdatePassword/index.ts +51 -54
  254. package/src/hooks/data/useCreate.ts +115 -117
  255. package/src/hooks/data/useCreateMany.ts +113 -118
  256. package/src/hooks/data/useDelete.ts +212 -227
  257. package/src/hooks/data/useDeleteMany.ts +230 -248
  258. package/src/hooks/data/useInfiniteList.ts +36 -42
  259. package/src/hooks/data/useList.ts +56 -62
  260. package/src/hooks/data/useMany.ts +36 -37
  261. package/src/hooks/data/useOne.ts +54 -55
  262. package/src/hooks/data/useUpdate.ts +288 -315
  263. package/src/hooks/data/useUpdateMany.ts +294 -325
  264. package/src/hooks/menu/useMenu.tsx +1 -1
  265. package/src/hooks/router/use-go/index.tsx +3 -0
  266. package/src/index.tsx +1 -0
  267. package/src/interfaces/auth.tsx +6 -6
  268. package/src/interfaces/bindings/auth.ts +3 -1
  269. package/src/interfaces/bindings/index.ts +1 -0
  270. package/src/interfaces/metaData/graphqlQueryOptions.ts +47 -0
@@ -140,8 +140,8 @@ export const useCreate = <
140
140
  TError,
141
141
  useCreateParams<TData, TError, TVariables>,
142
142
  unknown
143
- >(
144
- ({
143
+ >({
144
+ mutationFn: ({
145
145
  resource: resourceName,
146
146
  values,
147
147
  meta,
@@ -164,134 +164,132 @@ export const useCreate = <
164
164
  metaData: combinedMeta,
165
165
  });
166
166
  },
167
- {
168
- onSuccess: (
169
- data,
170
- {
171
- resource: resourceName,
172
- successNotification: successNotificationFromProp,
173
- dataProviderName: dataProviderNameFromProp,
174
- invalidates = ["list", "many"],
175
- values,
176
- meta,
177
- metaData,
178
- },
179
- ) => {
180
- const { resource, identifier } = select(resourceName);
181
- const resourceSingular = textTransformers.singular(identifier);
167
+ onSuccess: (
168
+ data,
169
+ {
170
+ resource: resourceName,
171
+ successNotification: successNotificationFromProp,
172
+ dataProviderName: dataProviderNameFromProp,
173
+ invalidates = ["list", "many"],
174
+ values,
175
+ meta,
176
+ metaData,
177
+ },
178
+ ) => {
179
+ const { resource, identifier } = select(resourceName);
180
+ const resourceSingular = textTransformers.singular(identifier);
182
181
 
183
- const dataProviderName = pickDataProvider(
184
- identifier,
185
- dataProviderNameFromProp,
186
- resources,
187
- );
182
+ const dataProviderName = pickDataProvider(
183
+ identifier,
184
+ dataProviderNameFromProp,
185
+ resources,
186
+ );
188
187
 
189
- const combinedMeta = getMeta({
190
- resource,
191
- meta: pickNotDeprecated(meta, metaData),
192
- });
188
+ const combinedMeta = getMeta({
189
+ resource,
190
+ meta: pickNotDeprecated(meta, metaData),
191
+ });
193
192
 
194
- const notificationConfig =
195
- typeof successNotificationFromProp === "function"
196
- ? successNotificationFromProp(data, values, identifier)
197
- : successNotificationFromProp;
193
+ const notificationConfig =
194
+ typeof successNotificationFromProp === "function"
195
+ ? successNotificationFromProp(data, values, identifier)
196
+ : successNotificationFromProp;
198
197
 
199
- handleNotification(notificationConfig, {
200
- key: `create-${identifier}-notification`,
201
- message: translate(
202
- "notifications.createSuccess",
203
- {
204
- resource: translate(
205
- `${identifier}.${identifier}`,
206
- resourceSingular,
207
- ),
208
- },
209
- `Successfully created ${resourceSingular}`,
210
- ),
211
- description: translate("notifications.success", "Success"),
212
- type: "success",
213
- });
198
+ handleNotification(notificationConfig, {
199
+ key: `create-${identifier}-notification`,
200
+ message: translate(
201
+ "notifications.createSuccess",
202
+ {
203
+ resource: translate(
204
+ `${identifier}.${identifier}`,
205
+ resourceSingular,
206
+ ),
207
+ },
208
+ `Successfully created ${resourceSingular}`,
209
+ ),
210
+ description: translate("notifications.success", "Success"),
211
+ type: "success",
212
+ });
214
213
 
215
- invalidateStore({
216
- resource: identifier,
217
- dataProviderName,
218
- invalidates,
219
- });
214
+ invalidateStore({
215
+ resource: identifier,
216
+ dataProviderName,
217
+ invalidates,
218
+ });
220
219
 
221
- publish?.({
222
- channel: `resources/${resource.name}`,
223
- type: "created",
224
- payload: {
225
- ids: data?.data?.id ? [data.data.id] : undefined,
226
- },
227
- date: new Date(),
228
- meta: {
229
- ...combinedMeta,
230
- dataProviderName,
231
- },
232
- });
220
+ publish?.({
221
+ channel: `resources/${resource.name}`,
222
+ type: "created",
223
+ payload: {
224
+ ids: data?.data?.id ? [data.data.id] : undefined,
225
+ },
226
+ date: new Date(),
227
+ meta: {
228
+ ...combinedMeta,
229
+ dataProviderName,
230
+ },
231
+ });
233
232
 
234
- const {
235
- fields: _fields,
236
- operation: _operation,
237
- variables: _variables,
238
- ...rest
239
- } = combinedMeta || {};
240
- log?.mutate({
241
- action: "create",
242
- resource: resource.name,
243
- data: values,
244
- meta: {
245
- dataProviderName,
246
- id: data?.data?.id ?? undefined,
247
- ...rest,
248
- },
249
- });
250
- },
251
- onError: (
252
- err: TError,
253
- {
254
- resource: resourceName,
255
- errorNotification: errorNotificationFromProp,
256
- values,
233
+ const {
234
+ fields: _fields,
235
+ operation: _operation,
236
+ variables: _variables,
237
+ ...rest
238
+ } = combinedMeta || {};
239
+ log?.mutate({
240
+ action: "create",
241
+ resource: resource.name,
242
+ data: values,
243
+ meta: {
244
+ dataProviderName,
245
+ id: data?.data?.id ?? undefined,
246
+ ...rest,
257
247
  },
258
- ) => {
259
- checkError(err);
248
+ });
249
+ },
250
+ onError: (
251
+ err: TError,
252
+ {
253
+ resource: resourceName,
254
+ errorNotification: errorNotificationFromProp,
255
+ values,
256
+ },
257
+ ) => {
258
+ checkError(err);
260
259
 
261
- const { identifier } = select(resourceName);
260
+ const { identifier } = select(resourceName);
262
261
 
263
- const resourceSingular = textTransformers.singular(identifier);
262
+ const resourceSingular = textTransformers.singular(identifier);
264
263
 
265
- const notificationConfig =
266
- typeof errorNotificationFromProp === "function"
267
- ? errorNotificationFromProp(err, values, identifier)
268
- : errorNotificationFromProp;
264
+ const notificationConfig =
265
+ typeof errorNotificationFromProp === "function"
266
+ ? errorNotificationFromProp(err, values, identifier)
267
+ : errorNotificationFromProp;
269
268
 
270
- handleNotification(notificationConfig, {
271
- key: `create-${identifier}-notification`,
272
- description: err.message,
273
- message: translate(
274
- "notifications.createError",
275
- {
276
- resource: translate(
277
- `${identifier}.${identifier}`,
278
- resourceSingular,
279
- ),
280
- statusCode: err.statusCode,
281
- },
282
- `There was an error creating ${resourceSingular} (status code: ${err.statusCode})`,
283
- ),
284
- type: "error",
285
- });
286
- },
287
- mutationKey: keys().data().mutation("create").get(preferLegacyKeys),
288
- ...mutationOptions,
289
- meta: {
290
- ...mutationOptions?.meta,
291
- ...getXRay("useCreate", preferLegacyKeys),
292
- },
269
+ handleNotification(notificationConfig, {
270
+ key: `create-${identifier}-notification`,
271
+ description: err.message,
272
+ message: translate(
273
+ "notifications.createError",
274
+ {
275
+ resource: translate(
276
+ `${identifier}.${identifier}`,
277
+ resourceSingular,
278
+ ),
279
+ statusCode: err.statusCode,
280
+ },
281
+ `There was an error creating ${resourceSingular} (status code: ${err.statusCode})`,
282
+ ),
283
+ type: "error",
284
+ });
285
+ },
286
+ mutationKey: keys().data().mutation("create").get(preferLegacyKeys),
287
+ ...mutationOptions,
288
+ meta: {
289
+ ...mutationOptions?.meta,
290
+ ...getXRay("useCreate", preferLegacyKeys),
293
291
  },
294
- );
292
+ });
295
293
 
296
294
  const { elapsedTime } = useLoadingOvertime({
297
295
  isLoading: mutation.isLoading,
@@ -113,8 +113,8 @@ export const useCreateMany = <
113
113
  CreateManyResponse<TData>,
114
114
  TError,
115
115
  useCreateManyParams<TData, TError, TVariables>
116
- >(
117
- ({
116
+ >({
117
+ mutationFn: ({
118
118
  resource: resourceName,
119
119
  values,
120
120
  meta,
@@ -152,132 +152,127 @@ export const useCreateMany = <
152
152
  );
153
153
  }
154
154
  },
155
- {
156
- onSuccess: (
157
- response,
158
- {
159
- resource: resourceName,
160
- successNotification,
161
- dataProviderName: dataProviderNameFromProp,
162
- invalidates = ["list", "many"],
163
- values,
164
- meta,
165
- metaData,
166
- },
167
- ) => {
168
- const { resource, identifier } = select(resourceName);
169
- const resourcePlural = textTransformers.plural(identifier);
155
+ onSuccess: (
156
+ response,
157
+ {
158
+ resource: resourceName,
159
+ successNotification,
160
+ dataProviderName: dataProviderNameFromProp,
161
+ invalidates = ["list", "many"],
162
+ values,
163
+ meta,
164
+ metaData,
165
+ },
166
+ ) => {
167
+ const { resource, identifier } = select(resourceName);
168
+ const resourcePlural = textTransformers.plural(identifier);
170
169
 
171
- const dataProviderName = pickDataProvider(
172
- identifier,
173
- dataProviderNameFromProp,
174
- resources,
175
- );
170
+ const dataProviderName = pickDataProvider(
171
+ identifier,
172
+ dataProviderNameFromProp,
173
+ resources,
174
+ );
176
175
 
177
- const combinedMeta = getMeta({
178
- resource,
179
- meta: pickNotDeprecated(meta, metaData),
180
- });
176
+ const combinedMeta = getMeta({
177
+ resource,
178
+ meta: pickNotDeprecated(meta, metaData),
179
+ });
181
180
 
182
- const notificationConfig =
183
- typeof successNotification === "function"
184
- ? successNotification(response, values, identifier)
185
- : successNotification;
181
+ const notificationConfig =
182
+ typeof successNotification === "function"
183
+ ? successNotification(response, values, identifier)
184
+ : successNotification;
186
185
 
187
- handleNotification(notificationConfig, {
188
- key: `createMany-${identifier}-notification`,
189
- message: translate(
190
- "notifications.createSuccess",
191
- {
192
- resource: translate(
193
- `${identifier}.${identifier}`,
194
- identifier,
195
- ),
196
- },
197
- `Successfully created ${resourcePlural}`,
198
- ),
199
- description: translate("notifications.success", "Success"),
200
- type: "success",
201
- });
186
+ handleNotification(notificationConfig, {
187
+ key: `createMany-${identifier}-notification`,
188
+ message: translate(
189
+ "notifications.createSuccess",
190
+ {
191
+ resource: translate(
192
+ `${identifier}.${identifier}`,
193
+ identifier,
194
+ ),
195
+ },
196
+ `Successfully created ${resourcePlural}`,
197
+ ),
198
+ description: translate("notifications.success", "Success"),
199
+ type: "success",
200
+ });
202
201
 
203
- invalidateStore({
204
- resource: identifier,
205
- dataProviderName,
206
- invalidates,
207
- });
202
+ invalidateStore({
203
+ resource: identifier,
204
+ dataProviderName,
205
+ invalidates,
206
+ });
208
207
 
209
- const ids = response?.data
210
- .filter((item) => item?.id !== undefined)
211
- .map((item) => item.id!);
212
- publish?.({
213
- channel: `resources/${resource.name}`,
214
- type: "created",
215
- payload: {
216
- ids,
217
- },
218
- date: new Date(),
219
- meta: {
220
- ...combinedMeta,
221
- dataProviderName,
222
- },
223
- });
208
+ const ids = response?.data
209
+ .filter((item) => item?.id !== undefined)
210
+ .map((item) => item.id!);
211
+ publish?.({
212
+ channel: `resources/${resource.name}`,
213
+ type: "created",
214
+ payload: {
215
+ ids,
216
+ },
217
+ date: new Date(),
218
+ meta: {
219
+ ...combinedMeta,
220
+ dataProviderName,
221
+ },
222
+ });
224
223
 
225
- const {
226
- fields: _fields,
227
- operation: _operation,
228
- variables: _variables,
229
- ...rest
230
- } = combinedMeta || {};
231
- log?.mutate({
232
- action: "createMany",
233
- resource: resource.name,
234
- data: values,
235
- meta: {
236
- dataProviderName,
237
- ids,
238
- ...rest,
239
- },
240
- });
241
- },
242
- onError: (
243
- err: TError,
244
- { resource: resourceName, errorNotification, values },
245
- ) => {
246
- const { identifier } = select(resourceName);
224
+ const {
225
+ fields: _fields,
226
+ operation: _operation,
227
+ variables: _variables,
228
+ ...rest
229
+ } = combinedMeta || {};
230
+ log?.mutate({
231
+ action: "createMany",
232
+ resource: resource.name,
233
+ data: values,
234
+ meta: {
235
+ dataProviderName,
236
+ ids,
237
+ ...rest,
238
+ },
239
+ });
240
+ },
241
+ onError: (
242
+ err: TError,
243
+ { resource: resourceName, errorNotification, values },
244
+ ) => {
245
+ const { identifier } = select(resourceName);
247
246
 
248
- const notificationConfig =
249
- typeof errorNotification === "function"
250
- ? errorNotification(err, values, identifier)
251
- : errorNotification;
247
+ const notificationConfig =
248
+ typeof errorNotification === "function"
249
+ ? errorNotification(err, values, identifier)
250
+ : errorNotification;
252
251
 
253
- handleNotification(notificationConfig, {
254
- key: `createMany-${identifier}-notification`,
255
- description: err.message,
256
- message: translate(
257
- "notifications.createError",
258
- {
259
- resource: translate(
260
- `${identifier}.${identifier}`,
261
- identifier,
262
- ),
263
- statusCode: err.statusCode,
264
- },
265
- `There was an error creating ${identifier} (status code: ${err.statusCode}`,
266
- ),
267
- type: "error",
268
- });
269
- },
270
- mutationKey: keys()
271
- .data()
272
- .mutation("createMany")
273
- .get(preferLegacyKeys),
274
- ...mutationOptions,
275
- meta: {
276
- ...mutationOptions?.meta,
277
- ...getXRay("useCreateMany", preferLegacyKeys),
278
- },
252
+ handleNotification(notificationConfig, {
253
+ key: `createMany-${identifier}-notification`,
254
+ description: err.message,
255
+ message: translate(
256
+ "notifications.createError",
257
+ {
258
+ resource: translate(
259
+ `${identifier}.${identifier}`,
260
+ identifier,
261
+ ),
262
+ statusCode: err.statusCode,
263
+ },
264
+ `There was an error creating ${identifier} (status code: ${err.statusCode}`,
265
+ ),
266
+ type: "error",
267
+ });
279
268
  },
280
- );
269
+ mutationKey: keys().data().mutation("createMany").get(preferLegacyKeys),
270
+ ...mutationOptions,
271
+ meta: {
272
+ ...mutationOptions?.meta,
273
+ ...getXRay("useCreateMany", preferLegacyKeys),
274
+ },
275
+ });
281
276
 
282
277
  const { elapsedTime } = useLoadingOvertime({
283
278
  isLoading: mutation.isLoading,