@opengis/fastify-table 1.1.19 → 1.1.20

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/Changelog.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # fastify-table
2
2
 
3
+ ## 1.1.20 - 02.10.2024
4
+
5
+ - code optimization
6
+
3
7
  ## 1.1.19 - 01.10.2024
4
8
 
5
9
  - custom hook support - addHook, applyHook
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "1.1.19",
3
+ "version": "1.1.20",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "main": "index.js",
@@ -20,7 +20,10 @@ async function getFilterSQL({
20
20
 
21
21
  const sqlList = body?.sql?.length
22
22
  ? body?.sql?.filter((el) => !el.disabled && el?.sql?.replace)
23
- .map((el) => ` left join lateral (${el.filter ? el.sql.replace(/limit 1/ig, '') : el.sql}) as ${el.name} on 1=1 `).join(' ')
23
+ .map((el, i) => {
24
+ Object.assign(el, { name: el.name || `t${i + 1}` });
25
+ return ` left join lateral (${el.filter ? el.sql.replace(/limit 1/ig, '') : el.sql}) as ${el.name} on 1=1 `;
26
+ }).join(' ')
24
27
  : '';
25
28
  const fieldQuery = config.allTemplates?.table?.[table] ? `${config.allTemplates?.table?.[table]} limit 0`
26
29
  : `select * from ${body?.table || table} ${sqlList ? ` t ${sqlList}` : ''} where 1=1 limit 0`;