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,36 +7,36 @@ var u = require('../src/apiUtility');
7
7
  var utility = require('../src/utility');
8
8
  utility.setupJSON();
9
9
 
10
- describe('buildPayload', function() {
11
- it('should package up the input into a payload', function() {
10
+ describe('buildPayload', function () {
11
+ it('should package up the input into a payload', function () {
12
12
  var token = 'abc123';
13
- var data = {context: 'not an object', other: 'stuff'};
13
+ var data = { context: 'not an object', other: 'stuff' };
14
14
  var payload = u.buildPayload(token, data);
15
15
 
16
16
  expect(payload.access_token).to.eql(token);
17
17
  expect(payload.data).to.eql(data);
18
18
  });
19
- it('should stringify context', function() {
19
+ it('should stringify context', function () {
20
20
  var token = 'abc123';
21
- var context = {a: 1, b:'other'};
21
+ var context = { a: 1, b: 'other' };
22
22
  var data = {
23
23
  context: context,
24
- other: 'stuff'
24
+ other: 'stuff',
25
25
  };
26
26
  var payload = u.buildPayload(token, data);
27
27
 
28
28
  expect(payload.data.context).to.not.eql(context);
29
29
  expect(payload.data.context).to.eql('{"a":1,"b":"other"}');
30
30
  });
31
- it('should truncate context', function() {
31
+ it('should truncate context', function () {
32
32
  var token = 'abc123';
33
33
  var context = {};
34
- for (var i=0; i<35; i++) {
34
+ for (var i = 0; i < 35; i++) {
35
35
  context[i] = i;
36
36
  }
37
37
  var data = {
38
38
  context: context,
39
- other: 'stuff'
39
+ other: 'stuff',
40
40
  };
41
41
  var payload = u.buildPayload(token, data);
42
42
 
@@ -45,15 +45,15 @@ describe('buildPayload', function() {
45
45
  });
46
46
  });
47
47
 
48
- describe('getTransportFromOptions', function() {
49
- it('should use defaults with not endpoint', function() {
48
+ describe('getTransportFromOptions', function () {
49
+ it('should use defaults with not endpoint', function () {
50
50
  var options = {
51
51
  not: 'endpoint',
52
52
  proxy: {
53
53
  host: 'whatver.com',
54
- port: 9090
54
+ port: 9090,
55
55
  },
56
- timeout: 3000
56
+ timeout: 3000,
57
57
  };
58
58
  var defaults = {
59
59
  hostname: 'api.com',
@@ -61,10 +61,10 @@ describe('getTransportFromOptions', function() {
61
61
  path: '/api/1',
62
62
  };
63
63
  var url = {
64
- parse: function() {
64
+ parse: function () {
65
65
  expect(false).to.be.ok();
66
66
  return {};
67
- }
67
+ },
68
68
  };
69
69
  var t = u.getTransportFromOptions(options, defaults, url);
70
70
  expect(t.hostname).to.eql(defaults.hostname);
@@ -73,13 +73,13 @@ describe('getTransportFromOptions', function() {
73
73
  expect(t.proxy).to.eql(options.proxy);
74
74
  expect(t.timeout).to.eql(options.timeout);
75
75
  });
76
- it('should parse the endpoint if given', function() {
76
+ it('should parse the endpoint if given', function () {
77
77
  var options = {
78
78
  endpoint: 'http://whatever.com/api/42',
79
79
  proxy: {
80
80
  host: 'nope.com',
81
- port: 9090
82
- }
81
+ port: 9090,
82
+ },
83
83
  };
84
84
  var defaults = {
85
85
  hostname: 'api.com',
@@ -88,14 +88,14 @@ describe('getTransportFromOptions', function() {
88
88
  search: '?abc=456',
89
89
  };
90
90
  var url = {
91
- parse: function(endpoint) {
91
+ parse: function (endpoint) {
92
92
  expect(endpoint).to.eql(options.endpoint);
93
93
  return {
94
94
  hostname: 'whatever.com',
95
95
  protocol: 'http:',
96
- pathname: '/api/42'
96
+ pathname: '/api/42',
97
97
  };
98
- }
98
+ },
99
99
  };
100
100
  var t = u.getTransportFromOptions(options, defaults, url);
101
101
  expect(t.hostname).to.not.eql(defaults.hostname);
@@ -105,7 +105,7 @@ describe('getTransportFromOptions', function() {
105
105
  expect(t.proxy).to.eql(options.proxy);
106
106
  expect(t.timeout).to.eql(undefined);
107
107
  });
108
- describe('getTransportFromOptions', function() {
108
+ describe('getTransportFromOptions', function () {
109
109
  var defaults = {
110
110
  hostname: 'api.com',
111
111
  protocol: 'https:',
@@ -113,34 +113,34 @@ describe('getTransportFromOptions', function() {
113
113
  search: '?abc=456',
114
114
  };
115
115
  var url = {
116
- parse: function(_) {
116
+ parse: function (_) {
117
117
  return {
118
118
  hostname: 'whatever.com',
119
119
  protocol: 'http:',
120
- pathname: '/api/42'
120
+ pathname: '/api/42',
121
121
  };
122
- }
122
+ },
123
123
  };
124
- it('should use xhr by default', function(done) {
124
+ it('should use xhr by default', function (done) {
125
125
  var options = {};
126
126
  var t = u.getTransportFromOptions(options, defaults, url);
127
127
  expect(t.transport).to.eql('xhr');
128
128
  done();
129
129
  });
130
- it('should use fetch when requested', function(done) {
131
- var options = {defaultTransport: 'fetch'};
130
+ it('should use fetch when requested', function (done) {
131
+ var options = { defaultTransport: 'fetch' };
132
132
  var t = u.getTransportFromOptions(options, defaults, url);
133
133
  expect(t.transport).to.eql('fetch');
134
134
  done();
135
135
  });
136
- it('should use xhr when requested', function(done) {
137
- var options = {defaultTransport: 'xhr'};
136
+ it('should use xhr when requested', function (done) {
137
+ var options = { defaultTransport: 'xhr' };
138
138
  var t = u.getTransportFromOptions(options, defaults, url);
139
139
  expect(t.transport).to.eql('xhr');
140
140
  done();
141
141
  });
142
- it('should use xhr when fetch is unavailable', function(done) {
143
- var options = {defaultTransport: 'fetch'};
142
+ it('should use xhr when fetch is unavailable', function (done) {
143
+ var options = { defaultTransport: 'fetch' };
144
144
  var oldFetch = window.fetch;
145
145
  self.fetch = undefined;
146
146
  var t = u.getTransportFromOptions(options, defaults, url);
@@ -148,8 +148,8 @@ describe('getTransportFromOptions', function() {
148
148
  self.fetch = oldFetch;
149
149
  done();
150
150
  });
151
- it('should use fetch when xhr is unavailable', function(done) {
152
- var options = {defaultTransport: 'xhr'};
151
+ it('should use fetch when xhr is unavailable', function (done) {
152
+ var options = { defaultTransport: 'xhr' };
153
153
  var oldXhr = window.XMLHttpRequest;
154
154
  self.XMLHttpRequest = undefined;
155
155
  var t = u.getTransportFromOptions(options, defaults, url);
@@ -158,15 +158,14 @@ describe('getTransportFromOptions', function() {
158
158
  done();
159
159
  });
160
160
  });
161
-
162
161
  });
163
162
 
164
- describe('transportOptions', function() {
165
- it('should use the given data if no proxy', function() {
163
+ describe('transportOptions', function () {
164
+ it('should use the given data if no proxy', function () {
166
165
  var transport = {
167
166
  hostname: 'a.com',
168
167
  path: '/api/v1/item/',
169
- port: 5000
168
+ port: 5000,
170
169
  };
171
170
  var method = 'GET';
172
171
 
@@ -178,16 +177,16 @@ describe('transportOptions', function() {
178
177
  expect(o.method).to.eql(method);
179
178
  expect(o.timeout).to.eql(undefined);
180
179
  });
181
- it('should use the proxy if given', function() {
180
+ it('should use the proxy if given', function () {
182
181
  var transport = {
183
182
  hostname: 'a.com',
184
183
  path: '/api/v1/item/',
185
184
  port: 5000,
186
185
  proxy: {
187
186
  host: 'b.com',
188
- port: 8080
187
+ port: 8080,
189
188
  },
190
- timeout: 3000
189
+ timeout: 3000,
191
190
  };
192
191
  var method = 'GET';
193
192
 
@@ -201,17 +200,17 @@ describe('transportOptions', function() {
201
200
  });
202
201
  });
203
202
 
204
- describe('appendPathToPath', function() {
203
+ describe('appendPathToPath', function () {
205
204
  var expSlash = '/api/item/';
206
205
  var expNoSlash = '/api/item';
207
- it('should handle trailing slash in base', function() {
206
+ it('should handle trailing slash in base', function () {
208
207
  var base = '/api/';
209
208
  expect(u.appendPathToPath(base, '/item/')).to.eql(expSlash);
210
209
  expect(u.appendPathToPath(base, '/item')).to.eql(expNoSlash);
211
210
  expect(u.appendPathToPath(base, 'item/')).to.eql(expSlash);
212
211
  expect(u.appendPathToPath(base, 'item')).to.eql(expNoSlash);
213
212
  });
214
- it('should handle no trailing slash in base', function() {
213
+ it('should handle no trailing slash in base', function () {
215
214
  var base = '/api';
216
215
  expect(u.appendPathToPath(base, '/item/')).to.eql(expSlash);
217
216
  expect(u.appendPathToPath(base, '/item')).to.eql(expNoSlash);