@refinedev/core 4.44.3 → 4.44.5
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 +104 -0
- package/dist/contexts/live/ILiveContext.d.ts +9 -0
- package/dist/contexts/live/ILiveContext.d.ts.map +1 -1
- package/dist/esm/index.js +6 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/hooks/data/useCreate.d.ts +1 -1
- package/dist/hooks/data/useCreate.d.ts.map +1 -1
- package/dist/hooks/data/useCreateMany.d.ts +1 -1
- package/dist/hooks/data/useCreateMany.d.ts.map +1 -1
- package/dist/hooks/data/useDelete.d.ts +2 -2
- package/dist/hooks/data/useDelete.d.ts.map +1 -1
- package/dist/hooks/data/useDeleteMany.d.ts +2 -2
- package/dist/hooks/data/useDeleteMany.d.ts.map +1 -1
- package/dist/hooks/data/useInfiniteList.d.ts +2 -2
- package/dist/hooks/data/useInfiniteList.d.ts.map +1 -1
- package/dist/hooks/data/useList.d.ts +1 -1
- package/dist/hooks/data/useList.d.ts.map +1 -1
- package/dist/hooks/data/useMany.d.ts +1 -1
- package/dist/hooks/data/useMany.d.ts.map +1 -1
- package/dist/hooks/data/useOne.d.ts +1 -1
- package/dist/hooks/data/useOne.d.ts.map +1 -1
- package/dist/hooks/data/useUpdate.d.ts +1 -1
- package/dist/hooks/data/useUpdate.d.ts.map +1 -1
- package/dist/hooks/data/useUpdateMany.d.ts +1 -1
- package/dist/hooks/data/useUpdateMany.d.ts.map +1 -1
- package/dist/hooks/live/useResourceSubscription/index.d.ts +10 -1
- package/dist/hooks/live/useResourceSubscription/index.d.ts.map +1 -1
- package/dist/hooks/live/useSubscription/index.d.ts +8 -3
- package/dist/hooks/live/useSubscription/index.d.ts.map +1 -1
- package/dist/iife/index.js +5 -5
- package/dist/iife/index.js.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/interfaces/live/LiveEvent.d.ts +4 -1
- package/dist/interfaces/live/LiveEvent.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/contexts/live/ILiveContext.ts +7 -0
- package/src/hooks/data/useCreate.ts +45 -41
- package/src/hooks/data/useCreateMany.ts +41 -38
- package/src/hooks/data/useDelete.ts +48 -40
- package/src/hooks/data/useDeleteMany.ts +52 -43
- package/src/hooks/data/useInfiniteList.ts +30 -27
- package/src/hooks/data/useList.ts +26 -23
- package/src/hooks/data/useMany.ts +23 -20
- package/src/hooks/data/useOne.ts +23 -20
- package/src/hooks/data/useUpdate.ts +52 -39
- package/src/hooks/data/useUpdateMany.ts +48 -40
- package/src/hooks/live/useResourceSubscription/index.ts +23 -6
- package/src/hooks/live/useSubscription/index.ts +10 -2
- package/src/interfaces/live/LiveEvent.ts +4 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseKey } from "..";
|
|
1
|
+
import { BaseKey, MetaQuery } from "..";
|
|
2
2
|
export declare type LiveEvent = {
|
|
3
3
|
channel: string;
|
|
4
4
|
type: "deleted" | "updated" | "created" | "*" | string;
|
|
@@ -7,5 +7,8 @@ export declare type LiveEvent = {
|
|
|
7
7
|
[x: string]: any;
|
|
8
8
|
};
|
|
9
9
|
date: Date;
|
|
10
|
+
meta?: MetaQuery & {
|
|
11
|
+
dataProviderName?: string;
|
|
12
|
+
};
|
|
10
13
|
};
|
|
11
14
|
//# sourceMappingURL=LiveEvent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiveEvent.d.ts","sourceRoot":"","sources":["../../../src/interfaces/live/LiveEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"LiveEvent.d.ts","sourceRoot":"","sources":["../../../src/interfaces/live/LiveEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAExC,oBAAY,SAAS,GAAG;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,GAAG,GAAG,MAAM,CAAC;IACvD,OAAO,EAAE;QACL,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC;QAChB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;IACF,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,CAAC,EAAE,SAAS,GAAG;QACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC7B,CAAC;CACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refinedev/core",
|
|
3
|
-
"version": "4.44.
|
|
3
|
+
"version": "4.44.5",
|
|
4
4
|
"description": "refine is a React-based framework for building internal tools, rapidly. It ships with Ant Design System, an enterprise-level UI toolkit.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -15,6 +15,9 @@ export type ILiveContext =
|
|
|
15
15
|
params?: {
|
|
16
16
|
ids?: BaseKey[];
|
|
17
17
|
id?: BaseKey;
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated `params.meta` is depcerated. Use `meta` directly from the root level instead.
|
|
20
|
+
*/
|
|
18
21
|
meta?: MetaQuery;
|
|
19
22
|
/**
|
|
20
23
|
* @deprecated `metaData` is deprecated with refine@4, refine will pass `meta` instead, however, we still support `metaData` for backward compatibility.
|
|
@@ -36,7 +39,11 @@ export type ILiveContext =
|
|
|
36
39
|
[key: string]: any;
|
|
37
40
|
};
|
|
38
41
|
types: LiveEvent["type"][];
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated use `meta.dataProviderName` instead.
|
|
44
|
+
*/
|
|
39
45
|
dataProviderName?: string;
|
|
46
|
+
meta?: MetaQuery & { dataProviderName?: string };
|
|
40
47
|
callback: (event: LiveEvent) => void;
|
|
41
48
|
}) => any;
|
|
42
49
|
unsubscribe: (subscription: any) => void;
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useMutation,
|
|
3
|
-
UseMutationOptions,
|
|
4
|
-
UseMutationResult,
|
|
5
|
-
} from "@tanstack/react-query";
|
|
6
|
-
import { getXRay } from "@refinedev/devtools-internal";
|
|
7
1
|
import {
|
|
8
2
|
pickDataProvider,
|
|
9
3
|
pickNotDeprecated,
|
|
10
4
|
useActiveAuthProvider,
|
|
11
5
|
} from "@definitions/helpers";
|
|
12
|
-
|
|
6
|
+
import { getXRay } from "@refinedev/devtools-internal";
|
|
13
7
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
IQueryKeys,
|
|
20
|
-
} from "../../interfaces";
|
|
8
|
+
useMutation,
|
|
9
|
+
UseMutationOptions,
|
|
10
|
+
UseMutationResult,
|
|
11
|
+
} from "@tanstack/react-query";
|
|
12
|
+
|
|
21
13
|
import {
|
|
22
|
-
useResource,
|
|
23
|
-
useTranslate,
|
|
24
|
-
usePublish,
|
|
25
|
-
useHandleNotification,
|
|
26
14
|
useDataProvider,
|
|
27
|
-
|
|
15
|
+
useHandleNotification,
|
|
28
16
|
useInvalidate,
|
|
29
|
-
|
|
17
|
+
useLog,
|
|
30
18
|
useMeta,
|
|
19
|
+
useOnError,
|
|
20
|
+
usePublish,
|
|
31
21
|
useRefineContext,
|
|
22
|
+
useResource,
|
|
23
|
+
useTranslate,
|
|
32
24
|
} from "@hooks";
|
|
25
|
+
import { useKeys } from "@hooks/useKeys";
|
|
26
|
+
import {
|
|
27
|
+
BaseRecord,
|
|
28
|
+
CreateResponse,
|
|
29
|
+
HttpError,
|
|
30
|
+
IQueryKeys,
|
|
31
|
+
MetaQuery,
|
|
32
|
+
SuccessErrorNotification,
|
|
33
|
+
} from "../../interfaces";
|
|
33
34
|
import {
|
|
34
35
|
useLoadingOvertime,
|
|
35
36
|
UseLoadingOvertimeOptionsProps,
|
|
36
37
|
UseLoadingOvertimeReturnType,
|
|
37
38
|
} from "../useLoadingOvertime";
|
|
38
|
-
import { useKeys } from "@hooks/useKeys";
|
|
39
39
|
|
|
40
40
|
type useCreateParams<TData, TError, TVariables> = {
|
|
41
41
|
/**
|
|
@@ -170,7 +170,7 @@ export const useCreate = <
|
|
|
170
170
|
{
|
|
171
171
|
resource: resourceName,
|
|
172
172
|
successNotification: successNotificationFromProp,
|
|
173
|
-
dataProviderName,
|
|
173
|
+
dataProviderName: dataProviderNameFromProp,
|
|
174
174
|
invalidates = ["list", "many"],
|
|
175
175
|
values,
|
|
176
176
|
meta,
|
|
@@ -178,9 +178,19 @@ export const useCreate = <
|
|
|
178
178
|
},
|
|
179
179
|
) => {
|
|
180
180
|
const { resource, identifier } = select(resourceName);
|
|
181
|
-
|
|
182
181
|
const resourceSingular = textTransformers.singular(identifier);
|
|
183
182
|
|
|
183
|
+
const dataProviderName = pickDataProvider(
|
|
184
|
+
identifier,
|
|
185
|
+
dataProviderNameFromProp,
|
|
186
|
+
resources,
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
const combinedMeta = getMeta({
|
|
190
|
+
resource,
|
|
191
|
+
meta: pickNotDeprecated(meta, metaData),
|
|
192
|
+
});
|
|
193
|
+
|
|
184
194
|
const notificationConfig =
|
|
185
195
|
typeof successNotificationFromProp === "function"
|
|
186
196
|
? successNotificationFromProp(data, values, identifier)
|
|
@@ -204,11 +214,7 @@ export const useCreate = <
|
|
|
204
214
|
|
|
205
215
|
invalidateStore({
|
|
206
216
|
resource: identifier,
|
|
207
|
-
dataProviderName
|
|
208
|
-
identifier,
|
|
209
|
-
dataProviderName,
|
|
210
|
-
resources,
|
|
211
|
-
),
|
|
217
|
+
dataProviderName,
|
|
212
218
|
invalidates,
|
|
213
219
|
});
|
|
214
220
|
|
|
@@ -219,26 +225,24 @@ export const useCreate = <
|
|
|
219
225
|
ids: data?.data?.id ? [data.data.id] : undefined,
|
|
220
226
|
},
|
|
221
227
|
date: new Date(),
|
|
228
|
+
meta: {
|
|
229
|
+
...combinedMeta,
|
|
230
|
+
dataProviderName,
|
|
231
|
+
},
|
|
222
232
|
});
|
|
223
233
|
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
combinedMeta || {};
|
|
231
|
-
|
|
234
|
+
const {
|
|
235
|
+
fields: _fields,
|
|
236
|
+
operation: _operation,
|
|
237
|
+
variables: _variables,
|
|
238
|
+
...rest
|
|
239
|
+
} = combinedMeta || {};
|
|
232
240
|
log?.mutate({
|
|
233
241
|
action: "create",
|
|
234
242
|
resource: resource.name,
|
|
235
243
|
data: values,
|
|
236
244
|
meta: {
|
|
237
|
-
dataProviderName
|
|
238
|
-
identifier,
|
|
239
|
-
dataProviderName,
|
|
240
|
-
resources,
|
|
241
|
-
),
|
|
245
|
+
dataProviderName,
|
|
242
246
|
id: data?.data?.id ?? undefined,
|
|
243
247
|
...rest,
|
|
244
248
|
},
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
+
import { getXRay } from "@refinedev/devtools-internal";
|
|
1
2
|
import {
|
|
2
3
|
useMutation,
|
|
3
4
|
UseMutationOptions,
|
|
4
5
|
UseMutationResult,
|
|
5
6
|
} from "@tanstack/react-query";
|
|
6
|
-
import { getXRay } from "@refinedev/devtools-internal";
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
MetaQuery,
|
|
14
|
-
IQueryKeys,
|
|
15
|
-
} from "../../interfaces";
|
|
9
|
+
handleMultiple,
|
|
10
|
+
pickDataProvider,
|
|
11
|
+
pickNotDeprecated,
|
|
12
|
+
} from "@definitions";
|
|
16
13
|
import {
|
|
17
|
-
useResource,
|
|
18
|
-
useTranslate,
|
|
19
|
-
usePublish,
|
|
20
|
-
useHandleNotification,
|
|
21
14
|
useDataProvider,
|
|
15
|
+
useHandleNotification,
|
|
22
16
|
useInvalidate,
|
|
23
17
|
useLog,
|
|
24
18
|
useMeta,
|
|
19
|
+
usePublish,
|
|
25
20
|
useRefineContext,
|
|
21
|
+
useResource,
|
|
22
|
+
useTranslate,
|
|
26
23
|
} from "@hooks";
|
|
24
|
+
import { useKeys } from "@hooks/useKeys";
|
|
27
25
|
import {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
BaseRecord,
|
|
27
|
+
CreateManyResponse,
|
|
28
|
+
HttpError,
|
|
29
|
+
IQueryKeys,
|
|
30
|
+
MetaQuery,
|
|
31
|
+
SuccessErrorNotification,
|
|
32
|
+
} from "../../interfaces";
|
|
32
33
|
import {
|
|
33
34
|
useLoadingOvertime,
|
|
34
35
|
UseLoadingOvertimeOptionsProps,
|
|
35
36
|
UseLoadingOvertimeReturnType,
|
|
36
37
|
} from "../useLoadingOvertime";
|
|
37
|
-
import { useKeys } from "@hooks/useKeys";
|
|
38
38
|
|
|
39
39
|
type useCreateManyParams<TData, TError, TVariables> = {
|
|
40
40
|
resource: string;
|
|
@@ -158,7 +158,7 @@ export const useCreateMany = <
|
|
|
158
158
|
{
|
|
159
159
|
resource: resourceName,
|
|
160
160
|
successNotification,
|
|
161
|
-
dataProviderName,
|
|
161
|
+
dataProviderName: dataProviderNameFromProp,
|
|
162
162
|
invalidates = ["list", "many"],
|
|
163
163
|
values,
|
|
164
164
|
meta,
|
|
@@ -166,9 +166,19 @@ export const useCreateMany = <
|
|
|
166
166
|
},
|
|
167
167
|
) => {
|
|
168
168
|
const { resource, identifier } = select(resourceName);
|
|
169
|
-
|
|
170
169
|
const resourcePlural = textTransformers.plural(identifier);
|
|
171
170
|
|
|
171
|
+
const dataProviderName = pickDataProvider(
|
|
172
|
+
identifier,
|
|
173
|
+
dataProviderNameFromProp,
|
|
174
|
+
resources,
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
const combinedMeta = getMeta({
|
|
178
|
+
resource,
|
|
179
|
+
meta: pickNotDeprecated(meta, metaData),
|
|
180
|
+
});
|
|
181
|
+
|
|
172
182
|
const notificationConfig =
|
|
173
183
|
typeof successNotification === "function"
|
|
174
184
|
? successNotification(response, values, identifier)
|
|
@@ -192,18 +202,13 @@ export const useCreateMany = <
|
|
|
192
202
|
|
|
193
203
|
invalidateStore({
|
|
194
204
|
resource: identifier,
|
|
195
|
-
dataProviderName
|
|
196
|
-
identifier,
|
|
197
|
-
dataProviderName,
|
|
198
|
-
resources,
|
|
199
|
-
),
|
|
205
|
+
dataProviderName,
|
|
200
206
|
invalidates,
|
|
201
207
|
});
|
|
202
208
|
|
|
203
209
|
const ids = response?.data
|
|
204
210
|
.filter((item) => item?.id !== undefined)
|
|
205
211
|
.map((item) => item.id!);
|
|
206
|
-
|
|
207
212
|
publish?.({
|
|
208
213
|
channel: `resources/${resource.name}`,
|
|
209
214
|
type: "created",
|
|
@@ -211,26 +216,24 @@ export const useCreateMany = <
|
|
|
211
216
|
ids,
|
|
212
217
|
},
|
|
213
218
|
date: new Date(),
|
|
219
|
+
meta: {
|
|
220
|
+
...combinedMeta,
|
|
221
|
+
dataProviderName,
|
|
222
|
+
},
|
|
214
223
|
});
|
|
215
224
|
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
combinedMeta || {};
|
|
223
|
-
|
|
225
|
+
const {
|
|
226
|
+
fields: _fields,
|
|
227
|
+
operation: _operation,
|
|
228
|
+
variables: _variables,
|
|
229
|
+
...rest
|
|
230
|
+
} = combinedMeta || {};
|
|
224
231
|
log?.mutate({
|
|
225
232
|
action: "createMany",
|
|
226
233
|
resource: resource.name,
|
|
227
234
|
data: values,
|
|
228
235
|
meta: {
|
|
229
|
-
dataProviderName
|
|
230
|
-
identifier,
|
|
231
|
-
dataProviderName,
|
|
232
|
-
resources,
|
|
233
|
-
),
|
|
236
|
+
dataProviderName,
|
|
234
237
|
ids,
|
|
235
238
|
...rest,
|
|
236
239
|
},
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
+
import { getXRay } from "@refinedev/devtools-internal";
|
|
1
2
|
import {
|
|
2
|
-
useQueryClient,
|
|
3
3
|
useMutation,
|
|
4
|
-
UseMutationResult,
|
|
5
4
|
UseMutationOptions,
|
|
5
|
+
UseMutationResult,
|
|
6
|
+
useQueryClient,
|
|
6
7
|
} from "@tanstack/react-query";
|
|
7
|
-
import { getXRay } from "@refinedev/devtools-internal";
|
|
8
8
|
|
|
9
|
+
import { ActionTypes } from "@contexts/undoableQueue";
|
|
10
|
+
import {
|
|
11
|
+
pickDataProvider,
|
|
12
|
+
pickNotDeprecated,
|
|
13
|
+
queryKeysReplacement,
|
|
14
|
+
useActiveAuthProvider,
|
|
15
|
+
} from "@definitions/helpers";
|
|
9
16
|
import {
|
|
10
|
-
useResource,
|
|
11
|
-
useMutationMode,
|
|
12
17
|
useCancelNotification,
|
|
13
|
-
useTranslate,
|
|
14
|
-
usePublish,
|
|
15
|
-
useHandleNotification,
|
|
16
18
|
useDataProvider,
|
|
17
|
-
|
|
19
|
+
useHandleNotification,
|
|
18
20
|
useInvalidate,
|
|
19
|
-
|
|
21
|
+
useLog,
|
|
20
22
|
useMeta,
|
|
23
|
+
useMutationMode,
|
|
24
|
+
useOnError,
|
|
25
|
+
usePublish,
|
|
21
26
|
useRefineContext,
|
|
27
|
+
useResource,
|
|
28
|
+
useTranslate,
|
|
22
29
|
} from "@hooks";
|
|
23
|
-
import {
|
|
30
|
+
import { useKeys } from "@hooks/useKeys";
|
|
24
31
|
import {
|
|
25
|
-
DeleteOneResponse,
|
|
26
|
-
MutationMode,
|
|
27
|
-
PrevContext as DeleteContext,
|
|
28
|
-
BaseRecord,
|
|
29
32
|
BaseKey,
|
|
30
|
-
|
|
33
|
+
BaseRecord,
|
|
34
|
+
DeleteOneResponse,
|
|
31
35
|
GetListResponse,
|
|
32
|
-
|
|
33
|
-
PreviousQuery,
|
|
36
|
+
HttpError,
|
|
34
37
|
IQueryKeys,
|
|
35
38
|
MetaQuery,
|
|
39
|
+
MutationMode,
|
|
40
|
+
PrevContext as DeleteContext,
|
|
41
|
+
PreviousQuery,
|
|
42
|
+
SuccessErrorNotification,
|
|
36
43
|
} from "../../interfaces";
|
|
37
|
-
import {
|
|
38
|
-
queryKeysReplacement,
|
|
39
|
-
pickDataProvider,
|
|
40
|
-
pickNotDeprecated,
|
|
41
|
-
useActiveAuthProvider,
|
|
42
|
-
} from "@definitions/helpers";
|
|
43
44
|
import {
|
|
44
45
|
useLoadingOvertime,
|
|
45
46
|
UseLoadingOvertimeOptionsProps,
|
|
46
47
|
UseLoadingOvertimeReturnType,
|
|
47
48
|
} from "../useLoadingOvertime";
|
|
48
|
-
import { useKeys } from "@hooks/useKeys";
|
|
49
49
|
|
|
50
50
|
export type DeleteParams<TData, TError, TVariables> = {
|
|
51
51
|
/**
|
|
@@ -384,16 +384,26 @@ export const useDelete = <
|
|
|
384
384
|
id,
|
|
385
385
|
resource: resourceName,
|
|
386
386
|
successNotification,
|
|
387
|
-
dataProviderName,
|
|
387
|
+
dataProviderName: dataProviderNameFromProp,
|
|
388
388
|
meta,
|
|
389
389
|
metaData,
|
|
390
390
|
},
|
|
391
391
|
context,
|
|
392
392
|
) => {
|
|
393
393
|
const { resource, identifier } = select(resourceName);
|
|
394
|
-
|
|
395
394
|
const resourceSingular = textTransformers.singular(identifier);
|
|
396
395
|
|
|
396
|
+
const dataProviderName = pickDataProvider(
|
|
397
|
+
identifier,
|
|
398
|
+
dataProviderNameFromProp,
|
|
399
|
+
resources,
|
|
400
|
+
);
|
|
401
|
+
|
|
402
|
+
const combinedMeta = getMeta({
|
|
403
|
+
resource,
|
|
404
|
+
meta: pickNotDeprecated(meta, metaData),
|
|
405
|
+
});
|
|
406
|
+
|
|
397
407
|
// Remove the queries from the cache:
|
|
398
408
|
queryClient.removeQueries(context?.queryKey.detail(id));
|
|
399
409
|
|
|
@@ -425,26 +435,24 @@ export const useDelete = <
|
|
|
425
435
|
ids: [id],
|
|
426
436
|
},
|
|
427
437
|
date: new Date(),
|
|
438
|
+
meta: {
|
|
439
|
+
...combinedMeta,
|
|
440
|
+
dataProviderName,
|
|
441
|
+
},
|
|
428
442
|
});
|
|
429
443
|
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
combinedMeta || {};
|
|
437
|
-
|
|
444
|
+
const {
|
|
445
|
+
fields: _fields,
|
|
446
|
+
operation: _operation,
|
|
447
|
+
variables: _variables,
|
|
448
|
+
...rest
|
|
449
|
+
} = combinedMeta || {};
|
|
438
450
|
log?.mutate({
|
|
439
451
|
action: "delete",
|
|
440
452
|
resource: resource.name,
|
|
441
453
|
meta: {
|
|
442
454
|
id,
|
|
443
|
-
dataProviderName
|
|
444
|
-
identifier,
|
|
445
|
-
dataProviderName,
|
|
446
|
-
resources,
|
|
447
|
-
),
|
|
455
|
+
dataProviderName,
|
|
448
456
|
...rest,
|
|
449
457
|
},
|
|
450
458
|
});
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
+
import { getXRay } from "@refinedev/devtools-internal";
|
|
1
2
|
import {
|
|
2
|
-
useQueryClient,
|
|
3
3
|
useMutation,
|
|
4
|
-
UseMutationResult,
|
|
5
4
|
UseMutationOptions,
|
|
5
|
+
UseMutationResult,
|
|
6
|
+
useQueryClient,
|
|
6
7
|
} from "@tanstack/react-query";
|
|
7
|
-
import { getXRay } from "@refinedev/devtools-internal";
|
|
8
8
|
|
|
9
|
+
import { ActionTypes } from "@contexts/undoableQueue";
|
|
9
10
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
GetListResponse,
|
|
17
|
-
PrevContext as DeleteContext,
|
|
18
|
-
SuccessErrorNotification,
|
|
19
|
-
MetaQuery,
|
|
20
|
-
IQueryKeys,
|
|
21
|
-
} from "../../interfaces";
|
|
11
|
+
handleMultiple,
|
|
12
|
+
pickDataProvider,
|
|
13
|
+
pickNotDeprecated,
|
|
14
|
+
queryKeysReplacement,
|
|
15
|
+
useActiveAuthProvider,
|
|
16
|
+
} from "@definitions";
|
|
22
17
|
import {
|
|
23
|
-
useResource,
|
|
24
|
-
useTranslate,
|
|
25
|
-
useMutationMode,
|
|
26
18
|
useCancelNotification,
|
|
27
|
-
usePublish,
|
|
28
|
-
useHandleNotification,
|
|
29
19
|
useDataProvider,
|
|
20
|
+
useHandleNotification,
|
|
30
21
|
useInvalidate,
|
|
31
22
|
useLog,
|
|
32
|
-
useOnError,
|
|
33
23
|
useMeta,
|
|
24
|
+
useMutationMode,
|
|
25
|
+
useOnError,
|
|
26
|
+
usePublish,
|
|
34
27
|
useRefineContext,
|
|
28
|
+
useResource,
|
|
29
|
+
useTranslate,
|
|
35
30
|
} from "@hooks";
|
|
36
|
-
import {
|
|
31
|
+
import { useKeys } from "@hooks/useKeys";
|
|
37
32
|
import {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
BaseKey,
|
|
34
|
+
BaseRecord,
|
|
35
|
+
DeleteManyResponse,
|
|
36
|
+
GetListResponse,
|
|
37
|
+
HttpError,
|
|
38
|
+
IQueryKeys,
|
|
39
|
+
MetaQuery,
|
|
40
|
+
MutationMode,
|
|
41
|
+
PrevContext as DeleteContext,
|
|
42
|
+
PreviousQuery,
|
|
43
|
+
SuccessErrorNotification,
|
|
44
|
+
} from "../../interfaces";
|
|
44
45
|
import {
|
|
45
46
|
useLoadingOvertime,
|
|
46
47
|
UseLoadingOvertimeOptionsProps,
|
|
47
48
|
UseLoadingOvertimeReturnType,
|
|
48
49
|
} from "../useLoadingOvertime";
|
|
49
|
-
import { useKeys } from "@hooks/useKeys";
|
|
50
50
|
|
|
51
51
|
export type DeleteManyParams<TData, TError, TVariables> = {
|
|
52
52
|
/**
|
|
@@ -418,13 +418,24 @@ export const useDeleteMany = <
|
|
|
418
418
|
resource: resourceName,
|
|
419
419
|
meta,
|
|
420
420
|
metaData,
|
|
421
|
-
dataProviderName,
|
|
421
|
+
dataProviderName: dataProviderNameFromProp,
|
|
422
422
|
successNotification,
|
|
423
423
|
},
|
|
424
424
|
context,
|
|
425
425
|
) => {
|
|
426
426
|
const { resource, identifier } = select(resourceName);
|
|
427
427
|
|
|
428
|
+
const dataProviderName = pickDataProvider(
|
|
429
|
+
identifier,
|
|
430
|
+
dataProviderNameFromProp,
|
|
431
|
+
resources,
|
|
432
|
+
);
|
|
433
|
+
|
|
434
|
+
const combinedMeta = getMeta({
|
|
435
|
+
resource,
|
|
436
|
+
meta: pickNotDeprecated(meta, metaData),
|
|
437
|
+
});
|
|
438
|
+
|
|
428
439
|
// Remove the queries from the cache:
|
|
429
440
|
ids.forEach((id) =>
|
|
430
441
|
queryClient.removeQueries(context?.queryKey.detail(id)),
|
|
@@ -456,26 +467,24 @@ export const useDeleteMany = <
|
|
|
456
467
|
type: "deleted",
|
|
457
468
|
payload: { ids },
|
|
458
469
|
date: new Date(),
|
|
470
|
+
meta: {
|
|
471
|
+
...combinedMeta,
|
|
472
|
+
dataProviderName,
|
|
473
|
+
},
|
|
459
474
|
});
|
|
460
475
|
|
|
461
|
-
const
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
combinedMeta || {};
|
|
468
|
-
|
|
476
|
+
const {
|
|
477
|
+
fields: _fields,
|
|
478
|
+
operation: _operation,
|
|
479
|
+
variables: _variables,
|
|
480
|
+
...rest
|
|
481
|
+
} = combinedMeta || {};
|
|
469
482
|
log?.mutate({
|
|
470
483
|
action: "deleteMany",
|
|
471
484
|
resource: resource.name,
|
|
472
485
|
meta: {
|
|
473
486
|
ids,
|
|
474
|
-
dataProviderName
|
|
475
|
-
identifier,
|
|
476
|
-
dataProviderName,
|
|
477
|
-
resources,
|
|
478
|
-
),
|
|
487
|
+
dataProviderName,
|
|
479
488
|
...rest,
|
|
480
489
|
},
|
|
481
490
|
});
|