@honeybadger-io/js 6.11.2 → 6.11.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.
@@ -891,7 +891,7 @@ function default_1$3(_window) {
891
891
  }
892
892
  events.default = default_1$3;
893
893
 
894
- var client$1 = {};
894
+ var client = {};
895
895
 
896
896
  var store = {};
897
897
 
@@ -959,6 +959,7 @@ defaults.CONFIG = void 0;
959
959
  defaults.CONFIG = {
960
960
  apiKey: null,
961
961
  endpoint: 'https://api.honeybadger.io',
962
+ appEndpoint: 'https://app.honeybadger.io',
962
963
  environment: null,
963
964
  hostname: null,
964
965
  projectRoot: null,
@@ -993,7 +994,7 @@ var __assign$2 = (commonjsGlobal && commonjsGlobal.__assign) || function () {
993
994
  };
994
995
  return __assign$2.apply(this, arguments);
995
996
  };
996
- var __awaiter$4 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
997
+ var __awaiter$3 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
997
998
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
998
999
  return new (P || (P = Promise))(function (resolve, reject) {
999
1000
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -1002,7 +1003,7 @@ var __awaiter$4 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (this
1002
1003
  step((generator = generator.apply(thisArg, _arguments || [])).next());
1003
1004
  });
1004
1005
  };
1005
- var __generator$4 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
1006
+ var __generator$3 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
1006
1007
  var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
1007
1008
  return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
1008
1009
  function verb(n) { return function (v) { return step([n, v]); }; }
@@ -1081,9 +1082,9 @@ var ThrottledEventsLogger = /** @class */ (function () {
1081
1082
  });
1082
1083
  };
