@opengis/fastify-table 1.1.0 → 1.1.2
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
|
@@ -17,8 +17,8 @@ export default async function filter(req) {
|
|
|
17
17
|
const cls = await getSelect(el.data);
|
|
18
18
|
if (!cls?.arr || !loadTable.table) return;
|
|
19
19
|
const { dataTypeID } = columns.find((item) => item.name === el.id) || {};
|
|
20
|
-
const countArr = req.pg.pgType[dataTypeID]?.includes('[]')
|
|
21
|
-
? await req.pg.queryCache(`select unnest(${el.id})::text as id,count(*) from ${loadTable.table} group by unnest(${el.id})`)
|
|
20
|
+
const countArr = req.pg.pgType[dataTypeID]?.includes('[]')
|
|
21
|
+
? await req.pg.queryCache(`select unnest(${el.id})::text as id,count(*) from ${loadTable.table} group by unnest(${el.id})`)
|
|
22
22
|
: await req.pg.queryCache(`select ${el.id}::text as id,count(*) from ${loadTable.table} group by ${el.id}`);
|
|
23
23
|
|
|
24
24
|
const options = countArr.rows.map(cel => {
|
|
@@ -37,6 +37,9 @@ async function getTemplateData(template) {
|
|
|
37
37
|
// multi file template: select, etc
|
|
38
38
|
if (template.length > 1) {
|
|
39
39
|
const data = await Promise.all(template.map(async el => readFileData(el[1])));
|
|
40
|
+
if (Array.isArray(data[0])) {
|
|
41
|
+
return data[0];
|
|
42
|
+
}
|
|
40
43
|
const result = {};
|
|
41
44
|
template.forEach((el, i) => {
|
|
42
45
|
Object.assign(result, typeof data[i] === 'object' ? data[i] : { [el[2]]: data[i] });
|
package/utils.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// between our tests.
|
|
3
3
|
|
|
4
4
|
import getTemplate from './table/controllers/utils/getTemplate.js';
|
|
5
|
-
import metaFormat from './table/funcs/metaFormat';
|
|
5
|
+
import metaFormat from './table/funcs/metaFormat/index.js';
|
|
6
6
|
|
|
7
7
|
export default null;
|
|
8
8
|
export { getTemplate, metaFormat };
|