@opengis/fastify-table 1.2.85 → 1.2.87
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/package.json +2 -2
- package/server/plugins/pg/funcs/getPG.js +2 -1
- package/server/plugins/pg/funcs/getPGAsync.js +2 -1
- package/server/plugins/table/funcs/getFilterSQL/index.js +3 -1
- package/server/plugins/table/funcs/getFilterSQL/util/formatValue.js +1 -1
- package/server/routes/table/index.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengis/fastify-table",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.87",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "core-plugins",
|
|
6
6
|
"keywords": [
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@fastify/http-proxy": "9.5.0",
|
|
32
32
|
"@fastify/sensible": "^5.0.0",
|
|
33
33
|
"@fastify/url-data": "5.4.0",
|
|
34
|
-
"@opengis/fastify-hb": "1.
|
|
34
|
+
"@opengis/fastify-hb": "1.7.0",
|
|
35
35
|
"fastify": "^4.26.1",
|
|
36
36
|
"fastify-plugin": "^4.0.0",
|
|
37
37
|
"ioredis": "5.3.2",
|
|
@@ -11,7 +11,8 @@ import init from './init.js';
|
|
|
11
11
|
import getDBParams from './getDBParams.js';
|
|
12
12
|
|
|
13
13
|
function getPG(param) {
|
|
14
|
-
const dbListParams = dblist.find(el => el.
|
|
14
|
+
const dbListParams = dblist.find(el => el.key === param?.key)
|
|
15
|
+
|| dblist.find(el => el.database === (param?.db || param?.database || param));
|
|
15
16
|
const {
|
|
16
17
|
user, password, host, port, db, database, name: origin,
|
|
17
18
|
} = dbListParams ?? (typeof param === 'string' ? getDBParams(param) : param || {});
|
|
@@ -11,7 +11,8 @@ import init from './init.js';
|
|
|
11
11
|
import getDBParams from './getDBParams.js';
|
|
12
12
|
|
|
13
13
|
async function getPGAsync(param) {
|
|
14
|
-
const dbListParams = dblist.find(el => el.
|
|
14
|
+
const dbListParams = dblist.find(el => el.key === param?.key)
|
|
15
|
+
|| dblist.find(el => el.database === (param?.db || param?.database || param));
|
|
15
16
|
const {
|
|
16
17
|
user, password, host, port, db, database, name: origin,
|
|
17
18
|
} = dbListParams ?? (typeof param === 'string' ? getDBParams(param) : param || {});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import getTemplate from '../getTemplate.js';
|
|
2
|
+
import getSelect from '../getSelect.js';
|
|
2
3
|
import pgClients from '../../../pg/pgClients.js';
|
|
3
4
|
import config from '../../../../../config.js';
|
|
4
5
|
|
|
@@ -96,7 +97,8 @@ export default async function getFilterSQL({
|
|
|
96
97
|
Object.assign(el, { extra: { table: extraDataTable, input: extraColumns.find(item => item?.name === el?.name)?.type } });
|
|
97
98
|
}
|
|
98
99
|
if (!el?.data) return el;
|
|
99
|
-
const cls = await getTemplate(['cls', 'select'], el.data);
|
|
100
|
+
// const cls = await getTemplate(['cls', 'select'], el.data); // only git cls
|
|
101
|
+
const cls = await getSelect(el.data, pg); // git + db cls
|
|
100
102
|
|
|
101
103
|
if (Array.isArray(cls) && cls?.length) {
|
|
102
104
|
Object.assign(el, { cls: el.data, options: cls, select: `select code, name from admin.cls where parent='${el.data}'` });
|
|
@@ -23,7 +23,7 @@ export default function formatValue({
|
|
|
23
23
|
const matchNull = { null: 'is null', notnull: 'is not null' }[value];
|
|
24
24
|
// null = true is null, not false
|
|
25
25
|
const matchBoolean = fieldType === 'boolean' ? { true: 'is true', false: 'is false' }[value] : null;
|
|
26
|
-
const matchMulti = fieldType
|
|
26
|
+
const matchMulti = fieldType?.includes('[]') ? `::text[] && '{${value}}'::text[]` : null;
|
|
27
27
|
const match = matchNull || matchBoolean || matchMulti || `::text=any('{${value}}'::text[])`;
|
|
28
28
|
|
|
29
29
|
// geometry
|
|
@@ -16,7 +16,7 @@ async function plugin(fastify, config = {}) {
|
|
|
16
16
|
const prefix = config.prefix || '/api';
|
|
17
17
|
const policy = ['public'];
|
|
18
18
|
fastify.get(`${prefix}/suggest/:data`, { config: { policy }, schema: suggestSchema }, suggest);
|
|
19
|
-
fastify.get(`${prefix}/data/:table/:id?`, { config: { policy }, schema: tableSchema }, data); // vs.crm.data.api с node
|
|
19
|
+
fastify.get(`${prefix}/data/:table/:id?`, { config: { policy: ['public', 'no-sql'] }, schema: tableSchema }, data); // vs.crm.data.api с node
|
|
20
20
|
|
|
21
21
|
fastify.get(`${prefix}/card/:table/:id`, { config: { policy }, schema: tableSchema }, card);
|
|
22
22
|
fastify.get(`${prefix}/search`, { config: { policy }, schema: searchSchema }, search);
|