@opengis/fastify-table 2.0.114 → 2.0.115

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 +1 @@
1
- {"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../script/migrate.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,OAAO,UAAU,OAAO,SAiB9B"}
1
+ {"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../script/migrate.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAC,OAAO,UAAU,OAAO,SAuB9B"}
@@ -1,6 +1,9 @@
1
+ import path from "node:path";
1
2
  import Fastify from "fastify";
2
3
  import config from "../config.js";
3
4
  import plugin from "../index.js";
5
+ import execMigrations from "../server/plugins/migration/exec.migrations.js";
6
+ import pgClients from "../server/plugins/pg/pgClients.js";
4
7
  const timeoutMs = +(config.migrationTimeout || 5000);
5
8
  const port = process.env.PORT || config.port || 3000;
6
9
  if (import.meta.main) {
@@ -11,6 +14,7 @@ export default function migrate() {
11
14
  app.register(plugin, config);
12
15
  app.listen({ host: "0.0.0.0", port }, (err) => {
13
16
  console.log(`Server started via port: ${port}`);
17
+ execMigrations(path.join(process.cwd(), "server/migrations"), pgClients.client).catch((err) => console.error(err.toString()));
14
18
  setTimeout(() => {
15
19
  console.log("Server closed after timeout", timeoutMs);
16
20
  app.close();
@@ -1,8 +1,12 @@
1
+ import path from "node:path";
1
2
  import Fastify from "fastify";
2
3
 
3
4
  import config from "../config.js";
4
5
  import plugin from "../index.js";
5
6
 
7
+ import execMigrations from "../server/plugins/migration/exec.migrations.js";
8
+ import pgClients from "../server/plugins/pg/pgClients.js";
9
+
6
10
  const timeoutMs = +(config.migrationTimeout || 5000);
7
11
 
8
12
  const port = process.env.PORT || config.port || 3000;
@@ -18,6 +22,12 @@ export default function migrate() {
18
22
 
19
23
  app.listen({ host: "0.0.0.0", port }, (err: any) => {
20
24
  console.log(`Server started via port: ${port}`);
25
+
26
+ execMigrations(
27
+ path.join(process.cwd(), "server/migrations"),
28
+ pgClients.client
29
+ ).catch((err) => console.error(err.toString()));
30
+
21
31
  setTimeout(() => {
22
32
  console.log("Server closed after timeout", timeoutMs);
23
33
  app.close();
@@ -1 +1 @@
1
- {"version":3,"file":"suggest.d.ts","sourceRoot":"","sources":["../../../../../server/routes/table/controllers/suggest.ts"],"names":[],"mappings":"AA+DA,wBAA8B,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,gBAmXzD"}
1
+ {"version":3,"file":"suggest.d.ts","sourceRoot":"","sources":["../../../../../server/routes/table/controllers/suggest.ts"],"names":[],"mappings":"AA+DA,wBAA8B,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,gBAqXzD"}
@@ -231,9 +231,8 @@ export default async function suggest(req, reply) {
231
231
  }
232
232
  // query
233
233
  const { rows: dataNew } = await pg.query(sqlSuggest, query.key ? [query.key.toLowerCase()] : []);
234
- // const { rows: dataNew1 } = dataNew.length < limit ? await pg.query(sqlSuggest, query.key ? [`${query.key}`] : []) : {};
235
- // const ids = dataNew.map((el) => el.id);
236
- const data = dataNew.filter((el) => el.id && el.text);
234
+ // in case id / text = Boolean
235
+ const data = dataNew.filter((el) => Object.hasOwn(el, "id") && Object.hasOwn(el, "text"));
237
236
  if (tableName && column) {
238
237
  const { name = query.sel || column, type = "select" } = getColumnCLS(tableName, column) || {};
239
238
  await metaFormat({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "2.0.114",
3
+ "version": "2.0.115",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [