@raphiniert/ra-data-postgrest 2.5.0 → 2.6.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 +11 -0
- package/README.md +1 -1
- package/esm/index.js +1 -1
- package/esm/urlBuilder.js +1 -1
- package/lib/index.js +2 -2
- package/lib/urlBuilder.js +1 -1
- package/package.json +5 -4
- package/src/index.ts +1 -1
- package/src/urlBuilder.ts +1 -1
- package/IDEAS.md +0 -46
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Find all notable changes of this project in this file.
|
|
4
4
|
|
|
5
|
+
## v2.6.0 - 2026-10-02
|
|
6
|
+
### Fixes
|
|
7
|
+
- [#208](https://github.com/raphiniert-com/ra-data-postgrest/pull/208) Fix nested filter arrays when a column receives 3+ values @[fzaninotto](https://github.com/fzaninotto)
|
|
8
|
+
|
|
9
|
+
### Improvements
|
|
10
|
+
- updated dependencies
|
|
11
|
+
|
|
12
|
+
## v2.5.1 - 2025-04-29
|
|
13
|
+
### Fixes
|
|
14
|
+
- [#182](https://github.com/raphiniert-com/ra-data-postgrest/issues/182) Fix the need for workaround by switching to [dequal](https://www.npmjs.com/package/dequal)
|
|
15
|
+
|
|
5
16
|
## v2.5.0 - 2025-04-23
|
|
6
17
|
### Improvements
|
|
7
18
|
- [#181](https://github.com/raphiniert-com/ra-data-postgrest/pull/181) Add support for embed and prefetch @[djhi](https://github.com/djhi)
|
package/README.md
CHANGED
|
@@ -353,7 +353,7 @@ This will result in a single query to the database and populate React Admin cach
|
|
|
353
353
|
|
|
354
354
|
## Developers notes
|
|
355
355
|
|
|
356
|
-
The current development of this library was done with node
|
|
356
|
+
The current development of this library was done with node v24.21.0 (npm v11.19.0). In this version the unit tests and the development environment should work.
|
|
357
357
|
|
|
358
358
|
## License
|
|
359
359
|
|
package/esm/index.js
CHANGED
|
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { getPrimaryKey, parseFilters, getOrderBy, dataWithVirtualId, dataWithoutVirtualId, removePrimaryKey, getQuery, encodeId, } from './urlBuilder';
|
|
13
13
|
import qs from 'qs';
|
|
14
|
-
import {
|
|
14
|
+
import { dequal as isEqual } from 'dequal';
|
|
15
15
|
export var defaultPrimaryKeys = new Map();
|
|
16
16
|
export var defaultSchema = function () { return ''; };
|
|
17
17
|
var useCustomSchema = function (schema, metaSchema, method) {
|
package/esm/urlBuilder.js
CHANGED
|
@@ -135,7 +135,7 @@ export var parseFilters = function (params, defaultListOp) {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
else {
|
|
138
|
-
if (!Array.isArray(result[splitKey[0]])) {
|
|
138
|
+
if (!Array.isArray(result.filter[splitKey[0]])) {
|
|
139
139
|
// second operator, we transform to an array
|
|
140
140
|
result.filter[splitKey[0]] = [
|
|
141
141
|
result.filter[splitKey[0]],
|
package/lib/index.js
CHANGED
|
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.defaultSchema = exports.defaultPrimaryKeys = void 0;
|
|
18
18
|
var urlBuilder_1 = require("./urlBuilder");
|
|
19
19
|
var qs_1 = __importDefault(require("qs"));
|
|
20
|
-
var
|
|
20
|
+
var dequal_1 = require("dequal");
|
|
21
21
|
exports.defaultPrimaryKeys = new Map();
|
|
22
22
|
var defaultSchema = function () { return ''; };
|
|
23
23
|
exports.defaultSchema = defaultSchema;
|
|
@@ -307,7 +307,7 @@ exports.default = (function (config) { return ({
|
|
|
307
307
|
}); });
|
|
308
308
|
var getChanges = function (data, previousData) {
|
|
309
309
|
var changes = Object.keys(data).reduce(function (changes, key) {
|
|
310
|
-
if (!(0,
|
|
310
|
+
if (!(0, dequal_1.dequal)(data[key], previousData[key])) {
|
|
311
311
|
changes[key] = data[key];
|
|
312
312
|
}
|
|
313
313
|
return changes;
|
package/lib/urlBuilder.js
CHANGED
|
@@ -138,7 +138,7 @@ var parseFilters = function (params, defaultListOp) {
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
else {
|
|
141
|
-
if (!Array.isArray(result[splitKey[0]])) {
|
|
141
|
+
if (!Array.isArray(result.filter[splitKey[0]])) {
|
|
142
142
|
// second operator, we transform to an array
|
|
143
143
|
result.filter[splitKey[0]] = [
|
|
144
144
|
result.filter[splitKey[0]],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raphiniert/ra-data-postgrest",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "postgREST data provider for react-admin",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"src"
|
|
13
13
|
],
|
|
14
14
|
"authors": [
|
|
15
|
-
"Raphael
|
|
15
|
+
"Raphael Schmitt"
|
|
16
16
|
],
|
|
17
17
|
"repository": "raphiniert-com/ra-data-postgrest",
|
|
18
18
|
"homepage": "https://github.com/raphiniert-com/ra-data-postgrest",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/jest": "^29.5.14",
|
|
33
33
|
"@types/qs": "^6.9.18",
|
|
34
|
-
"cross-env": "^
|
|
34
|
+
"cross-env": "^10.1.0",
|
|
35
35
|
"eslint-config-prettier": "^10.1.2",
|
|
36
36
|
"eslint-plugin-prettier": "^5.2.6",
|
|
37
37
|
"install-peers-cli": "^2.2.0",
|
|
@@ -39,12 +39,13 @@
|
|
|
39
39
|
"prettier": "^3.5.3",
|
|
40
40
|
"rimraf": "^6.0.1",
|
|
41
41
|
"ts-jest": "^29.3.2",
|
|
42
|
-
"typescript": "^5.
|
|
42
|
+
"typescript": "^5.9.3"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"ra-core": "^5.7.3"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
+
"dequal": "^2.0.3",
|
|
48
49
|
"qs": "^6.14.0"
|
|
49
50
|
}
|
|
50
51
|
}
|
package/src/index.ts
CHANGED
package/src/urlBuilder.ts
CHANGED
|
@@ -148,7 +148,7 @@ export const parseFilters = (
|
|
|
148
148
|
result.filter[splitKey[0]] = op;
|
|
149
149
|
}
|
|
150
150
|
} else {
|
|
151
|
-
if (!Array.isArray(result[splitKey[0]])) {
|
|
151
|
+
if (!Array.isArray(result.filter[splitKey[0]])) {
|
|
152
152
|
// second operator, we transform to an array
|
|
153
153
|
result.filter[splitKey[0]] = [
|
|
154
154
|
result.filter[splitKey[0]],
|
package/IDEAS.md
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
Here's a list of customizations that I have implemented locally in an old local version of ra-data-postgrest. The gaps in the numbers means it has already been imlemented in master. My customizations are relatively low quality and without tests. I thought I'd leave it here with you for inspiration or maybe it has overlap with one of the thins you want to work on.
|
|
2
|
-
- 1: Allowing calls like dataProvider.getOne('rpc/xxx') that actually returns a single object
|
|
3
|
-
- 6: column filtering voor getOne en getMany
|
|
4
|
-
- 8: Be able to use useGetOne with an array of ids for rpc/xxx functions
|
|
5
|
-
- 8b: Be able to use useGetMany with an array of ids for rpc/xxx functions
|
|
6
|
-
- 9: Be able to use useGetList with rpc functions (that return a list)
|
|
7
|
-
- 10: we could do null valued parameters, but undefined valued paramters do not make sense to pass to Postgrest
|
|
8
|
-
- 11: be able to filter on an array of values (and use 'in' operator by default)
|
|
9
|
-
- 12: be able to sort on multiple fields
|
|
10
|
-
- 13: with calls to getOne using rpc functions do not use eq.xxx but simply xxx
|
|
11
|
-
- 17: Allow a null response with getManyReference instead of an empty array (because that's what som of my rpcs return)
|
|
12
|
-
Some might be so niche that you should ignore them and that I instead should actually implement in a decorator (a function that alters the params a bit before the dataprovider function is called)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
About the decorator. Not sure if know how to use it, but I use it like this:
|
|
16
|
-
```jsx
|
|
17
|
-
import { CreateParams, DataProvider } from 'react-admin';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Gives opportunity to alter method, resource and params before calling the original dataProvider
|
|
21
|
-
*/
|
|
22
|
-
export const decorator = (dataProvider: DataProvider) => ({
|
|
23
|
-
...dataProvider,
|
|
24
|
-
create: (originalResource: string, originalParams: CreateParams) => {
|
|
25
|
-
const method = 'create';
|
|
26
|
-
|
|
27
|
-
const newParams = {
|
|
28
|
-
...originalParams,
|
|
29
|
-
// alterations
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return dataProvider[method](originalResource, newParams);
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
And then to use it.
|
|
38
|
-
```jsx
|
|
39
|
-
const restClient = postgrestRestProvider(
|
|
40
|
-
httpClientApi,
|
|
41
|
-
defaultListOp,
|
|
42
|
-
resourcePimaryKeys
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
export const dataProvider = decorator(restClient);
|
|
46
|
-
```
|