@honeybadger-io/js 4.0.0-beta.1 → 4.0.0-beta.4
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/README.md +2 -1
- package/dist/browser/honeybadger.js +20 -14
- 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/types/core/client.d.ts +1 -1
- package/dist/browser/types/core/types.d.ts +4 -0
- package/dist/browser/types/core/util.d.ts +1 -1
- package/dist/browser/types/server.d.ts +1 -1
- package/dist/server/honeybadger.d.ts +1 -1
- package/dist/server/honeybadger.js +36 -18
- package/dist/server/types/core/client.d.ts +1 -1
- package/dist/server/types/core/types.d.ts +4 -0
- package/dist/server/types/core/util.d.ts +1 -1
- package/dist/server/types/server.d.ts +1 -1
- package/package.json +6 -3
- package/dist/browser/types/core/error.d.ts +0 -3
- package/dist/server/types/core/error.d.ts +0 -3
package/README.md
CHANGED
|
@@ -14,7 +14,8 @@ For comprehensive documentation and support, [check out our documentation site](
|
|
|
14
14
|
|
|
15
15
|
## Changelog
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
[Conventional Commits](https://www.conventionalcommits.org/) are enforced with a git hook ([husky](https://typicode.github.io/husky) + [commitlint](https://commitlint.js.org/)) in order to automate changelog generation.
|
|
18
|
+
[CHANGELOG.md](CHANGELOG.md) is updated when a new version is released (npm run release) with [shipjs](https://community.algolia.com/shipjs/reference/all-config.html#updatechangelog).
|
|
18
19
|
|
|
19
20
|
## Contributing
|
|
20
21
|
|
|
@@ -271,7 +271,7 @@
|
|
|
271
271
|
return true;
|
|
272
272
|
}
|
|
273
273
|
// Returns a new object with properties from other object.
|
|
274
|
-
function
|
|
274
|
+
function shallowClone(obj) {
|
|
275
275
|
if (typeof (obj) !== 'object' || obj === null) {
|
|
276
276
|
return {};
|
|
277
277
|
}
|
|
@@ -298,8 +298,14 @@
|
|
|
298
298
|
return false;
|
|
299
299
|
}
|
|
300
300
|
function canSerialize(obj) {
|
|
301
|
-
|
|
302
|
-
|
|
301
|
+
var typeOfObj = typeof obj;
|
|
302
|
+
// Functions are TMI
|
|
303
|
+
if (/function/.test(typeOfObj)) {
|
|
304
|
+
// Let special toJSON method pass as it's used by JSON.stringify (#722)
|
|
305
|
+
return obj.name === 'toJSON';
|
|
306
|
+
}
|
|
307
|
+
// Symbols can't convert to strings.
|
|
308
|
+
if (/symbol/.test(typeOfObj)) {
|
|
303
309
|
return false;
|
|
304
310
|
}
|
|
305
311
|
if (obj === null) {
|
|
@@ -395,7 +401,7 @@
|
|
|
395
401
|
notice = merge(thing, { name: e.name, message: e.message, stack: e.stack });
|
|
396
402
|
}
|
|
397
403
|
else if (typeof thing === 'object') {
|
|
398
|
-
notice =
|
|
404
|
+
notice = shallowClone(thing);
|
|
399
405
|
}
|
|
400
406
|
else {
|
|
401
407
|
var m = String(thing);
|
|
@@ -583,7 +589,7 @@
|
|
|
583
589
|
var notifier = {
|
|
584
590
|
name: 'honeybadger-js',
|
|
585
591
|
url: 'https://github.com/honeybadger-io/honeybadger-js',
|
|
586
|
-
version: '4.0.0-beta.
|
|
592
|
+
version: '4.0.0-beta.4'
|
|
587
593
|
};
|
|
588
594
|
// Split at commas and spaces
|
|
589
595
|
var TAG_SEPARATOR = /,|\s+/;
|
|
@@ -695,11 +701,11 @@
|
|
|
695
701
|
stack: notice.stack
|
|
696
702
|
}
|
|
697
703
|
});
|
|
698
|
-
var breadcrumbs = this.
|
|
704
|
+
var breadcrumbs = this.__getStoreContentsOrDefault().breadcrumbs;
|
|
699
705
|
notice.__breadcrumbs = this.config.breadcrumbsEnabled ? breadcrumbs.slice() : [];
|
|
700
706
|
// we need to have the source file data before the beforeNotifyHandlers,
|
|
701
707
|
// in case they modify them
|
|
702
|
-
var sourceCodeData = notice && notice.backtrace ? notice.backtrace.map(function (trace) { return
|
|
708
|
+
var sourceCodeData = notice && notice.backtrace ? notice.backtrace.map(function (trace) { return shallowClone(trace); }) : null;
|
|
703
709
|
getSourceForBacktrace(sourceCodeData, this.__getSourceFileHandler, function (sourcePerTrace) {
|
|
704
710
|
sourcePerTrace.forEach(function (source, index) {
|
|
705
711
|
notice.backtrace[index].source = source;
|
|
@@ -770,7 +776,7 @@
|
|
|
770
776
|
if (objectIsEmpty(notice)) {
|
|
771
777
|
return null;
|
|
772
778
|
}
|
|
773
|
-
var context = this.
|
|
779
|
+
var context = this.__getStoreContentsOrDefault().context;
|
|
774
780
|
var noticeTags = this.__constructTags(notice.tags);
|
|
775
781
|
var contextTags = this.__constructTags(context["tags"]);
|
|
776
782
|
var configTags = this.__constructTags(this.config.tags);
|
|
@@ -800,7 +806,7 @@
|
|
|
800
806
|
return;
|
|
801
807
|
}
|
|
802
808
|
opts = opts || {};
|
|
803
|
-
var metadata =
|
|
809
|
+
var metadata = shallowClone(opts.metadata);
|
|
804
810
|
var category = opts.category || 'custom';
|
|
805
811
|
var timestamp = new Date().toISOString();
|
|
806
812
|
var store = this.__store.getStore();
|
|
@@ -871,13 +877,13 @@
|
|
|
871
877
|
/**
|
|
872
878
|
* For ALS, the store may be uninitialized (if .run()` has not been called).
|
|
873
879
|
* This provides an easy way to read the existing store object or fall back to a default.
|
|
874
|
-
* Returns *a copy* of the store.
|
|
880
|
+
* Returns *a copy* of the store contents.
|
|
875
881
|
* @internal
|
|
876
882
|
*/
|
|
877
|
-
Client.prototype.
|
|
878
|
-
var
|
|
879
|
-
var
|
|
880
|
-
return __assign({ context: {}, breadcrumbs: [] },
|
|
883
|
+
Client.prototype.__getStoreContentsOrDefault = function () {
|
|
884
|
+
var existingStoreContents = this.__store.getStore();
|
|
885
|
+
var storeContents = existingStoreContents || {};
|
|
886
|
+
return __assign({ context: {}, breadcrumbs: [] }, storeContents);
|
|
881
887
|
};
|
|
882
888
|
return Client;
|
|
883
889
|
}());
|