hud-sdk 1.8.10 → 1.8.12

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.
@@ -385,56 +385,85 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
385
385
 
386
386
  --------------------------------------------------------------------------------
387
387
 
388
- Package: typescript
389
- License: Apache-2.0
390
- Repository: https://github.com/microsoft/TypeScript
388
+ Package: strnum
389
+ License: MIT
390
+ Repository: https://github.com/NaturalIntelligence/strnum
391
391
 
392
- Apache License
392
+ MIT License
393
393
 
394
- Version 2.0, January 2004
394
+ Copyright (c) 2021 Natural Intelligence
395
395
 
396
- http://www.apache.org/licenses/
396
+ Permission is hereby granted, free of charge, to any person obtaining a copy
397
+ of this software and associated documentation files (the "Software"), to deal
398
+ in the Software without restriction, including without limitation the rights
399
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
400
+ copies of the Software, and to permit persons to whom the Software is
401
+ furnished to do so, subject to the following conditions:
397
402
 
398
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
403
+ The above copyright notice and this permission notice shall be included in all
404
+ copies or substantial portions of the Software.
399
405
 
400
- 1. Definitions.
406
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
407
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
408
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
409
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
410
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
411
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
412
+ SOFTWARE.
401
413
 
402
- "License" shall mean the terms and conditions for use, reproduction, and
403
- distribution as defined by Sections 1 through 9 of this document.
404
414
 
405
- "Licensor" shall mean the copyright owner or entity authorized by the copyright
406
- owner that is granting the License.
415
+ --------------------------------------------------------------------------------
416
+
417
+ Package: typescript
418
+ License: Apache-2.0
419
+ Repository: https://github.com/microsoft/TypeScript
407
420
 
421
+ Apache License
422
+
423
+ Version 2.0, January 2004
424
+
425
+ http://www.apache.org/licenses/
426
+
427
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
428
+
429
+ 1. Definitions.
430
+
431
+ "License" shall mean the terms and conditions for use, reproduction, and
432
+ distribution as defined by Sections 1 through 9 of this document.
433
+
434
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright
435
+ owner that is granting the License.
436
+
408
437
  "Legal Entity" shall mean the union of the acting entity and all other entities
409
438
  that control, are controlled by, or are under common control with that entity.
410
439
  For the purposes of this definition, "control" means (i) the power, direct or
411
440
  indirect, to cause the direction or management of such entity, whether by
412
441
  contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
413
- outstanding shares, or (iii) beneficial ownership of such entity.
414
-
442
+ outstanding shares, or (iii) beneficial ownership of such entity.
443
+
415
444
  "You" (or "Your") shall mean an individual or Legal Entity exercising
416
- permissions granted by this License.
417
-
445
+ permissions granted by this License.
446
+
418
447
  "Source" form shall mean the preferred form for making modifications, including
419
448
  but not limited to software source code, documentation source, and
420
- configuration files.
421
-
449
+ configuration files.
450
+
422
451
  "Object" form shall mean any form resulting from mechanical transformation or
423
452
  translation of a Source form, including but not limited to compiled object
424
- code, generated documentation, and conversions to other media types.
425
-
453
+ code, generated documentation, and conversions to other media types.
454
+
426
455
  "Work" shall mean the work of authorship, whether in Source or Object form,
427
456
  made available under the License, as indicated by a copyright notice that is
428
457
  included in or attached to the work (an example is provided in the Appendix
429
- below).
430
-
458
+ below).
459
+
431
460
  "Derivative Works" shall mean any work, whether in Source or Object form, that
432
461
  is based on (or derived from) the Work and for which the editorial revisions,
433
462
  annotations, elaborations, or other modifications represent, as a whole, an
434
463
  original work of authorship. For the purposes of this License, Derivative Works
435
464
  shall not include works that remain separable from, or merely link (or bind by
436
- name) to the interfaces of, the Work and Derivative Works thereof.
437
-
465
+ name) to the interfaces of, the Work and Derivative Works thereof.
466
+
438
467
  "Contribution" shall mean any work of authorship, including the original
439
468
  version of the Work and any modifications or additions to that Work or
440
469
  Derivative Works thereof, that is intentionally submitted to Licensor for
@@ -446,19 +475,19 @@ but not limited to communication on electronic mailing lists, source code
446
475
  control systems, and issue tracking systems that are managed by, or on behalf
447
476
  of, the Licensor for the purpose of discussing and improving the Work, but
448
477
  excluding communication that is conspicuously marked or otherwise designated in
449
- writing by the copyright owner as "Not a Contribution."
450
-
478
+ writing by the copyright owner as "Not a Contribution."
479
+
451
480
  "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
452
481
  of whom a Contribution has been received by Licensor and subsequently
453
- incorporated within the Work.
454
-
482
+ incorporated within the Work.
483
+
455
484
  2. Grant of Copyright License. Subject to the terms and conditions of this
456
485
  License, each Contributor hereby grants to You a perpetual, worldwide,
457
486
  non-exclusive, no-charge, royalty-free, irrevocable copyright license to
458
487
  reproduce, prepare Derivative Works of, publicly display, publicly perform,
459
488
  sublicense, and distribute the Work and such Derivative Works in Source or
460
- Object form.
461
-
489
+ Object form.
490
+
462
491
  3. Grant of Patent License. Subject to the terms and conditions of this
463
492
  License, each Contributor hereby grants to You a perpetual, worldwide,
464
493
  non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
@@ -471,23 +500,23 @@ litigation against any entity (including a cross-claim or counterclaim in a
471
500
  lawsuit) alleging that the Work or a Contribution incorporated within the Work
472
501
  constitutes direct or contributory patent infringement, then any patent
473
502
  licenses granted to You under this License for that Work shall terminate as of
474
- the date such litigation is filed.
475
-
503
+ the date such litigation is filed.
504
+
476
505
  4. Redistribution. You may reproduce and distribute copies of the Work or
477
506
  Derivative Works thereof in any medium, with or without modifications, and in
478
- Source or Object form, provided that You meet the following conditions:
479
-
507
+ Source or Object form, provided that You meet the following conditions:
508
+
480
509
  You must give any other recipients of the Work or Derivative Works a copy of
481
- this License; and
482
-
510
+ this License; and
511
+
483
512
  You must cause any modified files to carry prominent notices stating that You
484
- changed the files; and
485
-
513
+ changed the files; and
514
+
486
515
  You must retain, in the Source form of any Derivative Works that You
487
516
  distribute, all copyright, patent, trademark, and attribution notices from the
488
517
  Source form of the Work, excluding those notices that do not pertain to any
489
- part of the Derivative Works; and
490
-
518
+ part of the Derivative Works; and
519
+
491
520
  If the Work includes a "NOTICE" text file as part of its distribution, then any
492
521
  Derivative Works that You distribute must include a readable copy of the
493
522
  attribution notices contained within such NOTICE file, excluding those notices
@@ -505,20 +534,20 @@ modifications and may provide additional or different license terms and
505
534
  conditions for use, reproduction, or distribution of Your modifications, or for
506
535
  any such Derivative Works as a whole, provided Your use, reproduction, and
507
536
  distribution of the Work otherwise complies with the conditions stated in this
508
- License.
509
-
537
+ License.
538
+
510
539
  5. Submission of Contributions. Unless You explicitly state otherwise, any
511
540
  Contribution intentionally submitted for inclusion in the Work by You to the
512
541
  Licensor shall be under the terms and conditions of this License, without any
513
542
  additional terms or conditions. Notwithstanding the above, nothing herein shall
514
543
  supersede or modify the terms of any separate license agreement you may have
515
- executed with Licensor regarding such Contributions.
516
-
544
+ executed with Licensor regarding such Contributions.
545
+
517
546
  6. Trademarks. This License does not grant permission to use the trade names,
518
547
  trademarks, service marks, or product names of the Licensor, except as required
519
548
  for reasonable and customary use in describing the origin of the Work and
520
- reproducing the content of the NOTICE file.
521
-
549
+ reproducing the content of the NOTICE file.
550
+
522
551
  7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
