rollbar 2.26.2 → 2.26.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.
Files changed (117) hide show
  1. package/.github/workflows/ci.yml +32 -10
  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/Gruntfile.js +51 -71
  7. package/README.md +2 -4
  8. package/bower.json +1 -3
  9. package/defaults.js +17 -5
  10. package/dist/plugins/jquery.min.js +1 -1
  11. package/dist/rollbar.js +5699 -5052
  12. package/dist/rollbar.js.map +1 -1
  13. package/dist/rollbar.min.js +1 -1
  14. package/dist/rollbar.min.js.map +1 -1
  15. package/dist/rollbar.named-amd.js +5704 -5062
  16. package/dist/rollbar.named-amd.js.map +1 -1
  17. package/dist/rollbar.named-amd.min.js +1 -1
  18. package/dist/rollbar.named-amd.min.js.map +1 -1
  19. package/dist/rollbar.noconflict.umd.js +5693 -5052
  20. package/dist/rollbar.noconflict.umd.js.map +1 -1
  21. package/dist/rollbar.noconflict.umd.min.js +1 -1
  22. package/dist/rollbar.noconflict.umd.min.js.map +1 -1
  23. package/dist/rollbar.snippet.js +1 -1
  24. package/dist/rollbar.umd.js +5704 -5063
  25. package/dist/rollbar.umd.js.map +1 -1
  26. package/dist/rollbar.umd.min.js +1 -1
  27. package/dist/rollbar.umd.min.js.map +1 -1
  28. package/docs/extension-exceptions.md +35 -30
  29. package/docs/migration_v0_to_v1.md +41 -38
  30. package/index.d.ts +270 -231
  31. package/karma.conf.js +16 -34
  32. package/package.json +21 -17
  33. package/prettier.config.js +7 -0
  34. package/src/api.js +21 -10
  35. package/src/apiUtility.js +12 -8
  36. package/src/browser/core.js +103 -65
  37. package/src/browser/defaults/scrubFields.js +3 -3
  38. package/src/browser/detection.js +7 -8
  39. package/src/browser/domUtility.js +18 -8
  40. package/src/browser/globalSetup.js +12 -6
  41. package/src/browser/logger.js +1 -1
  42. package/src/browser/plugins/jquery.js +35 -35
  43. package/src/browser/predicates.js +1 -1
  44. package/src/browser/rollbar.js +1 -1
  45. package/src/browser/rollbarWrapper.js +8 -5
  46. package/src/browser/shim.js +43 -19
  47. package/src/browser/snippet_callback.js +6 -4
  48. package/src/browser/telemetry.js +573 -354
  49. package/src/browser/transforms.js +46 -27
  50. package/src/browser/transport/fetch.js +16 -14
  51. package/src/browser/transport/xhr.js +29 -13
  52. package/src/browser/transport.js +82 -25
  53. package/src/browser/url.js +16 -8
  54. package/src/browser/wrapGlobals.js +27 -8
  55. package/src/defaults.js +3 -3
  56. package/src/errorParser.js +14 -11
  57. package/src/merge.js +32 -23
  58. package/src/notifier.js +16 -13
  59. package/src/predicates.js +43 -23
  60. package/src/queue.js +71 -39
  61. package/src/rateLimiter.js +59 -18
  62. package/src/react-native/logger.js +1 -1
  63. package/src/react-native/rollbar.js +59 -55
  64. package/src/react-native/transforms.js +13 -9
  65. package/src/react-native/transport.js +44 -34
  66. package/src/rollbar.js +22 -13
  67. package/src/scrub.js +0 -1
  68. package/src/server/locals.js +69 -39
  69. package/src/server/logger.js +4 -4
  70. package/src/server/parser.js +72 -47
  71. package/src/server/rollbar.js +133 -55
  72. package/src/server/sourceMap/stackTrace.js +33 -18
  73. package/src/server/telemetry/urlHelpers.js +9 -11
  74. package/src/server/telemetry.js +68 -45
  75. package/src/server/transforms.js +37 -21
  76. package/src/server/transport.js +62 -32
  77. package/src/telemetry.js +92 -28
  78. package/src/transforms.js +33 -21
  79. package/src/truncation.js +8 -5
  80. package/src/utility/headers.js +43 -43
  81. package/src/utility/replace.js +9 -0
  82. package/src/utility/traverse.js +1 -1
  83. package/src/utility.js +89 -52
  84. package/test/api.test.js +31 -29
  85. package/test/apiUtility.test.js +43 -44
  86. package/test/browser.core.test.js +141 -131
  87. package/test/browser.domUtility.test.js +52 -35
  88. package/test/browser.predicates.test.js +13 -13
  89. package/test/browser.rollbar.test.js +597 -503
  90. package/test/browser.telemetry.test.js +76 -0
  91. package/test/browser.transforms.test.js +146 -128
  92. package/test/browser.transport.test.js +54 -46
  93. package/test/browser.url.test.js +12 -11
  94. package/test/fixtures/locals.fixtures.js +245 -126
  95. package/test/notifier.test.js +90 -78
  96. package/test/predicates.test.js +260 -214
  97. package/test/queue.test.js +230 -214
  98. package/test/rateLimiter.test.js +50 -42
  99. package/test/react-native.rollbar.test.js +149 -115
  100. package/test/react-native.transforms.test.js +21 -23
  101. package/test/react-native.transport.test.js +23 -11
  102. package/test/server.lambda.test.js +70 -53
  103. package/test/server.locals.test.js +437 -210
  104. package/test/server.parser.test.js +32 -26
  105. package/test/server.predicates.test.js +45 -43
  106. package/test/server.rollbar.test.js +311 -259
  107. package/test/server.telemetry.test.js +208 -83
  108. package/test/server.transforms.test.js +455 -361
  109. package/test/server.transport.test.js +144 -76
  110. package/test/telemetry.test.js +46 -37
  111. package/test/transforms.test.js +68 -66
  112. package/test/truncation.test.js +55 -53
  113. package/test/utility.test.js +266 -222
  114. package/webpack.config.js +46 -43
  115. package/.gitmodules +0 -3
  116. package/browserstack.browsers.js +0 -153
  117. package/browserstack.browsers.json +0 -4384
