rollbar 2.26.3 → 2.26.5

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 (117) hide show
  1. package/.github/workflows/ci.yml +33 -11
  2. package/.lgtm.yml +7 -7
  3. package/.prettierignore +18 -0
  4. package/.vscode/settings.json +39 -0
  5. package/CHANGELOG.md +121 -35
  6. package/CLAUDE.md +28 -0
  7. package/Gruntfile.js +48 -38
  8. package/README.md +2 -4
  9. package/SECURITY.md +5 -0
  10. package/bower.json +1 -3
  11. package/defaults.js +17 -5
  12. package/dist/plugins/jquery.min.js +1 -1
  13. package/dist/rollbar.js +6107 -5461
  14. package/dist/rollbar.js.map +1 -1
  15. package/dist/rollbar.min.js +1 -1
  16. package/dist/rollbar.min.js.map +1 -1
  17. package/dist/rollbar.named-amd.js +6107 -5466
  18. package/dist/rollbar.named-amd.js.map +1 -1
  19. package/dist/rollbar.named-amd.min.js +2 -1
  20. package/dist/rollbar.named-amd.min.js.map +1 -1
  21. package/dist/rollbar.noconflict.umd.js +6128 -5488
  22. package/dist/rollbar.noconflict.umd.js.map +1 -1
  23. package/dist/rollbar.noconflict.umd.min.js +2 -1
  24. package/dist/rollbar.noconflict.umd.min.js.map +1 -1
  25. package/dist/rollbar.snippet.js +1 -1
  26. package/dist/rollbar.umd.js +6107 -5467
  27. package/dist/rollbar.umd.js.map +1 -1
  28. package/dist/rollbar.umd.min.js +2 -1
  29. package/dist/rollbar.umd.min.js.map +1 -1
  30. package/docs/extension-exceptions.md +35 -30
  31. package/docs/migration_v0_to_v1.md +41 -38
  32. package/index.d.ts +270 -231
  33. package/karma.conf.js +15 -15
  34. package/package.json +10 -12
  35. package/prettier.config.js +7 -0
  36. package/src/api.js +21 -10
  37. package/src/apiUtility.js +12 -8
  38. package/src/browser/core.js +103 -65
  39. package/src/browser/defaults/scrubFields.js +3 -3
  40. package/src/browser/detection.js +7 -8
  41. package/src/browser/domUtility.js +18 -8
  42. package/src/browser/globalSetup.js +12 -6
  43. package/src/browser/logger.js +1 -1
  44. package/src/browser/plugins/jquery.js +35 -35
  45. package/src/browser/predicates.js +1 -1
  46. package/src/browser/rollbar.js +1 -1
  47. package/src/browser/rollbarWrapper.js +8 -5
  48. package/src/browser/shim.js +43 -19
  49. package/src/browser/snippet_callback.js +6 -4
  50. package/src/browser/telemetry.js +570 -358
  51. package/src/browser/transforms.js +46 -27
  52. package/src/browser/transport/fetch.js +16 -14
  53. package/src/browser/transport/xhr.js +29 -13
  54. package/src/browser/transport.js +91 -32
  55. package/src/browser/url.js +16 -8
  56. package/src/browser/wrapGlobals.js +27 -8
  57. package/src/defaults.js +3 -3
  58. package/src/errorParser.js +14 -11
  59. package/src/merge.js +32 -23
  60. package/src/notifier.js +16 -13
  61. package/src/predicates.js +43 -23
  62. package/src/queue.js +71 -39
  63. package/src/rateLimiter.js +59 -18
  64. package/src/react-native/logger.js +1 -1
  65. package/src/react-native/rollbar.js +59 -55
  66. package/src/react-native/transforms.js +13 -9
  67. package/src/react-native/transport.js +44 -34
  68. package/src/rollbar.js +22 -13
  69. package/src/scrub.js +0 -1
  70. package/src/server/locals.js +69 -39
  71. package/src/server/logger.js +4 -4
  72. package/src/server/parser.js +72 -47
  73. package/src/server/rollbar.js +133 -55
  74. package/src/server/sourceMap/stackTrace.js +33 -18
  75. package/src/server/telemetry/urlHelpers.js +9 -11
  76. package/src/server/telemetry.js +68 -45
  77. package/src/server/transforms.js +37 -21
  78. package/src/server/transport.js +62 -32
  79. package/src/telemetry.js +92 -28
  80. package/src/transforms.js +33 -21
  81. package/src/truncation.js +8 -5
  82. package/src/utility/headers.js +43 -43
  83. package/src/utility/replace.js +9 -0
  84. package/src/utility/traverse.js +1 -1
  85. package/src/utility.js +93 -52
  86. package/test/api.test.js +31 -29
  87. package/test/apiUtility.test.js +43 -44
  88. package/test/browser.core.test.js +141 -131
  89. package/test/browser.domUtility.test.js +52 -35
  90. package/test/browser.predicates.test.js +13 -13
  91. package/test/browser.rollbar.test.js +597 -503
  92. package/test/browser.telemetry.test.js +45 -38
  93. package/test/browser.transforms.test.js +146 -128
  94. package/test/browser.transport.test.js +54 -46
  95. package/test/browser.url.test.js +12 -11
  96. package/test/fixtures/locals.fixtures.js +245 -126
  97. package/test/notifier.test.js +90 -78
  98. package/test/predicates.test.js +260 -214
  99. package/test/queue.test.js +230 -214
  100. package/test/rateLimiter.test.js +50 -42
  101. package/test/react-native.rollbar.test.js +149 -115
  102. package/test/react-native.transforms.test.js +21 -23
  103. package/test/react-native.transport.test.js +23 -11
  104. package/test/server.lambda.test.js +70 -53
  105. package/test/server.locals.test.js +437 -210
  106. package/test/server.parser.test.js +32 -26
  107. package/test/server.predicates.test.js +45 -43
  108. package/test/server.rollbar.test.js +311 -259
  109. package/test/server.telemetry.test.js +208 -83
  110. package/test/server.transforms.test.js +455 -361
  111. package/test/server.transport.test.js +144 -76
  112. package/test/telemetry.test.js +46 -37
  113. package/test/transforms.test.js +68 -66
  114. package/test/truncation.test.js +55 -53
  115. package/test/utility.test.js +279 -222
  116. package/webpack.config.js +46 -42
  117. package/.gitmodules +0 -3