1083
1084
  ThrottledEventsLogger.prototype.send = function () {
1084
- return __awaiter$4(this, void 0, void 0, function () {
1085
+ return __awaiter$3(this, void 0, void 0, function () {
1085
1086
  var eventsData, data;
1086
- return __generator$4(this, function (_a) {
1087
+ return __generator$3(this, function (_a) {
1087
1088
  if (this.queue.length === 0) {
1088
1089
  return [2 /*return*/];
1089
1090
  }
@@ -1095,9 +1096,9 @@ var ThrottledEventsLogger = /** @class */ (function () {
1095
1096
  });
1096
1097
  };
1097
1098
  ThrottledEventsLogger.prototype.makeHttpRequest = function (data) {
1098
- return __awaiter$4(this, void 0, void 0, function () {
1099
+ return __awaiter$3(this, void 0, void 0, function () {
1099
1100
  var _this = this;
1100
- return __generator$4(this, function (_a) {
1101
+ return __generator$3(this, function (_a) {
1101
1102
  return [2 /*return*/, this.transport
1102
1103
  .send({
1103
1104
  headers: {
@@ -1157,7 +1158,7 @@ var __assign$1 = (commonjsGlobal && commonjsGlobal.__assign) || function () {
1157
1158
  };
1158
1159
  return __assign$1.apply(this, arguments);
1159
1160
  };
1160
- var __awaiter$3 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
1161
+ var __awaiter$2 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
1161
1162
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1162
1163
  return new (P || (P = Promise))(function (resolve, reject) {
1163
1164
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -1166,7 +1167,7 @@ var __awaiter$3 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (this
1166
1167
  step((generator = generator.apply(thisArg, _arguments || [])).next());
1167
1168
  });
1168
1169
  };
1169
- var __generator$3 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
1170
+ var __generator$2 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
1170
1171
  var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
1171
1172
  return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
1172
1173
  function verb(n) { return function (v) { return step([n, v]); }; }
@@ -1193,8 +1194,8 @@ var __generator$3 = (commonjsGlobal && commonjsGlobal.__generator) || function (
1193
1194
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
1194
1195
  }
1195
1196
  };
1196
- Object.defineProperty(client$1, "__esModule", { value: true });
1197
- client$1.Client = void 0;
1197
+ Object.defineProperty(client, "__esModule", { value: true });
1198
+ client.Client = void 0;
1198
1199
  var util_1$5 = util$1;
1199
1200
  var store_1 = store;
1200
1201
  var throttled_events_logger_1 = throttled_events_logger;
@@ -1213,7 +1214,7 @@ var Client = /** @class */ (function () {
1213
1214
  this.__notifier = {
1214
1215
  name: '@honeybadger-io/core',
1215
1216
  url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/core',
1216
- version: '6.11.2'
1217
+ version: '6.11.3'
1217
1218
  };
1218
1219
  this.config = __assign$1(__assign$1({}, defaults_1.CONFIG), opts);
1219
1220
  this.__initStore();
@@ -1548,9 +1549,9 @@ var Client = /** @class */ (function () {
1548
1549
  notice.__breadcrumbs = [];
1549
1550
  }
1550
1551
  return (0, util_1$5.getSourceForBacktrace)(originalBacktrace, this.__getSourceFileHandler)
1551
- .then(function (sourcePerTrace) { return __awaiter$3(_this, void 0, void 0, function () {
1552
+ .then(function (sourcePerTrace) { return __awaiter$2(_this, void 0, void 0, function () {
1552
1553
  var payload;
1553
- return __generator$3(this, function (_a) {
1554
+ return __generator$2(this, function (_a) {
1554
1555
  sourcePerTrace.forEach(function (source, index) {
1555
1556
  notice.backtrace[index].source = source;
1556
1557
  });
@@ -1579,7 +1580,8 @@ var Client = /** @class */ (function () {
1579
1580
  (0, util_1$5.runAfterNotifyHandlers)((0, util_1$5.merge)(notice, {
1580
1581
  id: uuid
1581
1582
  }), _this.__afterNotifyHandlers);
1582
- _this.logger.info("Error report sent \u26A1 https://app.honeybadger.io/notice/".concat(uuid));
1583
+ var noticeUrl = (0, util_1$5.endpoint)(_this.config.appEndpoint, "notice/".concat(uuid));
1584
+ _this.logger.info("Error report sent \u26A1 ".concat(noticeUrl));
1583
1585
  return true;
1584
1586
  })
1585
1587
  .catch(function (err) {
@@ -1590,7 +1592,7 @@ var Client = /** @class */ (function () {
1590
1592
  };
1591
1593
  return Client;
1592
1594
  }());
1593
- client$1.Client = Client;
1595
+ client.Client = Client;
1594
1596
 
1595
1597
  var types = {};
1596
1598
 
@@ -1627,13 +1629,14 @@ Object.defineProperty(types, "__esModule", { value: true });
1627
1629
  return (mod && mod.__esModule) ? mod : { "default": mod };
1628
1630
  };
1629
1631
  Object.defineProperty(exports, "__esModule", { value: true });
1630
- exports.Plugins = exports.Util = exports.Types = exports.Client = void 0;
1632
+ exports.Plugins = exports.Defaults = exports.Util = exports.Types = exports.Client = void 0;
1631
1633
  var events_1 = __importDefault(events);
1632
- var client_1 = client$1;
1634
+ var client_1 = client;
1633
1635
  Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return client_1.Client; } });
1634
1636
  __exportStar(store, exports);
1635
1637
  exports.Types = __importStar(types);
1636
1638
  exports.Util = __importStar(util$1);
1639
+ exports.Defaults = __importStar(defaults);
1637
1640
  exports.Plugins = {
1638
1641
  events: events_1.default
1639
1642
  };
@@ -1642,7 +1645,7 @@ Object.defineProperty(types, "__esModule", { value: true });
1642
1645
 
1643
1646
  var util = {};
1644
1647
 
1645
- var __awaiter$2 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
1648
+ var __awaiter$1 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
1646
1649
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1647
1650
  return new (P || (P = Promise))(function (resolve, reject) {
1648
1651
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -1651,7 +1654,7 @@ var __awaiter$2 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (this
1651
1654
  step((generator = generator.apply(thisArg, _arguments || [])).next());
1652
1655
  });
1653
1656
  };
1654
- var __generator$2 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
1657
+ var __generator$1 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
1655
1658
  var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
1656
1659
  return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
1657
1660
  function verb(n) { return function (v) { return step([n, v]); }; }
@@ -1700,9 +1703,9 @@ function fatallyLogAndExit(err, source) {
1700
1703
  }
1701
1704
  util.fatallyLogAndExit = fatallyLogAndExit;
1702
1705
  function getStats() {
1703
- return __awaiter$2(this, void 0, void 0, function () {
1706
+ return __awaiter$1(this, void 0, void 0, function () {
1704
1707
  var load, stats, fallback, memData, data, results;
1705
- return __generator$2(this, function (_a) {
1708
+ return __generator$1(this, function (_a) {
1706
1709
  switch (_a.label) {
1707
1710
  case 0:
1708
1711
  load = os_1.default.loadavg();
@@ -1761,8 +1764,8 @@ util.getStats = getStats;
1761
1764
  * @param path to source code
1762
1765
  */
1763
1766
  function getSourceFile(path) {
1764
- return __awaiter$2(this, void 0, void 0, function () {
1765
- return __generator$2(this, function (_a) {
1767
+ return __awaiter$1(this, void 0, void 0, function () {
1768
+ return __generator$1(this, function (_a) {
1766
1769
  switch (_a.label) {
1767
1770
  case 0:
1768
1771
  _a.trys.push([0, 2, , 3]);
@@ -2083,7 +2086,7 @@ var shutdown_plugin = {};
2083
2086
 
2084
2087
  var shutdown_monitor = {};
2085
2088
 
2086
- var __awaiter$1 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
2089
+ var __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
2087
2090
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2088
2091
  return new (P || (P = Promise))(function (resolve, reject) {
2089
2092
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -2092,7 +2095,7 @@ var __awaiter$1 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (this
2092
2095
  step((generator = generator.apply(thisArg, _arguments || [])).next());
2093
2096
  });
2094
2097
  };
2095
- var __generator$1 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
2098
+ var __generator = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
2096
2099
  var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
2097
2100
  return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
2098
2101
  function verb(n) { return function (v) { return step([n, v]); }; }
@@ -2132,8 +2135,8 @@ var ShutdownMonitor = /** @class */ (function () {
2132
2135
  ShutdownMonitor.prototype.makeListener = function () {
2133
2136
  var _this = this;
2134
2137
  // noinspection UnnecessaryLocalVariableJS
2135
- var honeybadgerShutdownListener = function (signal) { return __awaiter$1(_this, void 0, void 0, function () {
2136
- return __generator$1(this, function (_a) {
2138
+ var honeybadgerShutdownListener = function (signal) { return __awaiter(_this, void 0, void 0, function () {
2139
+ return __generator(this, function (_a) {
2137
2140
  switch (_a.label) {
2138
2141
  case 0:
2139
2142
  if (this.__isReporting || !this.__client) {
@@ -2485,325 +2488,6 @@ var StackedStore = /** @class */ (function () {
2485
2488
  }());
2486
2489
  stacked_store.StackedStore = StackedStore;
2487
2490
 
2488
- var client = {};
2489
-
2490
- var checkIn = {};
2491
-
2492
- Object.defineProperty(checkIn, "__esModule", { value: true });
2493
- checkIn.CheckIn = void 0;
2494
- var CheckIn = /** @class */ (function () {
2495
- function CheckIn(props) {
2496
- this.id = props.id;
2497
- this.name = props.name;
2498
- this.slug = props.slug;
2499
- this.scheduleType = props.scheduleType;
2500
- this.reportPeriod = props.reportPeriod;
2501
- this.gracePeriod = props.gracePeriod;
2502
- this.cronSchedule = props.cronSchedule;
2503
- this.cronTimezone = props.cronTimezone;
2504
- this.deleted = false;
2505
- }
2506
- CheckIn.prototype.isDeleted = function () {
2507
- return this.deleted;
2508
- };
2509
- CheckIn.prototype.markAsDeleted = function () {
2510
- this.deleted = true;
2511
- };
2512
- CheckIn.prototype.validate = function () {
2513
- if (!this.slug) {
2514
- throw new Error('slug is required for each check-in');
2515
- }
2516
- if (!this.scheduleType) {
2517
- throw new Error('scheduleType is required for each check-in');
2518
- }
2519
- if (!['simple', 'cron'].includes(this.scheduleType)) {
2520
- throw new Error("".concat(this.slug, " [scheduleType] must be \"simple\" or \"cron\""));
2521
- }
2522
- if (this.scheduleType === 'simple' && !this.reportPeriod) {
2523
- throw new Error("".concat(this.slug, " [reportPeriod] is required for simple check-ins"));
2524
- }
2525
- if (this.scheduleType === 'cron' && !this.cronSchedule) {
2526
- throw new Error("".concat(this.slug, " [cronSchedule] is required for cron check-ins"));
2527
- }
2528
- };
2529
- CheckIn.prototype.asRequestPayload = function () {
2530
- var _a, _b;
2531
- var payload = {
2532
- name: this.name,
2533
- schedule_type: this.scheduleType,
2534
- slug: this.slug,
2535
- grace_period: (_a = this.gracePeriod) !== null && _a !== void 0 ? _a : '' // default is empty string
2536
- };
2537
- if (this.scheduleType === 'simple') {
2538
- payload.report_period = this.reportPeriod;
2539
- }
2540
- else {
2541
- payload.cron_schedule = this.cronSchedule;
2542
- payload.cron_timezone = (_b = this.cronTimezone) !== null && _b !== void 0 ? _b : ''; // default is empty string
2543
- }
2544
- return payload;
2545
- };
2546
- /**
2547
- * Compares two check-ins, usually the one from the API and the one from the config file.
2548
- * If the one in the config file does not match the check-in from the API,
2549
- * then we issue an update request.
2550
- *
2551
- * `name`, `gracePeriod` and `cronTimezone` are optional fields that are automatically
2552
- * set to a value from the server if one is not provided,
2553
- * so we ignore their values if they are not set locally.
2554
- */
2555
- CheckIn.prototype.isInSync = function (other) {
2556
- var ignoreNameCheck = this.name === undefined;
2557
- var ignoreGracePeriodCheck = this.gracePeriod === undefined;
2558
- var ignoreCronTimezoneCheck = this.cronTimezone === undefined;
2559
- return this.slug === other.slug
2560
- && this.scheduleType === other.scheduleType
2561
- && this.reportPeriod === other.reportPeriod
2562
- && this.cronSchedule === other.cronSchedule
2563
- && (ignoreNameCheck || this.name === other.name)
2564
- && (ignoreGracePeriodCheck || this.gracePeriod === other.gracePeriod)
2565
- && (ignoreCronTimezoneCheck || this.cronTimezone === other.cronTimezone);
2566
- };
2567
- CheckIn.fromResponsePayload = function (payload) {
2568
- return new CheckIn({
2569
- id: payload.id,
2570
- name: payload.name,
2571
- slug: payload.slug,
2572
- scheduleType: payload.schedule_type,
2573
- reportPeriod: payload.report_period,
2574
- gracePeriod: payload.grace_period,
2575
- cronSchedule: payload.cron_schedule,
2576
- cronTimezone: payload.cron_timezone,
2577
- });
2578
- };
2579
- return CheckIn;
2580
- }());
2581
- checkIn.CheckIn = CheckIn;
2582
-
2583
- var __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
2584
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2585
- return new (P || (P = Promise))(function (resolve, reject) {
2586
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
2587
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
2588
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
2589
- step((generator = generator.apply(thisArg, _arguments || [])).next());
2590
- });
2591
- };
2592
- var __generator = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
2593
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
2594
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
2595
- function verb(n) { return function (v) { return step([n, v]); }; }
2596
- function step(op) {
2597
- if (f) throw new TypeError("Generator is already executing.");
2598
- while (_) try {
2599
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
2600
- if (y = 0, t) op = [op[0] & 2, t.value];
2601
- switch (op[0]) {
2602
- case 0: case 1: t = op; break;
2603
- case 4: _.label++; return { value: op[1], done: false };
2604
- case 5: _.label++; y = op[1]; op = [0]; continue;
2605
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
2606
- default:
2607
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
2608
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
2609
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
2610
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
2611
- if (t[2]) _.ops.pop();
2612
- _.trys.pop(); continue;
2613
- }
2614
- op = body.call(thisArg, _);
2615
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
2616
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
2617
- }
2618
- };
2619
- Object.defineProperty(client, "__esModule", { value: true });
2620
- client.CheckInsClient = void 0;
2621
- var check_in_1 = checkIn;
2622
- var CheckInsClient = /** @class */ (function () {
2623
- function CheckInsClient(config, transport) {
2624
- this.BASE_URL = 'https://app.honeybadger.io';
2625
- this.transport = transport;
2626
- this.config = config;
2627
- this.logger = config.logger;
2628
- }
2629
- CheckInsClient.prototype.getProjectId = function (projectApiKey) {
2630
- var _a;
2631
- return __awaiter(this, void 0, void 0, function () {
2632
- var response, data;
2633
- return __generator(this, function (_b) {
2634
- switch (_b.label) {
2635
- case 0:
2636
- if (!this.config.personalAuthToken || this.config.personalAuthToken === '') {
2637
- throw new Error('personalAuthToken is required');
2638
- }
2639
- return [4 /*yield*/, this.transport.send({
2640
- method: 'GET',
2641
- headers: this.getHeaders(),
2642
- endpoint: "".concat(this.BASE_URL, "/v2/project_keys/").concat(projectApiKey),
2643
- logger: this.logger,
2644
- })];
2645
- case 1:
2646
- response = _b.sent();
2647
- if (response.statusCode !== 200) {
2648
- throw new Error("Failed to fetch project[".concat(projectApiKey, "]: ").concat(this.getErrorMessage(response.body)));
2649
- }
2650
- data = JSON.parse(response.body);
2651
- return [2 /*return*/, (_a = data === null || data === void 0 ? void 0 : data.project) === null || _a === void 0 ? void 0 : _a.id];
2652
- }
2653
- });
2654
- });
2655
- };
2656
- CheckInsClient.prototype.listForProject = function (projectId) {
2657
- return __awaiter(this, void 0, void 0, function () {
2658
- var response, data;
2659
- return __generator(this, function (_a) {
2660
- switch (_a.label) {
2661
- case 0:
2662
- if (!this.config.personalAuthToken || this.config.personalAuthToken === '') {
2663
- throw new Error('personalAuthToken is required');
2664
- }
2665
- return [4 /*yield*/, this.transport.send({
2666
- method: 'GET',
2667
- headers: this.getHeaders(),
2668
- endpoint: "".concat(this.BASE_URL, "/v2/projects/").concat(projectId, "/check_ins"),
2669
- logger: this.logger,
2670
- })];
2671
- case 1:
2672
- response = _a.sent();
2673
- if (response.statusCode !== 200) {
2674
- throw new Error("Failed to fetch checkins for project[".concat(projectId, "]: ").concat(this.getErrorMessage(response.body)));
2675
- }
2676
- data = JSON.parse(response.body);
2677
- return [2 /*return*/, data.results.map(function (checkin) { return check_in_1.CheckIn.fromResponsePayload(checkin); })];
2678
- }
2679
- });
2680
- });
2681
- };
2682
- CheckInsClient.prototype.get = function (projectId, checkInId) {
2683
- return __awaiter(this, void 0, void 0, function () {
2684
- var response, data;
2685
- return __generator(this, function (_a) {
2686
- switch (_a.label) {
2687
- case 0:
2688
- if (!this.config.personalAuthToken || this.config.personalAuthToken === '') {
2689
- throw new Error('personalAuthToken is required');
2690
- }
2691
- return [4 /*yield*/, this.transport.send({
2692
- method: 'GET',
2693
- headers: this.getHeaders(),
2694
- endpoint: "".concat(this.BASE_URL, "/v2/projects/").concat(projectId, "/check_ins/").concat(checkInId),
2695
- logger: this.logger,
2696
- })];
2697
- case 1:
2698
- response = _a.sent();
2699
- if (response.statusCode !== 200) {
2700
- throw new Error("Failed to fetch check-in[".concat(checkInId, "] for project[").concat(projectId, "]: ").concat(this.getErrorMessage(response.body)));
2701
- }
2702
- data = JSON.parse(response.body);
2703
- return [2 /*return*/, check_in_1.CheckIn.fromResponsePayload(data)];
2704
- }
2705
- });
2706
- });
2707
- };
2708
- CheckInsClient.prototype.create = function (projectId, checkIn) {
2709
- return __awaiter(this, void 0, void 0, function () {
2710
- var response, data;
2711
- return __generator(this, function (_a) {
2712
- switch (_a.label) {
2713
- case 0:
2714
- if (!this.config.personalAuthToken || this.config.personalAuthToken === '') {
2715
- throw new Error('personalAuthToken is required');
2716
- }
2717
- return [4 /*yield*/, this.transport.send({
2718
- method: 'POST',
2719
- headers: this.getHeaders(),
2720
- endpoint: "".concat(this.BASE_URL, "/v2/projects/").concat(projectId, "/check_ins"),
2721
- logger: this.logger,
2722
- }, { check_in: checkIn.asRequestPayload() })];
2723
- case 1:
2724
- response = _a.sent();
2725
- if (response.statusCode !== 201) {
2726
- throw new Error("Failed to create check-in[".concat(checkIn.slug, "] for project[").concat(projectId, "]: ").concat(this.getErrorMessage(response.body)));
2727
- }
2728
- data = JSON.parse(response.body);
2729
- return [2 /*return*/, check_in_1.CheckIn.fromResponsePayload(data)];
2730
- }
2731
- });
2732
- });
2733
- };
2734
- CheckInsClient.prototype.update = function (projectId, checkIn) {
2735
- return __awaiter(this, void 0, void 0, function () {
2736
- var response;
2737
- return __generator(this, function (_a) {
2738
- switch (_a.label) {
2739
- case 0:
2740
- if (!this.config.personalAuthToken || this.config.personalAuthToken === '') {
2741
- throw new Error('personalAuthToken is required');
2742
- }
2743
- return [4 /*yield*/, this.transport.send({
2744
- method: 'PUT',
2745
- headers: this.getHeaders(),
2746
- endpoint: "".concat(this.BASE_URL, "/v2/projects/").concat(projectId, "/check_ins/").concat(checkIn.id),
2747
- logger: this.logger,
2748
- }, { check_in: checkIn.asRequestPayload() })];
2749
- case 1:
2750
- response = _a.sent();
2751
- if (response.statusCode !== 204) {
2752
- throw new Error("Failed to update checkin[".concat(checkIn.slug, "] for project[").concat(projectId, "]: ").concat(this.getErrorMessage(response.body)));
2753
- }
2754
- return [2 /*return*/, checkIn];
2755
- }
2756
- });
2757
- });
2758
- };
2759
- CheckInsClient.prototype.remove = function (projectId, checkIn) {
2760
- return __awaiter(this, void 0, void 0, function () {
2761
- var response;
2762
- return __generator(this, function (_a) {
2763
- switch (_a.label) {
2764
- case 0:
2765
- if (!this.config.personalAuthToken || this.config.personalAuthToken === '') {
2766
- throw new Error('personalAuthToken is required');
2767
- }
2768
- return [4 /*yield*/, this.transport.send({
2769
- method: 'DELETE',
2770
- headers: this.getHeaders(),
2771
- endpoint: "".concat(this.BASE_URL, "/v2/projects/").concat(projectId, "/check_ins/").concat(checkIn.id),
2772
- logger: this.logger,
2773
- })];
2774
- case 1:
2775
- response = _a.sent();
2776
- if (response.statusCode !== 204) {
2777
- throw new Error("Failed to remove checkin[".concat(checkIn.slug, "] for project[").concat(projectId, "]: ").concat(this.getErrorMessage(response.body)));
2778
- }
2779
- return [2 /*return*/];
2780
- }
2781
- });
2782
- });
2783
- };
2784
- CheckInsClient.prototype.getHeaders = function () {
2785
- return {
2786
- 'Authorization': "Basic ".concat(Buffer.from("".concat(this.config.personalAuthToken, ":")).toString('base64')),
2787
- 'Content-Type': 'application/json'
2788
- };
2789
- };
2790
- CheckInsClient.prototype.getErrorMessage = function (responseBody) {
2791
- var _a;
2792
- if (!responseBody) {
2793
- return '';
2794
- }
2795
- try {
2796
- var jsonBody = JSON.parse(responseBody);
2797
- return (_a = jsonBody.errors) !== null && _a !== void 0 ? _a : '';
2798
- }
2799
- catch (e) {
2800
- return responseBody;
2801
- }
2802
- };
2803
- return CheckInsClient;
2804
- }());
2805
- client.CheckInsClient = CheckInsClient;
2806
-
2807
2491
  (function (exports) {
2808
2492
  var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
2809
2493
  var extendStatics = function (d, b) {
@@ -2884,7 +2568,6 @@ client.CheckInsClient = CheckInsClient;
2884
2568
  var aws_lambda_1 = aws_lambda;
2885
2569
  var transport_1 = transport;
2886
2570
  var stacked_store_1 = stacked_store;
2887
- var client_1 = client;
2888
2571
  var endpoint = core_1.Util.endpoint;
2889
2572
  var DEFAULT_PLUGINS = [
2890
2573
  (0, uncaught_exception_plugin_1.default)(),
@@ -2920,7 +2603,6 @@ client.CheckInsClient = CheckInsClient;
2920
2603
  var config = _this.config;
2921
2604
  config.reportTimeoutWarning = (_a = config.reportTimeoutWarning) !== null && _a !== void 0 ? _a : true;
2922
2605
  config.timeoutWarningThresholdMs = config.timeoutWarningThresholdMs || 50;
2923
- _this.__checkInsClient = new client_1.CheckInsClient(_this.config, transport);
2924
2606
  _this.__getSourceFileHandler = util_1.getSourceFile.bind(_this);
2925
2607
  _this.errorHandler = middleware_1.errorHandler.bind(_this);
2926
2608
  _this.requestHandler = middleware_1.requestHandler.bind(_this);
@@ -3042,7 +2724,7 @@ client.CheckInsClient = CheckInsClient;
3042
2724
  var NOTIFIER = {
3043
2725
  name: '@honeybadger-io/js',
3044
2726
  url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/js',
3045
- version: '6.11.2'
2727
+ version: '6.11.3'
3046
2728
  };
3047
2729
  var userAgent = function () {
3048
2730
  return "Honeybadger JS Server Client ".concat(NOTIFIER.version, ", ").concat(os_1.default.version(), "; ").concat(os_1.default.platform());