@opengis/fastify-table 1.2.54 → 1.2.56

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "1.2.54",
3
+ "version": "1.2.56",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [
@@ -1,7 +1,7 @@
1
1
  import pino from 'pino';
2
2
  // import path from 'node:path';
3
3
 
4
- import { config, getRedis } from '../../../utils.js';
4
+ import { config, getRedis, redactionList } from '../../../utils.js';
5
5
 
6
6
  // utils
7
7
  import getHooks from './getHooks.js';
@@ -31,11 +31,19 @@ const options = {
31
31
  },
32
32
  ],
33
33
  },
34
+ redact: redactionList,
34
35
  };
35
36
  const logger = pino(options);
37
+
36
38
  logger.file = function userFile(logfolder, msg, req) {
37
39
  logger.info({ logfolder, ...(typeof msg === 'string' ? { msg } : msg) }, req);
38
40
  };
41
+
42
+ if (config.debug) {
43
+ logger.file('test/redaction', { clientId: 'should be redacted', clientSecret: 'should be redacted' });
44
+ }
45
+
46
+
39
47
  logger.metrics = function metrics(key, val, dbName) {
40
48
  const dbname = dbName || config.pg?.database;
41
49
  if (!dbname && !isServer) return;
@@ -0,0 +1,5 @@
1
+ import { dump } from "js-yaml";
2
+
3
+ const yml2json = (json) => dump(json || {});
4
+
5
+ export default yml2json;
@@ -0,0 +1,13 @@
1
+ import { load } from "js-yaml";
2
+
3
+ function loadSafe(yml) {
4
+ try {
5
+ return load(yml);
6
+ } catch (err) {
7
+ return { error: err.toString() };
8
+ }
9
+ };
10
+
11
+ const yml2json = (yml) => loadSafe(yml);
12
+
13
+ export default yml2json;
package/utils.js CHANGED
@@ -64,16 +64,21 @@ import logger from './server/plugins/logger/getLogger.js';
64
64
  // utils
65
65
  import config from './config.js';
66
66
  import dblist from './dblist.js';
67
+ import redactionList from './redactionList.js';
67
68
  import eventStream from './server/plugins/util/funcs/eventStream.js';
68
69
  import isFileExists from './server/plugins/crud/funcs/isFileExists.js';
69
70
  import getFolder from './server/plugins/crud/funcs/utils/getFolder.js';
70
71
 
71
72
  import logChanges from './server/plugins/crud/funcs/utils/logChanges.js';
72
73
 
74
+ import yml2json from './server/plugins/yml/funcs/yml2json.js';
75
+ import json2yml from './server/plugins/yml/funcs/json2yml.js';
76
+
73
77
  export default null;
74
78
  export {
75
79
  config,
76
80
  dblist,
81
+ redactionList,
77
82
  getFolder,
78
83
  handlebars,
79
84
  handlebarsSync,
@@ -134,4 +139,7 @@ export {
134
139
  getSelect,
135
140
 
136
141
  logChanges,
142
+
143
+ yml2json,
144
+ json2yml,
137
145
  };