@@ -10,26 +10,26 @@ function fullElement() {
10
10
  tagName: 'DIV',
11
11
  id: 'myId',
12
12
  className: 'a b c',
13
- getAttribute: function(t) {
13
+ getAttribute: function (t) {
14
14
  return {
15
15
  type: 'theType',
16
16
  name: 'someName',
17
- other: 'otherAttr'
17
+ other: 'otherAttr',
18
18
  }[t];
19
- }
19
+ },
20
20
  };
21
21
  }
22
22
 
23
23
  function genElement(tag, id, classes, type, name) {
24
24
  var elem = {
25
25
  tagName: tag,
26
- getAttribute: function(t) {
26
+ getAttribute: function (t) {
27
27
  return {
28
28
  type: type,
29
29
  name: name,
30
- other: 'otherAttr'
30
+ other: 'otherAttr',
31
31
  }[t];
32
- }
32
+ },
33
33
  };
34
34
  if (id) {
35
35
  elem.id = id;
@@ -40,41 +40,41 @@ function genElement(tag, id, classes, type, name) {
40
40
  return elem;
41
41
  }
42
42
 
43
- describe('isDescribedElement', function() {
44
- it('should match the type without subtypes', function() {
43
+ describe('isDescribedElement', function () {
44
+ it('should match the type without subtypes', function () {
45
45
  var e = genElement('div', null, null, 'text');
46
46
  expect(d.isDescribedElement(e, 'div')).to.be.ok();
47
47
  expect(d.isDescribedElement(e, 'DIV')).to.be.ok();
48
48
  expect(d.isDescribedElement(e, 'span')).to.not.be.ok();
49
49
  });
50
- it('should work with subtypes', function() {
50
+ it('should work with subtypes', function () {
51
51
  var e = genElement('div', null, null, 'text');
52
52
  expect(d.isDescribedElement(e, 'div', ['input', 'text'])).to.be.ok();
53
53
  expect(d.isDescribedElement(e, 'div', ['input', 'nottext'])).to.not.be.ok();
54
54
  expect(d.isDescribedElement(e, 'div', [])).to.not.be.ok();
55
55
  });
56
- it('should work if element has no type', function() {
56
+ it('should work if element has no type', function () {
57
57
  var e = genElement('div');
58
58
  expect(d.isDescribedElement(e, 'div', ['input', 'text'])).to.not.be.ok();
59
59
  expect(d.isDescribedElement(e, 'div')).to.be.ok();
60
60
  });
61
61
  });
62
62
 
63
- describe('describeElement', function() {
64
- it('should include the id', function() {
63
+ describe('describeElement', function () {
64
+ it('should include the id', function () {
65
65
  var elem = fullElement();
66
66
  var description = d.describeElement(elem);
67
67
  expect(description.id).to.eql('myId');
68
68
  });
69
- it('should have the right tag name', function() {
69
+ it('should have the right tag name', function () {
70
70
  var elem = fullElement();
71
71
  var description = d.describeElement(elem);
72
72
  expect(description.tagName).to.eql('div');
73
73
  });
74
74
  });
75
75
 
76
- describe('descriptionToString', function() {
77
- it('should be right', function() {
76
+ describe('descriptionToString', function () {
77
+ it('should be right', function () {
78
78
  var elem = fullElement();
79
79
  var desc = d.describeElement(elem);
80
80
  var str = d.descriptionToString(desc);
@@ -82,14 +82,14 @@ describe('descriptionToString', function() {
82
82
  });
83
83
  });
84
84
 
85
- describe('treeToArray', function() {
86
- it('should follow parent pointers', function() {
85
+ describe('treeToArray', function () {
86
+ it('should follow parent pointers', function () {
87
87
  var base = genElement('span', 'cool');
88
88
  base.parentNode = genElement('div', 'parent');
89
89
  var arr = d.treeToArray(base);
90
90
  expect(arr.length).to.eql(2);
91
91
  });
92
- it('should not stop before html tag', function() {
92
+ it('should not stop before html tag', function () {
93
93
  var e1 = genElement('div', 'cool');
94
94
  var e2 = genElement('div', null, 'a b');
95
95
  var h = genElement('html');
@@ -98,7 +98,7 @@ describe('treeToArray', function() {
98
98
  var arr = d.treeToArray(e1);
99
99
  expect(arr.length).to.eql(2);
100
100
  });
101
- it('should cap out at 5 elements', function() {
101
+ it('should cap out at 5 elements', function () {
102
102
  var e1 = genElement('div', 'cool');
103
103
  var e2 = genElement('div', null, 'a b');
104
104
  var e3 = genElement('div', null, 'a b');
@@ -113,7 +113,7 @@ describe('treeToArray', function() {
113
113
  var arr = d.treeToArray(e1);
114
114
  expect(arr.length).to.eql(5);
115
115
  });
116
- it('should put the innermost element last', function() {
116
+ it('should put the innermost element last', function () {
117
117
  var e1 = genElement('div', 'id1');
118
118
  var e2 = genElement('div', 'id2', 'a b');
119
119
  var e3 = genElement('div', 'id3', 'a b');
@@ -131,39 +131,56 @@ describe('treeToArray', function() {
131
131
  });
132
132
  });
133
133
 
134
- describe('elementArrayToString', function() {
135
- it('should work with one element', function() {
136
- var e1 = {tagName: 'div', id: 'id1', classes: ['a', 'b'], attributes: []};
134
+ describe('elementArrayToString', function () {
135
+ it('should work with one element', function () {
136
+ var e1 = { tagName: 'div', id: 'id1', classes: ['a', 'b'], attributes: [] };
137
137
  var arr = [e1];
138
138
  var res = d.elementArrayToString(arr);
139
139
  expect(res).to.eql('div#id1.a.b');
140
140
  });
141
- it('should work with two elements', function() {
142
- var e1 = {tagName: 'div', id: 'id1', classes: ['a', 'b'], attributes: []};
143
- var e2 = {tagName: 'div', id: 'id2', classes: ['a', 'b', 'c'], attributes: [{key: 'name', value: 'thing'}]};
141
+ it('should work with two elements', function () {
142
+ var e1 = { tagName: 'div', id: 'id1', classes: ['a', 'b'], attributes: [] };
143
+ var e2 = {
144
+ tagName: 'div',
145
+ id: 'id2',
146
+ classes: ['a', 'b', 'c'],
147
+ attributes: [{ key: 'name', value: 'thing' }],
148
+ };
144
149
  var arr = [e1, e2];
145
150
  var res = d.elementArrayToString(arr);
146
151
  expect(res).to.eql('div#id1.a.b > div#id2.a.b.c[name="thing"]');
147
152
  });
148
- it('should truncate at 80 characters max without breaking within a element', function() {
149
- var e1 = {tagName: 'div', id: 'id1', classes: ['a', 'b'], attributes: []};
150
- var e2 = {tagName: 'div', id: 'id2', classes: ['a', 'b', 'c'], attributes: [{key: 'name', value: 'thing2'}]};
151
- var e3 = {tagName: 'div', id: 'id3', classes: ['a', 'b'], attributes: []};
152
- var e4 = {tagName: 'div', id: 'id4', classes: ['a', 'b', 'c'], attributes: [{key: 'name', value: 'thing4'}]};
153
+ it('should truncate at 80 characters max without breaking within a element', function () {
154
+ var e1 = { tagName: 'div', id: 'id1', classes: ['a', 'b'], attributes: [] };
155
+ var e2 = {
156
+ tagName: 'div',
157
+ id: 'id2',
158
+ classes: ['a', 'b', 'c'],
159
+ attributes: [{ key: 'name', value: 'thing2' }],
160
+ };
161
+ var e3 = { tagName: 'div', id: 'id3', classes: ['a', 'b'], attributes: [] };
162
+ var e4 = {
163
+ tagName: 'div',
164
+ id: 'id4',
165
+ classes: ['a', 'b', 'c'],
166
+ attributes: [{ key: 'name', value: 'thing4' }],
167
+ };
153
168
  var arr = [e1, e2, e3, e4];
154
169
  var res = d.elementArrayToString(arr);
155
- expect(res).to.eql('... > div#id2.a.b.c[name="thing2"] > div#id3.a.b > div#id4.a.b.c[name="thing4"]');
170
+ expect(res).to.eql(
171
+ '... > div#id2.a.b.c[name="thing2"] > div#id3.a.b > div#id4.a.b.c[name="thing4"]',
172
+ );
156
173
  });
157
174
  });
158
175
 
159
- describe('everything', function() {
160
- it('should work with one element', function() {
176
+ describe('everything', function () {
177
+ it('should work with one element', function () {
161
178
  var e = genElement('div', 'id1');
162
179
  var description = d.descriptionToString(d.describeElement(e));
163
180
  var result = d.elementArrayToString(d.treeToArray(e));
164
181
  expect(description).to.eql(result);
165
182
  });
166
- it('should work with many elements', function() {
183
+ it('should work with many elements', function () {
167
184
  var e1 = genElement('div', 'id1');
168
185
  var e2 = genElement('div', 'id2', 'a b', 'input');
169
186
  var e3 = genElement('div', 'id3', 'a b', null, 'thing');
@@ -5,48 +5,48 @@
5
5
 
6
6
  var p = require('../src/browser/predicates');
7
7
 
8
- describe('checkIgnore', function() {
9
- it('should return false if is ajax and ignoring ajax errors is on', function() {
8
+ describe('checkIgnore', function () {
9
+ it('should return false if is ajax and ignoring ajax errors is on', function () {
10
10
  var item = {
11
11
  level: 'critical',
12
- body: {message: {extra: {isAjax: true}}}
12
+ body: { message: { extra: { isAjax: true } } },
13
13
  };
14
14
  var settings = {
15
15
  reportLevel: 'debug',
16
- plugins: {jquery: {ignoreAjaxErrors: true}}
16
+ plugins: { jquery: { ignoreAjaxErrors: true } },
17
17
  };
18
18
  expect(p.checkIgnore(item, settings)).to.not.be.ok();
19
19
  });
20
- it('should return true if is ajax and ignoring ajax errors is off', function() {
20
+ it('should return true if is ajax and ignoring ajax errors is off', function () {
21
21
  var item = {
22
22
  level: 'critical',
23
- body: {message: {extra: {isAjax: true}}}
23
+ body: { message: { extra: { isAjax: true } } },
24
24
  };
25
25
  var settings = {
26
26
  reportLevel: 'debug',
27
- plugins: {jquery: {ignoreAjaxErrors: false}}
27
+ plugins: { jquery: { ignoreAjaxErrors: false } },
28
28
  };
29
29
  expect(p.checkIgnore(item, settings)).to.be.ok();
30
30
  });
31
- it('should return true if is not ajax and ignoring ajax errors is on', function() {
31
+ it('should return true if is not ajax and ignoring ajax errors is on', function () {
32
32
  var item = {
33
33
  level: 'critical',
34
- body: {message: {extra: {isAjax: false}}}
34
+ body: { message: { extra: { isAjax: false } } },
35
35
  };
36
36
  var settings = {
37
37
  reportLevel: 'debug',
38
- plugins: {jquery: {ignoreAjaxErrors: true}}
38
+ plugins: { jquery: { ignoreAjaxErrors: true } },
39
39
  };
40
40
  expect(p.checkIgnore(item, settings)).to.be.ok();
41
41
  });
42
- it('should return true if no ajax extra key and ignoring ajax errors is on', function() {
42
+ it('should return true if no ajax extra key and ignoring ajax errors is on', function () {
43
43
  var item = {
44
44
  level: 'critical',
45
- body: {message: 'a message'}
45
+ body: { message: 'a message' },
46
46
  };
47
47
  var settings = {
48
48
  reportLevel: 'debug',
49
- plugins: {jquery: {ignoreAjaxErrors: true}}
49
+ plugins: { jquery: { ignoreAjaxErrors: true } },
50
50
  };
51
51
  expect(p.checkIgnore(item, settings)).to.be.ok();
52
52
  });