@opengis/fastify-table 1.3.11 → 1.3.13
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 +1 -1
- package/server/migrations/properties.sql +2 -0
- package/server/plugins/logger/createFileStream.js +2 -9
- package/server/plugins/logger/getLogger.js +2 -1
- package/server/plugins/logger/timestampWithTimeZone.js +5 -0
- package/server/plugins/migration/exec.migrations.js +1 -0
- package/server/plugins/pg/funcs/autoIndex.js +1 -1
- package/server/routes/table/controllers/data.js +2 -2
package/package.json
CHANGED
|
@@ -2,6 +2,8 @@ create schema if not exists admin;
|
|
|
2
2
|
create schema if not exists crm;
|
|
3
3
|
create schema if not exists setting;
|
|
4
4
|
|
|
5
|
+
CREATE EXTENSION if not exists pg_trgm SCHEMA public VERSION "1.5";
|
|
6
|
+
|
|
5
7
|
-- drop old
|
|
6
8
|
DROP TABLE IF EXISTS setting.extra_data;
|
|
7
9
|
DROP TABLE IF EXISTS admin.table_properties;
|
|
@@ -4,18 +4,11 @@ import build from 'pino-abstract-transport';
|
|
|
4
4
|
import fs from 'fs';
|
|
5
5
|
|
|
6
6
|
import labels from './labels.js';
|
|
7
|
+
import timestampWithTimeZone from './timestampWithTimeZone.js';
|
|
7
8
|
|
|
8
9
|
import config from '../../../config.js';
|
|
9
10
|
|
|
10
|
-
const generator = () => () => {
|
|
11
|
-
const date = new Date();
|
|
12
|
-
const tzOffset = date.getTimezoneOffset();
|
|
13
|
-
const currentTimeWithTimezome = date - tzOffset * 60 * 1000;
|
|
14
|
-
|
|
15
|
-
// if (!opt.interval || opt.interval === '1d') {
|
|
16
|
-
return `${new Date(currentTimeWithTimezome).toISOString().split('T')[0].replace(/:/g, '_')}.log`;
|
|
17
|
-
// }
|
|
18
|
-
};
|
|
11
|
+
const generator = () => () => `${timestampWithTimeZone().split('T')[0].replace(/:/g, '_')}.log`;
|
|
19
12
|
|
|
20
13
|
const {
|
|
21
14
|
dir = 'log', interval = '1d', compress = 'gzip', // maxFiles = 90, local: teeToStdout,
|
|
@@ -7,6 +7,7 @@ import redactionList from '../../../redactionList.js';
|
|
|
7
7
|
// utils
|
|
8
8
|
import getHooks from './getHooks.js';
|
|
9
9
|
import serializers from './serializers.js';
|
|
10
|
+
import timestampWithTimeZone from './timestampWithTimeZone.js';
|
|
10
11
|
|
|
11
12
|
const isServer = process.argv[2];
|
|
12
13
|
|
|
@@ -18,7 +19,7 @@ const level = config.log?.level || process.env.PINO_LOG_LEVEL || 'info';
|
|
|
18
19
|
console.log(`log level: ${level}`);
|
|
19
20
|
const options = {
|
|
20
21
|
level, // minimal log level to write
|
|
21
|
-
timestamp:
|
|
22
|
+
timestamp: () => `,"time":"${timestampWithTimeZone()}"`, // timestamp as isostring
|
|
22
23
|
hooks: getHooks(),
|
|
23
24
|
serializers, // custom log params
|
|
24
25
|
transport: {
|
|
@@ -12,6 +12,7 @@ export default async function execMigrations(dirPath, iscore) {
|
|
|
12
12
|
!dirPath
|
|
13
13
|
|| (config.migrationsCore === false && iscore)
|
|
14
14
|
|| config.migrations === false
|
|
15
|
+
|| process.env.NODE_ENV === 'unit test'
|
|
15
16
|
) {
|
|
16
17
|
console.log('migrations skip', 'core: ', !!iscore, 'dir: ', dirPath || 'not specified');
|
|
17
18
|
return;
|
|
@@ -14,7 +14,7 @@ async function autoIndex({
|
|
|
14
14
|
}) {
|
|
15
15
|
const filter = filter1.filter(el => el);
|
|
16
16
|
|
|
17
|
-
if (!filter?.length || !table) return null;
|
|
17
|
+
if (!filter?.length || !table || process.env.NODE_ENV === 'unit test') return null;
|
|
18
18
|
|
|
19
19
|
const attrs = filter.map((el) => (el.name || el).replace(/'/g, '')).filter(el => el?.indexOf('(') === -1).sort();
|
|
20
20
|
const types = filter.filter(el => (el?.name || el)?.indexOf?.('(') === -1).map((el) => (el.name ? el : { name: el }))
|
|
@@ -49,7 +49,7 @@ export default async function dataAPI(req, reply, called) {
|
|
|
49
49
|
|
|
50
50
|
if (query.sql === '0') return loadTable;
|
|
51
51
|
|
|
52
|
-
if (!loadTable && !(tokenData?.table && pg.pk?.[tokenData?.table])) { return { message: 'template not found', status: 404 }; }
|
|
52
|
+
if (!loadTable && !(tokenData?.table && pg.pk?.[tokenData?.table]) && !(called && pg.pk?.[params?.table])) { return { message: 'template not found', status: 404 }; }
|
|
53
53
|
|
|
54
54
|
const id = tokenData?.id || hookData?.id || params?.id;
|
|
55
55
|
const { actions = [], query: accessQuery } = await getAccess({ table: tokenData?.table || hookData?.table || params.table, id, user }, pg) || {};
|
|
@@ -60,7 +60,7 @@ export default async function dataAPI(req, reply, called) {
|
|
|
60
60
|
|
|
61
61
|
const {
|
|
62
62
|
table, columns = [], sql, cardSql, filters, form, meta, sqlColumns, public: ispublic, editable = false,
|
|
63
|
-
} = loadTable || tokenData;
|
|
63
|
+
} = loadTable || tokenData || params;
|
|
64
64
|
|
|
65
65
|
const tableMeta = await getMeta({ pg, table });
|
|
66
66
|
timeArr.push(Date.now())
|