@lidofinance/api-logger 0.10.0 → 0.11.0
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/dist/index.cjs.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;AAEA,MAAM,
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;AAEA,MAAM,+BAAS,IAAI,OAAO,kBAAkB;AAC5C,MAAM,sCAAgB,IAAI,OAAO,uBAAuB;IAExD;UAAK,KAAK;IAAL,MACH,WAAA;IADG,MAEH,UAAA;IAFG,MAGH,UAAA;IAHG,MAIH,WAAA;IAJG,MAKH,SAAA;GALG,gCAAA;AAQL,MAAM,kCAAY,CAAC,OACjB,gBAAgB,QAEZ,KAAK,SAAS,CAAC;QACb,SAAS,KAAK,OAAO;QACrB,OAAO,KAAK,KAAK;IACnB,KACA,KAAK,SAAS,CAAC,KAAK;AAWnB,MAAM,4CAAsB,CAAC,UAAkD;IACpF,MAAM,WAAW;WAAI;QAAS;QAAQ;KAAc,CAAC,MAAM,CAAC;IAC5D,mGAAmG;IACnG,MAAM,OAAO,CAAC,UAA4B,CAAA,GAAA,oDAAS,EAAE,UAAU;IAE/D,MAAM,MACJ,CAAC,QACD,CAAC,GAAG,SAA4B;YAC9B,IAAI;gBACF,OAAO,CAAC,MAAM,IAAI,OAAO,GAAG,CAAC,iCAAW,GAAG,CAAC;YAC9C,EAAE,OAAO,OAAO;gBACd,QAAQ,KAAK,CAAC;gBACd,QAAQ,IAAI,CAAC;YACf;QACF;IACF,OAAO,QAAQ,GAAG,CAAC,QAAQ,KAAK,eAC5B;QACE,OAAO,IAAI,4BAAM,KAAK;QACtB,MAAM,IAAI,4BAAM,IAAI;QACpB,MAAM,IAAI,4BAAM,IAAI;QACpB,OAAO,IAAI,4BAAM,KAAK;QACtB,KAAK,IAAI,4BAAM,GAAG;IACpB,IACA,OAAO;AACb;;ADvDA","sources":["packages/api/logger/src/index.ts","packages/api/logger/src/serverLoggerFactory.ts"],"sourcesContent":["export * from './serverLoggerFactory'\n","import maskString from '@darkobits/mask-string'\n\nconst anyHex = new RegExp('0x[a-fA-F0-9]+', 'ig')\nconst anyEthAddress = new RegExp('[a-zA-Z0-9.]+\\\\.eth', 'ig')\n\nenum LEVEL {\n error = 'error',\n warn = 'warn',\n info = 'info',\n debug = 'debug',\n log = 'log',\n}\n\nconst stringify = (data: unknown) =>\n data instanceof Error\n ? // extract Error's non-enumerable props before stringifying\n JSON.stringify({\n message: data.message,\n stack: data.stack,\n })\n : JSON.stringify(data)\n\nexport type Logger = (...messages: unknown[]) => void\nexport type ServerLogger = {\n error: Logger\n warn: Logger\n info: Logger\n debug: Logger\n log: Logger\n}\n\nexport const serverLoggerFactory = (secrets: Array<RegExp | string>): ServerLogger => {\n const patterns = [...secrets, anyHex, anyEthAddress].filter(Boolean)\n // TODO: replace not with *** but with name of masked pattern e.g. https://example.com/{INFURA_KEY}\n const mask = (message: string): string => maskString(patterns, message)\n\n const log =\n (level: LEVEL) =>\n (...output: unknown[]): void => {\n try {\n console[level](...output.map(stringify).map(mask))\n } catch (error) {\n console.error(error)\n console.warn('Failed to sanitize output')\n }\n }\n return process.env.NODE_ENV === 'production'\n ? {\n error: log(LEVEL.error),\n warn: log(LEVEL.warn),\n info: log(LEVEL.info),\n debug: log(LEVEL.debug),\n log: log(LEVEL.log),\n }\n : console\n}\n"],"names":[],"version":3,"file":"index.cjs.map","sourceRoot":"../../../../"}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;ACAA;AAEA,MAAM,
|
|
1
|
+
{"mappings":";;;;;;;;ACAA;AAEA,MAAM,+BAAS,IAAI,OAAO,kBAAkB;AAC5C,MAAM,sCAAgB,IAAI,OAAO,uBAAuB;IAExD;UAAK,KAAK;IAAL,MACH,WAAA;IADG,MAEH,UAAA;IAFG,MAGH,UAAA;IAHG,MAIH,WAAA;IAJG,MAKH,SAAA;GALG,gCAAA;AAQL,MAAM,kCAAY,CAAC,OACjB,gBAAgB,QAEZ,KAAK,SAAS,CAAC;QACb,SAAS,KAAK,OAAO;QACrB,OAAO,KAAK,KAAK;IACnB,KACA,KAAK,SAAS,CAAC,KAAK;AAWnB,MAAM,4CAAsB,CAAC,UAAkD;IACpF,MAAM,WAAW;WAAI;QAAS;QAAQ;KAAc,CAAC,MAAM,CAAC;IAC5D,mGAAmG;IACnG,MAAM,OAAO,CAAC,UAA4B,CAAA,GAAA,0BAAS,EAAE,UAAU;IAE/D,MAAM,MACJ,CAAC,QACD,CAAC,GAAG,SAA4B;YAC9B,IAAI;gBACF,OAAO,CAAC,MAAM,IAAI,OAAO,GAAG,CAAC,iCAAW,GAAG,CAAC;YAC9C,EAAE,OAAO,OAAO;gBACd,QAAQ,KAAK,CAAC;gBACd,QAAQ,IAAI,CAAC;YACf;QACF;IACF,OAAO,QAAQ,GAAG,CAAC,QAAQ,KAAK,eAC5B;QACE,OAAO,IAAI,4BAAM,KAAK;QACtB,MAAM,IAAI,4BAAM,IAAI;QACpB,MAAM,IAAI,4BAAM,IAAI;QACpB,OAAO,IAAI,4BAAM,KAAK;QACtB,KAAK,IAAI,4BAAM,GAAG;IACpB,IACA,OAAO;AACb;;ADvDA","sources":["packages/api/logger/src/index.ts","packages/api/logger/src/serverLoggerFactory.ts"],"sourcesContent":["export * from './serverLoggerFactory'\n","import maskString from '@darkobits/mask-string'\n\nconst anyHex = new RegExp('0x[a-fA-F0-9]+', 'ig')\nconst anyEthAddress = new RegExp('[a-zA-Z0-9.]+\\\\.eth', 'ig')\n\nenum LEVEL {\n error = 'error',\n warn = 'warn',\n info = 'info',\n debug = 'debug',\n log = 'log',\n}\n\nconst stringify = (data: unknown) =>\n data instanceof Error\n ? // extract Error's non-enumerable props before stringifying\n JSON.stringify({\n message: data.message,\n stack: data.stack,\n })\n : JSON.stringify(data)\n\nexport type Logger = (...messages: unknown[]) => void\nexport type ServerLogger = {\n error: Logger\n warn: Logger\n info: Logger\n debug: Logger\n log: Logger\n}\n\nexport const serverLoggerFactory = (secrets: Array<RegExp | string>): ServerLogger => {\n const patterns = [...secrets, anyHex, anyEthAddress].filter(Boolean)\n // TODO: replace not with *** but with name of masked pattern e.g. https://example.com/{INFURA_KEY}\n const mask = (message: string): string => maskString(patterns, message)\n\n const log =\n (level: LEVEL) =>\n (...output: unknown[]): void => {\n try {\n console[level](...output.map(stringify).map(mask))\n } catch (error) {\n console.error(error)\n console.warn('Failed to sanitize output')\n }\n }\n return process.env.NODE_ENV === 'production'\n ? {\n error: log(LEVEL.error),\n warn: log(LEVEL.warn),\n info: log(LEVEL.info),\n debug: log(LEVEL.debug),\n log: log(LEVEL.log),\n }\n : console\n}\n"],"names":[],"version":3,"file":"index.mjs.map","sourceRoot":"../../../../"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "API logger, which hides secrets",
|
|
4
4
|
"repository": "git@github.com:lidofinance/warehouse.git",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.11.0",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"types": "dist/index.d.ts",
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "parcel build",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
19
|
+
"lint": "eslint . && prettier --check src",
|
|
20
|
+
"lint:fix": "eslint --fix . && prettier --check src --write",
|
|
21
21
|
"types": "tsc --noEmit",
|
|
22
22
|
"test": "jest"
|
|
23
23
|
},
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@darkobits/mask-string": "^2.0.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@lidofinance/config-prettier": "~0.
|
|
28
|
+
"@lidofinance/config-prettier": "~0.11.0",
|
|
29
29
|
"@types/jest": "^29.2.4",
|
|
30
30
|
"@types/node": "^18.11.17",
|
|
31
31
|
"jest": "^29.3.1",
|