@opengis/fastify-table 1.1.142 → 1.1.144
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
|
@@ -51,7 +51,7 @@ async function init(client) {
|
|
|
51
51
|
const crudInc = table ? await rclient.get(keyCacheTable) || 0 : 0;
|
|
52
52
|
|
|
53
53
|
//
|
|
54
|
-
const hash = createHash('sha1').update(query).digest('base64');
|
|
54
|
+
const hash = createHash('sha1').update([query, JSON.stringify(args)].join()).digest('base64');
|
|
55
55
|
const keyCache = `pg:${hash}:${crudInc}`;
|
|
56
56
|
|
|
57
57
|
const cacheData = await rclient.get(keyCache);
|
|
@@ -7,7 +7,7 @@ export default async function getSelectVal({
|
|
|
7
7
|
pg = pgClients.client, name, values: valuesOrigin, ar = false,
|
|
8
8
|
}) {
|
|
9
9
|
if (!valuesOrigin?.length) return null;
|
|
10
|
-
const values = valuesOrigin.filter(el => el).map(el => el.toString());
|
|
10
|
+
const values = valuesOrigin.filter(el => typeof el === 'boolean' ? true : el).map(el => el.toString());
|
|
11
11
|
const cls = await getSelect(name, pg);
|
|
12
12
|
|
|
13
13
|
// === array ===
|
|
@@ -85,7 +85,7 @@ export default async function dataAPI(req) {
|
|
|
85
85
|
|
|
86
86
|
const order = columnList.includes(orderColumn) && orderColumn?.length ? `order by ${orderColumn} ${query.desc || orderDir === 'desc' ? 'desc' : ''}` : '';
|
|
87
87
|
const search = loadTable.meta?.search && query.search
|
|
88
|
-
? `(${loadTable.meta?.search.split(',').map(el => `${el} ilike '%${query.search.replace(/%/g, '\\%')}%'`).join(' or ')})`
|
|
88
|
+
? `(${loadTable.meta?.search.split(',').map(el => `${el} ilike '%${query.search.replace(/%/g, '\\%').replace(/'/g, "''")}%'`).join(' or ')})`
|
|
89
89
|
: null;
|
|
90
90
|
const queryBbox = query?.bbox ? query.bbox.replace(/ /g, ',').split(',')?.map((el) => el - 0) : [];
|
|
91
91
|
const queryPolyline = meta?.bbox && query?.polyline ? `ST_Contains(ST_MakePolygon(ST_LineFromEncodedPolyline('${query?.polyline}')),${meta.bbox})` : undefined;
|