@sentry/browser 6.18.2 → 6.19.0
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/bundles/bundle.debug.min.js +3 -0
- package/bundles/bundle.debug.min.js.map +1 -0
- package/bundles/bundle.es6.debug.min.js +3 -0
- package/bundles/bundle.es6.debug.min.js.map +1 -0
- package/{build → bundles}/bundle.es6.js +172 -181
- package/bundles/bundle.es6.js.map +1 -0
- package/bundles/bundle.es6.min.js +3 -0
- package/bundles/bundle.es6.min.js.map +1 -0
- package/{build → bundles}/bundle.js +198 -202
- package/bundles/bundle.js.map +1 -0
- package/bundles/bundle.min.js +3 -0
- package/bundles/bundle.min.js.map +1 -0
- package/dist/backend.d.ts.map +1 -1
- package/dist/backend.js.map +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/eventbuilder.d.ts.map +1 -1
- package/dist/eventbuilder.js.map +1 -1
- package/dist/exports.d.ts.map +1 -1
- package/dist/exports.js.map +1 -1
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +2 -6
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/breadcrumbs.d.ts.map +1 -1
- package/dist/integrations/breadcrumbs.js.map +1 -1
- package/dist/integrations/dedupe.d.ts.map +1 -1
- package/dist/integrations/dedupe.js +1 -1
- package/dist/integrations/dedupe.js.map +1 -1
- package/dist/integrations/globalhandlers.d.ts.map +1 -1
- package/dist/integrations/globalhandlers.js +1 -3
- package/dist/integrations/globalhandlers.js.map +1 -1
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/linkederrors.d.ts.map +1 -1
- package/dist/integrations/linkederrors.js.map +1 -1
- package/dist/integrations/trycatch.d.ts.map +1 -1
- package/dist/integrations/trycatch.js +26 -21
- package/dist/integrations/trycatch.js.map +1 -1
- package/dist/integrations/useragent.d.ts.map +1 -1
- package/dist/integrations/useragent.js.map +1 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +3 -9
- package/dist/sdk.js.map +1 -1
- package/dist/stack-parsers.d.ts.map +1 -1
- package/dist/stack-parsers.js.map +1 -1
- package/dist/transports/base.d.ts +6 -6
- package/dist/transports/base.d.ts.map +1 -1
- package/dist/transports/base.js +17 -68
- package/dist/transports/base.js.map +1 -1
- package/dist/transports/fetch.d.ts.map +1 -1
- package/dist/transports/fetch.js +2 -0
- package/dist/transports/fetch.js.map +1 -1
- package/dist/transports/index.d.ts.map +1 -1
- package/dist/transports/index.js.map +1 -1
- package/dist/transports/utils.d.ts.map +1 -1
- package/dist/transports/utils.js +1 -2
- package/dist/transports/utils.js.map +1 -1
- package/dist/transports/xhr.d.ts.map +1 -1
- package/dist/transports/xhr.js +2 -0
- package/dist/transports/xhr.js.map +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js.map +1 -1
- package/esm/backend.d.ts.map +1 -1
- package/esm/backend.js.map +1 -1
- package/esm/client.d.ts.map +1 -1
- package/esm/client.js +2 -2
- package/esm/client.js.map +1 -1
- package/esm/eventbuilder.d.ts.map +1 -1
- package/esm/eventbuilder.js.map +1 -1
- package/esm/exports.d.ts.map +1 -1
- package/esm/exports.js.map +1 -1
- package/esm/helpers.d.ts.map +1 -1
- package/esm/helpers.js +2 -6
- package/esm/helpers.js.map +1 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js.map +1 -1
- package/esm/integrations/breadcrumbs.d.ts.map +1 -1
- package/esm/integrations/breadcrumbs.js.map +1 -1
- package/esm/integrations/dedupe.d.ts.map +1 -1
- package/esm/integrations/dedupe.js +2 -2
- package/esm/integrations/dedupe.js.map +1 -1
- package/esm/integrations/globalhandlers.d.ts.map +1 -1
- package/esm/integrations/globalhandlers.js +1 -3
- package/esm/integrations/globalhandlers.js.map +1 -1
- package/esm/integrations/index.d.ts.map +1 -1
- package/esm/integrations/index.js.map +1 -1
- package/esm/integrations/linkederrors.d.ts.map +1 -1
- package/esm/integrations/linkederrors.js.map +1 -1
- package/esm/integrations/trycatch.d.ts.map +1 -1
- package/esm/integrations/trycatch.js +26 -21
- package/esm/integrations/trycatch.js.map +1 -1
- package/esm/integrations/useragent.d.ts.map +1 -1
- package/esm/integrations/useragent.js.map +1 -1
- package/esm/sdk.d.ts.map +1 -1
- package/esm/sdk.js +3 -9
- package/esm/sdk.js.map +1 -1
- package/esm/stack-parsers.d.ts.map +1 -1
- package/esm/stack-parsers.js.map +1 -1
- package/esm/transports/base.d.ts +6 -6
- package/esm/transports/base.d.ts.map +1 -1
- package/esm/transports/base.js +19 -70
- package/esm/transports/base.js.map +1 -1
- package/esm/transports/fetch.d.ts.map +1 -1
- package/esm/transports/fetch.js +2 -0
- package/esm/transports/fetch.js.map +1 -1
- package/esm/transports/index.d.ts.map +1 -1
- package/esm/transports/index.js.map +1 -1
- package/esm/transports/utils.d.ts.map +1 -1
- package/esm/transports/utils.js +1 -2
- package/esm/transports/utils.js.map +1 -1
- package/esm/transports/xhr.d.ts.map +1 -1
- package/esm/transports/xhr.js +2 -0
- package/esm/transports/xhr.js.map +1 -1
- package/esm/version.d.ts.map +1 -1
- package/esm/version.js.map +1 -1
- package/package.json +15 -13
- package/types/backend.d.ts +43 -0
- package/types/backend.d.ts.map +1 -0
- package/types/client.d.ts +33 -0
- package/types/client.d.ts.map +1 -0
- package/types/eventbuilder.d.ts +39 -0
- package/types/eventbuilder.d.ts.map +1 -0
- package/types/exports.d.ts +10 -0
- package/types/exports.d.ts.map +1 -0
- package/types/helpers.d.ts +52 -0
- package/types/helpers.d.ts.map +1 -0
- package/types/index.d.ts +16 -0
- package/types/index.d.ts.map +1 -0
- package/types/integrations/breadcrumbs.d.ts +47 -0
- package/types/integrations/breadcrumbs.d.ts.map +1 -0
- package/types/integrations/dedupe.d.ts +21 -0
- package/types/integrations/dedupe.d.ts.map +1 -0
- package/types/integrations/globalhandlers.d.ts +30 -0
- package/types/integrations/globalhandlers.d.ts.map +1 -0
- package/types/integrations/index.d.ts +7 -0
- package/types/integrations/index.d.ts.map +1 -0
- package/types/integrations/linkederrors.d.ts +42 -0
- package/types/integrations/linkederrors.d.ts.map +1 -0
- package/types/integrations/trycatch.d.ts +33 -0
- package/types/integrations/trycatch.d.ts.map +1 -0
- package/types/integrations/useragent.d.ts +17 -0
- package/types/integrations/useragent.d.ts.map +1 -0
- package/types/sdk.d.ts +112 -0
- package/types/sdk.d.ts.map +1 -0
- package/types/stack-parsers.d.ts +7 -0
- package/types/stack-parsers.d.ts.map +1 -0
- package/types/transports/base.d.ts +65 -0
- package/types/transports/base.d.ts.map +1 -0
- package/types/transports/fetch.d.ts +17 -0
- package/types/transports/fetch.d.ts.map +1 -0
- package/types/transports/index.d.ts +4 -0
- package/types/transports/index.d.ts.map +1 -0
- package/types/transports/utils.d.ts +48 -0
- package/types/transports/utils.d.ts.map +1 -0
- package/types/transports/xhr.d.ts +11 -0
- package/types/transports/xhr.d.ts.map +1 -0
- package/types/version.d.ts +2 -0
- package/types/version.d.ts.map +1 -0
- package/build/bundle.es6.js.map +0 -1
- package/build/bundle.es6.min.js +0 -3
- package/build/bundle.es6.min.js.map +0 -1
- package/build/bundle.js.map +0 -1
- package/build/bundle.min.js +0 -3
- package/build/bundle.min.js.map +0 -1
package/esm/transports/base.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { __read
|
|
1
|
+
import { __read } from "tslib";
|
|
2
2
|
import { eventToSentryRequest, getEnvelopeEndpointWithUrlEncodedAuth, getStoreEndpointWithUrlEncodedAuth, initAPIDetails, sessionToSentryRequest, } from '@sentry/core';
|
|
3
|
-
import { createClientReportEnvelope, dsnToString, eventStatusFromHttpCode, getGlobalObject, isDebugBuild, logger, makePromiseBuffer,
|
|
3
|
+
import { createClientReportEnvelope, disabledUntil, dsnToString, eventStatusFromHttpCode, getGlobalObject, isDebugBuild, isRateLimited, logger, makePromiseBuffer, serializeEnvelope, updateRateLimits, } from '@sentry/utils';
|
|
4
4
|
import { sendReport } from './utils';
|
|
5
5
|
function requestTypeToCategory(ty) {
|
|
6
6
|
var tyStr = ty;
|
|
@@ -60,7 +60,7 @@ var BaseTransport = /** @class */ (function () {
|
|
|
60
60
|
// A correct type for map-based implementation if we want to go that route
|
|
61
61
|
// would be `Partial<Record<SentryRequestType, Partial<Record<Outcome, number>>>>`
|
|
62
62
|
var key = requestTypeToCategory(category) + ":" + reason;
|
|
63
|
-
logger.log("Adding outcome: " + key);
|
|
63
|
+
isDebugBuild() && logger.log("Adding outcome: " + key);
|
|
64
64
|
this._outcomes[key] = (_a = this._outcomes[key], (_a !== null && _a !== void 0 ? _a : 0)) + 1;
|
|
65
65
|
};
|
|
66
66
|
/**
|
|
@@ -74,10 +74,10 @@ var BaseTransport = /** @class */ (function () {
|
|
|
74
74
|
this._outcomes = {};
|
|
75
75
|
// Nothing to send
|
|
76
76
|
if (!Object.keys(outcomes).length) {
|
|
77
|
-
logger.log('No outcomes to flush');
|
|
77
|
+
isDebugBuild() && logger.log('No outcomes to flush');
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
|
-
logger.log("Flushing outcomes:\n" + JSON.stringify(outcomes, null, 2));
|
|
80
|
+
isDebugBuild() && logger.log("Flushing outcomes:\n" + JSON.stringify(outcomes, null, 2));
|
|
81
81
|
var url = getEnvelopeEndpointWithUrlEncodedAuth(this._api.dsn, this._api.tunnel);
|
|
82
82
|
var discardedEvents = Object.keys(outcomes).map(function (key) {
|
|
83
83
|
var _a = __read(key.split(':'), 2), category = _a[0], reason = _a[1];
|
|
@@ -93,7 +93,7 @@ var BaseTransport = /** @class */ (function () {
|
|
|
93
93
|
sendReport(url, serializeEnvelope(envelope));
|
|
94
94
|
}
|
|
95
95
|
catch (e) {
|
|
96
|
-
logger.error(e);
|
|
96
|
+
isDebugBuild() && logger.error(e);
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
/**
|
|
@@ -102,13 +102,12 @@ var BaseTransport = /** @class */ (function () {
|
|
|
102
102
|
BaseTransport.prototype._handleResponse = function (_a) {
|
|
103
103
|
var requestType = _a.requestType, response = _a.response, headers = _a.headers, resolve = _a.resolve, reject = _a.reject;
|
|
104
104
|
var status = eventStatusFromHttpCode(response.status);
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
logger.warn("Too many " + requestType + " requests, backing off until: " + this._disabledUntil(requestType));
|
|
105
|
+
this._rateLimits = updateRateLimits(this._rateLimits, headers);
|
|
106
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
107
|
+
if (this._isRateLimited(requestType) && isDebugBuild()) {
|
|
108
|
+
isDebugBuild() &&
|
|
109
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
110
|
+
logger.warn("Too many " + requestType + " requests, backing off until: " + this._disabledUntil(requestType));
|
|
112
111
|
}
|
|
113
112
|
if (status === 'success') {
|
|
114
113
|
resolve({ status: status });
|
|
@@ -118,71 +117,21 @@ var BaseTransport = /** @class */ (function () {
|
|
|
118
117
|
};
|
|
119
118
|
/**
|
|
120
119
|
* Gets the time that given category is disabled until for rate limiting
|
|
120
|
+
*
|
|
121
|
+
* @deprecated Please use `disabledUntil` from @sentry/utils
|
|
121
122
|
*/
|
|
122
123
|
BaseTransport.prototype._disabledUntil = function (requestType) {
|
|
123
124
|
var category = requestTypeToCategory(requestType);
|
|
124
|
-
return this._rateLimits
|
|
125
|
+
return new Date(disabledUntil(this._rateLimits, category));
|
|
125
126
|
};
|
|
126
127
|
/**
|
|
127
128
|
* Checks if a category is rate limited
|
|
129
|
+
*
|
|
130
|
+
* @deprecated Please use `isRateLimited` from @sentry/utils
|
|
128
131
|
*/
|
|
129
132
|
BaseTransport.prototype._isRateLimited = function (requestType) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Sets internal _rateLimits from incoming headers. Returns true if headers contains a non-empty rate limiting header.
|
|
134
|
-
*/
|
|
135
|
-
BaseTransport.prototype._handleRateLimit = function (headers) {
|
|
136
|
-
var e_1, _a, e_2, _b;
|
|
137
|
-
var now = Date.now();
|
|
138
|
-
var rlHeader = headers['x-sentry-rate-limits'];
|
|
139
|
-
var raHeader = headers['retry-after'];
|
|
140
|
-
if (rlHeader) {
|
|
141
|
-
try {
|
|
142
|
-
// rate limit headers are of the form
|
|
143
|
-
// <header>,<header>,..
|
|
144
|
-
// where each <header> is of the form
|
|
145
|
-
// <retry_after>: <categories>: <scope>: <reason_code>
|
|
146
|
-
// where
|
|
147
|
-
// <retry_after> is a delay in ms
|
|
148
|
-
// <categories> is the event type(s) (error, transaction, etc) being rate limited and is of the form
|
|
149
|
-
// <category>;<category>;...
|
|
150
|
-
// <scope> is what's being limited (org, project, or key) - ignored by SDK
|
|
151
|
-
// <reason_code> is an arbitrary string like "org_quota" - ignored by SDK
|
|
152
|
-
for (var _c = __values(rlHeader.trim().split(',')), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
153
|
-
var limit = _d.value;
|
|
154
|
-
var parameters = limit.split(':', 2);
|
|
155
|
-
var headerDelay = parseInt(parameters[0], 10);
|
|
156
|
-
var delay = (!isNaN(headerDelay) ? headerDelay : 60) * 1000; // 60sec default
|
|
157
|
-
try {
|
|
158
|
-
for (var _e = (e_2 = void 0, __values(parameters[1].split(';'))), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
159
|
-
var category = _f.value;
|
|
160
|
-
this._rateLimits[category || 'all'] = new Date(now + delay);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
164
|
-
finally {
|
|
165
|
-
try {
|
|
166
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
167
|
-
}
|
|
168
|
-
finally { if (e_2) throw e_2.error; }
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
173
|
-
finally {
|
|
174
|
-
try {
|
|
175
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
176
|
-
}
|
|
177
|
-
finally { if (e_1) throw e_1.error; }
|
|
178
|
-
}
|
|
179
|
-
return true;
|
|
180
|
-
}
|
|
181
|
-
else if (raHeader) {
|
|
182
|
-
this._rateLimits.all = new Date(now + parseRetryAfterHeader(raHeader, now));
|
|
183
|
-
return true;
|
|
184
|
-
}
|
|
185
|
-
return false;
|
|
133
|
+
var category = requestTypeToCategory(requestType);
|
|
134
|
+
return isRateLimited(this._rateLimits, category);
|
|
186
135
|
};
|
|
187
136
|
return BaseTransport;
|
|
188
137
|
}());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/transports/base.ts"],"names":[],"mappings":";AAAA,OAAO,EAEL,oBAAoB,EACpB,qCAAqC,EACrC,kCAAkC,EAClC,cAAc,EACd,sBAAsB,GACvB,MAAM,cAAc,CAAC;AAYtB,OAAO,EACL,0BAA0B,EAC1B,WAAW,EACX,uBAAuB,EACvB,eAAe,EACf,YAAY,EACZ,MAAM,EACN,iBAAiB,EACjB,qBAAqB,EAErB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,SAAS,qBAAqB,CAAC,EAAqB;IAClD,IAAM,KAAK,GAAG,EAAY,CAAC;IAC3B,OAAO,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AAC7C,CAAC;AAED,IAAM,MAAM,GAAG,eAAe,EAAU,CAAC;AAEzC,0CAA0C;AAC1C;IAiBE,uBAA0B,OAAyB;QAAnD,iBAYC;QAZyB,YAAO,GAAP,OAAO,CAAkB;QARnD,4CAA4C;QACzB,YAAO,GAAkC,iBAAiB,CAAC,EAAE,CAAC,CAAC;QAElF,gEAAgE;QAC7C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EAAE,GAAG,CAAC,CAAC,CAAC;YAC5E,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAMH,oBAAC;AAAD,CAAC,AApMD,IAoMC","sourcesContent":["import {\n APIDetails,\n eventToSentryRequest,\n getEnvelopeEndpointWithUrlEncodedAuth,\n getStoreEndpointWithUrlEncodedAuth,\n initAPIDetails,\n sessionToSentryRequest,\n} from '@sentry/core';\nimport {\n ClientReport,\n Event,\n Outcome,\n Response as SentryResponse,\n SentryRequest,\n SentryRequestType,\n Session,\n Transport,\n TransportOptions,\n} from '@sentry/types';\nimport {\n createClientReportEnvelope,\n dsnToString,\n eventStatusFromHttpCode,\n getGlobalObject,\n isDebugBuild,\n logger,\n makePromiseBuffer,\n parseRetryAfterHeader,\n PromiseBuffer,\n serializeEnvelope,\n} from '@sentry/utils';\n\nimport { sendReport } from './utils';\n\nfunction requestTypeToCategory(ty: SentryRequestType): string {\n const tyStr = ty as string;\n return tyStr === 'event' ? 'error' : tyStr;\n}\n\nconst global = getGlobalObject<Window>();\n\n/** Base Transport class implementation */\nexport abstract class BaseTransport implements Transport {\n /**\n * @deprecated\n */\n public url: string;\n\n /** Helper to get Sentry API endpoints. */\n protected readonly _api: APIDetails;\n\n /** A simple buffer holding all requests. */\n protected readonly _buffer: PromiseBuffer<SentryResponse> = makePromiseBuffer(30);\n\n /** Locks transport after receiving rate limits in a response */\n protected readonly _rateLimits: Record<string, Date> = {};\n\n protected _outcomes: { [key: string]: number } = {};\n\n public constructor(public options: TransportOptions) {\n this._api = initAPIDetails(options.dsn, options._metadata, options.tunnel);\n // eslint-disable-next-line deprecation/deprecation\n this.url = getStoreEndpointWithUrlEncodedAuth(this._api.dsn);\n\n if (this.options.sendClientReports && global.document) {\n global.document.addEventListener('visibilitychange', () => {\n if (global.document.visibilityState === 'hidden') {\n this._flushOutcomes();\n }\n });\n }\n }\n\n /**\n * @inheritDoc\n */\n public sendEvent(event: Event): PromiseLike<SentryResponse> {\n return this._sendRequest(eventToSentryRequest(event, this._api), event);\n }\n\n /**\n * @inheritDoc\n */\n public sendSession(session: Session): PromiseLike<SentryResponse> {\n return this._sendRequest(sessionToSentryRequest(session, this._api), session);\n }\n\n /**\n * @inheritDoc\n */\n public close(timeout?: number): PromiseLike<boolean> {\n return this._buffer.drain(timeout);\n }\n\n /**\n * @inheritDoc\n */\n public recordLostEvent(reason: Outcome, category: SentryRequestType): void {\n if (!this.options.sendClientReports) {\n return;\n }\n // We want to track each category (event, transaction, session) separately\n // but still keep the distinction between different type of outcomes.\n // We could use nested maps, but it's much easier to read and type this way.\n // A correct type for map-based implementation if we want to go that route\n // would be `Partial<Record<SentryRequestType, Partial<Record<Outcome, number>>>>`\n const key = `${requestTypeToCategory(category)}:${reason}`;\n logger.log(`Adding outcome: ${key}`);\n this._outcomes[key] = (this._outcomes[key] ?? 0) + 1;\n }\n\n /**\n * Send outcomes as an envelope\n */\n protected _flushOutcomes(): void {\n if (!this.options.sendClientReports) {\n return;\n }\n\n const outcomes = this._outcomes;\n this._outcomes = {};\n\n // Nothing to send\n if (!Object.keys(outcomes).length) {\n logger.log('No outcomes to flush');\n return;\n }\n\n logger.log(`Flushing outcomes:\\n${JSON.stringify(outcomes, null, 2)}`);\n\n const url = getEnvelopeEndpointWithUrlEncodedAuth(this._api.dsn, this._api.tunnel);\n\n const discardedEvents = Object.keys(outcomes).map(key => {\n const [category, reason] = key.split(':');\n return {\n reason,\n category,\n quantity: outcomes[key],\n };\n // TODO: Improve types on discarded_events to get rid of cast\n }) as ClientReport['discarded_events'];\n const envelope = createClientReportEnvelope(discardedEvents, this._api.tunnel && dsnToString(this._api.dsn));\n\n try {\n sendReport(url, serializeEnvelope(envelope));\n } catch (e) {\n logger.error(e);\n }\n }\n\n /**\n * Handle Sentry repsonse for promise-based transports.\n */\n protected _handleResponse({\n requestType,\n response,\n headers,\n resolve,\n reject,\n }: {\n requestType: SentryRequestType;\n response: Response | XMLHttpRequest;\n headers: Record<string, string | null>;\n resolve: (value?: SentryResponse | PromiseLike<SentryResponse> | null | undefined) => void;\n reject: (reason?: unknown) => void;\n }): void {\n const status = eventStatusFromHttpCode(response.status);\n /**\n * \"The name is case-insensitive.\"\n * https://developer.mozilla.org/en-US/docs/Web/API/Headers/get\n */\n const limited = this._handleRateLimit(headers);\n if (limited && isDebugBuild()) {\n logger.warn(`Too many ${requestType} requests, backing off until: ${this._disabledUntil(requestType)}`);\n }\n\n if (status === 'success') {\n resolve({ status });\n return;\n }\n\n reject(response);\n }\n\n /**\n * Gets the time that given category is disabled until for rate limiting\n */\n protected _disabledUntil(requestType: SentryRequestType): Date {\n const category = requestTypeToCategory(requestType);\n return this._rateLimits[category] || this._rateLimits.all;\n }\n\n /**\n * Checks if a category is rate limited\n */\n protected _isRateLimited(requestType: SentryRequestType): boolean {\n return this._disabledUntil(requestType) > new Date(Date.now());\n }\n\n /**\n * Sets internal _rateLimits from incoming headers. Returns true if headers contains a non-empty rate limiting header.\n */\n protected _handleRateLimit(headers: Record<string, string | null>): boolean {\n const now = Date.now();\n const rlHeader = headers['x-sentry-rate-limits'];\n const raHeader = headers['retry-after'];\n\n if (rlHeader) {\n // rate limit headers are of the form\n // <header>,<header>,..\n // where each <header> is of the form\n // <retry_after>: <categories>: <scope>: <reason_code>\n // where\n // <retry_after> is a delay in ms\n // <categories> is the event type(s) (error, transaction, etc) being rate limited and is of the form\n // <category>;<category>;...\n // <scope> is what's being limited (org, project, or key) - ignored by SDK\n // <reason_code> is an arbitrary string like \"org_quota\" - ignored by SDK\n for (const limit of rlHeader.trim().split(',')) {\n const parameters = limit.split(':', 2);\n const headerDelay = parseInt(parameters[0], 10);\n const delay = (!isNaN(headerDelay) ? headerDelay : 60) * 1000; // 60sec default\n for (const category of parameters[1].split(';')) {\n this._rateLimits[category || 'all'] = new Date(now + delay);\n }\n }\n return true;\n } else if (raHeader) {\n this._rateLimits.all = new Date(now + parseRetryAfterHeader(raHeader, now));\n return true;\n }\n return false;\n }\n\n protected abstract _sendRequest(\n sentryRequest: SentryRequest,\n originalPayload: Event | Session,\n ): PromiseLike<SentryResponse>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/transports/base.ts"],"names":[],"mappings":";AAAA,OAAO,EAEL,oBAAoB,EACpB,qCAAqC,EACrC,kCAAkC,EAClC,cAAc,EACd,sBAAsB,GACvB,MAAM,cAAc,CAAC;AAYtB,OAAO,EACL,0BAA0B,EAC1B,aAAa,EACb,WAAW,EACX,uBAAuB,EACvB,eAAe,EACf,YAAY,EACZ,aAAa,EACb,MAAM,EACN,iBAAiB,EAGjB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,SAAS,qBAAqB,CAAC,EAAqB;IAClD,IAAM,KAAK,GAAG,EAAY,CAAC;IAC3B,OAAO,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AAC7C,CAAC;AAED,IAAM,MAAM,GAAG,eAAe,EAAU,CAAC;AAEzC,0CAA0C;AAC1C;IAiBE,uBAA0B,OAAyB;QAAnD,iBAYC;QAZyB,YAAO,GAAP,OAAO,CAAkB;QARnD,4CAA4C;QACzB,YAAO,GAAkC,iBAAiB,CAAC,EAAE,CAAC,CAAC;QAElF,gEAAgE;QACtD,gBAAW,GAAe,EAAE,CAAC;QAE7B,cAAS,GAA8B,EAAE,CAAC;QAGlD,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAC3E,mDAAmD;QACnD,IAAI,CAAC,GAAG,GAAG,kCAAkC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE7D,IAAI,IAAI,CAAC,OAAO,CAAC,iBAAiB,IAAI,MAAM,CAAC,QAAQ,EAAE;YACrD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4BAAW,EACX,sBAAQ,EACR,oBAAO,EACP,oBAAO,EACP,kBAAM;QAQN,IAAM,MAAM,GAAG,uBAAuB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAExD,IAAI,CAAC,WAAW,GAAG,gBAAgB,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAC/D,mDAAmD;QACnD,IAAI,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,YAAY,EAAE,EAAE;YACtD,YAAY,EAAE;gBACZ,mDAAmD;gBACnD,MAAM,CAAC,IAAI,CAAC,cAAY,WAAW,sCAAiC,IAAI,CAAC,cAAc,CAAC,WAAW,CAAG,CAAC,CAAC;SAC3G;QAED,IAAI,MAAM,KAAK,SAAS,EAAE;YACxB,OAAO,CAAC,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC;YACpB,OAAO;SACR;QAED,MAAM,CAAC,QAAQ,CAAC,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACO,sCAAc,GAAxB,UAAyB,WAA8B;QACrD,IAAM,QAAQ,GAAG,qBAAqB,CAAC,WAAW,CAAC,CAAC;QACpD,OAAO,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED;;;;OAIG;IACO,sCAAc,GAAxB,UAAyB,WAA8B;QACrD,IAAM,QAAQ,GAAG,qBAAqB,CAAC,WAAW,CAAC,CAAC;QACpD,OAAO,aAAa,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IACnD,CAAC;IAMH,oBAAC;AAAD,CAAC,AAtKD,IAsKC","sourcesContent":["import {\n APIDetails,\n eventToSentryRequest,\n getEnvelopeEndpointWithUrlEncodedAuth,\n getStoreEndpointWithUrlEncodedAuth,\n initAPIDetails,\n sessionToSentryRequest,\n} from '@sentry/core';\nimport {\n ClientReport,\n Event,\n Outcome,\n Response as SentryResponse,\n SentryRequest,\n SentryRequestType,\n Session,\n Transport,\n TransportOptions,\n} from '@sentry/types';\nimport {\n createClientReportEnvelope,\n disabledUntil,\n dsnToString,\n eventStatusFromHttpCode,\n getGlobalObject,\n isDebugBuild,\n isRateLimited,\n logger,\n makePromiseBuffer,\n PromiseBuffer,\n RateLimits,\n serializeEnvelope,\n updateRateLimits,\n} from '@sentry/utils';\n\nimport { sendReport } from './utils';\n\nfunction requestTypeToCategory(ty: SentryRequestType): string {\n const tyStr = ty as string;\n return tyStr === 'event' ? 'error' : tyStr;\n}\n\nconst global = getGlobalObject<Window>();\n\n/** Base Transport class implementation */\nexport abstract class BaseTransport implements Transport {\n /**\n * @deprecated\n */\n public url: string;\n\n /** Helper to get Sentry API endpoints. */\n protected readonly _api: APIDetails;\n\n /** A simple buffer holding all requests. */\n protected readonly _buffer: PromiseBuffer<SentryResponse> = makePromiseBuffer(30);\n\n /** Locks transport after receiving rate limits in a response */\n protected _rateLimits: RateLimits = {};\n\n protected _outcomes: { [key: string]: number } = {};\n\n public constructor(public options: TransportOptions) {\n this._api = initAPIDetails(options.dsn, options._metadata, options.tunnel);\n // eslint-disable-next-line deprecation/deprecation\n this.url = getStoreEndpointWithUrlEncodedAuth(this._api.dsn);\n\n if (this.options.sendClientReports && global.document) {\n global.document.addEventListener('visibilitychange', () => {\n if (global.document.visibilityState === 'hidden') {\n this._flushOutcomes();\n }\n });\n }\n }\n\n /**\n * @inheritDoc\n */\n public sendEvent(event: Event): PromiseLike<SentryResponse> {\n return this._sendRequest(eventToSentryRequest(event, this._api), event);\n }\n\n /**\n * @inheritDoc\n */\n public sendSession(session: Session): PromiseLike<SentryResponse> {\n return this._sendRequest(sessionToSentryRequest(session, this._api), session);\n }\n\n /**\n * @inheritDoc\n */\n public close(timeout?: number): PromiseLike<boolean> {\n return this._buffer.drain(timeout);\n }\n\n /**\n * @inheritDoc\n */\n public recordLostEvent(reason: Outcome, category: SentryRequestType): void {\n if (!this.options.sendClientReports) {\n return;\n }\n // We want to track each category (event, transaction, session) separately\n // but still keep the distinction between different type of outcomes.\n // We could use nested maps, but it's much easier to read and type this way.\n // A correct type for map-based implementation if we want to go that route\n // would be `Partial<Record<SentryRequestType, Partial<Record<Outcome, number>>>>`\n const key = `${requestTypeToCategory(category)}:${reason}`;\n isDebugBuild() && logger.log(`Adding outcome: ${key}`);\n this._outcomes[key] = (this._outcomes[key] ?? 0) + 1;\n }\n\n /**\n * Send outcomes as an envelope\n */\n protected _flushOutcomes(): void {\n if (!this.options.sendClientReports) {\n return;\n }\n\n const outcomes = this._outcomes;\n this._outcomes = {};\n\n // Nothing to send\n if (!Object.keys(outcomes).length) {\n isDebugBuild() && logger.log('No outcomes to flush');\n return;\n }\n\n isDebugBuild() && logger.log(`Flushing outcomes:\\n${JSON.stringify(outcomes, null, 2)}`);\n\n const url = getEnvelopeEndpointWithUrlEncodedAuth(this._api.dsn, this._api.tunnel);\n\n const discardedEvents = Object.keys(outcomes).map(key => {\n const [category, reason] = key.split(':');\n return {\n reason,\n category,\n quantity: outcomes[key],\n };\n // TODO: Improve types on discarded_events to get rid of cast\n }) as ClientReport['discarded_events'];\n const envelope = createClientReportEnvelope(discardedEvents, this._api.tunnel && dsnToString(this._api.dsn));\n\n try {\n sendReport(url, serializeEnvelope(envelope));\n } catch (e) {\n isDebugBuild() && logger.error(e);\n }\n }\n\n /**\n * Handle Sentry repsonse for promise-based transports.\n */\n protected _handleResponse({\n requestType,\n response,\n headers,\n resolve,\n reject,\n }: {\n requestType: SentryRequestType;\n response: Response | XMLHttpRequest;\n headers: Record<string, string | null>;\n resolve: (value?: SentryResponse | PromiseLike<SentryResponse> | null | undefined) => void;\n reject: (reason?: unknown) => void;\n }): void {\n const status = eventStatusFromHttpCode(response.status);\n\n this._rateLimits = updateRateLimits(this._rateLimits, headers);\n // eslint-disable-next-line deprecation/deprecation\n if (this._isRateLimited(requestType) && isDebugBuild()) {\n isDebugBuild() &&\n // eslint-disable-next-line deprecation/deprecation\n logger.warn(`Too many ${requestType} requests, backing off until: ${this._disabledUntil(requestType)}`);\n }\n\n if (status === 'success') {\n resolve({ status });\n return;\n }\n\n reject(response);\n }\n\n /**\n * Gets the time that given category is disabled until for rate limiting\n *\n * @deprecated Please use `disabledUntil` from @sentry/utils\n */\n protected _disabledUntil(requestType: SentryRequestType): Date {\n const category = requestTypeToCategory(requestType);\n return new Date(disabledUntil(this._rateLimits, category));\n }\n\n /**\n * Checks if a category is rate limited\n *\n * @deprecated Please use `isRateLimited` from @sentry/utils\n */\n protected _isRateLimited(requestType: SentryRequestType): boolean {\n const category = requestTypeToCategory(requestType);\n return isRateLimited(this._rateLimits, category);\n }\n\n protected abstract _sendRequest(\n sentryRequest: SentryRequest,\n originalPayload: Event | Session,\n ): PromiseLike<SentryResponse>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/transports/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAG1F,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,SAAS,EAAgC,MAAM,SAAS,CAAC;AAElE,8BAA8B;AAC9B,qBAAa,cAAe,SAAQ,aAAa;IAC/C;;OAEG;IACH,OAAO,CAAC,MAAM,CAAe;gBAEV,OAAO,EAAE,gBAAgB,EAAE,SAAS,GAAE,SAA0C;IAKnG;;;OAGG;IACH,SAAS,CAAC,YAAY,CAAC,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,KAAK,GAAG,OAAO,GAAG,WAAW,CAAC,QAAQ,CAAC;CA+D9G"}
|
package/esm/transports/fetch.js
CHANGED
|
@@ -17,11 +17,13 @@ var FetchTransport = /** @class */ (function (_super) {
|
|
|
17
17
|
*/
|
|
18
18
|
FetchTransport.prototype._sendRequest = function (sentryRequest, originalPayload) {
|
|
19
19
|
var _this = this;
|
|
20
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
20
21
|
if (this._isRateLimited(sentryRequest.type)) {
|
|
21
22
|
this.recordLostEvent('ratelimit_backoff', sentryRequest.type);
|
|
22
23
|
return Promise.reject({
|
|
23
24
|
event: originalPayload,
|
|
24
25
|
type: sentryRequest.type,
|
|
26
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
25
27
|
reason: "Transport for " + sentryRequest.type + " requests locked till " + this._disabledUntil(sentryRequest.type) + " due to too many requests.",
|
|
26
28
|
status: 429,
|
|
27
29
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../src/transports/fetch.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjF,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAa,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAElE,8BAA8B;AAC9B;IAAoC,kCAAa;IAM/C,wBAAmB,OAAyB,EAAE,SAAqD;QAArD,0BAAA,EAAA,YAAuB,4BAA4B,EAAE;QAAnG,YACE,kBAAM,OAAO,CAAC,SAEf;QADC,KAAI,CAAC,MAAM,GAAG,SAAS,CAAC;;IAC1B,CAAC;IAED;;;OAGG;IACO,qCAAY,GAAtB,UAAuB,aAA4B,EAAE,eAAgC;QAArF,iBA8DC;QA7DC,mDAAmD;QACnD,IAAI,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE;YAC3C,IAAI,CAAC,eAAe,CAAC,mBAAmB,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;YAE9D,OAAO,OAAO,CAAC,MAAM,CAAC;gBACpB,KAAK,EAAE,eAAe;gBACtB,IAAI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OAAO,SAAA;wBACP,MAAM,QAAA;qBACP,CAAC,CAAC;gBACL,CAAC,CAAC;qBACD,KAAK,CAAC,MAAM,CAAC,CAAC;YACnB,CAAC,CAAC;QAhBF,CAgBE,CACL;aACA,IAAI,CAAC,SAAS,EAAE,UAAA,MAAM;YACrB,gGAAgG;YAChG,IAAI,MAAM,YAAY,WAAW,EAAE;gBACjC,KAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;aAC5D;iBAAM;gBACL,KAAI,CAAC,eAAe,CAAC,eAAe,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;aAC3D;YACD,MAAM,MAAM,CAAC;QACf,CAAC,CAAC,CAAC;IACP,CAAC;IACH,qBAAC;AAAD,CAAC,AA9ED,CAAoC,aAAa,GA8EhD","sourcesContent":["import { Event, Response, SentryRequest, Session, TransportOptions } from '@sentry/types';\nimport { SentryError, supportsReferrerPolicy, SyncPromise } from '@sentry/utils';\n\nimport { BaseTransport } from './base';\nimport { FetchImpl, getNativeFetchImplementation } from './utils';\n\n/** `fetch` based transport */\nexport class FetchTransport extends BaseTransport {\n /**\n * Fetch API reference which always points to native browser implementation.\n */\n private _fetch: typeof fetch;\n\n public constructor(options: TransportOptions, fetchImpl: FetchImpl = getNativeFetchImplementation()) {\n super(options);\n this._fetch = fetchImpl;\n }\n\n /**\n * @param sentryRequest Prepared SentryRequest to be delivered\n * @param originalPayload Original payload used to create SentryRequest\n */\n protected _sendRequest(sentryRequest: SentryRequest, originalPayload: Event | Session): PromiseLike<Response> {\n // eslint-disable-next-line deprecation/deprecation\n if (this._isRateLimited(sentryRequest.type)) {\n this.recordLostEvent('ratelimit_backoff', sentryRequest.type);\n\n return Promise.reject({\n event: originalPayload,\n type: sentryRequest.type,\n // eslint-disable-next-line deprecation/deprecation\n reason: `Transport for ${sentryRequest.type} requests locked till ${this._disabledUntil(\n sentryRequest.type,\n )} due to too many requests.`,\n status: 429,\n });\n }\n\n const options: RequestInit = {\n body: sentryRequest.body,\n method: 'POST',\n // Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default'\n // (see https://caniuse.com/#feat=referrer-policy),\n // it doesn't. And it throws an exception instead of ignoring this parameter...\n // REF: https://github.com/getsentry/raven-js/issues/1233\n referrerPolicy: (supportsReferrerPolicy() ? 'origin' : '') as ReferrerPolicy,\n };\n if (this.options.fetchParameters !== undefined) {\n Object.assign(options, this.options.fetchParameters);\n }\n if (this.options.headers !== undefined) {\n options.headers = this.options.headers;\n }\n\n return this._buffer\n .add(\n () =>\n new SyncPromise<Response>((resolve, reject) => {\n void this._fetch(sentryRequest.url, options)\n .then(response => {\n const headers = {\n 'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),\n 'retry-after': response.headers.get('Retry-After'),\n };\n this._handleResponse({\n requestType: sentryRequest.type,\n response,\n headers,\n resolve,\n reject,\n });\n })\n .catch(reject);\n }),\n )\n .then(undefined, reason => {\n // It's either buffer rejection or any other xhr/fetch error, which are treated as NetworkError.\n if (reason instanceof SentryError) {\n this.recordLostEvent('queue_overflow', sentryRequest.type);\n } else {\n this.recordLostEvent('network_error', sentryRequest.type);\n }\n throw reason;\n });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC","sourcesContent":["export { BaseTransport } from './base';\nexport { FetchTransport } from './fetch';\nexport { XHRTransport } from './xhr';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/transports/utils.ts"],"names":[],"mappings":"AAKA,oBAAY,SAAS,GAAG,OAAO,KAAK,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,4BAA4B,IAAI,SAAS,CAiCxD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAqB1D"}
|
package/esm/transports/utils.js
CHANGED
|
@@ -63,9 +63,8 @@ export function getNativeFetchImplementation() {
|
|
|
63
63
|
document.head.removeChild(sandbox);
|
|
64
64
|
}
|
|
65
65
|
catch (e) {
|
|
66
|
-
|
|
66
|
+
isDebugBuild() &&
|
|
67
67
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', e);
|
|
68
|
-
}
|
|
69
68
|
}
|
|
70
69
|
}
|
|
71
70
|
return (cachedFetchImpl = fetchImpl.bind(global));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/transports/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE5G,IAAM,MAAM,GAAG,eAAe,EAAU,CAAC;AACzC,IAAI,eAA0B,CAA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AAQ,CAAC,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,oBAAoB,CAAC;IAC5G,IAAM,aAAa,GAAG,eAAe,IAAI,OAAO,MAAM,CAAC,SAAS,CAAC,UAAU,KAAK,UAAU,CAAC;IAE3F,IAAI,aAAa,EAAE;QACjB,wHAAwH;QACxH,IAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACtE,OAAO,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;KAC9B;IAED,IAAI,aAAa,EAAE,EAAE;QACnB,IAAM,OAAK,GAAG,4BAA4B,EAAE,CAAC;QAC7C,OAAO,MAAM,CACX,OAAK,CAAC,GAAG,EAAE;YACT,IAAI,MAAA;YACJ,MAAM,EAAE,MAAM;YACd,WAAW,EAAE,MAAM;YACnB,SAAS,EAAE,IAAI;SAChB,CAAC,CACH,CAAC;KACH;AACH,CAAC","sourcesContent":["import { forget, getGlobalObject, isDebugBuild, isNativeFetch, logger, supportsFetch } from '@sentry/utils';\n\nconst global = getGlobalObject<Window>();\nlet cachedFetchImpl: FetchImpl;\n\nexport type FetchImpl = typeof fetch;\n\n/**\n * A special usecase for incorrectly wrapped Fetch APIs in conjunction with ad-blockers.\n * Whenever someone wraps the Fetch API and returns the wrong promise chain,\n * this chain becomes orphaned and there is no possible way to capture it's rejections\n * other than allowing it bubble up to this very handler. eg.\n *\n * const f = window.fetch;\n * window.fetch = function () {\n * const p = f.apply(this, arguments);\n *\n * p.then(function() {\n * console.log('hi.');\n * });\n *\n * return p;\n * }\n *\n * `p.then(function () { ... })` is producing a completely separate promise chain,\n * however, what's returned is `p` - the result of original `fetch` call.\n *\n * This mean, that whenever we use the Fetch API to send our own requests, _and_\n * some ad-blocker blocks it, this orphaned chain will _always_ reject,\n * effectively causing another event to be captured.\n * This makes a whole process become an infinite loop, which we need to somehow\n * deal with, and break it in one way or another.\n *\n * To deal with this issue, we are making sure that we _always_ use the real\n * browser Fetch API, instead of relying on what `window.fetch` exposes.\n * The only downside to this would be missing our own requests as breadcrumbs,\n * but because we are already not doing this, it should be just fine.\n *\n * Possible failed fetch error messages per-browser:\n *\n * Chrome: Failed to fetch\n * Edge: Failed to Fetch\n * Firefox: NetworkError when attempting to fetch resource\n * Safari: resource blocked by content blocker\n */\nexport function getNativeFetchImplementation(): FetchImpl {\n if (cachedFetchImpl) {\n return cachedFetchImpl;\n }\n\n /* eslint-disable @typescript-eslint/unbound-method */\n\n // Fast path to avoid DOM I/O\n if (isNativeFetch(global.fetch)) {\n return (cachedFetchImpl = global.fetch.bind(global));\n }\n\n const document = global.document;\n let fetchImpl = global.fetch;\n // eslint-disable-next-line deprecation/deprecation\n if (document && typeof document.createElement === 'function') {\n try {\n const sandbox = document.createElement('iframe');\n sandbox.hidden = true;\n document.head.appendChild(sandbox);\n const contentWindow = sandbox.contentWindow;\n if (contentWindow && contentWindow.fetch) {\n fetchImpl = contentWindow.fetch;\n }\n document.head.removeChild(sandbox);\n } catch (e) {\n isDebugBuild() &&\n logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', e);\n }\n }\n\n return (cachedFetchImpl = fetchImpl.bind(global));\n /* eslint-enable @typescript-eslint/unbound-method */\n}\n\n/**\n * Sends sdk client report using sendBeacon or fetch as a fallback if available\n *\n * @param url report endpoint\n * @param body report payload\n */\nexport function sendReport(url: string, body: string): void {\n const isRealNavigator = Object.prototype.toString.call(global && global.navigator) === '[object Navigator]';\n const hasSendBeacon = isRealNavigator && typeof global.navigator.sendBeacon === 'function';\n\n if (hasSendBeacon) {\n // Prevent illegal invocations - https://xgwang.me/posts/you-may-not-know-beacon/#it-may-throw-error%2C-be-sure-to-catch\n const sendBeacon = global.navigator.sendBeacon.bind(global.navigator);\n return sendBeacon(url, body);\n }\n\n if (supportsFetch()) {\n const fetch = getNativeFetchImplementation();\n return forget(\n fetch(url, {\n body,\n method: 'POST',\n credentials: 'omit',\n keepalive: true,\n }),\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xhr.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"xhr.d.ts","sourceRoot":"","sources":["../../../src/transports/xhr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxE,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,4BAA4B;AAC5B,qBAAa,YAAa,SAAQ,aAAa;IAC7C;;;OAGG;IACH,SAAS,CAAC,YAAY,CAAC,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,KAAK,GAAG,OAAO,GAAG,WAAW,CAAC,QAAQ,CAAC;CAmD9G"}
|
package/esm/transports/xhr.js
CHANGED
|
@@ -13,11 +13,13 @@ var XHRTransport = /** @class */ (function (_super) {
|
|
|
13
13
|
*/
|
|
14
14
|
XHRTransport.prototype._sendRequest = function (sentryRequest, originalPayload) {
|
|
15
15
|
var _this = this;
|
|
16
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
16
17
|
if (this._isRateLimited(sentryRequest.type)) {
|
|
17
18
|
this.recordLostEvent('ratelimit_backoff', sentryRequest.type);
|
|
18
19
|
return Promise.reject({
|
|
19
20
|
event: originalPayload,
|
|
20
21
|
type: sentryRequest.type,
|
|
22
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
21
23
|
reason: "Transport for " + sentryRequest.type + " requests locked till " + this._disabledUntil(sentryRequest.type) + " due to too many requests.",
|
|
22
24
|
status: 429,
|
|
23
25
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xhr.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"xhr.js","sourceRoot":"","sources":["../../../src/transports/xhr.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM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,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC;gBACxC,KAAK,IAAM,MAAM,IAAI,KAAI,CAAC,OAAO,CAAC,OAAO,EAAE;oBACzC,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAI,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE;wBACtE,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;qBAChE;iBACF;gBACD,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YACnC,CAAC,CAAC;QApBF,CAoBE,CACL;aACA,IAAI,CAAC,SAAS,EAAE,UAAA,MAAM;YACrB,gGAAgG;YAChG,IAAI,MAAM,YAAY,WAAW,EAAE;gBACjC,KAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;aAC5D;iBAAM;gBACL,KAAI,CAAC,eAAe,CAAC,eAAe,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;aAC3D;YACD,MAAM,MAAM,CAAC;QACf,CAAC,CAAC,CAAC;IACP,CAAC;IACH,mBAAC;AAAD,CAAC,AAxDD,CAAkC,aAAa,GAwD9C","sourcesContent":["import { Event, Response, SentryRequest, Session } from '@sentry/types';\nimport { SentryError, SyncPromise } from '@sentry/utils';\n\nimport { BaseTransport } from './base';\n\n/** `XHR` based transport */\nexport class XHRTransport extends BaseTransport {\n /**\n * @param sentryRequest Prepared SentryRequest to be delivered\n * @param originalPayload Original payload used to create SentryRequest\n */\n protected _sendRequest(sentryRequest: SentryRequest, originalPayload: Event | Session): PromiseLike<Response> {\n // eslint-disable-next-line deprecation/deprecation\n if (this._isRateLimited(sentryRequest.type)) {\n this.recordLostEvent('ratelimit_backoff', sentryRequest.type);\n\n return Promise.reject({\n event: originalPayload,\n type: sentryRequest.type,\n // eslint-disable-next-line deprecation/deprecation\n reason: `Transport for ${sentryRequest.type} requests locked till ${this._disabledUntil(\n sentryRequest.type,\n )} due to too many requests.`,\n status: 429,\n });\n }\n\n return this._buffer\n .add(\n () =>\n new SyncPromise<Response>((resolve, reject) => {\n const request = new XMLHttpRequest();\n\n request.onreadystatechange = (): void => {\n if (request.readyState === 4) {\n const headers = {\n 'x-sentry-rate-limits': request.getResponseHeader('X-Sentry-Rate-Limits'),\n 'retry-after': request.getResponseHeader('Retry-After'),\n };\n this._handleResponse({ requestType: sentryRequest.type, response: request, headers, resolve, reject });\n }\n };\n\n request.open('POST', sentryRequest.url);\n for (const header in this.options.headers) {\n if (Object.prototype.hasOwnProperty.call(this.options.headers, header)) {\n request.setRequestHeader(header, this.options.headers[header]);\n }\n }\n request.send(sentryRequest.body);\n }),\n )\n .then(undefined, reason => {\n // It's either buffer rejection or any other xhr/fetch error, which are treated as NetworkError.\n if (reason instanceof SentryError) {\n this.recordLostEvent('queue_overflow', sentryRequest.type);\n } else {\n this.recordLostEvent('network_error', sentryRequest.type);\n }\n throw reason;\n });\n }\n}\n"]}
|
package/esm/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,QAAQ,8BAA8B,CAAC"}
|
package/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,MAAM,CAAC,IAAM,QAAQ,GAAG,2BAA2B,CAAC","sourcesContent":["// TODO: Remove in the next major release and rely only on @sentry/core SDK_VERSION and SdkInfo metadata\nexport const SDK_NAME = 'sentry.javascript.browser';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/browser",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.19.0",
|
|
4
4
|
"description": "Official Sentry SDK for browsers",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/browser",
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
},
|
|
12
12
|
"main": "dist/index.js",
|
|
13
13
|
"module": "esm/index.js",
|
|
14
|
-
"types": "
|
|
14
|
+
"types": "types/index.d.ts",
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@sentry/core": "6.
|
|
20
|
-
"@sentry/types": "6.
|
|
21
|
-
"@sentry/utils": "6.
|
|
19
|
+
"@sentry/core": "6.19.0",
|
|
20
|
+
"@sentry/types": "6.19.0",
|
|
21
|
+
"@sentry/utils": "6.19.0",
|
|
22
22
|
"tslib": "^1.9.3"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
@@ -44,20 +44,22 @@
|
|
|
44
44
|
"webpack": "^4.30.0"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
|
-
"build": "run-p build:cjs build:esm build:bundle",
|
|
47
|
+
"build": "run-p build:cjs build:esm build:bundle build:types && bash ../../scripts/postbuild.sh",
|
|
48
48
|
"build:bundle": "rollup --config",
|
|
49
49
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
50
|
-
"build:dev": "run-p build:cjs build:esm",
|
|
50
|
+
"build:dev": "run-p build:cjs build:esm build:types",
|
|
51
51
|
"build:es5": "yarn build:cjs # *** backwards compatibility - remove in v7 ***",
|
|
52
52
|
"build:esm": "tsc -p tsconfig.esm.json",
|
|
53
|
-
"build:
|
|
53
|
+
"build:types": "tsc -p tsconfig.types.json",
|
|
54
|
+
"build:watch": "run-p build:cjs:watch build:esm:watch build:bundle:watch build:types:watch",
|
|
54
55
|
"build:bundle:watch": "rollup --config --watch",
|
|
55
56
|
"build:cjs:watch": "tsc -p tsconfig.cjs.json --watch",
|
|
56
57
|
"build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***",
|
|
57
|
-
"build:dev:watch": "run-p build:cjs:watch build:esm:watch",
|
|
58
|
+
"build:dev:watch": "run-p build:cjs:watch build:esm:watch build:types:watch",
|
|
58
59
|
"build:esm:watch": "tsc -p tsconfig.esm.json --watch",
|
|
60
|
+
"build:types:watch": "tsc -p tsconfig.types.json --watch",
|
|
59
61
|
"circularDepCheck": "madge --circular src/index.ts",
|
|
60
|
-
"clean": "rimraf
|
|
62
|
+
"clean": "rimraf build coverage .rpt2_cache",
|
|
61
63
|
"fix": "run-s fix:eslint fix:prettier",
|
|
62
64
|
"fix:eslint": "eslint . --format stylish --fix",
|
|
63
65
|
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
|
|
@@ -65,10 +67,10 @@
|
|
|
65
67
|
"lint": "run-s lint:prettier lint:eslint",
|
|
66
68
|
"lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish",
|
|
67
69
|
"lint:prettier": "prettier --check \"{src,test}/**/*.ts\"",
|
|
68
|
-
"pack": "npm pack",
|
|
70
|
+
"pack": "npm pack ./build",
|
|
69
71
|
"size:check": "run-p size:check:es5 size:check:es6",
|
|
70
|
-
"size:check:es5": "cat build/bundle.min.js | gzip -9 | wc -c | awk '{$1=$1/1024; print \"ES5: \",$1,\"kB\";}'",
|
|
71
|
-
"size:check:es6": "cat build/bundle.es6.min.js | gzip -9 | wc -c | awk '{$1=$1/1024; print \"ES6: \",$1,\"kB\";}'",
|
|
72
|
+
"size:check:es5": "cat build/bundles/bundle.min.js | gzip -9 | wc -c | awk '{$1=$1/1024; print \"ES5: \",$1,\"kB\";}'",
|
|
73
|
+
"size:check:es6": "cat build/bundles/bundle.es6.min.js | gzip -9 | wc -c | awk '{$1=$1/1024; print \"ES6: \",$1,\"kB\";}'",
|
|
72
74
|
"test": "run-s test:unit",
|
|
73
75
|
"test:unit": "jest --config test/unit/jest.config.js",
|
|
74
76
|
"test:integration": "test/integration/run.js",
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { BaseBackend } from '@sentry/core';
|
|
2
|
+
import { Event, EventHint, Options, Severity, Transport } from '@sentry/types';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration options for the Sentry Browser SDK.
|
|
5
|
+
* @see BrowserClient for more information.
|
|
6
|
+
*/
|
|
7
|
+
export interface BrowserOptions extends Options {
|
|
8
|
+
/**
|
|
9
|
+
* A pattern for error URLs which should exclusively be sent to Sentry.
|
|
10
|
+
* This is the opposite of {@link Options.denyUrls}.
|
|
11
|
+
* By default, all errors will be sent.
|
|
12
|
+
*/
|
|
13
|
+
allowUrls?: Array<string | RegExp>;
|
|
14
|
+
/**
|
|
15
|
+
* A pattern for error URLs which should not be sent to Sentry.
|
|
16
|
+
* To allow certain errors instead, use {@link Options.allowUrls}.
|
|
17
|
+
* By default, all errors will be sent.
|
|
18
|
+
*/
|
|
19
|
+
denyUrls?: Array<string | RegExp>;
|
|
20
|
+
/** @deprecated use {@link Options.allowUrls} instead. */
|
|
21
|
+
whitelistUrls?: Array<string | RegExp>;
|
|
22
|
+
/** @deprecated use {@link Options.denyUrls} instead. */
|
|
23
|
+
blacklistUrls?: Array<string | RegExp>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The Sentry Browser SDK Backend.
|
|
27
|
+
* @hidden
|
|
28
|
+
*/
|
|
29
|
+
export declare class BrowserBackend extends BaseBackend<BrowserOptions> {
|
|
30
|
+
/**
|
|
31
|
+
* @inheritDoc
|
|
32
|
+
*/
|
|
33
|
+
eventFromException(exception: unknown, hint?: EventHint): PromiseLike<Event>;
|
|
34
|
+
/**
|
|
35
|
+
* @inheritDoc
|
|
36
|
+
*/
|
|
37
|
+
eventFromMessage(message: string, level?: Severity, hint?: EventHint): PromiseLike<Event>;
|
|
38
|
+
/**
|
|
39
|
+
* @inheritDoc
|
|
40
|
+
*/
|
|
41
|
+
protected _setupTransport(): Transport;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=backend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../src/backend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAM/E;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,OAAO;IAC7C;;;;OAIG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAEnC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAElC,yDAAyD;IACzD,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAEvC,wDAAwD;IACxD,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;CACxC;AAED;;;GAGG;AACH,qBAAa,cAAe,SAAQ,WAAW,CAAC,cAAc,CAAC;IAC7D;;OAEG;IACI,kBAAkB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAGnF;;OAEG;IACI,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,QAAwB,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAI/G;;OAEG;IACH,SAAS,CAAC,eAAe,IAAI,SAAS;CAsBvC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BaseClient, Scope } from '@sentry/core';
|
|
2
|
+
import { Event, EventHint } from '@sentry/types';
|
|
3
|
+
import { BrowserBackend, BrowserOptions } from './backend';
|
|
4
|
+
import { ReportDialogOptions } from './helpers';
|
|
5
|
+
/**
|
|
6
|
+
* The Sentry Browser SDK Client.
|
|
7
|
+
*
|
|
8
|
+
* @see BrowserOptions for documentation on configuration options.
|
|
9
|
+
* @see SentryClient for usage documentation.
|
|
10
|
+
*/
|
|
11
|
+
export declare class BrowserClient extends BaseClient<BrowserBackend, BrowserOptions> {
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new Browser SDK instance.
|
|
14
|
+
*
|
|
15
|
+
* @param options Configuration options for this SDK.
|
|
16
|
+
*/
|
|
17
|
+
constructor(options?: BrowserOptions);
|
|
18
|
+
/**
|
|
19
|
+
* Show a report dialog to the user to send feedback to a specific event.
|
|
20
|
+
*
|
|
21
|
+
* @param options Set individual options for the dialog
|
|
22
|
+
*/
|
|
23
|
+
showReportDialog(options?: ReportDialogOptions): void;
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
protected _prepareEvent(event: Event, scope?: Scope, hint?: EventHint): PromiseLike<Event | null>;
|
|
28
|
+
/**
|
|
29
|
+
* @inheritDoc
|
|
30
|
+
*/
|
|
31
|
+
protected _sendEvent(event: Event): void;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAe,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAGjD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAsB,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGpE;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,UAAU,CAAC,cAAc,EAAE,cAAc,CAAC;IAC3E;;;;OAIG;gBACgB,OAAO,GAAE,cAAmB;IAgB/C;;;;OAIG;IACI,gBAAgB,CAAC,OAAO,GAAE,mBAAwB,GAAG,IAAI;IAkBhE;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC;IAKjG;;OAEG;IACH,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;CAOzC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Event, EventHint, Exception, Severity, StackFrame } from '@sentry/types';
|
|
2
|
+
/**
|
|
3
|
+
* This function creates an exception from an TraceKitStackTrace
|
|
4
|
+
* @param stacktrace TraceKitStackTrace that will be converted to an exception
|
|
5
|
+
* @hidden
|
|
6
|
+
*/
|
|
7
|
+
export declare function exceptionFromError(ex: Error): Exception;
|
|
8
|
+
/**
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export declare function eventFromPlainObject(exception: Record<string, unknown>, syntheticException?: Error, isUnhandledRejection?: boolean): Event;
|
|
12
|
+
/**
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
export declare function eventFromError(ex: Error): Event;
|
|
16
|
+
/** Parses stack frames from an error */
|
|
17
|
+
export declare function parseStackFrames(ex: Error & {
|
|
18
|
+
framesToPop?: number;
|
|
19
|
+
stacktrace?: string;
|
|
20
|
+
}): StackFrame[];
|
|
21
|
+
/**
|
|
22
|
+
* Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.
|
|
23
|
+
* @hidden
|
|
24
|
+
*/
|
|
25
|
+
export declare function eventFromException(exception: unknown, hint?: EventHint, attachStacktrace?: boolean): PromiseLike<Event>;
|
|
26
|
+
/**
|
|
27
|
+
* Builds and Event from a Message
|
|
28
|
+
* @hidden
|
|
29
|
+
*/
|
|
30
|
+
export declare function eventFromMessage(message: string, level?: Severity, hint?: EventHint, attachStacktrace?: boolean): PromiseLike<Event>;
|
|
31
|
+
/**
|
|
32
|
+
* @hidden
|
|
33
|
+
*/
|
|
34
|
+
export declare function eventFromUnknownInput(exception: unknown, syntheticException?: Error, attachStacktrace?: boolean, isUnhandledRejection?: boolean): Event;
|
|
35
|
+
/**
|
|
36
|
+
* @hidden
|
|
37
|
+
*/
|
|
38
|
+
export declare function eventFromString(input: string, syntheticException?: Error, attachStacktrace?: boolean): Event;
|
|
39
|
+
//# sourceMappingURL=eventbuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventbuilder.d.ts","sourceRoot":"","sources":["../../src/eventbuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAwBlF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,KAAK,GAAG,SAAS,CAkBvD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,kBAAkB,CAAC,EAAE,KAAK,EAC1B,oBAAoB,CAAC,EAAE,OAAO,GAC7B,KAAK,CAyBP;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,KAAK,GAAG,KAAK,CAM/C;AAED,wCAAwC;AACxC,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,KAAK,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,EAAE,CAqBxG;AAmCD;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,OAAO,EAClB,IAAI,CAAC,EAAE,SAAS,EAChB,gBAAgB,CAAC,EAAE,OAAO,GACzB,WAAW,CAAC,KAAK,CAAC,CASpB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,KAAK,GAAE,QAAwB,EAC/B,IAAI,CAAC,EAAE,SAAS,EAChB,gBAAgB,CAAC,EAAE,OAAO,GACzB,WAAW,CAAC,KAAK,CAAC,CAQpB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,OAAO,EAClB,kBAAkB,CAAC,EAAE,KAAK,EAC1B,gBAAgB,CAAC,EAAE,OAAO,EAC1B,oBAAoB,CAAC,EAAE,OAAO,GAC7B,KAAK,CAiEP;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE,KAAK,EAAE,gBAAgB,CAAC,EAAE,OAAO,GAAG,KAAK,CAa5G"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { Breadcrumb, BreadcrumbHint, Request, SdkInfo, Event, EventHint, EventStatus, Exception, Response, Severity, StackFrame, Stacktrace, Thread, User, } from '@sentry/types';
|
|
2
|
+
export { SeverityLevel } from '@sentry/utils';
|
|
3
|
+
export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent, captureMessage, configureScope, getHubFromCarrier, getCurrentHub, Hub, makeMain, Scope, Session, startTransaction, SDK_VERSION, setContext, setExtra, setExtras, setTag, setTags, setUser, withScope, } from '@sentry/core';
|
|
4
|
+
export { BrowserOptions } from './backend';
|
|
5
|
+
export { BrowserClient } from './client';
|
|
6
|
+
export { injectReportDialog, ReportDialogOptions } from './helpers';
|
|
7
|
+
export { eventFromException, eventFromMessage } from './eventbuilder';
|
|
8
|
+
export { defaultIntegrations, forceLoad, init, lastEventId, onLoad, showReportDialog, flush, close, wrap } from './sdk';
|
|
9
|
+
export { SDK_NAME } from './version';
|
|
10
|
+
//# sourceMappingURL=exports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,cAAc,EACd,OAAO,EACP,OAAO,EACP,KAAK,EACL,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,GACL,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,GAAG,EACH,QAAQ,EACR,KAAK,EACL,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,SAAS,GACV,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AACxH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC"}
|