@shopify/cli 3.85.1 → 3.85.3

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.
Files changed (81) hide show
  1. package/dist/{chunk-TRKSH2XY.js → chunk-3XWYM7QS.js} +3 -3
  2. package/dist/{chunk-7JE3EHN3.js → chunk-5RNGA7FX.js} +5 -5
  3. package/dist/{chunk-6YB46YWH.js → chunk-6A6GDV25.js} +4 -4
  4. package/dist/{chunk-XNKJ52IR.js → chunk-6RJ7HBOQ.js} +3 -3
  5. package/dist/{chunk-ZZACM6JY.js → chunk-AMWSD3HH.js} +3 -3
  6. package/dist/{chunk-CKYPRLQQ.js → chunk-C45MKMJT.js} +400 -316
  7. package/dist/{chunk-FLHWGFGH.js → chunk-CAONVM2S.js} +3 -3
  8. package/dist/{chunk-GGNBWCCE.js → chunk-D5DJSKHK.js} +7 -7
  9. package/dist/{chunk-S3MBABAK.js → chunk-EDXQ22O4.js} +6 -6
  10. package/dist/{chunk-Y2JP6WFP.js → chunk-EG6MBBEN.js} +2 -2
  11. package/dist/{chunk-LOJKECKW.js → chunk-EWEA4LRT.js} +2 -2
  12. package/dist/{chunk-CNY4KRKG.js → chunk-F7TU455C.js} +2 -2
  13. package/dist/{chunk-KIC7OBUL.js → chunk-FGEKMLLA.js} +6 -6
  14. package/dist/{chunk-62H2KYOJ.js → chunk-GRVHLYQS.js} +4 -4
  15. package/dist/{chunk-TVWMGUCW.js → chunk-HBANZKAF.js} +3 -3
  16. package/dist/{chunk-MHFD5A4P.js → chunk-HS2O5IHL.js} +3 -3
  17. package/dist/{chunk-PYZUPEOA.js → chunk-HTTZVPR6.js} +3 -3
  18. package/dist/{chunk-G6OERDCU.js → chunk-I4ATBX6D.js} +4 -4
  19. package/dist/{chunk-YJZEHV2H.js → chunk-IHXRXBUN.js} +6 -6
  20. package/dist/{chunk-7LEPNDDJ.js → chunk-JAUHWNMJ.js} +5 -5
  21. package/dist/{chunk-KJT4XRJY.js → chunk-L54PNQGV.js} +2 -2
  22. package/dist/{chunk-R7QUG5YH.js → chunk-LJXXOFEJ.js} +2 -2
  23. package/dist/{chunk-O47I6ERR.js → chunk-NLFRHIZY.js} +6 -6
  24. package/dist/{chunk-7N5JGLLX.js → chunk-OQKAZQIC.js} +5 -5
  25. package/dist/{chunk-XKHE52EY.js → chunk-OURS5IQY.js} +3 -3
  26. package/dist/{chunk-VMPHJR5V.js → chunk-QHKSKL4E.js} +4 -4
  27. package/dist/{chunk-J3DHMVKN.js → chunk-QP2MOS2Y.js} +2 -2
  28. package/dist/{chunk-UYWDOH6Y.js → chunk-RPU6TIF2.js} +7 -7
  29. package/dist/{chunk-OXCV2R7K.js → chunk-UW4ASA6Y.js} +3 -3
  30. package/dist/{chunk-VCGC2OW6.js → chunk-V5ONTA7N.js} +2 -2
  31. package/dist/{chunk-Q64LTCDT.js → chunk-VR6Z7LKU.js} +3 -3
  32. package/dist/{chunk-OXVB7GS3.js → chunk-VVUZFYUK.js} +4 -4
  33. package/dist/{chunk-JDI5KJ6D.js → chunk-XJBIASMX.js} +3 -3
  34. package/dist/{chunk-W54BTT4L.js → chunk-Y4H4HMEZ.js} +2 -2
  35. package/dist/{chunk-YIQ4GHA2.js → chunk-ZHKIKKU7.js} +4 -4
  36. package/dist/cli/commands/auth/login.js +11 -11
  37. package/dist/cli/commands/auth/login.test.js +12 -12
  38. package/dist/cli/commands/auth/logout.js +11 -11
  39. package/dist/cli/commands/auth/logout.test.js +12 -12
  40. package/dist/cli/commands/cache/clear.js +11 -11
  41. package/dist/cli/commands/debug/command-flags.js +11 -11
  42. package/dist/cli/commands/docs/generate.js +11 -11
  43. package/dist/cli/commands/docs/generate.test.js +11 -11
  44. package/dist/cli/commands/help.js +11 -11
  45. package/dist/cli/commands/kitchen-sink/async.js +12 -12
  46. package/dist/cli/commands/kitchen-sink/async.test.js +12 -12
  47. package/dist/cli/commands/kitchen-sink/index.js +14 -14
  48. package/dist/cli/commands/kitchen-sink/index.test.js +14 -14
  49. package/dist/cli/commands/kitchen-sink/prompts.js +12 -12
  50. package/dist/cli/commands/kitchen-sink/prompts.test.js +12 -12
  51. package/dist/cli/commands/kitchen-sink/static.js +12 -12
  52. package/dist/cli/commands/kitchen-sink/static.test.js +12 -12
  53. package/dist/cli/commands/notifications/generate.js +12 -12
  54. package/dist/cli/commands/notifications/list.js +12 -12
  55. package/dist/cli/commands/search.js +12 -12
  56. package/dist/cli/commands/upgrade.js +12 -12
  57. package/dist/cli/commands/version.js +12 -12
  58. package/dist/cli/commands/version.test.js +12 -12
  59. package/dist/cli/services/commands/notifications.js +7 -7
  60. package/dist/cli/services/commands/search.js +3 -3
  61. package/dist/cli/services/commands/search.test.js +3 -3
  62. package/dist/cli/services/commands/version.js +4 -4
  63. package/dist/cli/services/commands/version.test.js +5 -5
  64. package/dist/cli/services/kitchen-sink/async.js +3 -3
  65. package/dist/cli/services/kitchen-sink/prompts.js +3 -3
  66. package/dist/cli/services/kitchen-sink/static.js +3 -3
  67. package/dist/cli/services/upgrade.js +4 -4
  68. package/dist/cli/services/upgrade.test.js +5 -5
  69. package/dist/{custom-oclif-loader-MVTJFCUD.js → custom-oclif-loader-YDKLB47A.js} +3 -3
  70. package/dist/{error-handler-OEZ5DBZB.js → error-handler-BYZU2C5C.js} +9 -9
  71. package/dist/hooks/postrun.js +7 -7
  72. package/dist/hooks/prerun.js +8 -8
  73. package/dist/index.js +232 -127
  74. package/dist/{local-72XWEFWL.js → local-XLJD5WYP.js} +3 -3
  75. package/dist/{node-package-manager-TTBSTZXN.js → node-package-manager-I7AWSWJ4.js} +4 -4
  76. package/dist/{path-COZT77T2.js → path-GB4VIEM6.js} +2 -2
  77. package/dist/tsconfig.tsbuildinfo +1 -1
  78. package/dist/{ui-XUA267UA.js → ui-2AJAFJYY.js} +3 -3
  79. package/dist/{workerd-KJQYQH4A.js → workerd-4DJKRJUB.js} +12 -12
  80. package/oclif.manifest.json +1 -1
  81. package/package.json +7 -7
@@ -4,17 +4,17 @@ import {
4
4
  import {
5
5
  fanoutHooks,
6
6
  reportAnalyticsEvent
7
- } from "./chunk-S3MBABAK.js";
7
+ } from "./chunk-EDXQ22O4.js";
8
8
  import {
9
9
  getEnvironmentData,
10
10
  isLocalEnvironment
11
- } from "./chunk-KIC7OBUL.js";
11
+ } from "./chunk-FGEKMLLA.js";
12
12
  import {
13
13
  runWithRateLimit
14
- } from "./chunk-OXCV2R7K.js";
14
+ } from "./chunk-UW4ASA6Y.js";
15
15
  import {
16
16
  CLI_KIT_VERSION
17
- } from "./chunk-KJT4XRJY.js";
17
+ } from "./chunk-L54PNQGV.js";
18
18
  import {
19
19
  AbortSilentError,
20
20
  CancelExecution,
@@ -29,7 +29,7 @@ import {
29
29
  reportingRateLimit,
30
30
  require_stacktracey,
31
31
  shouldReportErrorAsUnexpected
32
- } from "./chunk-MHFD5A4P.js";
32
+ } from "./chunk-HS2O5IHL.js";
33
33
  import {
34
34
  require_lib
35
35
  } from "./chunk-F7F4BQYW.js";
@@ -39,7 +39,7 @@ import {
39
39
  joinPath,
40
40
  normalizePath,
41
41
  relativePath
42
- } from "./chunk-Y2JP6WFP.js";
42
+ } from "./chunk-EG6MBBEN.js";
43
43
  import {
44
44
  __commonJS,
45
45
  __require,
@@ -465,9 +465,9 @@ var require_byline = __commonJS({
465
465
  }
466
466
  });
467
467
 