523
552
  writing, Licensor provides the Work (and each Contributor provides its
524
553
  Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -526,8 +555,8 @@ KIND, either express or implied, including, without limitation, any warranties
526
555
  or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
527
556
  PARTICULAR PURPOSE. You are solely responsible for determining the
528
557
  appropriateness of using or redistributing the Work and assume any risks
529
- associated with Your exercise of permissions under this License.
530
-
558
+ associated with Your exercise of permissions under this License.
559
+
531
560
  8. Limitation of Liability. In no event and under no legal theory, whether in
532
561
  tort (including negligence), contract, or otherwise, unless required by
533
562
  applicable law (such as deliberate and grossly negligent acts) or agreed to in
@@ -537,8 +566,8 @@ character arising as a result of this License or out of the use or inability to
537
566
  use the Work (including but not limited to damages for loss of goodwill, work
538
567
  stoppage, computer failure or malfunction, or any and all other commercial
539
568
  damages or losses), even if such Contributor has been advised of the
540
- possibility of such damages.
541
-
569
+ possibility of such damages.
570
+
542
571
  9. Accepting Warranty or Additional Liability. While redistributing the Work or
543
572
  Derivative Works thereof, You may choose to offer, and charge a fee for,
544
573
  acceptance of support, warranty, indemnity, or other liability obligations
@@ -547,9 +576,9 @@ obligations, You may act only on Your own behalf and on Your sole
547
576
  responsibility, not on behalf of any other Contributor, and only if You agree
548
577
  to indemnify, defend, and hold each Contributor harmless for any liability
549
578
  incurred by, or claims asserted against, such Contributor by reason of your
550
- accepting any such warranty or additional liability.
551
-
552
- END OF TERMS AND CONDITIONS
579
+ accepting any such warranty or additional liability.
580
+
581
+ END OF TERMS AND CONDITIONS
553
582
 
554
583
 
555
584
  --------------------------------------------------------------------------------
package/api.d.ts CHANGED
@@ -3,6 +3,11 @@
3
3
  export type UserContext = {
4
4
  [key: string]: string | number | boolean | string[] | number[];
5
5
  };
6
+ export type FlowHandler<Args extends unknown[], T> = (...args: Args) => T;
7
+ export declare function setHttpFlow(route: string, method: string): void;
8
+ export declare function startFlow(flowName: string): void;
9
+ export declare function endFlow(failureReason?: string): void;
10
+ export declare function wrapFlow<Args extends unknown[], T>(flowName: string, handler: FlowHandler<Args, T>): FlowHandler<Args, T>;
6
11
  export declare function setContext(context: UserContext): void;
7
12
  export declare function setFailure(error: string, context?: UserContext): void;
8
13
 
package/dist/cjs/api.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 n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(global,()=>(()=>{"use strict";var e={523:e=>{e.exports=require("./logger")},2546:e=>{e.exports=require("./lib")},2987:e=>{e.exports=require("perf_hooks")},5809:e=>{e.exports=require("./config")},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){globalThis.hudEnableInvestigation&&i.push(e)},t.setGlobalInvestigationTracking=function(e){t.globalInvestigationTracking=e},t.increaseGlobalInvestigationTracking=function(){t.globalInvestigationTracking++},t.getGlobalInvestigationTracking=function(){return t.globalInvestigationTracking},t.increaseInvestigationDedupingCache=function(e,t){const n=a.get(e)??new Map,r=(n.get(t)??0)+1;n.set(t,r),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=o.performance.eventLoopUtilization();s.push({cpuUsage:e,elu:t,timestamp:Date.now()}),s.length>r.hudConfig.machineMetricsSavedLength&&s.shift()},t.getLastMetrics=function(){return s[0]},t.setInvestigationDurationThresholds=function(e){g=e},t.getFlowIdDurationThresholdAndCount=function(e){return g[e]},t.increaseInvestigationDurationCount=function(e){const t=u.get(e)??0;u.set(e,t+1)},t.getInvestigationDurationCount=function(e){return u.get(e)??0},t.resetInvestigationDurationCounts=function(){u.clear()},t.increaseTotalInvestigationsErrorBased=function(){c++},t.getTotalInvestigationsErrorBased=function(){return c},t.resetTotalInvestigationsErrorBased=function(){c=0},t.increaseTotalInvestigationsDurationBased=function(){l++},t.getTotalInvestigationsDurationBased=function(){return l},t.resetTotalInvestigationsDurationBased=function(){l=0},t.getUniqueSetFailureErrors=function(){return d};const r=n(5809),o=n(2987);let i=[];t.globalInvestigationTracking=0;const a=new Map,s=[];let g={};const u=new Map;let c=0,l=0;const d=new Set},8528:e=>{e.exports=require("./dto")}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.setContext=C,e.setFailure=function(e,n){try{const r=(0,s.getInvestigationStorage)();if(void 0===r)return void(f||(a.app_logger.warning("setFailure - No Storage"),a.customer_logger.logEntry(i.UserErrorLogs.SetFailureBeforeRegister()),f=!0));if(!t.hudConfig.dynamicConfig.enableInvestigation)return;const u=r.getStore();if(void 0===u||u.status!==o.InvestigationStatus.Open)return void(p||(a.app_logger.warning("setFailure called not inside async context. Skipping."),a.customer_logger.logEntry(i.UserErrorLogs.SetFailureNoAsyncContext()),p=!0));if("string"!=typeof e)return void a.customer_logger.logEntry(i.UserErrorLogs.SetFailureErrorNotString());if(0===e.length)return void a.customer_logger.logEntry(i.UserErrorLogs.SetFailureErrorEmpty());let c=e;if(e.length>E&&(a.customer_logger.logEntry(i.UserErrorLogs.SetFailureErrorTooLong()),c=e.substring(0,E)),!(0,g.getUniqueSetFailureErrors)().has(c)){const e=t.hudConfig.dynamicConfig.investigationRateLimits.maxUniqueSetFailureErrors;(0,g.getUniqueSetFailureErrors)().size>=e&&(v||(a.customer_logger.logEntry(i.UserErrorLogs.SetFailureUniqueErrorLimitReached(e)),(0,a.limitedLogger)("setFailure: max unique errors reached",{error:c}),v=!0),c=x),(0,g.getUniqueSetFailureErrors)().add(c)}u.data.userDefinedError=c,void 0!==n&&C(n)}catch(e){a.app_logger.warning("failed to set failure. Skipping.",{error:e,stack:e instanceof Error&&null!==e?e.stack:void 0})}};const t=n(5809),o=n(8528),i=n(2546),a=n(523),s=n(7131),g=n(7398);let u=!1,c=!1,l=!1,d=!1,f=!1,p=!1,v=!1;const E=1024,x="HUD_MAX_ERRORS_REACHED";function C(e){try{const n=(0,s.getInvestigationStorage)();if(void 0===n)return void(l||(a.app_logger.warning("HudContext warning: No Storage"),a.customer_logger.logEntry(i.UserErrorLogs.SetContextBeforeRegister()),l=!0));if(!t.hudConfig.dynamicConfig.enableInvestigation)return;const r=n.getStore();if(void 0===r||r.status!==o.InvestigationStatus.Open)return void(u||(a.app_logger.warning("HudContext warning: setContext called not inside async context. Skipping."),a.customer_logger.logEntry(i.UserErrorLogs.SetContextNoAsyncContext()),u=!0));const g=(0,i.validateContext)(e);r.data.userContext={...r.data.userContext,...g}}catch(e){if(e instanceof i.HudContextValidationError)return void(d||(a.app_logger.warning("HudContext warning: failed to validate context. Skipping.",{error:e,stack:e instanceof Error&&null!==e?e.stack:void 0}),d=!0));c||(a.app_logger.warning("HudContext warning: failed to set context. Skipping.",{error:e,stack:e instanceof Error&&null!==e?e.stack:void 0}),c=!0)}}})(),r})());
1
+ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var o in r)("object"==typeof exports?exports:t)[o]=r[o]}}(global,()=>(()=>{"use strict";var t={523:t=>{t.exports=require("./logger")},2030:t=>{t.exports=require("./instrument")},2546:t=>{t.exports=require("./lib")},4074:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.setHttpFlow=function(t,e){try{if(v())return;if(!c(t)||!c(e))return void p("setHttpFlow");if(void 0===(0,u.getFlowStateStorage)())return void w("setHttpFlow");const r=(0,u.getFlowState)();if(void 0===r?.httpMetric)return void f("setHttpFlow:no-http-context","setHttpFlow called outside an HTTP flow. Skipping.",s.UserErrorLogs.SetHttpFlowNoHttpContext());const o=e.toLowerCase(),a=e.toUpperCase(),l=(0,s.generateEndpointFlowId)(t,[o]),d=l;g.has(d)||(g.add(d),(0,i.storeEndpointDeclaration)(new n.EndpointDeclaration(l,[o],"manual","",t))),r.httpMetric.setFlowId(l),r.httpMetric.setRequestAttributes({method:a}),r.flowId=l}catch(t){(0,l.limitedLogger)("Failed to set http flow",{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0})}},e.startFlow=function(t){try{if(v())return;if(!c(t))return void p("startFlow");const e=(0,u.getFlowStateStorage)();if(void 0===e)return void w("startFlow");const r=(0,u.getFlowState)();if(F("startFlow",r))return;const o=function(t,e){const r=E(t);if(void 0===r)return;const o=a.CustomFlowMetric.createUsableMetric(r),n=e??{};return n.manualFlowMetric=o,n.manualFlowName=t,n.flowId=r,{state:n,metric:o}}(t,r);if(void 0===o)return;e.enterWith(o.state),o.metric.start(),(0,a.createNewInvestigation)()}catch(t){(0,l.limitedLogger)("Failed to start manual flow",{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0})}},e.endFlow=function(t){try{if(v())return;if(void 0===(0,u.getFlowStateStorage)())return void w("endFlow");const e=(0,u.getFlowState)(),r=e?.manualFlowMetric;if(void 0===e||void 0===r)return void f("endFlow:no-start-flow","endFlow called without an active startFlow flow. Skipping.",s.UserErrorLogs.EndFlowNoStartedFlow());m(e,t)}catch(t){(0,l.limitedLogger)("Failed to end manual flow",{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0})}},e.wrapFlow=function(t,e){try{if(v())return e;if(!c(t))return p("wrapFlow"),e;if(void 0===(0,u.getFlowStateStorage)())return w("wrapFlow"),e;const r=E(t);if(void 0===r)return e;const o=()=>{if(!v()&&!F("wrapFlow",(0,u.getFlowState)()))return r},n=(e,r)=>{if(!e)return;if(void 0===(0,u.getFlowStateStorage)())return;const o=a.CustomFlowMetric.createUsableMetric(e),n={};return n.manualFlowMetric=o,n.manualFlowName=t,r.state=n,o.start(),(0,a.createNewInvestigation)(),n},i=(t,e)=>{m(e.state)},s=(t,e,r)=>{m(e.state,function(t){return t instanceof Error&&t.name?t.name:"Error"}(r))};return(0,a.wrapFlow)(o,e,!0,n,i,s)}catch(t){return(0,l.limitedLogger)("Failed to wrap manual flow",{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0}),e}};const o=r(5809),n=r(8528),i=r(8269),a=r(2030),s=r(2546),l=r(523),u=r(7131),g=new Set,d=new Set;function c(t){return"string"==typeof t&&t.length>0}function f(t,e,r){d.has(t)||(l.app_logger.warning(e),l.customer_logger.logEntry(r),d.add(t))}function w(t){f(`${t}:before-register`,`${t} called before register. Skipping.`,s.UserErrorLogs.ManualFlowApiBeforeRegister(t))}function p(t){f(`${t}:invalid-flow-name`,`${t} called with an invalid flow name. Skipping.`,s.UserErrorLogs.ManualFlowApiInvalidFlowName(t))}function F(t,e){return void 0!==e?.httpMetric?(function(t){f(`${t}:inside-http-flow`,`${t} called inside an HTTP flow. Skipping.`,s.UserErrorLogs.CustomFlowApiInsideHttpFlow(t))}(t),!0):(void 0!==e?.manualFlowMetric||void 0!==e?.flowId)&&(function(t){f(`${t}:inside-flow`,`${t} called inside another flow. Skipping.`,s.UserErrorLogs.CustomFlowApiInsideFlow(t))}(t),!0)}function m(t,e){const r=t?.manualFlowMetric;if(void 0!==t&&void 0!==r)try{void 0!==e&&e.length>0&&r.setFailureReason(e),r.calculateDuration(),(0,a.finishCustomFlowInvestigation)(r,t.manualFlowName??""),r.finish()}catch(t){(0,l.limitedLogger)("Failed to finish manual flow metric",{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0})}finally{t.manualFlowMetric=void 0,t.manualFlowName=void 0,t.flowId=void 0,t.shouldLinkFunction=void 0}}function v(){return void 0!==hudRunningMode&&hudRunningMode!==n.HudRunningMode.enabled}function E(t){const e=o.hudConfig.dynamicConfig.maxCustomFlowIds,r=(0,s.generateCustomFlowId)(t);if((0,i.storeCustomFlowDeclarationOnce)({flow_id:r,flow_name:t},e))return r;(0,l.limitedLogger)("Custom flow id limit reached",{flowName:t,maxCustomFlowIds:e})}},5809:t=>{t.exports=require("./config")},7131:t=>{t.exports=require("./wrap")},8269:t=>{t.exports=require("./globalstate")},8528:t=>{t.exports=require("./dto")}},e={};function r(o){var n=e[o];if(void 0!==n)return n.exports;var i=e[o]={exports:{}};return t[o](i,i.exports,r),i.exports}var o={};return(()=>{var t=o;Object.defineProperty(t,"__esModule",{value:!0}),t.wrapFlow=t.startFlow=t.setHttpFlow=t.endFlow=void 0,t.setContext=S,t.setFailure=function(t,r){try{if(E())return;const o=(0,l.getInvestigationStorage)();if(void 0===o)return void(w||(s.app_logger.warning("setFailure - No Storage"),s.customer_logger.logEntry(a.UserErrorLogs.SetFailureBeforeRegister()),w=!0));if(!e.hudConfig.dynamicConfig.enableInvestigation)return;const u=o.getStore();if(void 0===u||u.status!==n.InvestigationStatus.Open)return void(p||(s.app_logger.warning("setFailure called not inside async context. Skipping."),s.customer_logger.logEntry(a.UserErrorLogs.SetFailureNoAsyncContext()),p=!0));if("string"!=typeof t)return void s.customer_logger.logEntry(a.UserErrorLogs.SetFailureErrorNotString());if(0===t.length)return void s.customer_logger.logEntry(a.UserErrorLogs.SetFailureErrorEmpty());let g=t;if(t.length>m&&(s.customer_logger.logEntry(a.UserErrorLogs.SetFailureErrorTooLong()),g=t.substring(0,m)),!(0,i.getUniqueSetFailureErrors)().has(g)){const t=e.hudConfig.dynamicConfig.investigationRateLimits.maxUniqueSetFailureErrors;(0,i.getUniqueSetFailureErrors)().size>=t&&(F||(s.customer_logger.logEntry(a.UserErrorLogs.SetFailureUniqueErrorLimitReached(t)),(0,s.limitedLogger)("setFailure: max unique errors reached",{error:g}),F=!0),g=v),(0,i.getUniqueSetFailureErrors)().add(g)}u.data.userDefinedError=g,void 0!==r&&S(r)}catch(t){s.app_logger.warning("failed to set failure. Skipping.",{error:t,stack:t instanceof Error&&null!==t?t.stack:void 0})}};const e=r(5809),n=r(8528),i=r(8269),a=r(2546),s=r(523),l=r(7131);var u=r(4074);Object.defineProperty(t,"endFlow",{enumerable:!0,get:function(){return u.endFlow}}),Object.defineProperty(t,"setHttpFlow",{enumerable:!0,get:function(){return u.setHttpFlow}}),Object.defineProperty(t,"startFlow",{enumerable:!0,get:function(){return u.startFlow}}),Object.defineProperty(t,"wrapFlow",{enumerable:!0,get:function(){return u.wrapFlow}});let g=!1,d=!1,c=!1,f=!1,w=!1,p=!1,F=!1;const m=1024,v="HUD_MAX_ERRORS_REACHED";function E(){return void 0!==hudRunningMode&&hudRunningMode!==n.HudRunningMode.enabled}function S(t){try{if(E())return;const r=(0,l.getInvestigationStorage)();if(void 0===r)return void(c||(s.app_logger.warning("HudContext warning: No Storage"),s.customer_logger.logEntry(a.UserErrorLogs.SetContextBeforeRegister()),c=!0));if(!e.hudConfig.dynamicConfig.enableInvestigation)return;const o=r.getStore();if(void 0===o||o.status!==n.InvestigationStatus.Open)return void(g||(s.app_logger.warning("HudContext warning: setContext called not inside async context. Skipping."),s.customer_logger.logEntry(a.UserErrorLogs.SetContextNoAsyncContext()),g=!0));const i=(0,a.validateContext)(t);o.data.userContext={...o.data.userContext,...i}}catch(t){if(t instanceof a.HudContextValidationError)return void(f||(s.app_logger.warning("HudContext warning: failed to validate context. Skipping.",{error:t,stack:t instanceof Error&&null!==t?t.stack:void 0}),f=!0));d||(s.app_logger.warning("HudContext warning: failed to set context. Skipping.",{error:t,stack:t instanceof Error&&null!==t?t.stack:void 0}),d=!0)}}})(),o})());
2
2
  //# sourceMappingURL=api.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 s=t();for(var n in s)("object"==typeof exports?exports:e)[n]=s[n]}}(global,()=>(()=>{"use strict";var e={523:e=>{e.exports=require("./logger")},2312:function(e,t,s){var n,r=this&&this.__createBinding||(Object.create?function(e,t,s,n){void 0===n&&(n=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,n,r)}:function(e,t,s,n){void 0===n&&(n=s),e[n]=t[s]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[t.length]=s);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s=n(e),i=0;i<s.length;i++)"default"!==s[i]&&r(t,e,s[i]);return o(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.HudClient=void 0;const a=s(5809),u=s(2546),d=s(523),l=i(s(8938)),c=s(6982),g=s(6261),f=s(9561),h=s(9023),p=s(3106),_=(0,h.promisify)(p.gzip),w="node-sdk",m=(0,c.randomUUID)();class y{sessionId;httpClient;extensionEventEmitter;static config={baseURL:a.hudConfig.sink.url,timeout:a.hudConfig.sink.timeout,headers:{"Content-Type":"application/json"}};static defaultRequest={version:"1.0.0",source:w,event_version:"1.0.0"};constructor(e){this.httpClient=l.default.create(y.config),this.extensionEventEmitter=e}setSession(e){const{sessionId:t,extraHeaders:s}=e;this.sessionId=t,this.httpClient.defaults.headers.common[a.hudConfig.sink.session_attr]=t;try{for(const[e,t]of Object.entries(s))try{this.httpClient.defaults.headers.common[e]=t}catch(s){d.worker_logger.error("Failed to set extra header",{msg:s instanceof Error?s.message:void 0,stack:s instanceof Error?s.stack:void 0,key:e,value:t})}}catch(e){d.worker_logger.error("Failed to set extra headers",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}setExtensionEventEmitter(e){this.extensionEventEmitter=e}async logs(e){const t={logs:e,send_time:(new Date).toISOString()};await this._requestRelentless(a.hudConfig.endpoints.logs,t,"logs"),d.worker_logger.debug("sent logs successfully",{size:e.length})}async sessionslessLogs(e,t,s,n){const r={logs:e,send_time:(new Date).toISOString(),token:t,sdk_version:a.SDK_VERSION,sdk_type:w,sdk_runtime_type:n??"sdk",run_id:s??m};await this._requestRelentless(a.hudConfig.endpoints.sessionslessLogs,r,"sessionslessLogs"),d.worker_logger.debug("sent logs successfully",{size:e.length})}async send(e,t,s={}){const n={...y.defaultRequest,type:e,raw:t,send_time:(new Date).toISOString(),...s};await this._requestRelentless(a.hudConfig.endpoints.send,n,e),d.worker_logger.debug("sent event successfully",{type:e})}async batch(e,t,s={}){const n={...y.defaultRequest,type:e,arr:t,send_time:(new Date).toISOString(),...s};await this._requestRelentless(a.hudConfig.endpoints.batch,n,e),d.worker_logger.debug("sent batched events successfully",{type:e})}async getRemoteConfig(){const e=await this._requestDataRelentless(a.hudConfig.endpoints.getRemoteConfig,{},"getRemoteConfig");return d.worker_logger.info("Received remote configuration from server",{remoteConfiguration:e}),e}async getMode(e){const t={extra:e,send_time:(new Date).toISOString()},s=await this._requestDataRelentless(a.hudConfig.endpoints.getMode,t,"getMode");return d.worker_logger.info("Received mode from server "+s),s}async getKnownDetachedFunctions(){const e={...y.defaultRequest,send_time:(new Date).toISOString()},t=await this._requestDataRelentless(a.hudConfig.endpoints.getKnownDetachedFunctions,e,"getKnownDetachedFunctions");return t?.knownDetachedFunctions||[]}async setDetachedFunctions(e){if(0===e.length)return;const t={...y.defaultRequest,arr:e,send_time:(new Date).toISOString()};await this._requestRelentless(a.hudConfig.endpoints.setDetachedFunctions,t,"setDetachedFunctions"),d.worker_logger.debug("Sent detached functions successfully",{count:e.length})}async storeObject(e,t){const s={key:e,value:t.toString("base64")},n=await this._requestDataRelentless(a.hudConfig.endpoints.storeObject,s,"storeObject");if("reference"in n)return d.worker_logger.debug("Stored object successfully",{reference:n.reference}),n.reference;d.worker_logger.error("Failed to store object",{key:e,response:n})}async validateToken(e){const t={...y.defaultRequest,token:e,send_time:(new Date).toISOString()};try{return await this._requestRelentless(a.hudConfig.endpoints.validateToken,t,"validateToken"),!0}catch(e){if(e instanceof u.HudClientUnauthorizedError)return!1}return!1}async getUploadUrls(e,t,s){const n={...y.defaultRequest,send_time:(new Date).toISOString(),build_id:e,token:t,num_urls:s};return(await this._requestRelentless(a.hudConfig.endpoints.getUploadUrls,n,"getUploadUrls")).data.urls}async triggerReingest(e){const t={...y.defaultRequest,type:"triggerReingest",send_time:(new Date).toISOString(),build_id:e};await this._requestRelentless(a.hudConfig.endpoints.triggerReingest,t,"triggerReingest")}async completed(e,t){const s={...y.defaultRequest,build_id:e,token:t,send_time:(new Date).toISOString()};await this._requestRelentless(a.hudConfig.endpoints.completed,s,"completed")}async sendFileDeclarationsCi(e,t){d.worker_logger.debug("Sending file declarations request",{count:t.length});const s={...e,files:t},n=await this._requestRelentless(a.hudConfig.endpoints.fileDeclarationsCi,s,"fileDeclarations");return{files:n.data.files,send_all:n.data.send_all}}async sendFileDeclarations(e){d.worker_logger.debug("Sending file declarations request",{count:e.length});const t={files:e},s=await this._requestRelentless(a.hudConfig.endpoints.fileDeclarations,t,"fileDeclarations");return{files:s.data.files,send_all:s.data.send_all}}async getEndpointsDurationsInvestigationThresholds(){return await this._requestDataRelentless(a.hudConfig.endpoints.endpointsDurationsInvestigationThresholds,{},"endpointsDurationsInvestigationThresholds","get")}async _requestRelentless(e,t,s,n="post",r=3){const o={"X-Hud-Type":s,"X-Hud-Request-ID":(0,c.randomUUID)()},i=[];let a;for(let c=0;c<r;c++)try{const r=await this._request(e,t,s,o,n);return(0,u.incrementSentEventsCount)(s),r}catch(t){if(t instanceof Error&&(a=t),t instanceof l.AxiosError){if(401===t.response?.status)throw d.worker_logger.error("Unauthorized request",{endpoint:e,requestType:s}),new u.HudClientUnauthorizedError(`Unauthorized request for ${e}`);const{code:n,name:r,status:o,message:a}=t;i.push({code:n,name:r,status:o,message:a})}else if(t instanceof Error){const{name:e,message:s}=t;i.push({name:e,message:s})}await new Promise(e=>setTimeout(e,1))}throw d.worker_logger.error("Exceeded max retries to request",{endpoint:e,requestType:s,failures:i,retries:r}),new u.HudClientError(`Exceeded max retries for ${e}`,a instanceof l.AxiosError?a.code:void 0)}async _requestDataRelentless(e,t,s,n="post",r=3){return(await this._requestRelentless(e,t,s,n,r)).data}async _request(e,t,s,n,r="post"){try{this.extensionEventEmitter&&await(0,g.once)(this.extensionEventEmitter,"eventloop");const s="get"===r?void 0:await this._gzipCompress(JSON.stringify(t));return n={...n,"Content-Encoding":"gzip","Content-Type":"application/json"},await(0,u.suppressTraces)(async()=>await this.httpClient.request({url:e,method:r,data:s,headers:n}))()}catch(t){if(t instanceof l.AxiosError){const{code:n,name:r,status:o,cause:i,message:a}=t;d.worker_logger.error(`${e} request failed`,{requestType:s,code:n,name:r,status:o,cause:i,msg:a})}else d.worker_logger.error("Caught an unexpected error",{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0});throw t}}async _gzipCompress(e){return _(e)}async initSession(e,t,s,n,r){const o={token:e,service:t,start_time:s.toISOString(),type:w,version:"1.0.0",sdk_version:a.SDK_VERSION,tags:n,internal_tags:r};d.worker_logger.debug("Requesting init",{data:o});const i=await this._requestRelentless(a.hudConfig.endpoints.init,o,"init");if(i.status===a.hudConfig.throttleStatusCode)throw d.worker_logger.debug("Init request throttled"),new u.HudSessionThrottle;const l=i.data.sessionId,c=i.data.extraHeaders??{};return d.worker_logger.info("Succesfuly created session with backend",{host:y.config.baseURL,service:t,sessionId:l,extraHeaders:c,tags:n}),{sessionId:l,extraHeaders:c}}async uploadDeclarationsToS3(e,t,s,n){const r=await(0,f.buffer)(e);let o=(await this.getUploadUrls(t,s,1))[0];n(`Got upload url ${o}`);for(let e=1;e<=3;e++)try{return await l.default.put(o,r,{headers:{"Content-Encoding":"gzip","Content-Type":"application/x-ndjson"}}),void n(`Uploaded requests to ${o}`)}catch(r){if(!(l.default.isAxiosError(r)&&405===r.response?.status&&e<3))throw r;n(`Upload failed with 405 status, retrying attempt ${e+1}/3, current upload url: ${o}`),o=(await this.getUploadUrls(t,s,1))[0]}}}t.HudClient=y},2546:e=>{e.exports=require("./lib")},3106:e=>{e.exports=require("zlib")},5809:e=>{e.exports=require("./config")},6261:e=>{e.exports=require("events")},6982:e=>{e.exports=require("crypto")},8938:e=>{e.exports=require("axios")},9023:e=>{e.exports=require("util")},9561:e=>{e.exports=require("stream/consumers")}},t={};return function s(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,s),o.exports}(2312)})());
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 s=t();for(var n in s)("object"==typeof exports?exports:e)[n]=s[n]}}(global,()=>(()=>{"use strict";var e={523:e=>{e.exports=require("./logger")},2312:function(e,t,s){var n,r=this&&this.__createBinding||(Object.create?function(e,t,s,n){void 0===n&&(n=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,n,r)}:function(e,t,s,n){void 0===n&&(n=s),e[n]=t[s]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[t.length]=s);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s=n(e),i=0;i<s.length;i++)"default"!==s[i]&&r(t,e,s[i]);return o(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.HudClient=void 0;const a=s(5809),u=s(2546),d=s(523),l=i(s(8938)),c=s(6982),g=s(6261),f=s(9561),h=s(9023),p=s(3106),_=(0,h.promisify)(p.gzip),w="node-sdk",m=(0,c.randomUUID)();class y{sessionId;httpClient;extensionEventEmitter;static config={baseURL:a.hudConfig.sink.url,timeout:a.hudConfig.sink.timeout,headers:{"Content-Type":"application/json"}};static defaultRequest={version:"1.0.0",source:w,event_version:"1.0.0"};constructor(e){this.httpClient=l.default.create(y.config),this.extensionEventEmitter=e}setSession(e){const{sessionId:t,extraHeaders:s}=e;this.sessionId=t,this.httpClient.defaults.headers.common[a.hudConfig.sink.session_attr]=t;try{for(const[e,t]of Object.entries(s))try{this.httpClient.defaults.headers.common[e]=t}catch(s){d.worker_logger.error("Failed to set extra header",{msg:s instanceof Error?s.message:void 0,stack:s instanceof Error?s.stack:void 0,key:e,value:t})}}catch(e){d.worker_logger.error("Failed to set extra headers",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}setExtensionEventEmitter(e){this.extensionEventEmitter=e}async logs(e){const t={logs:e,send_time:(new Date).toISOString()};await this._requestRelentless(a.hudConfig.endpoints.logs,t,"logs"),d.worker_logger.debug("sent logs successfully",{size:e.length})}async sessionslessLogs(e,t,s,n){const r={logs:e,send_time:(new Date).toISOString(),token:t,sdk_version:a.SDK_VERSION,sdk_type:w,sdk_runtime_type:n??"sdk",run_id:s??m};await this._requestRelentless(a.hudConfig.endpoints.sessionslessLogs,r,"sessionslessLogs"),d.worker_logger.debug("sent logs successfully",{size:e.length})}async send(e,t,s={}){const n={...y.defaultRequest,type:e,raw:t,send_time:(new Date).toISOString(),...s};await this._requestRelentless(a.hudConfig.endpoints.send,n,e),d.worker_logger.debug("sent event successfully",{type:e})}async batch(e,t,s={}){const n={...y.defaultRequest,type:e,arr:t,send_time:(new Date).toISOString(),...s};await this._requestRelentless(a.hudConfig.endpoints.batch,n,e),d.worker_logger.debug("sent batched events successfully",{type:e})}async getRemoteConfig(){const e=await this._requestDataRelentless(a.hudConfig.endpoints.getRemoteConfig,{},"getRemoteConfig");return d.worker_logger.info("Received remote configuration from server",{remoteConfiguration:e}),e}async getMode(e){const t={extra:e,send_time:(new Date).toISOString()},s=await this._requestDataRelentless(a.hudConfig.endpoints.getMode,t,"getMode");return d.worker_logger.info("Received mode from server "+s),s}async getKnownDetachedFunctions(){const e={...y.defaultRequest,send_time:(new Date).toISOString()},t=await this._requestDataRelentless(a.hudConfig.endpoints.getKnownDetachedFunctions,e,"getKnownDetachedFunctions");return t?.knownDetachedFunctions||[]}async setDetachedFunctions(e){if(0===e.length)return;const t={...y.defaultRequest,arr:e,send_time:(new Date).toISOString()};await this._requestRelentless(a.hudConfig.endpoints.setDetachedFunctions,t,"setDetachedFunctions"),d.worker_logger.debug("Sent detached functions successfully",{count:e.length})}async storeObject(e,t){const s={key:e,value:t.toString("base64")},n=await this._requestDataRelentless(a.hudConfig.endpoints.storeObject,s,"storeObject");if("reference"in n)return d.worker_logger.debug("Stored object successfully",{reference:n.reference}),n.reference;d.worker_logger.error("Failed to store object",{key:e,response:n})}async validateToken(e){const t={...y.defaultRequest,token:e,send_time:(new Date).toISOString()};try{return await this._requestRelentless(a.hudConfig.endpoints.validateToken,t,"validateToken"),!0}catch(e){if(e instanceof u.HudClientUnauthorizedError)return!1}return!1}async getUploadUrls(e,t,s){const n={...y.defaultRequest,send_time:(new Date).toISOString(),build_id:e,token:t,num_urls:s};return(await this._requestRelentless(a.hudConfig.endpoints.getUploadUrls,n,"getUploadUrls")).data.urls}async triggerReingest(e){const t={...y.defaultRequest,type:"triggerReingest",send_time:(new Date).toISOString(),build_id:e};await this._requestRelentless(a.hudConfig.endpoints.triggerReingest,t,"triggerReingest")}async completed(e,t){const s={...y.defaultRequest,build_id:e,token:t,send_time:(new Date).toISOString()};await this._requestRelentless(a.hudConfig.endpoints.completed,s,"completed")}async sendFileDeclarationsCi(e,t){d.worker_logger.debug("Sending file declarations request",{count:t.length});const s={...e,files:t},n=await this._requestRelentless(a.hudConfig.endpoints.fileDeclarationsCi,s,"fileDeclarations");return{files:n.data.files,send_all:n.data.send_all}}async sendFileDeclarations(e){d.worker_logger.debug("Sending file declarations request",{count:e.length});const t={files:e},s=await this._requestRelentless(a.hudConfig.endpoints.fileDeclarations,t,"fileDeclarations");return{files:s.data.files,send_all:s.data.send_all}}async getEndpointsDurationsInvestigationThresholds(){return await this._requestDataRelentless(a.hudConfig.endpoints.endpointsDurationsInvestigationThresholds,{},"endpointsDurationsInvestigationThresholds","get")}async _requestRelentless(e,t,s,n="post",r=3){const o={"X-Hud-Type":s,"X-Hud-Request-ID":(0,c.randomUUID)()},i=[];let a;for(let c=0;c<r;c++)try{const r=await this._request(e,t,s,o,n);return(0,u.incrementSentEventsCount)(s),r}catch(t){if(t instanceof Error&&(a=t),t instanceof l.AxiosError){if(401===t.response?.status)throw d.worker_logger.error("Unauthorized request",{endpoint:e,requestType:s}),new u.HudClientUnauthorizedError(`Unauthorized request for ${e}`);const{code:n,name:r,status:o,message:a}=t;i.push({code:n,name:r,status:o,message:a})}else if(t instanceof Error){const{name:e,message:s}=t;i.push({name:e,message:s})}await new Promise(e=>setTimeout(e,1))}throw d.worker_logger.error("Exceeded max retries to request",{endpoint:e,requestType:s,failures:i,retries:r}),new u.HudClientError(`Exceeded max retries for ${e}`,a instanceof l.AxiosError?a.code:void 0)}async _requestDataRelentless(e,t,s,n="post",r=3){return(await this._requestRelentless(e,t,s,n,r)).data}async _request(e,t,s,n,r="post"){try{this.extensionEventEmitter&&await(0,g.once)(this.extensionEventEmitter,"eventloop");const s="get"===r?void 0:await this._gzipCompress(JSON.stringify(t));return n={...n,"Content-Encoding":"gzip","Content-Type":"application/json"},await(0,u.suppressTraces)(async()=>await this.httpClient.request({url:e,method:r,data:s,headers:n}))()}catch(t){if(t instanceof l.AxiosError){const{code:n,name:r,status:o,cause:i,message:a}=t;d.worker_logger.error(`${e} request failed`,{requestType:s,code:n,name:r,status:o,cause:i,msg:a})}else d.worker_logger.error("Caught an unexpected error",{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0});throw t}}async _gzipCompress(e){return _(e)}async initSession(e,t,s,n,r){const o={token:e,service:t,start_time:s.toISOString(),type:w,version:"1.0.0",sdk_version:a.SDK_VERSION,tags:n,internal_tags:r,deployment_id:a.hudConfig.userConfig.deploymentId?.value};d.worker_logger.debug("Requesting init",{data:o});const i=await this._requestRelentless(a.hudConfig.endpoints.init,o,"init");if(i.status===a.hudConfig.throttleStatusCode)throw d.worker_logger.debug("Init request throttled"),new u.HudSessionThrottle;const l=i.data.sessionId,c=i.data.extraHeaders??{};return d.worker_logger.info("Succesfuly created session with backend",{host:y.config.baseURL,service:t,sessionId:l,extraHeaders:c,tags:n}),{sessionId:l,extraHeaders:c}}async uploadDeclarationsToS3(e,t,s,n){const r=await(0,f.buffer)(e);let o=(await this.getUploadUrls(t,s,1))[0];n(`Got upload url ${o}`);for(let e=1;e<=3;e++)try{return await l.default.put(o,r,{headers:{"Content-Encoding":"gzip","Content-Type":"application/x-ndjson"}}),void n(`Uploaded requests to ${o}`)}catch(r){if(!(l.default.isAxiosError(r)&&405===r.response?.status&&e<3))throw r;n(`Upload failed with 405 status, retrying attempt ${e+1}/3, current upload url: ${o}`),o=(await this.getUploadUrls(t,s,1))[0]}}}t.HudClient=y},2546:e=>{e.exports=require("./lib")},3106:e=>{e.exports=require("zlib")},5809:e=>{e.exports=require("./config")},6261:e=>{e.exports=require("events")},6982:e=>{e.exports=require("crypto")},8938:e=>{e.exports=require("axios")},9023:e=>{e.exports=require("util")},9561:e=>{e.exports=require("stream/consumers")}},t={};return function s(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,s),o.exports}(2312)})());
2
2
  //# sourceMappingURL=client.js.map
@@ -1,2 +1,2 @@
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 a=Object.getOwnPropertyDescriptor(n,t);a&&!("get"in a?!n.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return n[t]}}),Object.defineProperty(e,i,a)}:function(e,n,t,i){void 0===i&&(i=t),e[i]=n[t]}),a=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,a(t(2887),n),a(t(2570),n);var o=t(2210);Object.defineProperty(n,"SDK_MODULE_NAME",{enumerable:!0,get:function(){return o.SDK_MODULE_NAME}}),a(t(7089),n);var r=t(5453);Object.defineProperty(n,"SDK_VERSION",{enumerable:!0,get:function(){return r.SDK_VERSION}})},2570:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.refreshInvestigationErrorStatusCodeRegex=function(e,n,t){if(null==e)return;const o=i.HudDynamicConfigSchema.deepPartial().safeParse(e);if(!o.success)return;const r=o.data?.investigationErrorStatusCodeRegex;void 0!==r&&r!==n.dynamicConfig.investigationErrorStatusCodeRegex&&a(r,n,t,"Periodic refresh - Dynamic configuration updated - investigationErrorStatusCodeRegex")},n.refreshInvestigationEnabled=function(e,n,t){if(null==e)return;const a=i.HudDynamicConfigSchema.deepPartial().safeParse(e);if(!a.success)return;const o=a.data?.enableInvestigation;if(void 0===o)return;o!==globalThis.hudEnableInvestigation&&(n.isInvestigationEnabledByEnv||(globalThis.hudEnableInvestigation=o,t.info("Periodic refresh - Dynamic configuration updated - enableInvestigation",{hudEnableInvestigation:o})))},n.updateDynamicConfig=function(e,n,t){const r=i.HudDynamicConfigSchema.deepPartial().safeParse(e);if(!r.success)return t.error("Dynamic configuration not updated - Invalid configuration override",{remoteConfigParseResult:r,remoteConfig:e}),n.dynamicConfig;const s=o(n.dynamicConfig,r.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),void 0!==s?.investigationRateLimits?.executionFlowMaxLength&&s?.investigationRateLimits?.executionFlowMaxLength!==n.dynamicConfig.investigationRateLimits.executionFlowMaxLength&&(globalThis.hudExecutionFlowMaxLength=s.investigationRateLimits.executionFlowMaxLength),void 0!==s?.investigationRateLimits?.exceptionMaxLength&&s?.investigationRateLimits?.exceptionMaxLength!==n.dynamicConfig.investigationRateLimits.exceptionMaxLength&&(globalThis.hudExceptionMaxLength=s.investigationRateLimits.exceptionMaxLength),void 0!==r.data.investigationErrorStatusCodeRegex&&s.investigationErrorStatusCodeRegex!==n.dynamicConfig.investigationErrorStatusCodeRegex&&a(s.investigationErrorStatusCodeRegex,n,t,"Dynamic configuration updated - investigationErrorStatusCodeRegex",s),s};const i=t(2887);function a(e,n,t,a,o){const{appliedRegex:r,usedDefault:s}=(0,i.updateInvestigationErrorStatusCodePatternGlobal)(e);n.dynamicConfig.investigationErrorStatusCodeRegex=r,o&&(o.investigationErrorStatusCodeRegex=r),s&&e!==r?t.warning("Invalid investigationErrorStatusCodeRegex, using default",{investigationErrorStatusCodeRegex:e,appliedRegex:r}):t.info(a,{investigationErrorStatusCodeRegex:r})}function o(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],r=n[i];t[i]=o(a,r)}return t}},2887:function(e,n,t){var i,a=this&&this.__createBinding||(Object.create?function(e,n,t,i){void 0===i&&(i=t);var a=Object.getOwnPropertyDescriptor(n,t);a&&!("get"in a?!n.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return n[t]}}),Object.defineProperty(e,i,a)}:function(e,n,t,i){void 0===i&&(i=t),e[i]=n[t]}),o=this&&this.__setModuleDefault||(Object.create?function(e,n){Object.defineProperty(e,"default",{enumerable:!0,value:n})}:function(e,n){e.default=n}),r=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),r=0;r<t.length;r++)"default"!==t[r]&&a(n,e,t[r]);return o(n,e),n});Object.defineProperty(n,"__esModule",{value:!0}),n.HudFailedReadConfigError=n.loggerConfig=n.hudConfig=n.HudDynamicConfigSchema=n.DEFAULT_INVESTIGATION_ERROR_STATUS_CODE_REGEX=void 0,n.functionUuidToBase64=c,n.getModulesToTraceFromEnv=function(){const e=process.env.HUD_MONITOR_MODULES||process.env.HUD_INCLUDE_MODULES;if(e)return e.split(",")},n.getExcludeDirsFromEnv=function(){const e=process.env.HUD_EXCLUDE_DIRS;if(e)return e.split(",")},n.getFrameworksToEnableFromEnv=function(){const e=process.env.HUD_ENABLE_FRAMEWORKS;let n;if(e)try{n=s.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.updateInvestigationErrorStatusCodePatternGlobal=function(e=n.DEFAULT_INVESTIGATION_ERROR_STATUS_CODE_REGEX){try{return globalThis.hudInvestigationErrorStatusCodePattern=new RegExp(`^(?:${e})$`),{appliedRegex:e,usedDefault:e===n.DEFAULT_INVESTIGATION_ERROR_STATUS_CODE_REGEX}}catch{return globalThis.hudInvestigationErrorStatusCodePattern=new RegExp(`^(?:${n.DEFAULT_INVESTIGATION_ERROR_STATUS_CODE_REGEX})$`),{appliedRegex:n.DEFAULT_INVESTIGATION_ERROR_STATUS_CODE_REGEX,usedDefault:!0}}},n.matchesInvestigationErrorStatusCode=function(e){return null!=e&&globalThis.hudInvestigationErrorStatusCodePattern.test(String(e))};const s=t(8528),l=r(t(6928)),u=t(3903),d=t(1569);function c(e){return Buffer.from((0,u.parse)(e)).toString("base64").slice(0,22)}const g="globalThis._hudMark";n.DEFAULT_INVESTIGATION_ERROR_STATUS_CODE_REGEX="^5\\d\\d$",n.HudDynamicConfigSchema=d.z.object({aggregationInterval:d.z.number(),aggregationFirstSendTimeout:d.z.number(),investigationInterval:d.z.number(),investigationFirstSendTimeout:d.z.number(),enableInvestigation:d.z.boolean(),investigationErrorStatusCodeRegex:d.z.string(),enableInvestigationArgsSending: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(),maxTotalInvestigationsErrorBased:d.z.number().int().positive(),maxTotalInvestigationsDurationBased:d.z.number().int().positive(),totalInvestigationTimeWindowMs:d.z.number().int().positive(),maxUniqLogs:d.z.number().int().positive(),maxStringLength:d.z.number().int().positive(),maxArrayLength:d.z.number().int().positive(),maxObjectDepth:d.z.number().int().positive(),maxKeyLength:d.z.number().int().positive(),executionFlowMaxLength:d.z.number().int().positive(),exceptionMaxLength:d.z.number().int().positive(),maxUniqueSetFailureErrors: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()),performanceMetricsInterval:d.z.number().int().positive(),enableOutboundData:d.z.boolean(),maxTotalOutbounds:d.z.number().int().positive(),maxOutboundCountWithData:d.z.number().int().positive(),maxHTTPRequestBodySize:d.z.number().int().positive(),maxHTTPResponseBodySize:d.z.number().int().positive(),functionDetachEnabled:d.z.boolean(),functionDetachThresholdPerSecond:d.z.number().int().positive(),enableMongoDocumentData:d.z.boolean(),enableTeardown:d.z.boolean(),flushOnUncaughtException:d.z.boolean(),fileTimestampsLogDelayMs:d.z.number().int().positive()});const m=process.env.HUD_ENABLE_INVESTIGATION,v="_HUD",p="94a210f3-861c-4e18-ab27-6b6c19437c9d",b={sink:{url:process.env.HUD_HOST||"https://api-prod.hud.io",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",endpointsDurationsInvestigationThresholds:"sink/endpoint-configuration",getKnownDetachedFunctions:"sink/known-detached-functions/get",setDetachedFunctions:"sink/known-detached-functions/set"},logger:{default:{levels:{app:"warning",worker:"warning",instrument:"warning"}},debug:{levels:{app:"debug",worker:"debug",instrument:"debug"}}},investigation:{objectVersion:"1.0.2",store:{type:"s3"}},userConfig:{lean:{value:!1,source:"DEFAULT"},minPodMemoryMB:{value:250,source:"DEFAULT"},maxMappedFunctions:{value:5e4,source:"DEFAULT"},maxFileSizeBytes:{value:2831155,source:"DEFAULT"},maxTimeUntilInitSessionMs:{value:3e4,source:"DEFAULT"},includeModules:{value:[],source:"DEFAULT"},excludeDirs:{value:[],source:"DEFAULT"},disableRuntimeInstrumentation:{value:!1,source:"DEFAULT"},disableParametersExtraction:{value:!1,source:"DEFAULT"},disableDetachedFunctions:{value:!1,source:"DEFAULT"},enableVarHoisting:{value:!1,source:"DEFAULT"},instrumentOneLiners:{value:!0,source:"DEFAULT"}},loggerWorkerPortSizeLimit:1e4,customerLoggerLevel:"info",logDirectory:process.env.HUD_LOG_DIR,invocationSampling:new Map([[[300n,null],100],[[200n,300n],50],[[100n,200n],25],[[0n,100n],10]]),callerResetInterval:36e5,modeInterval:3e5,logsSendInterval:6e4,endpointsInterval:3e4,endpointsFirstSendWaitTime:12e4,lazyEndpointsInterval:18e5,staticNextJsEndpointsInterval:1e4,staticNextJsEndpointsMaxAttempts:12,huddBinWidth:1.2,endpointsDurationsInvestigationThresholdsInterval:6e5,remoteConfigRefreshInterval:3e5,workerStateCollectionDelay:1e4,workerGrace:6e4,teardownGrace:5e3,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:p,wrapVarPrefix:v,functionInitFunctionName:`${v}i`,functionCatchFunctionName:`${v}c`,functionFinallyFunctionName:`${v}n`,callContextVarName:`${v}x`,fixStackFunctionName:`${v}s`,asyncIteratorWrapperFunctionName:`${v}w`,wrapperUserCatchFunctionName:`${v}u`,asyncWrapperFunctionName:`${v}a`,internalAsyncWrapperFunctionName:`${v}b`,frameworksToPatch:new Map([["express",{framework:s.availableFrameworks.express,enable:!0,version:"<=5",patcher:"express",enableEsbuild:!0}],[l.join("express","lib","application.js"),{framework:s.availableFrameworks.express,enable:!0,version:"<=5",patcher:"expressApplication",enableEsbuild:!0}],["router",{framework:s.availableFrameworks.express,enable:!0,version:"^2.0.0",patcher:"router",enableEsbuild:!0}],["@hapi/hapi",{framework:s.availableFrameworks.hapi,enable:!0,version:">=20.0.0 <22.0.0",patcher:"hapi"}],["koa",{framework:s.availableFrameworks.koa,enable:!0,version:"^2.0.0 || ^3.0.0",patcher:"koa"}],["fastify",{framework:s.availableFrameworks.fastify,enable:!0,version:">=4.0.0 <6",patcher:"fastify"}],["graphql/execution/execute",{framework:s.availableFrameworks.graphql,enable:!1,version:"14 - 16",patcher:"graphql"}],["http",{framework:s.availableFrameworks.http,enable:!0,version:"*",patcher:"http"}],["https",{framework:s.availableFrameworks.https,enable:!0,version:"*",patcher:"http"}],["next/dist/server/base-server",{framework:s.availableFrameworks.nextjs,enable:!1,version:">=13.4.0",patcher:"nextjs"}],["next/dist/server/lib/module-loader/route-module-loader",{framework:s.availableFrameworks.nextjs,enable:!1,version:">=13.4.0",patcher:"nextJsModuleLoader"}],["next/dist/compiled/next-server/pages-api.runtime.prod",{framework:s.availableFrameworks.nextjs,enable:!1,version:">=13.4.0",patcher:"nextJsRouteModule"}],["next/dist/compiled/next-server/pages-api-turbo.runtime.prod",{framework:s.availableFrameworks.nextjs,enable:!1,version:">=16.0.0",patcher:"nextJsRouteModule"}],["next/dist/server/config",{framework:s.availableFrameworks.nextjs,enable:!1,version:">=13.4.0",patcher:"nextJsConfig"}],["@nestjs/core/router/router-execution-context",{framework:s.availableFrameworks.nestjs,enable:!0,version:"*",patcher:"nestjsRouterExecutionContext"}],["kafkajs",{framework:s.availableFrameworks.kafkajs,enable:"win32"!==process.platform,version:">=1.4.0",patcher:"kafkajs"}],["@confluentinc/kafka-javascript",{framework:s.availableFrameworks.confluentKafkaJs,enable:!1,version:">=1.4.0",patcher:"confluentKafkaJs"}],["@nestjs/microservices/context/rpc-context-creator",{framework:s.availableFrameworks.nestjs,enable:"win32"!==process.platform,version:">=7.0.0",patcher:"nestjsRpcContextCreator"}],[["@codegenie/serverless-express","src","frameworks","express.js"].join(l.sep),{framework:s.availableFrameworks.codegenieServerlessExpress,enable:!0,version:"^4.1.0",patcher:"codeGenieServerlessExpress",enableEsbuild:!0}],["@codegenie/serverless-express",{framework:s.availableFrameworks.codegenieServerlessExpress,enable:!0,enableEsbuild:!0}],["sqs-consumer",{framework:s.availableFrameworks.sqs,enable:!0,version:">=7.5.0",patcher:"sqsConsumer"}],[["@mondaydotcomorg/monday-sqs-consumer","sqs-consumer"].join(l.sep),{framework:s.availableFrameworks.sqs,enable:"win32"!==process.platform,version:">=5.2.2 <6",patcher:"sqsConsumer",extraInfo:{isMondayVersion:!0,srcHash:"bd9064befbf3abb9ad0e6a53b0cf721d5612d5b8d8790875c994b7ff40b951c5"}}],["serverless-http",{framework:s.availableFrameworks.serverlessHttp,enable:!0,enableEsbuild:!0}],[l.join("serverless-http","lib","framework","get-framework.js"),{framework:s.availableFrameworks.serverlessHttp,enable:!0,version:"^2.7.0",patcher:"serverlessHttp",enableEsbuild:!0}],["axios",{framework:s.availableFrameworks.axios,enable:!0,version:">0.18.0 <1.0.0 || ^1.0.0",patcher:"outbound/axios",mainFilePath:"axios/dist/node/axios.cjs",extraInfo:{isOutbound:!0}}],["node-fetch",{framework:s.availableFrameworks.nodeFetch,enable:!0,version:"^2.0.0",patcher:"outbound/nodeFetch",mainFilePath:"node-fetch/lib/index.js",extraInfo:{isOutbound:!0}}],["request",{framework:s.availableFrameworks.request,enable:!0,version:"2.88.2",patcher:"outbound/request",extraInfo:{isOutbound:!0}}],["pg",{framework:s.availableFrameworks.pg,enable:!0,version:"^8.8.0",patcher:"outbound/pg",extraInfo:{isOutbound:!0}}],["@clickhouse/client-common",{framework:s.availableFrameworks.clickhouse,enable:!1,version:"^1.10.0",patcher:"outbound/clickhouse",extraInfo:{isOutbound:!0}}],["ioredis",{framework:s.availableFrameworks.ioredis,enable:!0,version:"^4.0.0 || ^5.0.0",patcher:"outbound/ioredis",extraInfo:{isOutbound:!0}}],["mongodb",{framework:s.availableFrameworks.mongodb,enable:!0,version:">=5.0.0 <8.0.0",patcher:"outbound/mongodb",extraInfo:{isOutbound:!0}}],["mongoose",{framework:s.availableFrameworks.mongoose,enable:!0,version:">=5.0.0 <7.0.0",patcher:"outbound/mongoose",extraInfo:{isOutbound:!0,coveredByFramework:{frameworkKey:"mongodb",versionRange:">=7.0.0 <10.0.0"}}}],["p-limit",{framework:"p-limit",enable:!0,version:"^3.0.0",patcher:"internal/pLimit"}]]),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,investigationErrorStatusCodeRegex:n.DEFAULT_INVESTIGATION_ERROR_STATUS_CODE_REGEX,enableInvestigationArgsSending:!1,investigationRateLimits:{maxSameInvestigations:2,sameInvestigationTimeWindowMs:36e5,maxTotalInvestigations:25,maxTotalInvestigationsErrorBased:25,maxTotalInvestigationsDurationBased:20,totalInvestigationTimeWindowMs:216e5,maxUniqLogs:2,executionFlowMaxLength:20,exceptionMaxLength:20,maxStringLength:1024,maxArrayLength:10,maxObjectDepth:3,maxKeyLength:30,maxUniqueSetFailureErrors:100},machineMetricsInterval:1e4,performanceMetricsInterval:6e4,reingestInterval:3e4,extraHeaders:[],enableOutboundData:"true"===process.env.HUD_ENABLE_OUTBOUND_DATA,maxHTTPRequestBodySize:1024,maxHTTPResponseBodySize:5120,blacklistParams:[],censorshipRegexes:[],forensicsBlacklistFields:[],forensicsWhitelistFields:[],maxOutboundCountWithData:process.env.HUD_MAX_OUTBOUND_WITH_DATA?parseInt(process.env.HUD_MAX_OUTBOUND_WITH_DATA):10,maxTotalOutbounds:20,functionDetachEnabled:!1,functionDetachThresholdPerSecond:5833,enableMongoDocumentData:!1,enableTeardown:!1,flushOnUncaughtException:!1,fileTimestampsLogDelayMs:12e4},machineMetricsSavedLength:2,isInvestigationEnabledByEnv:void 0!==m,suppressTraces:"true"!==process.env.HUD_DISABLE_SUPPRESS_TRACES,lambdaMinimunMemory:1024,lambdaBaseGivenTime:400,lambdaExtraGivenTimePerRequest:50,lambdaMaxGivenTime:700,throttleStatusCode:202,axiosFunctionId:c((0,u.v5)("axios",p)),nodeFetchFunctionId:c((0,u.v5)("node-fetch",p)),nodeFetchBodiesFunctionIds:{json:c((0,u.v5)("node-fetch-body-json",p)),text:c((0,u.v5)("node-fetch-body-text",p)),arrayBuffer:c((0,u.v5)("node-fetch-body-arrayBuffer",p)),blob:c((0,u.v5)("node-fetch-body-blob",p))},requestFunctionId:c((0,u.v5)("request-request",p)),requestMethodFunctionIds:{get:c((0,u.v5)("request-get",p)),head:c((0,u.v5)("request-head",p)),options:c((0,u.v5)("request-options",p)),post:c((0,u.v5)("request-post",p)),put:c((0,u.v5)("request-put",p)),patch:c((0,u.v5)("request-patch",p)),del:c((0,u.v5)("request-del",p)),delete:c((0,u.v5)("request-delete",p))},pgConnectFunctionId:c((0,u.v5)("pg-connect",p)),pgQueryFunctionId:c((0,u.v5)("pg-query",p)),pgEndFunctionId:c((0,u.v5)("pg-end",p)),clickhouseQueryFunctionId:c((0,u.v5)("clickhouse-query",p)),clickhouseExecFunctionId:c((0,u.v5)("clickhouse-exec",p)),clickhouseCommandFunctionId:c((0,u.v5)("clickhouse-command",p)),clickhouseInsertFunctionId:c((0,u.v5)("clickhouse-insert",p)),clickhouseCloseFunctionId:c((0,u.v5)("clickhouse-close",p)),functionsToInstrument:[{moduleName:"typeorm",fileToFunctionsMapping:{[l.join(l.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",esbuildFunctionIdVar:"hudFI",esbuildPluginMessagePrefix:"ESBuild plugin ",esbuildMark:"modifiedByHudESBuildPlugin-",esbuildMarkLength:67,esbuildUploadSourceMapTimeout:15e3,esbuildPluginLogsChunkSize:100,esbuildPluginLogsBatchSize:10,pluginsLogEndpoint:"https://yqp37dddrsewm6wdwwpwfraxqm0shdmx.lambda-url.eu-central-1.on.aws/",uninstrumentedFilesLogThreshold:2,tsNodeConfigTimeout:1e4,allowedEditExtensions:[".ts",".cts",".mts",".js",".cjs",".mjs"],nextJsMarkVarName:g,nextJsMarkStatement:`${g} = "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;const f=process.env.HUD_DEBUG?n.hudConfig.logger.debug:n.hudConfig.logger.default;n.loggerConfig={...f,console:"true"===process.env.HUD_VERBOSE};class h extends Error{path;code;constructor(e,n){super(),this.path=e,this.code=n}}n.HudFailedReadConfigError=h},3903:e=>{e.exports=require("uuid")},5453:(e,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.SDK_VERSION=void 0,n.SDK_VERSION="1.8.10"},6928:e=>{e.exports=require("path")},7089:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ObjectStoreConfigSchema=void 0;const i=t(1569),a=i.z.object({type:i.z.literal("s3")}),o=i.z.object({type:i.z.literal("disk"),path:i.z.string()}),r=i.z.object({type:i.z.literal("customer_s3"),bucket:i.z.string(),region:i.z.string(),prefix:i.z.string().optional()});n.ObjectStoreConfigSchema=i.z.union([a,o,r])},8528:e=>{e.exports=require("./dto")}},n={};return function t(i){var a=n[i];if(void 0!==a)return a.exports;var o=n[i]={exports:{}};return e[i].call(o.exports,o,o.exports,t),o.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 a=Object.getOwnPropertyDescriptor(n,t);a&&!("get"in a?!n.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return n[t]}}),Object.defineProperty(e,i,a)}:function(e,n,t,i){void 0===i&&(i=t),e[i]=n[t]}),a=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,a(t(2887),n),a(t(2570),n);var o=t(2210);Object.defineProperty(n,"SDK_MODULE_NAME",{enumerable:!0,get:function(){return o.SDK_MODULE_NAME}}),a(t(7089),n);var r=t(5453);Object.defineProperty(n,"SDK_VERSION",{enumerable:!0,get:function(){return r.SDK_VERSION}})},2570:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.refreshInvestigationErrorStatusCodeRegex=function(e,n,t){if(null==e)return;const o=i.HudDynamicConfigSchema.deepPartial().safeParse(e);if(!o.success)return;const r=o.data?.investigationErrorStatusCodeRegex;void 0!==r&&r!==n.dynamicConfig.investigationErrorStatusCodeRegex&&a(r,n,t,"Periodic refresh - Dynamic configuration updated - investigationErrorStatusCodeRegex")},n.refreshInvestigationEnabled=function(e,n,t){if(null==e)return;const a=i.HudDynamicConfigSchema.deepPartial().safeParse(e);if(!a.success)return;const o=a.data?.enableInvestigation;if(void 0===o)return;o!==globalThis.hudEnableInvestigation&&(n.isInvestigationEnabledByEnv||(globalThis.hudEnableInvestigation=o,t.info("Periodic refresh - Dynamic configuration updated - enableInvestigation",{hudEnableInvestigation:o})))},n.updateDynamicConfig=function(e,n,t){const r=i.HudDynamicConfigSchema.deepPartial().safeParse(e);if(!r.success)return t.error("Dynamic configuration not updated - Invalid configuration override",{remoteConfigParseResult:r,remoteConfig:e}),n.dynamicConfig;const s=o(n.dynamicConfig,r.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),void 0!==s?.investigationRateLimits?.executionFlowMaxLength&&s?.investigationRateLimits?.executionFlowMaxLength!==n.dynamicConfig.investigationRateLimits.executionFlowMaxLength&&(globalThis.hudExecutionFlowMaxLength=s.investigationRateLimits.executionFlowMaxLength),void 0!==s?.investigationRateLimits?.exceptionMaxLength&&s?.investigationRateLimits?.exceptionMaxLength!==n.dynamicConfig.investigationRateLimits.exceptionMaxLength&&(globalThis.hudExceptionMaxLength=s.investigationRateLimits.exceptionMaxLength),void 0!==r.data.investigationErrorStatusCodeRegex&&s.investigationErrorStatusCodeRegex!==n.dynamicConfig.investigationErrorStatusCodeRegex&&a(s.investigationErrorStatusCodeRegex,n,t,"Dynamic configuration updated - investigationErrorStatusCodeRegex",s),s};const i=t(2887);function a(e,n,t,a,o){const{appliedRegex:r,usedDefault:s}=(0,i.updateInvestigationErrorStatusCodePatternGlobal)(e);n.dynamicConfig.investigationErrorStatusCodeRegex=r,o&&(o.investigationErrorStatusCodeRegex=r),s&&e!==r?t.warning("Invalid investigationErrorStatusCodeRegex, using default",{investigationErrorStatusCodeRegex:e,appliedRegex:r}):t.info(a,{investigationErrorStatusCodeRegex:r})}function o(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],r=n[i];t[i]=o(a,r)}return t}},2887:function(e,n,t){var i,a=this&&this.__createBinding||(Object.create?function(e,n,t,i){void 0===i&&(i=t);var a=Object.getOwnPropertyDescriptor(n,t);a&&!("get"in a?!n.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return n[t]}}),Object.defineProperty(e,i,a)}:function(e,n,t,i){void 0===i&&(i=t),e[i]=n[t]}),o=this&&this.__setModuleDefault||(Object.create?function(e,n){Object.defineProperty(e,"default",{enumerable:!0,value:n})}:function(e,n){e.default=n}),r=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),r=0;r<t.length;r++)"default"!==t[r]&&a(n,e,t[r]);return o(n,e),n});Object.defineProperty(n,"__esModule",{value:!0}),n.HudFailedReadConfigError=n.loggerConfig=n.hudConfig=n.HudDynamicConfigSchema=n.DEFAULT_INVESTIGATION_ERROR_STATUS_CODE_REGEX=void 0,n.functionUuidToBase64=c,n.getModulesToTraceFromEnv=function(){const e=process.env.HUD_MONITOR_MODULES||process.env.HUD_INCLUDE_MODULES;if(e)return e.split(",")},n.getExcludeDirsFromEnv=function(){const e=process.env.HUD_EXCLUDE_DIRS;if(e)return e.split(",")},n.getFrameworksToEnableFromEnv=function(){const e=process.env.HUD_ENABLE_FRAMEWORKS;let n;if(e)try{n=s.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.updateInvestigationErrorStatusCodePatternGlobal=function(e=n.DEFAULT_INVESTIGATION_ERROR_STATUS_CODE_REGEX){try{return globalThis.hudInvestigationErrorStatusCodePattern=new RegExp(`^(?:${e})$`),{appliedRegex:e,usedDefault:e===n.DEFAULT_INVESTIGATION_ERROR_STATUS_CODE_REGEX}}catch{return globalThis.hudInvestigationErrorStatusCodePattern=new RegExp(`^(?:${n.DEFAULT_INVESTIGATION_ERROR_STATUS_CODE_REGEX})$`),{appliedRegex:n.DEFAULT_INVESTIGATION_ERROR_STATUS_CODE_REGEX,usedDefault:!0}}},n.matchesInvestigationErrorStatusCode=function(e){return null!=e&&globalThis.hudInvestigationErrorStatusCodePattern.test(String(e))};const s=t(8528),l=r(t(6928)),u=t(3903),d=t(1569);function c(e){return Buffer.from((0,u.parse)(e)).toString("base64").slice(0,22)}const m="globalThis._hudMark";n.DEFAULT_INVESTIGATION_ERROR_STATUS_CODE_REGEX="^5\\d\\d$",n.HudDynamicConfigSchema=d.z.object({aggregationInterval:d.z.number(),aggregationFirstSendTimeout:d.z.number(),investigationInterval:d.z.number(),investigationFirstSendTimeout:d.z.number(),enableInvestigation:d.z.boolean(),investigationErrorStatusCodeRegex:d.z.string(),enableInvestigationArgsSending: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(),maxTotalInvestigationsErrorBased:d.z.number().int().positive(),maxTotalInvestigationsDurationBased:d.z.number().int().positive(),totalInvestigationTimeWindowMs:d.z.number().int().positive(),maxUniqLogs:d.z.number().int().positive(),maxStringLength:d.z.number().int().positive(),maxArrayLength:d.z.number().int().positive(),maxObjectDepth:d.z.number().int().positive(),maxKeyLength:d.z.number().int().positive(),executionFlowMaxLength:d.z.number().int().positive(),exceptionMaxLength:d.z.number().int().positive(),maxUniqueSetFailureErrors: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()),performanceMetricsInterval:d.z.number().int().positive(),enableOutboundData:d.z.boolean(),maxTotalOutbounds:d.z.number().int().positive(),maxOutboundCountWithData:d.z.number().int().positive(),maxHTTPRequestBodySize:d.z.number().int().positive(),maxHTTPResponseBodySize:d.z.number().int().positive(),functionDetachEnabled:d.z.boolean(),functionDetachThresholdPerSecond:d.z.number().int().positive(),enableMongoDocumentData:d.z.boolean(),enableTeardown:d.z.boolean(),flushOnUncaughtException:d.z.boolean(),fileTimestampsLogDelayMs:d.z.number().int().positive(),maxCustomFlowIds:d.z.number().int().positive()});const g=process.env.HUD_ENABLE_INVESTIGATION,v="_HUD",p="94a210f3-861c-4e18-ab27-6b6c19437c9d",b={sink:{url:process.env.HUD_HOST||"https://api-prod.hud.io",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",endpointsDurationsInvestigationThresholds:"sink/endpoint-configuration",getKnownDetachedFunctions:"sink/known-detached-functions/get",setDetachedFunctions:"sink/known-detached-functions/set"},logger:{default:{levels:{app:"warning",worker:"warning",instrument:"warning"}},debug:{levels:{app:"debug",worker:"debug",instrument:"debug"}}},investigation:{objectVersion:"1.0.2",store:{type:"s3"}},userConfig:{lean:{value:!1,source:"DEFAULT"},minPodMemoryMB:{value:250,source:"DEFAULT"},maxMappedFunctions:{value:5e4,source:"DEFAULT"},maxFileSizeBytes:{value:2831155,source:"DEFAULT"},maxTimeUntilInitSessionMs:{value:3e4,source:"DEFAULT"},includeModules:{value:[],source:"DEFAULT"},excludeDirs:{value:[],source:"DEFAULT"},disableRuntimeInstrumentation:{value:!1,source:"DEFAULT"},disableParametersExtraction:{value:!1,source:"DEFAULT"},disableDetachedFunctions:{value:!1,source:"DEFAULT"},enableVarHoisting:{value:!1,source:"DEFAULT"},instrumentOneLiners:{value:!0,source:"DEFAULT"}},loggerWorkerPortSizeLimit:1e4,customerLoggerLevel:"info",logDirectory:process.env.HUD_LOG_DIR,invocationSampling:new Map([[[300n,null],100],[[200n,300n],50],[[100n,200n],25],[[0n,100n],10]]),callerResetInterval:36e5,modeInterval:3e5,logsSendInterval:6e4,endpointsInterval:3e4,endpointsFirstSendWaitTime:12e4,staticNextJsEndpointsInterval:1e4,staticNextJsEndpointsMaxAttempts:12,huddBinWidth:1.2,endpointsDurationsInvestigationThresholdsInterval:6e5,remoteConfigRefreshInterval:3e5,workerStateCollectionDelay:1e4,workerGrace:6e4,teardownGrace:5e3,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:p,wrapVarPrefix:v,functionInitFunctionName:`${v}i`,functionCatchFunctionName:`${v}c`,functionFinallyFunctionName:`${v}n`,callContextVarName:`${v}x`,fixStackFunctionName:`${v}s`,asyncIteratorWrapperFunctionName:`${v}w`,wrapperUserCatchFunctionName:`${v}u`,asyncWrapperFunctionName:`${v}a`,internalAsyncWrapperFunctionName:`${v}b`,frameworksToPatch:new Map([["express",{framework:s.availableFrameworks.express,enable:!0,version:"<=5",enableEsbuild:!0}],[l.join("express","lib","router","layer.js"),{framework:s.availableFrameworks.express,enable:!0,version:"<5",patcher:"expressLayer",enableEsbuild:!0}],[l.join("express","lib","application.js"),{framework:s.availableFrameworks.express,enable:!0,version:"<=5",patcher:"express",enableEsbuild:!0}],[l.join("express","lib","router","index.js"),{framework:s.availableFrameworks.express,enable:!0,version:"<5",patcher:"expressRouter",enableEsbuild:!0}],["router",{framework:s.availableFrameworks.express,enable:!0,version:"^2.0.0",patcher:"expressRouterInRouter",enableEsbuild:!0}],[l.join("router","lib","layer.js"),{framework:s.availableFrameworks.express,enable:!0,version:"^2.0.0",patcher:"expressLayerInRouter",enableEsbuild:!0}],["@hapi/hapi",{framework:s.availableFrameworks.hapi,enable:!0,version:">=20.0.0 <22.0.0",patcher:"hapi"}],["koa",{framework:s.availableFrameworks.koa,enable:!0,version:"^2.0.0 || ^3.0.0",patcher:"koa"}],["fastify",{framework:s.availableFrameworks.fastify,enable:!0,version:">=4.0.0 <6",patcher:"fastify"}],["graphql/execution/execute",{framework:s.availableFrameworks.graphql,enable:!1,version:"14 - 16",patcher:"graphql"}],["http",{framework:s.availableFrameworks.http,enable:!0,version:"*",patcher:"http"}],["https",{framework:s.availableFrameworks.https,enable:!0,version:"*",patcher:"http"}],["next/dist/server/base-server",{framework:s.availableFrameworks.nextjs,enable:!1,version:">=13.4.0",patcher:"nextjs"}],["next/dist/server/lib/module-loader/route-module-loader",{framework:s.availableFrameworks.nextjs,enable:!1,version:">=13.4.0",patcher:"nextJsModuleLoader"}],["next/dist/compiled/next-server/pages-api.runtime.prod",{framework:s.availableFrameworks.nextjs,enable:!1,version:">=13.4.0",patcher:"nextJsRouteModule"}],["next/dist/compiled/next-server/pages-api-turbo.runtime.prod",{framework:s.availableFrameworks.nextjs,enable:!1,version:">=16.0.0",patcher:"nextJsRouteModule"}],["next/dist/server/config",{framework:s.availableFrameworks.nextjs,enable:!1,version:">=13.4.0",patcher:"nextJsConfig"}],["@nestjs/core/router/router-execution-context",{framework:s.availableFrameworks.nestjs,enable:!0,version:"*",patcher:"nestjsRouterExecutionContext"}],["kafkajs",{framework:s.availableFrameworks.kafkajs,enable:"win32"!==process.platform,version:">=1.4.0",patcher:"kafkajs"}],["@confluentinc/kafka-javascript",{framework:s.availableFrameworks.confluentKafkaJs,enable:!1,version:">=1.4.0",patcher:"confluentKafkaJs"}],["@nestjs/microservices/context/rpc-context-creator",{framework:s.availableFrameworks.nestjs,enable:"win32"!==process.platform,version:">=7.0.0",patcher:"nestjsRpcContextCreator"}],[["@codegenie/serverless-express","src","frameworks","express.js"].join(l.sep),{framework:s.availableFrameworks.codegenieServerlessExpress,enable:!0,version:"^4.1.0",patcher:"codeGenieServerlessExpress",enableEsbuild:!0}],["@codegenie/serverless-express",{framework:s.availableFrameworks.codegenieServerlessExpress,enable:!0,enableEsbuild:!0}],["sqs-consumer",{framework:s.availableFrameworks.sqs,enable:!0,version:">=7.5.0",patcher:"sqsConsumer"}],[["@mondaydotcomorg/monday-sqs-consumer","sqs-consumer"].join(l.sep),{framework:s.availableFrameworks.sqs,enable:"win32"!==process.platform,version:">=5.2.2 <6",patcher:"sqsConsumer",extraInfo:{isMondayVersion:!0,srcHash:"bd9064befbf3abb9ad0e6a53b0cf721d5612d5b8d8790875c994b7ff40b951c5"}}],["serverless-http",{framework:s.availableFrameworks.serverlessHttp,enable:!0,enableEsbuild:!0}],[l.join("serverless-http","lib","framework","get-framework.js"),{framework:s.availableFrameworks.serverlessHttp,enable:!0,version:"^2.7.0",patcher:"serverlessHttp",enableEsbuild:!0}],["axios",{framework:s.availableFrameworks.axios,enable:!0,version:">0.18.0 <1.0.0 || ^1.0.0",patcher:"outbound/axios",mainFilePath:"axios/dist/node/axios.cjs",extraInfo:{isOutbound:!0}}],["node-fetch",{framework:s.availableFrameworks.nodeFetch,enable:!0,version:"^2.0.0",patcher:"outbound/nodeFetch",mainFilePath:"node-fetch/lib/index.js",extraInfo:{isOutbound:!0}}],["request",{framework:s.availableFrameworks.request,enable:!0,version:"2.88.2",patcher:"outbound/request",extraInfo:{isOutbound:!0}}],["pg",{framework:s.availableFrameworks.pg,enable:!0,version:"^8.8.0",patcher:"outbound/pg",extraInfo:{isOutbound:!0}}],["@clickhouse/client-common",{framework:s.availableFrameworks.clickhouse,enable:!1,version:"^1.10.0",patcher:"outbound/clickhouse",extraInfo:{isOutbound:!0}}],["ioredis",{framework:s.availableFrameworks.ioredis,enable:!0,version:"^4.0.0 || ^5.0.0",patcher:"outbound/ioredis",extraInfo:{isOutbound:!0}}],["mongodb",{framework:s.availableFrameworks.mongodb,enable:!0,version:">=5.0.0 <8.0.0",patcher:"outbound/mongodb",extraInfo:{isOutbound:!0}}],["mongoose",{framework:s.availableFrameworks.mongoose,enable:!0,version:">=5.0.0 <7.0.0",patcher:"outbound/mongoose",extraInfo:{isOutbound:!0,coveredByFramework:{frameworkKey:"mongodb",versionRange:">=7.0.0 <10.0.0"}}}],["p-limit",{framework:"p-limit",enable:!0,version:"^3.0.0",patcher:"internal/pLimit"}]]),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"===g,investigationErrorStatusCodeRegex:n.DEFAULT_INVESTIGATION_ERROR_STATUS_CODE_REGEX,enableInvestigationArgsSending:!1,investigationRateLimits:{maxSameInvestigations:2,sameInvestigationTimeWindowMs:36e5,maxTotalInvestigations:25,maxTotalInvestigationsErrorBased:25,maxTotalInvestigationsDurationBased:20,totalInvestigationTimeWindowMs:216e5,maxUniqLogs:2,executionFlowMaxLength:20,exceptionMaxLength:20,maxStringLength:1024,maxArrayLength:10,maxObjectDepth:3,maxKeyLength:30,maxUniqueSetFailureErrors:100},machineMetricsInterval:1e4,performanceMetricsInterval:6e4,reingestInterval:3e4,extraHeaders:[],enableOutboundData:"true"===process.env.HUD_ENABLE_OUTBOUND_DATA,maxHTTPRequestBodySize:1024,maxHTTPResponseBodySize:5120,blacklistParams:[],censorshipRegexes:[],forensicsBlacklistFields:[],forensicsWhitelistFields:[],maxOutboundCountWithData:process.env.HUD_MAX_OUTBOUND_WITH_DATA?parseInt(process.env.HUD_MAX_OUTBOUND_WITH_DATA):10,maxTotalOutbounds:20,functionDetachEnabled:!1,functionDetachThresholdPerSecond:5833,enableMongoDocumentData:!1,enableTeardown:!1,flushOnUncaughtException:!1,fileTimestampsLogDelayMs:12e4,maxCustomFlowIds:1e3},machineMetricsSavedLength:2,isInvestigationEnabledByEnv:void 0!==g,suppressTraces:"true"!==process.env.HUD_DISABLE_SUPPRESS_TRACES,lambdaMinimunMemory:1024,lambdaBaseGivenTime:400,lambdaExtraGivenTimePerRequest:50,lambdaMaxGivenTime:700,throttleStatusCode:202,axiosFunctionId:c((0,u.v5)("axios",p)),nodeFetchFunctionId:c((0,u.v5)("node-fetch",p)),nodeFetchBodiesFunctionIds:{json:c((0,u.v5)("node-fetch-body-json",p)),text:c((0,u.v5)("node-fetch-body-text",p)),arrayBuffer:c((0,u.v5)("node-fetch-body-arrayBuffer",p)),blob:c((0,u.v5)("node-fetch-body-blob",p))},requestFunctionId:c((0,u.v5)("request-request",p)),requestMethodFunctionIds:{get:c((0,u.v5)("request-get",p)),head:c((0,u.v5)("request-head",p)),options:c((0,u.v5)("request-options",p)),post:c((0,u.v5)("request-post",p)),put:c((0,u.v5)("request-put",p)),patch:c((0,u.v5)("request-patch",p)),del:c((0,u.v5)("request-del",p)),delete:c((0,u.v5)("request-delete",p))},pgConnectFunctionId:c((0,u.v5)("pg-connect",p)),pgQueryFunctionId:c((0,u.v5)("pg-query",p)),pgEndFunctionId:c((0,u.v5)("pg-end",p)),clickhouseQueryFunctionId:c((0,u.v5)("clickhouse-query",p)),clickhouseExecFunctionId:c((0,u.v5)("clickhouse-exec",p)),clickhouseCommandFunctionId:c((0,u.v5)("clickhouse-command",p)),clickhouseInsertFunctionId:c((0,u.v5)("clickhouse-insert",p)),clickhouseCloseFunctionId:c((0,u.v5)("clickhouse-close",p)),functionsToInstrument:[{moduleName:"typeorm",fileToFunctionsMapping:{[l.join(l.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",esbuildFunctionIdVar:"hudFI",esbuildPluginMessagePrefix:"ESBuild plugin ",esbuildMark:"modifiedByHudESBuildPlugin-",esbuildMarkLength:67,esbuildUploadSourceMapTimeout:15e3,esbuildPluginLogsChunkSize:100,esbuildPluginLogsBatchSize:10,pluginsLogEndpoint:"https://yqp37dddrsewm6wdwwpwfraxqm0shdmx.lambda-url.eu-central-1.on.aws/",uninstrumentedFilesLogThreshold:2,tsNodeConfigTimeout:1e4,allowedEditExtensions:[".ts",".cts",".mts",".js",".cjs",".mjs"],nextJsMarkVarName:m,nextJsMarkStatement:`${m} = "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;const f=process.env.HUD_DEBUG?n.hudConfig.logger.debug:n.hudConfig.logger.default;n.loggerConfig={...f,console:"true"===process.env.HUD_VERBOSE};class h extends Error{path;code;constructor(e,n){super(),this.path=e,this.code=n}}n.HudFailedReadConfigError=h},3903:e=>{e.exports=require("uuid")},5453:(e,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.SDK_VERSION=void 0,n.SDK_VERSION="1.8.12"},6928:e=>{e.exports=require("path")},7089:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ObjectStoreConfigSchema=void 0;const i=t(1569),a=i.z.object({type:i.z.literal("s3")}),o=i.z.object({type:i.z.literal("disk"),path:i.z.string()}),r=i.z.object({type:i.z.literal("customer_s3"),bucket:i.z.string(),region:i.z.string(),prefix:i.z.string().optional()});n.ObjectStoreConfigSchema=i.z.union([a,o,r])},8528:e=>{e.exports=require("./dto")}},n={};return function t(i){var a=n[i];if(void 0!==a)return a.exports;var o=n[i]={exports:{}};return e[i].call(o.exports,o,o.exports,t),o.exports}(2509)})());
2
2
  //# sourceMappingURL=config.js.map