@raphiniert/ra-data-postgrest 2.0.0-alpha.0 → 2.0.0-alpha.3

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/esm/index.js CHANGED
@@ -9,233 +9,241 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { fetchUtils } from 'ra-core';
13
12
  import { getPrimaryKey, parseFilters, getOrderBy, dataWithId, getQuery, getKeyData, encodeId, decodeId, isCompoundKey, } from './urlBuilder';
14
- /**
15
- * Maps react-admin queries to a postgrest REST API
16
- *
17
- * This REST dialect uses postgrest syntax
18
- *
19
- * @see https://postgrest.org/en/stable/api.html#embedded-filters
20
- *
21
- * @example
22
- *
23
- * getList => GET http://my.api.url/posts?order=title.asc&offset=0&limit=24&filterField=eq.value
24
- * getOne => GET http://my.api.url/posts?id=eq.123
25
- * getMany => GET http://my.api.url/posts?id=in.(123,456,789)
26
- * getManyReference => GET http://my.api.url/posts?author_id=eq.345
27
- * create => POST http://my.api.url/posts
28
- * update => PATCH http://my.api.url/posts?id=eq.123
29
- * updateMany => PATCH http://my.api.url/posts?id=in.(123,456,789)
30
- * delete => DELETE http://my.api.url/posts?id=eq.123
31
- * deleteMany => DELETE http://my.api.url/posts?id=in.(123,456,789)
32
- *
33
- * @example
34
- *
35
- * import * as React from 'react';
36
- * import { Admin, Resource } from 'react-admin';
37
- * import postgrestRestProvider from '@promitheus/ra-data-postgrest';
38
- *
39
- * import { PostList } from './posts';
40
- *
41
- * const App = () => (
42
- * <Admin dataProvider={postgrestRestProvider('http://path.to.my.api/')}>
43
- * <Resource name="posts" list={PostList} />
44
- * </Admin>
45
- * );
46
- *
47
- * export default App;
48
- */
49
- var defaultPrimaryKeys = new Map();
50
- export default (function (apiUrl, httpClient, defaultListOp, primaryKeys) {
51
- if (httpClient === void 0) { httpClient = fetchUtils.fetchJson; }
52
- if (defaultListOp === void 0) { defaultListOp = 'eq'; }
53
- if (primaryKeys === void 0) { primaryKeys = defaultPrimaryKeys; }
54
- return ({
55
- getList: function (resource, params) {
56
- var primaryKey = getPrimaryKey(resource, primaryKeys);
57
- var _a = params.pagination, page = _a.page, perPage = _a.perPage;
58
- var _b = params.sort, field = _b.field, order = _b.order;
59
- var parsedFilter = parseFilters(params.filter, defaultListOp);
60
- var query = __assign({ order: getOrderBy(field, order, primaryKey), offset: String((page - 1) * perPage), limit: String(perPage) }, parsedFilter);
61
- // add header that Content-Range is in returned header
62
- var options = {
63
- headers: new Headers({
64
- Accept: 'application/json',
65
- Prefer: 'count=exact',
66
- }),
13
+ import qs from 'qs';
14
+ export var defaultPrimaryKeys = new Map();
15
+ export var defaultSchema = function () { return ''; };
16
+ var useCustomSchema = function (schema, metaSchema, method) {
17
+ var _a;
18
+ var funcHeaderSchema = schema;
19
+ if (metaSchema !== undefined) {
20
+ funcHeaderSchema = function () { return metaSchema; };
21
+ }
22
+ if (funcHeaderSchema().length > 0) {
23
+ var schemaHeader = '';
24
+ if (['GET', 'HEAD'].includes(method)) {
25
+ schemaHeader = 'Accept-Profile';
26
+ }
27
+ else if (['POST', 'PATCH', 'PUT', 'DELETE'].includes(method)) {
28
+ schemaHeader = 'Content-Profile';
29
+ }
30
+ else
31
+ return {};
32
+ return _a = {}, _a[schemaHeader] = funcHeaderSchema(), _a;
33
+ }
34
+ else
35
+ return {};
36
+ };
37
+ export default (function (config) { return ({
38
+ getList: function (resource, params) {
39
+ var _a, _b;
40
+ if (params === void 0) { params = {}; }
41
+ var primaryKey = getPrimaryKey(resource, config.primaryKeys);
42
+ var _c = params.pagination, page = _c.page, perPage = _c.perPage;
43
+ var _d = params.sort || {}, field = _d.field, order = _d.order;
44
+ var _e = parseFilters(params, config.defaultListOp), filter = _e.filter, select = _e.select;
45
+ var metaSchema = (_a = params.meta) === null || _a === void 0 ? void 0 : _a.schema;
46
+ var query = __assign({ offset: String((page - 1) * perPage), limit: String(perPage) }, filter);
47
+ if (field) {
48
+ query.order = getOrderBy(field, order, primaryKey);
49
+ }
50
+ if (select) {
51
+ query.select = select;
52
+ }
53
+ // add header that Content-Range is in returned header
54
+ var options = {
55
+ headers: new Headers(__assign(__assign({ Accept: 'application/json', Prefer: 'count=exact' }, (((_b = params.meta) === null || _b === void 0 ? void 0 : _b.headers) || {})), useCustomSchema(config.schema, metaSchema, 'GET'))),
56
+ };
57
+ var url = "".concat(config.apiUrl, "/").concat(resource, "?").concat(qs.stringify(query));
58
+ return config.httpClient(url, options).then(function (_a) {
59
+ var headers = _a.headers, json = _a.json;
60
+ if (!headers.has('content-range')) {
61
+ throw new Error("The Content-Range header is missing in the HTTP Response. The postgREST data provider expects \n responses for lists of resources to contain this header with the total number of results to build \n the pagination. If you are using CORS, did you declare Content-Range in the Access-Control-Expose-Headers header?");
62
+ }
63
+ return {
64
+ data: json.map(function (obj) { return dataWithId(obj, primaryKey); }),
65
+ total: parseInt(headers.get('content-range').split('/').pop(), 10),
67
66
  };
68
- var url = "".concat(apiUrl, "/").concat(resource, "?").concat(new URLSearchParams(query));
69
- return httpClient(url, options).then(function (_a) {
70
- var headers = _a.headers, json = _a.json;
71
- if (!headers.has('content-range')) {
72
- throw new Error("The Content-Range header is missing in the HTTP Response. The postgREST data provider expects \n responses for lists of resources to contain this header with the total number of results to build \n the pagination. If you are using CORS, did you declare Content-Range in the Access-Control-Expose-Headers header?");
73
- }
74
- return {
75
- data: json.map(function (obj) { return dataWithId(obj, primaryKey); }),
76
- total: parseInt(headers.get('content-range').split('/').pop(), 10),
77
- };
78
- });
79
- },
80
- getOne: function (resource, params) {
81
- var id = params.id;
82
- var primaryKey = getPrimaryKey(resource, primaryKeys);
83
- var query = getQuery(primaryKey, id, resource);
84
- var url = "".concat(apiUrl, "/").concat(resource, "?").concat(query);
85
- return httpClient(url, {
86
- headers: new Headers({
87
- accept: 'application/vnd.pgrst.object+json',
88
- }),
89
- }).then(function (_a) {
90
- var json = _a.json;
91
- return ({
92
- data: dataWithId(json, primaryKey),
93
- });
67
+ });
68
+ },
69
+ getOne: function (resource, params) {
70
+ var _a, _b;
71
+ if (params === void 0) { params = {}; }
72
+ var id = params.id, meta = params.meta;
73
+ var primaryKey = getPrimaryKey(resource, config.primaryKeys);
74
+ var query = getQuery(primaryKey, id, resource, meta);
75
+ var url = "".concat(config.apiUrl, "/").concat(resource, "?").concat(qs.stringify(query));
76
+ var metaSchema = (_a = params.meta) === null || _a === void 0 ? void 0 : _a.schema;
77
+ return config
78
+ .httpClient(url, {
79
+ headers: new Headers(__assign(__assign({ accept: 'application/vnd.pgrst.object+json' }, (((_b = params.meta) === null || _b === void 0 ? void 0 : _b.headers) || {})), useCustomSchema(config.schema, metaSchema, 'GET'))),
80
+ })
81
+ .then(function (_a) {
82
+ var json = _a.json;
83
+ return ({
84
+ data: dataWithId(json, primaryKey),
94
85
  });
95
- },
96
- getMany: function (resource, params) {
97
- var ids = params.ids;
98
- var primaryKey = getPrimaryKey(resource, primaryKeys);
99
- var query = getQuery(primaryKey, ids, resource);
100
- var url = "".concat(apiUrl, "/").concat(resource, "?").concat(query);
101
- return httpClient(url).then(function (_a) {
102
- var json = _a.json;
103
- return ({
104
- data: json.map(function (data) { return dataWithId(data, primaryKey); }),
105
- });
86
+ });
87
+ },
88
+ getMany: function (resource, params) {
89
+ var _a;
90
+ if (params === void 0) { params = {}; }
91
+ var ids = params.ids;
92
+ var primaryKey = getPrimaryKey(resource, config.primaryKeys);
93
+ var query = getQuery(primaryKey, ids, resource, params.meta);
94
+ var url = "".concat(config.apiUrl, "/").concat(resource, "?").concat(qs.stringify(query));
95
+ var metaSchema = (_a = params.meta) === null || _a === void 0 ? void 0 : _a.schema;
96
+ return config
97
+ .httpClient(url, {
98
+ headers: new Headers(__assign({}, useCustomSchema(config.schema, metaSchema, 'GET'))),
99
+ })
100
+ .then(function (_a) {
101
+ var json = _a.json;
102
+ return ({
103
+ data: json.map(function (data) { return dataWithId(data, primaryKey); }),
106
104
  });
107
- },
108
- getManyReference: function (resource, params) {
109
- var _a;
110
- var _b = params.pagination, page = _b.page, perPage = _b.perPage;
111
- var _c = params.sort, field = _c.field, order = _c.order;
112
- var parsedFilter = parseFilters(params.filter, defaultListOp);
113
- var primaryKey = getPrimaryKey(resource, primaryKeys);
114
- var query = params.target
115
- ? __assign((_a = {}, _a[params.target] = "eq.".concat(params.id), _a.order = getOrderBy(field, order, primaryKey), _a.offset = String((page - 1) * perPage), _a.limit = String(perPage), _a), parsedFilter) : __assign({ order: getOrderBy(field, order, primaryKey), offset: String((page - 1) * perPage), limit: String(perPage) }, parsedFilter);
116
- // add header that Content-Range is in returned header
117
- var options = {
118
- headers: new Headers({
119
- Accept: 'application/json',
120
- Prefer: 'count=exact',
121
- }),
105
+ });
106
+ },
107
+ getManyReference: function (resource, params) {
108
+ var _a;
109
+ var _b, _c;
110
+ if (params === void 0) { params = {}; }
111
+ var _d = params.pagination, page = _d.page, perPage = _d.perPage;
112
+ var _e = params.sort, field = _e.field, order = _e.order;
113
+ var _f = parseFilters(params, config.defaultListOp), filter = _f.filter, select = _f.select;
114
+ var primaryKey = getPrimaryKey(resource, config.primaryKeys);
115
+ var metaSchema = (_b = params.meta) === null || _b === void 0 ? void 0 : _b.schema;
116
+ var query = params.target
117
+ ? __assign((_a = {}, _a[params.target] = "eq.".concat(params.id), _a.order = getOrderBy(field, order, primaryKey), _a.offset = String((page - 1) * perPage), _a.limit = String(perPage), _a), filter) : __assign({ order: getOrderBy(field, order, primaryKey), offset: String((page - 1) * perPage), limit: String(perPage) }, filter);
118
+ if (select) {
119
+ query.select = select;
120
+ }
121
+ // add header that Content-Range is in returned header
122
+ var options = {
123
+ headers: new Headers(__assign(__assign({ Accept: 'application/json', Prefer: 'count=exact' }, (((_c = params.meta) === null || _c === void 0 ? void 0 : _c.headers) || {})), useCustomSchema(config.schema, metaSchema, 'GET'))),
124
+ };
125
+ var url = "".concat(config.apiUrl, "/").concat(resource, "?").concat(qs.stringify(query));
126
+ return config.httpClient(url, options).then(function (_a) {
127
+ var headers = _a.headers, json = _a.json;
128
+ if (!headers.has('content-range')) {
129
+ throw new Error("The Content-Range header is missing in the HTTP Response. The postgREST data provider expects \n responses for lists of resources to contain this header with the total number of results to build \n the pagination. If you are using CORS, did you declare Content-Range in the Access-Control-Expose-Headers header?");
130
+ }
131
+ return {
132
+ data: json.map(function (data) { return dataWithId(data, primaryKey); }),
133
+ total: parseInt(headers.get('content-range').split('/').pop(), 10),
122
134
  };
123
- var url = "".concat(apiUrl, "/").concat(resource, "?").concat(new URLSearchParams(query));
124
- return httpClient(url, options).then(function (_a) {
125
- var headers = _a.headers, json = _a.json;
126
- if (!headers.has('content-range')) {
127
- throw new Error("The Content-Range header is missing in the HTTP Response. The postgREST data provider expects \n responses for lists of resources to contain this header with the total number of results to build \n the pagination. If you are using CORS, did you declare Content-Range in the Access-Control-Expose-Headers header?");
128
- }
129
- return {
130
- data: json.map(function (data) { return dataWithId(data, primaryKey); }),
131
- total: parseInt(headers.get('content-range').split('/').pop(), 10),
132
- };
133
- });
134
- },
135
- update: function (resource, params) {
136
- var id = params.id, data = params.data;
137
- var primaryKey = getPrimaryKey(resource, primaryKeys);
138
- var query = getQuery(primaryKey, id, resource);
139
- var primaryKeyData = getKeyData(primaryKey, data);
140
- var url = "".concat(apiUrl, "/").concat(resource, "?").concat(query);
141
- var body = JSON.stringify(__assign(__assign({}, data), primaryKeyData));
142
- return httpClient(url, {
143
- method: 'PATCH',
144
- headers: new Headers({
145
- Accept: 'application/vnd.pgrst.object+json',
146
- Prefer: 'return=representation',
147
- 'Content-Type': 'application/json',
148
- }),
149
- body: body,
150
- }).then(function (_a) {
151
- var json = _a.json;
152
- return ({ data: dataWithId(json, primaryKey) });
153
- });
154
- },
155
- updateMany: function (resource, params) {
156
- var ids = params.ids;
157
- var primaryKey = getPrimaryKey(resource, primaryKeys);
158
- var body = JSON.stringify(params.ids.map(function (id) {
159
- var data = params.data;
160
- var primaryKeyParams = decodeId(id, primaryKey);
161
- var primaryKeyData = {};
162
- if (isCompoundKey(primaryKey)) {
163
- primaryKey.forEach(function (key, index) {
164
- primaryKeyData[key] = primaryKeyParams[index];
165
- });
166
- }
167
- else {
168
- primaryKeyData[primaryKey[0]] = primaryKeyParams[0];
169
- }
170
- return __assign(__assign({}, data), primaryKeyData);
171
- }));
172
- var url = "".concat(apiUrl, "/").concat(resource);
173
- return httpClient(url, {
174
- method: 'PATCH',
175
- headers: new Headers({
176
- Prefer: 'return=representation',
177
- 'Content-Type': 'application/json',
178
- }),
179
- body: body,
180
- }).then(function (_a) {
181
- var json = _a.json;
182
- return ({
183
- data: json.map(function (data) { return encodeId(data, primaryKey); }),
135
+ });
136
+ },
137
+ update: function (resource, params) {
138
+ var _a, _b;
139
+ if (params === void 0) { params = {}; }
140
+ var id = params.id, data = params.data, meta = params.meta;
141
+ var primaryKey = getPrimaryKey(resource, config.primaryKeys);
142
+ var query = getQuery(primaryKey, id, resource, meta);
143
+ var primaryKeyData = getKeyData(primaryKey, data);
144
+ var url = "".concat(config.apiUrl, "/").concat(resource, "?").concat(qs.stringify(query));
145
+ var metaSchema = (_a = params.meta) === null || _a === void 0 ? void 0 : _a.schema;
146
+ var body = JSON.stringify(__assign(__assign({}, data), primaryKeyData));
147
+ return config
148
+ .httpClient(url, {
149
+ method: 'PATCH',
150
+ headers: new Headers(__assign(__assign({ Accept: 'application/vnd.pgrst.object+json', Prefer: 'return=representation', 'Content-Type': 'application/json' }, (((_b = params.meta) === null || _b === void 0 ? void 0 : _b.headers) || {})), useCustomSchema(config.schema, metaSchema, 'PATCH'))),
151
+ body: body,
152
+ })
153
+ .then(function (_a) {
154
+ var json = _a.json;
155
+ return ({ data: dataWithId(json, primaryKey) });
156
+ });
157
+ },
158
+ updateMany: function (resource, params) {
159
+ var _a, _b;
160
+ if (params === void 0) { params = {}; }
161
+ var ids = params.ids;
162
+ var primaryKey = getPrimaryKey(resource, config.primaryKeys);
163
+ var body = JSON.stringify(params.ids.map(function (id) {
164
+ var data = params.data;
165
+ var primaryKeyParams = decodeId(id, primaryKey);
166
+ var primaryKeyData = {};
167
+ if (isCompoundKey(primaryKey)) {
168
+ primaryKey.forEach(function (key, index) {
169
+ primaryKeyData[key] = primaryKeyParams[index];
184
170
  });
171
+ }
172
+ else {
173
+ primaryKeyData[primaryKey[0]] = primaryKeyParams[0];
174
+ }
175
+ return __assign(__assign({}, data), primaryKeyData);
176
+ }));
177
+ var url = "".concat(config.apiUrl, "/").concat(resource);
178
+ var metaSchema = (_a = params.meta) === null || _a === void 0 ? void 0 : _a.schema;
179
+ return config
180
+ .httpClient(url, {
181
+ method: 'PATCH',
182
+ headers: new Headers(__assign(__assign({ Prefer: 'return=representation', 'Content-Type': 'application/json' }, (((_b = params.meta) === null || _b === void 0 ? void 0 : _b.headers) || {})), useCustomSchema(config.schema, metaSchema, 'PATCH'))),
183
+ body: body,
184
+ })
185
+ .then(function (_a) {
186
+ var json = _a.json;
187
+ return ({
188
+ data: json.map(function (data) { return encodeId(data, primaryKey); }),
185
189
  });
186
- },
187
- create: function (resource, params) {
188
- var primaryKey = getPrimaryKey(resource, primaryKeys);
189
- var url = "".concat(apiUrl, "/").concat(resource);
190
- return httpClient(url, {
191
- method: 'POST',
192
- headers: new Headers({
193
- Accept: 'application/vnd.pgrst.object+json',
194
- Prefer: 'return=representation',
195
- 'Content-Type': 'application/json',
196
- }),
197
- body: JSON.stringify(params.data),
198
- }).then(function (_a) {
199
- var json = _a.json;
200
- return ({
201
- data: __assign(__assign({}, params.data), { id: encodeId(json, primaryKey) }),
202
- });
203
- });
204
- },
205
- delete: function (resource, params) {
206
- var id = params.id;
207
- var primaryKey = getPrimaryKey(resource, primaryKeys);
208
- var query = getQuery(primaryKey, id, resource);
209
- var url = "".concat(apiUrl, "/").concat(resource, "?").concat(query);
210
- return httpClient(url, {
211
- method: 'DELETE',
212
- headers: new Headers({
213
- Accept: 'application/vnd.pgrst.object+json',
214
- Prefer: 'return=representation',
215
- 'Content-Type': 'application/json',
216
- }),
217
- }).then(function (_a) {
218
- var json = _a.json;
219
- return ({ data: dataWithId(json, primaryKey) });
190
+ });
191
+ },
192
+ create: function (resource, params) {
193
+ var _a, _b;
194
+ if (params === void 0) { params = {}; }
195
+ var primaryKey = getPrimaryKey(resource, config.primaryKeys);
196
+ var url = "".concat(config.apiUrl, "/").concat(resource);
197
+ var metaSchema = (_a = params.meta) === null || _a === void 0 ? void 0 : _a.schema;
198
+ return config
199
+ .httpClient(url, {
200
+ method: 'POST',
201
+ headers: new Headers(__assign(__assign({ Accept: 'application/vnd.pgrst.object+json', Prefer: 'return=representation', 'Content-Type': 'application/json' }, (((_b = params.meta) === null || _b === void 0 ? void 0 : _b.headers) || {})), useCustomSchema(config.schema, metaSchema, 'POST'))),
202
+ body: JSON.stringify(params.data),
203
+ })
204
+ .then(function (_a) {
205
+ var json = _a.json;
206
+ return ({
207
+ data: __assign(__assign({}, json), { id: encodeId(json, primaryKey) }),
220
208
  });
221
- },
222
- deleteMany: function (resource, params) {
223
- var ids = params.ids;
224
- var primaryKey = getPrimaryKey(resource, primaryKeys);
225
- var query = getQuery(primaryKey, ids, resource);
226
- var url = "".concat(apiUrl, "/").concat(resource, "?").concat(query);
227
- return httpClient(url, {
228
- method: 'DELETE',
229
- headers: new Headers({
230
- Prefer: 'return=representation',
231
- 'Content-Type': 'application/json',
232
- }),
233
- }).then(function (_a) {
234
- var json = _a.json;
235
- return ({
236
- data: json.map(function (data) { return encodeId(data, primaryKey); }),
237
- });
209
+ });
210
+ },
211
+ delete: function (resource, params) {
212
+ var _a, _b;
213
+ if (params === void 0) { params = {}; }
214
+ var id = params.id, meta = params.meta;
215
+ var primaryKey = getPrimaryKey(resource, config.primaryKeys);
216
+ var query = getQuery(primaryKey, id, resource, meta);
217
+ var url = "".concat(config.apiUrl, "/").concat(resource, "?").concat(qs.stringify(query));
218
+ var metaSchema = (_a = params.meta) === null || _a === void 0 ? void 0 : _a.schema;
219
+ return config
220
+ .httpClient(url, {
221
+ method: 'DELETE',
222
+ headers: new Headers(__assign(__assign({ Accept: 'application/vnd.pgrst.object+json', Prefer: 'return=representation', 'Content-Type': 'application/json' }, (((_b = params.meta) === null || _b === void 0 ? void 0 : _b.headers) || {})), useCustomSchema(config.schema, metaSchema, 'DELETE'))),
223
+ })
224
+ .then(function (_a) {
225
+ var json = _a.json;
226
+ return ({ data: dataWithId(json, primaryKey) });
227
+ });
228
+ },
229
+ deleteMany: function (resource, params) {
230
+ var _a, _b;
231
+ if (params === void 0) { params = {}; }
232
+ var ids = params.ids, meta = params.meta;
233
+ var primaryKey = getPrimaryKey(resource, config.primaryKeys);
234
+ var query = getQuery(primaryKey, ids, resource, meta);
235
+ var url = "".concat(config.apiUrl, "/").concat(resource, "?").concat(qs.stringify(query));
236
+ var metaSchema = (_a = params.meta) === null || _a === void 0 ? void 0 : _a.schema;
237
+ return config
238
+ .httpClient(url, {
239
+ method: 'DELETE',
240
+ headers: new Headers(__assign(__assign({ Prefer: 'return=representation', 'Content-Type': 'application/json' }, (((_b = params.meta) === null || _b === void 0 ? void 0 : _b.headers) || {})), useCustomSchema(config.schema, metaSchema, 'DELETE'))),
241
+ })
242
+ .then(function (_a) {
243
+ var json = _a.json;
244
+ return ({
245
+ data: json.map(function (data) { return encodeId(data, primaryKey); }),
238
246
  });
239
- },
240
- });
241
- });
247
+ });
248
+ },
249
+ }); });
@@ -4,15 +4,19 @@ import { Identifier } from 'ra-core';
4
4
  * (https://postgrest.org/en/stable/api.html#operators)
5
5
  */
6
6
  declare const postgrestOperators: readonly ["eq", "gt", "gte", "lt", "lte", "neq", "like", "ilike", "match", "imatch", "in", "is", "fts", "plfts", "phfts", "wfts", "cs", "cd", "ov", "sl", "sr", "nxr", "nxl", "adj", "not", "or", "and"];
7
- export type PostgRestOperator = typeof postgrestOperators[number];
8
- export declare const parseFilters: (filter: Record<string, any>, defaultListOp: PostgRestOperator) => {};
7
+ type ParsedFiltersResult = {
8
+ filter: any;
9
+ select: any;
10
+ };
11
+ export type PostgRestOperator = (typeof postgrestOperators)[number];
12
+ export declare const parseFilters: (params: any, defaultListOp: PostgRestOperator) => Partial<ParsedFiltersResult>;
9
13
  export type PrimaryKey = Array<string>;
10
14
  export declare const getPrimaryKey: (resource: string, primaryKeys: Map<string, PrimaryKey>) => PrimaryKey;
11
15
  export declare const decodeId: (id: Identifier, primaryKey: PrimaryKey) => string[] | number[];
12
16
  export declare const encodeId: (data: any, primaryKey: PrimaryKey) => Identifier;
13
17
  export declare const dataWithId: (data: any, primaryKey: PrimaryKey) => any;
14
18
  export declare const isCompoundKey: (primaryKey: PrimaryKey) => Boolean;
15
- export declare const getQuery: (primaryKey: PrimaryKey, ids: Identifier | Array<Identifier>, resource: string) => string;
19
+ export declare const getQuery: (primaryKey: PrimaryKey, ids: Identifier | Array<Identifier>, resource: string, meta?: any) => any;
16
20
  export declare const getKeyData: (primaryKey: PrimaryKey, data: object) => object;
17
21
  export declare const getOrderBy: (field: string, order: string, primaryKey: PrimaryKey) => string;
18
22
  export {};