@opengis/fastify-table 2.0.99 → 2.0.100
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Handlebars from "handlebars";
|
|
2
|
-
import
|
|
2
|
+
import getPGAsync from "../../plugins/pg/funcs/getPGAsync.js";
|
|
3
3
|
const maxLimit = 100;
|
|
4
4
|
/**
|
|
5
5
|
* Відображення даних з таблиці або запиту до БД на сторінці. За запитом отримуємо масив json із рядків бази даних.
|
|
@@ -27,7 +27,7 @@ export default async function contentList(options) {
|
|
|
27
27
|
return "Table undefined";
|
|
28
28
|
}
|
|
29
29
|
try {
|
|
30
|
-
const pg =
|
|
30
|
+
const pg = await getPGAsync();
|
|
31
31
|
const hasBrackets = table.trim().startsWith("(") && table.trim().endsWith(")");
|
|
32
32
|
const SQL = `select *,${pg.pk[table] || "1"}::text from ${hasBrackets ? `${table} t` : table} where ${query || "1=1"} ${order ? `order by ${order}` : ""} limit ${limit !== undefined && limit !== null ? Math.min(maxLimit, +limit) : 15}`;
|
|
33
33
|
const compiledSQL = Handlebars.compile(SQL)(options.data.root);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPGAsync.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/pg/funcs/getPGAsync.ts"],"names":[],"mappings":"AAYA,iBAAe,UAAU,CAAC,KAAK,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"getPGAsync.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/pg/funcs/getPGAsync.ts"],"names":[],"mappings":"AAYA,iBAAe,UAAU,CAAC,KAAK,CAAC,EAAE,GAAG,gBA6DpC;AAED,eAAe,UAAU,CAAC"}
|