@refinedev/core 4.52.0 → 4.54.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.
- package/CHANGELOG.md +363 -2
- package/dist/components/pages/auth/components/login/index.d.cts.map +1 -1
- package/dist/components/pages/auth/components/login/index.d.ts.map +1 -1
- package/dist/definitions/types/index.d.cts +12 -0
- package/dist/definitions/types/index.d.cts.map +1 -0
- package/dist/definitions/types/index.d.mts +12 -0
- package/dist/definitions/types/index.d.mts.map +12 -0
- package/dist/definitions/types/index.d.ts +12 -0
- package/dist/definitions/types/index.d.ts.map +1 -0
- package/dist/hooks/data/useCreate.d.cts +7 -6
- package/dist/hooks/data/useCreate.d.cts.map +1 -1
- package/dist/hooks/data/useCreate.d.mts +7 -6
- package/dist/hooks/data/useCreate.d.mts.map +7 -6
- package/dist/hooks/data/useCreate.d.ts +7 -6
- package/dist/hooks/data/useCreate.d.ts.map +1 -1
- package/dist/hooks/data/useCreateMany.d.cts +9 -9
- package/dist/hooks/data/useCreateMany.d.cts.map +1 -1
- package/dist/hooks/data/useCreateMany.d.mts +9 -9
- package/dist/hooks/data/useCreateMany.d.mts.map +9 -9
- package/dist/hooks/data/useCreateMany.d.ts +9 -9
- package/dist/hooks/data/useCreateMany.d.ts.map +1 -1
- package/dist/hooks/data/useUpdate.d.cts +8 -7
- package/dist/hooks/data/useUpdate.d.cts.map +1 -1
- package/dist/hooks/data/useUpdate.d.mts +8 -7
- package/dist/hooks/data/useUpdate.d.mts.map +8 -7
- package/dist/hooks/data/useUpdate.d.ts +8 -7
- package/dist/hooks/data/useUpdate.d.ts.map +1 -1
- package/dist/hooks/data/useUpdateMany.d.cts +9 -9
- package/dist/hooks/data/useUpdateMany.d.cts.map +1 -1
- package/dist/hooks/data/useUpdateMany.d.mts +9 -9
- package/dist/hooks/data/useUpdateMany.d.mts.map +9 -9
- package/dist/hooks/data/useUpdateMany.d.ts +9 -9
- package/dist/hooks/data/useUpdateMany.d.ts.map +1 -1
- package/dist/hooks/form/index.d.cts.map +1 -1
- package/dist/hooks/form/index.d.ts.map +1 -1
- package/dist/hooks/form/types.d.cts +8 -0
- package/dist/hooks/form/types.d.cts.map +1 -1
- package/dist/hooks/form/types.d.mts +8 -0
- package/dist/hooks/form/types.d.mts.map +8 -0
- package/dist/hooks/form/types.d.ts +8 -0
- package/dist/hooks/form/types.d.ts.map +1 -1
- package/dist/hooks/show/index.d.cts.map +1 -1
- package/dist/hooks/show/index.d.ts.map +1 -1
- package/dist/hooks/show/types.d.cts +4 -0
- package/dist/hooks/show/types.d.cts.map +1 -1
- package/dist/hooks/show/types.d.mts +4 -0
- package/dist/hooks/show/types.d.mts.map +4 -0
- package/dist/hooks/show/types.d.ts +4 -0
- package/dist/hooks/show/types.d.ts.map +1 -1
- package/dist/hooks/useSelect/index.d.cts +10 -2
- package/dist/hooks/useSelect/index.d.cts.map +1 -1
- package/dist/hooks/useSelect/index.d.mts +10 -2
- package/dist/hooks/useSelect/index.d.mts.map +10 -2
- package/dist/hooks/useSelect/index.d.ts +10 -2
- package/dist/hooks/useSelect/index.d.ts.map +1 -1
- package/dist/hooks/useTable/index.d.cts +4 -0
- package/dist/hooks/useTable/index.d.cts.map +1 -1
- package/dist/hooks/useTable/index.d.mts +4 -0
- package/dist/hooks/useTable/index.d.mts.map +4 -0
- package/dist/hooks/useTable/index.d.ts +4 -0
- package/dist/hooks/useTable/index.d.ts.map +1 -1
- package/dist/index.cjs +10 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/components/pages/auth/components/login/index.tsx +7 -2
- package/src/definitions/types/index.ts +40 -0
- package/src/hooks/data/useCreate.ts +93 -32
- package/src/hooks/data/useCreateMany.ts +96 -33
- package/src/hooks/data/useUpdate.ts +137 -53
- package/src/hooks/data/useUpdateMany.ts +140 -51
- package/src/hooks/form/index.ts +2 -0
- package/src/hooks/form/types.ts +10 -0
- package/src/hooks/show/index.ts +1 -0
- package/src/hooks/show/types.ts +4 -0
- package/src/hooks/useSelect/index.ts +50 -28
- package/src/hooks/useTable/index.ts +5 -0
- package/dist/hooks/show/useShow.d.cts +0 -57
- package/dist/hooks/show/useShow.d.cts.map +0 -1
- package/dist/hooks/show/useShow.d.mts +0 -57
- package/dist/hooks/show/useShow.d.mts.map +0 -57
- package/dist/hooks/show/useShow.d.ts +0 -57
- package/dist/hooks/show/useShow.d.ts.map +0 -1
- package/src/hooks/show/useShow.ts +0 -179
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,367 @@
|
|
|
1
1
|
# @refinedev/core
|
|
2
2
|
|
|
3
|
-
## 4.
|
|
3
|
+
## 4.54.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#6180](https://github.com/refinedev/refine/pull/6180) [`292cebc5a70f19400793292b79d1400fec114591`](https://github.com/refinedev/refine/commit/292cebc5a70f19400793292b79d1400fec114591) Thanks [@alicanerdurmaz](https://github.com/alicanerdurmaz)! - feat: [`useSelect`](https://refine.dev/docs/data/hooks/use-select/)'s `queryResult` and `defaultValueQueryResult` is deprecated, use `query` and `defaultValueQuery` instead. #6179
|
|
8
|
+
|
|
9
|
+
```diff
|
|
10
|
+
import { useSelect } from '@refinedev/core';
|
|
11
|
+
|
|
12
|
+
- const { queryResult, defaultValueQueryResult } = useSelect();
|
|
13
|
+
+ const { query, defaultValueQuery } = useSelect();
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
> ✨ You can use `@refinedev/codemod` to automatically migrate your codebase. Simply run the following command in your project's root directory:
|
|
17
|
+
>
|
|
18
|
+
> ```bash
|
|
19
|
+
> npx @refinedev/codemod@latest rename-query-and-mutation-result
|
|
20
|
+
> ```
|
|
21
|
+
|
|
22
|
+
- [#6116](https://github.com/refinedev/refine/pull/6116) [`7e71f12b81954fd3a59678d7fcccd7b557879a94`](https://github.com/refinedev/refine/commit/7e71f12b81954fd3a59678d7fcccd7b557879a94) Thanks [@alicanerdurmaz](https://github.com/alicanerdurmaz)! - feat: [Mutation parameters](https://refine.dev/docs/data/hooks/use-update/#mutation-parameters) should be given as a prop to the `useUpdate` hook. #6102
|
|
23
|
+
From now on, you can pass mutation parameters to the `useUpdate` hook as a prop.
|
|
24
|
+
|
|
25
|
+
Old usage of `useUpdate` hook:
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { useUpdate } from "@refinedev/core";
|
|
29
|
+
|
|
30
|
+
const { mutate } = useUpdate();
|
|
31
|
+
|
|
32
|
+
mutate(
|
|
33
|
+
{
|
|
34
|
+
resource: "products",
|
|
35
|
+
id: 1,
|
|
36
|
+
mutationMode: "optimistic",
|
|
37
|
+
successNotification: false,
|
|
38
|
+
values: {
|
|
39
|
+
name: "New Product",
|
|
40
|
+
material: "Wood",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
onSuccess: () => {
|
|
45
|
+
/* do something after mutation success */
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
);
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
New usage of `useUpdate` hook:
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
import { useUpdate } from "@refinedev/core";
|
|
55
|
+
|
|
56
|
+
const { mutate } = useUpdate({
|
|
57
|
+
resource: "products",
|
|
58
|
+
successNotification: false,
|
|
59
|
+
mutationMode: "optimistic",
|
|
60
|
+
mutationOptions: {
|
|
61
|
+
onSuccess: () => {
|
|
62
|
+
/* do something after mutation success */
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
mutate({
|
|
68
|
+
// also you can override the parameters given to the hook
|
|
69
|
+
id: 1,
|
|
70
|
+
values: {
|
|
71
|
+
name: "New Product",
|
|
72
|
+
material: "Wood",
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
You can think of the parameters given to the `useUpdate` hook as default values, while the parameters given to the `mutate` function are the values used for that specific mutation or dynamic values.
|
|
78
|
+
|
|
79
|
+
> 🚨 If you pass these parameters to the `mutate` function, it will override the values given to the hook.
|
|
80
|
+
|
|
81
|
+
- [#6116](https://github.com/refinedev/refine/pull/6116) [`7e71f12b81954fd3a59678d7fcccd7b557879a94`](https://github.com/refinedev/refine/commit/7e71f12b81954fd3a59678d7fcccd7b557879a94) Thanks [@alicanerdurmaz](https://github.com/alicanerdurmaz)! - feat: [Mutation parameters](https://refine.dev/docs/data/hooks/use-create/#mutation-parameters) should be given as a prop to the `useCreate` hook. #6113
|
|
82
|
+
From now on, you can pass mutation parameters to the `useCreate` hook as a prop.
|
|
83
|
+
|
|
84
|
+
Old usage of `useCreate` hook:
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
import { useCreate } from "@refinedev/core";
|
|
88
|
+
|
|
89
|
+
const { mutate } = useCreate();
|
|
90
|
+
|
|
91
|
+
mutate(
|
|
92
|
+
{
|
|
93
|
+
resource: "products",
|
|
94
|
+
values: {
|
|
95
|
+
name: "New Product",
|
|
96
|
+
material: "Wood",
|
|
97
|
+
},
|
|
98
|
+
mutationMode: "optimistic",
|
|
99
|
+
successNotification: false,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
onSuccess: () => {
|
|
103
|
+
/* do something after mutation success */
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
);
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
New usage of `useCreate` hook:
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
import { useCreate } from "@refinedev/core";
|
|
113
|
+
|
|
114
|
+
const { mutate } = useCreate({
|
|
115
|
+
resource: "products",
|
|
116
|
+
successNotification: false,
|
|
117
|
+
mutationMode: "optimistic",
|
|
118
|
+
mutationOptions: {
|
|
119
|
+
onSuccess: () => {
|
|
120
|
+
/* do something after mutation success */
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
mutate({
|
|
126
|
+
// also you can override the parameters given to the hook
|
|
127
|
+
values: {
|
|
128
|
+
name: "New Product",
|
|
129
|
+
material: "Wood",
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
You can think of the parameters given to the `useCreate` hook as default values, while the parameters given to the `mutate` function are the values used for that specific mutation or dynamic values.
|
|
135
|
+
|
|
136
|
+
> 🚨 If you pass these parameters to the `mutate` function, it will override the values given to the hook.
|
|
137
|
+
|
|
138
|
+
- [#6172](https://github.com/refinedev/refine/pull/6172) [`4967a51944c139d102fcfc04ada5a42c725ed7c2`](https://github.com/refinedev/refine/commit/4967a51944c139d102fcfc04ada5a42c725ed7c2) Thanks [@alicanerdurmaz](https://github.com/alicanerdurmaz)! - feat: [`useTable`](https://refine.dev/docs/data/hooks/use-table/)'s `tableQueryResult` is deprecated, use `tableQuery` instead. #6169
|
|
139
|
+
|
|
140
|
+
```diff
|
|
141
|
+
import { useTable } from '@refinedev/core';
|
|
142
|
+
|
|
143
|
+
- const { tableQueryResult } = useTable();
|
|
144
|
+
+ const { tableQuery } = useTable();
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
> ✨ You can use `@refinedev/codemod` to automatically migrate your codebase. Simply run the following command in your project's root directory:
|
|
148
|
+
>
|
|
149
|
+
> ```bash
|
|
150
|
+
> npx @refinedev/codemod@latest rename-query-and-mutation-result
|
|
151
|
+
> ```
|
|
152
|
+
|
|
153
|
+
- [#6164](https://github.com/refinedev/refine/pull/6164) [`8ed027eec66c41c444f168f4f52e6b51057bc498`](https://github.com/refinedev/refine/commit/8ed027eec66c41c444f168f4f52e6b51057bc498) Thanks [@alicanerdurmaz](https://github.com/alicanerdurmaz)! - feat: [`useForm`](https://refine.dev/docs/data/hooks/use-form/)'s `queryResult` is deprecated, use `query` instead. #6163
|
|
154
|
+
|
|
155
|
+
```diff
|
|
156
|
+
import { useForm } from '@refinedev/core';
|
|
157
|
+
|
|
158
|
+
- const { queryResult } = useForm();
|
|
159
|
+
+ const { query } = useForm();
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
> ✨ You can use `@refinedev/codemod` to automatically migrate your codebase. Simply run the following command in your project's root directory:
|
|
163
|
+
>
|
|
164
|
+
> ```bash
|
|
165
|
+
> npx @refinedev/codemod@latest rename-query-and-mutation-result
|
|
166
|
+
> ```
|
|
167
|
+
|
|
168
|
+
- [#6116](https://github.com/refinedev/refine/pull/6116) [`7e71f12b81954fd3a59678d7fcccd7b557879a94`](https://github.com/refinedev/refine/commit/7e71f12b81954fd3a59678d7fcccd7b557879a94) Thanks [@alicanerdurmaz](https://github.com/alicanerdurmaz)! - feat: [Mutation parameters](https://refine.dev/docs/data/hooks/use-create-many/#mutation-parameters) should be given as a prop to the `useCreateMany` hook. #6114
|
|
169
|
+
From now on, you can pass mutation parameters to the `useCreateMany` hook as a prop.
|
|
170
|
+
|
|
171
|
+
Old usage of `useCreateMany` hook:
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
import { useCreateMany } from "@refinedev/core";
|
|
175
|
+
|
|
176
|
+
const { mutate } = useCreateMany();
|
|
177
|
+
|
|
178
|
+
mutate(
|
|
179
|
+
{
|
|
180
|
+
resource: "products",
|
|
181
|
+
values: [
|
|
182
|
+
{
|
|
183
|
+
name: "Product 1",
|
|
184
|
+
material: "Wood",
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: "Product 2",
|
|
188
|
+
material: "Metal",
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
mutationMode: "optimistic",
|
|
192
|
+
successNotification: false,
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
onSuccess: () => {
|
|
196
|
+
/* do something after mutation success */
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
);
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
New usage of `useCreateMany` hook:
|
|
203
|
+
|
|
204
|
+
```tsx
|
|
205
|
+
import { useCreateMany } from "@refinedev/core";
|
|
206
|
+
|
|
207
|
+
const { mutate } = useCreateMany({
|
|
208
|
+
resource: "products",
|
|
209
|
+
successNotification: false,
|
|
210
|
+
mutationMode: "optimistic",
|
|
211
|
+
mutationOptions: {
|
|
212
|
+
onSuccess: () => {
|
|
213
|
+
/* do something after mutation success */
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
mutate({
|
|
219
|
+
// also you can override the parameters given to the hook
|
|
220
|
+
values: [
|
|
221
|
+
{
|
|
222
|
+
name: "Product 1",
|
|
223
|
+
material: "Wood",
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
name: "Product 2",
|
|
227
|
+
material: "Metal",
|
|
228
|
+
},
|
|
229
|
+
],
|
|
230
|
+
});
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
You can think of the parameters given to the `useCreateMany` hook as default values, while the parameters given to the `mutate` function are the values used for that specific mutation or dynamic values.
|
|
234
|
+
|
|
235
|
+
> 🚨 If you pass these parameters to the `mutate` function, it will override the values given to the hook.
|
|
236
|
+
|
|
237
|
+
- [#6174](https://github.com/refinedev/refine/pull/6174) [`2b73e40b0e18932f008842790065cdd386e9d270`](https://github.com/refinedev/refine/commit/2b73e40b0e18932f008842790065cdd386e9d270) Thanks [@alicanerdurmaz](https://github.com/alicanerdurmaz)! - feat: [`useShow`](https://refine.dev/docs/data/hooks/use-show/)'s `queryResult` is deprecated, use `query` instead. #6173
|
|
238
|
+
|
|
239
|
+
```diff
|
|
240
|
+
import { useShow } from '@refinedev/core';
|
|
241
|
+
|
|
242
|
+
- const { queryResult } = useShow();
|
|
243
|
+
+ const { query } = useShow();
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
> ✨ You can use `@refinedev/codemod` to automatically migrate your codebase. Simply run the following command in your project's root directory:
|
|
247
|
+
>
|
|
248
|
+
> ```bash
|
|
249
|
+
> npx @refinedev/codemod@latest rename-query-and-mutation-result
|
|
250
|
+
> ```
|
|
251
|
+
|
|
252
|
+
- [#6164](https://github.com/refinedev/refine/pull/6164) [`8ed027eec66c41c444f168f4f52e6b51057bc498`](https://github.com/refinedev/refine/commit/8ed027eec66c41c444f168f4f52e6b51057bc498) Thanks [@alicanerdurmaz](https://github.com/alicanerdurmaz)! - feat: [`useForm`](https://refine.dev/docs/data/hooks/use-form/)'s `mutationResult` is deprecated, use `mutation` instead. #6163
|
|
253
|
+
|
|
254
|
+
```diff
|
|
255
|
+
import { useForm } from '@refinedev/core';
|
|
256
|
+
|
|
257
|
+
- const { mutationResult } = useForm();
|
|
258
|
+
+ const { mutation } = useForm();
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
> ✨ You can use `@refinedev/codemod` to automatically migrate your codebase. Simply run the following command in your project's root directory:
|
|
262
|
+
>
|
|
263
|
+
> ```bash
|
|
264
|
+
> npx @refinedev/codemod@latest rename-query-and-mutation-result
|
|
265
|
+
> ```
|
|
266
|
+
|
|
267
|
+
- [#6125](https://github.com/refinedev/refine/pull/6125) [`61aa3464df0d95c30839726f455ed43e6854730b`](https://github.com/refinedev/refine/commit/61aa3464df0d95c30839726f455ed43e6854730b) Thanks [@Dominic-Preap](https://github.com/Dominic-Preap)! - fix: update debounce behavior on `onSearch` in `useSelect`
|
|
268
|
+
|
|
269
|
+
Now debounce behavior is working correctly on `onSearch` in `useSelect` when using inside `Controller` of react-hook-form.
|
|
270
|
+
|
|
271
|
+
Resolves [#6096](https://github.com/refinedev/refine/issues/6096)
|
|
272
|
+
|
|
273
|
+
- [#6116](https://github.com/refinedev/refine/pull/6116) [`7e71f12b81954fd3a59678d7fcccd7b557879a94`](https://github.com/refinedev/refine/commit/7e71f12b81954fd3a59678d7fcccd7b557879a94) Thanks [@alicanerdurmaz](https://github.com/alicanerdurmaz)! - feat: [Mutation parameters](https://refine.dev/docs/data/hooks/use-update-many/#mutation-parameters) should be given as a prop to the `useUpdateMany` hook. #6115
|
|
274
|
+
From now on, you can pass mutation parameters to the `useUpdateMany` hook as a prop.
|
|
275
|
+
|
|
276
|
+
Old usage of `useUpdateMany` hook:
|
|
277
|
+
|
|
278
|
+
```tsx
|
|
279
|
+
import { useUpdateMany } from "@refinedev/core";
|
|
280
|
+
|
|
281
|
+
const { mutate } = useUpdateMany();
|
|
282
|
+
|
|
283
|
+
mutate(
|
|
284
|
+
{
|
|
285
|
+
resource: "products",
|
|
286
|
+
values: {
|
|
287
|
+
name: "New Product",
|
|
288
|
+
material: "Wood",
|
|
289
|
+
},
|
|
290
|
+
ids: [1, 2, 3],
|
|
291
|
+
mutationMode: "optimistic",
|
|
292
|
+
successNotification: false,
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
onSuccess: () => {
|
|
296
|
+
/* do something after mutation success */
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
);
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
New usage of `useUpdateMany` hook:
|
|
303
|
+
|
|
304
|
+
```tsx
|
|
305
|
+
import { useUpdateMany } from "@refinedev/core";
|
|
306
|
+
|
|
307
|
+
const { mutate } = useUpdateMany({
|
|
308
|
+
resource: "products",
|
|
309
|
+
successNotification: false,
|
|
310
|
+
mutationMode: "optimistic",
|
|
311
|
+
mutationOptions: {
|
|
312
|
+
onSuccess: () => {
|
|
313
|
+
/* do something after mutation success */
|
|
314
|
+
},
|
|
315
|
+
},
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
mutate({
|
|
319
|
+
ids: [1, 2, 3],
|
|
320
|
+
values: {
|
|
321
|
+
name: "New Product",
|
|
322
|
+
material: "Wood",
|
|
323
|
+
},
|
|
324
|
+
// also you can override the parameters given to the hook
|
|
325
|
+
});
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
You can think of the parameters given to the `useUpdateMany` hook as default values, while the parameters given to the `mutate` function are the values used for that specific mutation or dynamic values.
|
|
329
|
+
|
|
330
|
+
> 🚨 If you pass these parameters to the `mutate` function, it will override the values given to the hook.
|
|
331
|
+
|
|
332
|
+
### Patch Changes
|
|
333
|
+
|
|
334
|
+
- [#6185](https://github.com/refinedev/refine/pull/6185) [`603c73eb7d376fc2357a577f5921f844a8f444e4`](https://github.com/refinedev/refine/commit/603c73eb7d376fc2357a577f5921f844a8f444e4) Thanks [@aliemir](https://github.com/aliemir)! - Bump `@refinedev/devtools-internal` dependency to reflect the latest changes in the Refine Devtools.
|
|
335
|
+
|
|
336
|
+
- [#6224](https://github.com/refinedev/refine/pull/6224) [`81703b62bafeb01a75290b99b3869ef96d04bd94`](https://github.com/refinedev/refine/commit/81703b62bafeb01a75290b99b3869ef96d04bd94) Thanks [@WananiAdib](https://github.com/WananiAdib)! - fix(core): fixed type issue in useSelect. #6223
|
|
337
|
+
|
|
338
|
+
Previously, the types would not allow functions to be passed as props. After this change, it will be possible.
|
|
339
|
+
|
|
340
|
+
[Resolves #6223](https://github.com/refinedev/refine/issues/6223)
|
|
341
|
+
|
|
342
|
+
- [#6184](https://github.com/refinedev/refine/pull/6184) [`1f7976bd32da311367945370efccd7d9c9b102a7`](https://github.com/refinedev/refine/commit/1f7976bd32da311367945370efccd7d9c9b102a7) Thanks [@Sarfraz-droid](https://github.com/Sarfraz-droid)! - AuthPage in Next.js generates code with i18n but the folder hooks is not created. imported useTranslate from @hooks to fix the issue
|
|
343
|
+
|
|
344
|
+
- [#6116](https://github.com/refinedev/refine/pull/6116) [`7e71f12b81954fd3a59678d7fcccd7b557879a94`](https://github.com/refinedev/refine/commit/7e71f12b81954fd3a59678d7fcccd7b557879a94) Thanks [@alicanerdurmaz](https://github.com/alicanerdurmaz)! - fix: `invalidates` prop of `useUpdateMany` doesn't work. #6209
|
|
345
|
+
|
|
346
|
+
From now on, the `invalidates` prop of the `useUpdateMany` hook will work as expected.
|
|
347
|
+
|
|
348
|
+
```tsx
|
|
349
|
+
const { mutate } = useUpdateMany({
|
|
350
|
+
resource: "posts",
|
|
351
|
+
invalidates: ["all"], // invalidates all queries of the "posts" resource
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
mutate({ ids: [1, 2, 3], values: { title: "new title" } });
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
- [#6154](https://github.com/refinedev/refine/pull/6154) [`fa2d7a4554da2d5fb2432a011941f9c157b59aba`](https://github.com/refinedev/refine/commit/fa2d7a4554da2d5fb2432a011941f9c157b59aba) Thanks [@BatuhanW](https://github.com/BatuhanW)! - chore(devtools): bump internal devtools dependency
|
|
358
|
+
|
|
359
|
+
Bump `@refinedev/devtools-internal` version.
|
|
360
|
+
|
|
361
|
+
- Updated dependencies [[`ccddff6eba23286d4025a7301de3ebfc24b1b633`](https://github.com/refinedev/refine/commit/ccddff6eba23286d4025a7301de3ebfc24b1b633), [`603c73eb7d376fc2357a577f5921f844a8f444e4`](https://github.com/refinedev/refine/commit/603c73eb7d376fc2357a577f5921f844a8f444e4)]:
|
|
362
|
+
- @refinedev/devtools-internal@1.1.14
|
|
363
|
+
|
|
364
|
+
## 4.53.0
|
|
4
365
|
|
|
5
366
|
### Minor Changes
|
|
6
367
|
|
|
@@ -29,7 +390,7 @@
|
|
|
29
390
|
Resolves [#6067](https://github.com/refinedev/refine/issues/6067)
|
|
30
391
|
|
|
31
392
|
- Updated dependencies []:
|
|
32
|
-
- @refinedev/devtools-internal@1.1.
|
|
393
|
+
- @refinedev/devtools-internal@1.1.13
|
|
33
394
|
|
|
34
395
|
## 4.51.0
|
|
35
396
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/pages/auth/components/login/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/pages/auth/components/login/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAWxC,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAkB,cAAc,EAAE,MAAM,aAAa,CAAC;AAElE,KAAK,UAAU,GAAG,cAAc,CAAC,YAAY,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;AAE5E,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAmL1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/pages/auth/components/login/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/pages/auth/components/login/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAWxC,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAkB,cAAc,EAAE,MAAM,aAAa,CAAC;AAElE,KAAK,UAAU,GAAG,cAAc,CAAC,YAAY,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;AAE5E,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAmL1C,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MutateOptions, UseMutationResult as UseMutationResultBase } from "@tanstack/react-query";
|
|
2
|
+
export type MutateAsyncFunction<TData = unknown, TError = unknown, TVariables = void, TContext = unknown> = (variables?: TVariables, options?: MutateOptions<TData, TError, TVariables, TContext>) => Promise<TData>;
|
|
3
|
+
export type MutateFunction<TData = unknown, TError = unknown, TVariables = void, TContext = unknown> = (...args: Parameters<MutateAsyncFunction<TData, TError, TVariables, TContext>>) => void;
|
|
4
|
+
/**
|
|
5
|
+
* we want to make the mutate and mutateAsync functions optional in the UseMutationResult
|
|
6
|
+
* because we want users to be able to provide the required parameters from the hook
|
|
7
|
+
*/
|
|
8
|
+
export type UseMutationResult<TData = unknown, TError = unknown, TVariables = unknown, TContext = unknown> = Omit<UseMutationResultBase<TData, TError, TVariables, TContext>, "mutate" | "mutateAsync"> & {
|
|
9
|
+
mutate: MutateFunction<TData, TError, TVariables, TContext>;
|
|
10
|
+
mutateAsync: MutateAsyncFunction<TData, TError, TVariables, TContext>;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/definitions/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,IAAI,qBAAqB,EAC3C,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,mBAAmB,CAC7B,KAAK,GAAG,OAAO,EACf,MAAM,GAAG,OAAO,EAChB,UAAU,GAAG,IAAI,EACjB,QAAQ,GAAG,OAAO,IAChB,CACF,SAAS,CAAC,EAAE,UAAU,EACtB,OAAO,CAAC,EAAE,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,KACzD,OAAO,CAAC,KAAK,CAAC,CAAC;AAEpB,MAAM,MAAM,cAAc,CACxB,KAAK,GAAG,OAAO,EACf,MAAM,GAAG,OAAO,EAChB,UAAU,GAAG,IAAI,EACjB,QAAQ,GAAG,OAAO,IAChB,CACF,GAAG,IAAI,EAAE,UAAU,CAAC,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,KAC1E,IAAI,CAAC;AAEV;;;GAGG;AACH,MAAM,MAAM,iBAAiB,CAC3B,KAAK,GAAG,OAAO,EACf,MAAM,GAAG,OAAO,EAChB,UAAU,GAAG,OAAO,EACpB,QAAQ,GAAG,OAAO,IAChB,IAAI,CACN,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,EAC1D,QAAQ,GAAG,aAAa,CACzB,GAAG;IACF,MAAM,EAAE,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC5D,WAAW,EAAE,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;CACvE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MutateOptions, UseMutationResult as UseMutationResultBase } from "@tanstack/react-query";
|
|
2
|
+
export type MutateAsyncFunction<TData = unknown, TError = unknown, TVariables = void, TContext = unknown> = (variables?: TVariables, options?: MutateOptions<TData, TError, TVariables, TContext>) => Promise<TData>;
|
|
3
|
+
export type MutateFunction<TData = unknown, TError = unknown, TVariables = void, TContext = unknown> = (...args: Parameters<MutateAsyncFunction<TData, TError, TVariables, TContext>>) => void;
|
|
4
|
+
/**
|
|
5
|
+
* we want to make the mutate and mutateAsync functions optional in the UseMutationResult
|
|
6
|
+
* because we want users to be able to provide the required parameters from the hook
|
|
7
|
+
*/
|
|
8
|
+
export type UseMutationResult<TData = unknown, TError = unknown, TVariables = unknown, TContext = unknown> = Omit<UseMutationResultBase<TData, TError, TVariables, TContext>, "mutate" | "mutateAsync"> & {
|
|
9
|
+
mutate: MutateFunction<TData, TError, TVariables, TContext>;
|
|
10
|
+
mutateAsync: MutateAsyncFunction<TData, TError, TVariables, TContext>;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MutateOptions, UseMutationResult as UseMutationResultBase } from "@tanstack/react-query";
|
|
2
|
+
export type MutateAsyncFunction<TData = unknown, TError = unknown, TVariables = void, TContext = unknown> = (variables?: TVariables, options?: MutateOptions<TData, TError, TVariables, TContext>) => Promise<TData>;
|
|
3
|
+
export type MutateFunction<TData = unknown, TError = unknown, TVariables = void, TContext = unknown> = (...args: Parameters<MutateAsyncFunction<TData, TError, TVariables, TContext>>) => void;
|
|
4
|
+
/**
|
|
5
|
+
* we want to make the mutate and mutateAsync functions optional in the UseMutationResult
|
|
6
|
+
* because we want users to be able to provide the required parameters from the hook
|
|
7
|
+
*/
|
|
8
|
+
export type UseMutationResult<TData = unknown, TError = unknown, TVariables = unknown, TContext = unknown> = Omit<UseMutationResultBase<TData, TError, TVariables, TContext>, "mutate" | "mutateAsync"> & {
|
|
9
|
+
mutate: MutateFunction<TData, TError, TVariables, TContext>;
|
|
10
|
+
mutateAsync: MutateAsyncFunction<TData, TError, TVariables, TContext>;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MutateOptions, UseMutationResult as UseMutationResultBase } from "@tanstack/react-query";
|
|
2
|
+
export type MutateAsyncFunction<TData = unknown, TError = unknown, TVariables = void, TContext = unknown> = (variables?: TVariables, options?: MutateOptions<TData, TError, TVariables, TContext>) => Promise<TData>;
|
|
3
|
+
export type MutateFunction<TData = unknown, TError = unknown, TVariables = void, TContext = unknown> = (...args: Parameters<MutateAsyncFunction<TData, TError, TVariables, TContext>>) => void;
|
|
4
|
+
/**
|
|
5
|
+
* we want to make the mutate and mutateAsync functions optional in the UseMutationResult
|
|
6
|
+
* because we want users to be able to provide the required parameters from the hook
|
|
7
|
+
*/
|
|
8
|
+
export type UseMutationResult<TData = unknown, TError = unknown, TVariables = unknown, TContext = unknown> = Omit<UseMutationResultBase<TData, TError, TVariables, TContext>, "mutate" | "mutateAsync"> & {
|
|
9
|
+
mutate: MutateFunction<TData, TError, TVariables, TContext>;
|
|
10
|
+
mutateAsync: MutateAsyncFunction<TData, TError, TVariables, TContext>;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/definitions/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,IAAI,qBAAqB,EAC3C,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,mBAAmB,CAC7B,KAAK,GAAG,OAAO,EACf,MAAM,GAAG,OAAO,EAChB,UAAU,GAAG,IAAI,EACjB,QAAQ,GAAG,OAAO,IAChB,CACF,SAAS,CAAC,EAAE,UAAU,EACtB,OAAO,CAAC,EAAE,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,KACzD,OAAO,CAAC,KAAK,CAAC,CAAC;AAEpB,MAAM,MAAM,cAAc,CACxB,KAAK,GAAG,OAAO,EACf,MAAM,GAAG,OAAO,EAChB,UAAU,GAAG,IAAI,EACjB,QAAQ,GAAG,OAAO,IAChB,CACF,GAAG,IAAI,EAAE,UAAU,CAAC,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,KAC1E,IAAI,CAAC;AAEV;;;GAGG;AACH,MAAM,MAAM,iBAAiB,CAC3B,KAAK,GAAG,OAAO,EACf,MAAM,GAAG,OAAO,EAChB,UAAU,GAAG,OAAO,EACpB,QAAQ,GAAG,OAAO,IAChB,IAAI,CACN,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,EAC1D,QAAQ,GAAG,aAAa,CACzB,GAAG;IACF,MAAM,EAAE,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC5D,WAAW,EAAE,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;CACvE,CAAC"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { type UseMutationOptions
|
|
1
|
+
import { type UseMutationOptions } from "@tanstack/react-query";
|
|
2
2
|
import type { BaseRecord, CreateResponse, HttpError, IQueryKeys, MetaQuery } from "../../contexts/data/types";
|
|
3
|
+
import type { UseMutationResult } from "../../definitions/types";
|
|
3
4
|
import type { SuccessErrorNotification } from "../../contexts/notification/types";
|
|
4
5
|
import { type UseLoadingOvertimeOptionsProps, type UseLoadingOvertimeReturnType } from "../useLoadingOvertime";
|
|
5
6
|
export type UseCreateParams<TData, TError, TVariables> = {
|
|
6
7
|
/**
|
|
7
8
|
* Resource name for API data interactions
|
|
8
9
|
*/
|
|
9
|
-
resource
|
|
10
|
+
resource?: string;
|
|
10
11
|
/**
|
|
11
12
|
* Values for mutation function
|
|
12
13
|
*/
|
|
13
|
-
values
|
|
14
|
+
values?: TVariables;
|
|
14
15
|
/**
|
|
15
16
|
* Meta data for `dataProvider`
|
|
16
17
|
*/
|
|
@@ -31,8 +32,8 @@ export type UseCreateParams<TData, TError, TVariables> = {
|
|
|
31
32
|
} & SuccessErrorNotification<CreateResponse<TData>, TError, TVariables>;
|
|
32
33
|
export type UseCreateReturnType<TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}> = UseMutationResult<CreateResponse<TData>, TError, UseCreateParams<TData, TError, TVariables>, unknown>;
|
|
33
34
|
export type UseCreateProps<TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}> = {
|
|
34
|
-
mutationOptions?: Omit<UseMutationOptions<CreateResponse<TData>, TError, UseCreateParams<TData, TError, TVariables>, unknown>, "mutationFn"
|
|
35
|
-
} & UseLoadingOvertimeOptionsProps
|
|
35
|
+
mutationOptions?: Omit<UseMutationOptions<CreateResponse<TData>, TError, UseCreateParams<TData, TError, TVariables>, unknown>, "mutationFn">;
|
|
36
|
+
} & UseLoadingOvertimeOptionsProps & UseCreateParams<TData, TError, TVariables>;
|
|
36
37
|
/**
|
|
37
38
|
* `useCreate` is a modified version of `react-query`'s {@link https://react-query.tanstack.com/reference/useMutation `useMutation`} for create mutations.
|
|
38
39
|
*
|
|
@@ -45,5 +46,5 @@ export type UseCreateProps<TData extends BaseRecord = BaseRecord, TError extends
|
|
|
45
46
|
* @typeParam TVariables - Values for mutation function
|
|
46
47
|
*
|
|
47
48
|
*/
|
|
48
|
-
export declare const useCreate: <TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}>({ mutationOptions, overtimeOptions, }?: UseCreateProps<TData, TError, TVariables>) => UseCreateReturnType<TData, TError, TVariables> & UseLoadingOvertimeReturnType;
|
|
49
|
+
export declare const useCreate: <TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}>({ resource: resourceFromProps, values: valuesFromProps, dataProviderName: dataProviderNameFromProps, successNotification: successNotificationFromProps, errorNotification: errorNotificationFromProps, invalidates: invalidatesFromProps, meta: metaFromProps, metaData: metaDataFromProps, mutationOptions, overtimeOptions, }?: UseCreateProps<TData, TError, TVariables>) => UseCreateReturnType<TData, TError, TVariables> & UseLoadingOvertimeReturnType;
|
|
49
50
|
//# sourceMappingURL=useCreate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreate.d.ts","sourceRoot":"","sources":["../../../src/hooks/data/useCreate.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"useCreate.d.ts","sourceRoot":"","sources":["../../../src/hooks/data/useCreate.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,kBAAkB,EAGxB,MAAM,uBAAuB,CAAC;AAgB/B,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,SAAS,EACT,UAAU,EACV,SAAS,EACV,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,EACL,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EAElC,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,IAAI;IACvD;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,UAAU,CAAC,CAAC;CACvC,GAAG,wBAAwB,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;AAExE,MAAM,MAAM,mBAAmB,CAC7B,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,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAC1C,OAAO,CACR,CAAC;AAEF,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,cAAc,CAAC,KAAK,CAAC,EACrB,MAAM,EACN,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAC1C,OAAO,CACR,EACD,YAAY,CACb,CAAC;CACH,GAAG,8BAA8B,GAChC,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;AAE7C;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,SAAS,maAenB,eAAe,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,KAAQ,oBAClD,KAAK,EACL,MAAM,EACN,UAAU,CACX,GACC,4BAgOD,CAAC"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { type UseMutationOptions
|
|
1
|
+
import { type UseMutationOptions } from "@tanstack/react-query";
|
|
2
2
|
import type { BaseRecord, CreateResponse, HttpError, IQueryKeys, MetaQuery } from "../../contexts/data/types";
|
|
3
|
+
import type { UseMutationResult } from "../../definitions/types";
|
|
3
4
|
import type { SuccessErrorNotification } from "../../contexts/notification/types";
|
|
4
5
|
import { type UseLoadingOvertimeOptionsProps, type UseLoadingOvertimeReturnType } from "../useLoadingOvertime";
|
|
5
6
|
export type UseCreateParams<TData, TError, TVariables> = {
|
|
6
7
|
/**
|
|
7
8
|
* Resource name for API data interactions
|
|
8
9
|
*/
|
|
9
|
-
resource
|
|
10
|
+
resource?: string;
|
|
10
11
|
/**
|
|
11
12
|
* Values for mutation function
|
|
12
13
|
*/
|
|
13
|
-
values
|
|
14
|
+
values?: TVariables;
|
|
14
15
|
/**
|
|
15
16
|
* Meta data for `dataProvider`
|
|
16
17
|
*/
|
|
@@ -31,8 +32,8 @@ export type UseCreateParams<TData, TError, TVariables> = {
|
|
|
31
32
|
} & SuccessErrorNotification<CreateResponse<TData>, TError, TVariables>;
|
|
32
33
|
export type UseCreateReturnType<TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}> = UseMutationResult<CreateResponse<TData>, TError, UseCreateParams<TData, TError, TVariables>, unknown>;
|
|
33
34
|
export type UseCreateProps<TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}> = {
|
|
34
|
-
mutationOptions?: Omit<UseMutationOptions<CreateResponse<TData>, TError, UseCreateParams<TData, TError, TVariables>, unknown>, "mutationFn"
|
|
35
|
-
} & UseLoadingOvertimeOptionsProps
|
|
35
|
+
mutationOptions?: Omit<UseMutationOptions<CreateResponse<TData>, TError, UseCreateParams<TData, TError, TVariables>, unknown>, "mutationFn">;
|
|
36
|
+
} & UseLoadingOvertimeOptionsProps & UseCreateParams<TData, TError, TVariables>;
|
|
36
37
|
/**
|
|
37
38
|
* `useCreate` is a modified version of `react-query`'s {@link https://react-query.tanstack.com/reference/useMutation `useMutation`} for create mutations.
|
|
38
39
|
*
|
|
@@ -45,5 +46,5 @@ export type UseCreateProps<TData extends BaseRecord = BaseRecord, TError extends
|
|
|
45
46
|
* @typeParam TVariables - Values for mutation function
|
|
46
47
|
*
|
|
47
48
|
*/
|
|
48
|
-
export declare const useCreate: <TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}>({ mutationOptions, overtimeOptions, }?: UseCreateProps<TData, TError, TVariables>) => UseCreateReturnType<TData, TError, TVariables> & UseLoadingOvertimeReturnType;
|
|
49
|
+
export declare const useCreate: <TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}>({ resource: resourceFromProps, values: valuesFromProps, dataProviderName: dataProviderNameFromProps, successNotification: successNotificationFromProps, errorNotification: errorNotificationFromProps, invalidates: invalidatesFromProps, meta: metaFromProps, metaData: metaDataFromProps, mutationOptions, overtimeOptions, }?: UseCreateProps<TData, TError, TVariables>) => UseCreateReturnType<TData, TError, TVariables> & UseLoadingOvertimeReturnType;
|
|
49
50
|
//# sourceMappingURL=useCreate.d.ts.map
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { type UseMutationOptions
|
|
1
|
+
import { type UseMutationOptions } from "@tanstack/react-query";
|
|
2
2
|
import type { BaseRecord, CreateResponse, HttpError, IQueryKeys, MetaQuery } from "../../contexts/data/types";
|
|
3
|
+
import type { UseMutationResult } from "../../definitions/types";
|
|
3
4
|
import type { SuccessErrorNotification } from "../../contexts/notification/types";
|
|
4
5
|
import { type UseLoadingOvertimeOptionsProps, type UseLoadingOvertimeReturnType } from "../useLoadingOvertime";
|
|
5
6
|
export type UseCreateParams<TData, TError, TVariables> = {
|
|
6
7
|
/**
|
|
7
8
|
* Resource name for API data interactions
|
|
8
9
|
*/
|
|
9
|
-
resource
|
|
10
|
+
resource?: string;
|
|
10
11
|
/**
|
|
11
12
|
* Values for mutation function
|
|
12
13
|
*/
|
|
13
|
-
values
|
|
14
|
+
values?: TVariables;
|
|
14
15
|
/**
|
|
15
16
|
* Meta data for `dataProvider`
|
|
16
17
|
*/
|
|
@@ -31,8 +32,8 @@ export type UseCreateParams<TData, TError, TVariables> = {
|
|
|
31
32
|
} & SuccessErrorNotification<CreateResponse<TData>, TError, TVariables>;
|
|
32
33
|
export type UseCreateReturnType<TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}> = UseMutationResult<CreateResponse<TData>, TError, UseCreateParams<TData, TError, TVariables>, unknown>;
|
|
33
34
|
export type UseCreateProps<TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}> = {
|
|
34
|
-
mutationOptions?: Omit<UseMutationOptions<CreateResponse<TData>, TError, UseCreateParams<TData, TError, TVariables>, unknown>, "mutationFn"
|
|
35
|
-
} & UseLoadingOvertimeOptionsProps
|
|
35
|
+
mutationOptions?: Omit<UseMutationOptions<CreateResponse<TData>, TError, UseCreateParams<TData, TError, TVariables>, unknown>, "mutationFn">;
|
|
36
|
+
} & UseLoadingOvertimeOptionsProps & UseCreateParams<TData, TError, TVariables>;
|
|
36
37
|
/**
|
|
37
38
|
* `useCreate` is a modified version of `react-query`'s {@link https://react-query.tanstack.com/reference/useMutation `useMutation`} for create mutations.
|
|
38
39
|
*
|
|
@@ -45,5 +46,5 @@ export type UseCreateProps<TData extends BaseRecord = BaseRecord, TError extends
|
|
|
45
46
|
* @typeParam TVariables - Values for mutation function
|
|
46
47
|
*
|
|
47
48
|
*/
|
|
48
|
-
export declare const useCreate: <TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}>({ mutationOptions, overtimeOptions, }?: UseCreateProps<TData, TError, TVariables>) => UseCreateReturnType<TData, TError, TVariables> & UseLoadingOvertimeReturnType;
|
|
49
|
+
export declare const useCreate: <TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}>({ resource: resourceFromProps, values: valuesFromProps, dataProviderName: dataProviderNameFromProps, successNotification: successNotificationFromProps, errorNotification: errorNotificationFromProps, invalidates: invalidatesFromProps, meta: metaFromProps, metaData: metaDataFromProps, mutationOptions, overtimeOptions, }?: UseCreateProps<TData, TError, TVariables>) => UseCreateReturnType<TData, TError, TVariables> & UseLoadingOvertimeReturnType;
|
|
49
50
|
//# sourceMappingURL=useCreate.d.ts.map
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { type UseMutationOptions
|
|
1
|
+
import { type UseMutationOptions } from "@tanstack/react-query";
|
|
2
2
|
import type { BaseRecord, CreateResponse, HttpError, IQueryKeys, MetaQuery } from "../../contexts/data/types";
|
|
3
|
+
import type { UseMutationResult } from "../../definitions/types";
|
|
3
4
|
import type { SuccessErrorNotification } from "../../contexts/notification/types";
|
|
4
5
|
import { type UseLoadingOvertimeOptionsProps, type UseLoadingOvertimeReturnType } from "../useLoadingOvertime";
|
|
5
6
|
export type UseCreateParams<TData, TError, TVariables> = {
|
|
6
7
|
/**
|
|
7
8
|
* Resource name for API data interactions
|
|
8
9
|
*/
|
|
9
|
-
resource
|
|
10
|
+
resource?: string;
|
|
10
11
|
/**
|
|
11
12
|
* Values for mutation function
|
|
12
13
|
*/
|
|
13
|
-
values
|
|
14
|
+
values?: TVariables;
|
|
14
15
|
/**
|
|
15
16
|
* Meta data for `dataProvider`
|
|
16
17
|
*/
|
|
@@ -31,8 +32,8 @@ export type UseCreateParams<TData, TError, TVariables> = {
|
|
|
31
32
|
} & SuccessErrorNotification<CreateResponse<TData>, TError, TVariables>;
|
|
32
33
|
export type UseCreateReturnType<TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}> = UseMutationResult<CreateResponse<TData>, TError, UseCreateParams<TData, TError, TVariables>, unknown>;
|
|
33
34
|
export type UseCreateProps<TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}> = {
|
|
34
|
-
mutationOptions?: Omit<UseMutationOptions<CreateResponse<TData>, TError, UseCreateParams<TData, TError, TVariables>, unknown>, "mutationFn"
|
|
35
|
-
} & UseLoadingOvertimeOptionsProps
|
|
35
|
+
mutationOptions?: Omit<UseMutationOptions<CreateResponse<TData>, TError, UseCreateParams<TData, TError, TVariables>, unknown>, "mutationFn">;
|
|
36
|
+
} & UseLoadingOvertimeOptionsProps & UseCreateParams<TData, TError, TVariables>;
|
|
36
37
|
/**
|
|
37
38
|
* `useCreate` is a modified version of `react-query`'s {@link https://react-query.tanstack.com/reference/useMutation `useMutation`} for create mutations.
|
|
38
39
|
*
|
|
@@ -45,5 +46,5 @@ export type UseCreateProps<TData extends BaseRecord = BaseRecord, TError extends
|
|
|
45
46
|
* @typeParam TVariables - Values for mutation function
|
|
46
47
|
*
|
|
47
48
|
*/
|
|
48
|
-
export declare const useCreate: <TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}>({ mutationOptions, overtimeOptions, }?: UseCreateProps<TData, TError, TVariables>) => UseCreateReturnType<TData, TError, TVariables> & UseLoadingOvertimeReturnType;
|
|
49
|
+
export declare const useCreate: <TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}>({ resource: resourceFromProps, values: valuesFromProps, dataProviderName: dataProviderNameFromProps, successNotification: successNotificationFromProps, errorNotification: errorNotificationFromProps, invalidates: invalidatesFromProps, meta: metaFromProps, metaData: metaDataFromProps, mutationOptions, overtimeOptions, }?: UseCreateProps<TData, TError, TVariables>) => UseCreateReturnType<TData, TError, TVariables> & UseLoadingOvertimeReturnType;
|
|
49
50
|
//# sourceMappingURL=useCreate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreate.d.ts","sourceRoot":"","sources":["../../../src/hooks/data/useCreate.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"useCreate.d.ts","sourceRoot":"","sources":["../../../src/hooks/data/useCreate.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,kBAAkB,EAGxB,MAAM,uBAAuB,CAAC;AAgB/B,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,SAAS,EACT,UAAU,EACV,SAAS,EACV,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,EACL,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EAElC,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,IAAI;IACvD;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,UAAU,CAAC,CAAC;CACvC,GAAG,wBAAwB,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;AAExE,MAAM,MAAM,mBAAmB,CAC7B,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,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAC1C,OAAO,CACR,CAAC;AAEF,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,cAAc,CAAC,KAAK,CAAC,EACrB,MAAM,EACN,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAC1C,OAAO,CACR,EACD,YAAY,CACb,CAAC;CACH,GAAG,8BAA8B,GAChC,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;AAE7C;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,SAAS,maAenB,eAAe,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,KAAQ,oBAClD,KAAK,EACL,MAAM,EACN,UAAU,CACX,GACC,4BAgOD,CAAC"}
|