@refinedev/core 4.8.5 → 4.9.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 +57 -0
- package/dist/definitions/helpers/router/compose-route.d.ts +2 -2
- package/dist/definitions/helpers/router/compose-route.d.ts.map +1 -1
- package/dist/definitions/helpers/router/prepare-route-params.d.ts +1 -2
- package/dist/definitions/helpers/router/prepare-route-params.d.ts.map +1 -1
- package/dist/esm/index.js +6 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/hooks/breadcrumb/index.d.ts.map +1 -1
- package/dist/hooks/data/useCreate.d.ts.map +1 -1
- package/dist/hooks/data/useCreateMany.d.ts.map +1 -1
- package/dist/hooks/data/useCustom.d.ts.map +1 -1
- package/dist/hooks/data/useCustomMutation.d.ts.map +1 -1
- package/dist/hooks/data/useDelete.d.ts.map +1 -1
- package/dist/hooks/data/useDeleteMany.d.ts.map +1 -1
- package/dist/hooks/data/useInfiniteList.d.ts.map +1 -1
- package/dist/hooks/data/useList.d.ts.map +1 -1
- package/dist/hooks/data/useMany.d.ts.map +1 -1
- package/dist/hooks/data/useOne.d.ts.map +1 -1
- package/dist/hooks/data/useUpdate.d.ts.map +1 -1
- package/dist/hooks/data/useUpdateMany.d.ts.map +1 -1
- package/dist/hooks/form/useForm.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/navigation/index.d.ts.map +1 -1
- package/dist/hooks/router/use-get-to-path/index.d.ts.map +1 -1
- package/dist/hooks/show/useShow.d.ts.map +1 -1
- package/dist/hooks/useMeta/index.d.ts +33 -0
- package/dist/hooks/useMeta/index.d.ts.map +1 -0
- package/dist/hooks/useSelect/index.d.ts.map +1 -1
- package/dist/hooks/useTable/index.d.ts.map +1 -1
- package/dist/iife/index.js +6 -6
- package/dist/iife/index.js.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/definitions/helpers/router/__tests__/compose-route.ts +9 -5
- package/src/definitions/helpers/router/__tests__/prepare-route-params.ts +5 -2
- package/src/definitions/helpers/router/compose-route.ts +16 -5
- package/src/definitions/helpers/router/prepare-route-params.ts +4 -16
- package/src/hooks/breadcrumb/index.ts +6 -1
- package/src/hooks/data/useCreate.ts +8 -4
- package/src/hooks/data/useCreateMany.ts +10 -5
- package/src/hooks/data/useCustom.ts +20 -6
- package/src/hooks/data/useCustomMutation.ts +8 -2
- package/src/hooks/data/useDelete.ts +10 -3
- package/src/hooks/data/useDeleteMany.ts +10 -6
- package/src/hooks/data/useInfiniteList.ts +8 -4
- package/src/hooks/data/useList.ts +11 -6
- package/src/hooks/data/useMany.ts +23 -17
- package/src/hooks/data/useOne.ts +21 -14
- package/src/hooks/data/useUpdate.ts +10 -4
- package/src/hooks/data/useUpdateMany.ts +10 -5
- package/src/hooks/form/useForm.ts +13 -6
- package/src/hooks/index.ts +1 -0
- package/src/hooks/navigation/index.ts +54 -19
- package/src/hooks/router/use-get-to-path/index.ts +6 -1
- package/src/hooks/show/useShow.ts +14 -3
- package/src/hooks/useMeta/index.ts +26 -0
- package/src/hooks/useSelect/index.ts +11 -5
- package/src/hooks/useTable/index.ts +9 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
# @pankod/refine-core
|
|
2
2
|
|
|
3
|
+
## 4.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#4135](https://github.com/refinedev/refine/pull/4135) [`e72c0d2b41f`](https://github.com/refinedev/refine/commit/e72c0d2b41ffcd9d5853e0d912a31cb88fab9841) Thanks [@salihozdemir](https://github.com/salihozdemir)! - feat: Expose the query params to the `meta` and add the ability to pass global `meta` to data provider methods
|
|
8
|
+
|
|
9
|
+
- Added the ability to pass `meta` to data provider methods globally for specific resources.
|
|
10
|
+
|
|
11
|
+
For example, to pass the `role` property to all data provider methods for the `posts` resource, use the following code:
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { Refine } from "@refinedev/core";
|
|
15
|
+
|
|
16
|
+
const App: React.FC = () => {
|
|
17
|
+
return (
|
|
18
|
+
<Refine
|
|
19
|
+
resources={[
|
|
20
|
+
{
|
|
21
|
+
name: "posts",
|
|
22
|
+
meta: {
|
|
23
|
+
role: "editor",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
]}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Now, when you call any data hook with the `posts` resource, the `meta` property will be accessible in the data provider methods.
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
const dataProvider = {
|
|
36
|
+
getList: async ({ resource, meta }) => {
|
|
37
|
+
console.log(meta.role); // "editor"
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- Added the query params to the `meta` property by default.
|
|
43
|
+
|
|
44
|
+
For example, if you call the `useList` hook on the `example.com/posts?status=published` URL, the `meta` property will be accessible in the data provider methods as follows:
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
const dataProvider = {
|
|
48
|
+
getList: async ({ resource, meta }) => {
|
|
49
|
+
console.log(meta.status); // "published"
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Patch Changes
|
|
55
|
+
|
|
56
|
+
- [#4159](https://github.com/refinedev/refine/pull/4159) [`f7f590589e7`](https://github.com/refinedev/refine/commit/f7f590589e78a255f2ce292311c6bae765b9de8f) Thanks [@aliemir](https://github.com/aliemir)! - fixed: missing resource meta in route compositions
|
|
57
|
+
|
|
58
|
+
Added missing resource meta values when composing routes. This fixes the bug where the resource meta values does not included in the route composition.
|
|
59
|
+
|
|
3
60
|
## 4.8.5
|
|
4
61
|
|
|
5
62
|
### Patch Changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MetaQuery, ParseResponse } from "src/interfaces";
|
|
2
2
|
/**
|
|
3
3
|
* This function will compose a route with the given params and meta.
|
|
4
4
|
* - A route can have parameters like (eg: /users/:id)
|
|
@@ -6,5 +6,5 @@ import { MetaDataQuery, ParseResponse } from "../../../interfaces";
|
|
|
6
6
|
* - Then we prepare the route params with the given params and meta (eg: { id: 1 })
|
|
7
7
|
* - Then we replace the route params with the prepared route params (eg: /users/1)
|
|
8
8
|
*/
|
|
9
|
-
export declare const composeRoute: (designatedRoute: string,
|
|
9
|
+
export declare const composeRoute: (designatedRoute: string, resourceMeta?: MetaQuery, parsed?: ParseResponse, meta?: Record<string, unknown>) => string;
|
|
10
10
|
//# sourceMappingURL=compose-route.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose-route.d.ts","sourceRoot":"","sources":["../../../../src/definitions/helpers/router/compose-route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"compose-route.d.ts","sourceRoot":"","sources":["../../../../src/definitions/helpers/router/compose-route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAI1D;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,oBACJ,MAAM,iBACT,SAAS,WACf,aAAa,SACf,OAAO,MAAM,EAAE,OAAO,CAAC,KAC9B,MAwBF,CAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { MetaDataQuery, ParseResponse } from "../../../interfaces";
|
|
2
1
|
/**
|
|
3
2
|
* Prepares the route params by checking the existing params and meta data.
|
|
4
3
|
* Meta data is prioritized over params.
|
|
5
4
|
* Params are prioritized over predetermined id, action and resource.
|
|
6
5
|
* This means, we can use `meta` for user supplied params (both manually or from the query string)
|
|
7
6
|
*/
|
|
8
|
-
export declare const prepareRouteParams: <TRouteParams extends Record<string,
|
|
7
|
+
export declare const prepareRouteParams: <TRouteParams extends Record<string, unknown> = Record<string, unknown>>(routeParams: (keyof TRouteParams)[], meta?: Record<string, unknown>) => Partial<TRouteParams>;
|
|
9
8
|
//# sourceMappingURL=prepare-route-params.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare-route-params.d.ts","sourceRoot":"","sources":["../../../../src/definitions/helpers/router/prepare-route-params.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"prepare-route-params.d.ts","sourceRoot":"","sources":["../../../../src/definitions/helpers/router/prepare-route-params.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,uHAIrB,OAAO,MAAM,EAAE,OAAO,CAAC,0BAShC,CAAC"}
|