hud-sdk 1.6.28 → 1.6.30

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.
@@ -1,2 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var i in n)("object"==typeof exports?exports:e)[i]=n[i]}}(global,()=>(()=>{"use strict";var e={1569:e=>{e.exports=require("zod")},2210:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SDK_MODULE_NAME=void 0,t.SDK_MODULE_NAME="hud-sdk"},2509:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.SDK_VERSION=t.SDK_MODULE_NAME=void 0,r(n(2887),t),r(n(2570),t);var s=n(2210);Object.defineProperty(t,"SDK_MODULE_NAME",{enumerable:!0,get:function(){return s.SDK_MODULE_NAME}}),r(n(7089),t);var a=n(5453);Object.defineProperty(t,"SDK_VERSION",{enumerable:!0,get:function(){return a.SDK_VERSION}})},2570:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateDynamicConfig=function(e,t,n){const s=i.HudDynamicConfigSchema.deepPartial().safeParse(e);if(!s.success)return n.error("Dynamic configuration not updated - Invalid configuration override",{remoteConfigParseResult:s,remoteConfig:e}),t.dynamicConfig;const a=r(t.dynamicConfig,s.data);return void 0!==a.enableInvestigation&&a.enableInvestigation!==t.dynamicConfig.enableInvestigation&&(n.info("Dynamic configuration updated - enableInvestigation",{hudEnableInvestigation:a.enableInvestigation}),t.isInvestigationEnabledByEnv||(globalThis.hudEnableInvestigation=a.enableInvestigation)),a};const i=n(2887);function r(e,t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(e)&&Array.isArray(t))return t;const n={...e};for(const i in t){const s=e[i],a=t[i];n[i]=r(s,a)}return n}},2887:function(e,t,n){var i,r=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||(i=function(e){return i=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},i(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n=i(e),a=0;a<n.length;a++)"default"!==n[a]&&r(t,e,n[a]);return s(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.HudFailedReadConfigError=t.hudConfig=t.HudDynamicConfigSchema=void 0,t.getModulesToTraceFromEnv=function(){const e=process.env.HUD_MONITOR_MODULES||process.env.HUD_INCLUDE_MODULES;if(e)return e.split(",")},t.getFrameworksToEnableFromEnv=function(){const e=process.env.HUD_ENABLE_FRAMEWORKS;let t;if(e)try{t=o.availableFrameworksSchema.parse(JSON.parse(e))}catch{t=new Map}return t},t.isValidParam=function(e){return null!=e&&""!==e&&"string"==typeof e},t.updateInvestigationRateLimitGlobals=function(){globalThis.hudMaxSameInvestigations=t.hudConfig.dynamicConfig.investigationRateLimits.maxSameInvestigations,globalThis.hudMaxTotalInvestigations=t.hudConfig.dynamicConfig.investigationRateLimits.maxTotalInvestigations,globalThis.hudSameInvestigationTimeWindowNs=BigInt(t.hudConfig.dynamicConfig.investigationRateLimits.sameInvestigationTimeWindowMs)*BigInt(1e6),globalThis.hudTotalInvestigationTimeWindowNs=BigInt(t.hudConfig.dynamicConfig.investigationRateLimits.totalInvestigationTimeWindowMs)*BigInt(1e6)},t.getConfigContent=function(){if(process.env.HUD_CONFIG)return{content:process.env.HUD_CONFIG,source:"HUD_CONFIG"};const e=function(){try{const e=process.env.HUD_CONFIG_PATH;if(e)return l.existsSync(e)?e:void 0;let t=__dirname,n=0;for(;"/"!==t&&n<10;){const e=`${t}/hud.config`;if(l.existsSync(e))return e;t=u.dirname(t),n++}}catch{return}}();if(e)try{return{content:l.readFileSync(e,"utf8"),source:e}}catch(t){throw new h(e,t.code)}};const o=n(8528),l=a(n(9896)),u=a(n(6928)),d=n(1569),c="globalThis._hudMark";t.HudDynamicConfigSchema=d.z.object({aggregationInterval:d.z.number(),aggregationFirstSendTimeout:d.z.number(),investigationInterval:d.z.number(),investigationFirstSendTimeout:d.z.number(),enableInvestigation:d.z.boolean(),investigationRateLimits:d.z.object({maxSameInvestigations:d.z.number().int().positive(),sameInvestigationTimeWindowMs:d.z.number().int().positive(),maxTotalInvestigations:d.z.number().int().positive(),totalInvestigationTimeWindowMs:d.z.number().int().positive(),maxUniqLogs:d.z.number().int().positive()}),machineMetricsInterval:d.z.number().int().positive(),blacklistParams:d.z.array(d.z.string()),forensicsBlacklistFields:d.z.array(d.z.string()),forensicsWhitelistFields:d.z.array(d.z.string()),censorshipRegexes:d.z.array(d.z.object({regex:d.z.string(),replacement:d.z.string()})),reingestInterval:d.z.number().int().positive(),extraHeaders:d.z.array(d.z.string())});const m=process.env.HUD_ENABLE_INVESTIGATION,p=process.env.HUD_HOST||"https://api-prod.hud.io",g=process.env.HUD_LOG_DIR,f="_HUD",v=process.env.HUD_LOG_TO_FILE,b={sink:{url:p,timeout:5e3,session_attr:"X-Session-ID"},endpoints:{init:"sink/init",send:"sink/send",batch:"sink/batch",logs:"sink/logs",sessionslessLogs:"sink/sessionless-logs",fatalError:"sink/redline",getMode:"sink/getMode",getRemoteConfig:"sink/remote-config/get",fileDeclarations:"sink/file-declarations",sourceMap:"sink/sourcemap",storeObject:"sink/objects/store",getUploadUrls:"sink/registry/get-upload-urls",triggerReingest:"sink/registry/reingest",validateToken:"sink/registry/validate",fileDeclarationsCi:"sink/registry/file-declarations",completed:"sink/registry/completed"},logger:{default:{levels:{app:"warning",worker:"warning",instrument:"warning"}},debug:{levels:{app:"debug",worker:"debug",instrument:"debug"}}},investigation:{objectVersion:"1.0.1",store:{type:"s3"},limits:{executionFlowMaxLength:100,exceptionMaxLength:100},maxStringLength:1024,maxArrayLength:100,maxObjectDepth:10},userConfig:{minPodMemoryMB:{value:250,source:"DEFAULT"},maxMappedFunctions:{value:5e4,source:"DEFAULT"},maxFileSizeBytes:{value:2831155,source:"DEFAULT"},maxTimeUntilInitSessionMs:{value:3e4,source:"DEFAULT"},includeModules:{value:[],source:"DEFAULT"},disableRuntimeInstrumentation:{value:!1,source:"DEFAULT"}},loggerWorkerPortSizeLimit:1e4,customerLoggerLevel:"info",logDirectory:g,invocationSampling:new Map([[[300n,null],100],[[200n,300n],50],[[100n,200n],25],[[0n,100n],10]]),callerResetInterval:36e5,modeInterval:3e5,logsSendInterval:6e4,logPerfInterval:3e5,endpointsInterval:3e4,endpointsFirstSendWaitTime:12e4,lazyEndpointsInterval:18e5,staticNextJsEndpointsInterval:1e4,staticNextJsEndpointsMaxAttempts:12,huddBinWidth:1.2,workerGrace:6e4,workerTimeout:2e4,timeoutOnRegister:6e4,timeoutOnMetrics:6e4,workerMessageTimeout:1e4,communicationBatchSize:100,writePatched:!1,defaultOff:!0,disableOnBadApiKey:!0,disableOnBadServiceName:!0,cpuTimeCollection:!1,workloadMetadata:{sendInterval:3e5,aws:{imds:{baseURL:"http://169.254.169.254/latest",tokenURI:"/api/token",identityURI:"/dynamic/instance-identity/document",lifeCycleURI:"/meta-data/instance-life-cycle",requestTimeout:5e3},metadataFile:"/run/cloud-init/instance-data.json"},kubernetes:{namespaceFile:"/var/run/secrets/kubernetes.io/serviceaccount/namespace",uuidFile:"/sys/class/dmi/id/product_uuid",podMemoryLimitFile:"/sys/fs/cgroup/memory/memory.stat",podCPULimitFile:"/sys/fs/cgroup/cpuacct/cpu.shares"}},deleteLogsAfterSending:!0,supportSourceMap:!0,editInline:!0,bundlerBuildIdVarName:"hudFileBuildID",bundlerBuildUuidNamespace:"00c1e90b-af75-4d8e-9935-68485877f759",functionUuidNamespace:"94a210f3-861c-4e18-ab27-6b6c19437c9d",wrapVarPrefix:f,functionIdVarName:`${f}_fid`,frameworksToPatch:new Map([["express",{framework:o.availableFrameworks.express,enable:!0,version:"<=5",patcher:"express",enableEsbuild:!0}],[u.join("express","lib","application.js"),{framework:o.availableFrameworks.express,enable:!0,version:"<=5",patcher:"expressApplication",enableEsbuild:!0}],["router",{framework:o.availableFrameworks.express,enable:!0,version:"^2.0.0",patcher:"router",enableEsbuild:!0}],["koa",{framework:o.availableFrameworks.koa,enable:!0,version:"^2.0.0",patcher:"koa"}],["http",{framework:o.availableFrameworks.http,enable:!0,version:"*",patcher:"http"}],["https",{framework:o.availableFrameworks.https,enable:!0,version:"*",patcher:"http"}],["next/dist/server/base-server",{framework:o.availableFrameworks.nextjs,enable:!1,version:">=13.4.0",patcher:"nextjs"}],["next/dist/server/lib/module-loader/route-module-loader",{framework:o.availableFrameworks.nextjs,enable:!1,version:">=13.4.0",patcher:"nextJsModuleLoader"}],["next/dist/server/web/spec-extension/adapters/next-request",{framework:o.availableFrameworks.nextjs,enable:!1,version:">=13.4.0",patcher:"nextRequestAdapter"}],["next/dist/server/config",{framework:o.availableFrameworks.nextjs,enable:!1,version:">=13.4.0",patcher:"nextJsConfig"}],["@nestjs/core/router/router-execution-context",{framework:o.availableFrameworks.nestjs,enable:!0,version:"*",patcher:"nestjsRouterExecutionContext"}],["kafkajs",{framework:o.availableFrameworks.kafkajs,enable:"win32"!==process.platform,version:">=1.4.0",patcher:"kafkajs"}],["@nestjs/microservices/context/rpc-context-creator",{framework:o.availableFrameworks.nestjs,enable:"win32"!==process.platform,version:">=7.0.0",patcher:"nestjsRpcContextCreator"}],[["@codegenie/serverless-express","src","frameworks","express.js"].join(u.sep),{framework:o.availableFrameworks.codegenieServerlessExpress,enable:!0,version:"^4.1.0",patcher:"codeGenieServerlessExpress",enableEsbuild:!0}],["@codegenie/serverless-express",{framework:o.availableFrameworks.codegenieServerlessExpress,enable:!0,enableEsbuild:!0}],["sqs-consumer",{framework:o.availableFrameworks.sqs,enable:!0,version:"*",patcher:"sqsConsumer",extraInfo:{mondayVersion:">=6.1.0",bbcVersion:">=7.5.0"}}],["serverless-http",{framework:o.availableFrameworks.serverlessHttp,enable:!0,enableEsbuild:!0}],[u.join("serverless-http","lib","framework","get-framework.js"),{framework:o.availableFrameworks.serverlessHttp,enable:!0,version:"^2.7.0",patcher:"serverlessHttp",enableEsbuild:!0}]]),communicationKeepalive:!1,communicationKeepaliveGrace:5e3,express:{routeNamesSymbol:Symbol.for("hudRoutes"),layerStateSymbol:Symbol.for("hudState"),markedSymbol:Symbol.for("hudMarked"),wrapAllCallbacks:!0},supportedNodeVersions:["18","20","21","22","24"],hudPatchedName:"hudPatched",metricSymbol:Symbol.for("hudMetric"),dynamicConfig:{aggregationInterval:3e5,aggregationFirstSendTimeout:3e4,investigationInterval:5e3,investigationFirstSendTimeout:3e4,enableInvestigation:"true"===m,investigationRateLimits:{maxSameInvestigations:2,sameInvestigationTimeWindowMs:36e5,maxTotalInvestigations:25,totalInvestigationTimeWindowMs:216e5,maxUniqLogs:2},machineMetricsInterval:1e4,reingestInterval:3e4,extraHeaders:[],blacklistParams:[],censorshipRegexes:[],forensicsBlacklistFields:[],forensicsWhitelistFields:[]},machineMetricsSavedLength:2,isInvestigationEnabledByEnv:void 0!==m,suppressTraces:!0,lambdaMinimunMemory:1024,lambdaBaseGivenTime:400,lambdaExtraGivenTimePerRequest:50,lambdaMaxGivenTime:700,throttleStatusCode:202,functionsToInstrument:[{moduleName:"pg",fileToFunctionsMapping:{[u.join(u.sep,"pg","lib","client.js")]:["query","connect","end"]}},{moduleName:"axios",fileToFunctionsMapping:{[u.join(u.sep,"axios","dist","node","axios.cjs")]:["request"]}},{moduleName:"typeorm",fileToFunctionsMapping:{[u.join(u.sep,"typeorm","repository","Repository.js")]:["hasId","getId","create","merge","preload","save","remove","softRemove","recover","insert","update","upsert","delete","softDelete","restore","exist","exists","existsBy","count","countBy","sum","average","minimum","maximum","find","findBy","findAndCount","findAndCountBy","findByIds","findOne","findOneBy","findOneById","findOneOrFail","findOneByOrFail","query","clear","increment","decrement","extend"]}}],esbuildGlobalVar:"hudSGV",esbuildPluginMessagePrefix:"ESBuild plugin ",esbuildMark:"/*modifiedByHudESBuildPlugin-",esbuildMarkLength:67,esbuildUploadSourceMapTimeout:15e3,esbuildPluginLogsChunkSize:100,esbuildPluginLogsBatchSize:10,pluginsLogEndpoint:"https://yqp37dddrsewm6wdwwpwfraxqm0shdmx.lambda-url.eu-central-1.on.aws/",fileless:"true"!==v,uninstrumentedFilesLogThreshold:2,tsNodeConfigTimeout:1e4,allowedEditExtensions:[".ts",".cts",".mts",".js",".cjs",".mjs"],nextJsMarkVarName:c,nextJsMarkStatement:`${c} = "a"`,timeoutOnNextJsPlugin:3e4,logIntervals:{instrumentedFilesCount:5e3,sentEventsCount:12e4},cliBuildIdVarName:"hudCliBuildId",cliSdkVersionVarName:"hudCliSdkVersion"};t.hudConfig=function(e={}){return{...b,...e}}({logger:{default:{levels:{app:"info",worker:"info",instrument:"info"}},debug:{levels:{app:"debug",worker:"debug",instrument:"debug"}}},deleteLogsAfterSending:!1,communicationKeepalive:!0}),t.default=t.hudConfig;class h extends Error{path;code;constructor(e,t){super(),this.path=e,this.code=t}}t.HudFailedReadConfigError=h},5453:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SDK_VERSION=void 0,t.SDK_VERSION="1.6.28"},6928:e=>{e.exports=require("path")},7089:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectStoreConfigSchema=void 0;const i=n(1569),r=i.z.object({type:i.z.literal("s3")}),s=i.z.object({type:i.z.literal("disk"),path:i.z.string()});t.ObjectStoreConfigSchema=i.z.union([r,s])},8528:e=>{e.exports=require("./dto")},9896:e=>{e.exports=require("fs")}},t={};return function n(i){var r=t[i];if(void 0!==r)return r.exports;var s=t[i]={exports:{}};return e[i].call(s.exports,s,s.exports,n),s.exports}(2509)})());
1
+ !function(e,n){if("object"==typeof exports&&"object"==typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var t=n();for(var i in t)("object"==typeof exports?exports:e)[i]=t[i]}}(global,()=>(()=>{"use strict";var e={1569:e=>{e.exports=require("zod")},2210:(e,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.SDK_MODULE_NAME=void 0,n.SDK_MODULE_NAME="hud-sdk"},2509:function(e,n,t){var i=this&&this.__createBinding||(Object.create?function(e,n,t,i){void 0===i&&(i=t);var r=Object.getOwnPropertyDescriptor(n,t);r&&!("get"in r?!n.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return n[t]}}),Object.defineProperty(e,i,r)}:function(e,n,t,i){void 0===i&&(i=t),e[i]=n[t]}),r=this&&this.__exportStar||function(e,n){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(n,t)||i(n,e,t)};Object.defineProperty(n,"__esModule",{value:!0}),n.SDK_VERSION=n.SDK_MODULE_NAME=void 0,r(t(2887),n),r(t(2570),n);var a=t(2210);Object.defineProperty(n,"SDK_MODULE_NAME",{enumerable:!0,get:function(){return a.SDK_MODULE_NAME}}),r(t(7089),n);var s=t(5453);Object.defineProperty(n,"SDK_VERSION",{enumerable:!0,get:function(){return s.SDK_VERSION}})},2570:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.updateDynamicConfig=function(e,n,t){const a=i.HudDynamicConfigSchema.deepPartial().safeParse(e);if(!a.success)return t.error("Dynamic configuration not updated - Invalid configuration override",{remoteConfigParseResult:a,remoteConfig:e}),n.dynamicConfig;const s=r(n.dynamicConfig,a.data);return void 0!==s.enableInvestigation&&s.enableInvestigation!==n.dynamicConfig.enableInvestigation&&(t.info("Dynamic configuration updated - enableInvestigation",{hudEnableInvestigation:s.enableInvestigation}),n.isInvestigationEnabledByEnv||(globalThis.hudEnableInvestigation=s.enableInvestigation)),void 0!==s.enableInvestigationArgsSending&&s.enableInvestigationArgsSending!==n.dynamicConfig.enableInvestigationArgsSending&&(t.info("Dynamic configuration updated - enableInvestigationArgsSending",{hudEnableInvestigationArgsSending:s.enableInvestigationArgsSending}),globalThis.hudEnableInvestigationArgsSending=s.enableInvestigationArgsSending),s};const i=t(2887);function r(e,n){if(null===n||"object"!=typeof n)return n;if(Array.isArray(e)&&Array.isArray(n))return n;const t={...e};for(const i in n){const a=e[i],s=n[i];t[i]=r(a,s)}return t}},2887:function(e,n,t){var i,r=this&&this.__createBinding||(Object.create?function(e,n,t,i){void 0===i&&(i=t);var r=Object.getOwnPropertyDescriptor(n,t);r&&!("get"in r?!n.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return n[t]}}),Object.defineProperty(e,i,r)}:function(e,n,t,i){void 0===i&&(i=t),e[i]=n[t]}),a=this&&this.__setModuleDefault||(Object.create?function(e,n){Object.defineProperty(e,"default",{enumerable:!0,value:n})}:function(e,n){e.default=n}),s=this&&this.__importStar||(i=function(e){return i=Object.getOwnPropertyNames||function(e){var n=[];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[n.length]=t);return n},i(e)},function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t=i(e),s=0;s<t.length;s++)"default"!==t[s]&&r(n,e,t[s]);return a(n,e),n});Object.defineProperty(n,"__esModule",{value:!0}),n.HudFailedReadConfigError=n.hudConfig=n.HudDynamicConfigSchema=void 0,n.getModulesToTraceFromEnv=function(){const e=process.env.HUD_MONITOR_MODULES||process.env.HUD_INCLUDE_MODULES;if(e)return e.split(",")},n.getFrameworksToEnableFromEnv=function(){const e=process.env.HUD_ENABLE_FRAMEWORKS;let n;if(e)try{n=o.availableFrameworksSchema.parse(JSON.parse(e))}catch{n=new Map}return n},n.isValidParam=function(e){return null!=e&&""!==e&&"string"==typeof e},n.updateInvestigationRateLimitGlobals=function(){globalThis.hudMaxSameInvestigations=n.hudConfig.dynamicConfig.investigationRateLimits.maxSameInvestigations,globalThis.hudMaxTotalInvestigations=n.hudConfig.dynamicConfig.investigationRateLimits.maxTotalInvestigations,globalThis.hudSameInvestigationTimeWindowNs=BigInt(n.hudConfig.dynamicConfig.investigationRateLimits.sameInvestigationTimeWindowMs)*BigInt(1e6),globalThis.hudTotalInvestigationTimeWindowNs=BigInt(n.hudConfig.dynamicConfig.investigationRateLimits.totalInvestigationTimeWindowMs)*BigInt(1e6)},n.getConfigContent=function(){if(process.env.HUD_CONFIG)return{content:process.env.HUD_CONFIG,source:"HUD_CONFIG"};const e=function(){try{const e=process.env.HUD_CONFIG_PATH;if(e)return l.existsSync(e)?e:void 0;let n=__dirname,t=0;for(;"/"!==n&&t<10;){const e=`${n}/hud.config`;if(l.existsSync(e))return e;n=d.dirname(n),t++}}catch{return}}();if(e)try{return{content:l.readFileSync(e,"utf8"),source:e}}catch(n){throw new h(e,n.code)}};const o=t(8528),l=s(t(9896)),d=s(t(6928)),u=t(1569),c="globalThis._hudMark";n.HudDynamicConfigSchema=u.z.object({aggregationInterval:u.z.number(),aggregationFirstSendTimeout:u.z.number(),investigationInterval:u.z.number(),investigationFirstSendTimeout:u.z.number(),enableInvestigation:u.z.boolean(),enableInvestigationArgsSending:u.z.boolean(),investigationRateLimits:u.z.object({maxSameInvestigations:u.z.number().int().positive(),sameInvestigationTimeWindowMs:u.z.number().int().positive(),maxTotalInvestigations:u.z.number().int().positive(),totalInvestigationTimeWindowMs:u.z.number().int().positive(),maxUniqLogs:u.z.number().int().positive()}),machineMetricsInterval:u.z.number().int().positive(),blacklistParams:u.z.array(u.z.string()),forensicsBlacklistFields:u.z.array(u.z.string()),forensicsWhitelistFields:u.z.array(u.z.string()),censorshipRegexes:u.z.array(u.z.object({regex:u.z.string(),replacement:u.z.string()})),reingestInterval:u.z.number().int().positive(),extraHeaders:u.z.array(u.z.string())});const m=process.env.HUD_ENABLE_INVESTIGATION,g=process.env.HUD_HOST||"https://api-prod.hud.io",p=process.env.HUD_LOG_DIR,v="_HUD",f=process.env.HUD_LOG_TO_FILE,b={sink:{url:g,timeout:5e3,session_attr:"X-Session-ID"},endpoints:{init:"sink/init",send:"sink/send",batch:"sink/batch",logs:"sink/logs",sessionslessLogs:"sink/sessionless-logs",fatalError:"sink/redline",getMode:"sink/getMode",getRemoteConfig:"sink/remote-config/get",fileDeclarations:"sink/file-declarations",sourceMap:"sink/sourcemap",storeObject:"sink/objects/store",getUploadUrls:"sink/registry/get-upload-urls",triggerReingest:"sink/registry/reingest",validateToken:"sink/registry/validate",fileDeclarationsCi:"sink/registry/file-declarations",completed:"sink/registry/completed"},logger:{default:{levels:{app:"warning",worker:"warning",instrument:"warning"}},debug:{levels:{app:"debug",worker:"debug",instrument:"debug"}}},investigation:{objectVersion:"1.0.1",store:{type:"s3"},limits:{executionFlowMaxLength:100,exceptionMaxLength:100},maxStringLength:1024,maxArrayLength:100,maxObjectDepth:10},userConfig:{minPodMemoryMB:{value:250,source:"DEFAULT"},maxMappedFunctions:{value:5e4,source:"DEFAULT"},maxFileSizeBytes:{value:2831155,source:"DEFAULT"},maxTimeUntilInitSessionMs:{value:3e4,source:"DEFAULT"},includeModules:{value:[],source:"DEFAULT"},disableRuntimeInstrumentation:{value:!1,source:"DEFAULT"},disableParametersExtraction:{value:!1,source:"DEFAULT"}},loggerWorkerPortSizeLimit:1e4,customerLoggerLevel:"info",logDirectory:p,invocationSampling:new Map([[[300n,null],100],[[200n,300n],50],[[100n,200n],25],[[0n,100n],10]]),callerResetInterval:36e5,modeInterval:3e5,logsSendInterval:6e4,logPerfInterval:3e5,endpointsInterval:3e4,endpointsFirstSendWaitTime:12e4,lazyEndpointsInterval:18e5,staticNextJsEndpointsInterval:1e4,staticNextJsEndpointsMaxAttempts:12,huddBinWidth:1.2,workerGrace:6e4,workerTimeout:2e4,timeoutOnRegister:6e4,timeoutOnMetrics:6e4,workerMessageTimeout:1e4,communicationBatchSize:100,writePatched:!1,defaultOff:!0,disableOnBadApiKey:!0,disableOnBadServiceName:!0,cpuTimeCollection:!1,workloadMetadata:{sendInterval:3e5,aws:{imds:{baseURL:"http://169.254.169.254/latest",tokenURI:"/api/token",identityURI:"/dynamic/instance-identity/document",lifeCycleURI:"/meta-data/instance-life-cycle",requestTimeout:5e3},metadataFile:"/run/cloud-init/instance-data.json"},kubernetes:{namespaceFile:"/var/run/secrets/kubernetes.io/serviceaccount/namespace",uuidFile:"/sys/class/dmi/id/product_uuid",podMemoryLimitFile:"/sys/fs/cgroup/memory/memory.stat",podCPULimitFile:"/sys/fs/cgroup/cpuacct/cpu.shares"}},deleteLogsAfterSending:!0,supportSourceMap:!0,editInline:!0,bundlerBuildIdVarName:"hudFileBuildID",bundlerBuildUuidNamespace:"00c1e90b-af75-4d8e-9935-68485877f759",functionUuidNamespace:"94a210f3-861c-4e18-ab27-6b6c19437c9d",wrapVarPrefix:v,functionIdVarName:`${v}_fid`,frameworksToPatch:new Map([["express",{framework:o.availableFrameworks.express,enable:!0,version:"<=5",patcher:"express",enableEsbuild:!0}],[d.join("express","lib","application.js"),{framework:o.availableFrameworks.express,enable:!0,version:"<=5",patcher:"expressApplication",enableEsbuild:!0}],["router",{framework:o.availableFrameworks.express,enable:!0,version:"^2.0.0",patcher:"router",enableEsbuild:!0}],["koa",{framework:o.availableFrameworks.koa,enable:!0,version:"^2.0.0",patcher:"koa"}],["http",{framework:o.availableFrameworks.http,enable:!0,version:"*",patcher:"http"}],["https",{framework:o.availableFrameworks.https,enable:!0,version:"*",patcher:"http"}],["next/dist/server/base-server",{framework:o.availableFrameworks.nextjs,enable:!1,version:">=13.4.0",patcher:"nextjs"}],["next/dist/server/lib/module-loader/route-module-loader",{framework:o.availableFrameworks.nextjs,enable:!1,version:">=13.4.0",patcher:"nextJsModuleLoader"}],["next/dist/server/web/spec-extension/adapters/next-request",{framework:o.availableFrameworks.nextjs,enable:!1,version:">=13.4.0",patcher:"nextRequestAdapter"}],["next/dist/server/config",{framework:o.availableFrameworks.nextjs,enable:!1,version:">=13.4.0",patcher:"nextJsConfig"}],["@nestjs/core/router/router-execution-context",{framework:o.availableFrameworks.nestjs,enable:!0,version:"*",patcher:"nestjsRouterExecutionContext"}],["kafkajs",{framework:o.availableFrameworks.kafkajs,enable:"win32"!==process.platform,version:">=1.4.0",patcher:"kafkajs"}],["@confluentinc/kafka-javascript",{framework:o.availableFrameworks.confluentKafkaJs,enable:!1,version:">=1.4.0",patcher:"confluentKafkaJs"}],["@nestjs/microservices/context/rpc-context-creator",{framework:o.availableFrameworks.nestjs,enable:"win32"!==process.platform,version:">=7.0.0",patcher:"nestjsRpcContextCreator"}],[["@codegenie/serverless-express","src","frameworks","express.js"].join(d.sep),{framework:o.availableFrameworks.codegenieServerlessExpress,enable:!0,version:"^4.1.0",patcher:"codeGenieServerlessExpress",enableEsbuild:!0}],["@codegenie/serverless-express",{framework:o.availableFrameworks.codegenieServerlessExpress,enable:!0,enableEsbuild:!0}],["sqs-consumer",{framework:o.availableFrameworks.sqs,enable:!0,version:"*",patcher:"sqsConsumer",extraInfo:{mondayVersion:">=6.1.0",bbcVersion:">=7.5.0"}}],["serverless-http",{framework:o.availableFrameworks.serverlessHttp,enable:!0,enableEsbuild:!0}],[d.join("serverless-http","lib","framework","get-framework.js"),{framework:o.availableFrameworks.serverlessHttp,enable:!0,version:"^2.7.0",patcher:"serverlessHttp",enableEsbuild:!0}]]),communicationKeepalive:!1,communicationKeepaliveGrace:5e3,express:{routeNamesSymbol:Symbol.for("hudRoutes"),layerStateSymbol:Symbol.for("hudState"),markedSymbol:Symbol.for("hudMarked"),wrapAllCallbacks:!0},supportedNodeVersions:["18","20","21","22","24"],hudPatchedName:"hudPatched",metricSymbol:Symbol.for("hudMetric"),dynamicConfig:{aggregationInterval:3e5,aggregationFirstSendTimeout:3e4,investigationInterval:5e3,investigationFirstSendTimeout:3e4,enableInvestigation:"true"===m,enableInvestigationArgsSending:!0,investigationRateLimits:{maxSameInvestigations:2,sameInvestigationTimeWindowMs:36e5,maxTotalInvestigations:25,totalInvestigationTimeWindowMs:216e5,maxUniqLogs:2},machineMetricsInterval:1e4,reingestInterval:3e4,extraHeaders:[],blacklistParams:[],censorshipRegexes:[],forensicsBlacklistFields:[],forensicsWhitelistFields:[]},machineMetricsSavedLength:2,isInvestigationEnabledByEnv:void 0!==m,suppressTraces:!0,lambdaMinimunMemory:1024,lambdaBaseGivenTime:400,lambdaExtraGivenTimePerRequest:50,lambdaMaxGivenTime:700,throttleStatusCode:202,functionsToInstrument:[{moduleName:"pg",fileToFunctionsMapping:{[d.join(d.sep,"pg","lib","client.js")]:["query","connect","end"]}},{moduleName:"axios",fileToFunctionsMapping:{[d.join(d.sep,"axios","dist","node","axios.cjs")]:["request"]}},{moduleName:"typeorm",fileToFunctionsMapping:{[d.join(d.sep,"typeorm","repository","Repository.js")]:["hasId","getId","create","merge","preload","save","remove","softRemove","recover","insert","update","upsert","delete","softDelete","restore","exist","exists","existsBy","count","countBy","sum","average","minimum","maximum","find","findBy","findAndCount","findAndCountBy","findByIds","findOne","findOneBy","findOneById","findOneOrFail","findOneByOrFail","query","clear","increment","decrement","extend"]}}],esbuildGlobalVar:"hudSGV",esbuildPluginMessagePrefix:"ESBuild plugin ",esbuildMark:"/*modifiedByHudESBuildPlugin-",esbuildMarkLength:67,esbuildUploadSourceMapTimeout:15e3,esbuildPluginLogsChunkSize:100,esbuildPluginLogsBatchSize:10,pluginsLogEndpoint:"https://yqp37dddrsewm6wdwwpwfraxqm0shdmx.lambda-url.eu-central-1.on.aws/",fileless:"true"!==f,uninstrumentedFilesLogThreshold:2,tsNodeConfigTimeout:1e4,allowedEditExtensions:[".ts",".cts",".mts",".js",".cjs",".mjs"],nextJsMarkVarName:c,nextJsMarkStatement:`${c} = "a"`,timeoutOnNextJsPlugin:3e4,logIntervals:{instrumentedFilesCount:5e3,sentEventsCount:12e4},cliBuildIdVarName:"hudCliBuildId",cliSdkVersionVarName:"hudCliSdkVersion"};n.hudConfig=function(e={}){return{...b,...e}}({logger:{default:{levels:{app:"info",worker:"info",instrument:"info"}},debug:{levels:{app:"debug",worker:"debug",instrument:"debug"}}},deleteLogsAfterSending:!1,communicationKeepalive:!0}),n.default=n.hudConfig;class h extends Error{path;code;constructor(e,n){super(),this.path=e,this.code=n}}n.HudFailedReadConfigError=h},5453:(e,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.SDK_VERSION=void 0,n.SDK_VERSION="1.6.30"},6928:e=>{e.exports=require("path")},7089:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ObjectStoreConfigSchema=void 0;const i=t(1569),r=i.z.object({type:i.z.literal("s3")}),a=i.z.object({type:i.z.literal("disk"),path:i.z.string()});n.ObjectStoreConfigSchema=i.z.union([r,a])},8528:e=>{e.exports=require("./dto")},9896:e=>{e.exports=require("fs")}},n={};return function t(i){var r=n[i];if(void 0!==r)return r.exports;var a=n[i]={exports:{}};return e[i].call(a.exports,a,a.exports,t),a.exports}(2509)})());
2
2
  //# sourceMappingURL=config.js.map
