@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.cjs
CHANGED
|
@@ -158,14 +158,16 @@ var import_react64 = __toESM(require("react"));
|
|
|
158
158
|
|
|
159
159
|
// src/hooks/auth/usePermissions/index.ts
|
|
160
160
|
var import_devtools_internal = require("@refinedev/devtools-internal");
|
|
161
|
-
var
|
|
161
|
+
var import_react_query2 = require("@tanstack/react-query");
|
|
162
162
|
|
|
163
163
|
// src/contexts/auth/index.tsx
|
|
164
164
|
var import_react = __toESM(require("react"));
|
|
165
|
+
var import_react_query = require("@tanstack/react-query");
|
|
165
166
|
var AuthProviderContext = import_react.default.createContext(
|
|
166
167
|
{}
|
|
167
168
|
);
|
|
168
169
|
var AuthProviderContextProvider = /* @__PURE__ */ __name(({ children, isProvided, ...authProvider }) => {
|
|
170
|
+
const queryClient = (0, import_react_query.useQueryClient)();
|
|
169
171
|
const handleLogin = /* @__PURE__ */ __name(async (params) => {
|
|
170
172
|
var _a;
|
|
171
173
|
try {
|
|
@@ -196,6 +198,7 @@ var AuthProviderContextProvider = /* @__PURE__ */ __name(({ children, isProvided
|
|
|
196
198
|
var _a;
|
|
197
199
|
try {
|
|
198
200
|
const result = await ((_a = authProvider.logout) == null ? void 0 : _a.call(authProvider, params));
|
|
201
|
+
queryClient.invalidateQueries();
|
|
199
202
|
return result;
|
|
200
203
|
} catch (error) {
|
|
201
204
|
console.warn(
|
|
@@ -1232,7 +1235,7 @@ function usePermissions({
|
|
|
1232
1235
|
}) {
|
|
1233
1236
|
const { getPermissions } = useAuthProviderContext();
|
|
1234
1237
|
const { keys: keys2 } = useKeys();
|
|
1235
|
-
const queryResponse = (0,
|
|
1238
|
+
const queryResponse = (0, import_react_query2.useQuery)({
|
|
1236
1239
|
queryKey: keys2().auth().action("permissions").get(),
|
|
1237
1240
|
queryFn: getPermissions ? () => getPermissions(params) : () => Promise.resolve(void 0),
|
|
1238
1241
|
enabled: !!getPermissions,
|
|
@@ -1248,13 +1251,13 @@ __name(usePermissions, "usePermissions");
|
|
|
1248
1251
|
|
|
1249
1252
|
// src/hooks/auth/useGetIdentity/index.ts
|
|
1250
1253
|
var import_devtools_internal2 = require("@refinedev/devtools-internal");
|
|
1251
|
-
var
|
|
1254
|
+
var import_react_query3 = require("@tanstack/react-query");
|
|
1252
1255
|
function useGetIdentity({
|
|
1253
1256
|
queryOptions
|
|
1254
1257
|
} = {}) {
|
|
1255
1258
|
const { getIdentity } = useAuthProviderContext();
|
|
1256
1259
|
const { keys: keys2 } = useKeys();
|
|
1257
|
-
const queryResponse = (0,
|
|
1260
|
+
const queryResponse = (0, import_react_query3.useQuery)({
|
|
1258
1261
|
queryKey: keys2().auth().action("identity").get(),
|
|
1259
1262
|
queryFn: getIdentity ?? (() => Promise.resolve({})),
|
|
1260
1263
|
retry: false,
|
|
@@ -1271,12 +1274,12 @@ __name(useGetIdentity, "useGetIdentity");
|
|
|
1271
1274
|
|
|
1272
1275
|
// src/hooks/auth/useLogout/index.ts
|
|
1273
1276
|
var import_devtools_internal3 = require("@refinedev/devtools-internal");
|
|
1274
|
-
var
|
|
1277
|
+
var import_react_query5 = require("@tanstack/react-query");
|
|
1275
1278
|
|
|
1276
1279
|
// src/hooks/auth/useInvalidateAuthStore/index.ts
|
|
1277
|
-
var
|
|
1280
|
+
var import_react_query4 = require("@tanstack/react-query");
|
|
1278
1281
|
var useInvalidateAuthStore = /* @__PURE__ */ __name(() => {
|
|
1279
|
-
const queryClient = (0,
|
|
1282
|
+
const queryClient = (0, import_react_query4.useQueryClient)();
|
|
1280
1283
|
const { keys: keys2 } = useKeys();
|
|
1281
1284
|
const invalidate = /* @__PURE__ */ __name(async () => {
|
|
1282
1285
|
await Promise.all(
|
|
@@ -1299,7 +1302,7 @@ function useLogout({
|
|
|
1299
1302
|
const { open, close } = useNotification();
|
|
1300
1303
|
const { logout: logoutFromContext } = useAuthProviderContext();
|
|
1301
1304
|
const { keys: keys2 } = useKeys();
|
|
1302
|
-
const mutation = (0,
|
|
1305
|
+
const mutation = (0, import_react_query5.useMutation)({
|
|
1303
1306
|
mutationKey: keys2().auth().action("logout").get(),
|
|
1304
1307
|
mutationFn: logoutFromContext,
|
|
1305
1308
|
...mutationOptions,
|
|
@@ -1355,7 +1358,7 @@ var buildSuccessNotification = /* @__PURE__ */ __name((successNotification) => {
|
|
|
1355
1358
|
|
|
1356
1359
|
// src/hooks/auth/useLogin/index.ts
|
|
1357
1360
|
var import_devtools_internal4 = require("@refinedev/devtools-internal");
|
|
1358
|
-
var
|
|
1361
|
+
var import_react_query6 = require("@tanstack/react-query");
|
|
1359
1362
|
function useLogin({
|
|
1360
1363
|
mutationOptions
|
|
1361
1364
|
} = {}) {
|
|
@@ -1367,7 +1370,7 @@ function useLogin({
|
|
|
1367
1370
|
const { login: loginFromContext } = useAuthProviderContext();
|
|
1368
1371
|
const { keys: keys2 } = useKeys();
|
|
1369
1372
|
const to = (_a = parsed.params) == null ? void 0 : _a.to;
|
|
1370
|
-
const mutation = (0,
|
|
1373
|
+
const mutation = (0, import_react_query6.useMutation)({
|
|
1371
1374
|
mutationKey: keys2().auth().action("login").get(),
|
|
1372
1375
|
mutationFn: loginFromContext,
|
|
1373
1376
|
onSuccess: async ({ success, redirectTo, error, successNotification }) => {
|
|
@@ -1424,7 +1427,7 @@ var buildSuccessNotification2 = /* @__PURE__ */ __name((successNotification) =>
|
|
|
1424
1427
|
|
|
1425
1428
|
// src/hooks/auth/useRegister/index.ts
|
|
1426
1429
|
var import_devtools_internal5 = require("@refinedev/devtools-internal");
|
|
1427
|
-
var
|
|
1430
|
+
var import_react_query7 = require("@tanstack/react-query");
|
|
1428
1431
|
function useRegister({
|
|
1429
1432
|
mutationOptions
|
|
1430
1433
|
} = {}) {
|
|
@@ -1433,7 +1436,7 @@ function useRegister({
|
|
|
1433
1436
|
const { close, open } = useNotification();
|
|
1434
1437
|
const { register: registerFromContext } = useAuthProviderContext();
|
|
1435
1438
|
const { keys: keys2 } = useKeys();
|
|
1436
|
-
const mutation = (0,
|
|
1439
|
+
const mutation = (0, import_react_query7.useMutation)({
|
|
1437
1440
|
mutationKey: keys2().auth().action("register").get(),
|
|
1438
1441
|
mutationFn: registerFromContext,
|
|
1439
1442
|
onSuccess: async ({ success, redirectTo, error, successNotification }) => {
|
|
@@ -1488,7 +1491,7 @@ var buildSuccessNotification3 = /* @__PURE__ */ __name((successNotification) =>
|
|
|
1488
1491
|
|
|
1489
1492
|
// src/hooks/auth/useForgotPassword/index.ts
|
|
1490
1493
|
var import_devtools_internal6 = require("@refinedev/devtools-internal");
|
|
1491
|
-
var
|
|
1494
|
+
var import_react_query8 = require("@tanstack/react-query");
|
|
1492
1495
|
function useForgotPassword({
|
|
1493
1496
|
mutationOptions
|
|
1494
1497
|
} = {}) {
|
|
@@ -1496,7 +1499,7 @@ function useForgotPassword({
|
|
|
1496
1499
|
const { open, close } = useNotification();
|
|
1497
1500
|
const { forgotPassword: forgotPasswordFromContext } = useAuthProviderContext();
|
|
1498
1501
|
const { keys: keys2 } = useKeys();
|
|
1499
|
-
const mutation = (0,
|
|
1502
|
+
const mutation = (0, import_react_query8.useMutation)({
|
|
1500
1503
|
mutationKey: keys2().auth().action("forgotPassword").get(),
|
|
1501
1504
|
mutationFn: forgotPasswordFromContext,
|
|
1502
1505
|
onSuccess: ({ success, redirectTo, error, successNotification }) => {
|
|
@@ -1546,7 +1549,7 @@ var buildSuccessNotification4 = /* @__PURE__ */ __name((successNotification) =>
|
|
|
1546
1549
|
|
|
1547
1550
|
// src/hooks/auth/useUpdatePassword/index.ts
|
|
1548
1551
|
var import_devtools_internal7 = require("@refinedev/devtools-internal");
|
|
1549
|
-
var
|
|
1552
|
+
var import_react_query9 = require("@tanstack/react-query");
|
|
1550
1553
|
function useUpdatePassword({
|
|
1551
1554
|
mutationOptions
|
|
1552
1555
|
} = {}) {
|
|
@@ -1556,7 +1559,7 @@ function useUpdatePassword({
|
|
|
1556
1559
|
const { keys: keys2 } = useKeys();
|
|
1557
1560
|
const parsed = useParsed();
|
|
1558
1561
|
const params = parsed.params ?? {};
|
|
1559
|
-
const mutation = (0,
|
|
1562
|
+
const mutation = (0, import_react_query9.useMutation)({
|
|
1560
1563
|
mutationKey: keys2().auth().action("updatePassword").get(),
|
|
1561
1564
|
mutationFn: async (variables) => {
|
|
1562
1565
|
return updatePasswordFromContext == null ? void 0 : updatePasswordFromContext({
|
|
@@ -1611,14 +1614,14 @@ var buildSuccessNotification5 = /* @__PURE__ */ __name((successNotification) =>
|
|
|
1611
1614
|
|
|
1612
1615
|
// src/hooks/auth/useIsAuthenticated/index.ts
|
|
1613
1616
|
var import_devtools_internal8 = require("@refinedev/devtools-internal");
|
|
1614
|
-
var
|
|
1617
|
+
var import_react_query10 = require("@tanstack/react-query");
|
|
1615
1618
|
function useIsAuthenticated({
|
|
1616
1619
|
queryOptions,
|
|
1617
1620
|
params
|
|
1618
1621
|
} = {}) {
|
|
1619
1622
|
const { check } = useAuthProviderContext();
|
|
1620
1623
|
const { keys: keys2 } = useKeys();
|
|
1621
|
-
const queryResponse = (0,
|
|
1624
|
+
const queryResponse = (0, import_react_query10.useQuery)({
|
|
1622
1625
|
queryKey: keys2().auth().action("check").get(),
|
|
1623
1626
|
queryFn: async () => await (check == null ? void 0 : check(params)) ?? { authenticated: true },
|
|
1624
1627
|
retry: false,
|
|
@@ -1634,13 +1637,13 @@ __name(useIsAuthenticated, "useIsAuthenticated");
|
|
|
1634
1637
|
|
|
1635
1638
|
// src/hooks/auth/useOnError/index.ts
|
|
1636
1639
|
var import_devtools_internal9 = require("@refinedev/devtools-internal");
|
|
1637
|
-
var
|
|
1640
|
+
var import_react_query11 = require("@tanstack/react-query");
|
|
1638
1641
|
function useOnError() {
|
|
1639
1642
|
const go = useGo();
|
|
1640
1643
|
const { onError: onErrorFromContext } = useAuthProviderContext();
|
|
1641
1644
|
const { keys: keys2 } = useKeys();
|
|
1642
1645
|
const { mutate: logout } = useLogout();
|
|
1643
|
-
const mutation = (0,
|
|
1646
|
+
const mutation = (0, import_react_query11.useMutation)({
|
|
1644
1647
|
mutationKey: keys2().auth().action("onError").get(),
|
|
1645
1648
|
...onErrorFromContext ? {
|
|
1646
1649
|
mutationFn: onErrorFromContext,
|
|
@@ -1677,7 +1680,7 @@ var useIsExistAuthentication = /* @__PURE__ */ __name(() => {
|
|
|
1677
1680
|
var import_react10 = require("react");
|
|
1678
1681
|
var import_devtools_internal10 = require("@refinedev/devtools-internal");
|
|
1679
1682
|
var import_react11 = require("react");
|
|
1680
|
-
var
|
|
1683
|
+
var import_react_query12 = require("@tanstack/react-query");
|
|
1681
1684
|
|
|
1682
1685
|
// src/hooks/useLoadingOvertime/index.ts
|
|
1683
1686
|
var import_react9 = require("react");
|
|
@@ -1817,7 +1820,7 @@ var useList = /* @__PURE__ */ __name(({
|
|
|
1817
1820
|
prefferedPagination.mode,
|
|
1818
1821
|
queryOptions == null ? void 0 : queryOptions.select
|
|
1819
1822
|
]);
|
|
1820
|
-
const queryResponse = (0,
|
|
1823
|
+
const queryResponse = (0, import_react_query12.useQuery)({
|
|
1821
1824
|
queryKey: keys2().data(pickedDataProvider).resource(identifier ?? "").action("list").params({
|
|
1822
1825
|
...preferredMeta || {},
|
|
1823
1826
|
filters: prefferedFilters,
|
|
@@ -1896,7 +1899,7 @@ var useList = /* @__PURE__ */ __name(({
|
|
|
1896
1899
|
// src/hooks/data/useOne.ts
|
|
1897
1900
|
var import_react12 = require("react");
|
|
1898
1901
|
var import_devtools_internal11 = require("@refinedev/devtools-internal");
|
|
1899
|
-
var
|
|
1902
|
+
var import_react_query13 = require("@tanstack/react-query");
|
|
1900
1903
|
var useOne = /* @__PURE__ */ __name(({
|
|
1901
1904
|
resource: resourceFromProp,
|
|
1902
1905
|
id,
|
|
@@ -1948,7 +1951,7 @@ var useOne = /* @__PURE__ */ __name(({
|
|
|
1948
1951
|
dataProviderName: pickedDataProvider
|
|
1949
1952
|
}
|
|
1950
1953
|
});
|
|
1951
|
-
const queryResponse = (0,
|
|
1954
|
+
const queryResponse = (0, import_react_query13.useQuery)({
|
|
1952
1955
|
queryKey: keys2().data(pickedDataProvider).resource(identifier ?? "").action("one").id(id ?? "").params({
|
|
1953
1956
|
...preferredMeta || {}
|
|
1954
1957
|
}).get(),
|
|
@@ -2017,7 +2020,7 @@ var useOne = /* @__PURE__ */ __name(({
|
|
|
2017
2020
|
// src/hooks/data/useMany.ts
|
|
2018
2021
|
var import_react13 = require("react");
|
|
2019
2022
|
var import_devtools_internal12 = require("@refinedev/devtools-internal");
|
|
2020
|
-
var
|
|
2023
|
+
var import_react_query14 = require("@tanstack/react-query");
|
|
2021
2024
|
var import_warn_once2 = __toESM(require("warn-once"));
|
|
2022
2025
|
var EMPTY_ARRAY2 = Object.freeze([]);
|
|
2023
2026
|
var useMany = /* @__PURE__ */ __name(({
|
|
@@ -2078,7 +2081,7 @@ var useMany = /* @__PURE__ */ __name(({
|
|
|
2078
2081
|
dataProviderName: pickedDataProvider
|
|
2079
2082
|
}
|
|
2080
2083
|
});
|
|
2081
|
-
const queryResponse = (0,
|
|
2084
|
+
const queryResponse = (0, import_react_query14.useQuery)({
|
|
2082
2085
|
queryKey: keys2().data(pickedDataProvider).resource(identifier).action("many").ids(...ids ?? []).params({
|
|
2083
2086
|
...preferredMeta || {}
|
|
2084
2087
|
}).get(),
|
|
@@ -2154,7 +2157,7 @@ See https://refine.dev/docs/data/hooks/use-many/#resource-`, "resourceWarningMes
|
|
|
2154
2157
|
|
|
2155
2158
|
// src/hooks/data/useUpdate.ts
|
|
2156
2159
|
var import_devtools_internal13 = require("@refinedev/devtools-internal");
|
|
2157
|
-
var
|
|
2160
|
+
var import_react_query15 = require("@tanstack/react-query");
|
|
2158
2161
|
|
|
2159
2162
|
// src/contexts/undoableQueue/types.ts
|
|
2160
2163
|
var ActionTypes = /* @__PURE__ */ ((ActionTypes2) => {
|
|
@@ -2184,7 +2187,7 @@ var useUpdate = /* @__PURE__ */ __name(({
|
|
|
2184
2187
|
const { resources, select } = useResourceParams({
|
|
2185
2188
|
resource: resourceFromProps
|
|
2186
2189
|
});
|
|
2187
|
-
const queryClient = (0,
|
|
2190
|
+
const queryClient = (0, import_react_query15.useQueryClient)();
|
|
2188
2191
|
const dataProvider = useDataProvider();
|
|
2189
2192
|
const {
|
|
2190
2193
|
mutationMode: mutationModeContext,
|
|
@@ -2202,7 +2205,7 @@ var useUpdate = /* @__PURE__ */ __name(({
|
|
|
2202
2205
|
options: { textTransformers }
|
|
2203
2206
|
} = useRefineContext();
|
|
2204
2207
|
const { keys: keys2 } = useKeys();
|
|
2205
|
-
const mutationResult = (0,
|
|
2208
|
+
const mutationResult = (0, import_react_query15.useMutation)({
|
|
2206
2209
|
mutationFn: ({
|
|
2207
2210
|
id = idFromProps,
|
|
2208
2211
|
values = valuesFromProps,
|
|
@@ -2581,7 +2584,7 @@ var missingValuesError = new Error(
|
|
|
2581
2584
|
|
|
2582
2585
|
// src/hooks/data/useCreate.ts
|
|
2583
2586
|
var import_devtools_internal14 = require("@refinedev/devtools-internal");
|
|
2584
|
-
var
|
|
2587
|
+
var import_react_query16 = require("@tanstack/react-query");
|
|
2585
2588
|
var useCreate = /* @__PURE__ */ __name(({
|
|
2586
2589
|
resource: resourceFromProps,
|
|
2587
2590
|
values: valuesFromProps,
|
|
@@ -2606,7 +2609,7 @@ var useCreate = /* @__PURE__ */ __name(({
|
|
|
2606
2609
|
options: { textTransformers }
|
|
2607
2610
|
} = useRefineContext();
|
|
2608
2611
|
const { keys: keys2 } = useKeys();
|
|
2609
|
-
const mutationResult = (0,
|
|
2612
|
+
const mutationResult = (0, import_react_query16.useMutation)({
|
|
2610
2613
|
mutationFn: ({
|
|
2611
2614
|
resource: resourceName = resourceFromProps,
|
|
2612
2615
|
values = valuesFromProps,
|
|
@@ -2773,7 +2776,7 @@ var missingValuesError2 = new Error(
|
|
|
2773
2776
|
|
|
2774
2777
|
// src/hooks/data/useDelete.ts
|
|
2775
2778
|
var import_devtools_internal15 = require("@refinedev/devtools-internal");
|
|
2776
|
-
var
|
|
2779
|
+
var import_react_query17 = require("@tanstack/react-query");
|
|
2777
2780
|
var useDelete = /* @__PURE__ */ __name(({
|
|
2778
2781
|
mutationOptions,
|
|
2779
2782
|
overtimeOptions
|
|
@@ -2781,7 +2784,7 @@ var useDelete = /* @__PURE__ */ __name(({
|
|
|
2781
2784
|
const { mutate: checkError } = useOnError();
|
|
2782
2785
|
const dataProvider = useDataProvider();
|
|
2783
2786
|
const { resources, select } = useResourceParams();
|
|
2784
|
-
const queryClient = (0,
|
|
2787
|
+
const queryClient = (0, import_react_query17.useQueryClient)();
|
|
2785
2788
|
const {
|
|
2786
2789
|
mutationMode: mutationModeContext,
|
|
2787
2790
|
undoableTimeout: undoableTimeoutContext
|
|
@@ -2797,7 +2800,7 @@ var useDelete = /* @__PURE__ */ __name(({
|
|
|
2797
2800
|
options: { textTransformers }
|
|
2798
2801
|
} = useRefineContext();
|
|
2799
2802
|
const { keys: keys2 } = useKeys();
|
|
2800
|
-
const mutation = (0,
|
|
2803
|
+
const mutation = (0, import_react_query17.useMutation)({
|
|
2801
2804
|
mutationFn: ({
|
|
2802
2805
|
id,
|
|
2803
2806
|
mutationMode,
|
|
@@ -3057,7 +3060,7 @@ var useDelete = /* @__PURE__ */ __name(({
|
|
|
3057
3060
|
|
|
3058
3061
|
// src/hooks/data/useCreateMany.ts
|
|
3059
3062
|
var import_devtools_internal16 = require("@refinedev/devtools-internal");
|
|
3060
|
-
var
|
|
3063
|
+
var import_react_query18 = require("@tanstack/react-query");
|
|
3061
3064
|
var useCreateMany = /* @__PURE__ */ __name(({
|
|
3062
3065
|
resource: resourceFromProps,
|
|
3063
3066
|
values: valuesFromProps,
|
|
@@ -3081,7 +3084,7 @@ var useCreateMany = /* @__PURE__ */ __name(({
|
|
|
3081
3084
|
options: { textTransformers }
|
|
3082
3085
|
} = useRefineContext();
|
|
3083
3086
|
const { keys: keys2 } = useKeys();
|
|
3084
|
-
const mutationResult = (0,
|
|
3087
|
+
const mutationResult = (0, import_react_query18.useMutation)({
|
|
3085
3088
|
mutationFn: ({
|
|
3086
3089
|
resource: resourceName = resourceFromProps,
|
|
3087
3090
|
values = valuesFromProps,
|
|
@@ -3253,7 +3256,7 @@ var missingValuesError3 = new Error(
|
|
|
3253
3256
|
|
|
3254
3257
|
// src/hooks/data/useUpdateMany.ts
|
|
3255
3258
|
var import_devtools_internal17 = require("@refinedev/devtools-internal");
|
|
3256
|
-
var
|
|
3259
|
+
var import_react_query19 = require("@tanstack/react-query");
|
|
3257
3260
|
var useUpdateMany = /* @__PURE__ */ __name(({
|
|
3258
3261
|
ids: idsFromProps,
|
|
3259
3262
|
resource: resourceFromProps,
|
|
@@ -3271,7 +3274,7 @@ var useUpdateMany = /* @__PURE__ */ __name(({
|
|
|
3271
3274
|
overtimeOptions
|
|
3272
3275
|
} = {}) => {
|
|
3273
3276
|
const { resources, select } = useResourceParams();
|
|
3274
|
-
const queryClient = (0,
|
|
3277
|
+
const queryClient = (0, import_react_query19.useQueryClient)();
|
|
3275
3278
|
const dataProvider = useDataProvider();
|
|
3276
3279
|
const translate = useTranslate();
|
|
3277
3280
|
const {
|
|
@@ -3289,7 +3292,7 @@ var useUpdateMany = /* @__PURE__ */ __name(({
|
|
|
3289
3292
|
options: { textTransformers }
|
|
3290
3293
|
} = useRefineContext();
|
|
3291
3294
|
const { keys: keys2 } = useKeys();
|
|
3292
|
-
const mutationResult = (0,
|
|
3295
|
+
const mutationResult = (0, import_react_query19.useMutation)({
|
|
3293
3296
|
mutationFn: ({
|
|
3294
3297
|
ids = idsFromProps,
|
|
3295
3298
|
values = valuesFromProps,
|
|
@@ -3686,7 +3689,7 @@ var missingValuesError4 = new Error(
|
|
|
3686
3689
|
|
|
3687
3690
|
// src/hooks/data/useDeleteMany.ts
|
|
3688
3691
|
var import_devtools_internal18 = require("@refinedev/devtools-internal");
|
|
3689
|
-
var
|
|
3692
|
+
var import_react_query20 = require("@tanstack/react-query");
|
|
3690
3693
|
var useDeleteMany = /* @__PURE__ */ __name(({
|
|
3691
3694
|
mutationOptions,
|
|
3692
3695
|
overtimeOptions
|
|
@@ -3704,13 +3707,13 @@ var useDeleteMany = /* @__PURE__ */ __name(({
|
|
|
3704
3707
|
const invalidateStore = useInvalidate();
|
|
3705
3708
|
const { log } = useLog();
|
|
3706
3709
|
const { resources, select } = useResourceParams();
|
|
3707
|
-
const queryClient = (0,
|
|
3710
|
+
const queryClient = (0, import_react_query20.useQueryClient)();
|
|
3708
3711
|
const getMeta = useMeta();
|
|
3709
3712
|
const {
|
|
3710
3713
|
options: { textTransformers }
|
|
3711
3714
|
} = useRefineContext();
|
|
3712
3715
|
const { keys: keys2 } = useKeys();
|
|
3713
|
-
const mutation = (0,
|
|
3716
|
+
const mutation = (0, import_react_query20.useMutation)({
|
|
3714
3717
|
mutationFn: ({
|
|
3715
3718
|
resource: resourceName,
|
|
3716
3719
|
ids,
|
|
@@ -4003,7 +4006,7 @@ var useApiUrl = /* @__PURE__ */ __name((dataProviderName) => {
|
|
|
4003
4006
|
// src/hooks/data/useCustom.ts
|
|
4004
4007
|
var import_react14 = require("react");
|
|
4005
4008
|
var import_devtools_internal19 = require("@refinedev/devtools-internal");
|
|
4006
|
-
var
|
|
4009
|
+
var import_react_query21 = require("@tanstack/react-query");
|
|
4007
4010
|
var EMPTY_OBJECT = Object.freeze({});
|
|
4008
4011
|
var useCustom = /* @__PURE__ */ __name(({
|
|
4009
4012
|
url,
|
|
@@ -4027,7 +4030,7 @@ var useCustom = /* @__PURE__ */ __name(({
|
|
|
4027
4030
|
const { custom } = dataProvider(dataProviderName);
|
|
4028
4031
|
const combinedMeta = getMeta({ meta: preferredMeta });
|
|
4029
4032
|
if (custom) {
|
|
4030
|
-
const queryResponse = (0,
|
|
4033
|
+
const queryResponse = (0, import_react_query21.useQuery)({
|
|
4031
4034
|
queryKey: keys2().data(dataProviderName).mutation("custom").params({
|
|
4032
4035
|
method,
|
|
4033
4036
|
url,
|
|
@@ -4094,7 +4097,7 @@ var useCustom = /* @__PURE__ */ __name(({
|
|
|
4094
4097
|
|
|
4095
4098
|
// src/hooks/data/useCustomMutation.ts
|
|
4096
4099
|
var import_devtools_internal20 = require("@refinedev/devtools-internal");
|
|
4097
|
-
var
|
|
4100
|
+
var import_react_query22 = require("@tanstack/react-query");
|
|
4098
4101
|
var useCustomMutation = /* @__PURE__ */ __name(({
|
|
4099
4102
|
mutationOptions,
|
|
4100
4103
|
overtimeOptions
|
|
@@ -4105,7 +4108,7 @@ var useCustomMutation = /* @__PURE__ */ __name(({
|
|
|
4105
4108
|
const translate = useTranslate();
|
|
4106
4109
|
const getMeta = useMeta();
|
|
4107
4110
|
const { keys: keys2 } = useKeys();
|
|
4108
|
-
const mutationResult = (0,
|
|
4111
|
+
const mutationResult = (0, import_react_query22.useMutation)({
|
|
4109
4112
|
mutationKey: keys2().data().mutation("customMutation").get(),
|
|
4110
4113
|
mutationFn: ({
|
|
4111
4114
|
url,
|
|
@@ -4245,7 +4248,7 @@ var useDataProvider = /* @__PURE__ */ __name(() => {
|
|
|
4245
4248
|
// src/hooks/data/useInfiniteList.ts
|
|
4246
4249
|
var import_react17 = require("react");
|
|
4247
4250
|
var import_devtools_internal21 = require("@refinedev/devtools-internal");
|
|
4248
|
-
var
|
|
4251
|
+
var import_react_query23 = require("@tanstack/react-query");
|
|
4249
4252
|
var useInfiniteList = /* @__PURE__ */ __name(({
|
|
4250
4253
|
resource: resourceFromProp,
|
|
4251
4254
|
filters,
|
|
@@ -4317,7 +4320,7 @@ var useInfiniteList = /* @__PURE__ */ __name(({
|
|
|
4317
4320
|
dataProviderName: pickedDataProvider
|
|
4318
4321
|
}
|
|
4319
4322
|
});
|
|
4320
|
-
const queryResponse = (0,
|
|
4323
|
+
const queryResponse = (0, import_react_query23.useInfiniteQuery)({
|
|
4321
4324
|
queryKey: keys2().data(pickedDataProvider).resource(identifier).action("infinite").params({
|
|
4322
4325
|
...preferredMeta || {},
|
|
4323
4326
|
filters: prefferedFilters,
|
|
@@ -4431,10 +4434,10 @@ var LiveContextProvider = /* @__PURE__ */ __name(({
|
|
|
4431
4434
|
|
|
4432
4435
|
// src/hooks/invalidate/index.tsx
|
|
4433
4436
|
var import_react19 = require("react");
|
|
4434
|
-
var
|
|
4437
|
+
var import_react_query24 = require("@tanstack/react-query");
|
|
4435
4438
|
var useInvalidate = /* @__PURE__ */ __name(() => {
|
|
4436
4439
|
const { resources } = useResourceParams();
|
|
4437
|
-
const queryClient = (0,
|
|
4440
|
+
const queryClient = (0, import_react_query24.useQueryClient)();
|
|
4438
4441
|
const { keys: keys2 } = useKeys();
|
|
4439
4442
|
const invalidate = (0, import_react19.useCallback)(
|
|
4440
4443
|
async ({
|
|
@@ -5305,6 +5308,7 @@ __name(useResourceParams, "useResourceParams");
|
|
|
5305
5308
|
|
|
5306
5309
|
// src/hooks/router/use-get-to-path/index.ts
|
|
5307
5310
|
var import_react44 = __toESM(require("react"));
|
|
5311
|
+
var import_warn_once4 = __toESM(require("warn-once"));
|
|
5308
5312
|
var useGetToPath = /* @__PURE__ */ __name(() => {
|
|
5309
5313
|
const { resource: resourceFromRoute, resources } = useResourceParams();
|
|
5310
5314
|
const parsed = useParsed();
|
|
@@ -5315,19 +5319,31 @@ var useGetToPath = /* @__PURE__ */ __name(() => {
|
|
|
5315
5319
|
if (!selectedResource) {
|
|
5316
5320
|
return void 0;
|
|
5317
5321
|
}
|
|
5318
|
-
const
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
+
const fullResource = resources.find((r) => {
|
|
5323
|
+
if (!r.identifier)
|
|
5324
|
+
return false;
|
|
5325
|
+
if (!selectedResource.identifier)
|
|
5326
|
+
return false;
|
|
5327
|
+
return r.identifier === selectedResource.identifier;
|
|
5328
|
+
}) ?? resources.find((r) => {
|
|
5329
|
+
if (!r.identifier)
|
|
5330
|
+
return false;
|
|
5331
|
+
return r.identifier === selectedResource.name;
|
|
5332
|
+
}) ?? resources.find((r) => r.name === selectedResource.name) ?? selectedResource;
|
|
5333
|
+
const actionRoutes = getActionRoutesFromResource(fullResource, resources);
|
|
5322
5334
|
const actionRoute = (_a = actionRoutes.find(
|
|
5323
5335
|
(item) => item.action === action
|
|
5324
5336
|
)) == null ? void 0 : _a.route;
|
|
5325
5337
|
if (!actionRoute) {
|
|
5338
|
+
(0, import_warn_once4.default)(
|
|
5339
|
+
true,
|
|
5340
|
+
`[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.`
|
|
5341
|
+
);
|
|
5326
5342
|
return void 0;
|
|
5327
5343
|
}
|
|
5328
5344
|
const composed = composeRoute(
|
|
5329
5345
|
actionRoute,
|
|
5330
|
-
|
|
5346
|
+
fullResource == null ? void 0 : fullResource.meta,
|
|
5331
5347
|
parsed,
|
|
5332
5348
|
meta
|
|
5333
5349
|
);
|
|
@@ -5519,7 +5535,7 @@ var useNavigation2 = /* @__PURE__ */ __name(() => {
|
|
|
5519
5535
|
}, "useNavigation");
|
|
5520
5536
|
|
|
5521
5537
|
// src/hooks/show/index.ts
|
|
5522
|
-
var
|
|
5538
|
+
var import_warn_once5 = __toESM(require("warn-once"));
|
|
5523
5539
|
var useShow = /* @__PURE__ */ __name(({
|
|
5524
5540
|
resource: resourceFromProp,
|
|
5525
5541
|
id,
|
|
@@ -5542,7 +5558,7 @@ var useShow = /* @__PURE__ */ __name(({
|
|
|
5542
5558
|
resource,
|
|
5543
5559
|
meta
|
|
5544
5560
|
});
|
|
5545
|
-
(0,
|
|
5561
|
+
(0, import_warn_once5.default)(
|
|
5546
5562
|
Boolean(resourceFromProp) && !showId,
|
|
5547
5563
|
idWarningMessage2(identifier, showId)
|
|
5548
5564
|
);
|
|
@@ -5773,7 +5789,7 @@ var useToPath = /* @__PURE__ */ __name(({
|
|
|
5773
5789
|
|
|
5774
5790
|
// src/components/link/index.tsx
|
|
5775
5791
|
var import_react49 = __toESM(require("react"));
|
|
5776
|
-
var
|
|
5792
|
+
var import_warn_once6 = __toESM(require("warn-once"));
|
|
5777
5793
|
var LinkComponent = /* @__PURE__ */ __name((props, ref) => {
|
|
5778
5794
|
const routerContext = (0, import_react49.useContext)(RouterContext);
|
|
5779
5795
|
const LinkFromContext = routerContext == null ? void 0 : routerContext.Link;
|
|
@@ -5781,7 +5797,7 @@ var LinkComponent = /* @__PURE__ */ __name((props, ref) => {
|
|
|
5781
5797
|
let resolvedTo = "";
|
|
5782
5798
|
if ("go" in props) {
|
|
5783
5799
|
if (!(routerContext == null ? void 0 : routerContext.go)) {
|
|
5784
|
-
(0,
|
|
5800
|
+
(0, import_warn_once6.default)(
|
|
5785
5801
|
true,
|
|
5786
5802
|
"[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"
|
|
5787
5803
|
);
|
|
@@ -5823,7 +5839,7 @@ var useLink = /* @__PURE__ */ __name(() => {
|
|
|
5823
5839
|
// src/hooks/accessControl/useCan/index.ts
|
|
5824
5840
|
var import_react51 = require("react");
|
|
5825
5841
|
var import_devtools_internal22 = require("@refinedev/devtools-internal");
|
|
5826
|
-
var
|
|
5842
|
+
var import_react_query25 = require("@tanstack/react-query");
|
|
5827
5843
|
|
|
5828
5844
|
// src/contexts/accessControl/index.tsx
|
|
5829
5845
|
var import_react50 = __toESM(require("react"));
|
|
@@ -5897,7 +5913,7 @@ var useCan = /* @__PURE__ */ __name(({
|
|
|
5897
5913
|
};
|
|
5898
5914
|
const { resource: _resource, ...paramsRest } = params ?? {};
|
|
5899
5915
|
const sanitizedResource = sanitizeResource(_resource);
|
|
5900
|
-
const queryResponse = (0,
|
|
5916
|
+
const queryResponse = (0, import_react_query25.useQuery)({
|
|
5901
5917
|
queryKey: keys2().access().resource(resource).action(action).params({
|
|
5902
5918
|
params: { ...paramsRest, resource: sanitizedResource },
|
|
5903
5919
|
enabled: mergedQueryOptions == null ? void 0 : mergedQueryOptions.enabled
|
|
@@ -6126,7 +6142,7 @@ var useSelect = /* @__PURE__ */ __name((props) => {
|
|
|
6126
6142
|
var import_react54 = __toESM(require("react"));
|
|
6127
6143
|
var import_differenceWith2 = __toESM(require("lodash/differenceWith"));
|
|
6128
6144
|
var import_isEqual3 = __toESM(require("lodash/isEqual"));
|
|
6129
|
-
var
|
|
6145
|
+
var import_warn_once7 = __toESM(require("warn-once"));
|
|
6130
6146
|
var defaultPermanentFilter = [];
|
|
6131
6147
|
var defaultPermanentSorter = [];
|
|
6132
6148
|
var EMPTY_ARRAY3 = Object.freeze([]);
|
|
@@ -6188,7 +6204,7 @@ function useTable({
|
|
|
6188
6204
|
meta: preferredMeta
|
|
6189
6205
|
});
|
|
6190
6206
|
import_react54.default.useEffect(() => {
|
|
6191
|
-
(0,
|
|
6207
|
+
(0, import_warn_once7.default)(
|
|
6192
6208
|
typeof identifier === "undefined",
|
|
6193
6209
|
"useTable: `resource` is not defined."
|
|
6194
6210
|
);
|
|
@@ -6333,7 +6349,7 @@ __name(useTable, "useTable");
|
|
|
6333
6349
|
// src/hooks/auditLog/useLog/index.ts
|
|
6334
6350
|
var import_react56 = require("react");
|
|
6335
6351
|
var import_devtools_internal23 = require("@refinedev/devtools-internal");
|
|
6336
|
-
var
|
|
6352
|
+
var import_react_query26 = require("@tanstack/react-query");
|
|
6337
6353
|
|
|
6338
6354
|
// src/contexts/auditLog/index.tsx
|
|
6339
6355
|
var import_react55 = __toESM(require("react"));
|
|
@@ -6347,7 +6363,7 @@ var useLog = /* @__PURE__ */ __name(({
|
|
|
6347
6363
|
logMutationOptions,
|
|
6348
6364
|
renameMutationOptions
|
|
6349
6365
|
} = {}) => {
|
|
6350
|
-
const queryClient = (0,
|
|
6366
|
+
const queryClient = (0, import_react_query26.useQueryClient)();
|
|
6351
6367
|
const auditLogContext = (0, import_react56.useContext)(AuditLogContext);
|
|
6352
6368
|
const { keys: keys2 } = useKeys();
|
|
6353
6369
|
const { resources } = (0, import_react56.useContext)(ResourceContext);
|
|
@@ -6360,7 +6376,7 @@ var useLog = /* @__PURE__ */ __name(({
|
|
|
6360
6376
|
enabled: !!(auditLogContext == null ? void 0 : auditLogContext.create)
|
|
6361
6377
|
}
|
|
6362
6378
|
});
|
|
6363
|
-
const log = (0,
|
|
6379
|
+
const log = (0, import_react_query26.useMutation)({
|
|
6364
6380
|
mutationFn: async (params) => {
|
|
6365
6381
|
var _a, _b;
|
|
6366
6382
|
const resource = pickResource(params.resource, resources);
|
|
@@ -6386,7 +6402,7 @@ var useLog = /* @__PURE__ */ __name(({
|
|
|
6386
6402
|
...(0, import_devtools_internal23.getXRay)("useLog")
|
|
6387
6403
|
}
|
|
6388
6404
|
});
|
|
6389
|
-
const rename = (0,
|
|
6405
|
+
const rename = (0, import_react_query26.useMutation)({
|
|
6390
6406
|
mutationFn: async (params) => {
|
|
6391
6407
|
var _a;
|
|
6392
6408
|
return await ((_a = auditLogContext.update) == null ? void 0 : _a.call(auditLogContext, params));
|
|
@@ -6411,7 +6427,7 @@ var useLog = /* @__PURE__ */ __name(({
|
|
|
6411
6427
|
// src/hooks/auditLog/useLogList/index.ts
|
|
6412
6428
|
var import_react57 = require("react");
|
|
6413
6429
|
var import_devtools_internal24 = require("@refinedev/devtools-internal");
|
|
6414
|
-
var
|
|
6430
|
+
var import_react_query27 = require("@tanstack/react-query");
|
|
6415
6431
|
var useLogList = /* @__PURE__ */ __name(({
|
|
6416
6432
|
resource,
|
|
6417
6433
|
action,
|
|
@@ -6421,7 +6437,7 @@ var useLogList = /* @__PURE__ */ __name(({
|
|
|
6421
6437
|
}) => {
|
|
6422
6438
|
const { get: get2 } = (0, import_react57.useContext)(AuditLogContext);
|
|
6423
6439
|
const { keys: keys2 } = useKeys();
|
|
6424
|
-
const queryResponse = (0,
|
|
6440
|
+
const queryResponse = (0, import_react_query27.useQuery)({
|
|
6425
6441
|
queryKey: keys2().audit().resource(resource).action("list").params(meta).get(),
|
|
6426
6442
|
queryFn: () => (get2 == null ? void 0 : get2({
|
|
6427
6443
|
resource,
|
|
@@ -6442,7 +6458,7 @@ var useLogList = /* @__PURE__ */ __name(({
|
|
|
6442
6458
|
|
|
6443
6459
|
// src/hooks/breadcrumb/index.ts
|
|
6444
6460
|
var import_react58 = require("react");
|
|
6445
|
-
var
|
|
6461
|
+
var import_warn_once8 = __toESM(require("warn-once"));
|
|
6446
6462
|
var useBreadcrumb = /* @__PURE__ */ __name(({
|
|
6447
6463
|
meta: metaFromProps = {}
|
|
6448
6464
|
} = {}) => {
|
|
@@ -6488,7 +6504,7 @@ var useBreadcrumb = /* @__PURE__ */ __name(({
|
|
|
6488
6504
|
const key = `actions.${action}`;
|
|
6489
6505
|
const actionLabel = translate(key);
|
|
6490
6506
|
if (typeof i18nProvider !== "undefined" && actionLabel === key) {
|
|
6491
|
-
(0,
|
|
6507
|
+
(0, import_warn_once8.default)(
|
|
6492
6508
|
true,
|
|
6493
6509
|
`[useBreadcrumb]: Breadcrumb missing translate key for the "${action}" action. Please add "actions.${action}" key to your translation file.
|
|
6494
6510
|
For more information, see https://refine.dev/docs/api-reference/core/hooks/useBreadcrumb/#i18n-support`
|
|
@@ -6880,11 +6896,11 @@ function useDeleteButton(props) {
|
|
|
6880
6896
|
__name(useDeleteButton, "useDeleteButton");
|
|
6881
6897
|
|
|
6882
6898
|
// src/hooks/button/refresh-button/index.tsx
|
|
6883
|
-
var
|
|
6899
|
+
var import_react_query28 = require("@tanstack/react-query");
|
|
6884
6900
|
function useRefreshButton(props) {
|
|
6885
6901
|
const translate = useTranslate();
|
|
6886
6902
|
const { keys: keys2 } = useKeys();
|
|
6887
|
-
const queryClient = (0,
|
|
6903
|
+
const queryClient = (0, import_react_query28.useQueryClient)();
|
|
6888
6904
|
const invalidates = useInvalidate();
|
|
6889
6905
|
const { identifier, id, resources } = useResourceParams({
|
|
6890
6906
|
resource: props.resource,
|
|
@@ -8170,14 +8186,14 @@ var WelcomePage = /* @__PURE__ */ __name(() => {
|
|
|
8170
8186
|
// src/components/containers/refine/index.tsx
|
|
8171
8187
|
var import_react76 = __toESM(require("react"));
|
|
8172
8188
|
var import_devtools_internal25 = require("@refinedev/devtools-internal");
|
|
8173
|
-
var
|
|
8189
|
+
var import_react_query29 = require("@tanstack/react-query");
|
|
8174
8190
|
|
|
8175
8191
|
// src/components/telemetry/index.tsx
|
|
8176
8192
|
var import_react74 = __toESM(require("react"));
|
|
8177
8193
|
|
|
8178
8194
|
// src/hooks/useTelemetryData/index.ts
|
|
8179
8195
|
var import_react73 = require("react");
|
|
8180
|
-
var REFINE_VERSION = "5.0.
|
|
8196
|
+
var REFINE_VERSION = "5.0.8";
|
|
8181
8197
|
var useTelemetryData = /* @__PURE__ */ __name(() => {
|
|
8182
8198
|
var _a;
|
|
8183
8199
|
const auth = useIsExistAuthentication();
|
|
@@ -8319,16 +8335,16 @@ var Refine = /* @__PURE__ */ __name(({
|
|
|
8319
8335
|
const disableRouteChangeHandler = optionsWithDefaults.disableRouteChangeHandler;
|
|
8320
8336
|
const queryClient = useDeepMemo(() => {
|
|
8321
8337
|
var _a;
|
|
8322
|
-
if (reactQueryWithDefaults.clientConfig instanceof
|
|
8338
|
+
if (reactQueryWithDefaults.clientConfig instanceof import_react_query29.QueryClient) {
|
|
8323
8339
|
return reactQueryWithDefaults.clientConfig;
|
|
8324
8340
|
}
|
|
8325
|
-
return new
|
|
8341
|
+
return new import_react_query29.QueryClient({
|
|
8326
8342
|
...reactQueryWithDefaults.clientConfig,
|
|
8327
8343
|
defaultOptions: {
|
|
8328
8344
|
...reactQueryWithDefaults.clientConfig.defaultOptions,
|
|
8329
8345
|
queries: {
|
|
8330
8346
|
refetchOnWindowFocus: false,
|
|
8331
|
-
placeholderData:
|
|
8347
|
+
placeholderData: import_react_query29.keepPreviousData,
|
|
8332
8348
|
...(_a = reactQueryWithDefaults.clientConfig.defaultOptions) == null ? void 0 : _a.queries
|
|
8333
8349
|
}
|
|
8334
8350
|
}
|
|
@@ -8340,7 +8356,7 @@ var Refine = /* @__PURE__ */ __name(({
|
|
|
8340
8356
|
}, [notificationProvider]);
|
|
8341
8357
|
const notificationProviderContextValues = useNotificationProviderValues();
|
|
8342
8358
|
useRouterMisuseWarning(routerProvider);
|
|
8343
|
-
return /* @__PURE__ */ import_react76.default.createElement(
|
|
8359
|
+
return /* @__PURE__ */ import_react76.default.createElement(import_react_query29.QueryClientProvider, { client: queryClient }, /* @__PURE__ */ import_react76.default.createElement(NotificationContextProvider, { ...notificationProviderContextValues }, /* @__PURE__ */ import_react76.default.createElement(
|
|
8344
8360
|
AuthProviderContextProvider,
|
|
8345
8361
|
{
|
|
8346
8362
|
...authProvider ?? {},
|