@raphiniert/ra-data-postgrest 1.2.1 → 2.0.0-alpha.1
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 +99 -35
- package/README.md +84 -47
- package/esm/index.d.ts +9 -4
- package/esm/index.js +242 -4
- package/esm/urlBuilder.d.ts +22 -0
- package/esm/urlBuilder.js +203 -0
- package/lib/index.d.ts +9 -4
- package/lib/index.js +242 -5
- package/lib/urlBuilder.d.ts +22 -0
- package/lib/urlBuilder.js +215 -0
- package/package.json +17 -5
- package/src/index.ts +337 -4
- package/src/urlBuilder.ts +248 -0
- package/esm/authProvider/index.d.ts +0 -11
- package/esm/authProvider/index.js +0 -58
- package/esm/dataProvider/index.d.ts +0 -9
- package/esm/dataProvider/index.js +0 -360
- package/lib/authProvider/index.d.ts +0 -11
- package/lib/authProvider/index.js +0 -60
- package/lib/dataProvider/index.d.ts +0 -9
- package/lib/dataProvider/index.js +0 -362
- package/src/authProvider/index.ts +0 -56
- package/src/dataProvider/index.ts +0 -412
package/CHANGELOG.md
CHANGED
|
@@ -2,99 +2,163 @@
|
|
|
2
2
|
|
|
3
3
|
Find all notable changes of this project in this file.
|
|
4
4
|
|
|
5
|
+
## v2.0.0-alpha.1 - 2023-04-09
|
|
6
|
+
### Improvements
|
|
7
|
+
- updated dependencies
|
|
8
|
+
- updated `urlBuilder` and integrated URL encoding
|
|
9
|
+
|
|
10
|
+
### New feature
|
|
11
|
+
- [#48](https://github.com/raphiniert-com/ra-data-postgrest/issues/48) solved by pull request [#55](https://github.com/raphiniert-com/ra-data-postgrest/pull/55), the create method should return the data returned by postgrest and not the posted data - @[christiaanwesterbeek](https://github.com/christiaanwesterbeek)
|
|
12
|
+
- [#39](https://github.com/raphiniert-com/ra-data-postgrest/pull/39), allow passing extra headers via meta for react-admin hooks - @[christiaanwesterbeek](https://github.com/christiaanwesterbeek)
|
|
13
|
+
- [#41](https://github.com/raphiniert-com/ra-data-postgrest/pull/41), allow columns filtering for getList and getManyReference - @[christiaanwesterbeek](https://github.com/christiaanwesterbeek)
|
|
14
|
+
- added support of [#41](https://github.com/raphiniert-com/ra-data-postgrest/pull/41) for other functions, but `create` and `updateMany`
|
|
15
|
+
- [#38](https://github.com/raphiniert-com/ra-data-postgrest/pull/38), Let the sort param in getList be optional - @[christiaanwesterbeek](https://github.com/christiaanwesterbeek)
|
|
16
|
+
|
|
17
|
+
|
|
5
18
|
## v1.2.1 - 2023-04-07
|
|
6
19
|
- small fix in condition
|
|
7
20
|
- fixed package name
|
|
8
21
|
|
|
22
|
+
## v2.0.0-alpha.0 - 2022-11-23
|
|
23
|
+
|
|
24
|
+
- [#42](https://github.com/raphiniert-com/ra-data-postgrest/issues/42), started adding some unit tests - @[christiaanwesterbeek](https://github.com/christiaanwesterbeek)
|
|
25
|
+
- dropped authProvider
|
|
26
|
+
- code cleanup & restructuring
|
|
27
|
+
- minor bugfixes - @[christiaanwesterbeek](https://github.com/christiaanwesterbeek)
|
|
28
|
+
- added some notes to README.md
|
|
29
|
+
|
|
30
|
+
### Breaking changes
|
|
31
|
+
|
|
32
|
+
- dropped authProvider as this should rather be an own package in case of a generic piece of software or application specific.
|
|
33
|
+
|
|
9
34
|
## v1.2.0 - 2022-08-23
|
|
10
|
-
|
|
11
|
-
-
|
|
35
|
+
|
|
36
|
+
- [#33](https://github.com/raphiniert-com/ra-data-postgrest/pull/33), adding dependabot - @[promitheus7](https://github.com/promitheus7)
|
|
37
|
+
- [#30](https://github.com/raphiniert-com/ra-data-postgrest/pull/30) and [#33](https://github.com/raphiniert-com/ra-data-postgrest/pull/33), updated dependency to compatible starting from `ra-core` 4.1.x - @[corrideat](https://github.com/corrideat), @[promitheus7](https://github.com/promitheus7)
|
|
12
38
|
|
|
13
39
|
## v1.1.9 - 2022-08-23
|
|
14
|
-
|
|
40
|
+
|
|
41
|
+
- [#30](https://github.com/raphiniert-com/ra-data-postgrest/pull/30), updated ts and modified code, such that some package dependencies became unrequired - @[corrideat](https://github.com/corrideat)
|
|
15
42
|
|
|
16
43
|
## v1.1.8 - 2022-01-07
|
|
17
|
-
|
|
44
|
+
|
|
45
|
+
- required re-release as I missed to transpile all and upload the features of 1.1.7 to npm.
|
|
18
46
|
|
|
19
47
|
## v1.1.7 - 2022-01-07
|
|
48
|
+
|
|
20
49
|
### Fixes
|
|
21
|
-
|
|
50
|
+
|
|
51
|
+
- fixed bad behaivor with compound keys while using field named `id` [issue #27](https://github.com/raphiniert-com/ra-data-postgrest/issues/27) and [issue #19](https://github.com/raphiniert-com/ra-data-postgrest/pull/19) - @[kenfehling](https://github.com/kenfehling)
|
|
22
52
|
|
|
23
53
|
### New feature
|
|
24
|
-
- [#26](https://github.com/raphiniert-com/ra-data-postgrest/pull/26), added rpc filter support, which is explained [here](https://github.com/raphiniert-com/ra-data-postgrest#special-filter-feature-rpc-functions) - @[TheRealAstroboy](https://github.com/TheRealAstroboy)
|
|
25
54
|
|
|
55
|
+
- [#26](https://github.com/raphiniert-com/ra-data-postgrest/pull/26), added rpc filter support, which is explained [here](https://github.com/raphiniert-com/ra-data-postgrest#special-filter-feature-rpc-functions) - @[TheRealAstroboy](https://github.com/TheRealAstroboy)
|
|
26
56
|
|
|
27
57
|
## v1.1.6 - 2021-01-16
|
|
58
|
+
|
|
28
59
|
### Fixes
|
|
29
|
-
|
|
60
|
+
|
|
61
|
+
- [#24](https://github.com/raphiniert-com/ra-data-postgrest/pull/24), fixed eq. prefix for non-compound keys [issue #23](https://github.com/raphiniert-com/ra-data-postgrest/issues/23) - @[andymed-jlp](https://github.com/andymed-jlp)
|
|
30
62
|
|
|
31
63
|
## v1.1.5 - 2021-01-16
|
|
64
|
+
|
|
32
65
|
### Fixes
|
|
33
|
-
|
|
66
|
+
|
|
67
|
+
- fixed query string generation of rpc endpoints [issue #22](https://github.com/raphiniert-com/ra-data-postgrest/issues/22)
|
|
34
68
|
|
|
35
69
|
### Breaking changes
|
|
36
|
-
|
|
70
|
+
|
|
71
|
+
- Support was dropped for generating the query string given many ids in case of an rpc endpoint. If your application has some psql functions which parse the standard input, I recommend to rework your db design. If this change causes strong damage to your application, please contact me in order to find a proper generic solution. Query strings of single rpc calls now drop the operator (`eq.`) and are generated properly.
|
|
37
72
|
|
|
38
73
|
## v1.1.4 - 2021-01-16
|
|
39
|
-
|
|
74
|
+
|
|
75
|
+
- deployment error
|
|
40
76
|
|
|
41
77
|
## v1.1.3 - 2020-11-30
|
|
78
|
+
|
|
42
79
|
### Fixes
|
|
43
|
-
|
|
44
|
-
-
|
|
80
|
+
|
|
81
|
+
- [#20](https://github.com/raphiniert-com/ra-data-postgrest/pull/20), fixed small bug in update - @[mkkane](https://github.com/mkkane)
|
|
82
|
+
- removed console log
|
|
45
83
|
|
|
46
84
|
## v1.1.2 - 2020-10-05
|
|
85
|
+
|
|
47
86
|
### Fixes
|
|
48
|
-
|
|
87
|
+
|
|
88
|
+
- fixed the last fix of getMany and getManyReferecnce for compound keys :)
|
|
49
89
|
|
|
50
90
|
## v1.1.1 - 2020-09-28
|
|
91
|
+
|
|
51
92
|
### Fixes
|
|
52
|
-
|
|
93
|
+
|
|
94
|
+
- fixed getMany and getManyReferecnce for compound keys
|
|
53
95
|
|
|
54
96
|
## v1.1.0 - 2020-09-16
|
|
97
|
+
|
|
55
98
|
### Fixes
|
|
56
|
-
|
|
99
|
+
|
|
100
|
+
- removed requirement to define order key in react admin, when using compound keys: default was `id`, now it's the compound key
|
|
57
101
|
|
|
58
102
|
### Breaking changes
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
103
|
+
|
|
104
|
+
- refactored compound primary keys:
|
|
105
|
+
For single custom keys wrap an array as follows:
|
|
106
|
+
```jsx
|
|
107
|
+
const dataProvider = postgrestRestProvider(
|
|
108
|
+
API_URL,
|
|
109
|
+
fetchUtils.fetchJson,
|
|
110
|
+
'eq',
|
|
111
|
+
new Map([
|
|
112
|
+
['some_table', ['custom_id']], // <- instead of ['some_table','custom_id']
|
|
113
|
+
['another_table', ['first_column', 'second_column']],
|
|
114
|
+
])
|
|
115
|
+
);
|
|
116
|
+
```
|
|
67
117
|
|
|
68
118
|
## v1.0.7 - 2020-08-23
|
|
119
|
+
|
|
69
120
|
### New feature
|
|
70
|
-
|
|
121
|
+
|
|
122
|
+
- [#14](https://github.com/raphiniert-com/ra-data-postgrest/pull/14), added compound primary keys (see [README.md](https://github.com/raphiniert-com/ra-data-postgrest/blob/master/README.md#compound-primary-keys)) - @[programmarchy](https://github.com/programmarchy)
|
|
71
123
|
|
|
72
124
|
### Maintenance
|
|
73
|
-
|
|
74
|
-
-
|
|
125
|
+
|
|
126
|
+
- `import React from 'react';` -> `import * as React from 'react';`
|
|
127
|
+
- Some minor code cleanup
|
|
75
128
|
|
|
76
129
|
## v1.0.6 - 2020-06-15
|
|
130
|
+
|
|
77
131
|
### Fixes
|
|
78
|
-
|
|
132
|
+
|
|
133
|
+
- Fixed wrong support statement concerning [postgrest starter kit](https://github.com/subzerocloud/postgrest-starter-kit) in readme
|
|
79
134
|
|
|
80
135
|
## v1.0.5 - 2020-06-15
|
|
136
|
+
|
|
81
137
|
### Fixes
|
|
82
|
-
|
|
83
|
-
-
|
|
138
|
+
|
|
139
|
+
- [#13](https://github.com/raphiniert-com/ra-data-postgrest/pull/13), Remove console.log - @[jpagex](https://github.com/jpagex)
|
|
140
|
+
- [#12](https://github.com/raphiniert-com/ra-data-postgrest/pull/12), Fixed limit parameter - @[jpagex](https://github.com/jpagex)
|
|
84
141
|
|
|
85
142
|
## v1.0.4 - 2020-06-08
|
|
143
|
+
|
|
86
144
|
### Fixes
|
|
87
|
-
|
|
88
|
-
- [#
|
|
145
|
+
|
|
146
|
+
- Fixed missing js files in npm package [#8](https://github.com/raphiniert-com/ra-data-postgrest/issues/8)
|
|
147
|
+
- [#9](https://github.com/raphiniert-com/ra-data-postgrest/pull/9), Fixed typo in readme - @[seclace](https://github.com/seclace)
|
|
89
148
|
|
|
90
149
|
## v1.0.3 - 2020-05-17
|
|
150
|
+
|
|
91
151
|
### Fixes
|
|
92
|
-
|
|
93
|
-
-
|
|
152
|
+
|
|
153
|
+
- Fixed bug when multidelete - @[colonist4096](https://github.com/colonist4096)
|
|
154
|
+
- [#5](https://github.com/raphiniert-com/ra-data-postgrest/pull/6), Fixed bug while using multiple filters on the same attribute - @[olivierdalang](https://github.com/olivierdalang)
|
|
94
155
|
|
|
95
156
|
## v1.0.2 - 2020-03-10
|
|
157
|
+
|
|
96
158
|
### Fixes
|
|
97
|
-
|
|
159
|
+
|
|
160
|
+
- [#4](https://github.com/raphiniert-com/ra-data-postgrest/pull/4), Fixed bug while using ReferenceField with UUID - @[xero88](https://github.com/xero88)
|
|
98
161
|
|
|
99
162
|
## v1.0.1 - 2020-02-01
|
|
100
|
-
|
|
163
|
+
|
|
164
|
+
- initial release
|
package/README.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
# PostgREST Data Provider For React-Admin
|
|
2
|
+
[](https://www.npmjs.com/package/@raphiniert/ra-data-postgrest)
|
|
3
|
+
[](https://www.npmjs.com/package/@raphiniert/ra-data-postgrest)
|
|
4
|
+
[](https://coveralls.io/github/raphiniert-com/ra-data-postgrest?branch=master)
|
|
5
|
+
[](https://github.com/raphiniert-com/ra-data-postgrest/blob/master/LICENSE)
|
|
6
|
+
|
|
2
7
|
|
|
3
8
|
PostgREST Data Provider for [react-admin](https://github.com/marmelab/react-admin), the frontend framework for building admin applications on top of REST/GraphQL services.
|
|
4
9
|
|
|
@@ -14,17 +19,17 @@ npm install --save @raphiniert/ra-data-postgrest
|
|
|
14
19
|
|
|
15
20
|
This Data Provider fits REST APIs using simple GET parameters for filters and sorting. This is the dialect used for instance in [PostgREST](http://postgrest.org).
|
|
16
21
|
|
|
17
|
-
| Method | API calls
|
|
18
|
-
|
|
19
|
-
| `getList` | `GET http://my.api.url/posts?order=title.asc&offset=0&limit=24&filterField=eq.value`
|
|
20
|
-
| `getOne` | `GET http://my.api.url/posts?id=eq.123`
|
|
21
|
-
| `getMany` | `GET http://my.api.url/posts?id=in.(123,456,789)`
|
|
22
|
-
| `getManyReference` | `GET http://my.api.url/posts?author_id=eq.345`
|
|
23
|
-
| `create` | `POST http://my.api.url/posts`
|
|
24
|
-
| `update` | `PATCH http://my.api.url/posts?id=eq.123`
|
|
25
|
-
| `updateMany` | `PATCH http://my.api.url/posts?id=in.(123,456,789)`
|
|
26
|
-
| `delete` | `DELETE http://my.api.url/posts?id=eq.123`
|
|
27
|
-
| `deleteMany` | `DELETE http://my.api.url/posts?id=in.(123,456,789)`
|
|
22
|
+
| Method | API calls |
|
|
23
|
+
| ------------------ | ------------------------------------------------------------------------------------ |
|
|
24
|
+
| `getList` | `GET http://my.api.url/posts?order=title.asc&offset=0&limit=24&filterField=eq.value` |
|
|
25
|
+
| `getOne` | `GET http://my.api.url/posts?id=eq.123` |
|
|
26
|
+
| `getMany` | `GET http://my.api.url/posts?id=in.(123,456,789)` |
|
|
27
|
+
| `getManyReference` | `GET http://my.api.url/posts?author_id=eq.345` |
|
|
28
|
+
| `create` | `POST http://my.api.url/posts` |
|
|
29
|
+
| `update` | `PATCH http://my.api.url/posts?id=eq.123` |
|
|
30
|
+
| `updateMany` | `PATCH http://my.api.url/posts?id=in.(123,456,789)` |
|
|
31
|
+
| `delete` | `DELETE http://my.api.url/posts?id=eq.123` |
|
|
32
|
+
| `deleteMany` | `DELETE http://my.api.url/posts?id=in.(123,456,789)` |
|
|
28
33
|
|
|
29
34
|
**Note**: The PostgREST data provider expects the API to include a `Content-Range` header in the response to `getList` calls. The value must be the total number of resources in the collection. This allows react-admin to know how many pages of resources there are in total, and build the pagination controls.
|
|
30
35
|
|
|
@@ -61,7 +66,7 @@ export default App;
|
|
|
61
66
|
|
|
62
67
|
The provider function accepts an HTTP client function as second argument. By default, they use react-admin's `fetchUtils.fetchJson()` as HTTP client. It's similar to HTML5 `fetch()`, except it handles JSON decoding and HTTP error codes automatically.
|
|
63
68
|
|
|
64
|
-
That means that if you need to add custom headers to your requests, you just need to
|
|
69
|
+
That means that if you need to add custom headers to your requests, you just need to _wrap_ the `fetchJson()` call inside your own function:
|
|
65
70
|
|
|
66
71
|
```jsx
|
|
67
72
|
import { fetchUtils, Admin, Resource } from 'react-admin';
|
|
@@ -79,7 +84,7 @@ const dataProvider = postgrestRestProvider('http://localhost:3000', httpClient);
|
|
|
79
84
|
|
|
80
85
|
render(
|
|
81
86
|
<Admin dataProvider={dataProvider} title="Example Admin">
|
|
82
|
-
|
|
87
|
+
...
|
|
83
88
|
</Admin>,
|
|
84
89
|
document.getElementById('root')
|
|
85
90
|
);
|
|
@@ -93,7 +98,7 @@ Now all the requests to the REST API will contain the `X-Custom-Header: foobar`
|
|
|
93
98
|
const httpClient = (url, options = {}) => {
|
|
94
99
|
options.user = {
|
|
95
100
|
authenticated: true,
|
|
96
|
-
token: 'SRTRDFVESGNJYTUKTYTHRG'
|
|
101
|
+
token: 'SRTRDFVESGNJYTUKTYTHRG',
|
|
97
102
|
};
|
|
98
103
|
return fetchUtils.fetchJson(url, options);
|
|
99
104
|
};
|
|
@@ -101,62 +106,94 @@ const httpClient = (url, options = {}) => {
|
|
|
101
106
|
|
|
102
107
|
Now all the requests to the REST API will contain the `Authorization: SRTRDFVESGNJYTUKTYTHRG` header.
|
|
103
108
|
|
|
104
|
-
### Using authProvider
|
|
105
|
-
This package also comes with an [authProvider](https://github.com/marmelab/react-admin/blob/master/docs/Authentication.md) for react-admin which enables you to enable authentification. The provider is designed to work together with [subzero-starter-kit](https://github.com/subzerocloud/subzero-starter-kit). This starter kit sends the JWT within a session cookie. The authProvider expects that. If you want to use postgREST without the starter kit you'll need to write your own. Feel free to contribute!
|
|
106
|
-
|
|
107
|
-
With one of the starter kits it is very easy to use the authProvider:
|
|
108
|
-
```jsx
|
|
109
|
-
// in src/App.js
|
|
110
|
-
import React from 'react';
|
|
111
|
-
import { Admin, Resource } from 'react-admin';
|
|
112
|
-
import postgrestRestProvider, { authProvider } from '@raphiniert/ra-data-postgrest';
|
|
113
|
-
|
|
114
|
-
import { PostList } from './posts';
|
|
115
|
-
|
|
116
|
-
const App = () => (
|
|
117
|
-
<Admin dataProvider={postgrestRestProvider('http://path.to.my.api/')}
|
|
118
|
-
authProvider={authProvider}>
|
|
119
|
-
<Resource name="posts" list={PostList} />
|
|
120
|
-
</Admin>
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
export default App;
|
|
124
|
-
```
|
|
125
|
-
|
|
126
109
|
### Special Filter Feature
|
|
127
|
-
|
|
110
|
+
|
|
111
|
+
As postgRest allows several comparators, e.g. `ilike`, `like`, `eq`...
|
|
128
112
|
The dataProvider is designed to enable you to specify the comparator in your react filter component:
|
|
129
113
|
|
|
130
114
|
```jsx
|
|
131
115
|
<Filter {...props}>
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
116
|
+
<TextInput label="Search" source="post_title@ilike" alwaysOn />
|
|
117
|
+
<TextInput label="Search" source="post_author" alwaysOn />
|
|
118
|
+
// some more filters
|
|
135
119
|
</Filter>
|
|
136
120
|
```
|
|
137
121
|
|
|
138
122
|
One can simply append the comparator with an `@` to the source. In this example the field `post_title` would be filtered with `ilike` whereas `post_author` would be filtered using `eq` which is the default if no special comparator is specified.
|
|
139
123
|
|
|
140
124
|
#### RPC Functions
|
|
141
|
-
|
|
125
|
+
|
|
126
|
+
Given a RPC call as `GET /rpc/add_them?post_author=Herbert HTTP/1.1`, the dataProvider allows you to filter such endpoints. As they are no view, but a SQL procedure, several postgREST features do not apply. I.e. no comparators such as `ilike`, `like`, `eq` are applicable. Only the raw value without comparator needs to be send to the API. In order to realize this behavior, just add an "empty" comparator to the field, i.e. end `source` with an `@` as in the example:
|
|
142
127
|
|
|
143
128
|
```jsx
|
|
144
129
|
<Filter {...props}>
|
|
145
|
-
|
|
146
|
-
|
|
130
|
+
<TextInput label="Search" source="post_author@" alwaysOn />
|
|
131
|
+
// some more filters
|
|
147
132
|
</Filter>
|
|
148
133
|
```
|
|
149
134
|
|
|
150
135
|
### Compound primary keys
|
|
136
|
+
|
|
151
137
|
If one has data resources without primary keys named `id`, one will have to define this specifically. Also, if there is a primary key, which is defined over multiple columns:
|
|
152
138
|
|
|
153
139
|
```jsx
|
|
154
|
-
const dataProvider = postgrestRestProvider(
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
140
|
+
const dataProvider = postgrestRestProvider(
|
|
141
|
+
API_URL,
|
|
142
|
+
fetchUtils.fetchJson,
|
|
143
|
+
'eq',
|
|
144
|
+
new Map([
|
|
145
|
+
['some_table', ['custom_id']],
|
|
146
|
+
['another_table', ['first_column', 'second_column']],
|
|
147
|
+
])
|
|
148
|
+
);
|
|
158
149
|
```
|
|
159
150
|
|
|
151
|
+
### Passing extra headers via meta
|
|
152
|
+
Postgrest supports calling functions with a single JSON parameter by sending the header Prefer: params=single-object with your request according to its [docs](https://postgrest.org/en/stable/api.html#calling-functions-with-a-single-json-parameter).
|
|
153
|
+
|
|
154
|
+
Within the data provider one can add any kind of header to the request while calling react-admin hooks, e.g.:
|
|
155
|
+
```
|
|
156
|
+
const [create, { isLoading, error }] = useCreate(
|
|
157
|
+
'rpc/my-function',
|
|
158
|
+
{
|
|
159
|
+
data: { ... },
|
|
160
|
+
meta: { headers: { Prefer: 'params=single-object' } },
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Vertical filtering
|
|
166
|
+
Postgrest supports a feature of [Vertical Filtering (Columns)](https://postgrest.org/en/stable/api.html#vertical-filtering-columns). Within the react-admin hooks this feature can be used as in the following example:
|
|
167
|
+
```
|
|
168
|
+
const { data, total, isLoading, error } = useGetList(
|
|
169
|
+
'posts',
|
|
170
|
+
{
|
|
171
|
+
pagination: { page: 1, perPage: 10 },
|
|
172
|
+
sort: { field: 'published_at', order: 'DESC' }
|
|
173
|
+
meta: { columns: ['id', 'title'] }
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Further, one should be able to leverage this feature to rename columns:
|
|
179
|
+
```
|
|
180
|
+
columns: ['id', 'somealias:title']
|
|
181
|
+
```
|
|
182
|
+
, to cast columns:
|
|
183
|
+
```
|
|
184
|
+
columns: ['id::text', 'title']
|
|
185
|
+
```
|
|
186
|
+
and even get bits from a json or jsonb column"
|
|
187
|
+
```
|
|
188
|
+
columns: ['id', 'json_data->>blood_type', 'json_data->phones']
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**Note**: not working for `create` and `updateMany`.
|
|
192
|
+
|
|
193
|
+
## Developers notes
|
|
194
|
+
|
|
195
|
+
The current development of this library was done with node v19.10 and npm 8.19.3. In this version the unit tests and the development environment should work.
|
|
196
|
+
|
|
160
197
|
## License
|
|
161
198
|
|
|
162
199
|
This data provider is licensed under the MIT License and sponsored by [raphiniert.com](https://raphiniert.com).
|
package/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { fetchUtils, DataProvider } from 'ra-core';
|
|
2
|
+
import { PrimaryKey, PostgRestOperator } from './urlBuilder';
|
|
3
|
+
declare const _default: (apiUrl: string, httpClient?: (url: any, options?: fetchUtils.Options) => Promise<{
|
|
4
|
+
status: number;
|
|
5
|
+
headers: Headers;
|
|
6
|
+
body: string;
|
|
7
|
+
json: any;
|
|
8
|
+
}>, defaultListOp?: PostgRestOperator, primaryKeys?: Map<string, PrimaryKey>) => DataProvider;
|
|
9
|
+
export default _default;
|