package/dist/cjs/dto.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o=t();for(var r in o)("object"==typeof exports?exports:e)[r]=o[r]}}(global,()=>(()=>{"use strict";var e={765:(e,t)=>{var o,r;Object.defineProperty(t,"__esModule",{value:!0}),t.HudSessionInitStatus=t.HudRunningMode=t.KeepAliveMessage=void 0,t.KeepAliveMessage={msg:"keep-alive"},function(e){e[e.detached=0]="detached",e[e.disabled=1]="disabled",e[e.enabled=2]="enabled"}(o||(t.HudRunningMode=o={})),function(e){e[e.success=0]="success",e[e.throttled=1]="throttled"}(r||(t.HudSessionInitStatus=r={}))},878:(e,t)=>{var o;Object.defineProperty(t,"__esModule",{value:!0}),t.GraphQLSupportedOperations=void 0,function(e){e.query="query",e.mutation="mutation"}(o||(t.GraphQLSupportedOperations=o={}))},1569:e=>{e.exports=require("zod")},2176:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},3487:function(e,t,o){var r=this&&this.__createBinding||(Object.create?function(e,t,o,r){void 0===r&&(r=o);var n=Object.getOwnPropertyDescriptor(t,o);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,r,n)}:function(e,t,o,r){void 0===r&&(r=o),e[r]=t[o]}),n=this&&this.__exportStar||function(e,t){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(t,o)||r(t,e,o)};Object.defineProperty(t,"__esModule",{value:!0}),n(o(7789),t),n(o(7935),t),n(o(6910),t),n(o(2176),t),n(o(9107),t),n(o(7022),t),n(o(6604),t),n(o(4909),t),n(o(878),t),n(o(8377),t),n(o(8054),t),n(o(6328),t),n(o(6413),t),n(o(6364),t),n(o(765),t)},4909:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},6328:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},6364:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.HudSessionOptionsSchema=t.HudOptionsSchema=void 0;const r=o(1569),n=o(7789);t.HudOptionsSchema=r.z.object({includeModules:r.z.array(r.z.string()).optional(),enableFrameworks:n.availableFrameworksSchema.optional(),maxMappedFunctions:r.z.number().optional(),minPodMemoryMB:r.z.number().optional(),maxFileSizeBytes:r.z.number().optional(),maxTimeUntilInitSessionMs:r.z.number().optional(),verbose:r.z.boolean().optional(),disableSourceMapsResolution:r.z.boolean().optional(),disableRuntimeInstrumentation:r.z.boolean().optional(),customOptions:r.z.record(r.z.string(),r.z.string()).optional()}),t.HudSessionOptionsSchema=r.z.object({tags:r.z.record(r.z.string(),r.z.string()).optional()})},6413:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},6604:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},6910:(e,t)=>{var o,r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.EntityType=t.ArgumentTypes=t.ParameterTypes=void 0,function(e){e.Identifier="Identifier",e.RestElement="RestElement",e.ArrayPattern="ArrayPattern",e.AssignmentPattern="AssignmentPattern",e.ObjectPattern="ObjectPattern",e.ObjectProperty="ObjectProperty"}(o||(t.ParameterTypes=o={})),function(e){e.StringLiteral="StringLiteral",e.Identifier="Identifier",e.TemplateString="TemplateString"}(r||(t.ArgumentTypes=r={})),function(e){e.FunctionDeclaration="functionDeclaration",e.FunctionExpression="functionExpression",e.FunctionArrow="functionArrow",e.ClassMethod="classMethod",e.ObjectMethod="objectMethod",e.ClassPrivateMethod="classPrivateMethod",e.ClassDeclaration="classDeclaration",e.ClassExpression="classExpression",e.ObjectExpression="objectExpression",e.Program="program",e.ForLoop="forLoop",e.ForBlock="forBlock",e.ForTest="forTest",e.Block="block",e.While="while",e.DoWhile="doWhile",e.Do="Do",e.WhileTest="whileTest",e.Switch="switch",e.SwitchCase="switchCase",e.Catch="catch",e.With="with",e.If="if",e.IfTest="ifTest",e.IfConsequent="ifConsequent",e.IfAlternate="ifAlternate",e.TryCatch="tryCatch",e.Try="try",e.Finally="finally",e.Other="other",e.File="file"}(n||(t.EntityType=n={}))},7022:(e,t)=>{var o;Object.defineProperty(t,"__esModule",{value:!0}),t.Format=t.FUNCTION_DECLARATION_VERSION=void 0,t.isSupportedFormat=function(e){return Object.values(o).includes(e)},t.FUNCTION_DECLARATION_VERSION="1.1.3",function(e){e.cjs="commonjs",e.esm="module",e.moduleTypescript="module-typescript",e.commonjsTypescript="commonjs-typescript"}(o||(t.Format=o={}))},7789:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.availableFrameworksSchema=t.availableFrameworks=void 0;const r=o(1569);t.availableFrameworks={express:"express",koa:"koa",http:"http",https:"https",nextjs:"nextjs",nestjs:"nestjs",kafkajs:"kafkajs",codegenieServerlessExpress:"codegenieServerlessExpress",sqs:"sqs",serverlessHttp:"serverlessHttp"},t.availableFrameworksSchema=r.z.union([r.z.map(r.z.nativeEnum(t.availableFrameworks),r.z.boolean()),r.z.record(r.z.nativeEnum(t.availableFrameworks),r.z.boolean())]).transform(e=>e instanceof Map?e:new Map(Object.entries(e)))},7935:(e,t)=>{function o(e,t){return t?t instanceof RegExp?e+t.toString():("/"===t[t.length-1]&&t.length>1&&(t=t.slice(0,-1)),(t=e+t).replace(/\/{2,}/g,"/")):t}Object.defineProperty(t,"__esModule",{value:!0}),t.EndpointDeclaration=void 0,t.EndpointDeclaration=class{flow_id;methods;framework;partial_path;path;constructor(e,t,r,n,i,s){this.flow_id=e,this.methods=t,this.framework=r,this.partial_path=s,n||(n=""),this.path=o(n,i),this.partial_path=o(n,s)}}},8054:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},8377:(e,t)=>{var o;Object.defineProperty(t,"__esModule",{value:!0}),t.InvestigationStatus=void 0,function(e){e[e.Open=1]="Open",e[e.Closed=2]="Closed"}(o||(t.InvestigationStatus=o={}))},9107:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})}},t={};return function o(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,o),i.exports}(3487)})());
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o=t();for(var r in o)("object"==typeof exports?exports:e)[r]=o[r]}}(global,()=>(()=>{"use strict";var e={765:(e,t)=>{var o,r;Object.defineProperty(t,"__esModule",{value:!0}),t.HudSessionInitStatus=t.HudRunningMode=t.KeepAliveMessage=void 0,t.KeepAliveMessage={msg:"keep-alive"},function(e){e[e.detached=0]="detached",e[e.disabled=1]="disabled",e[e.enabled=2]="enabled"}(o||(t.HudRunningMode=o={})),function(e){e[e.success=0]="success",e[e.throttled=1]="throttled"}(r||(t.HudSessionInitStatus=r={}))},878:(e,t)=>{var o;Object.defineProperty(t,"__esModule",{value:!0}),t.GraphQLSupportedOperations=void 0,function(e){e.query="query",e.mutation="mutation"}(o||(t.GraphQLSupportedOperations=o={}))},1569:e=>{e.exports=require("zod")},2176:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},3487:function(e,t,o){var r=this&&this.__createBinding||(Object.create?function(e,t,o,r){void 0===r&&(r=o);var n=Object.getOwnPropertyDescriptor(t,o);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,r,n)}:function(e,t,o,r){void 0===r&&(r=o),e[r]=t[o]}),n=this&&this.__exportStar||function(e,t){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(t,o)||r(t,e,o)};Object.defineProperty(t,"__esModule",{value:!0}),n(o(7789),t),n(o(7935),t),n(o(6910),t),n(o(2176),t),n(o(9107),t),n(o(7022),t),n(o(6604),t),n(o(4909),t),n(o(878),t),n(o(8377),t),n(o(8054),t),n(o(6328),t),n(o(6413),t),n(o(6364),t),n(o(765),t)},4909:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},6328:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},6364:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.HudSessionOptionsSchema=t.HudOptionsSchema=void 0;const r=o(1569),n=o(7789);t.HudOptionsSchema=r.z.object({includeModules:r.z.array(r.z.string()).optional(),enableFrameworks:n.availableFrameworksSchema.optional(),maxMappedFunctions:r.z.number().optional(),minPodMemoryMB:r.z.number().optional(),maxFileSizeBytes:r.z.number().optional(),maxTimeUntilInitSessionMs:r.z.number().optional(),verbose:r.z.boolean().optional(),disableSourceMapsResolution:r.z.boolean().optional(),disableRuntimeInstrumentation:r.z.boolean().optional(),disableParametersExtraction:r.z.boolean().optional(),customOptions:r.z.record(r.z.string(),r.z.string()).optional()}),t.HudSessionOptionsSchema=r.z.object({tags:r.z.record(r.z.string(),r.z.string()).optional()})},6413:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},6604:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},6910:(e,t)=>{var o,r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.EntityType=t.ArgumentTypes=t.ParameterTypes=void 0,function(e){e.Identifier="Identifier",e.RestElement="RestElement",e.ArrayPattern="ArrayPattern",e.AssignmentPattern="AssignmentPattern",e.ObjectPattern="ObjectPattern",e.ObjectProperty="ObjectProperty"}(o||(t.ParameterTypes=o={})),function(e){e.StringLiteral="StringLiteral",e.Identifier="Identifier",e.TemplateString="TemplateString"}(r||(t.ArgumentTypes=r={})),function(e){e.FunctionDeclaration="functionDeclaration",e.FunctionExpression="functionExpression",e.FunctionArrow="functionArrow",e.ClassMethod="classMethod",e.ObjectMethod="objectMethod",e.ClassPrivateMethod="classPrivateMethod",e.ClassDeclaration="classDeclaration",e.ClassExpression="classExpression",e.ObjectExpression="objectExpression",e.Program="program",e.ForLoop="forLoop",e.ForBlock="forBlock",e.ForTest="forTest",e.Block="block",e.While="while",e.DoWhile="doWhile",e.Do="Do",e.WhileTest="whileTest",e.Switch="switch",e.SwitchCase="switchCase",e.Catch="catch",e.With="with",e.If="if",e.IfTest="ifTest",e.IfConsequent="ifConsequent",e.IfAlternate="ifAlternate",e.TryCatch="tryCatch",e.Try="try",e.Finally="finally",e.Other="other",e.File="file"}(n||(t.EntityType=n={}))},7022:(e,t)=>{var o;Object.defineProperty(t,"__esModule",{value:!0}),t.Format=t.FUNCTION_DECLARATION_VERSION=void 0,t.isSupportedFormat=function(e){return Object.values(o).includes(e)},t.FUNCTION_DECLARATION_VERSION="1.1.3",function(e){e.cjs="commonjs",e.esm="module",e.moduleTypescript="module-typescript",e.commonjsTypescript="commonjs-typescript"}(o||(t.Format=o={}))},7789:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.availableFrameworksSchema=t.availableFrameworks=void 0;const r=o(1569);t.availableFrameworks={express:"express",koa:"koa",http:"http",https:"https",nextjs:"nextjs",nestjs:"nestjs",kafkajs:"kafkajs",confluentKafkaJs:"confluentKafkaJs",codegenieServerlessExpress:"codegenieServerlessExpress",sqs:"sqs",serverlessHttp:"serverlessHttp"},t.availableFrameworksSchema=r.z.union([r.z.map(r.z.nativeEnum(t.availableFrameworks),r.z.boolean()),r.z.record(r.z.nativeEnum(t.availableFrameworks),r.z.boolean())]).transform(e=>e instanceof Map?e:new Map(Object.entries(e)))},7935:(e,t)=>{function o(e,t){return t?t instanceof RegExp?e+t.toString():("/"===t[t.length-1]&&t.length>1&&(t=t.slice(0,-1)),(t=e+t).replace(/\/{2,}/g,"/")):t}Object.defineProperty(t,"__esModule",{value:!0}),t.EndpointDeclaration=void 0,t.EndpointDeclaration=class{flow_id;methods;framework;partial_path;path;constructor(e,t,r,n,a,i){this.flow_id=e,this.methods=t,this.framework=r,this.partial_path=i,n||(n=""),this.path=o(n,a),this.partial_path=o(n,i)}}},8054:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},8377:(e,t)=>{var o;Object.defineProperty(t,"__esModule",{value:!0}),t.InvestigationStatus=void 0,function(e){e[e.Open=1]="Open",e[e.Closed=2]="Closed"}(o||(t.InvestigationStatus=o={}))},9107:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})}},t={};return function o(r){var n=t[r];if(void 0!==n)return n.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,o),a.exports}(3487)})());
2
2
  //# sourceMappingURL=dto.js.map
