@refinedev/core 5.0.7 → 5.0.8
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 +22 -0
- package/dist/contexts/auth/index.d.cts.map +1 -1
- package/dist/contexts/auth/index.d.ts.map +1 -1
- package/dist/contexts/data/types.d.cts +1 -1
- package/dist/contexts/data/types.d.cts.map +1 -1
- package/dist/contexts/data/types.d.mts +1 -1
- package/dist/contexts/data/types.d.mts.map +1 -1
- package/dist/contexts/data/types.d.ts +1 -1
- package/dist/contexts/data/types.d.ts.map +1 -1
- package/dist/hooks/router/use-get-to-path/index.d.cts.map +1 -1
- package/dist/hooks/router/use-get-to-path/index.d.ts.map +1 -1
- package/dist/index.cjs +95 -79
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +46 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/contexts/auth/index.tsx +4 -0
- package/src/contexts/data/types.ts +4 -0
- package/src/hooks/router/use-get-to-path/index.ts +24 -5
- package/tasks.md +0 -354
package/dist/index.mjs
CHANGED
|
@@ -13,10 +13,12 @@ import {
|
|
|
13
13
|
|
|
14
14
|
// src/contexts/auth/index.tsx
|
|
15
15
|
import React from "react";
|
|
16
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
16
17
|
var AuthProviderContext = React.createContext(
|
|
17
18
|
{}
|
|
18
19
|
);
|
|
19
20
|
var AuthProviderContextProvider = /* @__PURE__ */ __name(({ children, isProvided, ...authProvider }) => {
|
|
21
|
+
const queryClient = useQueryClient();
|
|
20
22
|
const handleLogin = /* @__PURE__ */ __name(async (params) => {
|
|
21
23
|
var _a;
|
|
22
24
|
try {
|
|
@@ -47,6 +49,7 @@ var AuthProviderContextProvider = /* @__PURE__ */ __name(({ children, isProvided
|
|
|
47
49
|
var _a;
|
|
48
50
|
try {
|
|
49
51
|
const result = await ((_a = authProvider.logout) == null ? void 0 : _a.call(authProvider, params));
|
|
52
|
+
queryClient.invalidateQueries();
|
|
50
53
|
return result;
|
|
51
54
|
} catch (error) {
|
|
52
55
|
console.warn(
|
|
@@ -1129,9 +1132,9 @@ import {
|
|
|
1129
1132
|
} from "@tanstack/react-query";
|
|
1130
1133
|
|
|
1131
1134
|
// src/hooks/auth/useInvalidateAuthStore/index.ts
|
|
1132
|
-
import { useQueryClient } from "@tanstack/react-query";
|
|
1135
|
+
import { useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
1133
1136
|
var useInvalidateAuthStore = /* @__PURE__ */ __name(() => {
|
|
1134
|
-
const queryClient =
|
|
1137
|
+
const queryClient = useQueryClient2();
|
|
1135
1138
|
const { keys: keys2 } = useKeys();
|
|
1136
1139
|
const invalidate = /* @__PURE__ */ __name(async () => {
|
|
1137
1140
|
await Promise.all(
|
|
@@ -2027,7 +2030,7 @@ See https://refine.dev/docs/data/hooks/use-many/#resource-`, "resourceWarningMes
|
|
|
2027
2030
|
import { getXRay as getXRay13 } from "@refinedev/devtools-internal";
|
|
2028
2031
|
import {
|
|
2029
2032
|
useMutation as useMutation7,
|
|
2030
|
-
useQueryClient as
|
|
2033
|
+
useQueryClient as useQueryClient3
|
|
2031
2034
|
} from "@tanstack/react-query";
|
|
2032
2035
|
|
|
2033
2036
|
// src/contexts/undoableQueue/types.ts
|
|
@@ -2058,7 +2061,7 @@ var useUpdate = /* @__PURE__ */ __name(({
|
|
|
2058
2061
|
const { resources, select } = useResourceParams({
|
|
2059
2062
|
resource: resourceFromProps
|
|
2060
2063
|
});
|
|
2061
|
-
const queryClient =
|
|
2064
|
+
const queryClient = useQueryClient3();
|
|
2062
2065
|
const dataProvider = useDataProvider();
|
|
2063
2066
|
const {
|
|
2064
2067
|
mutationMode: mutationModeContext,
|
|
@@ -2651,7 +2654,7 @@ var missingValuesError2 = new Error(
|
|
|
2651
2654
|
import { getXRay as getXRay15 } from "@refinedev/devtools-internal";
|
|
2652
2655
|
import {
|
|
2653
2656
|
useMutation as useMutation9,
|
|
2654
|
-
useQueryClient as
|
|
2657
|
+
useQueryClient as useQueryClient4
|
|
2655
2658
|
} from "@tanstack/react-query";
|
|
2656
2659
|
var useDelete = /* @__PURE__ */ __name(({
|
|
2657
2660
|
mutationOptions,
|
|
@@ -2660,7 +2663,7 @@ var useDelete = /* @__PURE__ */ __name(({
|
|
|
2660
2663
|
const { mutate: checkError } = useOnError();
|
|
2661
2664
|
const dataProvider = useDataProvider();
|
|
2662
2665
|
const { resources, select } = useResourceParams();
|
|
2663
|
-
const queryClient =
|
|
2666
|
+
const queryClient = useQueryClient4();
|
|
2664
2667
|
const {
|
|
2665
2668
|
mutationMode: mutationModeContext,
|
|
2666
2669
|
undoableTimeout: undoableTimeoutContext
|
|
@@ -3136,7 +3139,7 @@ var missingValuesError3 = new Error(
|
|
|
3136
3139
|
import { getXRay as getXRay17 } from "@refinedev/devtools-internal";
|
|
3137
3140
|
import {
|
|
3138
3141
|
useMutation as useMutation11,
|
|
3139
|
-
useQueryClient as
|
|
3142
|
+
useQueryClient as useQueryClient5
|
|
3140
3143
|
} from "@tanstack/react-query";
|
|
3141
3144
|
var useUpdateMany = /* @__PURE__ */ __name(({
|
|
3142
3145
|
ids: idsFromProps,
|
|
@@ -3155,7 +3158,7 @@ var useUpdateMany = /* @__PURE__ */ __name(({
|
|
|
3155
3158
|
overtimeOptions
|
|
3156
3159
|
} = {}) => {
|
|
3157
3160
|
const { resources, select } = useResourceParams();
|
|
3158
|
-
const queryClient =
|
|
3161
|
+
const queryClient = useQueryClient5();
|
|
3159
3162
|
const dataProvider = useDataProvider();
|
|
3160
3163
|
const translate = useTranslate();
|
|
3161
3164
|
const {
|
|
@@ -3572,7 +3575,7 @@ var missingValuesError4 = new Error(
|
|
|
3572
3575
|
import { getXRay as getXRay18 } from "@refinedev/devtools-internal";
|
|
3573
3576
|
import {
|
|
3574
3577
|
useMutation as useMutation12,
|
|
3575
|
-
useQueryClient as
|
|
3578
|
+
useQueryClient as useQueryClient6
|
|
3576
3579
|
} from "@tanstack/react-query";
|
|
3577
3580
|
var useDeleteMany = /* @__PURE__ */ __name(({
|
|
3578
3581
|
mutationOptions,
|
|
@@ -3591,7 +3594,7 @@ var useDeleteMany = /* @__PURE__ */ __name(({
|
|
|
3591
3594
|
const invalidateStore = useInvalidate();
|
|
3592
3595
|
const { log } = useLog();
|
|
3593
3596
|
const { resources, select } = useResourceParams();
|
|
3594
|
-
const queryClient =
|
|
3597
|
+
const queryClient = useQueryClient6();
|
|
3595
3598
|
const getMeta = useMeta();
|
|
3596
3599
|
const {
|
|
3597
3600
|
options: { textTransformers }
|
|
@@ -4325,11 +4328,11 @@ var LiveContextProvider = /* @__PURE__ */ __name(({
|
|
|
4325
4328
|
// src/hooks/invalidate/index.tsx
|
|
4326
4329
|
import { useCallback as useCallback2 } from "react";
|
|
4327
4330
|
import {
|
|
4328
|
-
useQueryClient as
|
|
4331
|
+
useQueryClient as useQueryClient7
|
|
4329
4332
|
} from "@tanstack/react-query";
|
|
4330
4333
|
var useInvalidate = /* @__PURE__ */ __name(() => {
|
|
4331
4334
|
const { resources } = useResourceParams();
|
|
4332
|
-
const queryClient =
|
|
4335
|
+
const queryClient = useQueryClient7();
|
|
4333
4336
|
const { keys: keys2 } = useKeys();
|
|
4334
4337
|
const invalidate = useCallback2(
|
|
4335
4338
|
async ({
|
|
@@ -5203,6 +5206,7 @@ __name(useResourceParams, "useResourceParams");
|
|
|
5203
5206
|
|
|
5204
5207
|
// src/hooks/router/use-get-to-path/index.ts
|
|
5205
5208
|
import React16 from "react";
|
|
5209
|
+
import warnOnce4 from "warn-once";
|
|
5206
5210
|
var useGetToPath = /* @__PURE__ */ __name(() => {
|
|
5207
5211
|
const { resource: resourceFromRoute, resources } = useResourceParams();
|
|
5208
5212
|
const parsed = useParsed();
|
|
@@ -5213,19 +5217,31 @@ var useGetToPath = /* @__PURE__ */ __name(() => {
|
|
|
5213
5217
|
if (!selectedResource) {
|
|
5214
5218
|
return void 0;
|
|
5215
5219
|
}
|
|
5216
|
-
const
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
+
const fullResource = resources.find((r) => {
|
|
5221
|
+
if (!r.identifier)
|
|
5222
|
+
return false;
|
|
5223
|
+
if (!selectedResource.identifier)
|
|
5224
|
+
return false;
|
|
5225
|
+
return r.identifier === selectedResource.identifier;
|
|
5226
|
+
}) ?? resources.find((r) => {
|
|
5227
|
+
if (!r.identifier)
|
|
5228
|
+
return false;
|
|
5229
|
+
return r.identifier === selectedResource.name;
|
|
5230
|
+
}) ?? resources.find((r) => r.name === selectedResource.name) ?? selectedResource;
|
|
5231
|
+
const actionRoutes = getActionRoutesFromResource(fullResource, resources);
|
|
5220
5232
|
const actionRoute = (_a = actionRoutes.find(
|
|
5221
5233
|
(item) => item.action === action
|
|
5222
5234
|
)) == null ? void 0 : _a.route;
|
|
5223
5235
|
if (!actionRoute) {
|
|
5236
|
+
warnOnce4(
|
|
5237
|
+
true,
|
|
5238
|
+
`[useGetToPath]: Could not find a route for the "${action}" action of the "${selectedResource.name}" resource. Please make sure that the resource has the "${action}" property defined.`
|
|
5239
|
+
);
|
|
5224
5240
|
return void 0;
|
|
5225
5241
|
}
|
|
5226
5242
|
const composed = composeRoute(
|
|
5227
5243
|
actionRoute,
|
|
5228
|
-
|
|
5244
|
+
fullResource == null ? void 0 : fullResource.meta,
|
|
5229
5245
|
parsed,
|
|
5230
5246
|
meta
|
|
5231
5247
|
);
|
|
@@ -5417,7 +5433,7 @@ var useNavigation2 = /* @__PURE__ */ __name(() => {
|
|
|
5417
5433
|
}, "useNavigation");
|
|
5418
5434
|
|
|
5419
5435
|
// src/hooks/show/index.ts
|
|
5420
|
-
import
|
|
5436
|
+
import warnOnce5 from "warn-once";
|
|
5421
5437
|
var useShow = /* @__PURE__ */ __name(({
|
|
5422
5438
|
resource: resourceFromProp,
|
|
5423
5439
|
id,
|
|
@@ -5440,7 +5456,7 @@ var useShow = /* @__PURE__ */ __name(({
|
|
|
5440
5456
|
resource,
|
|
5441
5457
|
meta
|
|
5442
5458
|
});
|
|
5443
|
-
|
|
5459
|
+
warnOnce5(
|
|
5444
5460
|
Boolean(resourceFromProp) && !showId,
|
|
5445
5461
|
idWarningMessage2(identifier, showId)
|
|
5446
5462
|
);
|
|
@@ -5671,7 +5687,7 @@ var useToPath = /* @__PURE__ */ __name(({
|
|
|
5671
5687
|
|
|
5672
5688
|
// src/components/link/index.tsx
|
|
5673
5689
|
import React19, { forwardRef, useContext as useContext20 } from "react";
|
|
5674
|
-
import
|
|
5690
|
+
import warnOnce6 from "warn-once";
|
|
5675
5691
|
var LinkComponent = /* @__PURE__ */ __name((props, ref) => {
|
|
5676
5692
|
const routerContext = useContext20(RouterContext);
|
|
5677
5693
|
const LinkFromContext = routerContext == null ? void 0 : routerContext.Link;
|
|
@@ -5679,7 +5695,7 @@ var LinkComponent = /* @__PURE__ */ __name((props, ref) => {
|
|
|
5679
5695
|
let resolvedTo = "";
|
|
5680
5696
|
if ("go" in props) {
|
|
5681
5697
|
if (!(routerContext == null ? void 0 : routerContext.go)) {
|
|
5682
|
-
|
|
5698
|
+
warnOnce6(
|
|
5683
5699
|
true,
|
|
5684
5700
|
"[Link]: `routerProvider` is not found. To use `go`, Please make sure that you have provided the `routerProvider` for `<Refine />` https://refine.dev/docs/routing/router-provider/ \n"
|
|
5685
5701
|
);
|
|
@@ -6026,7 +6042,7 @@ var useSelect = /* @__PURE__ */ __name((props) => {
|
|
|
6026
6042
|
import React22, { useState as useState8, useEffect as useEffect12, useCallback as useCallback10 } from "react";
|
|
6027
6043
|
import differenceWith2 from "lodash-es/differenceWith.js";
|
|
6028
6044
|
import isEqual3 from "lodash-es/isEqual.js";
|
|
6029
|
-
import
|
|
6045
|
+
import warnOnce7 from "warn-once";
|
|
6030
6046
|
var defaultPermanentFilter = [];
|
|
6031
6047
|
var defaultPermanentSorter = [];
|
|
6032
6048
|
var EMPTY_ARRAY3 = Object.freeze([]);
|
|
@@ -6088,7 +6104,7 @@ function useTable({
|
|
|
6088
6104
|
meta: preferredMeta
|
|
6089
6105
|
});
|
|
6090
6106
|
React22.useEffect(() => {
|
|
6091
|
-
|
|
6107
|
+
warnOnce7(
|
|
6092
6108
|
typeof identifier === "undefined",
|
|
6093
6109
|
"useTable: `resource` is not defined."
|
|
6094
6110
|
);
|
|
@@ -6235,7 +6251,7 @@ import { useContext as useContext22 } from "react";
|
|
|
6235
6251
|
import { getXRay as getXRay23 } from "@refinedev/devtools-internal";
|
|
6236
6252
|
import {
|
|
6237
6253
|
useMutation as useMutation14,
|
|
6238
|
-
useQueryClient as
|
|
6254
|
+
useQueryClient as useQueryClient8
|
|
6239
6255
|
} from "@tanstack/react-query";
|
|
6240
6256
|
|
|
6241
6257
|
// src/contexts/auditLog/index.tsx
|
|
@@ -6250,7 +6266,7 @@ var useLog = /* @__PURE__ */ __name(({
|
|
|
6250
6266
|
logMutationOptions,
|
|
6251
6267
|
renameMutationOptions
|
|
6252
6268
|
} = {}) => {
|
|
6253
|
-
const queryClient =
|
|
6269
|
+
const queryClient = useQueryClient8();
|
|
6254
6270
|
const auditLogContext = useContext22(AuditLogContext);
|
|
6255
6271
|
const { keys: keys2 } = useKeys();
|
|
6256
6272
|
const { resources } = useContext22(ResourceContext);
|
|
@@ -6347,7 +6363,7 @@ var useLogList = /* @__PURE__ */ __name(({
|
|
|
6347
6363
|
|
|
6348
6364
|
// src/hooks/breadcrumb/index.ts
|
|
6349
6365
|
import { useContext as useContext24 } from "react";
|
|
6350
|
-
import
|
|
6366
|
+
import warnOnce8 from "warn-once";
|
|
6351
6367
|
var useBreadcrumb = /* @__PURE__ */ __name(({
|
|
6352
6368
|
meta: metaFromProps = {}
|
|
6353
6369
|
} = {}) => {
|
|
@@ -6393,7 +6409,7 @@ var useBreadcrumb = /* @__PURE__ */ __name(({
|
|
|
6393
6409
|
const key = `actions.${action}`;
|
|
6394
6410
|
const actionLabel = translate(key);
|
|
6395
6411
|
if (typeof i18nProvider !== "undefined" && actionLabel === key) {
|
|
6396
|
-
|
|
6412
|
+
warnOnce8(
|
|
6397
6413
|
true,
|
|
6398
6414
|
`[useBreadcrumb]: Breadcrumb missing translate key for the "${action}" action. Please add "actions.${action}" key to your translation file.
|
|
6399
6415
|
For more information, see https://refine.dev/docs/api-reference/core/hooks/useBreadcrumb/#i18n-support`
|
|
@@ -6789,11 +6805,11 @@ function useDeleteButton(props) {
|
|
|
6789
6805
|
__name(useDeleteButton, "useDeleteButton");
|
|
6790
6806
|
|
|
6791
6807
|
// src/hooks/button/refresh-button/index.tsx
|
|
6792
|
-
import { useQueryClient as
|
|
6808
|
+
import { useQueryClient as useQueryClient9 } from "@tanstack/react-query";
|
|
6793
6809
|
function useRefreshButton(props) {
|
|
6794
6810
|
const translate = useTranslate();
|
|
6795
6811
|
const { keys: keys2 } = useKeys();
|
|
6796
|
-
const queryClient =
|
|
6812
|
+
const queryClient = useQueryClient9();
|
|
6797
6813
|
const invalidates = useInvalidate();
|
|
6798
6814
|
const { identifier, id, resources } = useResourceParams({
|
|
6799
6815
|
resource: props.resource,
|
|
@@ -8090,7 +8106,7 @@ import React39 from "react";
|
|
|
8090
8106
|
|
|
8091
8107
|
// src/hooks/useTelemetryData/index.ts
|
|
8092
8108
|
import { useContext as useContext26 } from "react";
|
|
8093
|
-
var REFINE_VERSION = "5.0.
|
|
8109
|
+
var REFINE_VERSION = "5.0.8";
|
|
8094
8110
|
var useTelemetryData = /* @__PURE__ */ __name(() => {
|
|
8095
8111
|
var _a;
|
|
8096
8112
|
const auth = useIsExistAuthentication();
|