Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@supertenant/core / src / util / initializedTooLateHeuristic.js
Size: Mime:
// (c) Copyright 2023 Supertenant Ltd. - all rights reserved.
// See LICENSE file in project root for license terms.
"use strict";let logger,firstCall=(logger=require("../logger").getLogger("util/initializedTooLateHeuristic",newLogger=>{logger=newLogger}),!0),hasBeenInitializedTooLate=!1,patterns=[/\/@redis\/client\/dist\/lib\/cluster\/commands.js/,/\/cls-hooked\/index.js/,/\/express\/index.js/,/\/fastify\/fastify/,/\/ioredis\/built\//,/\/mongodb-core\/lib\//,/\/mongodb\/lib\//,/\/mysql2\/index.js/,/\/mysql2\/promise.js/,/\/mysql\/index.js/,/\/redis\/dist\/index.js/,/\/redis\/index.js/];const extraPatterns=[/\/bluebird\/js\/release\//,/\/request\/index.js/,/\/winston\/lib\/winston.js/];module.exports=function(){if(firstCall){var loadedModules=Object.keys(require.cache);0===Object.keys(require.cache).filter(moduleId=>/\/@contrast\/agent\//.test(moduleId)).length?patterns=patterns.concat(extraPatterns):logger.debug("Found @contrast/agent in the modules that have already been loaded. @supertenant/core will therefore exclude bluebird, request and winston from the check for modules that have been loaded before @supertenant/core.");for(let i=0;i<loadedModules.length;i++)for(let j=0;j<patterns.length;j++)patterns[j].test(loadedModules[i])&&(hasBeenInitializedTooLate=!0,logger.debug(`Found a module that has been loaded before @supertenant/core but should have been loaded afterwards: ${loadedModules[i]}.`))}return firstCall=!1,hasBeenInitializedTooLate},module.exports.reset=()=>{hasBeenInitializedTooLate=!1,firstCall=!0};