ag-common 0.0.605 → 0.0.606
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.
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.fatal = exports.error = exports.trace = exports.warn = exports.info = exports.debug = exports.SetLogLevel = exports.SetLogShim = exports.GetLogLevel = void 0;
|
|
5
5
|
const array_1 = require("./array");
|
|
6
|
+
const redact_1 = require("./string/redact");
|
|
6
7
|
const GetLogLevel = (l) => ['TRACE', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL'].findIndex((s) => s === l);
|
|
7
8
|
exports.GetLogLevel = GetLogLevel;
|
|
8
9
|
let logShim;
|
|
@@ -32,7 +33,11 @@ function logprocess(type, args) {
|
|
|
32
33
|
}
|
|
33
34
|
////////
|
|
34
35
|
const datetime = new Date().toLocaleTimeString('en-GB');
|
|
35
|
-
const log = [
|
|
36
|
+
const log = [
|
|
37
|
+
`[${datetime}]`,
|
|
38
|
+
type,
|
|
39
|
+
...args.filter(array_1.notEmpty).map((s) => (0, redact_1.redactObject)(s)),
|
|
40
|
+
];
|
|
36
41
|
if (logShim) {
|
|
37
42
|
logShim(...log);
|
|
38
43
|
return;
|
|
@@ -4,7 +4,7 @@ exports.redactObject = exports.redactString = void 0;
|
|
|
4
4
|
function redactString(str) {
|
|
5
5
|
let ret = str;
|
|
6
6
|
ret = ret !== null && ret !== void 0 ? ret : '';
|
|
7
|
-
const repl = '$1<
|
|
7
|
+
const repl = '$1<redacted>$2';
|
|
8
8
|
ret = ret.replace(/(\b)grant_type.+?(\b)/gm, repl);
|
|
9
9
|
ret = ret.replace(/(\b)Bearer .+?(\b)/gm, repl);
|
|
10
10
|
ret = ret.replace(/(\b)eyJ[a-zA-Z0-9]{10}.+?(\b)/gm, repl);
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.606",
|
|
3
3
|
"name": "ag-common",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"lint": "npx eslint --ext .ts,.tsx .",
|
|
14
14
|
"start": "cross-env BROWSER=none cross-env storybook dev -p 6006",
|
|
15
15
|
"build-storybook": "storybook build -o docs --quiet",
|
|
16
|
-
"test
|
|
16
|
+
"test": "globstar -- node --import tsx --test \"src/**/redact.test.ts\""
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@aws-sdk/client-dynamodb": "^3.390",
|