@opengis/fastify-table 1.5.5 → 1.5.6
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.
|
@@ -41,15 +41,15 @@ export default async function getSelectVal({ pg = pgClients.client, name, values
|
|
|
41
41
|
: {};
|
|
42
42
|
const filteredValues = values.filter((el) => !cache[el]);
|
|
43
43
|
// query select
|
|
44
|
-
const q = `with c(id,text) as (select * from (${cls.sql})q where ${id} = any(
|
|
45
|
-
.join(",")
|
|
46
|
-
.replace(/"/g, '\\"')
|
|
47
|
-
.replace(/'/g, "''")}}')) select * from c`;
|
|
44
|
+
const q = `with c(id,text) as (select * from (${cls.sql})q where ${id}::text = any($1::text[])) select * from c`;
|
|
48
45
|
const data = filteredValues.length
|
|
49
46
|
? await pg
|
|
50
|
-
.query(q)
|
|
51
|
-
.then((el) => el.rows)
|
|
52
|
-
.catch((err) =>
|
|
47
|
+
.query(q, [filteredValues])
|
|
48
|
+
.then((el) => el.rows || [])
|
|
49
|
+
.catch((err) => {
|
|
50
|
+
console.error("getSelectVal error: 2", name, q, err.toString());
|
|
51
|
+
return [];
|
|
52
|
+
})
|
|
53
53
|
: [];
|
|
54
54
|
const clsObj = {
|
|
55
55
|
...cache,
|
package/package.json
CHANGED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
{"level":"info","time":"2025-09-16T16:08:48.535Z","pid":18136,"hostname":"Setebos","msg":"Server listening at http://127.0.0.1:3000"}
|
|
2
|
-
{"level":"info","time":"2025-09-16T16:08:48.535Z","pid":18136,"hostname":"Setebos","msg":"Server listening at http://172.30.11.6:3000"}
|
|
3
|
-
{"level":"info","time":"2025-09-16T16:08:48.535Z","pid":18136,"hostname":"Setebos","msg":"Server listening at http://192.168.2.133:3000"}
|
|
4
|
-
{"level":"info","time":"2025-09-16T16:08:54.213Z","pid":18136,"hostname":"Setebos","reqId":"req-1","msg":"Route GET:/ not found"}
|
|
5
|
-
{"level":"info","time":"2025-09-16T16:08:55.755Z","pid":18136,"hostname":"Setebos","reqId":"req-2","msg":"Route GET:/ not found"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"level":"info","time":"2025-09-16T16:08:48.536Z","pid":18136,"hostname":"Setebos","logfolder":"init"}
|
package/dist/server.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-return-assign */
|
|
2
|
-
// This file contains code that we reuse
|
|
3
|
-
// between our tests.
|
|
4
|
-
import Fastify from 'fastify';
|
|
5
|
-
|
|
6
|
-
import config from './config.js';
|
|
7
|
-
import plugin from './index.js';
|
|
8
|
-
|
|
9
|
-
import loggerTest from './server/routes/logger/controllers/logger.test.api.js';
|
|
10
|
-
import { logger, addTemplateDir } from './utils.js';
|
|
11
|
-
|
|
12
|
-
const cwd = process.cwd();
|
|
13
|
-
|
|
14
|
-
const app = Fastify({ loggerInstance: logger });
|
|
15
|
-
await app.register(plugin, config);
|
|
16
|
-
addTemplateDir(`${cwd}/module/test`);
|
|
17
|
-
|
|
18
|
-
app.get('/logger-test', { schema: {} }, loggerTest);
|
|
19
|
-
app.get('/err', { schema: {} }, () => {
|
|
20
|
-
throw new Error('test error code 500');
|
|
21
|
-
});
|
|
22
|
-
app.get('/health', {
|
|
23
|
-
config: {
|
|
24
|
-
policy: 'L0', // L0, L1, L2
|
|
25
|
-
auth: 'user-jwt', // none, user-jwt, creds
|
|
26
|
-
role: 'admin', // role
|
|
27
|
-
scope: 'logger', // logger, admin, gis, bi
|
|
28
|
-
rateLimit: { max: 100, timeWindow: '1 minute', hook: 'preHandler' },
|
|
29
|
-
cors: { origins: ['https://app.example.com'] },
|
|
30
|
-
ipAllowlist: ['1.2.3.4'], // skip
|
|
31
|
-
rbac: { resource: 'id', action: 'add' }, //
|
|
32
|
-
maxPayloadBytes: 1_000_000, // chat gpt
|
|
33
|
-
}
|
|
34
|
-
}, async () => ({ ok: true }))
|
|
35
|
-
|
|
36
|
-
/* addCron(async function testCron() {
|
|
37
|
-
return (config.local || true) ? null : { message: 'Done', status: 200 };
|
|
38
|
-
}, 60 * 1); */
|
|
39
|
-
|
|
40
|
-
const user = { user_type: config.auth?.type || 'admin', uid: config.auth?.uid || '2' };
|
|
41
|
-
app.addHook('onRequest', async (req) => {
|
|
42
|
-
req.user = user;
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
app.listen({ host: config.host || '0.0.0.0', port: config.port || process.env.PORT || 3000 }, (err) => {
|
|
46
|
-
console.log(`Server started via port: ${config.port || process.env.PORT || 3000}`);
|
|
47
|
-
if (err) {
|
|
48
|
-
console.error(err.toString());
|
|
49
|
-
app.log.error(err);
|
|
50
|
-
process.exit(1);
|
|
51
|
-
}
|
|
52
|
-
});
|