@@ -7,29 +7,29 @@ var Notifier = require('../src/notifier');
7
7
 
8
8
  var rollbarConfig = {
9
9
  accessToken: '12c99de67a444c229fca100e0967486f',
10
- captureUncaught: true
10
+ captureUncaught: true,
11
11
  };
12
12
 
13
13
  function TestQueueGenerator() {
14
- var TestQueue = function() {
14
+ var TestQueue = function () {
15
15
  this.items = [];
16
16
  };
17
17
 
18
- TestQueue.prototype.addPendingItem = function(){};
19
- TestQueue.prototype.removePendingItem = function(){};
20
- TestQueue.prototype.addItem = function(item, callback) {
21
- this.items.push({item: item, callback: callback});
18
+ TestQueue.prototype.addPendingItem = function () {};
19
+ TestQueue.prototype.removePendingItem = function () {};
20
+ TestQueue.prototype.addItem = function (item, callback) {
21
+ this.items.push({ item: item, callback: callback });
22
22
  };
23
23
 
24
- TestQueue.prototype.configure = function() {};
24
+ TestQueue.prototype.configure = function () {};
25
25
 
26
26
  return TestQueue;
27
27
  }
28
28
 
29
- describe('Notifier()', function() {
30
- it('should have all of the expected methods', function(done) {
29
+ describe('Notifier()', function () {
30
+ it('should have all of the expected methods', function (done) {
31
31
  var queue = new (TestQueueGenerator())();
32
- var options = {enabled: true};
32
+ var options = { enabled: true };
33
33
  var notifier = new Notifier(queue, options);
34
34
  expect(notifier).to.have.property('configure');
35
35
  expect(notifier).to.have.property('addTransform');
@@ -39,13 +39,13 @@ describe('Notifier()', function() {
39
39
  });
40
40
  });
41
41
 
42
- describe('configure', function() {
43
- it('should update the options', function(done) {
42
+ describe('configure', function () {
43
+ it('should update the options', function (done) {
44
44
  var queue = new (TestQueueGenerator())();
45
- var options = {someBool: true, other: 'stuff', enabled: true};
45
+ var options = { someBool: true, other: 'stuff', enabled: true };
46
46
  var notifier = new Notifier(queue, options);
47
47
 
48
- notifier.configure({other: 'baz'});
48
+ notifier.configure({ other: 'baz' });
49
49
 
50
50
  expect(notifier.options.someBool).to.be.ok();
51
51
  expect(notifier.options.other).to.eql('baz');
@@ -53,21 +53,23 @@ describe('configure', function() {
53
53
  done();
54
54
  });
55
55
 
56
- it('should pass the updated options to the transform', function(done) {
56
+ it('should pass the updated options to the transform', function (done) {
57
57
  var queue = new (TestQueueGenerator())();
58
- var options = {someBool: true, enabled: true};
58
+ var options = { someBool: true, enabled: true };
59
59
  var notifier = new Notifier(queue, options);
60
60
 
61
- var initialItem = {a: 123, b: 'a string'};
62
- notifier.addTransform(function(i, o, cb) {
63
- expect(o.someBool).to.not.be.ok();
64
- cb(null, {a: 42, b: i.b});
65
- }).addTransform(function(i, o, cb) {
66
- expect(o.someBool).to.not.be.ok();
67
- cb(null, {a: i.a+1, b: i.b});
68
- });
61
+ var initialItem = { a: 123, b: 'a string' };
62
+ notifier
63
+ .addTransform(function (i, o, cb) {
64
+ expect(o.someBool).to.not.be.ok();
65
+ cb(null, { a: 42, b: i.b });
66
+ })
67
+ .addTransform(function (i, o, cb) {
68
+ expect(o.someBool).to.not.be.ok();
69
+ cb(null, { a: i.a + 1, b: i.b });
70
+ });
69
71
 
70
- notifier.configure({someBool: false});
72
+ notifier.configure({ someBool: false });
71
73
 
72
74
  var spy = sinon.spy();
73
75
  notifier.log(initialItem, spy);
@@ -80,31 +82,31 @@ describe('configure', function() {
80
82
 
81
83
  done();
82
84
  });
83
- it('should not add an item if disabled in constructor', function(done) {
85
+ it('should not add an item if disabled in constructor', function (done) {
84
86
  var queue = new (TestQueueGenerator())();
85
- var options = {someBool: true, enabled: false};
87
+ var options = { someBool: true, enabled: false };
86
88
  var notifier = new Notifier(queue, options);
87
- var initialItem = {a: 123, b: 'a string'};
89
+ var initialItem = { a: 123, b: 'a string' };
88
90
  notifier.log(initialItem);
89
91
  expect(queue.items.length).to.eql(0);
90
92
  done();
91
93
  });
92
- it('should not add an item if disabled via call to configure', function(done) {
94
+ it('should not add an item if disabled via call to configure', function (done) {
93
95
  var queue = new (TestQueueGenerator())();
94
- var options = {someBool: true, enabled: true};
96
+ var options = { someBool: true, enabled: true };
95
97
  var notifier = new Notifier(queue, options);
96
- var initialItem = {a: 123, b: 'a string'};
97
- notifier.configure({enabled: false});
98
+ var initialItem = { a: 123, b: 'a string' };
99
+ notifier.configure({ enabled: false });
98
100
  notifier.log(initialItem);
99
101
  expect(queue.items.length).to.eql(0);
100
102
  done();
101
103
  });
102
104
  });
103
105
 
104
- describe('addTransform', function() {
105
- it('should not add a non-function', function(done) {
106
+ describe('addTransform', function () {
107
+ it('should not add a non-function', function (done) {
106
108
  var queue = new (TestQueueGenerator())();
107
- var options = {enabled: true};
109
+ var options = { enabled: true };
108
110
  var notifier = new Notifier(queue, options);
109
111
 
110
112
  expect(notifier.transforms.length).to.eql(0);
@@ -114,26 +116,28 @@ describe('addTransform', function() {
114
116
  done();
115
117
  });
116
118
 
117
- it('should add a function', function(done) {
119
+ it('should add a function', function (done) {
118
120
  var queue = new (TestQueueGenerator())();
119
- var options = {enabled: true};
121
+ var options = { enabled: true };
120
122
  var notifier = new Notifier(queue, options);
121
123
 
122
124
  expect(notifier.transforms.length).to.eql(0);
123
- notifier.addTransform(function() { return; });
125
+ notifier.addTransform(function () {
126
+ return;
127
+ });
124
128
  expect(notifier.transforms.length).to.eql(1);
125
129
 
126
130
  done();
127
131
  });
128
132
  });
129
133
 
130
- describe('log', function() {
131
- it('should work without any transforms', function(done) {
134
+ describe('log', function () {
135
+ it('should work without any transforms', function (done) {
132
136
  var queue = new (TestQueueGenerator())();
133
- var options = {enabled: true};
137
+ var options = { enabled: true };
134
138
  var notifier = new Notifier(queue, options);
135
139
 
136
- var initialItem = {a: 123, b: 'a string'};
140
+ var initialItem = { a: 123, b: 'a string' };
137
141
  var spy = sinon.spy();
138
142
  notifier.log(initialItem, spy);
139
143
  expect(spy.called).to.not.be.ok();
@@ -143,17 +147,19 @@ describe('log', function() {
143
147
  done();
144
148
  });
145
149
 
146
- it('should apply the transforms', function(done) {
150
+ it('should apply the transforms', function (done) {
147
151
  var queue = new (TestQueueGenerator())();
148
- var options = {enabled: true};
152
+ var options = { enabled: true };
149
153
  var notifier = new Notifier(queue, options);
150
154
 
151
- var initialItem = {a: 123, b: 'a string'};
152
- notifier.addTransform(function(i, o, cb) {
153
- cb(null, {a: 42, b: i.b});
154
- }).addTransform(function(i, o, cb) {
155
- cb(null, {a: i.a+1, b: i.b});
156
- });
155
+ var initialItem = { a: 123, b: 'a string' };
156
+ notifier
157
+ .addTransform(function (i, o, cb) {
158
+ cb(null, { a: 42, b: i.b });
159
+ })
160
+ .addTransform(function (i, o, cb) {
161
+ cb(null, { a: i.a + 1, b: i.b });
162
+ });
157
163
  var spy = sinon.spy();
158
164
  notifier.log(initialItem, spy);
159
165
 
@@ -166,19 +172,21 @@ describe('log', function() {
166
172
  done();
167
173
  });
168
174
 
169
- it('should stop and callback if a transform errors', function(done) {
175
+ it('should stop and callback if a transform errors', function (done) {
170
176
  var queue = new (TestQueueGenerator())();
171
- var options = {enabled: true};
177
+ var options = { enabled: true };
172
178
  var notifier = new Notifier(queue, options);
173
179
 
174
- var initialItem = {a: 123, b: 'a string'};
180
+ var initialItem = { a: 123, b: 'a string' };
175
181
  var error = new Error('fizz buzz');
176
- notifier.addTransform(function(i, o, cb) {
177
- cb(error, null);
178
- }).addTransform(function(i, o, cb) {
179
- expect(false).to.be.ok(); // assert this is not called
180
- cb(null, {a: 42, b: i.b});
181
- });
182
+ notifier
183
+ .addTransform(function (i, o, cb) {
184
+ cb(error, null);
185
+ })
186
+ .addTransform(function (i, o, cb) {
187
+ expect(false).to.be.ok(); // assert this is not called
188
+ cb(null, { a: 42, b: i.b });
189
+ });
182
190
  var spy = sinon.spy();
183
191
  notifier.log(initialItem, spy);
184
192
 
@@ -189,18 +197,20 @@ describe('log', function() {
189
197
  done();
190
198
  });
191
199
 
192
- it('should work without a callback', function(done) {
200
+ it('should work without a callback', function (done) {
193
201
  var queue = new (TestQueueGenerator())();
194
- var options = {enabled: true};
202
+ var options = { enabled: true };
195
203
  var notifier = new Notifier(queue, options);
196
204
 
197
- var initialItem = {a: 123, b: 'a string'};
198
- notifier.addTransform(function(i, o, cb) {
199
- cb(new Error('fizz buzz'), null);
200
- }).addTransform(function(i, o, cb) {
201
- expect(false).to.be.ok(); // assert this is not called
202
- cb(null, {a: 42, b: i.b});
203
- });
205
+ var initialItem = { a: 123, b: 'a string' };
206
+ notifier
207
+ .addTransform(function (i, o, cb) {
208
+ cb(new Error('fizz buzz'), null);
209
+ })
210
+ .addTransform(function (i, o, cb) {
211
+ expect(false).to.be.ok(); // assert this is not called
212
+ cb(null, { a: 42, b: i.b });
213
+ });
204
214
  notifier.log(initialItem);
205
215
 
206
216
  expect(queue.items.length).to.eql(0);
@@ -208,19 +218,21 @@ describe('log', function() {
208
218
  done();
209
219
  });
210
220
 
211
- it('should pass the options to the transforms', function(done) {
221
+ it('should pass the options to the transforms', function (done) {
212
222
  var queue = new (TestQueueGenerator())();
213
- var options = {enabled: true, someBool: true};
223
+ var options = { enabled: true, someBool: true };
214
224
  var notifier = new Notifier(queue, options);
215
225
 
216
- var initialItem = {a: 123, b: 'a string'};
217
- notifier.addTransform(function(i, o, cb) {
218
- expect(o.someBool).to.be.ok();
219
- cb(null, {a: 42, b: i.b});
220
- }).addTransform(function(i, o, cb) {
221
- expect(o.someBool).to.be.ok();
222
- cb(null, {a: i.a+1, b: i.b});
223
- });
226
+ var initialItem = { a: 123, b: 'a string' };
227
+ notifier
228
+ .addTransform(function (i, o, cb) {
229
+ expect(o.someBool).to.be.ok();
230
+ cb(null, { a: 42, b: i.b });
231
+ })
232
+ .addTransform(function (i, o, cb) {
233
+ expect(o.someBool).to.be.ok();
234
+ cb(null, { a: i.a + 1, b: i.b });
235
+ });
224
236
  var spy = sinon.spy();
225
237
  notifier.log(initialItem, spy);
226
238