axe 12.2.2 → 12.2.4
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/README.md +1 -1
- package/dist/axe.js +32 -26
- package/dist/axe.min.js +1 -1
- package/lib/index.d.ts +247 -0
- package/lib/index.js +13 -9
- package/package.json +20 -17
- package/src/index.d.ts +247 -0
- package/src/index.js +634 -0
package/README.md
CHANGED
|
@@ -322,7 +322,7 @@ Axe will automatically add the following metadata and information to the `meta`
|
|
|
322
322
|
|
|
323
323
|
Axe will omit from metadata all properties via the default Array from `meta.omittedFields` option (see [Options](#options) below for more insight).
|
|
324
324
|
|
|
325
|
-
If the argument "meta" is an empty object, then it will not be passed as an argument to logger methods
|
|
325
|
+
If the argument "meta" is an empty object, then it will not be passed as an argument to logger methods – because you don't want to see an empty `{}` polluting your log metadata. Axe keeps your log output tidy.
|
|
326
326
|
|
|
327
327
|
```sh
|
|
328
328
|
hello world {
|
package/dist/axe.js
CHANGED
|
@@ -1040,7 +1040,6 @@ const pick = (obj, paths, length, sep) => {
|
|
|
1040
1040
|
if (val === undefined) {
|
|
1041
1041
|
continue; // eslint-disable-line no-continue
|
|
1042
1042
|
}
|
|
1043
|
-
|
|
1044
1043
|
set(picked, path, val, sep);
|
|
1045
1044
|
}
|
|
1046
1045
|
return picked;
|
|
@@ -1287,7 +1286,7 @@ module.exports = function unset(obj, prop) {
|
|
|
1287
1286
|
module.exports={
|
|
1288
1287
|
"name": "axe",
|
|
1289
1288
|
"description": "Axe is a logger-agnostic wrapper that normalizes logs regardless of argument style. Great for large development teams, old and new projects, and works with Pino, Bunyan, Winston, console, and more. It is lightweight, performant, highly-configurable, and automatically adds OS, CPU, and Git information to your logs. It supports hooks (useful for masking sensitive data) and dot-notation remapping, omitting, and picking of log metadata properties. Made for Forward Email, Lad, and Cabin.",
|
|
1290
|
-
"version": "12.2.
|
|
1289
|
+
"version": "12.2.4",
|
|
1291
1290
|
"author": "Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com)",
|
|
1292
1291
|
"browser": {
|
|
1293
1292
|
"parse-app-info": false
|
|
@@ -1318,43 +1317,45 @@ module.exports={
|
|
|
1318
1317
|
"unset-value": "2.0.1"
|
|
1319
1318
|
},
|
|
1320
1319
|
"devDependencies": {
|
|
1321
|
-
"@babel/cli": "^7.
|
|
1322
|
-
"@babel/core": "^7.
|
|
1323
|
-
"@babel/preset-env": "^7.
|
|
1324
|
-
"@commitlint/cli": "^17.
|
|
1325
|
-
"@commitlint/config-conventional": "^17.
|
|
1326
|
-
"ava": "^5.
|
|
1320
|
+
"@babel/cli": "^7.22.15",
|
|
1321
|
+
"@babel/core": "^7.22.17",
|
|
1322
|
+
"@babel/preset-env": "^7.22.15",
|
|
1323
|
+
"@commitlint/cli": "^17.7.1",
|
|
1324
|
+
"@commitlint/config-conventional": "^17.7.0",
|
|
1325
|
+
"ava": "^5.3.1",
|
|
1327
1326
|
"babelify": "^10.0.0",
|
|
1328
1327
|
"browserify": "^17.0.0",
|
|
1329
|
-
"consola": "^3.
|
|
1328
|
+
"consola": "^3.2.3",
|
|
1330
1329
|
"cross-env": "^7.0.3",
|
|
1331
|
-
"eslint": "^8.
|
|
1330
|
+
"eslint": "^8.49.0",
|
|
1332
1331
|
"eslint-config-xo-lass": "^2.0.1",
|
|
1333
|
-
"eslint-plugin-compat": "^4.
|
|
1332
|
+
"eslint-plugin-compat": "^4.2.0",
|
|
1334
1333
|
"eslint-plugin-node": "^11.1.0",
|
|
1335
1334
|
"express": "^4.18.2",
|
|
1336
1335
|
"fixpack": "^4.0.0",
|
|
1337
1336
|
"husky": "^8.0.3",
|
|
1338
1337
|
"jsdom": "15.x",
|
|
1339
1338
|
"koa": "^2.14.2",
|
|
1340
|
-
"lint-staged": "^
|
|
1339
|
+
"lint-staged": "^14.0.1",
|
|
1341
1340
|
"lodash": "^4.17.21",
|
|
1342
1341
|
"nyc": "^15.1.0",
|
|
1343
|
-
"pino": "^8.
|
|
1342
|
+
"pino": "^8.15.1",
|
|
1344
1343
|
"remark-cli": "^11.0.0",
|
|
1345
1344
|
"remark-preset-github": "^4.0.4",
|
|
1346
1345
|
"rimraf": "^5.0.1",
|
|
1347
1346
|
"signale": "^1.4.0",
|
|
1348
|
-
"sinon": "^15.
|
|
1347
|
+
"sinon": "^15.2.0",
|
|
1349
1348
|
"tinyify": "3.0.0",
|
|
1350
|
-
"
|
|
1349
|
+
"tsd": "^0.31.0",
|
|
1350
|
+
"xo": "^0.56.0"
|
|
1351
1351
|
},
|
|
1352
1352
|
"engines": {
|
|
1353
1353
|
"node": ">=14"
|
|
1354
1354
|
},
|
|
1355
1355
|
"files": [
|
|
1356
1356
|
"lib",
|
|
1357
|
-
"dist"
|
|
1357
|
+
"dist",
|
|
1358
|
+
"src"
|
|
1358
1359
|
],
|
|
1359
1360
|
"homepage": "https://github.com/cabinjs/axe",
|
|
1360
1361
|
"jsdelivr": "dist/axe.min.js",
|
|
@@ -1406,7 +1407,7 @@ module.exports={
|
|
|
1406
1407
|
"build": "npm run build:clean && npm run build:lib && npm run build:dist",
|
|
1407
1408
|
"build:clean": "rimraf lib dist",
|
|
1408
1409
|
"build:dist": "npm run browserify && npm run minify",
|
|
1409
|
-
"build:lib": "babel --config-file ./.lib.babelrc.json src --out-dir lib",
|
|
1410
|
+
"build:lib": "babel --config-file ./.lib.babelrc.json src --out-dir lib --copy-files",
|
|
1410
1411
|
"lint": "xo --fix && remark . -qfo && fixpack",
|
|
1411
1412
|
"lint-build": "npm run lint-lib && npm run lint-dist",
|
|
1412
1413
|
"lint-dist": "eslint --no-inline-config -c .dist.eslintrc.json dist",
|
|
@@ -1415,8 +1416,9 @@ module.exports={
|
|
|
1415
1416
|
"nyc": "cross-env NODE_ENV=test nyc ava",
|
|
1416
1417
|
"prepare": "husky install",
|
|
1417
1418
|
"pretest": "npm run lint",
|
|
1418
|
-
"test": "npm run build && npm run lint-build && npm run nyc"
|
|
1419
|
+
"test": "npm run build && npm run lint-build && tsd && npm run nyc"
|
|
1419
1420
|
},
|
|
1421
|
+
"types": "lib/index.d.ts",
|
|
1420
1422
|
"unpkg": "dist/axe.min.js"
|
|
1421
1423
|
}
|
|
1422
1424
|
|
|
@@ -1471,10 +1473,10 @@ function dotifyToArray(obj) {
|
|
|
1471
1473
|
const convertedKey = isSymbol(key) ? Symbol.keyFor(key) || key.description : key;
|
|
1472
1474
|
const newKey = current ? current + '.' + convertedKey : convertedKey; // joined key with dot
|
|
1473
1475
|
// if (value && typeof value === 'object' && !(value instanceof Date) && !ObjectID.isValid(value)) {
|
|
1474
|
-
if (isPlainObject(value)) {
|
|
1476
|
+
if (isPlainObject(value) && res.indexOf(convertedKey) === -1) {
|
|
1475
1477
|
res.push(convertedKey);
|
|
1476
1478
|
recurse(value, newKey); // it's a nested object, so do it again
|
|
1477
|
-
} else {
|
|
1479
|
+
} else if (res.indexOf(newKey) === -1) {
|
|
1478
1480
|
res.push(newKey);
|
|
1479
1481
|
}
|
|
1480
1482
|
}
|
|
@@ -1502,6 +1504,9 @@ function isString(value) {
|
|
|
1502
1504
|
function isFunction(value) {
|
|
1503
1505
|
return typeof value === 'function';
|
|
1504
1506
|
}
|
|
1507
|
+
function getFunction(value) {
|
|
1508
|
+
return isFunction(value) ? value : null;
|
|
1509
|
+
}
|
|
1505
1510
|
class Axe {
|
|
1506
1511
|
// eslint-disable-next-line complexity
|
|
1507
1512
|
constructor() {
|
|
@@ -1560,12 +1565,13 @@ class Axe {
|
|
|
1560
1565
|
// Bind helper functions for each log level
|
|
1561
1566
|
for (const element of levels) {
|
|
1562
1567
|
// Ensure function exists in logger passed
|
|
1563
|
-
if (
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1568
|
+
if (element === 'fatal') {
|
|
1569
|
+
this.config.logger.fatal = getFunction(this.config.logger[element]) || getFunction(this.config.logger.error) || getFunction(this.config.logger.info) || getFunction(this.config.logger.log);
|
|
1570
|
+
} else {
|
|
1571
|
+
this.config.logger[element] = getFunction(this.config.logger[element]) || getFunction(this.config.logger.info) || getFunction(this.config.logger.log);
|
|
1572
|
+
}
|
|
1573
|
+
if (!isFunction(this.config.logger[element])) {
|
|
1574
|
+
throw new Error(`\`${element}\` must be a function on the logger.`);
|
|
1569
1575
|
}
|
|
1570
1576
|
|
|
1571
1577
|
// Bind log handler which normalizes args and populates meta
|
package/dist/axe.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Axe=e()}}((function(){!function(e){"use strict";e.console||(e.console={});for(var t,r,n=e.console,o=function(){},i=["memory"],s="assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(",");t=i.pop();)n[t]||(n[t]={});for(;r=s.pop();)n[r]||(n[r]=o)}("undefined"==typeof window?this:window);var e={hostname:function(){return"undefined"!=typeof location?location.hostname:""}},t=function(e){var t=Array.prototype.slice.call(arguments,1);return t.length&&(e=e.toString().replace(/(%?)(%([jds]))/g,(function(e,r,n,o){var i=t.shift();switch(o){case"s":i=""+i;break;case"d":i=Number(i);break;case"j":i=JSON.stringify(i)}return r?(t.unshift(i),e):i}))),t.length&&(e=e.toString()+" "+t.join(" ")),""+e.toString().replace(/%{2,2}/g,"%")},r=["%s","%d","%i","%f","%j","%o","%O","%%"],n=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(n=e,"[object Object]"!==Object.prototype.toString.call(n)||!t)return e;var n;const o=Array.isArray(t)?t:String(t).split(r),{length:i}=o;return i<2?e[o[0]]:((e,t,r)=>{for(let n=0;n<r;n++){if(null===e)return;const r=e[t[n]];if(void 0===r)return;e=r}return e})(e,o,i)},o=function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return e instanceof Error}},i="undefined"!=typeof Symbol&&Symbol,s={},c=Object.prototype.toString;if("function"==typeof i&&"function"==typeof Symbol&&"symbol"==typeof i("foo")&&"symbol"==typeof Symbol("bar")&&function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0}()){var f=Symbol.prototype.toString,a=/^Symbol\(.*\)$/;s=function(e){if("symbol"==typeof e)return!0;if("[object Symbol]"!==c.call(e))return!1;try{return function(e){return"symbol"==typeof e.valueOf()&&a.test(f.call(e))}(e)}catch(t){return!1}}}else s=function(e){return!1};var l=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype};const{hasOwnProperty:u}=Object.prototype,{propertyIsEnumerable:p}=Object,g=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),y=this,h={concatArrays:!1,ignoreUndefined:!1},m=e=>{const t=[];for(const r in e)u.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols){const r=Object.getOwnPropertySymbols(e);for(const n of r)p.call(e,n)&&t.push(n)}return t};function d(e){return Array.isArray(e)?function(e){const t=e.slice(0,0);return m(e).forEach(r=>{g(t,r,d(e[r]))}),t}(e):l(e)?function(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return m(e).forEach(r=>{g(t,r,d(e[r]))}),t}(e):e}const b=(e,t,r,n)=>(r.forEach(r=>{void 0===t[r]&&n.ignoreUndefined||(r in e&&e[r]!==Object.getPrototypeOf(e)?g(e,r,v(e[r],t[r],n)):g(e,r,d(t[r])))}),e);function v(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?((e,t,r)=>{let n=e.slice(0,0),o=0;return[e,t].forEach(t=>{const i=[];for(let r=0;r<t.length;r++)u.call(t,r)&&(i.push(String(r)),g(n,o++,t===e?t[r]:d(t[r])));n=b(n,t,m(t).filter(e=>!i.includes(e)),r)}),n})(e,t,r):l(t)&&l(e)?b(e,t,m(t),r):d(t)}var O={};const A=async(e,t)=>{const r=[];let n=0;for(const o of e)r.push(await t(await o,n++));return r};(O=A).default=A;var j={};function w(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return S(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?S(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){c=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(c)throw i}}}}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var E=function e(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!o(t))throw new Error("`err` must be an Error");if(!Array.isArray(r))throw new TypeError("`fields` must be an Array");const n={};var i,s=w(new Set([...Object.getOwnPropertyNames(Object.getPrototypeOf(t)),...Object.getOwnPropertyNames(t)]));try{for(s.s();!(i=s.n()).done;){const e=i.value;"function"!=typeof t[e]&&(n[e]=t[e])}}catch(t){s.e(t)}finally{s.f()}return!n.name&&t.constructor.name&&(n.name=t.constructor.name),Array.isArray(t.errors)&&(n.errors=t.errors.map(t=>o(t)?e(t,r):t)),Array.isArray(r)&&r.length>0?n.filter(e=>r.includes(e)):n};const _=e=>"object"==typeof e||"function"==typeof e,T=(e,t)=>"__proto__"==e||"constructor"==e&&"function"==typeof t.constructor;var P=function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".";if(!_(e)||!t||!t.length)return e;const o=Array.isArray(t)?t:String(t).split(n);if(T(o[0],e))return e;const{length:i}=o;return 1===i?(e[o[0]]=r,e):((e,t,r,n)=>{let o=e,i=0;for(;i<r-1;i++){const e=t[i];T(e,o)||(o=_(o[e])?o[e]:o[e]={})}return o[t[i]]=n,e})(e,o,i,r)},k=function(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)};function x(e,t,r){return"function"==typeof r.join?r.join(e):e[0]+t+e[1]}function I(e,t,r){return"function"!=typeof r.isValid||r.isValid(e,t)}function L(e){return k(e)||Array.isArray(e)||"function"==typeof e}var M=Object.prototype.toString;function F(e){return"function"==typeof e.constructor?e.constructor.name:null}var N=function e(t){switch(function(e){if(void 0===e)return"undefined";if(null===e)return"null";var t=typeof e;if("boolean"===t)return"boolean";if("string"===t)return"string";if("number"===t)return"number";if("symbol"===t)return"symbol";if("function"===t)return"GeneratorFunction"===F(e)?"generatorfunction":"function";if(function(e){return Array.isArray?Array.isArray(e):e instanceof Array}(e))return"array";if(function(e){return!(!e.constructor||"function"!=typeof e.constructor.isBuffer)&&e.constructor.isBuffer(e)}(e))return"buffer";if(function(e){try{if("number"==typeof e.length&&"function"==typeof e.callee)return!0}catch(t){if(-1!==t.message.indexOf("callee"))return!0}return!1}(e))return"arguments";if(function(e){return e instanceof Date||"function"==typeof e.toDateString&&"function"==typeof e.getDate&&"function"==typeof e.setDate}(e))return"date";if(function(e){return e instanceof Error||"string"==typeof e.message&&e.constructor&&"number"==typeof e.constructor.stackTraceLimit}(e))return"error";if(function(e){return e instanceof RegExp||"string"==typeof e.flags&&"boolean"==typeof e.ignoreCase&&"boolean"==typeof e.multiline&&"boolean"==typeof e.global}(e))return"regexp";switch(F(e)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(function(e){return"function"==typeof e.throw&&"function"==typeof e.return&&"function"==typeof e.next}(e))return"generator";switch(t=M.call(e)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")}(t)){case"boolean":case"date":case"function":case"null":case"number":return!0;case"undefined":return!1;case"regexp":return"(?:)"!==t.source&&""!==t.source;case"buffer":return""!==t.toString();case"error":return""!==t.message;case"string":case"arguments":return 0!==t.length;case"file":case"map":case"set":return 0!==t.size;case"array":case"object":for(const r of Object.keys(t))if(e(t[r]))return!0;return!1;default:return!0}},D=function(e,t,r){return!(null==(n=e)||"object"!=typeof n&&"function"!=typeof n&&!Array.isArray(n)||"string"!=typeof t&&!Array.isArray(t))&&N(function(e,t,r){if(k(r)||(r={default:r}),!L(e))return void 0!==r.default?r.default:e;"number"==typeof t&&(t=String(t));const n=Array.isArray(t),o="string"==typeof t,i=r.separator||".",s=r.joinChar||("string"==typeof i?i:".");if(!o&&!n)return e;if(o&&t in e)return I(t,e,r)?e[t]:r.default;let c=n?t:function(e,t,r){return"function"==typeof r.split?r.split(e):e.split(t)}(t,i,r),f=c.length,a=0;do{let t=c[a];for("number"==typeof t&&(t=String(t));t&&"\\"===t.slice(-1);)t=x([t.slice(0,-1),c[++a]||""],s,r);if(t in e){if(!I(t,e,r))return r.default;e=e[t]}else{let n=!1,o=a+1;for(;o<f;)if(n=(t=x([t,c[o++]],s,r))in e){if(!I(t,e,r))return r.default;e=e[t],a=o-1;break}if(!n)return r.default}}while(++a<f&&L(e));return a===f?e:r.default}(e,t,r));var n};const C=e=>{if((e=>"__proto__"===e||"constructor"===e||"prototype"===e)(e))throw new Error(`Cannot set unsafe key: "${e}"`)};var B=function(e,t){if(null==(r=e)||"object"!=typeof r||!1!==Array.isArray(r))throw new TypeError("expected an object.");var r,n=Array.isArray(t);if(!n&&e.hasOwnProperty(t))return delete e[t],!0;if(D(e,t)){for(var o=n?t.slice():t.split("."),i=o.pop();o.length&&"\\"===o[o.length-1].slice(-1);)i=o.pop().slice(0,-1)+"."+i;for(;o.length;)t=o.shift(),C(t),e=e[t];return delete e[i]}return!0},X={};Object.defineProperty(X,"__esModule",{value:!0}),X.boolean=void 0,X.boolean=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1"].includes(e.trim().toLowerCase());case"[object Number]":return 1===e.valueOf();case"[object Boolean]":return e.valueOf();default:return!1}};var H={};Object.defineProperty(H,"__esModule",{value:!0}),H.isBooleanable=void 0,H.isBooleanable=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1","false","f","no","n","off","0"].includes(e.trim().toLowerCase());case"[object Number]":return[0,1].includes(e.valueOf());case"[object Boolean]":return!0;default:return!1}};var R={};Object.defineProperty(R,"__esModule",{value:!0}),R.boolean=void 0,Object.defineProperty(R,"boolean",{enumerable:!0,get:function(){return X.boolean}}),Object.defineProperty(R,"isBooleanable",{enumerable:!0,get:function(){return H.isBooleanable}});var U,K,W,z="12.2.2",$=U={};function V(){throw new Error("setTimeout has not been defined")}function G(){throw new Error("clearTimeout has not been defined")}function J(e){if(K===setTimeout)return setTimeout(e,0);if((K===V||!K)&&setTimeout)return K=setTimeout,setTimeout(e,0);try{return K(e,0)}catch(t){try{return K.call(null,e,0)}catch(t){return K.call(this,e,0)}}}!function(){try{K="function"==typeof setTimeout?setTimeout:V}catch(e){K=V}try{W="function"==typeof clearTimeout?clearTimeout:G}catch(e){W=G}}();var q,Q=[],Y=!1,Z=-1;function ee(){Y&&q&&(Y=!1,q.length?Q=q.concat(Q):Z=-1,Q.length&&te())}function te(){if(!Y){var e=J(ee);Y=!0;for(var t=Q.length;t;){for(q=Q,Q=[];++Z<t;)q&&q[Z].run();Z=-1,t=Q.length}q=null,Y=!1,function(e){if(W===clearTimeout)return clearTimeout(e);if((W===G||!W)&&clearTimeout)return W=clearTimeout,clearTimeout(e);try{W(e)}catch(t){try{return W.call(null,e)}catch(t){return W.call(this,e)}}}(e)}}function re(e,t){this.fun=e,this.array=t}function ne(){}$.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];Q.push(new re(e,t)),1!==Q.length||Y||J(te)},re.prototype.run=function(){this.fun.apply(null,this.array)},$.title="browser",$.browser=!0,$.env={},$.argv=[],$.version="",$.versions={},$.on=ne,$.addListener=ne,$.once=ne,$.off=ne,$.removeListener=ne,$.removeAllListeners=ne,$.emit=ne,$.prependListener=ne,$.prependOnceListener=ne,$.listeners=function(e){return[]},$.binding=function(e){throw new Error("process.binding is not supported")},$.cwd=function(){return"/"},$.chdir=function(e){throw new Error("process.chdir is not supported")},$.umask=function(){return 0};var oe={};return function(i){(function(){const{boolean:c}=R,f=Symbol.for("axe.silent"),a=new Set(["config","log"]),u=["trace","debug","info","warn","error","fatal"],p={warning:"warn",err:"error"},g="`level` invalid, must be: "+u.join(", "),m=i.env.HOSTNAME||e.hostname();function b(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e||s(e))}function A(e){return null==e||"object"==typeof e&&0===Reflect.ownKeys(e).length||"string"==typeof e&&0===e.trim().length}function w(e){return void 0===e}function S(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function _(e){return"string"==typeof e}oe=class{constructor(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const r={};if(i.env.AXE_REMAPPED_META_FIELDS){const e=i.env.AXE_REMAPPED_META_FIELDS.split(",").map(e=>e.split(":"));for(const[t,n]of e)r[t]=n}let n=i.env.AXE_OMIT_META_FIELDS;"string"==typeof n&&(n=n.split(",").map(e=>e.trim())),Array.isArray(n)||(n=[]);let o=i.env.AXE_PICK_META_FIELDS;"string"==typeof o&&(o=o.split(",").map(e=>e.trim())),Array.isArray(o)||(o=[]),this.config=function(){const e=v(d(h),this!==y&&this||{},h);let t={_:{}};for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];for(const i of n)if(void 0!==i){if(!l(i))throw new TypeError("`"+i+"` is not an Option Object");t=v(t,{_:i},e)}return t._}({showStack:!i.env.AXE_SHOW_STACK||c(i.env.AXE_SHOW_STACK),meta:Object.assign({show:!i.env.AXE_SHOW_META||c(i.env.AXE_SHOW_META),remappedFields:r,omittedFields:n,pickedFields:o,cleanupRemapping:!0,hideHTTP:"is_http",hideMeta:"hide_meta"},"object"==typeof t.meta?t.meta:{}),version:z,silent:!1,logger:console,name:m,level:"info",levels:["info","warn","error","fatal"],appInfo:!i.env.AXE_APP_INFO||c(i.env.AXE_APP_INFO),hooks:Object.assign({pre:[],post:[]},"object"==typeof t.hooks?t.hooks:{})},t),this.appInfo=!!this.config.appInfo&&"function"==typeof j&&j(),this.log=this.log.bind(this);const s=Object.keys(this.config.logger).filter(e=>!a.has(e));for(const i of s)this[i]=this.config.logger[i];for(const i of u)"function"!=typeof this.config.logger[i]&&("fatal"===i?this.config.logger.fatal=this.config.logger.error||this.config.logger.info||this.config.logger.log:this.config.logger[i]=this.config.logger.info||this.config.logger.log),this[i]=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.log(i,...Array.prototype.slice.call(r))};this.setLevel=this.setLevel.bind(this),this.getNormalizedLevel=this.getNormalizedLevel.bind(this),this.setName=this.setName.bind(this),this.config.name&&this.setName(this.config.name),this.setLevel(this.config.level),this.err=this.error,this.warning=this.warn,this.pre=function(e,t){this.config.hooks.pre.push((function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return e!==r?[...o]:t(...o)}))},this.post=function(e,t){this.config.hooks.post.push((function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return e!==r?[...o]:t(...o)}))}}setLevel(e){if(!_(e)||-1===u.indexOf(e))throw new Error(g);_(this.config.logger.logLevel)?this.config.logger.logLevel=e:this.config.logger.level=e,this.config.levels=u.slice(u.indexOf(e))}getNormalizedLevel(e){return _(e)?_(p[e])?p[e]:-1===u.indexOf(e)?"info":e:"info"}setName(e){if(!_(e))throw new Error("`name` must be a String");_(this.config.logger.scope)?this.config.logger.scope=e:this.config.logger.name=e}log(e,i,a){const l=[],g=[];let y=!1,h=!0;w(e)||l.push(e),w(i)||l.push(i),w(a)||l.push(a);for(var m=arguments.length,d=new Array(m>3?m-3:0),v=3;v<m;v++)d[v-3]=arguments[v];for(const t of Array.prototype.slice.call(d))l.push(t);let j=0;if(_(e)&&_(p[e])?e=p[e]:o(e)?(h=!1,a=i,i=e,e="error"):_(e)&&-1!==u.indexOf(e)||(h=!1,a=i,i=e,e=this.getNormalizedLevel(e),j=-1),-1===this.config.levels.indexOf(e))return;let T,k=!1;if((S(i)||Array.isArray(i))&&_(a)){k=!0;const e=a;a=i,i=_(e)&&l.length>=3+j?t(...l.slice(2+j)):e}if(w(i)&&(i=e),1!==l.slice(1+j).length||_(i)||o(i))if(!k&&l.length>=4+j){i=void 0,a={};const r=[];for(const e of l.slice(h&&0===j?1:0))o(e)?g.push(e):r.push(e);r.length>0&&(i=t(...r),y=!0),g.length>0&&"log"===e&&(e="error")}else if(!k&&l.length===3+j&&_(i)&&r.some(e=>-1!==i.indexOf(e)))i=t(i,a),a={};else if(o(i)){if(o(a)){g.push(a);const r=[];o(i)&&(g.unshift(i),i=void 0);for(const e of l.slice(2+j))a!==e&&(o(e)?g.push(e):r.push(e),r.length>0&&(i=t(...r),y=!0));"log"===e&&(e="error"),a={}}}else o(a)?(g.push(a),a={}):S(a)||w(a)||null===a?_(i)||(i=t(i)):(i=t(i,a),a={});else a={message:i},i=e;w(a)||S(a)?S(a)||(a={}):a={original_meta:a},o(i)&&(g.unshift(i),i=void 0),S(a.err)&&(o(a.err)&&g.push(a.err),a.original_err=o(a.err)?E(a.err):a.err),g.length>0&&(1===g.length?T=g[0]:((T=new Error([...new Set(g.map(e=>e.message).filter(Boolean))].join("; "))).stack=[...new Set(g.map(e=>e.stack).filter(Boolean))].join("\n\n"),T.errors=g),a.err=E(T),_(i)||(i=T.message)),a.level=e,this.appInfo&&(a.app=this.appInfo);const x=-1===j?"log":e;for(const t of this.config.hooks.pre)[T,i,a]=t(x,T,i,a);const I=c(a[f]);if(!A(this.config.meta.remappedFields))for(const t of Reflect.ownKeys(this.config.meta.remappedFields))if(P(a,this.config.meta.remappedFields[t],n(a,t)),B(a,t),this.config.meta.cleanupRemapping){const e=t.lastIndexOf(".");if(-1===e)continue;const r=t.slice(0,e);A(n(a,r))&&B(a,r)}if(!A(this.config.meta.omittedFields)||!A(this.config.meta.pickedFields)){const e=function(e){const t=[];return function e(r,n){for(const o of Reflect.ownKeys(r)){const i=r[o],c=s(o)?Symbol.keyFor(o)||o.description:o,f=n?n+"."+c:c;b(i)?(t.push(c),e(i,f)):t.push(f)}}(e),t}(a);if(!A(this.config.meta.omittedFields))for(const r of this.config.meta.omittedFields){let t=e.length;for(;t--;)(e[t]===r||!s(e[t])&&0===e[t].indexOf(r+"."))&&e.splice(t,1)}const t=[];if(!A(this.config.meta.pickedFields))for(const r of this.config.meta.pickedFields){if(s(r))a[r]&&t.push([r,a[r]]);else{const t=r.indexOf("."),n=r.slice(0,t+1);if(-1!==t){let t=e.length;for(;t--;)(e[t]===n.slice(0,-1)||0===e[t].indexOf(n))&&e.splice(t,1)}}-1===e.indexOf(r)&&e.push(r)}for(const r of e)s(r)?void 0!==a[r]&&t.push([r,a[r]]):void 0!==a[Symbol.for(r)]&&t.push([Symbol.for(r),a[Symbol.for(r)]]);try{a=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(o=e,"[object Object]"!==Object.prototype.toString.call(o)||!t||!Array.isArray(t)&&"string"!=typeof t)return{};var o;const{length:i}=t;if("string"==typeof t||i<2){const o="string"==typeof t?t:t[0],i=n(e,o,r);return void 0!==i?P({},o,i,r):{}}return((e,t,r,o)=>{const i={};for(let s=0;s<r;s++){const r=t[s],c=n(e,r,o);void 0!==c&&P(i,r,c,o)}return i})(e,t,i,r)}(a,e)}catch(T){this.config.logger.error(T)}if(t.length>0)for(const[r,n]of t)a[r]=n}return this.config.silent||I||(o(T)&&this.config.showStack?!this.config.meta.show||A(a)||this.config.meta.hideMeta&&a[this.config.meta.hideMeta]?this.config.logger[x](...y?[i,T]:[T]):this.config.logger[x](...y?[i,T,a]:[T,a]):!this.config.meta.show||A(a)||this.config.meta.hideMeta&&a[this.config.meta.hideMeta]||this.config.meta.hideHTTP&&a[this.config.meta.hideHTTP]?this.config.logger[x](i):this.config.logger[x](i,a)),0===this.config.hooks.post.length?{method:x,err:T,message:i,meta:a}:O(this.config.hooks.post,e=>e(x,T,i,a)).then().catch(e=>{this.config.logger.error(e)})}}}).call(this)}.call(this,U),oe}));
|
|
1
|
+
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Axe=e()}}((function(){!function(e){"use strict";e.console||(e.console={});for(var t,r,n=e.console,o=function(){},i=["memory"],s="assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(",");t=i.pop();)n[t]||(n[t]={});for(;r=s.pop();)n[r]||(n[r]=o)}("undefined"==typeof window?this:window);var e={hostname:function(){return"undefined"!=typeof location?location.hostname:""}},t=function(e){var t=Array.prototype.slice.call(arguments,1);return t.length&&(e=e.toString().replace(/(%?)(%([jds]))/g,(function(e,r,n,o){var i=t.shift();switch(o){case"s":i=""+i;break;case"d":i=Number(i);break;case"j":i=JSON.stringify(i)}return r?(t.unshift(i),e):i}))),t.length&&(e=e.toString()+" "+t.join(" ")),""+e.toString().replace(/%{2,2}/g,"%")},r=["%s","%d","%i","%f","%j","%o","%O","%%"],n=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(n=e,"[object Object]"!==Object.prototype.toString.call(n)||!t)return e;var n;const o=Array.isArray(t)?t:String(t).split(r),{length:i}=o;return i<2?e[o[0]]:((e,t,r)=>{for(let n=0;n<r;n++){if(null===e)return;const r=e[t[n]];if(void 0===r)return;e=r}return e})(e,o,i)},o=function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return e instanceof Error}},i="undefined"!=typeof Symbol&&Symbol,s={},c=Object.prototype.toString;if("function"==typeof i&&"function"==typeof Symbol&&"symbol"==typeof i("foo")&&"symbol"==typeof Symbol("bar")&&function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0}()){var f=Symbol.prototype.toString,a=/^Symbol\(.*\)$/;s=function(e){if("symbol"==typeof e)return!0;if("[object Symbol]"!==c.call(e))return!1;try{return function(e){return"symbol"==typeof e.valueOf()&&a.test(f.call(e))}(e)}catch(t){return!1}}}else s=function(e){return!1};var l=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype};const{hasOwnProperty:u}=Object.prototype,{propertyIsEnumerable:p}=Object,g=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),y=this,h={concatArrays:!1,ignoreUndefined:!1},d=e=>{const t=[];for(const r in e)u.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols){const r=Object.getOwnPropertySymbols(e);for(const n of r)p.call(e,n)&&t.push(n)}return t};function m(e){return Array.isArray(e)?function(e){const t=e.slice(0,0);return d(e).forEach(r=>{g(t,r,m(e[r]))}),t}(e):l(e)?function(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return d(e).forEach(r=>{g(t,r,m(e[r]))}),t}(e):e}const b=(e,t,r,n)=>(r.forEach(r=>{void 0===t[r]&&n.ignoreUndefined||(r in e&&e[r]!==Object.getPrototypeOf(e)?g(e,r,v(e[r],t[r],n)):g(e,r,m(t[r])))}),e);function v(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?((e,t,r)=>{let n=e.slice(0,0),o=0;return[e,t].forEach(t=>{const i=[];for(let r=0;r<t.length;r++)u.call(t,r)&&(i.push(String(r)),g(n,o++,t===e?t[r]:m(t[r])));n=b(n,t,d(t).filter(e=>!i.includes(e)),r)}),n})(e,t,r):l(t)&&l(e)?b(e,t,d(t),r):m(t)}var O={};const A=async(e,t)=>{const r=[];let n=0;for(const o of e)r.push(await t(await o,n++));return r};(O=A).default=A;var w={};function j(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return S(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?S(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){c=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(c)throw i}}}}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var E=function e(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!o(t))throw new Error("`err` must be an Error");if(!Array.isArray(r))throw new TypeError("`fields` must be an Array");const n={};var i,s=j(new Set([...Object.getOwnPropertyNames(Object.getPrototypeOf(t)),...Object.getOwnPropertyNames(t)]));try{for(s.s();!(i=s.n()).done;){const e=i.value;"function"!=typeof t[e]&&(n[e]=t[e])}}catch(t){s.e(t)}finally{s.f()}return!n.name&&t.constructor.name&&(n.name=t.constructor.name),Array.isArray(t.errors)&&(n.errors=t.errors.map(t=>o(t)?e(t,r):t)),Array.isArray(r)&&r.length>0?n.filter(e=>r.includes(e)):n};const _=e=>"object"==typeof e||"function"==typeof e,T=(e,t)=>"__proto__"==e||"constructor"==e&&"function"==typeof t.constructor;var P=function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".";if(!_(e)||!t||!t.length)return e;const o=Array.isArray(t)?t:String(t).split(n);if(T(o[0],e))return e;const{length:i}=o;return 1===i?(e[o[0]]=r,e):((e,t,r,n)=>{let o=e,i=0;for(;i<r-1;i++){const e=t[i];T(e,o)||(o=_(o[e])?o[e]:o[e]={})}return o[t[i]]=n,e})(e,o,i,r)},k=function(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)};function x(e,t,r){return"function"==typeof r.join?r.join(e):e[0]+t+e[1]}function I(e,t,r){return"function"!=typeof r.isValid||r.isValid(e,t)}function L(e){return k(e)||Array.isArray(e)||"function"==typeof e}var M=Object.prototype.toString;function F(e){return"function"==typeof e.constructor?e.constructor.name:null}var N=function e(t){switch(function(e){if(void 0===e)return"undefined";if(null===e)return"null";var t=typeof e;if("boolean"===t)return"boolean";if("string"===t)return"string";if("number"===t)return"number";if("symbol"===t)return"symbol";if("function"===t)return"GeneratorFunction"===F(e)?"generatorfunction":"function";if(function(e){return Array.isArray?Array.isArray(e):e instanceof Array}(e))return"array";if(function(e){return!(!e.constructor||"function"!=typeof e.constructor.isBuffer)&&e.constructor.isBuffer(e)}(e))return"buffer";if(function(e){try{if("number"==typeof e.length&&"function"==typeof e.callee)return!0}catch(t){if(-1!==t.message.indexOf("callee"))return!0}return!1}(e))return"arguments";if(function(e){return e instanceof Date||"function"==typeof e.toDateString&&"function"==typeof e.getDate&&"function"==typeof e.setDate}(e))return"date";if(function(e){return e instanceof Error||"string"==typeof e.message&&e.constructor&&"number"==typeof e.constructor.stackTraceLimit}(e))return"error";if(function(e){return e instanceof RegExp||"string"==typeof e.flags&&"boolean"==typeof e.ignoreCase&&"boolean"==typeof e.multiline&&"boolean"==typeof e.global}(e))return"regexp";switch(F(e)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(function(e){return"function"==typeof e.throw&&"function"==typeof e.return&&"function"==typeof e.next}(e))return"generator";switch(t=M.call(e)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")}(t)){case"boolean":case"date":case"function":case"null":case"number":return!0;case"undefined":return!1;case"regexp":return"(?:)"!==t.source&&""!==t.source;case"buffer":return""!==t.toString();case"error":return""!==t.message;case"string":case"arguments":return 0!==t.length;case"file":case"map":case"set":return 0!==t.size;case"array":case"object":for(const r of Object.keys(t))if(e(t[r]))return!0;return!1;default:return!0}},D=function(e,t,r){return!(null==(n=e)||"object"!=typeof n&&"function"!=typeof n&&!Array.isArray(n)||"string"!=typeof t&&!Array.isArray(t))&&N(function(e,t,r){if(k(r)||(r={default:r}),!L(e))return void 0!==r.default?r.default:e;"number"==typeof t&&(t=String(t));const n=Array.isArray(t),o="string"==typeof t,i=r.separator||".",s=r.joinChar||("string"==typeof i?i:".");if(!o&&!n)return e;if(o&&t in e)return I(t,e,r)?e[t]:r.default;let c=n?t:function(e,t,r){return"function"==typeof r.split?r.split(e):e.split(t)}(t,i,r),f=c.length,a=0;do{let t=c[a];for("number"==typeof t&&(t=String(t));t&&"\\"===t.slice(-1);)t=x([t.slice(0,-1),c[++a]||""],s,r);if(t in e){if(!I(t,e,r))return r.default;e=e[t]}else{let n=!1,o=a+1;for(;o<f;)if(n=(t=x([t,c[o++]],s,r))in e){if(!I(t,e,r))return r.default;e=e[t],a=o-1;break}if(!n)return r.default}}while(++a<f&&L(e));return a===f?e:r.default}(e,t,r));var n};const C=e=>{if((e=>"__proto__"===e||"constructor"===e||"prototype"===e)(e))throw new Error(`Cannot set unsafe key: "${e}"`)};var B=function(e,t){if(null==(r=e)||"object"!=typeof r||!1!==Array.isArray(r))throw new TypeError("expected an object.");var r,n=Array.isArray(t);if(!n&&e.hasOwnProperty(t))return delete e[t],!0;if(D(e,t)){for(var o=n?t.slice():t.split("."),i=o.pop();o.length&&"\\"===o[o.length-1].slice(-1);)i=o.pop().slice(0,-1)+"."+i;for(;o.length;)t=o.shift(),C(t),e=e[t];return delete e[i]}return!0},X={};Object.defineProperty(X,"__esModule",{value:!0}),X.boolean=void 0,X.boolean=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1"].includes(e.trim().toLowerCase());case"[object Number]":return 1===e.valueOf();case"[object Boolean]":return e.valueOf();default:return!1}};var H={};Object.defineProperty(H,"__esModule",{value:!0}),H.isBooleanable=void 0,H.isBooleanable=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1","false","f","no","n","off","0"].includes(e.trim().toLowerCase());case"[object Number]":return[0,1].includes(e.valueOf());case"[object Boolean]":return!0;default:return!1}};var R={};Object.defineProperty(R,"__esModule",{value:!0}),R.boolean=void 0,Object.defineProperty(R,"boolean",{enumerable:!0,get:function(){return X.boolean}}),Object.defineProperty(R,"isBooleanable",{enumerable:!0,get:function(){return H.isBooleanable}});var U,K,W,z="12.2.4",$=U={};function V(){throw new Error("setTimeout has not been defined")}function G(){throw new Error("clearTimeout has not been defined")}function J(e){if(K===setTimeout)return setTimeout(e,0);if((K===V||!K)&&setTimeout)return K=setTimeout,setTimeout(e,0);try{return K(e,0)}catch(t){try{return K.call(null,e,0)}catch(t){return K.call(this,e,0)}}}!function(){try{K="function"==typeof setTimeout?setTimeout:V}catch(e){K=V}try{W="function"==typeof clearTimeout?clearTimeout:G}catch(e){W=G}}();var q,Q=[],Y=!1,Z=-1;function ee(){Y&&q&&(Y=!1,q.length?Q=q.concat(Q):Z=-1,Q.length&&te())}function te(){if(!Y){var e=J(ee);Y=!0;for(var t=Q.length;t;){for(q=Q,Q=[];++Z<t;)q&&q[Z].run();Z=-1,t=Q.length}q=null,Y=!1,function(e){if(W===clearTimeout)return clearTimeout(e);if((W===G||!W)&&clearTimeout)return W=clearTimeout,clearTimeout(e);try{W(e)}catch(t){try{return W.call(null,e)}catch(t){return W.call(this,e)}}}(e)}}function re(e,t){this.fun=e,this.array=t}function ne(){}$.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];Q.push(new re(e,t)),1!==Q.length||Y||J(te)},re.prototype.run=function(){this.fun.apply(null,this.array)},$.title="browser",$.browser=!0,$.env={},$.argv=[],$.version="",$.versions={},$.on=ne,$.addListener=ne,$.once=ne,$.off=ne,$.removeListener=ne,$.removeAllListeners=ne,$.emit=ne,$.prependListener=ne,$.prependOnceListener=ne,$.listeners=function(e){return[]},$.binding=function(e){throw new Error("process.binding is not supported")},$.cwd=function(){return"/"},$.chdir=function(e){throw new Error("process.chdir is not supported")},$.umask=function(){return 0};var oe={};return function(i){(function(){const{boolean:c}=R,f=Symbol.for("axe.silent"),a=new Set(["config","log"]),u=["trace","debug","info","warn","error","fatal"],p={warning:"warn",err:"error"},g="`level` invalid, must be: "+u.join(", "),d=i.env.HOSTNAME||e.hostname();function b(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e||s(e))}function A(e){return null==e||"object"==typeof e&&0===Reflect.ownKeys(e).length||"string"==typeof e&&0===e.trim().length}function j(e){return void 0===e}function S(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function _(e){return"string"==typeof e}function T(e){return"function"==typeof e}function k(e){return T(e)?e:null}oe=class{constructor(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const r={};if(i.env.AXE_REMAPPED_META_FIELDS){const e=i.env.AXE_REMAPPED_META_FIELDS.split(",").map(e=>e.split(":"));for(const[t,n]of e)r[t]=n}let n=i.env.AXE_OMIT_META_FIELDS;"string"==typeof n&&(n=n.split(",").map(e=>e.trim())),Array.isArray(n)||(n=[]);let o=i.env.AXE_PICK_META_FIELDS;"string"==typeof o&&(o=o.split(",").map(e=>e.trim())),Array.isArray(o)||(o=[]),this.config=function(){const e=v(m(h),this!==y&&this||{},h);let t={_:{}};for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];for(const i of n)if(void 0!==i){if(!l(i))throw new TypeError("`"+i+"` is not an Option Object");t=v(t,{_:i},e)}return t._}({showStack:!i.env.AXE_SHOW_STACK||c(i.env.AXE_SHOW_STACK),meta:Object.assign({show:!i.env.AXE_SHOW_META||c(i.env.AXE_SHOW_META),remappedFields:r,omittedFields:n,pickedFields:o,cleanupRemapping:!0,hideHTTP:"is_http",hideMeta:"hide_meta"},"object"==typeof t.meta?t.meta:{}),version:z,silent:!1,logger:console,name:d,level:"info",levels:["info","warn","error","fatal"],appInfo:!i.env.AXE_APP_INFO||c(i.env.AXE_APP_INFO),hooks:Object.assign({pre:[],post:[]},"object"==typeof t.hooks?t.hooks:{})},t),this.appInfo=!!this.config.appInfo&&!!T(w)&&w(),this.log=this.log.bind(this);const s=Object.keys(this.config.logger).filter(e=>!a.has(e));for(const i of s)this[i]=this.config.logger[i];for(const i of u){if("fatal"===i?this.config.logger.fatal=k(this.config.logger[i])||k(this.config.logger.error)||k(this.config.logger.info)||k(this.config.logger.log):this.config.logger[i]=k(this.config.logger[i])||k(this.config.logger.info)||k(this.config.logger.log),!T(this.config.logger[i]))throw new Error(`\`${i}\` must be a function on the logger.`);this[i]=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.log(i,...Array.prototype.slice.call(r))}}this.setLevel=this.setLevel.bind(this),this.getNormalizedLevel=this.getNormalizedLevel.bind(this),this.setName=this.setName.bind(this),this.config.name&&this.setName(this.config.name),this.setLevel(this.config.level),this.err=this.error,this.warning=this.warn,this.pre=function(e,t){this.config.hooks.pre.push((function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return e!==r?[...o]:t(...o)}))},this.post=function(e,t){this.config.hooks.post.push((function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return e!==r?[...o]:t(...o)}))}}setLevel(e){if(!_(e)||-1===u.indexOf(e))throw new Error(g);_(this.config.logger.logLevel)?this.config.logger.logLevel=e:this.config.logger.level=e,this.config.levels=u.slice(u.indexOf(e))}getNormalizedLevel(e){return _(e)?_(p[e])?p[e]:-1===u.indexOf(e)?"info":e:"info"}setName(e){if(!_(e))throw new Error("`name` must be a String");_(this.config.logger.scope)?this.config.logger.scope=e:this.config.logger.name=e}log(e,i,a){const l=[],g=[];let y=!1,h=!0;j(e)||l.push(e),j(i)||l.push(i),j(a)||l.push(a);for(var d=arguments.length,m=new Array(d>3?d-3:0),v=3;v<d;v++)m[v-3]=arguments[v];for(const t of Array.prototype.slice.call(m))l.push(t);let w=0;if(_(e)&&_(p[e])?e=p[e]:o(e)?(h=!1,a=i,i=e,e="error"):_(e)&&-1!==u.indexOf(e)||(h=!1,a=i,i=e,e=this.getNormalizedLevel(e),w=-1),-1===this.config.levels.indexOf(e))return;let T,k=!1;if((S(i)||Array.isArray(i))&&_(a)){k=!0;const e=a;a=i,i=_(e)&&l.length>=3+w?t(...l.slice(2+w)):e}if(j(i)&&(i=e),1!==l.slice(1+w).length||_(i)||o(i))if(!k&&l.length>=4+w){i=void 0,a={};const r=[];for(const e of l.slice(h&&0===w?1:0))o(e)?g.push(e):r.push(e);r.length>0&&(i=t(...r),y=!0),g.length>0&&"log"===e&&(e="error")}else if(!k&&l.length===3+w&&_(i)&&r.some(e=>-1!==i.indexOf(e)))i=t(i,a),a={};else if(o(i)){if(o(a)){g.push(a);const r=[];o(i)&&(g.unshift(i),i=void 0);for(const e of l.slice(2+w))a!==e&&(o(e)?g.push(e):r.push(e),r.length>0&&(i=t(...r),y=!0));"log"===e&&(e="error"),a={}}}else o(a)?(g.push(a),a={}):S(a)||j(a)||null===a?_(i)||(i=t(i)):(i=t(i,a),a={});else a={message:i},i=e;j(a)||S(a)?S(a)||(a={}):a={original_meta:a},o(i)&&(g.unshift(i),i=void 0),S(a.err)&&(o(a.err)&&g.push(a.err),a.original_err=o(a.err)?E(a.err):a.err),g.length>0&&(1===g.length?T=g[0]:((T=new Error([...new Set(g.map(e=>e.message).filter(Boolean))].join("; "))).stack=[...new Set(g.map(e=>e.stack).filter(Boolean))].join("\n\n"),T.errors=g),a.err=E(T),_(i)||(i=T.message)),a.level=e,this.appInfo&&(a.app=this.appInfo);const x=-1===w?"log":e;for(const t of this.config.hooks.pre)[T,i,a]=t(x,T,i,a);const I=c(a[f]);if(!A(this.config.meta.remappedFields))for(const t of Reflect.ownKeys(this.config.meta.remappedFields))if(P(a,this.config.meta.remappedFields[t],n(a,t)),B(a,t),this.config.meta.cleanupRemapping){const e=t.lastIndexOf(".");if(-1===e)continue;const r=t.slice(0,e);A(n(a,r))&&B(a,r)}if(!A(this.config.meta.omittedFields)||!A(this.config.meta.pickedFields)){const e=function(e){const t=[];return function e(r,n){for(const o of Reflect.ownKeys(r)){const i=r[o],c=s(o)?Symbol.keyFor(o)||o.description:o,f=n?n+"."+c:c;b(i)&&-1===t.indexOf(c)?(t.push(c),e(i,f)):-1===t.indexOf(f)&&t.push(f)}}(e),t}(a);if(!A(this.config.meta.omittedFields))for(const r of this.config.meta.omittedFields){let t=e.length;for(;t--;)(e[t]===r||!s(e[t])&&0===e[t].indexOf(r+"."))&&e.splice(t,1)}const t=[];if(!A(this.config.meta.pickedFields))for(const r of this.config.meta.pickedFields){if(s(r))a[r]&&t.push([r,a[r]]);else{const t=r.indexOf("."),n=r.slice(0,t+1);if(-1!==t){let t=e.length;for(;t--;)(e[t]===n.slice(0,-1)||0===e[t].indexOf(n))&&e.splice(t,1)}}-1===e.indexOf(r)&&e.push(r)}for(const r of e)s(r)?void 0!==a[r]&&t.push([r,a[r]]):void 0!==a[Symbol.for(r)]&&t.push([Symbol.for(r),a[Symbol.for(r)]]);try{a=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(o=e,"[object Object]"!==Object.prototype.toString.call(o)||!t||!Array.isArray(t)&&"string"!=typeof t)return{};var o;const{length:i}=t;if("string"==typeof t||i<2){const o="string"==typeof t?t:t[0],i=n(e,o,r);return void 0!==i?P({},o,i,r):{}}return((e,t,r,o)=>{const i={};for(let s=0;s<r;s++){const r=t[s],c=n(e,r,o);void 0!==c&&P(i,r,c,o)}return i})(e,t,i,r)}(a,e)}catch(T){this.config.logger.error(T)}if(t.length>0)for(const[r,n]of t)a[r]=n}return this.config.silent||I||(o(T)&&this.config.showStack?!this.config.meta.show||A(a)||this.config.meta.hideMeta&&a[this.config.meta.hideMeta]?this.config.logger[x](...y?[i,T]:[T]):this.config.logger[x](...y?[i,T,a]:[T,a]):!this.config.meta.show||A(a)||this.config.meta.hideMeta&&a[this.config.meta.hideMeta]||this.config.meta.hideHTTP&&a[this.config.meta.hideHTTP]?this.config.logger[x](i):this.config.logger[x](i,a)),0===this.config.hooks.post.length?{method:x,err:T,message:i,meta:a}:O(this.config.hooks.post,e=>e(x,T,i,a)).then().catch(e=>{this.config.logger.error(e)})}}}).call(this)}.call(this,U),oe}));
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
export default Axe;
|
|
2
|
+
|
|
3
|
+
declare const Axe: Axe.Constructor;
|
|
4
|
+
|
|
5
|
+
declare namespace Axe {
|
|
6
|
+
// These should match the defaults in the index file
|
|
7
|
+
namespace Defaults {
|
|
8
|
+
type OmittedLoggerKeys = 'config' | 'log';
|
|
9
|
+
type Levels = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type Constructor = new <TLogger extends Logger = Console>(
|
|
13
|
+
config?: Options<TLogger>
|
|
14
|
+
) => Axe<TLogger>;
|
|
15
|
+
|
|
16
|
+
export type Axe<TLogger extends Logger = Console> = ParentLogger<TLogger> &
|
|
17
|
+
Prototype &
|
|
18
|
+
LoggerMethods &
|
|
19
|
+
LoggerMethodAliases;
|
|
20
|
+
|
|
21
|
+
// This is the inherited methods from the logger object
|
|
22
|
+
export type ParentLogger<T extends Logger> = Omit<
|
|
23
|
+
{
|
|
24
|
+
[K in Exclude<keyof T, Defaults.OmittedLoggerKeys>]: T[K];
|
|
25
|
+
},
|
|
26
|
+
Defaults.Levels
|
|
27
|
+
>;
|
|
28
|
+
|
|
29
|
+
export type LoggerMethod = (...args: any[]) => Promise<void>;
|
|
30
|
+
|
|
31
|
+
export type LoggerMethods = {
|
|
32
|
+
[K in Defaults.Levels]: LoggerMethod;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type LoggerMethodAliases = {
|
|
36
|
+
err: LoggerMethods['error'];
|
|
37
|
+
warning: LoggerMethods['warn'];
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type Prototype = {
|
|
41
|
+
log: (...args: any[]) => Promise<void>;
|
|
42
|
+
|
|
43
|
+
setLevel(leveL: string): void;
|
|
44
|
+
getNormalizedLevel(level: string): string;
|
|
45
|
+
setName(name: string): void;
|
|
46
|
+
pre(level: string, fn: PreHook): void;
|
|
47
|
+
post(level: string, fn: PostHook): void;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
type Logger<
|
|
51
|
+
ObjectType = {
|
|
52
|
+
info?: (...args: any[]) => any;
|
|
53
|
+
log?: (...args: any[]) => any;
|
|
54
|
+
},
|
|
55
|
+
KeysType extends keyof ObjectType = keyof ObjectType
|
|
56
|
+
> =
|
|
57
|
+
// Require at least one of the keys
|
|
58
|
+
{
|
|
59
|
+
[Key in KeysType]-?: Required<Pick<ObjectType, Key>> &
|
|
60
|
+
Partial<Pick<ObjectType, Exclude<KeysType, Key>>>;
|
|
61
|
+
}[KeysType] &
|
|
62
|
+
Record<string, any>;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* A pre-hook is a function that runs before the logger method is invoked.
|
|
66
|
+
* It receives the method name, error, message, and metadata as arguments.
|
|
67
|
+
* It should return an array of the error, message, and metadata.
|
|
68
|
+
*
|
|
69
|
+
* @param method - The method name that will be invoked (e.g. 'info', 'warn', 'error', 'fatal')
|
|
70
|
+
* @param err - The error object (if any)
|
|
71
|
+
* @param message - The message to log (if any)
|
|
72
|
+
* @param meta - The metadata object to log (if any)
|
|
73
|
+
*
|
|
74
|
+
* @returns An array of the error, message, and metadata
|
|
75
|
+
*/
|
|
76
|
+
export type PreHook = (
|
|
77
|
+
method: string,
|
|
78
|
+
err: any,
|
|
79
|
+
message: any,
|
|
80
|
+
meta: any
|
|
81
|
+
) => [any, any, any];
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* A post-hook is a function that runs after the logger method is invoked.
|
|
85
|
+
*
|
|
86
|
+
* @param method - The method name that was invoked (e.g. 'info', 'warn', 'error', 'fatal')
|
|
87
|
+
* @param err - The error object (if any)
|
|
88
|
+
* @param message - The message that was logged (if any)
|
|
89
|
+
* @param meta - The metadata object that was logged (if any)
|
|
90
|
+
*/
|
|
91
|
+
export type PostHook = (
|
|
92
|
+
method: string,
|
|
93
|
+
err: any,
|
|
94
|
+
message: any,
|
|
95
|
+
meta: any
|
|
96
|
+
) => PromiseLike<any> | any;
|
|
97
|
+
|
|
98
|
+
export type Options<TLogger extends Logger> = {
|
|
99
|
+
/**
|
|
100
|
+
* Attempts to parse a boolean value from `process.env.AXE_SHOW_STACK`).
|
|
101
|
+
* **If this value is `true`, then if `message` is an instance of an Error,
|
|
102
|
+
* it will be invoked as the first argument to logger methods.
|
|
103
|
+
* If this is `false`, then only the `err.message` will be invoked as the first argument to logger methods.**
|
|
104
|
+
*
|
|
105
|
+
* Basically if `true` it will call `logger.method(err)` and if `false` it will call `logger.method(err.message)`.
|
|
106
|
+
* If you pass `err` as the first argument to a logger method,
|
|
107
|
+
* then it will show the stack trace via `err.stack` typically.
|
|
108
|
+
*
|
|
109
|
+
* @default true
|
|
110
|
+
*/
|
|
111
|
+
showStack?: boolean;
|
|
112
|
+
|
|
113
|
+
meta?: {
|
|
114
|
+
/**
|
|
115
|
+
* Attempts to parse a boolean value from `process.env.AXE_SHOW_META`
|
|
116
|
+
* – meaning you can pass a flag `AXE_SHOW_META=true node app.js` when needed for debugging),
|
|
117
|
+
* whether or not to output metadata to logger methods.
|
|
118
|
+
* If set to `false`, then fields will not be omitted nor picked;
|
|
119
|
+
* the entire meta object will be hidden from logger output.
|
|
120
|
+
*
|
|
121
|
+
* @default true
|
|
122
|
+
*/
|
|
123
|
+
show?: boolean;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Attempts to parse an Object mapping from `process.env.AXE_REMAPPED_META_FIELDS`
|
|
127
|
+
* (`,` and `:` delimited, e.g. `REMAPPED_META_FIELDS=foo:bar,beep.boop:beepBoop` to remap `meta.foo` to `meta.bar` and `meta.beep.boop` to `meta.beepBoop`).
|
|
128
|
+
* Note that this will clean up empty objects by default unless you set the option `meta.cleanupRemapping` to `false`).
|
|
129
|
+
* Supports dot-notation.
|
|
130
|
+
*
|
|
131
|
+
* @default {}
|
|
132
|
+
*/
|
|
133
|
+
remappedFields?: RemappedFields;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Attempts to parse an array value from `process.env.AXE_OMIT_META_FIELDS`
|
|
137
|
+
* (`,` delimited) - meaning you can pass a flag `AXE_OMIT_META_FIELDS=user,id node app.js`),
|
|
138
|
+
* determining which fields to omit in the metadata passed to logger methods.
|
|
139
|
+
* Supports dot-notation.
|
|
140
|
+
*
|
|
141
|
+
* @default []
|
|
142
|
+
*/
|
|
143
|
+
omittedFields?: string[];
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Attempts to parse an array value from `process.env.AXE_PICK_META_FIELDS`
|
|
147
|
+
* (`,` delimited) - meaning you can pass a flag, e.g. `AXE_PICK_META_FIELDS=request.headers,response.headers node app.js`
|
|
148
|
+
* which would pick from `meta.request` and `meta.response` *only* `meta.request.headers` and `meta.response.headers`),
|
|
149
|
+
* **This takes precedence after fields are omitted, which means this acts as a whitelist.**
|
|
150
|
+
* Supports dot-notation.
|
|
151
|
+
* **As of v11.2.0 this now supports Symbols, but only top-level symbols via `Reflect.ownKeys` (not recursive yet).**
|
|
152
|
+
*
|
|
153
|
+
* @default []
|
|
154
|
+
*/
|
|
155
|
+
pickedFields?: Array<string | symbol>;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Whether or not to cleanup empty objects after remapping operations are completed)
|
|
159
|
+
*
|
|
160
|
+
* @default true
|
|
161
|
+
*/
|
|
162
|
+
cleanupRemapping?: boolean;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Whether to suppress HTTP metadata (prevents logger invocation with second arg `meta`)
|
|
166
|
+
* if `meta.is_http` is `true` (via [parse-request][] v5.1.0+).
|
|
167
|
+
* If you manually set `meta.is_http = true` and this is `true`, then `meta` arg will be suppressed as well.
|
|
168
|
+
*
|
|
169
|
+
* @default true
|
|
170
|
+
*/
|
|
171
|
+
hideHTTP?: boolean;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* If this value is provided as a String, then if `meta[config.hideMeta]` is `true`,
|
|
175
|
+
* it will suppress the entire metadata object `meta` (the second arg) from being passed/invoked to the logger.
|
|
176
|
+
* This is useful when you want to suppress metadata from the logger invocation,
|
|
177
|
+
* but still persist it to post hooks (e.g. for sending upstream to your log storage provider).
|
|
178
|
+
* This helps to keep development and production console output clean while also allowing you to still store the meta object.
|
|
179
|
+
*
|
|
180
|
+
* @deafult 'hide_meta'
|
|
181
|
+
*/
|
|
182
|
+
hideMeta?: string | boolean;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Whether or not to invoke logger methods. Pre and post hooks will still run even if this option is set to `false`.
|
|
187
|
+
*
|
|
188
|
+
* @default false
|
|
189
|
+
*/
|
|
190
|
+
silent?: boolean;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Defaults to `console` with {@link https://github.com/paulmillr/console-polyfill console-polyfill} added automatically, though **you can bring your own logger**.
|
|
194
|
+
* See {@link https://github.com/cabinjs/axe?tab=readme-ov-file#custom-logger custom-logger} – you can pass an instance of `pino`, `signale`, `winston`, `bunyan`, etc.
|
|
195
|
+
*
|
|
196
|
+
* @default console
|
|
197
|
+
*/
|
|
198
|
+
logger?: TLogger;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* The default name for the logger (defaults to `false` in development environments,
|
|
202
|
+
* which does not set `logger.name`)
|
|
203
|
+
* – this is useful if you are using a logger like `pino` which prefixes log output with the name set here.
|
|
204
|
+
*
|
|
205
|
+
* @default `false` if `NODE_ENV` is `"development"` otherwise the value of `process.env.HOSTNAME` or `os.hostname()`
|
|
206
|
+
*/
|
|
207
|
+
name?: string | boolean;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* The default level of logging to invoke `logger` methods for (defaults to `info`,
|
|
211
|
+
* which includes all logs including info and higher in severity (e.g. `info`, `warn`, `error`, `fatal`)
|
|
212
|
+
*
|
|
213
|
+
* @default 'info'
|
|
214
|
+
*/
|
|
215
|
+
level?: string;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* An Array of logging levels to support.
|
|
219
|
+
* You usually shouldn't change this unless you want to prevent logger methods from being invoked or prevent hooks from being run for a certain log level.
|
|
220
|
+
* If an invalid log level is attempted to be invoked, and if it is not in this Array, then no hooks and no logger methods will be invoked.
|
|
221
|
+
*
|
|
222
|
+
* @default ['info','warn','error','fatal']
|
|
223
|
+
*/
|
|
224
|
+
levels?: string[];
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Attempts to parse a boolean value from `process.env.AXE_APP_INFO`) - whether or not to parse application information (using [parse-app-info][]).
|
|
228
|
+
*
|
|
229
|
+
* @default true
|
|
230
|
+
*/
|
|
231
|
+
appInfo?: boolean;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* See {@link https://github.com/cabinjs/axe?tab=readme-ov-file#hooks Hooks}
|
|
235
|
+
*
|
|
236
|
+
* @defualt { pre: [], post: [] }
|
|
237
|
+
*/
|
|
238
|
+
hooks?: {
|
|
239
|
+
pre?: PreHook[];
|
|
240
|
+
post?: PostHook[];
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
type RemappedFields = {
|
|
245
|
+
[key: string]: string | RemappedFields;
|
|
246
|
+
};
|
|
247
|
+
}
|