rollbar 2.22.0 → 2.24.1
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/.github/pull_request_template.md +15 -6
- package/.github/workflows/ci.yml +1 -1
- package/dist/rollbar.js +64 -8
- package/dist/rollbar.js.map +1 -1
- package/dist/rollbar.min.js +1 -1
- package/dist/rollbar.min.js.map +1 -1
- package/dist/rollbar.named-amd.js +64 -8
- package/dist/rollbar.named-amd.js.map +1 -1
- package/dist/rollbar.named-amd.min.js +1 -1
- package/dist/rollbar.named-amd.min.js.map +1 -1
- package/dist/rollbar.noconflict.umd.js +64 -8
- package/dist/rollbar.noconflict.umd.js.map +1 -1
- package/dist/rollbar.noconflict.umd.min.js +1 -1
- package/dist/rollbar.noconflict.umd.min.js.map +1 -1
- package/dist/rollbar.snippet.js +1 -1
- package/dist/rollbar.umd.js +64 -8
- package/dist/rollbar.umd.js.map +1 -1
- package/dist/rollbar.umd.min.js +1 -1
- package/dist/rollbar.umd.min.js.map +1 -1
- package/index.d.ts +1 -1
- package/package.json +2 -3
- package/src/defaults.js +1 -1
- package/src/server/parser.js +22 -5
- package/src/server/sourceMap/stackTrace.js +20 -0
- package/src/transforms.js +14 -2
- package/src/utility.js +47 -4
- package/test/browser.core.test.js +52 -0
- package/test/server.rollbar.test.js +6 -6
- package/test/server.transforms.test.js +63 -8
- package/test/transforms.test.js +65 -0
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
## Description of the change
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Please include a summary of the change and which issues are fixed.
|
|
4
|
+
> Please also include relevant motivation and context.
|
|
5
|
+
|
|
4
6
|
## Type of change
|
|
7
|
+
|
|
5
8
|
- [ ] Bug fix (non-breaking change that fixes an issue)
|
|
6
9
|
- [ ] New feature (non-breaking change that adds functionality)
|
|
7
10
|
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
|
11
|
+
- [ ] Maintenance
|
|
12
|
+
- [ ] New release
|
|
8
13
|
|
|
9
14
|
## Related issues
|
|
10
15
|
|
|
11
|
-
>
|
|
16
|
+
> Shortcut stories and GitHub issues (delete irrelevant)
|
|
17
|
+
|
|
18
|
+
- Fix [SC-]
|
|
19
|
+
- Fix #1
|
|
20
|
+
|
|
12
21
|
## Checklists
|
|
13
22
|
|
|
14
23
|
### Development
|
|
@@ -17,9 +26,9 @@
|
|
|
17
26
|
- [ ] The code changed/added as part of this pull request has been covered with tests
|
|
18
27
|
- [ ] All tests related to the changed code pass in development
|
|
19
28
|
|
|
20
|
-
### Code review
|
|
29
|
+
### Code review
|
|
21
30
|
|
|
22
|
-
- [ ]
|
|
23
|
-
- [ ] "Ready for review" label attached to the PR and reviewers
|
|
31
|
+
- [ ] This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
|
|
32
|
+
- [ ] "Ready for review" label attached to the PR and reviewers assigned
|
|
33
|
+
- [ ] Issue from task tracker has a link to this pull request
|
|
24
34
|
- [ ] Changes have been reviewed by at least one other engineer
|
|
25
|
-
- [ ] Issue from task tracker has a link to this pull request
|
package/.github/workflows/ci.yml
CHANGED
package/dist/rollbar.js
CHANGED
|
@@ -246,6 +246,15 @@ function isError(e) {
|
|
|
246
246
|
return isType(e, 'error') || isType(e, 'exception');
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
+
/* isPromise - a convenience function for checking if a value is a promise
|
|
250
|
+
*
|
|
251
|
+
* @param p - any value
|
|
252
|
+
* @returns true if f is a function, otherwise false
|
|
253
|
+
*/
|
|
254
|
+
function isPromise(p) {
|
|
255
|
+
return isObject(p) && isType(p.then, 'function');
|
|
256
|
+
}
|
|
257
|
+
|
|
249
258
|
function redact() {
|
|
250
259
|
return '********';
|
|
251
260
|
}
|
|
@@ -482,6 +491,37 @@ function wrapCallback(logger, f) {
|
|
|
482
491
|
};
|
|
483
492
|
}
|
|
484
493
|
|
|
494
|
+
function nonCircularClone(obj) {
|
|
495
|
+
var seen = [obj];
|
|
496
|
+
|
|
497
|
+
function clone(obj, seen) {
|
|
498
|
+
var value, name, newSeen, result = {};
|
|
499
|
+
|
|
500
|
+
try {
|
|
501
|
+
for (name in obj) {
|
|
502
|
+
value = obj[name];
|
|
503
|
+
|
|
504
|
+
if (value && (isType(value, 'object') || isType(value, 'array'))) {
|
|
505
|
+
if (seen.includes(value)) {
|
|
506
|
+
result[name] = 'Removed circular reference: ' + typeName(value);
|
|
507
|
+
} else {
|
|
508
|
+
newSeen = seen.slice();
|
|
509
|
+
newSeen.push(value);
|
|
510
|
+
result[name] = clone(value, newSeen);
|
|
511
|
+
}
|
|
512
|
+
continue;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
result[name] = value;
|
|
516
|
+
}
|
|
517
|
+
} catch (e) {
|
|
518
|
+
result = 'Failed cloning custom data: ' + e.message;
|
|
519
|
+
}
|
|
520
|
+
return result;
|
|
521
|
+
}
|
|
522
|
+
return clone(obj, seen);
|
|
523
|
+
}
|
|
524
|
+
|
|
485
525
|
function createItem(args, logger, notifier, requestKeys, lambdaContext) {
|
|
486
526
|
var message, err, custom, callback, request;
|
|
487
527
|
var arg;
|
|
@@ -539,10 +579,12 @@ function createItem(args, logger, notifier, requestKeys, lambdaContext) {
|
|
|
539
579
|
}
|
|
540
580
|
}
|
|
541
581
|
|
|
582
|
+
// if custom is an array this turns it into an object with integer keys
|
|
583
|
+
if (custom) custom = nonCircularClone(custom);
|
|
584
|
+
|
|
542
585
|
if (extraArgs.length > 0) {
|
|
543
|
-
|
|
544
|
-
custom =
|
|
545
|
-
custom.extraArgs = extraArgs;
|
|
586
|
+
if (!custom) custom = nonCircularClone({});
|
|
587
|
+
custom.extraArgs = nonCircularClone(extraArgs);
|
|
546
588
|
}
|
|
547
589
|
|
|
548
590
|
var item = {
|
|
@@ -587,7 +629,7 @@ function addErrorContext(item, errors) {
|
|
|
587
629
|
try {
|
|
588
630
|
for (var i = 0; i < errors.length; ++i) {
|
|
589
631
|
if (errors[i].hasOwnProperty('rollbarContext')) {
|
|
590
|
-
custom = merge(custom, errors[i].rollbarContext);
|
|
632
|
+
custom = merge(custom, nonCircularClone(errors[i].rollbarContext));
|
|
591
633
|
contextAdded = true;
|
|
592
634
|
}
|
|
593
635
|
}
|
|
@@ -812,6 +854,7 @@ module.exports = {
|
|
|
812
854
|
isObject: isObject,
|
|
813
855
|
isString: isString,
|
|
814
856
|
isType: isType,
|
|
857
|
+
isPromise: isPromise,
|
|
815
858
|
jsonParse: jsonParse,
|
|
816
859
|
LEVELS: LEVELS,
|
|
817
860
|
makeUnhandledStackInfo: makeUnhandledStackInfo,
|
|
@@ -4035,8 +4078,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
4035
4078
|
var numericProps = ['columnNumber', 'lineNumber'];
|
|
4036
4079
|
var stringProps = ['fileName', 'functionName', 'source'];
|
|
4037
4080
|
var arrayProps = ['args'];
|
|
4081
|
+
var objectProps = ['evalOrigin'];
|
|
4038
4082
|
|
|
4039
|
-
var props = booleanProps.concat(numericProps, stringProps, arrayProps);
|
|
4083
|
+
var props = booleanProps.concat(numericProps, stringProps, arrayProps, objectProps);
|
|
4040
4084
|
|
|
4041
4085
|
function StackFrame(obj) {
|
|
4042
4086
|
if (!obj) return;
|
|
@@ -4206,9 +4250,10 @@ function addMessageWithError(item, options, callback) {
|
|
|
4206
4250
|
function userTransform(logger) {
|
|
4207
4251
|
return function(item, options, callback) {
|
|
4208
4252
|
var newItem = _.merge(item);
|
|
4253
|
+
var response = null;
|
|
4209
4254
|
try {
|
|
4210
4255
|
if (_.isFunction(options.transform)) {
|
|
4211
|
-
options.transform(newItem.data, item);
|
|
4256
|
+
response = options.transform(newItem.data, item);
|
|
4212
4257
|
}
|
|
4213
4258
|
} catch (e) {
|
|
4214
4259
|
options.transform = null;
|
|
@@ -4216,7 +4261,18 @@ function userTransform(logger) {
|
|
|
4216
4261
|
callback(null, item);
|
|
4217
4262
|
return;
|
|
4218
4263
|
}
|
|
4219
|
-
|
|
4264
|
+
if(_.isPromise(response)) {
|
|
4265
|
+
response.then(function (promisedItem) {
|
|
4266
|
+
if(promisedItem) {
|
|
4267
|
+
newItem.data = promisedItem;
|
|
4268
|
+
}
|
|
4269
|
+
callback(null, newItem);
|
|
4270
|
+
}, function (error) {
|
|
4271
|
+
callback(error, item);
|
|
4272
|
+
});
|
|
4273
|
+
} else {
|
|
4274
|
+
callback(null, newItem);
|
|
4275
|
+
}
|
|
4220
4276
|
}
|
|
4221
4277
|
}
|
|
4222
4278
|
|
|
@@ -4523,7 +4579,7 @@ module.exports = {
|
|
|
4523
4579
|
|
|
4524
4580
|
|
|
4525
4581
|
module.exports = {
|
|
4526
|
-
version: '2.
|
|
4582
|
+
version: '2.24.1',
|
|
4527
4583
|
endpoint: 'api.rollbar.com/api/1/item/',
|
|
4528
4584
|
logLevel: 'debug',
|
|
4529
4585
|
reportLevel: 'debug',
|