hud-sdk
Version:
Hud's Node SDK
2 lines • 41.8 kB
JavaScript
!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 s in n)("object"==typeof exports?exports:e)[s]=n[s]}}(global,()=>(()=>{"use strict";var e={523:e=>{e.exports=require("./logger")},1427:e=>{e.exports=require("./nativerequire")},2546:e=>{e.exports=require("./lib")},2702:function(e,t,n){var s,i=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,i)}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(s=function(e){return s=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},s(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n=s(e),o=0;o<n.length;o++)"default"!==n[o]&&i(t,e,n[o]);return r(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.WorkerKeepaliveGuard=void 0;const a=o(n(523)),c=n(8528),d=a.app_logger;t.WorkerKeepaliveGuard=class{worker;keepaliveGrace;timeoutId=void 0;eventHandler=this.keepalive.bind(this);constructor(e,t){this.worker=e,this.keepaliveGrace=t}keepalive(e){try{if(e.msg!==c.KeepAliveMessage.msg)return;this._restartTimeout()}catch(e){d.error("Error in keepalive",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}_restartTimeout(){const e=setTimeout(()=>{},this.keepaliveGrace);clearTimeout(this.timeoutId),this.timeoutId=e}start(){this.stop(),this.worker.on("message",this.eventHandler).unref()}stop(){void 0!==this.timeoutId&&clearTimeout(this.timeoutId),this.worker.off("message",this.eventHandler),this.timeoutId=void 0}}},4672:e=>{e.exports=require("./client")},5119:function(e,t,n){var s,i=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,i)}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(s=function(e){return s=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},s(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n=s(e),o=0;o<n.length;o++)"default"!==n[o]&&i(t,e,n[o]);return r(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.updateTsNodeConfig=t.tryFlushPendingLogs=t.init=t.flush=void 0;const a=o(n(6281));t.init=a.default,Object.defineProperty(t,"flush",{enumerable:!0,get:function(){return a.flush}}),Object.defineProperty(t,"tryFlushPendingLogs",{enumerable:!0,get:function(){return a.tryFlushPendingLogs}}),Object.defineProperty(t,"updateTsNodeConfig",{enumerable:!0,get:function(){return a.updateTsNodeConfig}})},5809:e=>{e.exports=require("./config")},5994:function(e,t,n){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MainThread=void 0;const i=n(8167),r=n(2546),o=n(5809),a=n(8269),c=n(523),d=n(7274),g=n(6281),l=s(n(7320)),u=n(9269);function h(){globalThis.hudInstrumentationOccured&&c.customer_logger.logEntry(r.UserErrorLogs.YesInstrumentationNoMetrics())}t.MainThread=class{apiKey;service;startTime;tags;messenger;lifecycleHooksRegistered=!1;teardownInFlight;didLogFlushInLambda=!1;resolveInitPromise;initPromise=new Promise(e=>{this.resolveInitPromise=e});constructor(e,t,n,s){this.apiKey=e,this.service=t,this.startTime=n,this.tags=s,(0,a.storeCredentials)(e,t)}startFailed(e){e instanceof r.HudSessionThrottle?(c.customer_logger.logEntry(r.UserLogs.InitIdleMode()),(0,g._detachAndTerminate)(!1,!1,!0)):e instanceof r.HudInitNetworkError&&e.originalAxiosErrorCode?(c.customer_logger.logEntry((0,r.getNetworkError)(e.originalAxiosErrorCode)),c.app_logger.critical("Failed to start worker because of network error",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0}),(0,g._detachAndTerminate)(!1,!1,!0)):(c.app_logger.critical("Failed to start worker",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0}),(0,r.setFirstError)(e.code),(0,g._detachAndTerminate)(!0,!1,!0))}async _registerLambdaExtension(){const e=await(0,r.register)();return(0,a.setLambdaExtensionId)(e),e}async startMessenger(e){try{this.messenger=await this._createMessenger(e),await this._start(),this.registerLifecycleTeardown(),c.customer_logger.logEntry(r.UserLogs.HudInitSuccess())}catch(e){throw this.startFailed(e),e}finally{this.resolveInitPromise()}}async start(){if(i.isMainThread)if(globalThis.hudRuningInsideLambda)try{const e=await this._registerLambdaExtension();c.app_logger.info("Lambda extension registered, not waiting for worker to start",{lambdaExtensionId:e}),(0,r.next)(e).then(async()=>{c.app_logger.info("Lambda got first event, creating messenger");try{await this.startMessenger(e)}catch{}}).catch(e=>{c.app_logger.error("Failed to send first event to lambda",{msg:e instanceof Error?e.message:void 0}),this.startFailed(e),this.resolveInitPromise()})}catch(e){throw this.startFailed(e),this.resolveInitPromise(),e}else await this.startMessenger(void 0)}async _start(){if(!this.messenger)throw new r.HudInitError("Messenger not initialized");try{const e=await this.messenger.checkWorkerInitialized(o.hudConfig.workerTimeout),t=e?.content?.sessionInfo;if(t&&((0,a.storeSessionInfo)(t),!0===t.options?.forensicsOnly&&(0,r.enableForensicsOnly)()),await this._initDynamicConfig(),o.hudConfig.dynamicConfig.functionDetachEnabled&&!o.hudConfig.userConfig.disableDetachedFunctions?.value){const e=await(this.messenger?.getKnownDetachedFunctions(!0));e&&(0,d.applyKnownDetachedFunctions)(e)}globalThis.hudMetricsIndicator=setTimeout(h,o.hudConfig.timeoutOnMetrics),globalThis.hudMetricsIndicator.unref()}catch(e){const t=e instanceof Error?e.message:void 0;if(e instanceof r.HudSessionThrottle)throw e;throw c.app_logger.critical("Failed to start worker",{msg:t}),e}(0,u.setUnknownAsyncContextTypesInterval)(),await this.messenger.start()}async _createMessenger(e){const t=r.myRequire.resolve(`${o.SDK_MODULE_NAME}/worker`),n={...process.env};delete n.NODE_OPTIONS;const s=new i.Worker(t,{workerData:{apiKey:this.apiKey,service:this.service,startTime:this.startTime,tags:this.tags,lambdaExtensionId:e,shouldCreateDeclaraionWorker:!!e,userConfig:o.hudConfig.userConfig},execArgv:[],env:n});let a;try{a=new l.default(s),await a.checkWorker(o.hudConfig.workerTimeout)}catch(e){if(e instanceof r.HudSessionThrottle)throw c.app_logger.info("Worker started in idle mode - session throttled"),e;throw c.app_logger.critical("Worker failed to start",{msg:e instanceof Error?e.message:void 0}),e}finally{s.unref()}return a}async _initDynamicConfig(){const e=await(this.messenger?.getRemoteConfig());e?(c.app_logger.info("Remote configuration exists"),o.hudConfig.dynamicConfig=(0,o.updateDynamicConfig)(e,o.hudConfig,c.app_logger),(0,o.updateInvestigationRateLimitGlobals)(),c.app_logger.info("Current dynamic configuration:",{currentDynamicConfig:o.hudConfig.dynamicConfig})):c.app_logger.info("No remote configuration - falling back to default dynamic configuration",{defaultDynamicConfig:o.hudConfig.dynamicConfig})}async terminateMessenger(){await(this.messenger?.terminateWorker()),this.messenger?.stop(),this.messenger=void 0}registerLifecycleTeardown(){if(this.lifecycleHooksRegistered)return;if(this.lifecycleHooksRegistered=!0,globalThis.hudRuningInsideLambda)return;const e=o.hudConfig.dynamicConfig.enableTeardown||o.hudConfig.userConfig.flushOnExit?.value,t=o.hudConfig.userConfig.flushOnUncaughtException?.value||o.hudConfig.dynamicConfig.flushOnUncaughtException;if(!e&&!t)return;const n=async()=>{try{if(this.teardownInFlight)return void await this.teardownInFlight;this.teardownInFlight=this.gracefulShutdown(),await this.teardownInFlight}catch{}};e&&(process.once("beforeExit",()=>{n()}),process.prependOnceListener("SIGTERM",async()=>{const e=process.listenerCount("SIGTERM")>0;try{await n()}catch{}e||process.kill(process.pid,"SIGTERM")}),process.prependOnceListener("SIGINT",async()=>{const e=process.listenerCount("SIGINT")>0;try{await n()}catch{}e||process.kill(process.pid,"SIGINT")})),t&&(process.prependOnceListener("uncaughtException",e=>{const t=process.listenerCount("uncaughtException")>0;(async()=>{try{await n()}catch{}if(!t)throw e})()}),process.prependOnceListener("unhandledRejection",e=>{const t=process.listenerCount("unhandledRejection")>0;(async()=>{try{await n()}catch{}if(!t)throw e})()}))}async gracefulShutdown(){if(this.messenger){try{await this.messenger.gracefulShutdown()}catch{}this.messenger=void 0,(0,a.detachHud)(!1,!1)}}async flush(){globalThis.hudRuningInsideLambda?this.didLogFlushInLambda||(this.didLogFlushInLambda=!0,c.app_logger.warning("flush() is not supported in lambda. Skipping."),c.customer_logger.logEntry(r.UserErrorLogs.FlushNotSupportedInLambda())):(await this.initPromise,await(this.messenger?.flush()))}}},6261:e=>{e.exports=require("events")},6281:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=async function(e,t,n){try{if(!globalThis.hudRanOnRequire)return;if(globalThis.hudRunMutex)return void i.app_logger.warning("Already ran init!");globalThis.hudRunMutex=!0,(0,c.clearInitGuard)(),(0,s.updateUserConfigFromInit)(e,t,n);const g=(0,c.validateAndGetUserInput)();if(!g)return;if(globalThis.hudRunningMode!==a.HudRunningMode.enabled)return void i.app_logger.critical("SDK running mode is not enabled - initialization aborted");if((0,s.setForensicsOnly)(!0===o.hudConfig.userConfig.forensicsOnly?.value),(0,s.isForensicsOnly)()&&((0,s.applyForensicsOnlyLogFloor)(),i.app_logger.info("SDK running in forensics-only mode")),i.app_logger.info("Initializing hud",{userConfig:Object.entries(o.hudConfig.userConfig).filter(([e,t])=>"DEFAULT"!==t.source)}),l=new r.MainThread(g.apiKey,g.service,globalThis.hudStartTime,o.hudConfig.userConfig.tags?.value),await l.start(),l.messenger&&(0,d.safeCall)(i.app_logger,l.messenger.handleLogsTask()),globalThis.hudImportStartTime){const e=process.uptime()-globalThis.hudImportStartTime;i.app_logger.info("Hud initialized",{importTime:e,startTime:globalThis.hudImportStartTime})}}catch(e){try{if(e instanceof d.HudSessionThrottle)return;i.app_logger.critical("Something went wrong in init",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}catch{i.app_logger.critical("Something went wrong in init & e.stack raised an exception")}h(!0,!1,!0)}},t.isValidParam=function(e){return null!=e&&""!==e&&"string"==typeof e},t._detachAndTerminate=h,t.flushLogs=f,t.updateTsNodeConfig=function(){try{return!!l?.messenger&&l.messenger.updateTsNodeConfig()}catch(e){return i.app_logger.error("Failed to update ts-node config",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0}),!1}},t.flush=async function(){try{await(l?.flush())}catch(e){i.app_logger.error("Failed flushing SDK",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}},t.tryFlushPendingLogs=async function(e,t){(0,c.getShouldFlushOnInit)()&&((0,c.markShouldFlushOnInit)(!1),await f(e,t))};const s=n(2546),i=n(523),r=n(5994),o=n(5809),a=n(8528),c=n(8269),d=n(2546),g=n(7274);let l,u=!1;function h(e=!0,t=!1,n=!1){(0,c.detachHud)(e,t),n&&(0,d.safeCall)(i.app_logger,f()),l&&(0,d.safeCall)(i.app_logger,l.terminateMessenger());const r=(0,c.getLambdaExtensionId)();r&&!u&&(u=!0,(0,d.safeCall)(i.app_logger,(0,s.nextLoopDummy)(r))),(0,c.clearUserIndicatorsTimeouts)(),(0,g.resetCallers)()}async function f(e,t){const s=(0,c.getSessionInfo)(),r=(0,c.getStoredApiKey)(),o=(0,c.getStoredService)();try{const a=e||r;if(!a||"string"!=typeof a)return;const c=t||o||"unknown",d=(0,i.getSavedLogs)();for(const e of d){const{HudClient:t}=n(4672),r=new t;s?(i.app_logger.info("Flushing logs with session",{size:e.length,sessionId:s.sessionId,service:c}),r.setSession(s),await r.logs(e)):(i.app_logger.info("Flushing logs (sessionless)",{size:e.length,service:c}),await r.sessionslessLogs(e,a)),i.app_logger.info("Successfully flushed logs")}}catch(e){try{i.app_logger.error("Failed to flush logs",{msg:e instanceof Error?e.message:void 0,hasSession:null!==s})}catch{}}}},6460:e=>{e.exports=require("timers/promises")},7131:e=>{e.exports=require("./wrap")},7274:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._setLastPrepCallsTimestamp=c,t.getLastPrepCallsTimestamp=function(){return a},t._liftExceptions=g,t.prepCalls=function(e,t){const n=process.hrtime.bigint();let d;d=null===a?s.hudConfig.dynamicConfig.aggregationInterval:Number(n-a)/1e6,c(n);let l=null;d>=s.hudConfig.dynamicConfig.functionDetachMinWindowMs&&s.hudConfig.dynamicConfig.functionDetachEnabled&&!s.hudConfig.userConfig.disableDetachedFunctions?.value&&(l=s.hudConfig.dynamicConfig.functionDetachThresholdPerSecond*(d/1e3));const u=(new Date).toISOString(),h=[];return Object.entries(hudCalls).map(([n,s])=>{const i=s.shouldDetach;let a=0;var c;Object.entries(s).forEach(([s,o])=>{"shouldDetach"!==s&&Object.entries(o).forEach(([o,c])=>{try{if(null===l||i||(a+=c.count),0===c.sampledCount)return;const r={function_id:n,wrapped_flow_id:o||void 0,wrapped_caller_id:s||void 0,timestamp:u,timeslice:e,exceptions:g(c.exceptions),count:c.count,sampled_count:c.sampledCount,sum_duration:c.sum,sum_squared_duration:c.squareSum,sketch:c.sketch?t.encode(c.sketch):void 0,is_linked_function:c.isLinkedFunction};h.push(r),function(e){e.count=0,e.sampledCount=0,e.sum=0,e.squareSum=0,e.sketch=null,e.exceptions={}}(c)}catch(e){r.app_logger.error("Failed preparing invocation, skipping",{func:n,wrappedCaller:s,msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}})}),null!==l&&a>l&&(hudCalls[n].shouldDetach=!0,c=n,o.push(c),r.app_logger.info("Detaching function",{func:n,totalFunctionCalls:a}))}),h.length>0&&(0,i.clearMetricsIndicator)(),h},t.resetCallers=function(){for(const e in globalThis.hudCalls)for(const t in globalThis.hudCalls[e])if("shouldDetach"!==t)for(const n in globalThis.hudCalls[e][t])d(globalThis.hudCalls[e][t][n])},t.getAndClearDetachedFunctions=function(){const e=o;return o=[],e},t.applyKnownDetachedFunctions=function(e){if(e&&0!==e.length&&!s.hudConfig.userConfig.disableDetachedFunctions?.value){l!==e.length&&(r.app_logger.info("Applying known detached functions from host",{count:e.length}),l=e.length);for(const t of e)try{globalThis.hudCalls[t]?globalThis.hudCalls[t].shouldDetach=!0:globalThis.hudCalls[t]={shouldDetach:!0}}catch(e){r.app_logger.error("Failed to apply detached function, skipping",{rawFunctionId:t,error:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}};const s=n(5809),i=n(8269),r=n(523);let o=[],a=null;function c(e){a=e}function d(e){e.samplingCounter=0}function g(e){const t={};for(const n in e)t[n]=[{count:e[n]}];return t}let l=0},7320:function(e,t,n){var s,i=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,i)}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(s=function(e){return s=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},s(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n=s(e),o=0;o<n.length;o++)"default"!==n[o]&&i(t,e,n[o]);return r(t,e),t});Object.defineProperty(t,"__esModule",{value:!0});const a=o(n(523)),c=o(n(6460)),d=n(5809),g=n(2546),l=n(8528),u=n(2546),h=n(7131),f=n(8269),m=n(2546),p=n(7274),v=n(2702),y=n(8269),w=n(1427),C=n(6281),k=n(8269),b=n(2546),E=n(6261),T=a.app_logger,F=m.safeCall.bind(m.safeCall,T);t.default=class{worker;tsNodeUpdated=!1;staticNextJsEndpointsSent=!1;gracefulShutdownDone=!1;flushInFlight;flushCounter=0;lastManualFlushTimestampMs;didLogManualFlushTooFrequent=!1;threadStatsBaseline=(0,g.createThreadStatsBaseline)();abortController;workerKeepaliveGuard;messageQueue=[];MAX_QUEUE_SIZE=100;messageEmitter=new E.EventEmitter;constructor(e){this.worker=e,this.abortController=new AbortController,(0,E.setMaxListeners)(25,this.abortController.signal);let t=!1;this.worker.on("message",e=>{e.msg!==l.KeepAliveMessage.msg&&(this.messageQueue.length>=this.MAX_QUEUE_SIZE&&(t||(t=!0,T.error("Message queue is at max size, dropping oldest message",{msg:e.msg})),this.messageQueue.shift()),this.messageQueue.push(e),this.messageEmitter.emit("message",e))}).unref(),this.worker.on("error",this.handleWorkerError).unref(),this.workerKeepaliveGuard=new v.WorkerKeepaliveGuard(e,d.hudConfig.communicationKeepaliveGrace),this.updateTsNodeConfig()&&T.info("ts-node config updated from Messenger constructor")}handleWorkerError=e=>{try{e?.code===(new m.HudClientUnauthorizedError).code&&a.customer_logger.logEntry(m.UserErrorLogs.ApiKeyDenied(d.hudConfig.userConfig.key?.source)),T.critical("Error from worker, stopping hud",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0}),(0,m.setFirstError)(e?.code),this.stop(),(0,C._detachAndTerminate)(!0,!1,!0)}catch(e){T.critical("Error stopping hud after worker crash",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}};stop(){try{this.abortWorker()}catch{}d.hudConfig.communicationKeepalive&&this.workerKeepaliveGuard.stop(),this.abortController.abort(),this.abortController=new AbortController,this.messageQueue=[],this.messageEmitter.removeAllListeners(),(0,f.resetGlobals)()}abortWorker(){this._sendObject("Abort",{})}async restart(e){this.stop(),globalThis.hudRunningMode=e,await this.start()}_sendArray(e,t){t.length>0&&(this._sendObject(e,t),T.debug("sent data to worker",{msg:e,size:t.length}))}_sendObject(e,t){const n={msg:e,content:t};this.worker.postMessage(n)}async checkWorker(e){const t=["started"];let n;try{n=await this.getMessageFromWorker(t,e,!0)}catch(s){if(!(s instanceof m.HudTimeoutError))throw s;n=await this.getMessageFromWorker(t,e/2,!1)}if(!n)throw new m.HudInitError("Worker not started");return n}async checkWorkerInitialized(e){let t;const n=["initialized","throttled","networkError"];try{t=await this.getMessageFromWorker(n,e,!0)}catch(s){if(!(s instanceof m.HudTimeoutError))throw s;t=await this.getMessageFromWorker(n,e/10,!1)}if("throttled"===t?.msg)throw new m.HudSessionThrottle;if("networkError"===t?.msg)throw T.error("networkError",{error:t.content.error}),new m.HudInitNetworkError(t.content.message,t.content.originalMessage);if(!t||"initialized"!==t?.msg||void 0===t?.content)throw new m.HudInitError("Worker not initialized successfully");if(t?.content.status!==l.HudSessionInitStatus.success)throw new m.HudInitError("Worker not initialized successfully");return t}async start(){switch(d.hudConfig.communicationKeepalive&&this.workerKeepaliveGuard.start(),globalThis.hudRunningMode){case l.HudRunningMode.enabled:T.info("Enabled mode"),(0,u.applyForensicsDeclarationDelay)(),F(this.getMode()),F(this.periodicGetEndpointsDurationsInvestigationThresholds()),F(this.periodicRefreshRemoteConfig()),F(this.startPeriodicTasks()),F(this.periodicSendMetrics()),F(this.periodicSendDetachedFunctions()),F(this.periodicFetchKnownDetachedFunctions()),F(this.highFrequencySendInvestigations()),F(this.periodicSendProcessedFiles()),F(this.delayedStateCollection()),F(this.periodicSendEndpoints()),F(this.periodicSendOutbounds()),F(this.periodicSendKafkaJS()),F(this.periodicSendSqs()),F(this.periodicSendGraphQL()),F(this.periodicSendGenericDeclarations()),F(this.sendStaticNextJsEndpointsOnce()),F(this.periodicSaveMachineMetrics()),F(this.periodicSendReingest()),F(this.resetCallerCounters()),F(this.periodicResetGlobalInvestigationCounter()),F(this.periodicResetInvestigationDedupingCache()),F(this.sendLogsPeriodically(d.hudConfig.logsSendInterval)),F(this.sendRuntime()),F(this.sendPatchedModules()),F(this.sendPreloadedModules()),F(this.dumpModulesAfterWhile(6e4)),F(this.periodicSendThreadPerformanceMetrics());break;case l.HudRunningMode.disabled:T.info("Disabled mode"),F(this.getMode());break;case l.HudRunningMode.detached:T.info("Detached"),(0,C._detachAndTerminate)(!1,!1),this.stop();break;default:T.error("Running mode not handled")}}consumeMessageFromQueue(e){const t=this.messageQueue.findIndex(t=>e.includes(t.msg));if(-1!==t)return this.messageQueue.splice(t,1)[0]}async getMessageFromWorker(e,t,n=!1,s){let i;e=Array.isArray(e)?e:[e];const r=this.consumeMessageFromQueue(e);if(r)return T.info("Found message in queue",{msg:r.msg}),r;const o=new AbortController,a=()=>{o.abort()};this.abortController.signal.addEventListener("abort",a);const d=c.setTimeout(t,void 0,{signal:o.signal,ref:n}),g=t=>{try{e.includes(t.msg)&&(i=t,o.abort(),this.consumeMessageFromQueue([t.msg]),T.info("Received message from worker (canceling timeout)",t))}catch(e){T.error("Failed handling message from worker",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}};this.messageEmitter.on("message",g),s&&this.worker.postMessage(s);try{throw await d,T.warning("Timeout waiting for message from worker"),new m.HudTimeoutError}catch(e){if(!(0,m.isAbortError)(e))throw(0,m.setFirstError)(e.code),e}finally{this.abortController.signal.removeEventListener("abort",a),this.messageEmitter.off("message",g)}return i}async getMode(){await(0,u.safeUnrefInterval)(async()=>{const e=globalThis.hudRunningMode,t={msg:"GetMode",content:{startTime:globalThis.hudStartTime,runningMode:e}},n=await this.getMessageFromWorker(t.msg,d.hudConfig.workerMessageTimeout,!1,t);if(n?.msg!==t.msg||void 0===n?.content.mode)return void T.error("Unexpected message from worker",n);let s=n.content.mode;s===l.HudRunningMode.reservedForForensicsOnlyDontUse&&((0,u.enableForensicsOnly)(),s=l.HudRunningMode.enabled),s!==e&&await this.restart(s)},d.hudConfig.modeInterval,{signal:this.abortController.signal,onError:e=>T.error("Failed getting mode from worker",{msg:e.message,stack:e.stack})})}async getRemoteConfig(){const e="initDynamicConfig";try{const t=await this.getMessageFromWorker(e,d.hudConfig.workerMessageTimeout,!0);if(t?.msg!==e||void 0===t?.content)throw new Error(`Unexpected message from worker: ${t}`);return t?.content}catch(e){T.error("Failed getting remote configuration from worker",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}async getKnownDetachedFunctions(e=!1){const t="KnownDetachedFunctions",n={msg:"GetKnownDetachedFunctions",content:{}};try{const s=await this.getMessageFromWorker(t,d.hudConfig.workerMessageTimeout,e,n);if(s?.msg!==t||void 0===s?.content)throw new Error(`Unexpected message from worker: ${s}`);return s?.content}catch(e){return T.error("Failed getting known detached functions from worker",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0}),[]}}async periodicSaveMachineMetrics(){(0,f.saveMachineMetric)(),await(0,u.safeUnrefInterval)(()=>(0,f.saveMachineMetric)(),d.hudConfig.dynamicConfig.machineMetricsInterval,{signal:this.abortController.signal,onError:e=>T.error("Failed saving machine metrics",{msg:e.message,stack:e.stack})})}async resetCallerCounters(){const e=d.hudConfig.callerResetInterval;await(0,u.safeUnrefInterval)(()=>{T.info("Resetting caller",{interval:e}),(0,p.resetCallers)()},e,{signal:this.abortController.signal,onError:e=>T.error("Failed reseting caller counters",{msg:e.message,stack:e.stack})})}async updateEndpointDurationsInvestigationThresholds(){const e={msg:"EndpointsDurationsInvestigationThresholds"},t="EndpointsDurationsInvestigationThresholds";try{const n=await this.getMessageFromWorker(t,d.hudConfig.workerMessageTimeout,!1,e);if(n?.msg!==t||void 0===n?.content)throw new Error(`Unexpected message from worker: ${n}`);(0,f.setInvestigationDurationThresholds)(n?.content),T.debug("Endpoints durations investigation thresholds updated",{thresholds:n?.content})}catch(e){T.error("Failed getting endpoints durations investigation thresholds from worker",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}async periodicGetEndpointsDurationsInvestigationThresholds(){await this.updateEndpointDurationsInvestigationThresholds(),await(0,u.safeUnrefInterval)(()=>this.updateEndpointDurationsInvestigationThresholds(),d.hudConfig.endpointsDurationsInvestigationThresholdsInterval,{signal:this.abortController.signal,onError:e=>T.error("Failed updating endpoints durations investigation thresholds",{msg:e.message,stack:e.stack})})}async updateRefreshRemoteConfig(){const e="RefreshRemoteConfig",t={msg:"RefreshRemoteConfig"};try{const n=await this.getMessageFromWorker(e,d.hudConfig.workerMessageTimeout,!1,t);if(n?.msg!==e||void 0===n?.content)return;(0,d.refreshInvestigationEnabled)(n.content,d.hudConfig,T),(0,d.refreshInvestigationErrorStatusCodeRegex)(n.content,d.hudConfig,T)}catch(e){T.error("Failed refreshing remote config from worker",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}async periodicRefreshRemoteConfig(){await(0,u.safeUnrefInterval)(()=>this.updateRefreshRemoteConfig(),d.hudConfig.remoteConfigRefreshInterval,{signal:this.abortController.signal,onError:e=>T.error("Failed refreshing remote config",{msg:e.message,stack:e.stack})})}async delayedStateCollection(){await this.setupPeriodicTask(0,d.hudConfig.workerStateCollectionDelay,()=>{try{this.updateTsNodeConfig()&&T.info("ts-node config updated from delayed task")}catch(e){T.error("Failed collecting state from delayed task",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return!0},"delayedStateCollection",2)}sendProcessedFiles(){const e=function(){const e=globalThis.hudProcessedFiles;return globalThis.hudProcessedFiles=[],e}();this._sendArray("ProcessedFiles",e)}sendKafkaTopics(){const e=(0,y.getKafkaJSTopics)();this._sendArray("KafkaJSTopics",e)}sendSqsQueues(){const e=(0,y.getSqsQueues)();e.length>0&&this._sendArray("SqsQueue",e)}sendGenericDeclarations(){const e=(0,y.getGenericDeclarationsFromStorage)();e.length>0&&this._sendArray("GenericFlowDeclaration",e)}sendGraphQLOperations(){const e=Object.values((0,y.getGraphQLOperations)());e.length>0&&this._sendArray("GraphQLDeclaration",e)}sendInvocations(e){const t=this.elapsedTimesliceMs((0,p.getLastPrepCallsTimestamp)()),n=(0,p.prepCalls)(t,e);n.length>0&&this._sendArray("Invocations",n)}sendFlowMetrics(){const e=this.elapsedTimesliceMs((0,f.getLastSendFlowMetricsTimestamp)()),t=(0,f.getFlowMetrics)(e);Object.keys(t).length>0&&this._sendObject("FlowMetrics",{aggregatedMetrics:t})}sendThreadPerformanceMetrics(){const e=(0,m.collectThreadPerformance)(this.threadStatsBaseline,T,"MainThread");e&&this._sendObject("PerformanceMetrics",e)}sendStaticNextJsEndpointsIfReady(){return!(!(0,g.isNextJsApp)()||!(0,y.isNextConfigExtracted)()||this.staticNextJsEndpointsSent||(this.staticNextJsEndpointsSent=!0,this._sendObject("StaticNextJsEndpoints",{NextConfig:JSON.stringify((0,y.getNextConfig)())}),0))}async periodicSendProcessedFiles(){const e=d.hudConfig.dynamicConfig.aggregationFirstSendTimeout,t=d.hudConfig.dynamicConfig.aggregationInterval;await this.setupPeriodicTask(e,t,()=>(this.sendProcessedFiles(),!0),"periodicSendProcessedFiles")}async periodicSendKafkaJS(){const e=d.hudConfig.dynamicConfig.aggregationFirstSendTimeout,t=d.hudConfig.dynamicConfig.aggregationInterval;await this.setupPeriodicTask(e,t,()=>(this.sendKafkaTopics(),!0),"periodicSendKafkaJS")}async periodicSendSqs(){const e=d.hudConfig.dynamicConfig.aggregationFirstSendTimeout,t=d.hudConfig.dynamicConfig.aggregationInterval;await this.setupPeriodicTask(e,t,()=>(this.sendSqsQueues(),!0),"periodicSendSqs")}async periodicSendGraphQL(){const e=d.hudConfig.dynamicConfig.aggregationFirstSendTimeout,t=d.hudConfig.dynamicConfig.aggregationInterval;await this.setupPeriodicTask(e,t,()=>(this.sendGraphQLOperations(),!0),"periodicSendGraphQL")}async periodicSendGenericDeclarations(){const e=d.hudConfig.dynamicConfig.aggregationFirstSendTimeout,t=d.hudConfig.dynamicConfig.aggregationInterval;await this.setupPeriodicTask(e,t,()=>(this.sendGenericDeclarations(),!0),"periodicSendGenericDeclarations")}async periodicSendMetrics(){const e=new h.SketchManager(d.hudConfig.huddBinWidth),t=d.hudConfig.dynamicConfig.aggregationFirstSendTimeout,n=d.hudConfig.dynamicConfig.aggregationInterval;await this.setupPeriodicTask(t,n,()=>{try{this.refreshInvestigations()}catch(e){T.error("Failed sending investigations",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}const t=(0,u.isForensicsOnly)();try{const n=this.elapsedTimesliceMs((0,p.getLastPrepCallsTimestamp)()),s=(0,p.prepCalls)(n,e);!t&&s.length>0&&this._sendArray("Invocations",s)}catch(e){T.error("Failed sending invocations",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}try{const e=this.elapsedTimesliceMs((0,f.getLastSendFlowMetricsTimestamp)()),n=(0,f.getFlowMetrics)(e);!t&&Object.keys(n).length>0&&this._sendObject("FlowMetrics",{aggregatedMetrics:n})}catch(e){T.error("Failed sending flow metrics",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return!0},"periodicSendMetrics")}async periodicSendDetachedFunctions(){if(!d.hudConfig.dynamicConfig.functionDetachEnabled||d.hudConfig.userConfig.disableDetachedFunctions?.value)return;const e=d.hudConfig.dynamicConfig.aggregationFirstSendTimeout,t=d.hudConfig.dynamicConfig.aggregationInterval;await this.setupPeriodicTask(e,t,()=>{try{const e=(0,p.getAndClearDetachedFunctions)();e.length>0&&this._sendArray("DetachedFunctions",e)}catch(e){T.error("Failed sending detached functions",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return!0},"periodicSendDetachedFunctions")}async fetchKnownDetachedFunctions(){try{const e=await this.getKnownDetachedFunctions();e&&e.length>0&&(0,p.applyKnownDetachedFunctions)(e)}catch(e){T.error("Failed fetching known detached functions",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}async periodicFetchKnownDetachedFunctions(){d.hudConfig.dynamicConfig.functionDetachEnabled&&!d.hudConfig.userConfig.disableDetachedFunctions?.value&&await(0,u.safeUnrefInterval)(()=>this.fetchKnownDetachedFunctions(),d.hudConfig.dynamicConfig.aggregationInterval,{signal:this.abortController.signal,onError:e=>T.error("Failed fetching known detached functions",{msg:e.message,stack:e.stack})})}async highFrequencySendInvestigations(){if(!d.hudConfig.dynamicConfig.enableInvestigation)return;const e=d.hudConfig.dynamicConfig.investigationFirstSendTimeout,t=d.hudConfig.dynamicConfig.investigationInterval;await this.setupPeriodicTask(e,t,()=>(this.refreshInvestigations(),!0),"highFrequencySendInvestigations")}refreshInvestigations(){const e=(0,y.getClosedInvestigations)();e.length>0&&this._sendArray("Investigations",e)}async periodicSendEndpoints(){const e=d.hudConfig.endpointsFirstSendWaitTime,t=d.hudConfig.endpointsInterval;await this.setupPeriodicTask(e,t,()=>(this.sendEndpoints(),!0),"periodicSendEndpoints")}async periodicSendOutbounds(){const e=d.hudConfig.dynamicConfig.aggregationFirstSendTimeout,t=d.hudConfig.dynamicConfig.aggregationInterval;await this.setupPeriodicTask(e,t,()=>(this.sendOutbounds(),!0),"periodicSendOutbounds")}sendEndpoints(){(0,f.collectExpressEndpointDeclarations)();const e=(0,f.getEndpointDeclarationsFromStorage)();e.length>0&&this._sendArray("EndpointDeclaration",e)}sendOutbounds(){const e=(0,k.getLoadedOutboundsFromStorage)();e.length>0&&this._sendArray("LoadedOutbounds",e);const t=(0,k.getIoredisCommandsFromStorage)();t.length>0&&this._sendArray("IoredisCommands",t)}elapsedTimesliceMs(e){const t=null===e?d.hudConfig.dynamicConfig.aggregationInterval:Number(process.hrtime.bigint()-e)/1e6;return Math.max(1,t)}flushAllPendingData(){const e=new h.SketchManager(d.hudConfig.huddBinWidth),t=[{label:"investigations",fn:()=>this.refreshInvestigations()},{label:"invocations",fn:()=>this.sendInvocations(e)},{label:"flow metrics",fn:()=>this.sendFlowMetrics()},{label:"processed files",fn:()=>this.sendProcessedFiles()},{label:"endpoints",fn:()=>{this.sendEndpoints(),this.sendOutbounds()}},{label:"Kafka topics",fn:()=>this.sendKafkaTopics()},{label:"SQS queues",fn:()=>this.sendSqsQueues()},{label:"Generic declarations",fn:()=>this.sendGenericDeclarations()},{label:"GraphQL declarations",fn:()=>this.sendGraphQLOperations()},{label:"static Next.js endpoints",fn:()=>{this.sendStaticNextJsEndpointsIfReady()}},{label:"thread performance metrics",fn:()=>this.sendThreadPerformanceMetrics()}];for(const e of t)try{e.fn()}catch(t){T.error(`Failed flushing ${e.label}`,{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0})}}async sendTerminateAndAwait(e){const t=a.getSavedLogs();try{await this.getMessageFromWorker("terminated",e.grace,e.shouldRef,{msg:"Terminate",content:{grace:e.grace,logBuffers:t}})}catch(t){t instanceof m.HudTimeoutError?(T.critical(e.timeoutLogMsg,{error:t.message}),await this.worker.terminate()):(T.critical(e.unexpectedLogMsg,{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0}),await this.worker.terminate())}}async gracefulShutdown(){if(!this.gracefulShutdownDone){this.gracefulShutdownDone=!0;try{this.abortController.abort(),this.abortController=new AbortController,d.hudConfig.communicationKeepalive&&this.workerKeepaliveGuard.stop(),this.worker.ref(),await this.flushNow(),await this.sendTerminateAndAwait({grace:d.hudConfig.teardownGrace,shouldRef:!0,timeoutLogMsg:"Teardown grace timeout - terminating worker",unexpectedLogMsg:"Unexpected error during SDK graceful shutdown"})}finally{try{this.worker.unref()}catch{}this.stop()}}}async terminateWorker(){await this.sendTerminateAndAwait({grace:d.hudConfig.workerGrace,shouldRef:!1,timeoutLogMsg:"Grace period timeout - terminating worker",unexpectedLogMsg:"Unexpected error during worker termination"}),T.info("Worker terminated successfully.")}async sendRuntime(){const e={nodeVersion:process.version,nodeDependencyVersions:process.versions,platform:process.platform,architecture:process.arch,pid:process.pid,cwd:process.cwd(),execPath:process.execPath,execArgv:process.execArgv,argv:process.argv,uptime:process.uptime(),mainModulePath:n.c[n.s]?.filename};this._sendObject("Runtime",e)}async startPeriodicTasks(){this._sendObject("StartPeriodicTasks",{})}async sendPreloadedModules(){globalThis.hudLoadedModules?this._sendObject("PreInitLoadedModules",{modules:globalThis.hudLoadedModules}):T.warning("Didn't get module, weird....")}async periodicSendThreadPerformanceMetrics(){const e=d.hudConfig.dynamicConfig.performanceMetricsInterval;await(0,u.safeUnrefInterval)(()=>this.sendThreadPerformanceMetrics(),e,{signal:this.abortController.signal,onError:e=>T.error("Failed sending thread performance metrics",{msg:e.message,stack:e.stack})})}async dumpModulesAfterWhile(e){await(0,u.unrefSetTimeout)(e,void 0,{signal:this.abortController.signal});const t=Object.keys(w.myRequire.cache);this._sendObject("PostInitLoadedModules",{modules:t})}async sendPatchedModules(){if(!globalThis.hudPatched)return void T.error("Cant find patched modules");const e=Array.from(globalThis.hudPatched);this._sendObject("PatchedModules",{modules:e})}async handleLogsTask(){try{const e=a.getSavedLogs();for(const t of e)try{this._sendObject("Logs",{logs:t})}catch(e){T.error("Failed send logs to worker",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}catch(e){T.error("Failed send logs to worker",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}async flush(){if(this.flushInFlight)return void await this.flushInFlight;const e=Date.now();void 0!==this.lastManualFlushTimestampMs&&e-this.lastManualFlushTimestampMs<d.hudConfig.dynamicConfig.aggregationInterval?this.logManualFlushTooFrequent():(this.lastManualFlushTimestampMs=e,await this.flushNow())}logManualFlushTooFrequent(){this.didLogManualFlushTooFrequent||(this.didLogManualFlushTooFrequent=!0,T.warning("flush() called more frequently than aggregation interval",{aggregationInterval:d.hudConfig.dynamicConfig.aggregationInterval}),a.customer_logger.logEntry(m.UserErrorLogs.FlushCalledTooFrequently(d.hudConfig.dynamicConfig.aggregationInterval)))}async flushNow(){if(this.flushInFlight)await this.flushInFlight;else{this.flushInFlight=this._flush();try{await this.flushInFlight}finally{this.flushInFlight=void 0}}}async _flush(){const e=++this.flushCounter;try{this.flushAllPendingData(),await this.handleLogsTask(),await this.getMessageFromWorker(`flushed:${e}`,d.hudConfig.teardownGrace,!0,{msg:"Flush",content:{flushId:e}})}catch(e){T.error("Failed flushing SDK data",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}async sendLogsPeriodically(e){await(0,u.safeUnrefInterval)(()=>this.handleLogsTask(),e,{signal:this.abortController.signal,onError:e=>T.error("Failed sending logs periodically",{msg:e.message,stack:e.stack})})}async setupPeriodicTask(e,t,n,s,i=0){function r(e){let t=!0;try{t=n(e)}catch(e){T.error("Failed in periodic task",{taskName:s,msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return t}if(await(0,u.unrefSetTimeout)(e,void 0,{signal:this.abortController.signal}),!r(e))return void T.warning("Periodic task failed, stopping task",{firstRun:!0,taskName:s});if(1===i)return;let o=i>0?i-1:0;await(0,u.safeUnrefInterval)(e=>{if(!r(t))return T.warning("Periodic task failed, stopping task",{firstRun:!1,taskName:s}),void e();o>0&&0===--o&&e()},t,{signal:this.abortController.signal,onError:e=>T.error("Failed in periodic task interval",{taskName:s,msg:e.message,stack:e.stack})})}async periodicResetGlobalInvestigationCounter(){const e=d.hudConfig.dynamicConfig.investigationRateLimits.totalInvestigationTimeWindowMs;await(0,u.safeUnrefInterval)(()=>{T.info("Resetting global investigation counter",{interval:e}),(0,y.setGlobalInvestigationTracking)(0),(0,f.resetTotalInvestigationsDurationBased)(),(0,f.resetTotalInvestigationsErrorBased)()},e,{signal:this.abortController.signal,onError:e=>T.error("Failed resetting global investigation counter",{msg:e.message,stack:e.stack})})}async periodicResetInvestigationDedupingCache(){const e=d.hudConfig.dynamicConfig.investigationRateLimits.sameInvestigationTimeWindowMs;await(0,u.safeUnrefInterval)(()=>{T.info("Resetting investigation deduping cache",{interval:e}),(0,y.resetInvestigationDedupingCache)(),(0,f.resetInvestigationDurationCounts)(),(0,f.getUniqueSetFailureErrors)().clear()},e,{signal:this.abortController.signal,onError:e=>T.error("Failed resetting investigation deduping cache",{msg:e.message,stack:e.stack})})}updateTsNodeConfig(){if(this.tsNodeUpdated)return!1;try{const e=(0,b.getUserTsNodeConfig)();return!!e&&(this.tsNodeUpdated=!0,T.info("tsconfig found, sending config to worker"),this._sendObject("TsNodeConfig",{tsConfig:e}),!0)}catch(e){throw this.tsNodeUpdated=!0,this.stop(),e instanceof m.HudError&&(0,m.setFirstError)(e.code),(0,C._detachAndTerminate)(!1),e}}async sendStaticNextJsEndpointsOnce(){if(!(0,g.isNextJsApp)())return;const e=d.hudConfig.staticNextJsEndpointsInterval,t=d.hudConfig.staticNextJsEndpointsMaxAttempts;let n=0;await(0,u.safeUnrefInterval)(e=>{if(n++,T.debug("Attempting to send static next.js endpoints",{attemptCount:n}),this.sendStaticNextJsEndpointsIfReady())return T.info("Sent static next.js endpoints"),void e();n>t&&(T.warning("Exceeded max attempts to send static next.js endpoints",{isNextConfigExtracted:(0,y.isNextConfigExtracted)(),attemptCount:n}),e())},e,{signal:this.abortController.signal,onError:e=>T.error("Failed sending static next.js endpoints",{msg:e.message,stack:e.stack})})}async periodicSendReingest(){await(0,u.safeUnrefInterval)(()=>{const e=(0,f.getAndClearReingestValues)();e.size>0&&this._sendArray("Reingest",Array.from(e))},d.hudConfig.dynamicConfig.reingestInterval,{signal:this.abortController.signal,onError:e=>T.error("Failed sending reingest",{msg:e.message,stack:e.stack})})}}},8167:e=>{e.exports=require("worker_threads")},8269:e=>{e.exports=require("./globalstate")},8528:e=>{e.exports=require("./dto")},9269:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.setUnknownAsyncContextTypesInterval=function(){const e=setInterval(()=>{try{const e=(0,i.getUnknownAsyncContextTypes)();if(0===e.size)return;const t=[];for(const n of e)o.has(n)||(o.add(n),t.push(n));t.length>0&&r.instrument_logger.warning("Encountered unknown async context type(s) without caller propagation",{types:t})}catch(e){r.instrument_logger.error("Error logging unknown async context types",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}},s.hudConfig.logIntervals.unknownAsyncContextTypes);return e.unref(),e};const s=n(5809),i=n(8269),r=n(523),o=new Set}},t={};function n(s){var i=t[s];if(void 0!==i)return i.exports;var r=t[s]={exports:{}};return e[s].call(r.exports,r,r.exports,n),r.exports}return n.c=t,n(n.s=5119)})());
//# sourceMappingURL=core.js.map