@opengis/fastify-table 1.2.53 → 1.2.55
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
CHANGED
|
@@ -11,13 +11,14 @@ export default async function filterAPI(req) {
|
|
|
11
11
|
if (!loadTable) { return { status: 404, message: 'not found' }; }
|
|
12
12
|
|
|
13
13
|
const sqlTable = loadTable.sql?.filter?.((el) => !el?.disabled && el?.sql?.replace).map((el, i) => ` left join lateral (${el.sql.replace('{{uid}}', user?.uid)}) ${el.name || `t${i}`} on 1=1 `)?.join('') || '';
|
|
14
|
-
const { fields: columns } = await pg.query(`select * from ${loadTable.table} t ${sqlTable} limit 0`);
|
|
14
|
+
const { fields: columns = [] } = await pg.query(`select * from ${loadTable.table} t ${sqlTable} limit 0`);
|
|
15
|
+
const { fields = [] } = await pg.query(`select * from ${loadTable.table} t limit 0`);
|
|
15
16
|
|
|
16
17
|
const {
|
|
17
18
|
filter, custom, state, search,
|
|
18
19
|
} = query;
|
|
19
20
|
|
|
20
|
-
const { extra } = loadTable?.form ? await getTemplate('form', loadTable?.form) : {};
|
|
21
|
+
const { extra } = loadTable?.form ? await getTemplate('form', loadTable?.form) || {} : {};
|
|
21
22
|
|
|
22
23
|
const { optimizedSQL = `select * from ${loadTable.table}` } = loadTable?.sql || filter || custom || state || search || extra ? await getFilterSQL({
|
|
23
24
|
pg,
|
|
@@ -86,7 +87,7 @@ export default async function filterAPI(req) {
|
|
|
86
87
|
?.join(' ') || '';
|
|
87
88
|
|
|
88
89
|
// percentile_cont - alternative
|
|
89
|
-
await Promise.all(filters.filter((el) => el.name && el.type === 'Range' &&
|
|
90
|
+
await Promise.all(filters.filter((el) => el.name && el.type === 'Range' && fields?.find?.((item) => item?.name === el.name)).map(async (el) => {
|
|
90
91
|
const data = await pg.queryCache(`select array[
|
|
91
92
|
min(${el.name}),
|
|
92
93
|
percentile_disc(0.25) within group (order by ${el.name}),
|
package/utils.js
CHANGED
|
@@ -70,6 +70,9 @@ import getFolder from './server/plugins/crud/funcs/utils/getFolder.js';
|
|
|
70
70
|
|
|
71
71
|
import logChanges from './server/plugins/crud/funcs/utils/logChanges.js';
|
|
72
72
|
|
|
73
|
+
import yml2json from './server/plugins/yml/funcs/yml2json.js';
|
|
74
|
+
import json2yml from './server/plugins/yml/funcs/json2yml.js';
|
|
75
|
+
|
|
73
76
|
export default null;
|
|
74
77
|
export {
|
|
75
78
|
config,
|
|
@@ -134,4 +137,7 @@ export {
|
|
|
134
137
|
getSelect,
|
|
135
138
|
|
|
136
139
|
logChanges,
|
|
140
|
+
|
|
141
|
+
yml2json,
|
|
142
|
+
json2yml,
|
|
137
143
|
};
|