468
- // ../../node_modules/.pnpm/@bugsnag+node@7.25.0/node_modules/@bugsnag/node/dist/bugsnag.js
468
+ // ../../node_modules/.pnpm/@bugsnag+node@8.6.0/node_modules/@bugsnag/node/dist/bugsnag.js
469
469
  var require_bugsnag = __commonJS({
470
- "../../node_modules/.pnpm/@bugsnag+node@7.25.0/node_modules/@bugsnag/node/dist/bugsnag.js"(exports, module) {
470
+ "../../node_modules/.pnpm/@bugsnag+node@8.6.0/node_modules/@bugsnag/node/dist/bugsnag.js"(exports, module) {
471
471
  init_cjs_shims();
472
472
  (function(f) {
473
473
  if (typeof exports == "object" && typeof module < "u")
@@ -492,22 +492,22 @@ var require_bugsnag = __commonJS({
492
492
  metaData: this.metadata
493
493
  };
494
494
  }, Breadcrumb2;
495
- }(), _$Breadcrumb_1 = Breadcrumb, _$breadcrumbTypes_6 = ["navigation", "request", "process", "log", "user", "state", "error", "manual"], _$reduce_16 = function(arr, fn, accum) {
495
+ }(), _$Breadcrumb_7 = Breadcrumb, _$breadcrumbTypes_12 = ["navigation", "request", "process", "log", "user", "state", "error", "manual"], _$reduce_22 = function(arr, fn, accum) {
496
496
  for (var val = accum, i = 0, len = arr.length; i < len; i++) val = fn(val, arr[i], i, arr);
497
497
  return val;
498
- }, _$filter_11 = function(arr, fn) {
499
- return _$reduce_16(arr, function(accum, item, i, arr2) {
498
+ }, _$filter_17 = function(arr, fn) {
499
+ return _$reduce_22(arr, function(accum, item, i, arr2) {
500
500
  return fn(item, i, arr2) ? accum.concat(item) : accum;
501
501
  }, []);
502
- }, _$includes_12 = function(arr, x) {
503
- return _$reduce_16(arr, function(accum, item, i, arr2) {
502
+ }, _$includes_18 = function(arr, x) {
503
+ return _$reduce_22(arr, function(accum, item, i, arr2) {
504
504
  return accum === !0 || item === x;
505
505
  }, !1);
506
- }, _$isArray_13 = function(obj) {
506
+ }, _$isArray_19 = function(obj) {
507
507
  return Object.prototype.toString.call(obj) === "[object Array]";
508
508
  }, _hasDontEnumBug = !{
509
509
  toString: null
510
- }.propertyIsEnumerable("toString"), _dontEnums = ["toString", "toLocaleString", "valueOf", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "constructor"], _$keys_14 = function(obj) {
510
+ }.propertyIsEnumerable("toString"), _dontEnums = ["toString", "toLocaleString", "valueOf", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "constructor"], _$keys_20 = function(obj) {
511
511
  var result = [], prop;
512
512
  for (prop in obj)
513
513
  Object.prototype.hasOwnProperty.call(obj, prop) && result.push(prop);
@@ -515,36 +515,36 @@ var require_bugsnag = __commonJS({
515
515
  for (var i = 0, len = _dontEnums.length; i < len; i++)
516
516
  Object.prototype.hasOwnProperty.call(obj, _dontEnums[i]) && result.push(_dontEnums[i]);
517
517
  return result;
518
- }, _$intRange_25 = function(min, max) {
518
+ }, _$intRange_31 = function(min, max) {
519
519
  return min === void 0 && (min = 1), max === void 0 && (max = 1 / 0), function(value) {
520
520
  return typeof value == "number" && parseInt("" + value, 10) === value && value >= min && value <= max;
521
521
  };
522
- }, _$listOfFunctions_26 = function(value) {
523
- return typeof value == "function" || _$isArray_13(value) && _$filter_11(value, function(f) {
522
+ }, _$listOfFunctions_32 = function(value) {
523
+ return typeof value == "function" || _$isArray_19(value) && _$filter_17(value, function(f) {
524
524
  return typeof f == "function";
525
525
  }).length === value.length;
526
- }, _$stringWithLength_27 = function(value) {
526
+ }, _$stringWithLength_33 = function(value) {
527
527
  return typeof value == "string" && !!value.length;
528
- }, _$config_3 = {}, defaultErrorTypes = function() {
528
+ }, _$config_9 = {}, defaultErrorTypes = function() {
529
529
  return {
530
530
  unhandledExceptions: !0,
531
531
  unhandledRejections: !0
532
532
  };
533
533
  };
534
- _$config_3.schema = {
534
+ _$config_9.schema = {
535
535
  apiKey: {
536
536
  defaultValue: function() {
537
537
  return null;
538
538
  },
539
539
  message: "is required",
540
- validate: _$stringWithLength_27
540
+ validate: _$stringWithLength_33
541
541
  },
542
542
  appVersion: {
543
543
  defaultValue: function() {
544
544
  },
545
545
  message: "should be a string",
546
546
  validate: function(value) {
547
- return value === void 0 || _$stringWithLength_27(value);
547
+ return value === void 0 || _$stringWithLength_33(value);
548
548
  }
549
549
  },
550
550
  appType: {
@@ -552,7 +552,7 @@ var require_bugsnag = __commonJS({
552
552
  },
553
553
  message: "should be a string",
554
554
  validate: function(value) {
555
- return value === void 0 || _$stringWithLength_27(value);
555
+ return value === void 0 || _$stringWithLength_33(value);
556
556
  }
557
557
  },
558
558
  autoDetectErrors: {
@@ -572,10 +572,10 @@ var require_bugsnag = __commonJS({
572
572
  allowPartialObject: !0,
573
573
  validate: function(value) {
574
574
  if (typeof value != "object" || !value) return !1;
575
- var providedKeys = _$keys_14(value), defaultKeys = _$keys_14(defaultErrorTypes());
576
- return !(_$filter_11(providedKeys, function(k) {
577
- return _$includes_12(defaultKeys, k);
578
- }).length < providedKeys.length || _$filter_11(_$keys_14(value), function(k) {
575
+ var providedKeys = _$keys_20(value), defaultKeys = _$keys_20(defaultErrorTypes());
576
+ return !(_$filter_17(providedKeys, function(k) {
577
+ return _$includes_18(defaultKeys, k);
578
+ }).length < providedKeys.length || _$filter_17(_$keys_20(value), function(k) {
579
579
  return typeof value[k] != "boolean";
580
580
  }).length > 0);
581
581
  }
@@ -585,27 +585,30 @@ var require_bugsnag = __commonJS({
585
585
  return [];
586
586
  },
587
587
  message: "should be a function or array of functions",
588
- validate: _$listOfFunctions_26
588
+ validate: _$listOfFunctions_32
589
589
  },
590
590
  onSession: {
591
591
  defaultValue: function() {
592
592
  return [];
593
593
  },
594
594
  message: "should be a function or array of functions",
595
- validate: _$listOfFunctions_26
595
+ validate: _$listOfFunctions_32
596
596
  },
597
597
  onBreadcrumb: {
598
598
  defaultValue: function() {
599
599
  return [];
600
600
  },
601
601
  message: "should be a function or array of functions",
602
- validate: _$listOfFunctions_26
602
+ validate: _$listOfFunctions_32
603
603
  },
604
604
  endpoints: {
605
- defaultValue: function() {
606
- return {
605
+ defaultValue: function(endpoints) {
606
+ return typeof endpoints > "u" ? {
607
607
  notify: "https://notify.bugsnag.com",
608
608
  sessions: "https://sessions.bugsnag.com"
609
+ } : {
610
+ notify: null,
611
+ sessions: null
609
612
  };
610
613
  },
611
614
  message: "should be an object containing endpoint URLs { notify, sessions }",
@@ -613,9 +616,9 @@ var require_bugsnag = __commonJS({
613
616
  return (
614
617
  // first, ensure it's an object
615
618
  val && typeof val == "object" && // notify and sessions must always be set
616
- _$stringWithLength_27(val.notify) && _$stringWithLength_27(val.sessions) && // ensure no keys other than notify/session are set on endpoints object
617
- _$filter_11(_$keys_14(val), function(k) {
618
- return !_$includes_12(["notify", "sessions"], k);
619
+ _$stringWithLength_33(val.notify) && _$stringWithLength_33(val.sessions) && // ensure no keys other than notify/session are set on endpoints object
620
+ _$filter_17(_$keys_20(val), function(k) {
621
+ return !_$includes_18(["notify", "sessions"], k);
619
622
  }).length === 0
620
623
  );
621
624
  }
@@ -635,7 +638,7 @@ var require_bugsnag = __commonJS({
635
638
  },
636
639
  message: "should be an array of strings",
637
640
  validate: function(value) {
638
- return value === null || _$isArray_13(value) && _$filter_11(value, function(f) {
641
+ return value === null || _$isArray_19(value) && _$filter_17(value, function(f) {
639
642
  return typeof f == "string";
640
643
  }).length === value.length;
641
644
  }
@@ -655,17 +658,17 @@ var require_bugsnag = __commonJS({
655
658
  },
656
659
  message: "should be a number \u2264100",
657
660
  validate: function(value) {
658
- return _$intRange_25(0, 100)(value);
661
+ return _$intRange_31(0, 100)(value);
659
662
  }
660
663
  },
661
664
  enabledBreadcrumbTypes: {
662
665
  defaultValue: function() {
663
- return _$breadcrumbTypes_6;
666
+ return _$breadcrumbTypes_12;
664
667
  },
665
- message: "should be null or a list of available breadcrumb types (" + _$breadcrumbTypes_6.join(",") + ")",
668
+ message: "should be null or a list of available breadcrumb types (" + _$breadcrumbTypes_12.join(",") + ")",
666
669
  validate: function(value) {
667
- return value === null || _$isArray_13(value) && _$reduce_16(value, function(accum, maybeType) {
668
- return accum === !1 ? accum : _$includes_12(_$breadcrumbTypes_6, maybeType);
670
+ return value === null || _$isArray_19(value) && _$reduce_22(value, function(accum, maybeType) {
671
+ return accum === !1 ? accum : _$includes_18(_$breadcrumbTypes_12, maybeType);
669
672
  }, !0);
670
673
  }
671
674
  },
@@ -683,8 +686,8 @@ var require_bugsnag = __commonJS({
683
686
  },
684
687
  message: "should be an object with { id, email, name } properties",
685
688
  validate: function(value) {
686
- return value === null || value && _$reduce_16(_$keys_14(value), function(accum, key) {
687
- return accum && _$includes_12(["id", "email", "name"], key);
689
+ return value === null || value && _$reduce_22(_$keys_20(value), function(accum, key) {
690
+ return accum && _$includes_18(["id", "email", "name"], key);
688
691
  }, !0);
689
692
  }
690
693
  },
@@ -702,7 +705,7 @@ var require_bugsnag = __commonJS({
702
705
  },
703
706
  message: "should be null or an object with methods { debug, info, warn, error }",
704
707
  validate: function(value) {
705
- return !value || value && _$reduce_16(["debug", "info", "warn", "error"], function(accum, method) {
708
+ return !value || value && _$reduce_22(["debug", "info", "warn", "error"], function(accum, method) {
706
709
  return accum && typeof value[method] == "function";
707
710
  }, !0);
708
711
  }
@@ -713,7 +716,7 @@ var require_bugsnag = __commonJS({
713
716
  },
714
717
  message: "should be an array of strings|regexes",
715
718
  validate: function(value) {
716
- return _$isArray_13(value) && value.length === _$filter_11(value, function(s) {
719
+ return _$isArray_19(value) && value.length === _$filter_17(value, function(s) {
717
720
  return typeof s == "string" || s && typeof s.test == "function";
718
721
  }).length;
719
722
  }
@@ -724,7 +727,7 @@ var require_bugsnag = __commonJS({
724
727
  },
725
728
  message: "should be an array of plugin objects",
726
729
  validate: function(value) {
727
- return _$isArray_13(value) && value.length === _$filter_11(value, function(p) {
730
+ return _$isArray_19(value) && value.length === _$filter_17(value, function(p) {
728
731
  return p && typeof p == "object" && typeof p.load == "function";
729
732
  }).length;
730
733
  }
@@ -735,24 +738,42 @@ var require_bugsnag = __commonJS({
735
738
  },
736
739
  message: 'should be an array of objects that have a "name" property',
737
740
  validate: function(value) {
738
- return _$isArray_13(value) && value.length === _$filter_11(value, function(feature) {
741
+ return _$isArray_19(value) && value.length === _$filter_17(value, function(feature) {
739
742
  return feature && typeof feature == "object" && typeof feature.name == "string";
740
743
  }).length;
741
744
  }
745
+ },
746
+ reportUnhandledPromiseRejectionsAsHandled: {
747
+ defaultValue: function() {
748
+ return !1;
749
+ },
750
+ message: "should be true|false",
751
+ validate: function(value) {
752
+ return value === !0 || value === !1;
753
+ }
754
+ },
755
+ sendPayloadChecksums: {
756
+ defaultValue: function() {
757
+ return !1;
758
+ },
759
+ message: "should be true|false",
760
+ validate: function(value) {
761
+ return value === !0 || value === !1;
762
+ }
742
763
  }
743
764
  };
744
- var _$errorStackParser_9 = require_error_stack_parser(), _$assign_10 = function(target) {
765
+ var _$errorStackParser_15 = require_error_stack_parser(), _$assign_16 = function(target) {
745
766
  for (var i = 1; i < arguments.length; i++) {
746
767
  var source = arguments[i];
747
768
  for (var key in source)
748
769
  Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
749
770
  }
750
771
  return target;
751
- }, _$map_15 = function(arr, fn) {
752
- return _$reduce_16(arr, function(accum, item, i, arr2) {
772
+ }, _$map_21 = function(arr, fn) {
773
+ return _$reduce_22(arr, function(accum, item, i, arr2) {
753
774
  return accum.concat(fn(item, i, arr2));
754
775
  }, []);
755
- }, _$safeJsonStringify_31 = function(data, replacer, space, opts) {
776
+ }, _$safeJsonStringify_5 = function(data, replacer, space, opts) {
756
777
  var redactedKeys = opts && opts.redactedKeys ? opts.redactedKeys : [], redactedPaths = opts && opts.redactedPaths ? opts.redactedPaths : [];
757
778
  return JSON.stringify(prepareObjForSerialization(data, redactedKeys, redactedPaths), replacer, space);
758
779
  }, MAX_DEPTH = 20, MAX_EDGES = 25e3, MIN_PRESERVED_DEPTH = 8, REPLACEMENT_NODE = "...";
@@ -777,7 +798,7 @@ var require_bugsnag = __commonJS({
777
798
  if (typeof patterns[i] == "string" && patterns[i].toLowerCase() === key.toLowerCase() || patterns[i] && typeof patterns[i].test == "function" && patterns[i].test(key)) return !0;
778
799
  return !1;
779
800
  }
780
- function __isArray_31(obj) {
801
+ function __isArray_5(obj) {
781
802
  return Object.prototype.toString.call(obj) === "[object Array]";
782
803
  }
783
804
  function safelyGetProp(obj, prop) {
@@ -813,7 +834,7 @@ var require_bugsnag = __commonJS({
813
834
  }, path2);
814
835
  return seen.pop(), eResult;
815
836
  }
816
- if (__isArray_31(obj2)) {
837
+ if (__isArray_5(obj2)) {
817
838
  for (var aResult = [], i = 0, len = obj2.length; i < len; i++) {
818
839
  if (edgesExceeded()) {
819
840
  aResult.push(REPLACEMENT_NODE);
@@ -845,7 +866,7 @@ var require_bugsnag = __commonJS({
845
866
  }
846
867
  function add(existingFeatures, existingFeatureKeys, name2, variant) {
847
868
  if (typeof name2 == "string") {
848
- variant === void 0 ? variant = null : variant !== null && typeof variant != "string" && (variant = _$safeJsonStringify_31(variant));
869
+ variant === void 0 ? variant = null : variant !== null && typeof variant != "string" && (variant = _$safeJsonStringify_5(variant));
849
870
  var existingIndex = existingFeatureKeys[name2];
850
871
  if (typeof existingIndex == "number") {
851
872
  existingFeatures[existingIndex] = {
@@ -861,7 +882,7 @@ var require_bugsnag = __commonJS({
861
882
  }
862
883
  }
863
884
  function merge(existingFeatures, newFeatures, existingFeatureKeys) {
864
- if (_$isArray_13(newFeatures)) {
885
+ if (_$isArray_19(newFeatures)) {
865
886
  for (var i = 0; i < newFeatures.length; ++i) {
866
887
  var feature = newFeatures[i];
867
888
  feature === null || typeof feature != "object" || add(existingFeatures, existingFeatureKeys, feature.name, feature.variant);
@@ -870,7 +891,7 @@ var require_bugsnag = __commonJS({
870
891
  }
871
892
  }
872
893
  function toEventApi(featureFlags) {
873
- return _$map_15(_$filter_11(featureFlags, Boolean), function(_ref) {
894
+ return _$map_21(_$filter_17(featureFlags, Boolean), function(_ref) {
874
895
  var name2 = _ref.name, variant = _ref.variant, flag = {
875
896
  featureFlag: name2
876
897
  };
@@ -881,19 +902,19 @@ var require_bugsnag = __commonJS({
881
902
  var existingIndex = featuresIndex[name2];
882
903
  typeof existingIndex == "number" && (features[existingIndex] = null, delete featuresIndex[name2]);
883
904
  }
884
- var _$featureFlagDelegate_17 = {
905
+ var _$featureFlagDelegate_23 = {
885
906
  add,
886
907
  clear,
887
908
  merge,
888
909
  toEventApi
889
- }, _$hasStack_18 = function(err) {
910
+ }, _$hasStack_24 = function(err) {
890
911
  return !!err && (!!err.stack || !!err.stacktrace || !!err["opera#sourceloc"]) && typeof (err.stack || err.stacktrace || err["opera#sourceloc"]) == "string" && err.stack !== err.name + ": " + err.message;
891
- }, _$iserror_19 = require_iserror(), __add_21 = function(state, section, keyOrObj, maybeVal) {
912
+ }, _$iserror_25 = require_iserror(), __add_27 = function(state, section, keyOrObj, maybeVal) {
892
913
  var _updates;
893
914
  if (section) {
894
915
  var updates;
895
- if (keyOrObj === null) return __clear_21(state, section);
896
- typeof keyOrObj == "object" && (updates = keyOrObj), typeof keyOrObj == "string" && (updates = (_updates = {}, _updates[keyOrObj] = maybeVal, _updates)), updates && (section === "__proto__" || section === "constructor" || section === "prototype" || (state[section] || (state[section] = {}), state[section] = _$assign_10({}, state[section], updates)));
916
+ if (keyOrObj === null) return __clear_27(state, section);
917
+ typeof keyOrObj == "object" && (updates = keyOrObj), typeof keyOrObj == "string" && (updates = (_updates = {}, _updates[keyOrObj] = maybeVal, _updates)), updates && (section === "__proto__" || section === "constructor" || section === "prototype" || (state[section] || (state[section] = {}), state[section] = _$assign_16({}, state[section], updates)));
897
918
  }
898
919
  }, get = function(state, section, key) {
899
920
  if (typeof section == "string") {
@@ -902,7 +923,7 @@ var require_bugsnag = __commonJS({
902
923
  if (state[section])
903
924
  return state[section][key];
904
925
  }
905
- }, __clear_21 = function(state, section, key) {
926
+ }, __clear_27 = function(state, section, key) {
906
927
  if (typeof section == "string") {
907
928
  if (!key) {
908
929
  delete state[section];
@@ -910,46 +931,50 @@ var require_bugsnag = __commonJS({
910
931
  }
911
932
  section === "__proto__" || section === "constructor" || section === "prototype" || state[section] && delete state[section][key];
912
933
  }
913
- }, _$metadataDelegate_21 = {
914
- add: __add_21,
934
+ }, _$metadataDelegate_27 = {
935
+ add: __add_27,
915
936
  get,
916
- clear: __clear_21
937
+ clear: __clear_27
917
938
  };
918
939
  function _extends() {
919
- return _extends = Object.assign ? Object.assign.bind() : function(target) {
920
- for (var i = 1; i < arguments.length; i++) {
921
- var source = arguments[i];
922
- for (var key in source)
923
- Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
940
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
941
+ for (var e = 1; e < arguments.length; e++) {
942
+ var t = arguments[e];
943
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
924
944
  }
925
- return target;
926
- }, _extends.apply(this, arguments);
945
+ return n;
946
+ }, _extends.apply(null, arguments);
927
947
  }
928
948
  var StackGenerator = require_stack_generator(), Event = /* @__PURE__ */ function() {
929
949
  function Event2(errorClass, errorMessage, stacktrace, handledState, originalError) {
930
- stacktrace === void 0 && (stacktrace = []), handledState === void 0 && (handledState = defaultHandledState()), this.apiKey = void 0, this.context = void 0, this.groupingHash = void 0, this.originalError = originalError, this._handledState = handledState, this.severity = this._handledState.severity, this.unhandled = this._handledState.unhandled, this.app = {}, this.device = {}, this.request = {}, this.breadcrumbs = [], this.threads = [], this._metadata = {}, this._features = [], this._featuresIndex = {}, this._user = {}, this._session = void 0, this._correlation = void 0, this.errors = [createBugsnagError(errorClass, errorMessage, Event2.__type, stacktrace)];
950
+ stacktrace === void 0 && (stacktrace = []), handledState === void 0 && (handledState = defaultHandledState()), this.apiKey = void 0, this.context = void 0, this.groupingHash = void 0, this.originalError = originalError, this._handledState = handledState, this.severity = this._handledState.severity, this.unhandled = this._handledState.unhandled, this.app = {}, this.device = {}, this.request = {}, this.breadcrumbs = [], this.threads = [], this._metadata = {}, this._features = [], this._featuresIndex = {}, this._user = {}, this._session = void 0, this._correlation = void 0, this._groupingDiscriminator = void 0, this.errors = [createBugsnagError(errorClass, errorMessage, Event2.__type, stacktrace)];
931
951
  }
932
952
  var _proto = Event2.prototype;
933
953
  return _proto.addMetadata = function(section, keyOrObj, maybeVal) {
934
- return _$metadataDelegate_21.add(this._metadata, section, keyOrObj, maybeVal);
954
+ return _$metadataDelegate_27.add(this._metadata, section, keyOrObj, maybeVal);
935
955
  }, _proto.setTraceCorrelation = function(traceId, spanId) {
936
956
  typeof traceId == "string" && (this._correlation = _extends({
937
957
  traceId
938
958
  }, typeof spanId == "string" ? {
939
959
  spanId
940
960
  } : {}));
961
+ }, _proto.getGroupingDiscriminator = function() {
962
+ return this._groupingDiscriminator;
963
+ }, _proto.setGroupingDiscriminator = function(value) {
964
+ var previousValue = this._groupingDiscriminator;
965
+ return (typeof value == "string" || value === null || value === void 0) && (this._groupingDiscriminator = value), previousValue;
941
966
  }, _proto.getMetadata = function(section, key) {
942
- return _$metadataDelegate_21.get(this._metadata, section, key);
967
+ return _$metadataDelegate_27.get(this._metadata, section, key);
943
968
  }, _proto.clearMetadata = function(section, key) {
944
- return _$metadataDelegate_21.clear(this._metadata, section, key);
969
+ return _$metadataDelegate_27.clear(this._metadata, section, key);
945
970
  }, _proto.addFeatureFlag = function(name2, variant) {
946
- variant === void 0 && (variant = null), _$featureFlagDelegate_17.add(this._features, this._featuresIndex, name2, variant);
971
+ variant === void 0 && (variant = null), _$featureFlagDelegate_23.add(this._features, this._featuresIndex, name2, variant);
947
972
  }, _proto.addFeatureFlags = function(featureFlags) {
948
- _$featureFlagDelegate_17.merge(this._features, featureFlags, this._featuresIndex);
973
+ _$featureFlagDelegate_23.merge(this._features, featureFlags, this._featuresIndex);
949
974
  }, _proto.getFeatureFlags = function() {
950
- return _$featureFlagDelegate_17.toEventApi(this._features);
975
+ return _$featureFlagDelegate_23.toEventApi(this._features);
951
976
  }, _proto.clearFeatureFlag = function(name2) {
952
- _$featureFlagDelegate_17.clear(this._features, this._featuresIndex, name2);
977
+ _$featureFlagDelegate_23.clear(this._features, this._featuresIndex, name2);
953
978
  }, _proto.clearFeatureFlags = function() {
954
979
  this._features = [], this._featuresIndex = {};
955
980
  }, _proto.getUser = function() {
@@ -963,8 +988,8 @@ var require_bugsnag = __commonJS({
963
988
  }, _proto.toJSON = function() {
964
989
  return {
965
990
  payloadVersion: "4",
966
- exceptions: _$map_15(this.errors, function(er) {
967
- return _$assign_10({}, er, {
991
+ exceptions: _$map_21(this.errors, function(er) {
992
+ return _$assign_16({}, er, {
968
993
  message: er.errorMessage
969
994
  });
970
995
  }),
@@ -977,6 +1002,7 @@ var require_bugsnag = __commonJS({
977
1002
  breadcrumbs: this.breadcrumbs,
978
1003
  context: this.context,
979
1004
  groupingHash: this.groupingHash,
1005
+ groupingDiscriminator: this._groupingDiscriminator,
980
1006
  metaData: this._metadata,
981
1007
  user: this._user,
982
1008
  session: this._session,
@@ -1012,7 +1038,7 @@ var require_bugsnag = __commonJS({
1012
1038
  errorClass: ensureString(errorClass),
1013
1039
  errorMessage: ensureString(errorMessage),
1014
1040
  type,
1015
- stacktrace: _$reduce_16(stacktrace, function(accum, frame) {
1041
+ stacktrace: _$reduce_22(stacktrace, function(accum, frame) {
1016
1042
  var f = formatStackframe(frame);
1017
1043
  try {
1018
1044
  return JSON.stringify(f) === "{}" ? accum : accum.concat(f);
@@ -1026,9 +1052,9 @@ var require_bugsnag = __commonJS({
1026
1052
  return error.cause ? [error].concat(getCauseStack(error.cause)) : [error];
1027
1053
  }
1028
1054
  Event.getStacktrace = function(error, errorFramesToSkip, backtraceFramesToSkip) {
1029
- if (_$hasStack_18(error)) return _$errorStackParser_9.parse(error).slice(errorFramesToSkip);
1055
+ if (_$hasStack_24(error)) return _$errorStackParser_15.parse(error).slice(errorFramesToSkip);
1030
1056
  try {
1031
- return _$filter_11(StackGenerator.backtrace(), function(frame) {
1057
+ return _$filter_17(StackGenerator.backtrace(), function(frame) {
1032
1058
  return (frame.functionName || "").indexOf("StackGenerator$$") === -1;
1033
1059
  }).slice(1 + backtraceFramesToSkip);
1034
1060
  } catch {
@@ -1054,8 +1080,8 @@ var require_bugsnag = __commonJS({
1054
1080
  event = new Event(error.name, error.message, [], handledState, maybeError);
1055
1081
  }
1056
1082
  if (error.name === "InvalidError" && event.addMetadata("" + component, "non-error parameter", makeSerialisable(maybeError)), error.cause) {
1057
- var _event$errors, causes = getCauseStack(error).slice(1), normalisedCauses = _$map_15(causes, function(cause) {
1058
- var stacktrace2 = _$iserror_19(cause) && _$hasStack_18(cause) ? _$errorStackParser_9.parse(cause) : [], _normaliseError2 = normaliseError(cause, !0, "error cause"), error2 = _normaliseError2[0];
1083
+ var _event$errors, causes = getCauseStack(error).slice(1), normalisedCauses = _$map_21(causes, function(cause) {
1084
+ var stacktrace2 = _$iserror_25(cause) && _$hasStack_24(cause) ? _$errorStackParser_15.parse(cause) : [], _normaliseError2 = normaliseError(cause, !0, "error cause"), error2 = _normaliseError2[0];
1059
1085
  return error2.name === "InvalidError" && event.addMetadata("error cause", makeSerialisable(cause)), createBugsnagError(error2.name, error2.message, Event.__type, stacktrace2);
1060
1086
  });
1061
1087
  (_event$errors = event.errors).push.apply(_event$errors, normalisedCauses);
@@ -1072,7 +1098,7 @@ var require_bugsnag = __commonJS({
1072
1098
  return err.name = "InvalidError", err;
1073
1099
  };
1074
1100
  if (!tolerateNonErrors)
1075
- _$iserror_19(maybeError) ? error = maybeError : (error = createAndLogInputError(typeof maybeError), internalFrames += 2);
1101
+ _$iserror_25(maybeError) ? error = maybeError : (error = createAndLogInputError(typeof maybeError), internalFrames += 2);
1076
1102
  else
1077
1103
  switch (typeof maybeError) {
1078
1104
  case "string":
@@ -1084,23 +1110,23 @@ var require_bugsnag = __commonJS({
1084
1110
  error = createAndLogInputError("function"), internalFrames += 2;
1085
1111
  break;
1086
1112
  case "object":
1087
- maybeError !== null && _$iserror_19(maybeError) ? error = maybeError : maybeError !== null && hasNecessaryFields(maybeError) ? (error = new Error(maybeError.message || maybeError.errorMessage), error.name = maybeError.name || maybeError.errorClass, internalFrames += 1) : (error = createAndLogInputError(maybeError === null ? "null" : "unsupported object"), internalFrames += 2);
1113
+ maybeError !== null && _$iserror_25(maybeError) ? error = maybeError : maybeError !== null && hasNecessaryFields(maybeError) ? (error = new Error(maybeError.message || maybeError.errorMessage), error.name = maybeError.name || maybeError.errorClass, internalFrames += 1) : (error = createAndLogInputError(maybeError === null ? "null" : "unsupported object"), internalFrames += 2);
1088
1114
  break;
1089
1115
  default:
1090
1116
  error = createAndLogInputError("nothing"), internalFrames += 2;
1091
1117
  }
1092
- if (!_$hasStack_18(error))
1118
+ if (!_$hasStack_24(error))
1093
1119
  try {
1094
1120
  throw error;
1095
1121
  } catch (e) {
1096
- _$hasStack_18(e) && (error = e, internalFrames = 1);
1122
+ _$hasStack_24(e) && (error = e, internalFrames = 1);
1097
1123
  }
1098
1124
  return [error, internalFrames];
1099
1125
  };
1100
1126
  Event.__type = "browserjs";
1101
1127
  var hasNecessaryFields = function(error) {
1102
1128
  return (typeof error.name == "string" || typeof error.errorClass == "string") && (typeof error.message == "string" || typeof error.errorMessage == "string");
1103
- }, _$Event_4 = Event, _$asyncEvery_5 = function(arr, fn, cb) {
1129
+ }, _$Event_10 = Event, _$asyncEvery_11 = function(arr, fn, cb) {
1104
1130
  var index = 0, next = function() {
1105
1131
  if (index >= arr.length) return cb(null, !0);
1106
1132
  fn(arr[index], function(err, result) {
@@ -1110,7 +1136,7 @@ var require_bugsnag = __commonJS({
1110
1136
  });
1111
1137
  };
1112
1138
  next();
1113
- }, _$callbackRunner_7 = function(callbacks, event, onCallbackError, cb) {
1139
+ }, _$callbackRunner_13 = function(callbacks, event, onCallbackError, cb) {
1114
1140
  var runMaybeAsyncCallback = function(fn, cb2) {
1115
1141
  if (typeof fn != "function") return cb2(null);
1116
1142
  try {
@@ -1140,8 +1166,8 @@ var require_bugsnag = __commonJS({
1140
1166
  onCallbackError(e), cb2(null);
1141
1167
  }
1142
1168
  };
1143
- _$asyncEvery_5(callbacks, runMaybeAsyncCallback, cb);
1144
- }, _$syncCallbackRunner_24 = function(callbacks, callbackArg, callbackType, logger) {
1169
+ _$asyncEvery_11(callbacks, runMaybeAsyncCallback, cb);
1170
+ }, _$syncCallbackRunner_30 = function(callbacks, callbackArg, callbackType, logger) {
1145
1171
  for (var ignore = !1, cbs = callbacks.slice(); !ignore && cbs.length; )
1146
1172
  try {
1147
1173
  ignore = cbs.pop()(callbackArg) === !1;
@@ -1149,28 +1175,38 @@ var require_bugsnag = __commonJS({
1149
1175
  logger.error("Error occurred in " + callbackType + " callback, continuing anyway\u2026"), logger.error(e);
1150
1176
  }
1151
1177
  return ignore;
1152
- }, _$pad_30 = function(num, size) {
1178
+ }, _$pad_4 = function(num, size) {
1153
1179
  var s = "000000000" + num;
1154
1180
  return s.substr(s.length - size);
1155
- }, os = __require("os"), padding = 2, pid = _$pad_30(process.pid.toString(36), padding), hostname = os.hostname(), length = hostname.length, hostId = _$pad_30(hostname.split("").reduce(function(prev, char) {
1181
+ }, os = __require("os");
1182
+ function getHostname() {
1183
+ try {
1184
+ return os.hostname();
1185
+ } catch {
1186
+ return process.env._CLUSTER_NETWORK_NAME_ || process.env.COMPUTERNAME || "hostname";
1187
+ }
1188
+ }
1189
+ var padding = 2, pid = _$pad_4(process.pid.toString(36), padding), hostname = getHostname(), length = hostname.length, hostId = _$pad_4(hostname.split("").reduce(function(prev, char) {
1156
1190
  return +prev + char.charCodeAt(0);
1157
- }, +length + 36).toString(36), padding), _$fingerprint_29 = function() {
1191
+ }, +length + 36).toString(36), padding), _$fingerprint_2 = function() {
1158
1192
  return pid + hostId;
1193
+ }, _$isCuid_3 = function(value) {
1194
+ return typeof value == "string" && /^c[a-z0-9]{20,32}$/.test(value);
1159
1195
  }, c = 0, blockSize = 4, base = 36, discreteValues = Math.pow(base, blockSize);
1160
1196
  function randomBlock() {
1161
- return _$pad_30((Math.random() * discreteValues << 0).toString(base), blockSize);
1197
+ return _$pad_4((Math.random() * discreteValues << 0).toString(base), blockSize);
1162
1198
  }
1163
1199
  function safeCounter() {
1164
1200
  return c = c < discreteValues ? c : 0, c++, c - 1;
1165
1201
  }
1166
1202
  function cuid() {
1167
- var letter = "c", timestamp = (/* @__PURE__ */ new Date()).getTime().toString(base), counter = _$pad_30(safeCounter().toString(base), blockSize), print = _$fingerprint_29(), random = randomBlock() + randomBlock();
1203
+ var letter = "c", timestamp = (/* @__PURE__ */ new Date()).getTime().toString(base), counter = _$pad_4(safeCounter().toString(base), blockSize), print = _$fingerprint_2(), random = randomBlock() + randomBlock();
1168
1204
  return letter + timestamp + counter + print + random;
1169
1205
  }
1170
- cuid.fingerprint = _$fingerprint_29;
1171
- var _$cuid_28 = cuid, Session = /* @__PURE__ */ function() {
1206
+ cuid.fingerprint = _$fingerprint_2, cuid.isCuid = _$isCuid_3;
1207
+ var _$cuid_1 = cuid, Session = /* @__PURE__ */ function() {
1172
1208
  function Session2() {
1173
- this.id = _$cuid_28(), this.startedAt = /* @__PURE__ */ new Date(), this._handled = 0, this._unhandled = 0, this._user = {}, this.app = {}, this.device = {};
1209
+ this.id = _$cuid_1(), this.startedAt = /* @__PURE__ */ new Date(), this._handled = 0, this._unhandled = 0, this._user = {}, this.app = {}, this.device = {};
1174
1210
  }
1175
1211
  var _proto = Session2.prototype;
1176
1212
  return _proto.getUser = function() {
@@ -1193,11 +1229,11 @@ var require_bugsnag = __commonJS({
1193
1229
  }, _proto._track = function(event) {
1194
1230
  this[event._handledState.unhandled ? "_unhandled" : "_handled"] += 1;
1195
1231
  }, Session2;
1196
- }(), _$Session_32 = Session, __add_2 = _$featureFlagDelegate_17.add, __clear_2 = _$featureFlagDelegate_17.clear, __merge_2 = _$featureFlagDelegate_17.merge, noop = function() {
1232
+ }(), _$Session_34 = Session, __add_8 = _$featureFlagDelegate_23.add, __clear_8 = _$featureFlagDelegate_23.clear, __merge_8 = _$featureFlagDelegate_23.merge, HUB_PREFIX = "00000", HUB_NOTIFY = "https://notify.insighthub.smartbear.com", HUB_SESSION = "https://sessions.insighthub.smartbear.com", noop = function() {
1197
1233
  }, Client = /* @__PURE__ */ function() {
1198
1234
  function Client2(configuration, schema2, internalPlugins2, notifier) {
1199
1235
  var _this = this;
1200
- schema2 === void 0 && (schema2 = _$config_3.schema), internalPlugins2 === void 0 && (internalPlugins2 = []), this._notifier = notifier, this._config = {}, this._schema = schema2, this._delivery = {
1236
+ schema2 === void 0 && (schema2 = _$config_9.schema), internalPlugins2 === void 0 && (internalPlugins2 = []), this._notifier = notifier, this._config = {}, this._schema = schema2, this._delivery = {
1201
1237
  sendSession: noop,
1202
1238
  sendEvent: noop
1203
1239
  }, this._logger = {
@@ -1205,12 +1241,12 @@ var require_bugsnag = __commonJS({
1205
1241
  info: noop,
1206
1242
  warn: noop,
1207
1243
  error: noop
1208
- }, this._plugins = {}, this._breadcrumbs = [], this._session = null, this._metadata = {}, this._featuresIndex = {}, this._features = [], this._context = void 0, this._user = {}, this._cbs = {
1244
+ }, this._plugins = {}, this._breadcrumbs = [], this._session = null, this._metadata = {}, this._featuresIndex = {}, this._features = [], this._context = void 0, this._user = {}, this._groupingDiscriminator = void 0, this._cbs = {
1209
1245
  e: [],
1210
1246
  s: [],
1211
1247
  sp: [],
1212
1248
  b: []
1213
- }, this.Client = Client2, this.Event = _$Event_4, this.Breadcrumb = _$Breadcrumb_1, this.Session = _$Session_32, this._config = this._configure(configuration, internalPlugins2), _$map_15(internalPlugins2.concat(this._config.plugins), function(pl) {
1249
+ }, this.Client = Client2, this.Event = _$Event_10, this.Breadcrumb = _$Breadcrumb_7, this.Session = _$Session_34, this._config = this._configure(configuration, internalPlugins2), _$map_21(internalPlugins2.concat(this._config.plugins), function(pl) {
1214
1250
  pl && _this._loadPlugin(pl);
1215
1251
  }), this._depth = 1;
1216
1252
  var self2 = this, notify = this.notify;
@@ -1220,31 +1256,38 @@ var require_bugsnag = __commonJS({
1220
1256
  }
1221
1257
  var _proto = Client2.prototype;
1222
1258
  return _proto.addMetadata = function(section, keyOrObj, maybeVal) {
1223
- return _$metadataDelegate_21.add(this._metadata, section, keyOrObj, maybeVal);
1259
+ return _$metadataDelegate_27.add(this._metadata, section, keyOrObj, maybeVal);
1224
1260
  }, _proto.getMetadata = function(section, key) {
1225
- return _$metadataDelegate_21.get(this._metadata, section, key);
1261
+ return _$metadataDelegate_27.get(this._metadata, section, key);
1226
1262
  }, _proto.clearMetadata = function(section, key) {
1227
- return _$metadataDelegate_21.clear(this._metadata, section, key);
1263
+ return _$metadataDelegate_27.clear(this._metadata, section, key);
1228
1264
  }, _proto.addFeatureFlag = function(name2, variant) {
1229
- variant === void 0 && (variant = null), __add_2(this._features, this._featuresIndex, name2, variant);
1265
+ variant === void 0 && (variant = null), __add_8(this._features, this._featuresIndex, name2, variant);
1230
1266
  }, _proto.addFeatureFlags = function(featureFlags) {
1231
- __merge_2(this._features, featureFlags, this._featuresIndex);
1267
+ __merge_8(this._features, featureFlags, this._featuresIndex);
1232
1268
  }, _proto.clearFeatureFlag = function(name2) {
1233
- __clear_2(this._features, this._featuresIndex, name2);
1269
+ __clear_8(this._features, this._featuresIndex, name2);
1234
1270
  }, _proto.clearFeatureFlags = function() {
1235
1271
  this._features = [], this._featuresIndex = {};
1236
1272
  }, _proto.getContext = function() {
1237
1273
  return this._context;
1238
1274
  }, _proto.setContext = function(c2) {
1239
1275
  this._context = c2;
1276
+ }, _proto.getGroupingDiscriminator = function() {
1277
+ return this._groupingDiscriminator;
1278
+ }, _proto.setGroupingDiscriminator = function(value) {
1279
+ var previousValue = this._groupingDiscriminator;
1280
+ return (typeof value == "string" || value === null || value === void 0) && (this._groupingDiscriminator = value), previousValue;
1240
1281
  }, _proto._configure = function(opts, internalPlugins2) {
1241
- var schema2 = _$reduce_16(internalPlugins2, function(schema3, plugin) {
1242
- return plugin && plugin.configSchema ? _$assign_10({}, schema3, plugin.configSchema) : schema3;
1243
- }, this._schema), _reduce = _$reduce_16(_$keys_14(schema2), function(accum, key) {
1282
+ var schema2 = _$reduce_22(internalPlugins2, function(schema3, plugin) {
1283
+ return plugin && plugin.configSchema ? _$assign_16({}, schema3, plugin.configSchema) : schema3;
1284
+ }, this._schema);
1285
+ opts.endpoints || (opts.sendPayloadChecksums = "sendPayloadChecksums" in opts ? opts.sendPayloadChecksums : !0);
1286
+ var _reduce = _$reduce_22(_$keys_20(schema2), function(accum, key) {
1244
1287
  var defaultValue = schema2[key].defaultValue(opts[key]);
1245
1288
  if (opts[key] !== void 0) {
1246
1289
  var valid = schema2[key].validate(opts[key]);
1247
- valid ? schema2[key].allowPartialObject ? accum.config[key] = _$assign_10(defaultValue, opts[key]) : accum.config[key] = opts[key] : (accum.errors[key] = schema2[key].message, accum.config[key] = defaultValue);
1290
+ valid ? schema2[key].allowPartialObject ? accum.config[key] = _$assign_16(defaultValue, opts[key]) : accum.config[key] = opts[key] : (accum.errors[key] = schema2[key].message, accum.config[key] = defaultValue);
1248
1291
  } else
1249
1292
  accum.config[key] = defaultValue;
1250
1293
  return accum;
@@ -1254,9 +1297,12 @@ var require_bugsnag = __commonJS({
1254
1297
  }), errors = _reduce.errors, config = _reduce.config;
1255
1298
  if (schema2.apiKey) {
1256
1299
  if (!config.apiKey) throw new Error("No Bugsnag API Key set");
1257
- /^[0-9a-f]{32}$/i.test(config.apiKey) || (errors.apiKey = "should be a string of 32 hexadecimal characters");
1300
+ /^[0-9a-f]{32}$/i.test(config.apiKey) || (errors.apiKey = "should be a string of 32 hexadecimal characters"), opts.endpoints === void 0 && config.apiKey.startsWith(HUB_PREFIX) && (config.endpoints = {
1301
+ notify: HUB_NOTIFY,
1302
+ sessions: HUB_SESSION
1303
+ });
1258
1304
  }
1259
- return this._metadata = _$assign_10({}, config.metadata), __merge_2(this._features, config.featureFlags, this._featuresIndex), this._user = _$assign_10({}, config.user), this._context = config.context, config.logger && (this._logger = config.logger), config.onError && (this._cbs.e = this._cbs.e.concat(config.onError)), config.onBreadcrumb && (this._cbs.b = this._cbs.b.concat(config.onBreadcrumb)), config.onSession && (this._cbs.s = this._cbs.s.concat(config.onSession)), _$keys_14(errors).length && this._logger.warn(generateConfigErrorMessage(errors, opts)), config;
1305
+ return this._metadata = _$assign_16({}, config.metadata), __merge_8(this._features, config.featureFlags, this._featuresIndex), this._user = _$assign_16({}, config.user), this._context = config.context, config.logger && (this._logger = config.logger), config.onError && (this._cbs.e = this._cbs.e.concat(config.onError)), config.onBreadcrumb && (this._cbs.b = this._cbs.b.concat(config.onBreadcrumb)), config.onSession && (this._cbs.s = this._cbs.s.concat(config.onSession)), _$keys_20(errors).length && this._logger.warn(generateConfigErrorMessage(errors, opts)), config;
1260
1306
  }, _proto.getUser = function() {
1261
1307
  return this._user;
1262
1308
  }, _proto.setUser = function(id, email, name2) {
@@ -1267,20 +1313,20 @@ var require_bugsnag = __commonJS({
1267
1313
  };
1268
1314
  }, _proto._loadPlugin = function(plugin) {
1269
1315
  var result = plugin.load(this);
1270
- return plugin.name && (this._plugins["~" + plugin.name + "~"] = result), this;
1316
+ plugin.name && (this._plugins["~" + plugin.name + "~"] = result);
1271
1317
  }, _proto.getPlugin = function(name2) {
1272
1318
  return this._plugins["~" + name2 + "~"];
1273
1319
  }, _proto._setDelivery = function(d) {
1274
1320
  this._delivery = d(this);
1275
1321
  }, _proto.startSession = function() {
1276
- var session = new _$Session_32();
1277
- session.app.releaseStage = this._config.releaseStage, session.app.version = this._config.appVersion, session.app.type = this._config.appType, session._user = _$assign_10({}, this._user);
1278
- var ignore = _$syncCallbackRunner_24(this._cbs.s, session, "onSession", this._logger);
1322
+ var session = new _$Session_34();
1323
+ session.app.releaseStage = this._config.releaseStage, session.app.version = this._config.appVersion, session.app.type = this._config.appType, session._user = _$assign_16({}, this._user);
1324
+ var ignore = _$syncCallbackRunner_30(this._cbs.s, session, "onSession", this._logger);
1279
1325
  return ignore ? (this._logger.debug("Session not started due to onSession callback"), this) : this._sessionDelegate.startSession(this, session);
1280
1326
  }, _proto.addOnError = function(fn, front) {
1281
1327
  front === void 0 && (front = !1), this._cbs.e[front ? "unshift" : "push"](fn);
1282
1328
  }, _proto.removeOnError = function(fn) {
1283
- this._cbs.e = _$filter_11(this._cbs.e, function(f) {
1329
+ this._cbs.e = _$filter_17(this._cbs.e, function(f) {
1284
1330
  return f !== fn;
1285
1331
  });
1286
1332
  }, _proto._addOnSessionPayload = function(fn) {
@@ -1288,13 +1334,13 @@ var require_bugsnag = __commonJS({
1288
1334
  }, _proto.addOnSession = function(fn) {
1289
1335
  this._cbs.s.push(fn);
1290
1336
  }, _proto.removeOnSession = function(fn) {
1291
- this._cbs.s = _$filter_11(this._cbs.s, function(f) {
1337
+ this._cbs.s = _$filter_17(this._cbs.s, function(f) {
1292
1338
  return f !== fn;
1293
1339
  });
1294
1340
  }, _proto.addOnBreadcrumb = function(fn, front) {
1295
1341
  front === void 0 && (front = !1), this._cbs.b[front ? "unshift" : "push"](fn);
1296
1342
  }, _proto.removeOnBreadcrumb = function(fn) {
1297
- this._cbs.b = _$filter_11(this._cbs.b, function(f) {
1343
+ this._cbs.b = _$filter_17(this._cbs.b, function(f) {
1298
1344
  return f !== fn;
1299
1345
  });
1300
1346
  }, _proto.pauseSession = function() {
@@ -1302,8 +1348,8 @@ var require_bugsnag = __commonJS({
1302
1348
  }, _proto.resumeSession = function() {
1303
1349
  return this._sessionDelegate.resumeSession(this);
1304
1350
  }, _proto.leaveBreadcrumb = function(message, metadata, type) {
1305
- if (message = typeof message == "string" ? message : "", type = typeof type == "string" && _$includes_12(_$breadcrumbTypes_6, type) ? type : "manual", metadata = typeof metadata == "object" && metadata !== null ? metadata : {}, !!message) {
1306
- var crumb = new _$Breadcrumb_1(message, metadata, type), ignore = _$syncCallbackRunner_24(this._cbs.b, crumb, "onBreadcrumb", this._logger);
1351
+ if (message = typeof message == "string" ? message : "", type = typeof type == "string" && _$includes_18(_$breadcrumbTypes_12, type) ? type : "manual", metadata = typeof metadata == "object" && metadata !== null ? metadata : {}, !!message) {
1352
+ var crumb = new _$Breadcrumb_7(message, metadata, type), ignore = _$syncCallbackRunner_30(this._cbs.b, crumb, "onBreadcrumb", this._logger);
1307
1353
  if (ignore) {
1308
1354
  this._logger.debug("Breadcrumb not attached due to onBreadcrumb callback");
1309
1355
  return;
@@ -1312,23 +1358,23 @@ var require_bugsnag = __commonJS({
1312
1358
  }
1313
1359
  }, _proto._isBreadcrumbTypeEnabled = function(type) {
1314
1360
  var types = this._config.enabledBreadcrumbTypes;
1315
- return types === null || _$includes_12(types, type);
1361
+ return types === null || _$includes_18(types, type);
1316
1362
  }, _proto.notify = function(maybeError, onError, postReportCallback) {
1317
1363
  postReportCallback === void 0 && (postReportCallback = noop);
1318
- var event = _$Event_4.create(maybeError, !0, void 0, "notify()", this._depth + 1, this._logger);
1364
+ var event = _$Event_10.create(maybeError, !0, void 0, "notify()", this._depth + 1, this._logger);
1319
1365
  this._notify(event, onError, postReportCallback);
1320
1366
  }, _proto._notify = function(event, onError, postReportCallback) {
1321
1367
  var _this2 = this;
1322
- if (postReportCallback === void 0 && (postReportCallback = noop), event.app = _$assign_10({}, event.app, {
1368
+ if (postReportCallback === void 0 && (postReportCallback = noop), event.app = _$assign_16({}, event.app, {
1323
1369
  releaseStage: this._config.releaseStage,
1324
1370
  version: this._config.appVersion,
1325
1371
  type: this._config.appType
1326
- }), event.context = event.context || this._context, event._metadata = _$assign_10({}, event._metadata, this._metadata), event._user = _$assign_10({}, event._user, this._user), event.breadcrumbs = this._breadcrumbs.slice(), __merge_2(event._features, this._features, event._featuresIndex), this._config.enabledReleaseStages !== null && !_$includes_12(this._config.enabledReleaseStages, this._config.releaseStage))
1372
+ }), event.context = event.context || this._context, event._metadata = _$assign_16({}, event._metadata, this._metadata), event._user = _$assign_16({}, event._user, this._user), event.breadcrumbs = this._breadcrumbs.slice(), event.setGroupingDiscriminator(this._groupingDiscriminator), __merge_8(event._features, this._features, event._featuresIndex), this._config.enabledReleaseStages !== null && !_$includes_18(this._config.enabledReleaseStages, this._config.releaseStage))
1327
1373
  return this._logger.warn("Event not sent due to releaseStage/enabledReleaseStages configuration"), postReportCallback(null, event);
1328
1374
  var originalSeverity = event.severity, onCallbackError = function(err) {
1329
1375
  _this2._logger.error("Error occurred in onError callback, continuing anyway\u2026"), _this2._logger.error(err);
1330
1376
  }, callbacks = [].concat(this._cbs.e).concat(onError);
1331
- _$callbackRunner_7(callbacks, event, onCallbackError, function(err, shouldSend) {
1377
+ _$callbackRunner_13(callbacks, event, onCallbackError, function(err, shouldSend) {
1332
1378
  if (err && onCallbackError(err), !shouldSend)
1333
1379
  return _this2._logger.debug("Event not sent due to onError callback"), postReportCallback(null, event);
1334
1380
  _this2._isBreadcrumbTypeEnabled("error") && Client2.prototype.leaveBreadcrumb.call(_this2, event.errors[0].errorClass, {
@@ -1348,7 +1394,7 @@ var require_bugsnag = __commonJS({
1348
1394
  }, Client2;
1349
1395
  }(), generateConfigErrorMessage = function(errors, rawInput) {
1350
1396
  var er = new Error(`Invalid configuration
1351
- ` + _$map_15(_$keys_14(errors), function(key) {
1397
+ ` + _$map_21(_$keys_20(errors), function(key) {
1352
1398
  return " - " + key + " " + errors[key] + ", got " + stringify(rawInput[key]);
1353
1399
  }).join(`
1354
1400
 
@@ -1363,9 +1409,9 @@ var require_bugsnag = __commonJS({
1363
1409
  default:
1364
1410
  return String(val);
1365
1411
  }
1366
- }, _$Client_2 = Client, _$jsonPayload_20 = {}, EVENT_REDACTION_PATHS = ["events.[].metaData", "events.[].breadcrumbs.[].metaData", "events.[].request"];
1367
- _$jsonPayload_20.event = function(event, redactedKeys) {
1368
- var payload = _$safeJsonStringify_31(event, null, null, {
1412
+ }, _$Client_8 = Client, _$jsonPayload_26 = {}, EVENT_REDACTION_PATHS = ["events.[].metaData", "events.[].breadcrumbs.[].metaData", "events.[].request"];
1413
+ _$jsonPayload_26.event = function(event, redactedKeys) {
1414
+ var payload = _$safeJsonStringify_5(event, null, null, {
1369
1415
  redactedPaths: EVENT_REDACTION_PATHS,
1370
1416
  redactedKeys
1371
1417
  });
@@ -1373,15 +1419,15 @@ var require_bugsnag = __commonJS({
1373
1419
  notifier: `WARNING!
1374
1420
  Serialized payload was ` + payload.length / 1e6 + `MB (limit = 1MB)
1375
1421
  metadata was removed`
1376
- }, payload = _$safeJsonStringify_31(event, null, null, {
1422
+ }, payload = _$safeJsonStringify_5(event, null, null, {
1377
1423
  redactedPaths: EVENT_REDACTION_PATHS,
1378
1424
  redactedKeys
1379
1425
  })), payload;
1380
- }, _$jsonPayload_20.session = function(session, redactedKeys) {
1381
- var payload = _$safeJsonStringify_31(session, null, null);
1426
+ }, _$jsonPayload_26.session = function(session, redactedKeys) {
1427
+ var payload = _$safeJsonStringify_5(session, null, null);
1382
1428
  return payload;
1383
1429
  };
1384
- var http = __require("http"), https = __require("https"), ___require_34 = __require("url"), parse = ___require_34.parse, _$request_34 = function(_ref, cb) {
1430
+ var http = __require("http"), https = __require("https"), ___require_36 = __require("url"), parse = ___require_36.parse, _$request_36 = function(_ref, cb) {
1385
1431
  var url2 = _ref.url, headers = _ref.headers, body = _ref.body, agent = _ref.agent, didError = !1, onError = function(err) {
1386
1432
  didError || (didError = !0, cb(err));
1387
1433
  }, parsedUrl = parse(url2), secure = parsedUrl.protocol === "https:", transport = secure ? https : http, req = transport.request({
@@ -1408,17 +1454,21 @@ metadata was removed`
1408
1454
  }), stream.on("end", function() {
1409
1455
  return cb(null, data);
1410
1456
  });
1411
- }, _$delivery_33 = function(client) {
1457
+ }, _$delivery_35 = function(client) {
1412
1458
  return {
1413
1459
  sendEvent: function(event, cb) {
1414
1460
  cb === void 0 && (cb = function() {
1415
1461
  });
1416
- var body = _$jsonPayload_20.event(event, client._config.redactedKeys), _cb = function(err) {
1417
- err && client._logger.error(`Event failed to send\u2026
1418
- ` + (err && err.stack ? err.stack : err), err), body.length > 1e6 && client._logger.warn("Event oversized (" + (body.length / 1e6).toFixed(2) + " MB)"), cb(err);
1462
+ var body = _$jsonPayload_26.event(event, client._config.redactedKeys), _cb = function(err2) {
1463
+ err2 && client._logger.error(`Event failed to send\u2026
1464
+ ` + (err2 && err2.stack ? err2.stack : err2), err2), body.length > 1e6 && client._logger.warn("Event oversized (" + (body.length / 1e6).toFixed(2) + " MB)"), cb(err2);
1419
1465
  };
1466
+ if (client._config.endpoints.notify === null) {
1467
+ var err = new Error("Event not sent due to incomplete endpoint configuration");
1468
+ return _cb(err);
1469
+ }
1420
1470
  try {
1421
- _$request_34({
1471
+ _$request_36({
1422
1472
  url: client._config.endpoints.notify,
1423
1473
  headers: {
1424
1474
  "Content-Type": "application/json",
@@ -1428,8 +1478,8 @@ metadata was removed`
1428
1478
  },
1429
1479
  body,
1430
1480
  agent: client._config.agent
1431
- }, function(err, body2) {
1432
- return _cb(err);
1481
+ }, function(err2, body2) {
1482
+ return _cb(err2);
1433
1483
  });
1434
1484
  } catch (e) {
1435
1485
  _cb(e);
@@ -1438,12 +1488,16 @@ metadata was removed`
1438
1488
  sendSession: function(session, cb) {
1439
1489
  cb === void 0 && (cb = function() {
1440
1490
  });
1441
- var _cb = function(err) {
1442
- err && client._logger.error(`Session failed to send\u2026
1443
- ` + (err && err.stack ? err.stack : err), err), cb(err);
1491
+ var _cb = function(err2) {
1492
+ err2 && client._logger.error(`Session failed to send\u2026
1493
+ ` + (err2 && err2.stack ? err2.stack : err2), err2), cb(err2);
1444
1494
  };
1495
+ if (client._config.endpoints.session === null) {
1496
+ var err = new Error("Session not sent due to incomplete endpoint configuration");
1497
+ return _cb(err);
1498
+ }
1445
1499
  try {
1446
- _$request_34({
1500
+ _$request_36({
1447
1501
  url: client._config.endpoints.sessions,
1448
1502
  headers: {
1449
1503
  "Content-Type": "application/json",
@@ -1451,10 +1505,10 @@ metadata was removed`
1451
1505
  "Bugsnag-Payload-Version": "1",
1452
1506
  "Bugsnag-Sent-At": (/* @__PURE__ */ new Date()).toISOString()
1453
1507
  },
1454
- body: _$jsonPayload_20.session(session, client._config.redactedKeys),
1508
+ body: _$jsonPayload_26.session(session, client._config.redactedKeys),
1455
1509
  agent: client._config.agent
1456
- }, function(err) {
1457
- return _cb(err);
1510
+ }, function(err2) {
1511
+ return _cb(err2);
1458
1512
  });
1459
1513
  } catch (e) {
1460
1514
  _cb(e);
@@ -1462,18 +1516,17 @@ metadata was removed`
1462
1516
  }
1463
1517
  };
1464
1518
  };
1465
- function ___extends_35() {
1466
- return ___extends_35 = Object.assign ? Object.assign.bind() : function(target) {
1467
- for (var i = 1; i < arguments.length; i++) {
1468
- var source = arguments[i];
1469
- for (var key in source)
1470
- Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
1519
+ function ___extends_37() {
1520
+ return ___extends_37 = Object.assign ? Object.assign.bind() : function(n) {
1521
+ for (var e = 1; e < arguments.length; e++) {
1522
+ var t = arguments[e];
1523
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
1471
1524
  }
1472
- return target;
1473
- }, ___extends_35.apply(this, arguments);
1525
+ return n;
1526
+ }, ___extends_37.apply(null, arguments);
1474
1527
  }
1475
- var schema = _$config_3.schema, __os_35 = __require("os"), _require2 = __require("util"), inspect = _require2.inspect, _$config_35 = {
1476
- appType: ___extends_35({}, schema.appType, {
1528
+ var schema = _$config_9.schema, __os_37 = __require("os"), _require2 = __require("util"), inspect = _require2.inspect, _$config_37 = {
1529
+ appType: ___extends_37({}, schema.appType, {
1477
1530
  defaultValue: function() {
1478
1531
  return "node";
1479
1532
  }
@@ -1483,25 +1536,25 @@ metadata was removed`
1483
1536
  return process.cwd();
1484
1537
  },
1485
1538
  validate: function(value) {
1486
- return value === null || _$stringWithLength_27(value);
1539
+ return value === null || _$stringWithLength_33(value);
1487
1540
  },
1488
1541
  message: "should be string"
1489
1542
  },
1490
1543
  hostname: {
1491
1544
  defaultValue: function() {
1492
- return __os_35.hostname();
1545
+ return __os_37.hostname();
1493
1546
  },
1494
1547
  message: "should be a string",
1495
1548
  validate: function(value) {
1496
- return value === null || _$stringWithLength_27(value);
1549
+ return value === null || _$stringWithLength_33(value);
1497
1550
  }
1498
1551
  },
1499
- logger: ___extends_35({}, schema.logger, {
1552
+ logger: ___extends_37({}, schema.logger, {
1500
1553
  defaultValue: function() {
1501
1554
  return getPrefixedConsole();
1502
1555
  }
1503
1556
  }),
1504
- releaseStage: ___extends_35({}, schema.releaseStage, {
1557
+ releaseStage: ___extends_37({}, schema.releaseStage, {
1505
1558
  defaultValue: function() {
1506
1559
  return process.env.NODE_ENV || "production";
1507
1560
  }
@@ -1551,7 +1604,7 @@ metadata was removed`
1551
1604
  return typeof value == "object" && value !== null || typeof value == "boolean";
1552
1605
  }, appStart = /* @__PURE__ */ new Date(), reset = function() {
1553
1606
  appStart = /* @__PURE__ */ new Date();
1554
- }, _$app_37 = {
1607
+ }, _$app_39 = {
1555
1608
  name: "appDuration",
1556
1609
  load: function(client) {
1557
1610
  return client.addOnError(function(event) {
@@ -1561,54 +1614,88 @@ metadata was removed`
1561
1614
  reset
1562
1615
  };
1563
1616
  }
1564
- }, _$nodeFallbackStack_22 = {};
1565
- _$nodeFallbackStack_22.getStack = function() {
1617
+ }, _$consoleBreadcrumbs_40 = {};
1618
+ _$consoleBreadcrumbs_40.load = function(client) {
1619
+ var isDev = /^(local-)?dev(elopment)?$/.test(client._config.releaseStage);
1620
+ isDev || !client._isBreadcrumbTypeEnabled("log") || _$map_21(CONSOLE_LOG_METHODS, function(method) {
1621
+ var original = console[method];
1622
+ console[method] = function() {
1623
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)
1624
+ args[_key] = arguments[_key];
1625
+ client.leaveBreadcrumb("Console output", _$reduce_22(args, function(accum, arg, i) {
1626
+ var stringified = "[Unknown value]";
1627
+ try {
1628
+ stringified = String(arg);
1629
+ } catch {
1630
+ }
1631
+ if (stringified === "[object Object]")
1632
+ try {
1633
+ stringified = JSON.stringify(arg);
1634
+ } catch {
1635
+ }
1636
+ return accum["[" + i + "]"] = stringified, accum;
1637
+ }, {
1638
+ severity: method.indexOf("group") === 0 ? "log" : method
1639
+ }), "log"), original.apply(console, args);
1640
+ }, console[method]._restore = function() {
1641
+ console[method] = original;
1642
+ };
1643
+ });
1644
+ }, process.env.NODE_ENV !== "production" && (_$consoleBreadcrumbs_40.destroy = function() {
1645
+ return CONSOLE_LOG_METHODS.forEach(function(method) {
1646
+ typeof console[method]._restore == "function" && console[method]._restore();
1647
+ });
1648
+ });
1649
+ var CONSOLE_LOG_METHODS = _$filter_17(["log", "debug", "info", "warn", "error"], function(method) {
1650
+ return typeof console < "u" && typeof console[method] == "function";
1651
+ }), _$cloneClient_14 = {}, onCloneCallbacks = [];
1652
+ _$cloneClient_14 = function(client) {
1653
+ var clone = new client.Client({}, {}, [], client._notifier);
1654
+ return clone._config = client._config, clone._breadcrumbs = client._breadcrumbs.slice(), clone._metadata = _$assign_16({}, client._metadata), clone._features = [].concat(client._features), clone._featuresIndex = _$assign_16({}, client._featuresIndex), clone._user = _$assign_16({}, client._user), clone._context = client._context, clone._cbs = {
1655
+ e: client._cbs.e.slice(),
1656
+ s: client._cbs.s.slice(),
1657
+ sp: client._cbs.sp.slice(),
1658
+ b: client._cbs.b.slice()
1659
+ }, clone._logger = client._logger, clone._delivery = client._delivery, clone._sessionDelegate = client._sessionDelegate, onCloneCallbacks.forEach(function(callback) {
1660
+ callback(clone);
1661
+ }), clone;
1662
+ }, _$cloneClient_14.registerCallback = function(callback) {
1663
+ onCloneCallbacks.push(callback);
1664
+ };
1665
+ var _$nodeFallbackStack_28 = {};
1666
+ _$nodeFallbackStack_28.getStack = function() {
1566
1667
  return new Error().stack.split(`
1567
1668
  `).slice(3).join(`
1568
1669
  `);
1569
- }, _$nodeFallbackStack_22.maybeUseFallbackStack = function(err, fallbackStack) {
1670
+ }, _$nodeFallbackStack_28.maybeUseFallbackStack = function(err, fallbackStack) {
1570
1671
  var lines = err.stack.split(`
1571
1672
  `);
1572
1673
  return (lines.length === 1 || lines.length === 2 && /at Error \(native\)/.test(lines[1])) && (err.stack = lines[0] + `
1573
1674
  ` + fallbackStack), err;
1574
1675
  };
1575
- var _$contextualize_38 = {}, domain = __require("domain"), getStack = _$nodeFallbackStack_22.getStack, maybeUseFallbackStack = _$nodeFallbackStack_22.maybeUseFallbackStack;
1576
- _$contextualize_38 = {
1676
+ var _$contextualize_41 = {}, getStack = _$nodeFallbackStack_28.getStack;
1677
+ _$contextualize_41 = {
1577
1678
  name: "contextualize",
1578
1679
  load: function(client) {
1579
1680
  var contextualize = function(fn, onError) {
1580
- var fallbackStack = getStack(), dom = domain.create();
1581
- dom.on("error", function(err) {
1582
- err.stack && maybeUseFallbackStack(err, fallbackStack);
1583
- var event = client.Event.create(err, !0, {
1584
- severity: "error",
1585
- unhandled: !0,
1586
- severityReason: {
1587
- type: "unhandledException"
1588
- }
1589
- }, "contextualize()", 1);
1590
- client._notify(event, onError, function(e, event2) {
1591
- e && client._logger.error("Failed to send event to Bugsnag"), client._config.onUncaughtException(err, event2, client._logger);
1592
- });
1593
- }), process.nextTick(function() {
1594
- return dom.run(fn);
1595
- });
1681
+ var fallbackStack = getStack(), clonedClient = _$cloneClient_14(client);
1682
+ clonedClient.fallbackStack = fallbackStack, clonedClient.addOnError(onError), client._clientContext.run(clonedClient, fn);
1596
1683
  };
1597
1684
  return contextualize;
1598
1685
  }
1599
- }, _$contextualize_38.default = _$contextualize_38;
1600
- var _$intercept_39 = {}, __getStack_39 = _$nodeFallbackStack_22.getStack, __maybeUseFallbackStack_39 = _$nodeFallbackStack_22.maybeUseFallbackStack;
1601
- _$intercept_39 = {
1686
+ }, _$contextualize_41.default = _$contextualize_41;
1687
+ var _$intercept_42 = {}, __getStack_42 = _$nodeFallbackStack_28.getStack, maybeUseFallbackStack = _$nodeFallbackStack_28.maybeUseFallbackStack;
1688
+ _$intercept_42 = {
1602
1689
  name: "intercept",
1603
1690
  load: function(client) {
1604
1691
  var intercept = function(onError, cb) {
1605
1692
  onError === void 0 && (onError = function() {
1606
1693
  }), typeof cb != "function" && (cb = onError, onError = function() {
1607
1694
  });
1608
- var fallbackStack = __getStack_39();
1695
+ var fallbackStack = __getStack_42();
1609
1696
  return function(err) {
1610
1697
  if (err) {
1611
- err.stack && __maybeUseFallbackStack_39(err, fallbackStack);
1698
+ err.stack && maybeUseFallbackStack(err, fallbackStack);
1612
1699
  var event = client.Event.create(err, !0, {
1613
1700
  severity: "warning",
1614
1701
  unhandled: !1,
@@ -1626,44 +1713,43 @@ metadata was removed`
1626
1713
  };
1627
1714
  return intercept;
1628
1715
  }
1629
- }, _$intercept_39.default = _$intercept_39;
1630
- function ___extends_40() {
1631
- return ___extends_40 = Object.assign ? Object.assign.bind() : function(target) {
1632
- for (var i = 1; i < arguments.length; i++) {
1633
- var source = arguments[i];
1634
- for (var key in source)
1635
- Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
1716
+ }, _$intercept_42.default = _$intercept_42;
1717
+ function ___extends_43() {
1718
+ return ___extends_43 = Object.assign ? Object.assign.bind() : function(n) {
1719
+ for (var e = 1; e < arguments.length; e++) {
1720
+ var t = arguments[e];
1721
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
1636
1722
  }
1637
- return target;
1638
- }, ___extends_40.apply(this, arguments);
1723
+ return n;
1724
+ }, ___extends_43.apply(null, arguments);
1639
1725
  }
1640
- var __os_40 = __require("os"), _$device_40 = {
1726
+ var __os_43 = __require("os"), _$device_43 = {
1641
1727
  load: function(client) {
1642
1728
  var device = {
1643
- osName: __os_40.platform() + " (" + __os_40.arch() + ")",
1644
- osVersion: __os_40.release(),
1645
- totalMemory: __os_40.totalmem(),
1729
+ osName: __os_43.platform() + " (" + __os_43.arch() + ")",
1730
+ osVersion: __os_43.release(),
1731
+ totalMemory: __os_43.totalmem(),
1646
1732
  hostname: client._config.hostname,
1647
1733
  runtimeVersions: {
1648
1734
  node: process.versions.node
1649
1735
  }
1650
1736
  };
1651
1737
  client._addOnSessionPayload(function(sp) {
1652
- sp.device = ___extends_40({}, sp.device, device);
1738
+ sp.device = ___extends_43({}, sp.device, device);
1653
1739
  }), client.addOnError(function(event) {
1654
- event.device = ___extends_40({}, event.device, device, {
1655
- freeMemory: __os_40.freemem(),
1740
+ event.device = ___extends_43({}, event.device, device, {
1741
+ freeMemory: __os_43.freemem(),
1656
1742
  time: /* @__PURE__ */ new Date()
1657
1743
  });
1658
1744
  }, !0);
1659
1745
  }
1660
- }, ___require_23 = __require("path"), join = ___require_23.join, resolve = ___require_23.resolve, _$pathNormalizer_23 = function(p) {
1746
+ }, ___require_29 = __require("path"), join = ___require_29.join, resolve = ___require_29.resolve, _$pathNormalizer_29 = function(p) {
1661
1747
  return join(resolve(p), "/");
1662
- }, _$inProject_41 = {
1748
+ }, _$inProject_44 = {
1663
1749
  load: function(client) {
1664
1750
  return client.addOnError(function(event) {
1665
1751
  if (client._config.projectRoot) {
1666
- var projectRoot = _$pathNormalizer_23(client._config.projectRoot), allFrames = event.errors.reduce(function(accum, er) {
1752
+ var projectRoot = _$pathNormalizer_29(client._config.projectRoot), allFrames = event.errors.reduce(function(accum, er) {
1667
1753
  return accum.concat(er.stacktrace);
1668
1754
  }, []);
1669
1755
  allFrames.map(function(stackframe) {
@@ -1673,25 +1759,24 @@ metadata was removed`
1673
1759
  });
1674
1760
  }
1675
1761
  };
1676
- function ___extends_42() {
1677
- return ___extends_42 = Object.assign ? Object.assign.bind() : function(target) {
1678
- for (var i = 1; i < arguments.length; i++) {
1679
- var source = arguments[i];
1680
- for (var key in source)
1681
- Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
1762
+ function ___extends_45() {
1763
+ return ___extends_45 = Object.assign ? Object.assign.bind() : function(n) {
1764
+ for (var e = 1; e < arguments.length; e++) {
1765
+ var t = arguments[e];
1766
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
1682
1767
  }
1683
- return target;
1684
- }, ___extends_42.apply(this, arguments);
1768
+ return n;
1769
+ }, ___extends_45.apply(null, arguments);
1685
1770
  }
1686
- function _inheritsLoose(subClass, superClass) {
1687
- subClass.prototype = Object.create(superClass.prototype), subClass.prototype.constructor = subClass, _setPrototypeOf(subClass, superClass);
1771
+ function _inheritsLoose(t, o) {
1772
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
1688
1773
  }
1689
- function _setPrototypeOf(o, p) {
1690
- return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o2, p2) {
1691
- return o2.__proto__ = p2, o2;
1692
- }, _setPrototypeOf(o, p);
1774
+ function _setPrototypeOf(t, e) {
1775
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t2, e2) {
1776
+ return t2.__proto__ = e2, t2;
1777
+ }, _setPrototypeOf(t, e);
1693
1778
  }
1694
- var SURROUNDING_LINES = 3, MAX_LINE_LENGTH = 200, ___require_42 = __require("fs"), createReadStream = ___require_42.createReadStream, ___require2_42 = __require("stream"), Writable = ___require2_42.Writable, pump = require_pump(), byline = require_byline(), path = __require("path"), _$surroundingCode_42 = {
1779
+ var SURROUNDING_LINES = 3, MAX_LINE_LENGTH = 200, ___require_45 = __require("fs"), createReadStream = ___require_45.createReadStream, ___require2_45 = __require("stream"), Writable = ___require2_45.Writable, pump = require_pump(), byline = require_byline(), path = __require("path"), _$surroundingCode_45 = {
1695
1780
  load: function(client) {
1696
1781
  if (client._config.sendCode) {
1697
1782
  var loadSurroundingCode = function(stackframe, cache) {
@@ -1750,13 +1835,13 @@ metadata was removed`
1750
1835
  cb(null, slicer.getCode());
1751
1836
  });
1752
1837
  }, CodeRange = /* @__PURE__ */ function(_Writable) {
1753
- _inheritsLoose(CodeRange2, _Writable);
1754
1838
  function CodeRange2(opts) {
1755
1839
  var _this;
1756
- return _this = _Writable.call(this, ___extends_42({}, opts, {
1840
+ return _this = _Writable.call(this, ___extends_45({}, opts, {
1757
1841
  decodeStrings: !1
1758
1842
  })) || this, _this._start = opts.start, _this._end = opts.end, _this._n = 0, _this._code = {}, _this;
1759
1843
  }
1844
+ _inheritsLoose(CodeRange2, _Writable);
1760
1845
  var _proto = CodeRange2.prototype;
1761
1846
  return _proto._write = function(chunk, enc, cb) {
1762
1847
  return this._n++, this._n < this._start ? cb(null) : this._n <= this._end ? (this._code[String(this._n)] = chunk.length <= MAX_LINE_LENGTH ? chunk : chunk.substr(0, MAX_LINE_LENGTH), cb(null)) : (this.emit("done"), cb(null));
@@ -1776,61 +1861,51 @@ metadata was removed`
1776
1861
  resolve2(res.slice(1));
1777
1862
  });
1778
1863
  });
1779
- }, _handler, _$uncaughtException_43 = {
1864
+ }, __maybeUseFallbackStack_46 = _$nodeFallbackStack_28.maybeUseFallbackStack, _handler, _$uncaughtException_46 = {
1780
1865
  load: function(client) {
1781
1866
  client._config.autoDetectErrors && client._config.enabledErrorTypes.unhandledExceptions && (_handler = function(err) {
1782
- var event = client.Event.create(err, !1, {
1867
+ var ctx = client._clientContext && client._clientContext.getStore(), c2 = ctx || client;
1868
+ err.stack && c2.fallbackStack && __maybeUseFallbackStack_46(err, c2.fallbackStack);
1869
+ var event = c2.Event.create(err, !1, {
1783
1870
  severity: "error",
1784
1871
  unhandled: !0,
1785
1872
  severityReason: {
1786
1873
  type: "unhandledException"
1787
1874
  }
1788
1875
  }, "uncaughtException handler", 1);
1789
- client._notify(event, function() {
1790
- }, function(e, event2) {
1791
- e && client._logger.error("Failed to send event to Bugsnag"), client._config.onUncaughtException(err, event2, client._logger);
1876
+ return new Promise(function(resolve2) {
1877
+ c2._notify(event, function() {
1878
+ }, function(e, event2) {
1879
+ e && c2._logger.error("Failed to send event to Bugsnag"), c2._config.onUncaughtException(err, event2, c2._logger), resolve2();
1880
+ });
1792
1881
  });
1793
- }, process.on("uncaughtException", _handler));
1882
+ }, process.prependListener("uncaughtException", _handler));
1794
1883
  },
1795
1884
  destroy: function() {
1796
1885
  process.removeListener("uncaughtException", _handler);
1797
1886
  }
1798
- }, ___handler_44, _$unhandledRejection_44 = {
1887
+ }, ___handler_47, _$unhandledRejection_47 = {
1799
1888
  load: function(client) {
1800
- !client._config.autoDetectErrors || !client._config.enabledErrorTypes.unhandledRejections || (___handler_44 = function(err) {
1801
- var event = client.Event.create(err, !1, {
1889
+ !client._config.autoDetectErrors || !client._config.enabledErrorTypes.unhandledRejections || (___handler_47 = function(err) {
1890
+ var ctx = client._clientContext && client._clientContext.getStore(), c2 = ctx || client, unhandled = !client._config.reportUnhandledPromiseRejectionsAsHandled, event = c2.Event.create(err, !1, {
1802
1891
  severity: "error",
1803
- unhandled: !0,
1892
+ unhandled,
1804
1893
  severityReason: {
1805
1894
  type: "unhandledPromiseRejection"
1806
1895
  }
1807
1896
  }, "unhandledRejection handler", 1);
1808
1897
  return new Promise(function(resolve2) {
1809
- client._notify(event, function() {
1898
+ c2._notify(event, function() {
1810
1899
  }, function(e, event2) {
1811
- e && client._logger.error("Failed to send event to Bugsnag"), client._config.onUnhandledRejection(err, event2, client._logger), resolve2();
1900
+ e && c2._logger.error("Failed to send event to Bugsnag"), c2._config.onUnhandledRejection(err, event2, c2._logger), resolve2();
1812
1901
  });
1813
1902
  });
1814
- }, process.prependListener ? process.prependListener("unhandledRejection", ___handler_44) : process.on("unhandledRejection", ___handler_44));
1903
+ }, process.prependListener ? process.prependListener("unhandledRejection", ___handler_47) : process.on("unhandledRejection", ___handler_47));
1815
1904
  },
1816
1905
  destroy: function() {
1817
- process.removeListener("unhandledRejection", ___handler_44);
1906
+ process.removeListener("unhandledRejection", ___handler_47);
1818
1907
  }
1819
- }, _$cloneClient_8 = {}, onCloneCallbacks = [];
1820
- _$cloneClient_8 = function(client) {
1821
- var clone = new client.Client({}, {}, [], client._notifier);
1822
- return clone._config = client._config, clone._breadcrumbs = client._breadcrumbs.slice(), clone._metadata = _$assign_10({}, client._metadata), clone._features = [].concat(client._features), clone._featuresIndex = _$assign_10({}, client._featuresIndex), clone._user = _$assign_10({}, client._user), clone._context = client._context, clone._cbs = {
1823
- e: client._cbs.e.slice(),
1824
- s: client._cbs.s.slice(),
1825
- sp: client._cbs.sp.slice(),
1826
- b: client._cbs.b.slice()
1827
- }, clone._logger = client._logger, clone._delivery = client._delivery, clone._sessionDelegate = client._sessionDelegate, onCloneCallbacks.forEach(function(callback) {
1828
- callback(clone);
1829
- }), clone;
1830
- }, _$cloneClient_8.registerCallback = function(callback) {
1831
- onCloneCallbacks.push(callback);
1832
- };
1833
- var _$Backoff_45 = Backoff;
1908
+ }, _$Backoff_6 = Backoff;
1834
1909
  function Backoff(opts) {
1835
1910
  opts = opts || {}, this.ms = opts.min || 100, this.max = opts.max || 1e4, this.factor = opts.factor || 2, this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0, this.attempts = 0;
1836
1911
  }
@@ -1844,25 +1919,20 @@ metadata was removed`
1844
1919
  }, Backoff.prototype.reset = function() {
1845
1920
  this.attempts = 0;
1846
1921
  };
1847
- function _assertThisInitialized(self2) {
1848
- if (self2 === void 0)
1849
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1850
- return self2;
1851
- }
1852
- function ___inheritsLoose_47(subClass, superClass) {
1853
- subClass.prototype = Object.create(superClass.prototype), subClass.prototype.constructor = subClass, ___setPrototypeOf_47(subClass, superClass);
1922
+ function ___inheritsLoose_49(t, o) {
1923
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, ___setPrototypeOf_49(t, o);
1854
1924
  }
1855
- function ___setPrototypeOf_47(o, p) {
1856
- return ___setPrototypeOf_47 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o2, p2) {
1857
- return o2.__proto__ = p2, o2;
1858
- }, ___setPrototypeOf_47(o, p);
1925
+ function ___setPrototypeOf_49(t, e) {
1926
+ return ___setPrototypeOf_49 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t2, e2) {
1927
+ return t2.__proto__ = e2, t2;
1928
+ }, ___setPrototypeOf_49(t, e);
1859
1929
  }
1860
- var DEFAULT_SUMMARY_INTERVAL = 10 * 1e3, Emitter = __require("events").EventEmitter, _$tracker_47 = /* @__PURE__ */ function(_Emitter) {
1861
- ___inheritsLoose_47(SessionTracker, _Emitter);
1930
+ var DEFAULT_SUMMARY_INTERVAL = 10 * 1e3, Emitter = __require("events").EventEmitter, _$tracker_49 = /* @__PURE__ */ function(_Emitter) {
1862
1931
  function SessionTracker(intervalLength) {
1863
1932
  var _this;
1864
- return _this = _Emitter.call(this) || this, _this._sessions = /* @__PURE__ */ new Map(), _this._interval = null, _this._intervalLength = intervalLength || DEFAULT_SUMMARY_INTERVAL, _this._summarize = _this._summarize.bind(_assertThisInitialized(_this)), _this;
1933
+ return _this = _Emitter.call(this) || this, _this._sessions = /* @__PURE__ */ new Map(), _this._interval = null, _this._intervalLength = intervalLength || DEFAULT_SUMMARY_INTERVAL, _this._summarize = _this._summarize.bind(_this), _this;
1865
1934
  }
1935
+ ___inheritsLoose_49(SessionTracker, _Emitter);
1866
1936
  var _proto = SessionTracker.prototype;
1867
1937
  return _proto.start = function() {
1868
1938
  this._interval || (this._interval = setInterval(this._summarize, this._intervalLength).unref());
@@ -1883,13 +1953,12 @@ metadata was removed`
1883
1953
  }(Emitter), dateToMsKey = function(d) {
1884
1954
  var dk = new Date(d);
1885
1955
  return dk.setSeconds(0), dk.setMilliseconds(0), dk.toISOString();
1886
- }, _$session_46 = {
1956
+ }, _$session_48 = {
1887
1957
  load: function(client) {
1888
- var sessionTracker = new _$tracker_47(client._config.sessionSummaryInterval);
1958
+ var sessionTracker = new _$tracker_49(client._config.sessionSummaryInterval);
1889
1959
  sessionTracker.on("summary", sendSessionSummary(client)), sessionTracker.start(), client._sessionDelegate = {
1890
1960
  startSession: function(client2, session) {
1891
- var sessionClient = _$cloneClient_8(client2);
1892
- return sessionClient._session = session, sessionClient._pausedSession = null, sessionTracker.track(sessionClient._session), sessionClient;
1961
+ return client2._session = session, client2._pausedSession = null, sessionTracker.track(client2._session), client2;
1893
1962
  },
1894
1963
  pauseSession: function(client2) {
1895
1964
  client2._pausedSession = client2._session, client2._session = null;
@@ -1904,7 +1973,7 @@ metadata was removed`
1904
1973
  defaultValue: function() {
1905
1974
  },
1906
1975
  validate: function(value) {
1907
- return value === void 0 || _$intRange_25()(value);
1976
+ return value === void 0 || _$intRange_31()(value);
1908
1977
  },
1909
1978
  message: "should be a positive integer"
1910
1979
  }
@@ -1916,7 +1985,7 @@ metadata was removed`
1916
1985
  return;
1917
1986
  }
1918
1987
  if (!sessionCounts.length) return;
1919
- var backoff = new _$Backoff_45({
1988
+ var backoff = new _$Backoff_6({
1920
1989
  min: 1e3,
1921
1990
  max: 1e4
1922
1991
  }), maxAttempts = 10;
@@ -1946,13 +2015,13 @@ metadata was removed`
1946
2015
  type: client._config.appType
1947
2016
  },
1948
2017
  sessionCounts
1949
- }, ignore = _$syncCallbackRunner_24(client._cbs.sp, payload, "onSessionPayload", client._logger);
2018
+ }, ignore = _$syncCallbackRunner_30(client._cbs.sp, payload, "onSessionPayload", client._logger);
1950
2019
  if (ignore)
1951
2020
  return client._logger.debug("Session not sent due to onSessionPayload callback"), cb(null);
1952
2021
  client._delivery.sendSession(payload, cb);
1953
2022
  }
1954
2023
  };
1955
- }, _$pathNormaliser_48 = {
2024
+ }, _$pathNormaliser_50 = {
1956
2025
  load: function(client) {
1957
2026
  client.addOnError(function(event) {
1958
2027
  var allFrames = event.errors.reduce(function(accum, er) {
@@ -1963,11 +2032,11 @@ metadata was removed`
1963
2032
  });
1964
2033
  });
1965
2034
  }
1966
- }, _$stripProjectRoot_49 = {
2035
+ }, _$stripProjectRoot_51 = {
1967
2036
  load: function(client) {
1968
2037
  return client.addOnError(function(event) {
1969
2038
  if (client._config.projectRoot) {
1970
- var projectRoot = _$pathNormalizer_23(client._config.projectRoot), allFrames = event.errors.reduce(function(accum, er) {
2039
+ var projectRoot = _$pathNormalizer_29(client._config.projectRoot), allFrames = event.errors.reduce(function(accum, er) {
1971
2040
  return accum.concat(er.stacktrace);
1972
2041
  }, []);
1973
2042
  allFrames.map(function(stackframe) {
@@ -1976,35 +2045,38 @@ metadata was removed`
1976
2045
  }
1977
2046
  });
1978
2047
  }
1979
- }, _$notifier_36 = {};
1980
- function ___extends_36() {
1981
- return ___extends_36 = Object.assign ? Object.assign.bind() : function(target) {
1982
- for (var i = 1; i < arguments.length; i++) {
1983
- var source = arguments[i];
1984
- for (var key in source)
1985
- Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
2048
+ }, _$notifier_38 = {};
2049
+ function ___extends_38() {
2050
+ return ___extends_38 = Object.assign ? Object.assign.bind() : function(n) {
2051
+ for (var e = 1; e < arguments.length; e++) {
2052
+ var t = arguments[e];
2053
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
1986
2054
  }
1987
- return target;
1988
- }, ___extends_36.apply(this, arguments);
2055
+ return n;
2056
+ }, ___extends_38.apply(null, arguments);
1989
2057
  }
1990
- var name = "Bugsnag Node", version = "7.25.0", url = "https://github.com/bugsnag/bugsnag-js";
1991
- _$Event_4.__type = "nodejs";
1992
- var __schema_36 = ___extends_36({}, _$config_3.schema, _$config_35);
1993
- delete __schema_36.enabledBreadcrumbTypes;
1994
- var internalPlugins = [_$app_37, _$surroundingCode_42, _$inProject_41, _$stripProjectRoot_49, _$session_46, _$device_40, _$uncaughtException_43, _$unhandledRejection_44, _$intercept_39, _$contextualize_38, _$pathNormaliser_48], Bugsnag2 = {
2058
+ var name = "Bugsnag Node", version = "8.6.0", url = "https://github.com/bugsnag/bugsnag-js", ___require_38 = __require("async_hooks"), AsyncLocalStorage = ___require_38.AsyncLocalStorage;
2059
+ _$Event_10.__type = "nodejs";
2060
+ var __schema_38 = ___extends_38({}, _$config_9.schema, _$config_37), internalPlugins = [_$app_39, _$surroundingCode_45, _$inProject_44, _$stripProjectRoot_51, _$session_48, _$device_43, _$uncaughtException_46, _$unhandledRejection_47, _$intercept_42, _$contextualize_41, _$pathNormaliser_50, _$consoleBreadcrumbs_40], Bugsnag2 = {
1995
2061
  _client: null,
1996
2062
  createClient: function(opts) {
1997
2063
  typeof opts == "string" && (opts = {
1998
2064
  apiKey: opts
1999
2065
  }), opts || (opts = {});
2000
- var bugsnag = new _$Client_2(opts, __schema_36, internalPlugins, {
2066
+ var bugsnag = new _$Client_8(opts, __schema_38, internalPlugins, {
2001
2067
  name,
2002
2068
  version,
2003
2069
  url
2004
2070
  });
2005
- return bugsnag._setDelivery(_$delivery_33), bugsnag._logger.debug("Loaded!"), bugsnag.leaveBreadcrumb = function() {
2006
- bugsnag._logger.warn("Breadcrumbs are not supported in Node.js yet");
2007
- }, bugsnag._config.enabledBreadcrumbTypes = [], bugsnag;
2071
+ return Object.keys(_$Client_8.prototype).forEach(function(m) {
2072
+ var original = bugsnag[m];
2073
+ bugsnag[m] = function() {
2074
+ var contextClient = bugsnag._clientContext && typeof bugsnag._clientContext.getStore == "function" ? bugsnag._clientContext.getStore() : null, client = contextClient || bugsnag, originalMethod = contextClient ? contextClient[m] : original;
2075
+ client._depth += 1;
2076
+ var ret = originalMethod.apply(client, arguments);
2077
+ return client._depth -= 1, ret;
2078
+ };
2079
+ }), bugsnag._clientContext = new AsyncLocalStorage(), bugsnag._setDelivery(_$delivery_35), bugsnag._logger.debug("Loaded!"), bugsnag;
2008
2080
  },
2009
2081
  start: function(opts) {
2010
2082
  return Bugsnag2._client ? (Bugsnag2._client._logger.warn("Bugsnag.start() was called more than once. Ignoring."), Bugsnag2._client) : (Bugsnag2._client = Bugsnag2.createClient(opts), Bugsnag2._client);
@@ -2013,21 +2085,22 @@ metadata was removed`
2013
2085
  return Bugsnag2._client != null;
2014
2086
  }
2015
2087
  };
2016
- return Object.keys(_$Client_2.prototype).forEach(function(m) {
2088
+ return Object.keys(_$Client_8.prototype).forEach(function(m) {
2017
2089
  /^_/.test(m) || (Bugsnag2[m] = function() {
2018
- if (!Bugsnag2._client) return console.error("Bugsnag." + m + "() was called before Bugsnag.start()");
2019
- Bugsnag2._client._depth += 1;
2020
- var ret = Bugsnag2._client[m].apply(Bugsnag2._client, arguments);
2021
- return Bugsnag2._client._depth -= 1, ret;
2090
+ var client = Bugsnag2._client, ctx = client && client._clientContext && client._clientContext.getStore();
2091
+ if (ctx && (client = ctx), !client) return console.error("Bugsnag." + m + "() was called before Bugsnag.start()");
2092
+ client._depth += 1;
2093
+ var ret = client[m].apply(client, arguments);
2094
+ return client._depth -= 1, ret;
2022
2095
  });
2023
- }), _$notifier_36 = Bugsnag2, _$notifier_36.Client = _$Client_2, _$notifier_36.Event = _$Event_4, _$notifier_36.Session = _$Session_32, _$notifier_36.Breadcrumb = _$Breadcrumb_1, _$notifier_36.default = Bugsnag2, _$notifier_36;
2096
+ }), _$notifier_38 = Bugsnag2, _$notifier_38.Client = _$Client_8, _$notifier_38.Event = _$Event_10, _$notifier_38.Session = _$Session_34, _$notifier_38.Breadcrumb = _$Breadcrumb_7, _$notifier_38.default = Bugsnag2, _$notifier_38;
2024
2097
  });
2025
2098
  }
2026
2099
  });
2027
2100
 
2028
- // ../../node_modules/.pnpm/@bugsnag+js@7.25.0/node_modules/@bugsnag/js/node/notifier.js
2101
+ // ../../node_modules/.pnpm/@bugsnag+js@8.6.0/node_modules/@bugsnag/js/node/notifier.js
2029
2102
  var require_notifier = __commonJS({
2030
- "../../node_modules/.pnpm/@bugsnag+js@7.25.0/node_modules/@bugsnag/js/node/notifier.js"(exports, module) {
2103
+ "../../node_modules/.pnpm/@bugsnag+js@8.6.0/node_modules/@bugsnag/js/node/notifier.js"(exports, module) {
2031
2104
  init_cjs_shims();
2032
2105
  module.exports = require_bugsnag();
2033
2106
  }
@@ -2035,8 +2108,9 @@ var require_notifier = __commonJS({
2035
2108
 
2036
2109
  // ../cli-kit/dist/public/node/error-handler.js
2037
2110
  init_cjs_shims();
2038
- var import_core = __toESM(require_lib(), 1), import_stacktracey = __toESM(require_stacktracey(), 1), import_js = __toESM(require_notifier(), 1);
2111
+ var import_core = __toESM(require_lib()), import_stacktracey = __toESM(require_stacktracey()), import_js = __toESM(require_notifier());
2039
2112
  import { realpath } from "fs/promises";
2113
+ var ALLOWED_SLICE_NAMES = /* @__PURE__ */ new Set(["app", "theme", "hydrogen", "store"]);
2040
2114
  async function errorHandler(error, config) {
2041
2115
  if (error instanceof CancelExecution)
2042
2116
  error.message && error.message !== "" && outputInfo(`\u2728 ${error.message}`);
@@ -2071,6 +2145,11 @@ ${formattedStacktrace}`;
2071
2145
  outputDebug(`Reporting ${unhandled ? "unhandled" : "handled"} error to Bugsnag: ${reportableError.message}`);
2072
2146
  let eventHandler = (event) => {
2073
2147
  event.severity = "error", event.unhandled = unhandled;
2148
+ let { commandStartOptions } = getAllSensitiveMetadata(), { startCommand } = commandStartOptions ?? {};
2149
+ if (startCommand) {
2150
+ let firstWord = startCommand.trim().split(/\s+/)[0] ?? "cli", sliceName = ALLOWED_SLICE_NAMES.has(firstWord) ? firstWord : "cli";
2151
+ event.addMetadata("custom", { slice_name: sliceName });
2152
+ }
2074
2153
  }, errorHandler2 = (error2) => {
2075
2154
  error2 ? reject(error2) : resolve(reportableError);
2076
2155
  };
@@ -2133,7 +2212,12 @@ function initializeBugsnag() {
2133
2212
  endpoints: {
2134
2213
  notify: "https://error-analytics-production.shopifysvc.com",
2135
2214
  sessions: "https://error-analytics-sessions-production.shopifysvc.com"
2136
- }
2215
+ },
2216
+ // Set the project root to `null` to prevent the default behavior of
2217
+ // Bugsnag which is to set it to the cwd. That is unhelpful for us because
2218
+ // the cwd can be anywhere in the user's filesystem, not necessarily
2219
+ // related to the CLI codebase.
2220
+ projectRoot: null
2137
2221
  });
2138
2222
  }
2139
2223
 
@@ -2150,4 +2234,4 @@ export {
2150
2234
  registerCleanBugsnagErrorsFromWithinPlugins,
2151
2235
  addBugsnagMetadata
2152
2236
  };
2153
- //# sourceMappingURL=chunk-CKYPRLQQ.js.map
2237
+ //# sourceMappingURL=chunk-C45MKMJT.js.map