@beforeyoubid/logger-adapter
Advanced tools
Comparing version 1.0.11 to 1.0.12
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.consoleLogger = void 0; | ||
const params_1 = require("../params"); | ||
const logger_1 = require("./logger"); | ||
const util_1 = require("../util"); | ||
let loggerObject; | ||
const logParams = params_1.getLogParams(); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "consoleLogger", { | ||
enumerable: true, | ||
get: function() { | ||
return consoleLogger; | ||
} | ||
}); | ||
var _params = require("../params"); | ||
var _logger = require("./logger"); | ||
var _util = require("../util"); | ||
var loggerObject; | ||
var logParams = (0, _params.getLogParams)(); | ||
/** | ||
* Initialise and wrap the native console object | ||
* @param params | ||
*/ | ||
const init = (params = logParams) => { | ||
*/ var init = function() { | ||
var params = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : logParams; | ||
var AWS_LAMBDA_FUNCTION_NAME = process.env.AWS_LAMBDA_FUNCTION_NAME; | ||
// If has wrapped already, don't do it again | ||
if (!!loggerObject) | ||
return; | ||
const { logDNAKey, sendToRemote } = params; | ||
const isEnabled = util_1.isLogDNAEnabled(logDNAKey, sendToRemote); | ||
if (!!loggerObject) return; | ||
var logDNAKey = params.logDNAKey, sendToRemote = params.sendToRemote; | ||
var isEnabled = (0, _util.isLogDNAEnabled)(logDNAKey, sendToRemote); | ||
// Wrap console object | ||
loggerObject = isEnabled ? logger_1.getLogger(params) : {}; | ||
if (!isEnabled) { | ||
console.info(`LOGDNA is disabled`); | ||
loggerObject = isEnabled ? (0, _logger.getLogger)(params) : {}; | ||
if (!isEnabled && AWS_LAMBDA_FUNCTION_NAME !== undefined) { | ||
console.info("LOGDNA is disabled"); | ||
} | ||
}; | ||
const consoleLogger = { | ||
init, | ||
flushAll: util_1.flushAll, | ||
var consoleLogger = { | ||
init: init, | ||
flushAll: _util.flushAll | ||
}; | ||
exports.consoleLogger = consoleLogger; | ||
//# sourceMappingURL=data:application/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BQUksQ0FBQ00sYUFBYUwsNkJBQTZCUSxXQUFXO1FBQ3hEQyxRQUFRQyxJQUFJLENBQUU7SUFDaEIsQ0FBQztBQUNIO0FBRUEsSUFBTWhCLGdCQUFnQjtJQUNwQkksTUFBQUE7SUFDQWEsVUFBQUEsY0FBUTtBQUNWIn0= |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getDefaultConsoleLog = exports.getLogger = void 0; | ||
const LogDNALogger = require('logdna'); | ||
const { flushAll } = require('../util'); | ||
let logger; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
function _export(target, all) { | ||
for(var name in all)Object.defineProperty(target, name, { | ||
enumerable: true, | ||
get: all[name] | ||
}); | ||
} | ||
_export(exports, { | ||
getLogger: function() { | ||
return getLogger; | ||
}, | ||
getDefaultConsoleLog: function() { | ||
return getDefaultConsoleLog; | ||
} | ||
}); | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
} | ||
function _iterableToArray(iter) { | ||
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(n); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
var LogDNALogger = require("logdna"); | ||
var flushAll = require("../util").flushAll; | ||
var logger; | ||
// Default console | ||
const _log = console.log; | ||
const _info = console.info; | ||
const _warn = console.warn; | ||
const _error = console.error; | ||
const wrapConsole = (logger, logLevel) => { | ||
_log('--------------------- Wrapping Console -----------------------'); | ||
const log = function (...args) { | ||
if (logLevel === 'debug') { | ||
logger.debug([...args].join(' ')); | ||
var _log = console.log; | ||
var _info = console.info; | ||
var _warn = console.warn; | ||
var _error = console.error; | ||
var wrapConsole = function(logger, logLevel) { | ||
_log("--------------------- Wrapping Console -----------------------"); | ||
var log = function log() { | ||
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ | ||
args[_key] = arguments[_key]; | ||
} | ||
_log(...args); | ||
if (logLevel === "debug") { | ||
logger.debug(_toConsumableArray(args).join(" ")); | ||
} | ||
_log.apply(void 0, _toConsumableArray(args)); | ||
}; | ||
const info = function (...args) { | ||
if (['debug', 'info'].indexOf(logLevel) !== -1) { | ||
logger.info([...args].join(' ')); | ||
var info = function info() { | ||
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ | ||
args[_key] = arguments[_key]; | ||
} | ||
_info(...args); | ||
if ([ | ||
"debug", | ||
"info" | ||
].indexOf(logLevel) !== -1) { | ||
logger.info(_toConsumableArray(args).join(" ")); | ||
} | ||
_info.apply(void 0, _toConsumableArray(args)); | ||
}; | ||
const warn = function (...args) { | ||
logger.warn([...args].join(' ')); | ||
_warn(...args); | ||
var warn = function warn() { | ||
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ | ||
args[_key] = arguments[_key]; | ||
} | ||
logger.warn(_toConsumableArray(args).join(" ")); | ||
_warn.apply(void 0, _toConsumableArray(args)); | ||
}; | ||
const error = function (...args) { | ||
logger.error([...args].join(' ')); | ||
_error(...args); | ||
var error = function error() { | ||
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ | ||
args[_key] = arguments[_key]; | ||
} | ||
logger.error(_toConsumableArray(args).join(" ")); | ||
_error.apply(void 0, _toConsumableArray(args)); | ||
}; | ||
@@ -40,4 +95,4 @@ console.log = log; | ||
}; | ||
const getLogger = (params) => { | ||
const { logDNAKey, logLevel, logDNAOptions } = params; | ||
var getLogger = function(params) { | ||
var logDNAKey = params.logDNAKey, logLevel = params.logLevel, logDNAOptions = params.logDNAOptions; | ||
logger = LogDNALogger.setupDefaultLogger(logDNAKey, logDNAOptions); | ||
@@ -50,4 +105,6 @@ // Wrap default | ||
}; | ||
exports.getLogger = getLogger; | ||
const getDefaultConsoleLog = () => _log; | ||
exports.getDefaultConsoleLog = getDefaultConsoleLog; | ||
var getDefaultConsoleLog = function() { | ||
return _log; | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb25zb2xlL2xvZ2dlci50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBJTG9nRE5BUGFyYW1zIH0gZnJvbSAnLi4vdHlwZXMnO1xuY29uc3QgTG9nRE5BTG9nZ2VyID0gcmVxdWlyZSgnbG9nZG5hJyk7XG5jb25zdCB7IGZsdXNoQWxsIH0gPSByZXF1aXJlKCcuLi91dGlsJyk7XG5sZXQgbG9nZ2VyOiBhbnk7XG5cbi8vIERlZmF1bHQgY29uc29sZVxuY29uc3QgX2xvZyA9IGNvbnNvbGUubG9nO1xuY29uc3QgX2luZm8gPSBjb25zb2xlLmluZm87XG5jb25zdCBfd2FybiA9IGNvbnNvbGUud2FybjtcbmNvbnN0IF9lcnJvciA9IGNvbnNvbGUuZXJyb3I7XG5cbmNvbnN0IHdyYXBDb25zb2xlID0gKGxvZ2dlcjogYW55LCBsb2dMZXZlbDogc3RyaW5nKTogdm9pZCA9PiB7XG4g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DtBQUVBLElBQU1KLHVCQUF1QjtXQUFXSyJ9 |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FALLBACK_TIMEOUT_AFTER_FLUSHING = void 0; | ||
const FALLBACK_TIMEOUT_AFTER_FLUSHING = 5000; | ||
exports.FALLBACK_TIMEOUT_AFTER_FLUSHING = FALLBACK_TIMEOUT_AFTER_FLUSHING; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "FALLBACK_TIMEOUT_AFTER_FLUSHING", { | ||
enumerable: true, | ||
get: function() { | ||
return FALLBACK_TIMEOUT_AFTER_FLUSHING; | ||
} | ||
}); | ||
var FALLBACK_TIMEOUT_AFTER_FLUSHING = 5000; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jb25zdHMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiY29uc3QgRkFMTEJBQ0tfVElNRU9VVF9BRlRFUl9GTFVTSElORyA9IDUwMDA7XG5cbmV4cG9ydCB7IEZBTExCQUNLX1RJTUVPVVRfQUZURVJfRkxVU0hJTkcgfTtcbiJdLCJuYW1lcyI6WyJGQUxMQkFDS19USU1FT1VUX0FGVEVSX0ZMVVNISU5HIl0sIm1hcHBpbmdzIjoiOzs7OytCQUVTQTs7O2VBQUFBOzs7QUFGVCxJQUFNQSxrQ0FBa0MifQ== |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ensureFlushAllCallback = exports.ensureFlushAll = exports.flushAll = exports.getLogParams = exports.logger = exports.consoleLogger = void 0; | ||
const console_1 = require("./console"); | ||
Object.defineProperty(exports, "consoleLogger", { enumerable: true, get: function () { return console_1.consoleLogger; } }); | ||
const logger_1 = require("./logger"); | ||
Object.defineProperty(exports, "logger", { enumerable: true, get: function () { return logger_1.logger; } }); | ||
const params_1 = require("./params"); | ||
Object.defineProperty(exports, "getLogParams", { enumerable: true, get: function () { return params_1.getLogParams; } }); | ||
const util_1 = require("./util"); | ||
Object.defineProperty(exports, "flushAll", { enumerable: true, get: function () { return util_1.flushAll; } }); | ||
Object.defineProperty(exports, "ensureFlushAll", { enumerable: true, get: function () { return util_1.ensureFlushAll; } }); | ||
Object.defineProperty(exports, "ensureFlushAllCallback", { enumerable: true, get: function () { return util_1.ensureFlushAllCallback; } }); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
function _export(target, all) { | ||
for(var name in all)Object.defineProperty(target, name, { | ||
enumerable: true, | ||
get: all[name] | ||
}); | ||
} | ||
_export(exports, { | ||
consoleLogger: function() { | ||
return _console.consoleLogger; | ||
}, | ||
logger: function() { | ||
return _logger.logger; | ||
}, | ||
getLogParams: function() { | ||
return _params.getLogParams; | ||
}, | ||
flushAll: function() { | ||
return _util.flushAll; | ||
}, | ||
ensureFlushAll: function() { | ||
return _util.ensureFlushAll; | ||
}, | ||
ensureFlushAllCallback: function() { | ||
return _util.ensureFlushAllCallback; | ||
} | ||
}); | ||
var _console = require("./console"); | ||
var _logger = require("./logger"); | ||
var _params = require("./params"); | ||
var _util = require("./util"); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBjb25zb2xlTG9nZ2VyIH0gZnJvbSAnLi9jb25zb2xlJztcbmltcG9ydCB7IGxvZ2dlciB9IGZyb20gJy4vbG9nZ2VyJztcbmltcG9ydCB7IGdldExvZ1BhcmFtcyB9IGZyb20gJy4vcGFyYW1zJztcbmltcG9ydCB7IGZsdXNoQWxsLCBlbnN1cmVGbHVzaEFsbCwgZW5zdXJlRmx1c2hBbGxDYWxsYmFjayB9IGZyb20gJy4vdXRpbCc7XG5leHBvcnQgeyBjb25zb2xlTG9nZ2VyLCBsb2dnZXIsIGdldExvZ1BhcmFtcywgZmx1c2hBbGwsIGVuc3VyZUZsdXNoQWxsLCBlbnN1cmVGbHVzaEFsbENhbGxiYWNrIH07XG4iXSwibmFtZXMiOlsiY29uc29sZUxvZ2dlciIsImxvZ2dlciIsImdldExvZ1BhcmFtcyIsImZsdXNoQWxsIiwiZW5zdXJlRmx1c2hBbGwiLCJlbnN1cmVGbHVzaEFsbENhbGxiYWNrIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OztJQUlTQSxhQUFhO2VBQWJBLHNCQUFhOztJQUFFQyxNQUFNO2VBQU5BLGNBQU07O0lBQUVDLFlBQVk7ZUFBWkEsb0JBQVk7O0lBQUVDLFFBQVE7ZUFBUkEsY0FBUTs7SUFBRUMsY0FBYztlQUFkQSxvQkFBYzs7SUFBRUMsc0JBQXNCO2VBQXRCQSw0QkFBc0I7Ozt1QkFKaEU7c0JBQ1A7c0JBQ007b0JBQ29DIn0= |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.logger = void 0; | ||
const params_1 = require("../params"); | ||
const logger_1 = require("./logger"); | ||
const logParams = params_1.getLogParams(); | ||
const logger = logger_1.getLogger(logParams); | ||
exports.logger = logger; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "logger", { | ||
enumerable: true, | ||
get: function() { | ||
return logger; | ||
} | ||
}); | ||
var _params = require("../params"); | ||
var _logger = require("./logger"); | ||
var logParams = (0, _params.getLogParams)(); | ||
var logger = (0, _logger.getLogger)(logParams); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9sb2dnZXIvaW5kZXgudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgZ2V0TG9nUGFyYW1zIH0gZnJvbSAnLi4vcGFyYW1zJztcbmltcG9ydCB7IGdldExvZ2dlciB9IGZyb20gJy4vbG9nZ2VyJztcblxuY29uc3QgbG9nUGFyYW1zID0gZ2V0TG9nUGFyYW1zKCk7XG5jb25zdCBsb2dnZXIgPSBnZXRMb2dnZXIobG9nUGFyYW1zKTtcblxuZXhwb3J0IHsgbG9nZ2VyIH07XG4iXSwibmFtZXMiOlsibG9nZ2VyIiwibG9nUGFyYW1zIiwiZ2V0TG9nUGFyYW1zIiwiZ2V0TG9nZ2VyIl0sIm1hcHBpbmdzIjoiOzs7OytCQU1TQTs7O2VBQUFBOzs7c0JBTm9CO3NCQUNIO0FBRTFCLElBQU1DLFlBQVlDLElBQUFBLG9CQUFZO0FBQzlCLElBQU1GLFNBQVNHLElBQUFBLGlCQUFTLEVBQUNGIn0= |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getLogger = void 0; | ||
const logdnaWinston = require('logdna-winston'); | ||
const winston = require('winston'); | ||
const { isLogDNAEnabled } = require('../util'); | ||
const { format, transports } = winston; | ||
const createWinstonLogger = (logLevel) => { | ||
const logger = winston.createLogger({ | ||
level: logLevel || 'info', | ||
format: format.combine(format.timestamp(), format.simple(), format.printf((info) => `${info.timestamp} - ${info.level}: ${info.message}`)), | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "getLogger", { | ||
enumerable: true, | ||
get: function() { | ||
return getLogger; | ||
} | ||
}); | ||
var _winston = /*#__PURE__*/ _interopRequireDefault(require("winston")); | ||
var _util = require("../util"); | ||
function _interopRequireDefault(obj) { | ||
return obj && obj.__esModule ? obj : { | ||
default: obj | ||
}; | ||
} | ||
var logdnaWinston = require("logdna-winston"); | ||
var format = _winston.default.format, transports = _winston.default.transports; | ||
var createWinstonLogger = function(logLevel) { | ||
var logger = _winston.default.createLogger({ | ||
level: logLevel || "info", | ||
format: format.combine(format.timestamp(), format.simple(), format.printf(function(info) { | ||
return "".concat(info.timestamp, " - ").concat(info.level, ": ").concat(info.message); | ||
})), | ||
transports: [ | ||
new transports.Console({ | ||
format: format.combine(format.timestamp(), format.simple(), format.printf((info) => `${info.timestamp} - ${info.level}: ${info.message}`), format.colorize({ all: true })), | ||
}), | ||
], | ||
format: format.combine(format.timestamp(), format.simple(), format.printf(function(info) { | ||
return "".concat(info.timestamp, " - ").concat(info.level, ": ").concat(info.message); | ||
}), format.colorize({ | ||
all: true | ||
})) | ||
}) | ||
] | ||
}); | ||
return logger; | ||
}; | ||
const getLogger = (params) => { | ||
const { logLevel, logDNAOptions, logDNAKey, sendToRemote } = params; | ||
const isEnabled = isLogDNAEnabled(logDNAKey, sendToRemote); | ||
const logger = createWinstonLogger(logLevel); | ||
var getLogger = function(params) { | ||
var AWS_LAMBDA_FUNCTION_NAME = process.env.AWS_LAMBDA_FUNCTION_NAME; | ||
var logLevel = params.logLevel, logDNAOptions = params.logDNAOptions, logDNAKey = params.logDNAKey, sendToRemote = params.sendToRemote; | ||
var isEnabled = (0, _util.isLogDNAEnabled)(logDNAKey, sendToRemote); | ||
var logger = createWinstonLogger(logLevel); | ||
if (isEnabled) { | ||
logger.add(new logdnaWinston(logDNAOptions)); | ||
} else if (AWS_LAMBDA_FUNCTION_NAME !== undefined) { | ||
logger.debug("LOGDNA is disabled"); | ||
} | ||
else { | ||
logger.info(`LOGDNA is disabled`); | ||
} | ||
return logger; | ||
}; | ||
exports.getLogger = getLogger; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9sb2dnZXIvbG9nZ2VyLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IElMb2dETkFQYXJhbXMgfSBmcm9tICcuLi90eXBlcyc7XG5jb25zdCBsb2dkbmFXaW5zdG9uID0gcmVxdWlyZSgnbG9nZG5hLXdpbnN0b24nKTtcbmltcG9ydCB3aW5zdG9uIGZyb20gJ3dpbnN0b24nO1xuaW1wb3J0IHsgaXNMb2dETkFFbmFibGVkIH0gZnJvbSAnLi4vdXRpbCc7XG5jb25zdCB7IGZvcm1hdCwgdHJhbnNwb3J0cyB9ID0gd2luc3Rvbjtcblxu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k4sT0FBakJNO0lBQzVDLElBQU1DLFlBQVlDLElBQUFBLHFCQUFlLEVBQUNILFdBQVdDO0lBQzdDLElBQU1sQixTQUFTRixvQkFBb0JDO0lBQ25DLElBQUlvQixXQUFXO1FBQ2JuQixPQUFPcUIsR0FBRyxDQUFDLElBQUk1QixjQUFjdUI7SUFDL0IsT0FBTyxJQUFJSCw2QkFBNkJTLFdBQVc7UUFDakR0QixPQUFPdUIsS0FBSyxDQUFFO0lBQ2hCLENBQUM7SUFFRCxPQUFPdkI7QUFDVCJ9 |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.sendToRemote = exports.getLogParams = void 0; | ||
const getEnvs = (env = (process === null || process === void 0 ? void 0 : process.env) || {}) => { | ||
const { LOG_LEVEL = 'info', LOGDNA_KEY = '', STAGE = 'n/a', AWS_LAMBDA_FUNCTION_NAME = 'n/a', LOGDNA_ENABLED = 'true', LOGDNA_SUPPRESS_FLUSH_ALL = 'false', } = env; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
function _export(target, all) { | ||
for(var name in all)Object.defineProperty(target, name, { | ||
enumerable: true, | ||
get: all[name] | ||
}); | ||
} | ||
_export(exports, { | ||
getLogParams: function() { | ||
return getLogParams; | ||
}, | ||
sendToRemote: function() { | ||
return sendToRemote; | ||
} | ||
}); | ||
var getEnvs = function() { | ||
var env = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : (process === null || process === void 0 ? void 0 : process.env) || {}; | ||
var _env_LOG_LEVEL = env.LOG_LEVEL, LOG_LEVEL = _env_LOG_LEVEL === void 0 ? "info" : _env_LOG_LEVEL, _env_LOGDNA_KEY = env.LOGDNA_KEY, LOGDNA_KEY = _env_LOGDNA_KEY === void 0 ? "" : _env_LOGDNA_KEY, _env_STAGE = env.STAGE, STAGE = _env_STAGE === void 0 ? "n/a" : _env_STAGE, _env_AWS_LAMBDA_FUNCTION_NAME = env.AWS_LAMBDA_FUNCTION_NAME, AWS_LAMBDA_FUNCTION_NAME = _env_AWS_LAMBDA_FUNCTION_NAME === void 0 ? "n/a" : _env_AWS_LAMBDA_FUNCTION_NAME, _env_LOGDNA_ENABLED = env.LOGDNA_ENABLED, LOGDNA_ENABLED = _env_LOGDNA_ENABLED === void 0 ? "true" : _env_LOGDNA_ENABLED, _env_LOGDNA_SUPPRESS_FLUSH_ALL = env.LOGDNA_SUPPRESS_FLUSH_ALL, LOGDNA_SUPPRESS_FLUSH_ALL = _env_LOGDNA_SUPPRESS_FLUSH_ALL === void 0 ? "false" : _env_LOGDNA_SUPPRESS_FLUSH_ALL; | ||
return { | ||
LOG_LEVEL, | ||
LOGDNA_KEY, | ||
STAGE, | ||
AWS_LAMBDA_FUNCTION_NAME, | ||
LOGDNA_ENABLED, | ||
LOGDNA_SUPPRESS_FLUSH_ALL, | ||
LOG_LEVEL: LOG_LEVEL, | ||
LOGDNA_KEY: LOGDNA_KEY, | ||
STAGE: STAGE, | ||
AWS_LAMBDA_FUNCTION_NAME: AWS_LAMBDA_FUNCTION_NAME, | ||
LOGDNA_ENABLED: LOGDNA_ENABLED, | ||
LOGDNA_SUPPRESS_FLUSH_ALL: LOGDNA_SUPPRESS_FLUSH_ALL | ||
}; | ||
}; | ||
const sendToRemote = (logDNAKey, logDNAEnabled) => { | ||
return !!logDNAKey && logDNAEnabled === 'true'; | ||
var sendToRemote = function(logDNAKey, logDNAEnabled) { | ||
return !!logDNAKey && logDNAEnabled === "true"; | ||
}; | ||
exports.sendToRemote = sendToRemote; | ||
const getLogParams = (env = (process === null || process === void 0 ? void 0 : process.env) || {}) => { | ||
const { LOG_LEVEL, LOGDNA_KEY, STAGE, AWS_LAMBDA_FUNCTION_NAME, LOGDNA_ENABLED, LOGDNA_SUPPRESS_FLUSH_ALL } = getEnvs(env); | ||
const logDNAOptions = { | ||
var getLogParams = function() { | ||
var env = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : (process === null || process === void 0 ? void 0 : process.env) || {}; | ||
var _getEnvs = getEnvs(env), LOG_LEVEL = _getEnvs.LOG_LEVEL, LOGDNA_KEY = _getEnvs.LOGDNA_KEY, STAGE = _getEnvs.STAGE, AWS_LAMBDA_FUNCTION_NAME = _getEnvs.AWS_LAMBDA_FUNCTION_NAME, LOGDNA_ENABLED = _getEnvs.LOGDNA_ENABLED, LOGDNA_SUPPRESS_FLUSH_ALL = _getEnvs.LOGDNA_SUPPRESS_FLUSH_ALL; | ||
var logDNAOptions = { | ||
key: LOGDNA_KEY, | ||
@@ -27,5 +43,8 @@ env: STAGE, | ||
index_meta: true, | ||
tags: [AWS_LAMBDA_FUNCTION_NAME, STAGE], | ||
tags: [ | ||
AWS_LAMBDA_FUNCTION_NAME, | ||
STAGE | ||
], | ||
level: LOG_LEVEL, | ||
handleExceptions: true, | ||
handleExceptions: true | ||
}; | ||
@@ -36,7 +55,8 @@ return { | ||
sendToRemote: sendToRemote(LOGDNA_KEY, LOGDNA_ENABLED), | ||
logDNASuppressFlushAll: LOGDNA_SUPPRESS_FLUSH_ALL === 'true', | ||
logDNASuppressFlushAll: LOGDNA_SUPPRESS_FLUSH_ALL === "true", | ||
functionName: AWS_LAMBDA_FUNCTION_NAME, | ||
logDNAOptions, | ||
logDNAOptions: logDNAOptions | ||
}; | ||
}; | ||
exports.getLogParams = getLogParams; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9wYXJhbXMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgSUxvZ0ROQVBhcmFtcyB9IGZyb20gJy4vdHlwZXMnO1xuXG5jb25zdCBnZXRFbnZzID0gKGVudiA9IHByb2Nlc3M/LmVudiB8fCB7fSkgPT4ge1xuICBjb25zdCB7XG4gICAgTE9HX0xFVkVMID0gJ2luZm8nLFxuICAgIExPR0ROQV9LRVkgPSAnJyxcbiAgICBTVEFHRSA9ICduL2EnLFxuICAgIEFXU19MQU1CREFfRlVOQ1RJT05fTkFNRSA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FVBQVVoQjtRQUNWTSxXQUFXTDtRQUNYTCxjQUFjQSxhQUFhSyxZQUFZRztRQUN2Q2Esd0JBQXdCWiw4QkFBOEI7UUFDdERhLGNBQWNmO1FBQ2RLLGVBQUFBO0lBQ0Y7QUFDRiJ9 |
@@ -1,5 +0,5 @@ | ||
export declare type EmptyCBFunction = () => void; | ||
export declare type CallbackFunction = (err: any, data: any) => void; | ||
export declare type LambdaHandlerWithAsyncFunction = (event: any, context: any) => Promise<any>; | ||
export declare type LambdaHandlerWithCallbackFunction = (event: any, context: any, fn: CallbackFunction) => void; | ||
export type EmptyCBFunction = () => void; | ||
export type CallbackFunction = (err: any, data: any) => void; | ||
export type LambdaHandlerWithAsyncFunction = (event: any, context: any) => Promise<any>; | ||
export type LambdaHandlerWithCallbackFunction = (event: any, context: any, fn: CallbackFunction) => void; | ||
export interface ILogDNALogOptions { | ||
@@ -6,0 +6,0 @@ key: string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9 |
313
dist/util.js
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
function _export(target, all) { | ||
for(var name in all)Object.defineProperty(target, name, { | ||
enumerable: true, | ||
get: all[name] | ||
}); | ||
} | ||
_export(exports, { | ||
isLogDNAEnabled: function() { | ||
return isLogDNAEnabled; | ||
}, | ||
flushAll: function() { | ||
return flushAll; | ||
}, | ||
ensureFlushAll: function() { | ||
return ensureFlushAll; | ||
}, | ||
ensureFlushAllCallback: function() { | ||
return ensureFlushAllCallback; | ||
} | ||
}); | ||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
try { | ||
var info = gen[key](arg); | ||
var value = info.value; | ||
} catch (error) { | ||
reject(error); | ||
return; | ||
} | ||
if (info.done) { | ||
resolve(value); | ||
} else { | ||
Promise.resolve(value).then(_next, _throw); | ||
} | ||
} | ||
function _asyncToGenerator(fn) { | ||
return function() { | ||
var self = this, args = arguments; | ||
return new Promise(function(resolve, reject) { | ||
var gen = fn.apply(self, args); | ||
function _next(value) { | ||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); | ||
} | ||
function _throw(err) { | ||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); | ||
} | ||
_next(undefined); | ||
}); | ||
}; | ||
} | ||
var __generator = (void 0) && (void 0).__generator || function(thisArg, body) { | ||
var f, y, t, g, _ = { | ||
label: 0, | ||
sent: function() { | ||
if (t[0] & 1) throw t[1]; | ||
return t[1]; | ||
}, | ||
trys: [], | ||
ops: [] | ||
}; | ||
return(g = { | ||
next: verb(0), | ||
"throw": verb(1), | ||
"return": verb(2) | ||
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() { | ||
return this; | ||
}), g); | ||
function verb(n) { | ||
return function(v) { | ||
return step([ | ||
n, | ||
v | ||
]); | ||
}; | ||
} | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while(_)try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [ | ||
op[0] & 2, | ||
t.value | ||
]; | ||
switch(op[0]){ | ||
case 0: | ||
case 1: | ||
t = op; | ||
break; | ||
case 4: | ||
_.label++; | ||
return { | ||
value: op[1], | ||
done: false | ||
}; | ||
case 5: | ||
_.label++; | ||
y = op[1]; | ||
op = [ | ||
0 | ||
]; | ||
continue; | ||
case 7: | ||
op = _.ops.pop(); | ||
_.trys.pop(); | ||
continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { | ||
_ = 0; | ||
continue; | ||
} | ||
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { | ||
_.label = op[1]; | ||
break; | ||
} | ||
if (op[0] === 6 && _.label < t[1]) { | ||
_.label = t[1]; | ||
t = op; | ||
break; | ||
} | ||
if (t && _.label < t[2]) { | ||
_.label = t[2]; | ||
_.ops.push(op); | ||
break; | ||
} | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); | ||
continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { | ||
op = [ | ||
6, | ||
e | ||
]; | ||
y = 0; | ||
} finally{ | ||
f = t = 0; | ||
} | ||
if (op[0] & 5) throw op[1]; | ||
return { | ||
value: op[0] ? op[1] : void 0, | ||
done: true | ||
}; | ||
} | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ensureFlushAllCallback = exports.ensureFlushAll = exports.flushAll = exports.isLogDNAEnabled = void 0; | ||
const LogDNALogger = require('logdna'); | ||
const debug = require('util').debuglog('logger-adapter'); | ||
const { FALLBACK_TIMEOUT_AFTER_FLUSHING } = require('./consts'); | ||
const { getLogParams } = require('./params'); | ||
var LogDNALogger = require("logdna"); | ||
var debug = require("util").debuglog("logger-adapter"); | ||
var FALLBACK_TIMEOUT_AFTER_FLUSHING = require("./consts").FALLBACK_TIMEOUT_AFTER_FLUSHING; | ||
var getLogParams = require("./params").getLogParams; | ||
// timeout | ||
let timeout; | ||
var timeout; | ||
/** | ||
@@ -23,32 +159,41 @@ * Handy function to check if we are sending to LogDNA | ||
* @param sendToRemote | ||
*/ | ||
const isLogDNAEnabled = (logDNAKey, sendToRemote) => !!logDNAKey && sendToRemote; | ||
exports.isLogDNAEnabled = isLogDNAEnabled; | ||
*/ var isLogDNAEnabled = function(logDNAKey, sendToRemote) { | ||
return !!logDNAKey && sendToRemote; | ||
}; | ||
/** | ||
* REturn if we need to suppress flushAll on a local machine | ||
*/ | ||
const suppressFlushAll = () => { var _a; return ((_a = getLogParams()) === null || _a === void 0 ? void 0 : _a.logDNASuppressFlushAll) || false; }; | ||
*/ var suppressFlushAll = function() { | ||
var _getLogParams; | ||
return ((_getLogParams = getLogParams()) === null || _getLogParams === void 0 ? void 0 : _getLogParams.logDNASuppressFlushAll) || false; | ||
}; | ||
/** | ||
* Send all log messages to LogDNA before lambda is terminated | ||
*/ | ||
const flushAll = () => __awaiter(void 0, void 0, void 0, function* () { | ||
return new Promise(resolve => { | ||
debug('Flushing all logs...'); | ||
LogDNALogger.flushAll(() => { | ||
debug('Completed flushing all log messages'); | ||
if (timeout) { | ||
clearTimeout(timeout); | ||
} | ||
resolve(); | ||
*/ var flushAll = function() { | ||
var _ref = _asyncToGenerator(function() { | ||
return __generator(this, function(_state) { | ||
return [ | ||
2, | ||
new Promise(function(resolve) { | ||
debug("Flushing all logs..."); | ||
LogDNALogger.flushAll(function() { | ||
debug("Completed flushing all log messages"); | ||
if (timeout) { | ||
clearTimeout(timeout); | ||
} | ||
resolve(); | ||
}); | ||
}) | ||
]; | ||
}); | ||
}); | ||
}); | ||
exports.flushAll = flushAll; | ||
return function flushAll() { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}(); | ||
/** | ||
* Fallback promise just in | ||
*/ | ||
const timeoutPromise = () => { | ||
return new Promise(resolve => { | ||
timeout = setTimeout(() => { | ||
debug('Flushing timeout has reached. Ignore flushing messages...'); | ||
*/ var timeoutPromise = function() { | ||
return new Promise(function(resolve) { | ||
timeout = setTimeout(function() { | ||
debug("Flushing timeout has reached. Ignore flushing messages..."); | ||
resolve(); | ||
@@ -61,19 +206,70 @@ }, FALLBACK_TIMEOUT_AFTER_FLUSHING); | ||
* @param lambdaHandler | ||
*/ | ||
const ensureFlushAll = (lambdaHandler) => { | ||
return (event, context) => __awaiter(void 0, void 0, void 0, function* () { | ||
try { | ||
const result = yield lambdaHandler(event, context); | ||
if (!suppressFlushAll()) | ||
yield Promise.race([flushAll(), timeoutPromise()]); | ||
return result; | ||
} | ||
catch (e) { | ||
if (!suppressFlushAll()) | ||
yield Promise.race([flushAll(), timeoutPromise()]); | ||
throw e; | ||
} | ||
}); | ||
*/ var ensureFlushAll = function(lambdaHandler) { | ||
return function() { | ||
var _ref = _asyncToGenerator(function(event, context) { | ||
var result, e; | ||
return __generator(this, function(_state) { | ||
switch(_state.label){ | ||
case 0: | ||
_state.trys.push([ | ||
0, | ||
4, | ||
, | ||
7 | ||
]); | ||
return [ | ||
4, | ||
lambdaHandler(event, context) | ||
]; | ||
case 1: | ||
result = _state.sent(); | ||
if (!!suppressFlushAll()) return [ | ||
3, | ||
3 | ||
]; | ||
return [ | ||
4, | ||
Promise.race([ | ||
flushAll(), | ||
timeoutPromise() | ||
]) | ||
]; | ||
case 2: | ||
_state.sent(); | ||
_state.label = 3; | ||
case 3: | ||
return [ | ||
2, | ||
result | ||
]; | ||
case 4: | ||
e = _state.sent(); | ||
if (!!suppressFlushAll()) return [ | ||
3, | ||
6 | ||
]; | ||
return [ | ||
4, | ||
Promise.race([ | ||
flushAll(), | ||
timeoutPromise() | ||
]) | ||
]; | ||
case 5: | ||
_state.sent(); | ||
_state.label = 6; | ||
case 6: | ||
throw e; | ||
case 7: | ||
return [ | ||
2 | ||
]; | ||
} | ||
}); | ||
}); | ||
return function(event, context) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}(); | ||
}; | ||
exports.ensureFlushAll = ensureFlushAll; | ||
/** | ||
@@ -87,9 +283,7 @@ * A Lambda wrapper to ensure we flush messages before a Lambda function get terminated | ||
* @param lambdaHandler | ||
*/ | ||
const ensureFlushAllCallback = (lambdaHandler) => { | ||
return (event, context, callback) => { | ||
const thisCallback = (error, result) => { | ||
*/ var ensureFlushAllCallback = function(lambdaHandler) { | ||
return function(event, context, callback) { | ||
var thisCallback = function(error, result) { | ||
callback(error, result); | ||
if (!suppressFlushAll()) | ||
flushAll(); | ||
if (!suppressFlushAll()) flushAll(); | ||
}; | ||
@@ -99,2 +293,3 @@ lambdaHandler(event, context, thisCallback); | ||
}; | ||
exports.ensureFlushAllCallback = ensureFlushAllCallback; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy91dGlsLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IExhbWJkYUhhbmRsZXJXaXRoQXN5bmNGdW5jdGlvbiwgTGFtYmRhSGFuZGxlcldpdGhDYWxsYmFja0Z1bmN0aW9uLCBDYWxsYmFja0Z1bmN0aW9uIH0gZnJvbSAnLi90eXBlcyc7XG5cbmNvbnN0IExvZ0ROQUxvZ2dlciA9IHJlcXVpcmUoJ2xvZ2RuYScpO1xuY29uc3QgZGVidWcgPSByZXF1aXJlKCd1dGlsJykuZGVidWdsb2coJ2xvZ2dlci1hZGFwdGVyJyk7XG5jb25zdCB7IEZBTExCQUNLX1RJTUVPVVRfQUZURVJfRkxVU0hJTkcgfSA9IHJlcXVpcmUoJy4vY29uc3RzJyk7XG5jb25zdCB7IGdldExvZ1BhcmFtcyB9ID0gcmVxdWlyZSgnLi9wYXJhbXMnKTtcblxuLy8gdGltZW91dFxubGV0IHRpbWVvdXQ6IE5vZGVKUy5UaW1lb3V0O1xuXG4vKipcbiAqIEhhbmR5IGZ1bmN0aW9uIHRvIGNoZWNrIGlmIHdlIGFyZSBzZW5kaW5nIHRvIExvZ0ROQVxuICogQHBhcmFtIGxvZ0ROQUtleVxuICogQHBhcmFtIHNlbmRUb1JlbW90ZVxuICovXG5jb25zdCBpc0xvZ0ROQUVuYWJsZWQgPSAobG9nRE5B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TtnQ0FBRXhCO2dDQUFZaUI7Ozs7d0JBQWhDOzs7d0JBQ3pCOzs0QkFBT0s7Ozt3QkFDQUM7NkJBQ0gsQ0FBQ1gsb0JBQUQ7Ozs7d0JBQXFCOzs0QkFBTUUsUUFBUVUsSUFBSTtnQ0FBRXhCO2dDQUFZaUI7Ozs7d0JBQWhDOzs7d0JBQ3pCLE1BQU1NLEVBQUU7Ozs7Ozs7UUFFWjt3QkFUY0gsT0FBWUM7Ozs7QUFVNUI7QUFFQTs7Ozs7Ozs7Q0FRQyxHQUNELElBQU1uQix5QkFBeUIsU0FDN0JpQixlQUNzQztJQUN0QyxPQUFPLFNBQUNDLE9BQVlDLFNBQWNJLFVBQXFDO1FBQ3JFLElBQU1DLGVBQWUsU0FBQ0MsT0FBWUwsUUFBc0I7WUFDdERHLFNBQVNFLE9BQU9MO1lBQ2hCLElBQUksQ0FBQ1Ysb0JBQW9CWjtRQUMzQjtRQUNBbUIsY0FBY0MsT0FBT0MsU0FBU0s7SUFDaEM7QUFDRiJ9 |
{ | ||
"name": "@beforeyoubid/logger-adapter", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"description": "A platform logger module to send the log messages to LogDNA.", | ||
@@ -8,4 +8,3 @@ "main": "dist/index.js", | ||
"files": [ | ||
"dist/**/*", | ||
"src/**/*" | ||
"dist/**/*" | ||
], | ||
@@ -15,8 +14,13 @@ "scripts": { | ||
"lint:fix": "eslint --fix --max-warnings 0 '**/*.{ts,tsx,js,jsx}'", | ||
"test": "yarn build && jest --config jestconfig.json", | ||
"test:coverage": "yarn build && jest --config jestconfig.json --watch --coverage", | ||
"test:ci": "yarn build && jest --config jestconfig.json --verbose=false --coverage", | ||
"test-only": "jest --config jestconfig.json", | ||
"build": "tsc", | ||
"build-and-publish": "npm run build && npm publish --access public" | ||
"test": "yarn build && jest", | ||
"test:coverage": "yarn build && jest --watch --coverage", | ||
"test:ci": "jest --verbose=false --coverage", | ||
"test-only": "jest", | ||
"build": "rimraf dist && npm run build:types && npm run build:js", | ||
"build:types": "tsc --emitDeclarationOnly --declaration --project tsconfig.build.json", | ||
"build:js": "swc src --out-dir dist --extensions \".ts,.tsx\" --source-maps inline --ignore=.spec.js", | ||
"ts": "tsc --noEmit", | ||
"build-and-publish": "npm run build && npm publish --access public", | ||
"build-and-publish-dryrun": "npm run build && npm publish --dry-run", | ||
"build-and-publish-dryrun-ci": "npm run build && npm publish --registry http://localhost:4873" | ||
}, | ||
@@ -35,18 +39,25 @@ "repository": { | ||
"dependencies": { | ||
"logdna": "^3.5.2", | ||
"logdna": "3.5.3", | ||
"logdna-winston": "^2.3.2", | ||
"winston": "^3.3.3" | ||
"winston": "3.8.2" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^26.0.9", | ||
"@types/node": "^14.0.27", | ||
"@typescript-eslint/eslint-plugin": "^3.9.0", | ||
"@typescript-eslint/parser": "^3.9.0", | ||
"eslint": "^7.6.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"jest": "^26.4.0", | ||
"prettier": "^2.0.5", | ||
"ts-jest": "^26.2.0", | ||
"typescript": "^3.9.7" | ||
"@swc/cli": "0.1.61", | ||
"@swc/core": "1.3.35", | ||
"@swc/jest": "0.2.24", | ||
"@types/jest": "29.4.0", | ||
"@types/node": "18.13.0", | ||
"@typescript-eslint/eslint-plugin": "5.52.0", | ||
"@typescript-eslint/parser": "5.52.0", | ||
"danger": "11.2.3", | ||
"danger-plugin-yarn": "1.6.0", | ||
"eslint": "8.34.0", | ||
"eslint-config-prettier": "8.6.0", | ||
"eslint-plugin-prettier": "4.2.1", | ||
"jest": "29.4.2", | ||
"jest-junit": "15.0.0", | ||
"prettier": "2.8.4", | ||
"rimraf": "^4.1.2", | ||
"ts-node": "^10.9.1", | ||
"typescript": "4.9.5" | ||
}, | ||
@@ -53,0 +64,0 @@ "resolutions": { |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
57082
18
20
679
2
1
+ Added@colors/colors@1.5.0(transitive)
+ Addedwinston@3.8.2(transitive)
- Removedwinston@3.17.0(transitive)
Updatedlogdna@3.5.3
Updatedwinston@3.8.2