@honeybadger-io/js 6.14.0 → 6.15.0
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.
- package/dist/browser/honeybadger.ext.min.js +1 -1
- package/dist/browser/honeybadger.ext.min.js.map +1 -1
- package/dist/browser/honeybadger.js +44 -10
- package/dist/browser/honeybadger.js.map +1 -1
- package/dist/browser/honeybadger.min.js +1 -1
- package/dist/browser/honeybadger.min.js.map +1 -1
- package/dist/browser/util.d.ts +2 -7
- package/dist/server/fastify.d.ts +31 -0
- package/dist/server/fastify.js +2095 -0
- package/dist/server/fastify.js.map +1 -0
- package/dist/server/honeybadger.js +5 -3
- package/dist/server/honeybadger.js.map +1 -1
- package/dist/server/instrumentation/http_event.d.ts +51 -0
- package/package.json +3 -3
|
@@ -939,7 +939,7 @@
|
|
|
939
939
|
var defaults = {};
|
|
940
940
|
|
|
941
941
|
Object.defineProperty(defaults, "__esModule", { value: true });
|
|
942
|
-
defaults.CONFIG = void 0;
|
|
942
|
+
defaults.BREADCRUMBS_SELECTOR_ATTRIBUTES = defaults.CONFIG = void 0;
|
|
943
943
|
defaults.CONFIG = {
|
|
944
944
|
apiKey: null,
|
|
945
945
|
endpoint: 'https://api.honeybadger.io',
|
|
@@ -966,6 +966,8 @@
|
|
|
966
966
|
filters: ['creditcard', 'password'],
|
|
967
967
|
__plugins: [],
|
|
968
968
|
};
|
|
969
|
+
// Browser-only, so it lives outside CONFIG (which is shared with Node).
|
|
970
|
+
defaults.BREADCRUMBS_SELECTOR_ATTRIBUTES = ['data-hb-name'];
|
|
969
971
|
|
|
970
972
|
var __assign$2 = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
971
973
|
__assign$2 = Object.assign || function(t) {
|
|
@@ -1198,7 +1200,7 @@
|
|
|
1198
1200
|
this.__notifier = {
|
|
1199
1201
|
name: '@honeybadger-io/core',
|
|
1200
1202
|
url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/core',
|
|
1201
|
-
version: '6.
|
|
1203
|
+
version: '6.15.0'
|
|
1202
1204
|
};
|
|
1203
1205
|
this.config = __assign$1(__assign$1({}, defaults_1.CONFIG), opts);
|
|
1204
1206
|
this.__initStore();
|
|
@@ -1633,12 +1635,34 @@
|
|
|
1633
1635
|
util.preferCatch = util.encodeCookie = util.decodeCookie = util.localURLPathname = util.parseURL = util.nativeFetch = util.stringTextOfElement = util.stringSelectorOfElement = util.stringNameOfElement = void 0;
|
|
1634
1636
|
var core_1$7 = src;
|
|
1635
1637
|
var globalThisOrWindow$7 = core_1$7.Util.globalThisOrWindow;
|
|
1638
|
+
var BREADCRUMBS_SELECTOR_ATTRIBUTES = core_1$7.Defaults.BREADCRUMBS_SELECTOR_ATTRIBUTES;
|
|
1636
1639
|
/**
|
|
1637
1640
|
* Converts an HTMLElement into a human-readable string.
|
|
1638
1641
|
* @param {!HTMLElement} element
|
|
1639
1642
|
* @return {string}
|
|
1640
1643
|
*/
|
|
1641
|
-
function
|
|
1644
|
+
function cleanNameOfElement(element, attributes) {
|
|
1645
|
+
if (!Array.isArray(attributes)) {
|
|
1646
|
+
return undefined;
|
|
1647
|
+
}
|
|
1648
|
+
if (!element || typeof element.getAttribute !== 'function') {
|
|
1649
|
+
return undefined;
|
|
1650
|
+
}
|
|
1651
|
+
for (var _i = 0, attributes_1 = attributes; _i < attributes_1.length; _i++) {
|
|
1652
|
+
var attr = attributes_1[_i];
|
|
1653
|
+
if (typeof attr !== 'string' || attr.length === 0) {
|
|
1654
|
+
continue;
|
|
1655
|
+
}
|
|
1656
|
+
var value = element.getAttribute(attr);
|
|
1657
|
+
if (value && value.trim()) {
|
|
1658
|
+
var normalized = value.trim().replace(/\s+/g, ' ');
|
|
1659
|
+
return truncate(normalized, 100);
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
return undefined;
|
|
1663
|
+
}
|
|
1664
|
+
function stringNameOfElement(element, attributes) {
|
|
1665
|
+
if (attributes === void 0) { attributes = BREADCRUMBS_SELECTOR_ATTRIBUTES; }
|
|
1642
1666
|
if (!element || !element.tagName) {
|
|
1643
1667
|
return '';
|
|
1644
1668
|
}
|
|
@@ -1647,6 +1671,10 @@
|
|
|
1647
1671
|
if (name === 'html') {
|
|
1648
1672
|
return '';
|
|
1649
1673
|
}
|
|
1674
|
+
var cleanName = cleanNameOfElement(element, attributes);
|
|
1675
|
+
if (cleanName) {
|
|
1676
|
+
return cleanName;
|
|
1677
|
+
}
|
|
1650
1678
|
if (element.id) {
|
|
1651
1679
|
name += "#".concat(element.id);
|
|
1652
1680
|
}
|
|
@@ -1669,10 +1697,15 @@
|
|
|
1669
1697
|
return name;
|
|
1670
1698
|
}
|
|
1671
1699
|
util.stringNameOfElement = stringNameOfElement;
|
|
1672
|
-
function stringSelectorOfElement(element) {
|
|
1673
|
-
|
|
1700
|
+
function stringSelectorOfElement(element, attributes) {
|
|
1701
|
+
if (attributes === void 0) { attributes = BREADCRUMBS_SELECTOR_ATTRIBUTES; }
|
|
1702
|
+
var name = stringNameOfElement(element, attributes);
|
|
1703
|
+
// A named element anchors the selector: stop walking up.
|
|
1704
|
+
if (name && cleanNameOfElement(element, attributes)) {
|
|
1705
|
+
return name;
|
|
1706
|
+
}
|
|
1674
1707
|
if (element.parentNode && element.parentNode.tagName) {
|
|
1675
|
-
var parentName = stringSelectorOfElement(element.parentNode);
|
|
1708
|
+
var parentName = stringSelectorOfElement(element.parentNode, attributes);
|
|
1676
1709
|
if (parentName.length > 0) {
|
|
1677
1710
|
return "".concat(parentName, " > ").concat(name);
|
|
1678
1711
|
}
|
|
@@ -2002,8 +2035,9 @@
|
|
|
2002
2035
|
_window.addEventListener('click', function (event) {
|
|
2003
2036
|
var message, selector, text;
|
|
2004
2037
|
try {
|
|
2005
|
-
|
|
2006
|
-
|
|
2038
|
+
var attributes = client.config.breadcrumbsSelectorAttributes;
|
|
2039
|
+
message = (0, util_1.stringNameOfElement)(event.target, attributes);
|
|
2040
|
+
selector = (0, util_1.stringSelectorOfElement)(event.target, attributes);
|
|
2007
2041
|
text = (0, util_1.stringTextOfElement)(event.target);
|
|
2008
2042
|
}
|
|
2009
2043
|
catch (e) {
|
|
@@ -2552,7 +2586,7 @@
|
|
|
2552
2586
|
__extends(Honeybadger, _super);
|
|
2553
2587
|
function Honeybadger(opts) {
|
|
2554
2588
|
if (opts === void 0) { opts = {}; }
|
|
2555
|
-
var _this = _super.call(this, __assign({ userFeedbackEndpoint: 'https://api.honeybadger.io/v2/feedback', async: true, maxErrors: null, ignoreBrowserExtensionErrors: false, projectRoot: getProjectRoot() }, opts), new transport_1.BrowserTransport({
|
|
2589
|
+
var _this = _super.call(this, __assign({ userFeedbackEndpoint: 'https://api.honeybadger.io/v2/feedback', async: true, maxErrors: null, ignoreBrowserExtensionErrors: false, breadcrumbsSelectorAttributes: core_1.Defaults.BREADCRUMBS_SELECTOR_ATTRIBUTES, projectRoot: getProjectRoot() }, opts), new transport_1.BrowserTransport({
|
|
2556
2590
|
'User-Agent': userAgent(),
|
|
2557
2591
|
})) || this;
|
|
2558
2592
|
/** @internal */
|
|
@@ -2726,7 +2760,7 @@
|
|
|
2726
2760
|
var NOTIFIER = {
|
|
2727
2761
|
name: '@honeybadger-io/js',
|
|
2728
2762
|
url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/js',
|
|
2729
|
-
version: '6.
|
|
2763
|
+
version: '6.15.0'
|
|
2730
2764
|
};
|
|
2731
2765
|
var userAgent = function () {
|
|
2732
2766
|
if (typeof navigator !== 'undefined') {
|