rollbar 2.26.3 → 3.0.0-alpha.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/.cursor/rules/guidelines.mdc +154 -0
- package/.github/workflows/ci.yml +32 -12
- package/.lgtm.yml +7 -7
- package/.prettierignore +18 -0
- package/.vscode/settings.json +39 -0
- package/CHANGELOG.md +121 -35
- package/CLAUDE.md +201 -0
- package/Gruntfile.js +101 -48
- package/Makefile +3 -3
- package/README.md +2 -4
- package/SECURITY.md +5 -0
- package/babel.config.json +9 -0
- package/bower.json +1 -3
- package/codex.md +148 -0
- package/defaults.js +17 -5
- package/dist/plugins/jquery.min.js +1 -1
- package/dist/rollbar.js +18748 -5375
- package/dist/rollbar.js.map +1 -1
- package/dist/rollbar.min.js +2 -1
- package/dist/rollbar.min.js.LICENSE.txt +1 -0
- package/dist/rollbar.min.js.map +1 -1
- package/dist/rollbar.named-amd.js +19368 -6000
- package/dist/rollbar.named-amd.js.map +1 -1
- package/dist/rollbar.named-amd.min.js +3 -1
- package/dist/rollbar.named-amd.min.js.LICENSE.txt +1 -0
- package/dist/rollbar.named-amd.min.js.map +1 -1
- package/dist/rollbar.noconflict.umd.js +18749 -5380
- package/dist/rollbar.noconflict.umd.js.map +1 -1
- package/dist/rollbar.noconflict.umd.min.js +3 -1
- package/dist/rollbar.noconflict.umd.min.js.LICENSE.txt +1 -0
- package/dist/rollbar.noconflict.umd.min.js.map +1 -1
- package/dist/rollbar.snippet.js +1 -1
- package/dist/rollbar.umd.js +19367 -6000
- package/dist/rollbar.umd.js.map +1 -1
- package/dist/rollbar.umd.min.js +3 -1
- package/dist/rollbar.umd.min.js.LICENSE.txt +1 -0
- package/dist/rollbar.umd.min.js.map +1 -1
- package/docs/extension-exceptions.md +35 -30
- package/docs/migration_v0_to_v1.md +41 -38
- package/eslint.config.mjs +33 -0
- package/get_versions.js +33 -0
- package/index.d.ts +270 -231
- package/karma.conf.js +18 -27
- package/package.json +21 -21
- package/prettier.config.js +7 -0
- package/src/api.js +78 -14
- package/src/apiUtility.js +14 -11
- package/src/browser/core.js +138 -72
- package/src/browser/defaults/scrubFields.js +3 -3
- package/src/browser/detection.js +7 -8
- package/src/browser/domUtility.js +18 -8
- package/src/browser/globalSetup.js +12 -6
- package/src/browser/logger.js +1 -1
- package/src/browser/plugins/jquery.js +35 -35
- package/src/browser/predicates.js +1 -1
- package/src/browser/replay/defaults.js +71 -0
- package/src/browser/replay/recorder.js +193 -0
- package/src/browser/replay/replayMap.js +195 -0
- package/src/browser/rollbar.js +12 -8
- package/src/browser/rollbarWrapper.js +8 -5
- package/src/browser/shim.js +43 -19
- package/src/browser/snippet_callback.js +6 -4
- package/src/browser/telemetry.js +573 -361
- package/src/browser/transforms.js +46 -27
- package/src/browser/transport/fetch.js +26 -14
- package/src/browser/transport/xhr.js +41 -14
- package/src/browser/transport.js +93 -33
- package/src/browser/url.js +16 -8
- package/src/browser/wrapGlobals.js +27 -8
- package/src/defaults.js +3 -3
- package/src/errorParser.js +14 -11
- package/src/merge.js +32 -23
- package/src/notifier.js +16 -13
- package/src/predicates.js +43 -23
- package/src/queue.js +133 -40
- package/src/rateLimiter.js +59 -18
- package/src/react-native/logger.js +1 -1
- package/src/react-native/rollbar.js +59 -55
- package/src/react-native/transforms.js +13 -9
- package/src/react-native/transport.js +44 -34
- package/src/rollbar.js +72 -21
- package/src/scrub.js +0 -1
- package/src/server/locals.js +69 -39
- package/src/server/logger.js +4 -4
- package/src/server/parser.js +72 -47
- package/src/server/rollbar.js +135 -56
- package/src/server/sourceMap/stackTrace.js +33 -18
- package/src/server/telemetry/urlHelpers.js +9 -11
- package/src/server/telemetry.js +68 -45
- package/src/server/transforms.js +37 -21
- package/src/server/transport.js +62 -32
- package/src/telemetry.js +162 -33
- package/src/tracing/context.js +24 -0
- package/src/tracing/contextManager.js +37 -0
- package/src/tracing/defaults.js +7 -0
- package/src/tracing/exporter.js +188 -0
- package/src/tracing/hrtime.js +98 -0
- package/src/tracing/id.js +24 -0
- package/src/tracing/session.js +55 -0
- package/src/tracing/span.js +92 -0
- package/src/tracing/spanProcessor.js +15 -0
- package/src/tracing/tracer.js +46 -0
- package/src/tracing/tracing.js +89 -0
- package/src/transforms.js +33 -21
- package/src/truncation.js +8 -5
- package/src/utility/headers.js +43 -43
- package/src/utility/replace.js +9 -0
- package/src/utility/traverse.js +1 -1
- package/src/utility.js +123 -52
- package/test/api.test.js +88 -41
- package/test/apiUtility.test.js +48 -50
- package/test/browser.core.test.js +142 -141
- package/test/browser.domUtility.test.js +53 -36
- package/test/browser.predicates.test.js +14 -14
- package/test/browser.replay.recorder.test.js +416 -0
- package/test/browser.rollbar.test.js +655 -515
- package/test/browser.telemetry.test.js +46 -39
- package/test/browser.transforms.test.js +164 -139
- package/test/browser.transport.test.js +59 -50
- package/test/browser.url.test.js +13 -12
- package/test/fixtures/locals.fixtures.js +245 -126
- package/test/fixtures/replay/index.js +20 -0
- package/test/fixtures/replay/payloads.fixtures.js +229 -0
- package/test/fixtures/replay/rrwebEvents.fixtures.js +251 -0
- package/test/fixtures/replay/rrwebSyntheticEvents.fixtures.js +328 -0
- package/test/notifier.test.js +91 -79
- package/test/predicates.test.js +261 -215
- package/test/queue.test.js +231 -215
- package/test/rateLimiter.test.js +51 -43
- package/test/react-native.rollbar.test.js +150 -116
- package/test/react-native.transforms.test.js +23 -25
- package/test/react-native.transport.test.js +26 -14
- package/test/replay/index.js +2 -0
- package/test/replay/integration/api.spans.test.js +136 -0
- package/test/replay/integration/e2e.test.js +228 -0
- package/test/replay/integration/index.js +9 -0
- package/test/replay/integration/queue.replayMap.test.js +332 -0
- package/test/replay/integration/replayMap.test.js +163 -0
- package/test/replay/integration/sessionRecording.test.js +390 -0
- package/test/replay/unit/api.postSpans.test.js +150 -0
- package/test/replay/unit/index.js +7 -0
- package/test/replay/unit/queue.replayMap.test.js +225 -0
- package/test/replay/unit/replayMap.test.js +348 -0
- package/test/replay/util/index.js +5 -0
- package/test/replay/util/mockRecordFn.js +80 -0
- package/test/server.lambda.mocha.test.mjs +172 -0
- package/test/server.locals.constructor.mocha.test.mjs +80 -0
- package/test/server.locals.error-handling.mocha.test.mjs +387 -0
- package/test/server.locals.merge.mocha.test.mjs +267 -0
- package/test/server.locals.test-utils.mjs +114 -0
- package/test/server.parser.mocha.test.mjs +87 -0
- package/test/server.predicates.mocha.test.mjs +63 -0
- package/test/server.rollbar.constructor.mocha.test.mjs +199 -0
- package/test/server.rollbar.handlers.mocha.test.mjs +253 -0
- package/test/server.rollbar.logging.mocha.test.mjs +326 -0
- package/test/server.rollbar.misc.mocha.test.mjs +44 -0
- package/test/server.rollbar.test-utils.mjs +57 -0
- package/test/server.telemetry.mocha.test.mjs +377 -0
- package/test/server.transforms.data.mocha.test.mjs +163 -0
- package/test/server.transforms.error.mocha.test.mjs +199 -0
- package/test/server.transforms.request.mocha.test.mjs +208 -0
- package/test/server.transforms.scrub.mocha.test.mjs +140 -0
- package/test/server.transforms.sourcemaps.mocha.test.mjs +122 -0
- package/test/server.transforms.test-utils.mjs +62 -0
- package/test/server.transport.mocha.test.mjs +269 -0
- package/test/telemetry.test.js +178 -38
- package/test/tracing/contextManager.test.js +28 -0
- package/test/tracing/exporter.toPayload.test.js +400 -0
- package/test/tracing/id.test.js +24 -0
- package/test/tracing/span.test.js +183 -0
- package/test/tracing/spanProcessor.test.js +73 -0
- package/test/tracing/tracing.test.js +105 -0
- package/test/transforms.test.js +70 -68
- package/test/truncation.test.js +57 -55
- package/test/utility.test.js +310 -228
- package/webpack.config.js +36 -70
- package/.eslintignore +0 -7
- package/.gitmodules +0 -3
- package/test/server.lambda.test.js +0 -177
- package/test/server.locals.test.js +0 -841
- package/test/server.parser.test.js +0 -72
- package/test/server.predicates.test.js +0 -89
- package/test/server.rollbar.test.js +0 -676
- package/test/server.telemetry.test.js +0 -318
- package/test/server.transforms.test.js +0 -1099
- package/test/server.transport.test.js +0 -201
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var assert = require('assert');
|
|
4
|
-
var util = require('util');
|
|
5
|
-
var vows = require('vows');
|
|
6
|
-
var Transport = require('../src/server/transport');
|
|
7
|
-
var t = new Transport();
|
|
8
|
-
|
|
9
|
-
vows.describe('transport')
|
|
10
|
-
.addBatch({
|
|
11
|
-
'post': {
|
|
12
|
-
'base data': {
|
|
13
|
-
topic: function() {
|
|
14
|
-
return {
|
|
15
|
-
accessToken: 'abc123',
|
|
16
|
-
options: {},
|
|
17
|
-
payload: {
|
|
18
|
-
access_token: 'abc123',
|
|
19
|
-
data: {a: 1}
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
},
|
|
23
|
-
'with no payload': {
|
|
24
|
-
topic: function(data) {
|
|
25
|
-
var factory = transportFactory(null, '{"err": null, "result":"all good"}');
|
|
26
|
-
t.post(data.accessToken, data.options, null, this.callback, factory);
|
|
27
|
-
},
|
|
28
|
-
'should have an error': function(err, resp) {
|
|
29
|
-
assert.ok(err);
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
'with a payload and no error': {
|
|
33
|
-
topic: function(data) {
|
|
34
|
-
var factory = transportFactory(null, '{"err": null, "result":{"uuid":"42def", "message":"all good"}}',
|
|
35
|
-
function() {
|
|
36
|
-
assert.equal(this.options.headers['Content-Type'], 'application/json');
|
|
37
|
-
assert.isNumber(this.options.headers['Content-Length']);
|
|
38
|
-
assert(this.options.headers['Content-Length'] > 0);
|
|
39
|
-
assert.equal(this.options.headers['X-Rollbar-Access-Token'], data.accessToken);
|
|
40
|
-
});
|
|
41
|
-
t.post(data.accessToken, data.options, data.payload, this.callback, factory);
|
|
42
|
-
},
|
|
43
|
-
'should not error': function(err, resp) {
|
|
44
|
-
assert.ifError(err);
|
|
45
|
-
},
|
|
46
|
-
'should have the right response data': function(err, resp) {
|
|
47
|
-
assert.equal(resp.message, 'all good');
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
'with a payload and an error in the response': {
|
|
51
|
-
topic: function(data) {
|
|
52
|
-
var factory = transportFactory(null, '{"err": "bork", "message":"things broke"}',
|
|
53
|
-
function() {
|
|
54
|
-
assert.equal(this.options.headers['Content-Type'], 'application/json');
|
|
55
|
-
assert.isNumber(this.options.headers['Content-Length']);
|
|
56
|
-
assert(this.options.headers['Content-Length'] > 0);
|
|
57
|
-
assert.equal(this.options.headers['X-Rollbar-Access-Token'], data.accessToken);
|
|
58
|
-
});
|
|
59
|
-
t.post(data.accessToken, data.options, data.payload, this.callback, factory);
|
|
60
|
-
},
|
|
61
|
-
'should error': function(err, resp) {
|
|
62
|
-
assert.ok(err);
|
|
63
|
-
},
|
|
64
|
-
'should have the message somewhere': function(err, resp) {
|
|
65
|
-
assert.match(err.message, /things broke/);
|
|
66
|
-
},
|
|
67
|
-
'should not have a response': function(err, resp) {
|
|
68
|
-
assert.ifError(resp);
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
'with a payload and an error during sending': {
|
|
72
|
-
topic: function(data) {
|
|
73
|
-
var factory = transportFactory(new Error('bork'), null,
|
|
74
|
-
function() {
|
|
75
|
-
assert.equal(this.options.headers['Content-Type'], 'application/json');
|
|
76
|
-
assert.isNumber(this.options.headers['Content-Length']);
|
|
77
|
-
assert(this.options.headers['Content-Length'] > 0);
|
|
78
|
-
assert.equal(this.options.headers['X-Rollbar-Access-Token'], data.accessToken);
|
|
79
|
-
});
|
|
80
|
-
t.post(data.accessToken, data.options, data.payload, this.callback, factory);
|
|
81
|
-
},
|
|
82
|
-
'should error': function(err, resp) {
|
|
83
|
-
assert.ok(err);
|
|
84
|
-
},
|
|
85
|
-
'should have the message somewhere': function(err, resp) {
|
|
86
|
-
assert.match(err.message, /bork/);
|
|
87
|
-
},
|
|
88
|
-
'should not have a response': function(err, resp) {
|
|
89
|
-
assert.ifError(resp);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
'with rate limiting': {
|
|
94
|
-
topic: function() {
|
|
95
|
-
return new Transport();
|
|
96
|
-
},
|
|
97
|
-
'should transmit non-rate limited requests': function(t) {
|
|
98
|
-
var response = new TestResponse({
|
|
99
|
-
statusCode: 200,
|
|
100
|
-
headers: {
|
|
101
|
-
'x-rate-limit-remaining': '1',
|
|
102
|
-
'x-rate-limit-remaining-seconds': '100'
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
var error;
|
|
106
|
-
|
|
107
|
-
assert.equal(t.rateLimitExpires, 0);
|
|
108
|
-
|
|
109
|
-
t.handleResponse(response);
|
|
110
|
-
|
|
111
|
-
var factory = transportFactory(null, '{"err": null, "result": "all good"}');
|
|
112
|
-
t.post('token', {}, 'payload', function(err){ error = err; }, factory);
|
|
113
|
-
|
|
114
|
-
assert.equal(error, null);
|
|
115
|
-
assert.isTrue(Math.floor(Date.now() / 1000) >= t.rateLimitExpires);
|
|
116
|
-
},
|
|
117
|
-
'should drop rate limited requests and set timeout': function(t) {
|
|
118
|
-
var response = new TestResponse({
|
|
119
|
-
statusCode: 429,
|
|
120
|
-
headers: {
|
|
121
|
-
'x-rate-limit-remaining': '0',
|
|
122
|
-
'x-rate-limit-remaining-seconds': '100'
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
var error;
|
|
126
|
-
|
|
127
|
-
t.handleResponse(response);
|
|
128
|
-
|
|
129
|
-
t.post('token', {}, 'payload', function(err){ error = err; });
|
|
130
|
-
|
|
131
|
-
assert.match(error.message, /Exceeded rate limit/);
|
|
132
|
-
assert.isTrue(Math.floor(Date.now() / 1000) < t.rateLimitExpires);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
})
|
|
137
|
-
.export(module, {error: false});
|
|
138
|
-
|
|
139
|
-
var TestTransport = function(options, error, response, assertions) {
|
|
140
|
-
this.options = options;
|
|
141
|
-
this.error = error;
|
|
142
|
-
this.response = response;
|
|
143
|
-
this.requestOpts = null;
|
|
144
|
-
this.requestCallback = null;
|
|
145
|
-
this.assertions = assertions;
|
|
146
|
-
};
|
|
147
|
-
var TestRequest = function(error, response, transport) {
|
|
148
|
-
this.error = error;
|
|
149
|
-
this.responseData = response;
|
|
150
|
-
this.data = [];
|
|
151
|
-
this.events = {};
|
|
152
|
-
this.transport = transport;
|
|
153
|
-
this.response = null;
|
|
154
|
-
};
|
|
155
|
-
TestTransport.prototype.request = function(opts, cb) {
|
|
156
|
-
this.requestOpts = opts;
|
|
157
|
-
this.requestCallback = cb;
|
|
158
|
-
return new TestRequest(this.error, this.response, this);
|
|
159
|
-
};
|
|
160
|
-
TestRequest.prototype.write = function(data) {
|
|
161
|
-
this.data.push(data);
|
|
162
|
-
};
|
|
163
|
-
TestRequest.prototype.on = function(event, cb) {
|
|
164
|
-
this.events[event] = cb;
|
|
165
|
-
};
|
|
166
|
-
TestRequest.prototype.end = function() {
|
|
167
|
-
if (this.transport.assertions) {
|
|
168
|
-
this.transport.assertions();
|
|
169
|
-
}
|
|
170
|
-
if (this.error) {
|
|
171
|
-
if (this.events['error']) {
|
|
172
|
-
this.events['error'](this.error);
|
|
173
|
-
}
|
|
174
|
-
} else {
|
|
175
|
-
this.response = new TestResponse();
|
|
176
|
-
this.transport.requestCallback(this.response);
|
|
177
|
-
if (this.response.events['data']) {
|
|
178
|
-
this.response.events['data'](this.responseData);
|
|
179
|
-
}
|
|
180
|
-
if (this.response.events['end']) {
|
|
181
|
-
this.response.events['end']();
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
var TestResponse = function(options = {}) {
|
|
186
|
-
this.encoding = null;
|
|
187
|
-
this.events = {};
|
|
188
|
-
this.headers = options.headers || {};
|
|
189
|
-
this.statusCode = options.statusCode || 200;
|
|
190
|
-
};
|
|
191
|
-
TestResponse.prototype.setEncoding = function(s) {
|
|
192
|
-
this.encoding = s;
|
|
193
|
-
}
|
|
194
|
-
TestResponse.prototype.on = function(event, cb) {
|
|
195
|
-
this.events[event] = cb;
|
|
196
|
-
};
|
|
197
|
-
var transportFactory = function(error, response, assertions) {
|
|
198
|
-
return function(options) {
|
|
199
|
-
return new TestTransport(options, error, response, assertions);
|
|
200
|
-
};
|
|
201
|
-
};
|