@@ -1,2 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o=t();for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(global,()=>(()=>{"use strict";var e={290:e=>{e.exports=require("async_hooks")},395:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addReingestValue=function(e){o.add(e)},t.getAndClearReingestValues=function(){const e=new Set;for(const t of o)n.has(t)||e.add(t);for(const t of e)n.add(t);return o=new Set,e};let o=new Set;const n=new Set},523:e=>{e.exports=require("./logger")},754:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.storeEndpointDeclaration=function(e){o.push(e)},t.getEndpointDeclarationsFromStorage=function(){const e=o;return o=[],e};let o=[]},820:function(e,t,o){var n=this&&this.__createBinding||(Object.create?function(e,t,o,n){void 0===n&&(n=o);var r=Object.getOwnPropertyDescriptor(t,o);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,n,r)}:function(e,t,o,n){void 0===n&&(n=o),e[n]=t[o]}),r=this&&this.__exportStar||function(e,t){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(t,o)||n(t,e,o)};Object.defineProperty(t,"__esModule",{value:!0}),r(o(7764),t),r(o(4583),t),r(o(2314),t),r(o(1321),t),r(o(3764),t),r(o(2207),t),r(o(8714),t),r(o(4988),t),r(o(2525),t),r(o(3973),t),r(o(1757),t),r(o(1364),t),r(o(7398),t),r(o(8708),t),r(o(395),t)},1321:function(e,t,o){var n,r=this&&this.__createBinding||(Object.create?function(e,t,o,n){void 0===n&&(n=o);var r=Object.getOwnPropertyDescriptor(t,o);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,n,r)}:function(e,t,o,n){void 0===n&&(n=o),e[n]=t[o]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[t.length]=o);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o=n(e),a=0;a<o.length;a++)"default"!==o[a]&&r(t,e,o[a]);return i(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.GraphQLDocumentMetadata=void 0,t.getDocumentsMetadata=function(){const e=u;return u=[],e};const s=a(o(6982));let u=[];t.GraphQLDocumentMetadata=class{name;timeTook;hash;selectionNames;constructor(e,t){this.name=e.definitions[0]?.name?.value,this.hash=s.createHash("sha256").update(e.loc?.source?.body).digest("hex"),this.selectionNames=e.definitions.flatMap(e=>e.selectionSet.selections.map(e=>e.name.value)),this.timeTook=t}save(){u.push(this)}}},1364:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.initGlobals=function(){globalThis.hudGlobalInitGuard||(globalThis.hudGlobalInitGuard=!0,globalThis.hudRunMutex=!1,globalThis.hudRanOnRequire=!1,globalThis.hudRanOnImport=!1,globalThis.hudInitGuard=void 0,globalThis.hudInstrumentationIndicator=void 0,globalThis.hudMetricsIndicator=void 0,globalThis.hudInstrumentationOccured=!1,globalThis.hudNextJsPluginIndicator=void 0,globalThis.hudStartTime=new Date,globalThis.hudCalls={},globalThis.hudRunningMode=r.HudRunningMode.enabled,globalThis.hudExecutionFlowMaxLength=n.hudConfig.investigation.limits.executionFlowMaxLength,globalThis.hudExceptionMaxLength=n.hudConfig.investigation.limits.exceptionMaxLength,globalThis.hudEnableInvestigation=n.hudConfig.dynamicConfig.enableInvestigation,(0,s.setInvestigationStorage)(new u.AsyncLocalStorage),(0,s.setFlowStateStorage)(new u.AsyncLocalStorage),function(){globalThis.hudSampleTable=[];const e=[[10,1],[30,2],[100,3],[500,11],[1e3,23],[5e3,53]];let t=0;for(const[o,n]of e){for(let e=t;e<o;e++)globalThis.hudSampleTable.push(e%n===0);t=o}}(),l())},t.resetGlobals=l,t.hookMessageChannel=function(){const{port1:e,port2:t}=new c.MessageChannel;return e.on("message",e=>{"HudModulePatch"===e.key?(globalThis.hudPatched.add(e.hudPatched),globalThis.hudProcessedFiles.push(e.hudProcessedFiles)):"HudRetrieveFileCache"===e.key&&globalThis.HudSourceMapCache.set(e.filename,e.content)}),e.unref(),globalThis.hudHookPort=e,t},t.clearInitGuard=d,t.clearMetricsIndicator=h,t.clearInstrumentationIndicator=g,t.clearUserIndicatorsTimeouts=function(){d(),h(),g()},t.detachHud=f,t.forceHudEnable=function(){globalThis.forceHudEnable=!0},t.saveHudRunningFromSetup=function(){globalThis.hudIsRunningFromSetup=!0},t.saveInstrumentationIndicator=function(e){globalThis.hudInstrumentationIndicator=e,globalThis.hudInstrumentationIndicator.unref()},t.validateAndGetUserInput=function(){return n.hudConfig.userConfig.key||n.hudConfig.userConfig.service?n.hudConfig.userConfig.key?(0,n.isValidParam)(n.hudConfig.userConfig.key.value)?n.hudConfig.userConfig.service?(0,n.isValidParam)(n.hudConfig.userConfig.service.value)?{apiKey:n.hudConfig.userConfig.key.value,service:n.hudConfig.userConfig.service.value}:(a.app_logger.critical("Service name is invalid - SDK cannot initialize",{source:n.hudConfig.userConfig.service.source}),n.hudConfig.disableOnBadServiceName&&f(!1),void a.customer_logger.log(i.UserErrorLogs.HudServiceInvalid(n.hudConfig.userConfig.service.source))):(a.app_logger.critical("Service name is missing - SDK cannot initialize"),n.hudConfig.disableOnBadServiceName&&f(!1),void a.customer_logger.log(i.UserErrorLogs.HudServiceNotSet(globalThis.hudStartFromAutoInit))):(a.app_logger.critical("API key is invalid - SDK cannot initialize",{source:n.hudConfig.userConfig.key.source}),n.hudConfig.disableOnBadApiKey&&f(!1),void a.customer_logger.log(i.UserErrorLogs.HudApiKeyInvalid(n.hudConfig.userConfig.key.source))):(a.app_logger.critical("API key is missing - SDK cannot initialize"),n.hudConfig.disableOnBadApiKey&&f(!1),void a.customer_logger.log(i.UserErrorLogs.HudApiKeyNotSet(globalThis.hudStartFromAutoInit))):(a.app_logger.critical("Both API key and service name are missing - SDK cannot initialize"),(n.hudConfig.disableOnBadApiKey||n.hudConfig.disableOnBadServiceName)&&f(!1),void a.customer_logger.log(i.UserErrorLogs.BothApiKeyAndServiceNotSet(globalThis.hudStartFromAutoInit)))};const n=o(5809),r=o(8528),i=o(2546),a=o(523),s=o(7131),u=o(290),c=o(8167);function l(){globalThis.hudProcessedFiles=[],globalThis._hud_S=new Array(1e3).fill(""),globalThis._hud_SI={value:0},globalThis.hudLoadedModules=[],globalThis.hudPatched=new Set,globalThis.HudSourceMapCache=new Map,globalThis.hudExpressState=[]}function d(){clearTimeout(globalThis.hudInitGuard),globalThis.hudInitGuard=void 0}function h(){clearTimeout(globalThis.hudMetricsIndicator),globalThis.hudMetricsIndicator=void 0}function g(){clearTimeout(globalThis.hudInstrumentationIndicator),globalThis.hudInstrumentationIndicator=void 0,globalThis.hudInstrumentationOccured=!0}function f(e=!0,t=!1){if(a.app_logger.warning("Detaching hud"),t||e&&hudRunningMode!==r.HudRunningMode.detached){const e=(0,i.getFirstError)();a.customer_logger.log(i.UserErrorLogs.ShutdownGracefully(e))}globalThis.hudRunningMode=r.HudRunningMode.detached}},1757:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.markForLogFlushing=function(){a=!0},t.storeCredentials=function(e,t){r=e,i=t},t.storeSessionInfo=function(e){s=e},t.flushLogs=u,t.tryFlushPendingLogs=async function(e,t){a&&(a=!1,await u(e,t))};const n=o(523);let r,i,a=!1,s=null;async function u(e,t){try{const a=e||r;if(!a||"string"!=typeof a)return;const u=t||i||"unknown",c=(0,n.getSavedLogs)();for(const e of c){const{HudClient:t}=o(4672),r=new t;s?(n.app_logger.info("Flushing logs with session",{size:e.length,sessionId:s.sessionId,service:u}),r.setSession(s),await r.logs(e)):(n.app_logger.info("Flushing logs (sessionless)",{size:e.length,service:u}),await r.sessionslessLogs(e,a)),n.app_logger.info("Successfully flushed logs")}}catch(e){try{n.app_logger.error("Failed to flush logs",{msg:e instanceof Error?e.message:void 0,hasSession:null!==s})}catch{}}}},2207:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.storeResolverIdBySelectionName=function(e,t){o.set(t,e)},t.getResolverIdBySelectionName=function(e){return o.get(e)};const o=new Map},2314:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fullEndpointFlowIdMap=void 0,t.getLinkedConsistentFlowId=u,t.getFlowIdFromMappings=c,t.linkTemporaryToConsistenFlowId=l,t.clearFlowIdMappings=function(){t.fullEndpointFlowIdMap.clear(),s.clear()},t.swapTempToConstFlowId=function(e){e.forEach(e=>{"express"===e.framework&&(e.flow_id=u(e.flow_id,!0)??e.flow_id)})};const n=o(2546),r=o(523),i=o(7930),a=o(8590);t.fullEndpointFlowIdMap=new Map;const s=new Map;function u(e,t){let o=c(e,!1);return o?o.flowId:(l(t),o=c(e,!0),o?(o.isPartial&&!t&&r.app_logger.warning("Found partial endpoint for flow id even though partial aren't allowd",{flowId:e,consistentFlowId:o.flowId}),o.flowId):void 0)}function c(e,o){let n=t.fullEndpointFlowIdMap.get(e);return n?{flowId:n,isPartial:!1}:o?(n=s.get(e),n?{flowId:n,isPartial:!0}:void 0):void 0}function l(e){const o=[];globalThis.hudExpressState.forEach(e=>{try{o.push(...(0,i.extractEndpointsFromRouter)("",e))}catch(e){r.app_logger.error("Failed to extract endpoints from express",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}),o.forEach(e=>{if(e.partial_path)return;const o=e.flow_id;let r=t.fullEndpointFlowIdMap.get(o);r||(r=(0,n.generateEndpointFlowId)(e.path,e.methods),t.fullEndpointFlowIdMap.set(o,r))}),(0,a.getPartialEndpointDeclarationsFromStorage)().forEach(o=>{const r=o.flow_id;let i=t.fullEndpointFlowIdMap.get(r);i||(i=s.get(r),i||(i=(0,n.generateEndpointFlowId)(o.partial_path,o.methods),e?s.set(r,i):t.fullEndpointFlowIdMap.set(r,i)))})}},2525:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSqsQueues=function(){const e=o;return o=[],e},t.storeSqsQueueDeclaration=function(e){o.push(e)};let o=[]},2546:e=>{e.exports=require("./lib")},2987:e=>{e.exports=require("perf_hooks")},3764:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getResolversDeclarations=function(){const e=o;return o=[],e},t.storeResolverDeclaration=function(e){o.push(e)};let o=[]},3973:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getFlowMetrics=function(e){const t=(new Date).toISOString(),o={};for(const n in s){const i=[];let a;for(const o in s[n]){const r=s[n][o];a||(a=r.getEventVersion()),i.push(r.finalize(u,t,e))}delete s[n],a?o[n]={eventVersion:a,metrics:i}:r.app_logger.error("No event version found for metric type",n)}return o},t.storeFlowMetric=function(e){const t=function(e){if(void 0!==e.flow_id)switch(e.type){case"EndpointMetric":{const t=e;return`${e.flow_id}|${t.route}|${t.method}|${t.status_code}`}case"KafkaJSMetric":{const t=e;return`${e.flow_id}|${t.partition}|${t.error}`}default:return e.flow_id}}(e);if(!t)return;s[e.type]||(s[e.type]={});const o=s[e.type][t];if(o)o.update(e,u);else{const o=a.MetricFactory.createMetric(e,u);s[e.type][t]=o}};const n=o(5809),r=o(523),i=o(7131),a=o(7859),s={},u=new i.SketchManager(n.hudConfig.huddBinWidth)},4583:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getExpressEndpointDeclarations=function(){let e=[];globalThis.hudExpressState.forEach(t=>{try{e=e.concat((0,i.extractEndpointsFromRouter)("",t))}catch(e){n.app_logger.error("Failed to extract endpoints from express",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}),e=e.concat((0,a.getRouterlessEndpointDeclarationsFromStorage)());const t=new Set;e.forEach(e=>{e.partial_path||t.add(e.flow_id)});const o=e.filter(e=>!e.partial_path||!t.has(e.flow_id)&&(n.app_logger.info("Partial endpoint without full endpoint",{endpoint:e}),!0));return(0,r.swapTempToConstFlowId)(o),o};const n=o(523),r=o(2314),i=o(7930),a=o(8590)},4672:e=>{e.exports=require("./client")},4988:function(e,t,o){var n,r=this&&this.__createBinding||(Object.create?function(e,t,o,n){void 0===n&&(n=o);var r=Object.getOwnPropertyDescriptor(t,o);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,n,r)}:function(e,t,o,n){void 0===n&&(n=o),e[n]=t[o]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[t.length]=o);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o=n(e),a=0;a<o.length;a++)"default"!==o[a]&&r(t,e,o[a]);return i(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.pageManifest=t.apiManifest=void 0,t.setNextConfig=function(e){h=e,g=!0},t.getNextConfig=function(){return h},t.isNextConfigExtracted=function(){return g},t.extractNextEndpointDeclarations=async function(e){const o=[];if(!e)return o;l.worker_logger.info("Extracting next.js endpoint declarations in worker");const n=e.distDir,r=s.join(n,t.apiManifest),i=await(0,c.readFile)(r);if(i){const e=JSON.parse(i),t=await async function(e,t){const o=[];for(const n of Object.keys(t))if(n.endsWith("/route")){const r=s.join(e,"server",t[n]),i=await f(r),a=m(n,"/route");for(const e of i){const t=(0,c.generateEndpointFlowId)(a,[e]);o.push(new u.EndpointDeclaration(t,[e],"nextjs","",a))}}else if(n.endsWith("/page")){const e=["GET"],t=m(n,"/page"),r=(0,c.generateEndpointFlowId)(t,e);o.push(new u.EndpointDeclaration(r,e,"nextjs","",t))}else l.worker_logger.warning("Unknown Next.js manifest key type",{key:n});return o}(n,e);o.push(...t)}const a=s.join(n,t.pageManifest),h=await(0,c.readFile)(a);if(h){const e=JSON.parse(h),t=await async function(e,t){const o=[];for(const n of Object.keys(t))if(n.startsWith("/api/")){const r=s.join(e,"server",t[n]),i=await f(r),a=await p(r);for(const e of i){const t=(0,c.generateEndpointFlowId)(n,[e]);o.push(new u.EndpointDeclaration(t,[e],"nextjs","",n))}if(a){const e=d.filter(e=>!i.includes(e)),t=(0,c.generateEndpointFlowId)(n,e);o.push(new u.EndpointDeclaration(t,e,"nextjs","",n))}}else{const e=["GET"],t=(0,c.generateEndpointFlowId)(n,e);o.push(new u.EndpointDeclaration(t,e,"nextjs","",n))}return o}(n,e);o.push(...t)}return o};const s=a(o(6928)),u=o(8528),c=o(2546),l=o(523),d=["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD"];let h;t.apiManifest="server/app-paths-manifest.json",t.pageManifest="server/pages-manifest.json";let g=!1;async function f(e){const t=await(0,c.readFile)(e);if(!t)return[];const o=new RegExp(`\\b(${d.join("|")})\\b`,"g"),n=t.matchAll(o),r=Array.from(n,e=>e[1]);return Array.from(new Set(r))}async function p(e){const t=await(0,c.readFile)(e);return!!t&&null!==t.match(/\bdefault\b/g)}function m(e,t){return e.length===t.length?"/":e.length>t.length?e.slice(0,0-t.length):e}},5809:e=>{e.exports=require("./config")},6928:e=>{e.exports=require("path")},6982:e=>{e.exports=require("crypto")},7131:e=>{e.exports=require("./wrap")},7398:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.globalInvestigationTracking=void 0,t.getClosedInvestigations=function(){const e=i;return i=[],e},t.storeClosedInvestigation=function(e){i.push(e)},t.setGlobalInvestigationTracking=function(e){t.globalInvestigationTracking=e},t.increaseGlobalInvestigationTracking=function(){t.globalInvestigationTracking++},t.increaseInvestigationDedupingCache=function(e,t){const o=a.get(e)??new Map,n=(o.get(t)??0)+1;o.set(t,n),a.set(e,o)},t.resetInvestigationDedupingCache=function(){a.clear()},t.getInvestigationDedupingCache=function(e){return a.get(e)??new Map},t.saveMachineMetric=function(){const e=process.cpuUsage(),t=r.performance.eventLoopUtilization();s.push({cpuUsage:e,elu:t,timestamp:Date.now()}),s.length>n.hudConfig.machineMetricsSavedLength&&s.shift()},t.getLastMetrics=function(){return s[0]};const n=o(5809),r=o(2987);let i=[];t.globalInvestigationTracking=0;const a=new Map,s=[]},7764:function(e,t,o){var n=this&&this.__createBinding||(Object.create?function(e,t,o,n){void 0===n&&(n=o);var r=Object.getOwnPropertyDescriptor(t,o);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,n,r)}:function(e,t,o,n){void 0===n&&(n=o),e[n]=t[o]}),r=this&&this.__exportStar||function(e,t){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(t,o)||n(t,e,o)};Object.defineProperty(t,"__esModule",{value:!0}),r(o(754),t),r(o(8714),t),r(o(4988),t),r(o(1321),t),r(o(3764),t),r(o(2207),t),r(o(4583),t),r(o(8590),t)},7859:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MetricFactory=t.BaseMetric=void 0;class o{}class n extends o{flowId;count;sumDuration;sumSquaredDuration;sketchBuilder;errorBreakdown;constructor(e,t){super(),this.flowId=e.flow_id,this.count=1,this.sumDuration=e.duration,this.sumSquaredDuration=e.duration**2,this.sketchBuilder=t.newSketchDataWithValue(e.duration),this.errorBreakdown=new Map,e.error_breakdown&&this.updateErrorBreakdown(e.error_breakdown)}getEventVersion(){return"1.0.0"}updateErrorBreakdown(e){let t=this.errorBreakdown.get(e.key);void 0===t&&(t={errors:e.errors,count:0,caught:e.caught,key:e.key},this.errorBreakdown.set(e.key,t)),t.count+=1}update(e,t){this.sumDuration+=e.duration,this.sumSquaredDuration+=e.duration**2,this.count+=1,t.add(this.sketchBuilder,e.duration),void 0!==e.error_breakdown&&this.updateErrorBreakdown(e.error_breakdown)}finalize(e,t,o){return{flow_id:this.flowId,count:this.count,sum_duration:this.sumDuration,sum_squared_duration:this.sumSquaredDuration,timestamp:t,timeslice:o,sketch:e.encode(this.sketchBuilder),error_breakdown:Array.from(this.errorBreakdown.values()).map(e=>({errors:e.errors,count:e.count,caught:e.caught}))}}}t.BaseMetric=n;class r{static registry={};static registerMetric(e,t){r.registry[e]=t}static createMetric(e,t){const o=r.registry[e.type];if(!o)throw new Error(`Unknown metric type: ${e.type}`);return new o(e,t)}}t.MetricFactory=r,r.registerMetric("EndpointMetric",class extends n{method;statusCode;constructor(e,t){super(e,t),this.method=e.method,this.statusCode=e.status_code}getEventVersion(){return"1.0.2"}finalize(e,t,o){return{...super.finalize(e,t,o),method:this.method,status_code:this.statusCode}}}),r.registerMetric("GraphQLMetric",class extends n{constructor(e,t){super(e,t)}}),r.registerMetric("KafkaJSMetric",class extends n{partition;error;ConsumeSketchBuilder;sumConsumedDuration;sumSquaredConsumedDuration;constructor(e,t){super(e,t),this.partition=e.partition,this.error=e.error,e.total_consume_duration&&(this.ConsumeSketchBuilder=t.newSketchDataWithValue(e.total_consume_duration)),this.sumConsumedDuration=e.total_consume_duration??0,this.sumSquaredConsumedDuration=(e.total_consume_duration??0)**2}update(e,t){super.update(e,t),e.total_consume_duration&&(this.sumConsumedDuration+=e.total_consume_duration,this.sumSquaredConsumedDuration+=e.total_consume_duration**2,this.ConsumeSketchBuilder?t.add(this.ConsumeSketchBuilder,e.total_consume_duration):this.ConsumeSketchBuilder=t.newSketchDataWithValue(e.total_consume_duration))}finalize(e,t,o){return{...super.finalize(e,t,o),partition:this.partition,error:this.error,sum_consumed_duration:this.sumConsumedDuration,sum_squared_consumed_duration:this.sumSquaredConsumedDuration,sketch_consume:e.encode(this.ConsumeSketchBuilder)}}}),r.registerMetric("SqsMetric",class extends n{msgCount;errors;e2eData;constructor(e,t){super(e,t),this.msgCount=e.msg_count,this.errors=e.errors,e.e2e_duration&&(this.e2eData={duration:e.e2e_duration,squaredDuration:e.e2e_duration**2,sketchBuilder:t.newSketchDataWithValue(e.e2e_duration)})}update(e,t){super.update(e,t),this.msgCount&&e.msg_count&&(this.msgCount+=e.msg_count),e.errors.forEach((e,t)=>{this.errors.set(t,(this.errors.get(t)??0)+e)}),this.e2eData&&e.e2e_duration&&(this.e2eData.duration+=e.e2e_duration,this.e2eData.squaredDuration+=e.e2e_duration**2,t.add(this.e2eData.sketchBuilder,e.e2e_duration))}getEventVersion(){return"1.0.2"}finalize(e,t,o){return{...super.finalize(e,t,o),errors:Object.fromEntries(this.errors),msg_count:this.msgCount,...this.e2eData?{e2e_sum_duration:this.e2eData.duration,e2e_sum_squared_duration:this.e2eData.squaredDuration,e2e_sketch:e.encode(this.e2eData.sketchBuilder)}:{}}}})},7930:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extractEndpointsFromRouter=function e(t,o){let r=[];const u="true"===process.env.HUD_LOG_EXPRESS;if(!o.stack)return i.app_logger.error("Router without stack - bad OTEL version",{router:o}),r;for(const c of o.stack)if("router"===c.name){if(!c[n.hudConfig.express.routeNamesSymbol]){i.app_logger.error("Router layer without routes",{layer:c});continue}const o=t+c[n.hudConfig.express.routeNamesSymbol];r=r.concat(e(o,c.handle))}else c.route&&c.route[n.hudConfig.express.layerStateSymbol]?r=r.concat(a(c,t)):u&&!s.has(c.name)&&(s.add(c.name),i.app_logger.warning("Found unknown layer name when extracting endpoints",{layer:c.name}));return r};const n=o(5809),r=o(8528),i=o(523);function a(e,t){const o=[];for(const[i,a]of Object.entries(e.route[n.hudConfig.express.layerStateSymbol]))o.push(new r.EndpointDeclaration(i,a.methods,"express",t,a.layerPath));return Array.from(o.values())}const s=new Set(["query","expressInit","mounted_app"])},8167:e=>{e.exports=require("worker_threads")},8528:e=>{e.exports=require("./dto")},8590:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRouterlessEndpointDeclarationsFromStorage=function(){const e=i;return i=[],e},t.storePartialEndpointDeclaration=function(e){a.push(e)},t.getPartialEndpointDeclarationsFromStorage=function(){const e=a;return a=[],e},t.storeExpressEndpointDeclaration=function(e){if(!r.fullEndpointFlowIdMap.has(e.flow_id)){if(e.path){const t=(0,n.generateEndpointFlowId)(e.path,e.methods);r.fullEndpointFlowIdMap.set(e.flow_id,t)}i.push(e)}};const n=o(2546),r=o(2314);let i=[],a=[]},8708:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.setLambdaExtensionId=function(e){r&&n.app_logger.warning("Lambda extension id already set"),r=e},t.getLambdaExtensionId=function(){return r};const n=o(523);let r},8714:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getKafkaJSTopics=function(){const e=o;return o=[],e},t.storeKafkaJSTopicDeclaration=function(e){o.push(e)};let o=[]}},t={};return function o(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,o),i.exports}(820)})());
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(global,()=>(()=>{"use strict";var e={290:e=>{e.exports=require("async_hooks")},395:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addReingestValue=function(e){n.add(e)},t.getAndClearReingestValues=function(){const e=new Set;for(const t of n)o.has(t)||e.add(t);for(const t of e)o.add(t);return n=new Set,e};let n=new Set;const o=new Set},523:e=>{e.exports=require("./logger")},754:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.storeEndpointDeclaration=function(e){n.push(e)},t.getEndpointDeclarationsFromStorage=function(){const e=n;return n=[],e};let n=[]},820:function(e,t,n){var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,r)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||o(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(7764),t),r(n(4583),t),r(n(2314),t),r(n(1321),t),r(n(3764),t),r(n(2207),t),r(n(8714),t),r(n(4988),t),r(n(2525),t),r(n(3973),t),r(n(1757),t),r(n(1364),t),r(n(7398),t),r(n(8708),t),r(n(395),t)},1321:function(e,t,n){var o,r=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,r)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||(o=function(e){return o=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},o(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n=o(e),a=0;a<n.length;a++)"default"!==n[a]&&r(t,e,n[a]);return i(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.GraphQLDocumentMetadata=void 0,t.getDocumentsMetadata=function(){const e=u;return u=[],e};const s=a(n(6982));let u=[];t.GraphQLDocumentMetadata=class{name;timeTook;hash;selectionNames;constructor(e,t){this.name=e.definitions[0]?.name?.value,this.hash=s.createHash("sha256").update(e.loc?.source?.body).digest("hex"),this.selectionNames=e.definitions.flatMap(e=>e.selectionSet.selections.map(e=>e.name.value)),this.timeTook=t}save(){u.push(this)}}},1364:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.initGlobals=function(){globalThis.hudGlobalInitGuard||(globalThis.hudGlobalInitGuard=!0,globalThis.hudRunMutex=!1,globalThis.hudRanOnRequire=!1,globalThis.hudRanOnImport=!1,globalThis.hudInitGuard=void 0,globalThis.hudInstrumentationIndicator=void 0,globalThis.hudMetricsIndicator=void 0,globalThis.hudInstrumentationOccured=!1,globalThis.hudNextJsPluginIndicator=void 0,globalThis.hudStartTime=new Date,globalThis.hudCalls={},globalThis.hudRunningMode=r.HudRunningMode.enabled,globalThis.hudExecutionFlowMaxLength=o.hudConfig.investigation.limits.executionFlowMaxLength,globalThis.hudExceptionMaxLength=o.hudConfig.investigation.limits.exceptionMaxLength,globalThis.hudEnableInvestigation=o.hudConfig.dynamicConfig.enableInvestigation,globalThis.hudEnableInvestigationArgsSending=o.hudConfig.dynamicConfig.enableInvestigationArgsSending,(0,s.setInvestigationStorage)(new u.AsyncLocalStorage),(0,s.setFlowStateStorage)(new u.AsyncLocalStorage),function(){globalThis.hudSampleTable=[];const e=[[10,1],[30,2],[100,3],[500,11],[1e3,23],[5e3,53]];let t=0;for(const[n,o]of e){for(let e=t;e<n;e++)globalThis.hudSampleTable.push(e%o===0);t=n}}(),c())},t.resetGlobals=c,t.hookMessageChannel=function(){const{port1:e,port2:t}=new l.MessageChannel;return e.on("message",e=>{"HudModulePatch"===e.key?(globalThis.hudPatched.add(e.hudPatched),globalThis.hudProcessedFiles.push(e.hudProcessedFiles)):"HudRetrieveFileCache"===e.key&&globalThis.HudSourceMapCache.set(e.filename,e.content)}),e.unref(),globalThis.hudHookPort=e,t},t.clearInitGuard=d,t.clearMetricsIndicator=g,t.clearInstrumentationIndicator=h,t.clearUserIndicatorsTimeouts=function(){d(),g(),h()},t.detachHud=f,t.forceHudEnable=function(){globalThis.forceHudEnable=!0},t.saveHudRunningFromSetup=function(){globalThis.hudIsRunningFromSetup=!0},t.saveInstrumentationIndicator=function(e){globalThis.hudInstrumentationIndicator=e,globalThis.hudInstrumentationIndicator.unref()},t.validateAndGetUserInput=function(){return o.hudConfig.userConfig.key||o.hudConfig.userConfig.service?o.hudConfig.userConfig.key?(0,o.isValidParam)(o.hudConfig.userConfig.key.value)?o.hudConfig.userConfig.service?(0,o.isValidParam)(o.hudConfig.userConfig.service.value)?{apiKey:o.hudConfig.userConfig.key.value,service:o.hudConfig.userConfig.service.value}:(a.app_logger.critical("Service name is invalid - SDK cannot initialize",{source:o.hudConfig.userConfig.service.source}),o.hudConfig.disableOnBadServiceName&&f(!1),void a.customer_logger.log(i.UserErrorLogs.HudServiceInvalid(o.hudConfig.userConfig.service.source))):(a.app_logger.critical("Service name is missing - SDK cannot initialize"),o.hudConfig.disableOnBadServiceName&&f(!1),void a.customer_logger.log(i.UserErrorLogs.HudServiceNotSet(globalThis.hudStartFromAutoInit))):(a.app_logger.critical("API key is invalid - SDK cannot initialize",{source:o.hudConfig.userConfig.key.source}),o.hudConfig.disableOnBadApiKey&&f(!1),void a.customer_logger.log(i.UserErrorLogs.HudApiKeyInvalid(o.hudConfig.userConfig.key.source))):(a.app_logger.critical("API key is missing - SDK cannot initialize"),o.hudConfig.disableOnBadApiKey&&f(!1),void a.customer_logger.log(i.UserErrorLogs.HudApiKeyNotSet(globalThis.hudStartFromAutoInit))):(a.app_logger.critical("Both API key and service name are missing - SDK cannot initialize"),(o.hudConfig.disableOnBadApiKey||o.hudConfig.disableOnBadServiceName)&&f(!1),void a.customer_logger.log(i.UserErrorLogs.BothApiKeyAndServiceNotSet(globalThis.hudStartFromAutoInit)))};const o=n(5809),r=n(8528),i=n(2546),a=n(523),s=n(7131),u=n(290),l=n(8167);function c(){globalThis.hudProcessedFiles=[],globalThis._hud_S=new Array(1e3).fill(""),globalThis._hud_SI={value:0},globalThis.hudLoadedModules=[],globalThis.hudPatched=new Set,globalThis.HudSourceMapCache=new Map,globalThis.hudExpressState=[]}function d(){clearTimeout(globalThis.hudInitGuard),globalThis.hudInitGuard=void 0}function g(){clearTimeout(globalThis.hudMetricsIndicator),globalThis.hudMetricsIndicator=void 0}function h(){clearTimeout(globalThis.hudInstrumentationIndicator),globalThis.hudInstrumentationIndicator=void 0,globalThis.hudInstrumentationOccured=!0}function f(e=!0,t=!1){if(a.app_logger.warning("Detaching hud"),t||e&&hudRunningMode!==r.HudRunningMode.detached){const e=(0,i.getFirstError)();a.customer_logger.log(i.UserErrorLogs.ShutdownGracefully(e))}globalThis.hudRunningMode=r.HudRunningMode.detached}},1757:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.markForLogFlushing=function(){a=!0},t.storeCredentials=function(e,t){r=e,i=t},t.storeSessionInfo=function(e){s=e},t.flushLogs=u,t.tryFlushPendingLogs=async function(e,t){a&&(a=!1,await u(e,t))};const o=n(523);let r,i,a=!1,s=null;async function u(e,t){try{const a=e||r;if(!a||"string"!=typeof a)return;const u=t||i||"unknown",l=(0,o.getSavedLogs)();for(const e of l){const{HudClient:t}=n(4672),r=new t;s?(o.app_logger.info("Flushing logs with session",{size:e.length,sessionId:s.sessionId,service:u}),r.setSession(s),await r.logs(e)):(o.app_logger.info("Flushing logs (sessionless)",{size:e.length,service:u}),await r.sessionslessLogs(e,a)),o.app_logger.info("Successfully flushed logs")}}catch(e){try{o.app_logger.error("Failed to flush logs",{msg:e instanceof Error?e.message:void 0,hasSession:null!==s})}catch{}}}},2207:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.storeResolverIdBySelectionName=function(e,t){n.set(t,e)},t.getResolverIdBySelectionName=function(e){return n.get(e)};const n=new Map},2314:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fullEndpointFlowIdMap=void 0,t.getLinkedConsistentFlowId=u,t.getFlowIdFromMappings=l,t.linkTemporaryToConsistenFlowId=c,t.clearFlowIdMappings=function(){t.fullEndpointFlowIdMap.clear(),s.clear()},t.swapTempToConstFlowId=function(e){e.forEach(e=>{"express"===e.framework&&(e.flow_id=u(e.flow_id,!0)??e.flow_id)})};const o=n(2546),r=n(523),i=n(7930),a=n(8590);t.fullEndpointFlowIdMap=new Map;const s=new Map;function u(e,t){let n=l(e,!1);return n?n.flowId:(c(t),n=l(e,!0),n?(n.isPartial&&!t&&r.app_logger.warning("Found partial endpoint for flow id even though partial aren't allowd",{flowId:e,consistentFlowId:n.flowId}),n.flowId):void 0)}function l(e,n){let o=t.fullEndpointFlowIdMap.get(e);return o?{flowId:o,isPartial:!1}:n?(o=s.get(e),o?{flowId:o,isPartial:!0}:void 0):void 0}function c(e){const n=[];globalThis.hudExpressState.forEach(e=>{try{n.push(...(0,i.extractEndpointsFromRouter)("",e))}catch(e){r.app_logger.error("Failed to extract endpoints from express",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}),n.forEach(e=>{if(e.partial_path)return;const n=e.flow_id;let r=t.fullEndpointFlowIdMap.get(n);r||(r=(0,o.generateEndpointFlowId)(e.path,e.methods),t.fullEndpointFlowIdMap.set(n,r))}),(0,a.getPartialEndpointDeclarationsFromStorage)().forEach(n=>{const r=n.flow_id;let i=t.fullEndpointFlowIdMap.get(r);i||(i=s.get(r),i||(i=(0,o.generateEndpointFlowId)(n.partial_path,n.methods),e?s.set(r,i):t.fullEndpointFlowIdMap.set(r,i)))})}},2525:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSqsQueues=function(){const e=n;return n=[],e},t.storeSqsQueueDeclaration=function(e){n.push(e)};let n=[]},2546:e=>{e.exports=require("./lib")},2987:e=>{e.exports=require("perf_hooks")},3764:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getResolversDeclarations=function(){const e=n;return n=[],e},t.storeResolverDeclaration=function(e){n.push(e)};let n=[]},3973:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getFlowMetrics=function(e){const t=(new Date).toISOString(),n={};for(const o in s){const i=[];let a;for(const n in s[o]){const r=s[o][n];a||(a=r.getEventVersion()),i.push(r.finalize(u,t,e))}delete s[o],a?n[o]={eventVersion:a,metrics:i}:r.app_logger.error("No event version found for metric type",o)}return n},t.storeFlowMetric=function(e){const t=function(e){if(void 0!==e.flow_id)switch(e.type){case"EndpointMetric":{const t=e;return`${e.flow_id}|${t.route}|${t.method}|${t.status_code}`}case"KafkaJSMetric":{const t=e;return`${e.flow_id}|${t.partition}|${t.error}`}default:return e.flow_id}}(e);if(!t)return;s[e.type]||(s[e.type]={});const n=s[e.type][t];if(n)n.update(e,u);else{const n=a.MetricFactory.createMetric(e,u);s[e.type][t]=n}};const o=n(5809),r=n(523),i=n(7131),a=n(7859),s={},u=new i.SketchManager(o.hudConfig.huddBinWidth)},4583:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getExpressEndpointDeclarations=function(){let e=[];globalThis.hudExpressState.forEach(t=>{try{e=e.concat((0,i.extractEndpointsFromRouter)("",t))}catch(e){o.app_logger.error("Failed to extract endpoints from express",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}),e=e.concat((0,a.getRouterlessEndpointDeclarationsFromStorage)());const t=new Set;e.forEach(e=>{e.partial_path||t.add(e.flow_id)});const n=e.filter(e=>!e.partial_path||!t.has(e.flow_id)&&(o.app_logger.info("Partial endpoint without full endpoint",{endpoint:e}),!0));return(0,r.swapTempToConstFlowId)(n),n};const o=n(523),r=n(2314),i=n(7930),a=n(8590)},4672:e=>{e.exports=require("./client")},4988:function(e,t,n){var o,r=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,r)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||(o=function(e){return o=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},o(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n=o(e),a=0;a<n.length;a++)"default"!==n[a]&&r(t,e,n[a]);return i(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.pageManifest=t.apiManifest=void 0,t.setNextConfig=function(e){g=e,h=!0},t.getNextConfig=function(){return g},t.isNextConfigExtracted=function(){return h},t.extractNextEndpointDeclarations=async function(e){const n=[];if(!e)return n;c.worker_logger.info("Extracting next.js endpoint declarations in worker");const o=e.distDir,r=s.join(o,t.apiManifest),i=await(0,l.readFile)(r);if(i){const e=JSON.parse(i),t=await async function(e,t){const n=[];for(const o of Object.keys(t))if(o.endsWith("/route")){const r=s.join(e,"server",t[o]),i=await f(r),a=m(o,"/route");for(const e of i){const t=(0,l.generateEndpointFlowId)(a,[e]);n.push(new u.EndpointDeclaration(t,[e],"nextjs","",a))}}else if(o.endsWith("/page")){const e=["GET"],t=m(o,"/page"),r=(0,l.generateEndpointFlowId)(t,e);n.push(new u.EndpointDeclaration(r,e,"nextjs","",t))}else c.worker_logger.warning("Unknown Next.js manifest key type",{key:o});return n}(o,e);n.push(...t)}const a=s.join(o,t.pageManifest),g=await(0,l.readFile)(a);if(g){const e=JSON.parse(g),t=await async function(e,t){const n=[];for(const o of Object.keys(t))if(o.startsWith("/api/")){const r=s.join(e,"server",t[o]),i=await f(r),a=await p(r);for(const e of i){const t=(0,l.generateEndpointFlowId)(o,[e]);n.push(new u.EndpointDeclaration(t,[e],"nextjs","",o))}if(a){const e=d.filter(e=>!i.includes(e)),t=(0,l.generateEndpointFlowId)(o,e);n.push(new u.EndpointDeclaration(t,e,"nextjs","",o))}}else{const e=["GET"],t=(0,l.generateEndpointFlowId)(o,e);n.push(new u.EndpointDeclaration(t,e,"nextjs","",o))}return n}(o,e);n.push(...t)}return n};const s=a(n(6928)),u=n(8528),l=n(2546),c=n(523),d=["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD"];let g;t.apiManifest="server/app-paths-manifest.json",t.pageManifest="server/pages-manifest.json";let h=!1;async function f(e){const t=await(0,l.readFile)(e);if(!t)return[];const n=new RegExp(`\\b(${d.join("|")})\\b`,"g"),o=t.matchAll(n),r=Array.from(o,e=>e[1]);return Array.from(new Set(r))}async function p(e){const t=await(0,l.readFile)(e);return!!t&&null!==t.match(/\bdefault\b/g)}function m(e,t){return e.length===t.length?"/":e.length>t.length?e.slice(0,0-t.length):e}},5809:e=>{e.exports=require("./config")},6928:e=>{e.exports=require("path")},6982:e=>{e.exports=require("crypto")},7131:e=>{e.exports=require("./wrap")},7398:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.globalInvestigationTracking=void 0,t.getClosedInvestigations=function(){const e=i;return i=[],e},t.storeClosedInvestigation=function(e){i.push(e)},t.setGlobalInvestigationTracking=function(e){t.globalInvestigationTracking=e},t.increaseGlobalInvestigationTracking=function(){t.globalInvestigationTracking++},t.increaseInvestigationDedupingCache=function(e,t){const n=a.get(e)??new Map,o=(n.get(t)??0)+1;n.set(t,o),a.set(e,n)},t.resetInvestigationDedupingCache=function(){a.clear()},t.getInvestigationDedupingCache=function(e){return a.get(e)??new Map},t.saveMachineMetric=function(){const e=process.cpuUsage(),t=r.performance.eventLoopUtilization();s.push({cpuUsage:e,elu:t,timestamp:Date.now()}),s.length>o.hudConfig.machineMetricsSavedLength&&s.shift()},t.getLastMetrics=function(){return s[0]};const o=n(5809),r=n(2987);let i=[];t.globalInvestigationTracking=0;const a=new Map,s=[]},7764:function(e,t,n){var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,r)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||o(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(754),t),r(n(8714),t),r(n(4988),t),r(n(1321),t),r(n(3764),t),r(n(2207),t),r(n(4583),t),r(n(8590),t)},7859:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MetricFactory=t.BaseMetric=void 0;class n{}class o extends n{flowId;count;sumDuration;sumSquaredDuration;sketchBuilder;errorBreakdown;constructor(e,t){super(),this.flowId=e.flow_id,this.count=1,this.sumDuration=e.duration,this.sumSquaredDuration=e.duration**2,this.sketchBuilder=t.newSketchDataWithValue(e.duration),this.errorBreakdown=new Map,e.error_breakdown&&this.updateErrorBreakdown(e.error_breakdown)}getEventVersion(){return"1.0.0"}updateErrorBreakdown(e){let t=this.errorBreakdown.get(e.key);void 0===t&&(t={errors:e.errors,count:0,caught:e.caught,key:e.key},this.errorBreakdown.set(e.key,t)),t.count+=1}update(e,t){this.sumDuration+=e.duration,this.sumSquaredDuration+=e.duration**2,this.count+=1,t.add(this.sketchBuilder,e.duration),void 0!==e.error_breakdown&&this.updateErrorBreakdown(e.error_breakdown)}finalize(e,t,n){return{flow_id:this.flowId,count:this.count,sum_duration:this.sumDuration,sum_squared_duration:this.sumSquaredDuration,timestamp:t,timeslice:n,sketch:e.encode(this.sketchBuilder),error_breakdown:Array.from(this.errorBreakdown.values()).map(e=>({errors:e.errors,count:e.count,caught:e.caught}))}}}t.BaseMetric=o;class r{static registry={};static registerMetric(e,t){r.registry[e]=t}static createMetric(e,t){const n=r.registry[e.type];if(!n)throw new Error(`Unknown metric type: ${e.type}`);return new n(e,t)}}t.MetricFactory=r,r.registerMetric("EndpointMetric",class extends o{method;statusCode;constructor(e,t){super(e,t),this.method=e.method,this.statusCode=e.status_code}getEventVersion(){return"1.0.2"}finalize(e,t,n){return{...super.finalize(e,t,n),method:this.method,status_code:this.statusCode}}}),r.registerMetric("GraphQLMetric",class extends o{constructor(e,t){super(e,t)}}),r.registerMetric("KafkaJSMetric",class extends o{partition;error;ConsumeSketchBuilder;sumConsumedDuration;sumSquaredConsumedDuration;constructor(e,t){super(e,t),this.partition=e.partition,this.error=e.error,e.total_consume_duration&&(this.ConsumeSketchBuilder=t.newSketchDataWithValue(e.total_consume_duration)),this.sumConsumedDuration=e.total_consume_duration??0,this.sumSquaredConsumedDuration=(e.total_consume_duration??0)**2}update(e,t){super.update(e,t),e.total_consume_duration&&(this.sumConsumedDuration+=e.total_consume_duration,this.sumSquaredConsumedDuration+=e.total_consume_duration**2,this.ConsumeSketchBuilder?t.add(this.ConsumeSketchBuilder,e.total_consume_duration):this.ConsumeSketchBuilder=t.newSketchDataWithValue(e.total_consume_duration))}finalize(e,t,n){return{...super.finalize(e,t,n),partition:this.partition,error:this.error,sum_consumed_duration:this.sumConsumedDuration,sum_squared_consumed_duration:this.sumSquaredConsumedDuration,sketch_consume:e.encode(this.ConsumeSketchBuilder)}}}),r.registerMetric("SqsMetric",class extends o{msgCount;errors;e2eData;constructor(e,t){super(e,t),this.msgCount=e.msg_count,this.errors=e.errors,e.e2e_duration&&(this.e2eData={duration:e.e2e_duration,squaredDuration:e.e2e_duration**2,sketchBuilder:t.newSketchDataWithValue(e.e2e_duration)})}update(e,t){super.update(e,t),this.msgCount&&e.msg_count&&(this.msgCount+=e.msg_count),e.errors.forEach((e,t)=>{this.errors.set(t,(this.errors.get(t)??0)+e)}),this.e2eData&&e.e2e_duration&&(this.e2eData.duration+=e.e2e_duration,this.e2eData.squaredDuration+=e.e2e_duration**2,t.add(this.e2eData.sketchBuilder,e.e2e_duration))}getEventVersion(){return"1.0.2"}finalize(e,t,n){return{...super.finalize(e,t,n),errors:Object.fromEntries(this.errors),msg_count:this.msgCount,...this.e2eData?{e2e_sum_duration:this.e2eData.duration,e2e_sum_squared_duration:this.e2eData.squaredDuration,e2e_sketch:e.encode(this.e2eData.sketchBuilder)}:{}}}})},7930:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extractEndpointsFromRouter=function e(t,n){let r=[];const u="true"===process.env.HUD_LOG_EXPRESS;if(!n.stack)return i.app_logger.error("Router without stack - bad OTEL version",{router:n}),r;for(const l of n.stack)if("router"===l.name){if(!l[o.hudConfig.express.routeNamesSymbol]){i.app_logger.error("Router layer without routes",{layer:l});continue}const n=t+l[o.hudConfig.express.routeNamesSymbol];r=r.concat(e(n,l.handle))}else l.route&&l.route[o.hudConfig.express.layerStateSymbol]?r=r.concat(a(l,t)):u&&!s.has(l.name)&&(s.add(l.name),i.app_logger.warning("Found unknown layer name when extracting endpoints",{layer:l.name}));return r};const o=n(5809),r=n(8528),i=n(523);function a(e,t){const n=[];for(const[i,a]of Object.entries(e.route[o.hudConfig.express.layerStateSymbol]))n.push(new r.EndpointDeclaration(i,a.methods,"express",t,a.layerPath));return Array.from(n.values())}const s=new Set(["query","expressInit","mounted_app"])},8167:e=>{e.exports=require("worker_threads")},8528:e=>{e.exports=require("./dto")},8590:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRouterlessEndpointDeclarationsFromStorage=function(){const e=i;return i=[],e},t.storePartialEndpointDeclaration=function(e){a.push(e)},t.getPartialEndpointDeclarationsFromStorage=function(){const e=a;return a=[],e},t.storeExpressEndpointDeclaration=function(e){if(!r.fullEndpointFlowIdMap.has(e.flow_id)){if(e.path){const t=(0,o.generateEndpointFlowId)(e.path,e.methods);r.fullEndpointFlowIdMap.set(e.flow_id,t)}i.push(e)}};const o=n(2546),r=n(2314);let i=[],a=[]},8708:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.setLambdaExtensionId=function(e){r&&o.app_logger.warning("Lambda extension id already set"),r=e},t.getLambdaExtensionId=function(){return r};const o=n(523);let r},8714:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getKafkaJSTopics=function(){const e=n;return n=[],e},t.storeKafkaJSTopicDeclaration=function(e){n.push(e)};let n=[]}},t={};return function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,n),i.exports}(820)})());
2
2
  //# sourceMappingURL=globalstate.js.map