@sentry/browser 7.0.0-alpha.1 → 7.0.0-beta.2
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/README.md +2 -3
- package/cjs/client.js +130 -83
- package/cjs/client.js.map +1 -1
- package/cjs/eventbuilder.js +225 -167
- package/cjs/eventbuilder.js.map +1 -1
- package/cjs/exports.js +55 -47
- package/cjs/exports.js.map +1 -1
- package/cjs/flags.js +7 -3
- package/cjs/flags.js.map +1 -1
- package/cjs/helpers.js +122 -130
- package/cjs/helpers.js.map +1 -1
- package/cjs/index.js +78 -13
- package/cjs/index.js.map +1 -1
- package/cjs/integrations/breadcrumbs.js +223 -192
- package/cjs/integrations/breadcrumbs.js.map +1 -1
- package/cjs/integrations/dedupe.js +183 -142
- package/cjs/integrations/dedupe.js.map +1 -1
- package/cjs/integrations/globalhandlers.js +211 -171
- package/cjs/integrations/globalhandlers.js.map +1 -1
- package/cjs/integrations/httpcontext.js +51 -0
- package/cjs/integrations/httpcontext.js.map +1 -0
- package/cjs/integrations/index.js +18 -14
- package/cjs/integrations/index.js.map +1 -1
- package/cjs/integrations/linkederrors.js +79 -51
- package/cjs/integrations/linkederrors.js.map +1 -1
- package/cjs/integrations/trycatch.js +245 -216
- package/cjs/integrations/trycatch.js.map +1 -1
- package/cjs/sdk.js +168 -114
- package/cjs/sdk.js.map +1 -1
- package/cjs/stack-parsers.js +134 -84
- package/cjs/stack-parsers.js.map +1 -1
- package/cjs/transports/fetch.js +34 -80
- package/cjs/transports/fetch.js.map +1 -1
- package/cjs/transports/index.js +10 -14
- package/cjs/transports/index.js.map +1 -1
- package/cjs/transports/utils.js +57 -53
- package/cjs/transports/utils.js.map +1 -1
- package/cjs/transports/xhr.js +53 -63
- package/cjs/transports/xhr.js.map +1 -1
- package/esm/client.js +128 -82
- package/esm/client.js.map +1 -1
- package/esm/eventbuilder.js +218 -160
- package/esm/eventbuilder.js.map +1 -1
- package/esm/exports.js +12 -7
- package/esm/exports.js.map +1 -1
- package/esm/flags.js +5 -2
- package/esm/flags.js.map +1 -1
- package/esm/helpers.js +120 -127
- package/esm/helpers.js.map +1 -1
- package/esm/index.js +28 -10
- package/esm/index.js.map +1 -1
- package/esm/integrations/breadcrumbs.js +219 -190
- package/esm/integrations/breadcrumbs.js.map +1 -1
- package/esm/integrations/dedupe.js +180 -140
- package/esm/integrations/dedupe.js.map +1 -1
- package/esm/integrations/globalhandlers.js +208 -169
- package/esm/integrations/globalhandlers.js.map +1 -1
- package/esm/integrations/httpcontext.js +49 -0
- package/esm/integrations/httpcontext.js.map +1 -0
- package/esm/integrations/index.js +7 -7
- package/esm/integrations/index.js.map +1 -1
- package/esm/integrations/linkederrors.js +76 -49
- package/esm/integrations/linkederrors.js.map +1 -1
- package/esm/integrations/trycatch.js +242 -214
- package/esm/integrations/trycatch.js.map +1 -1
- package/esm/sdk.js +164 -111
- package/esm/sdk.js.map +1 -1
- package/esm/stack-parsers.js +126 -83
- package/esm/stack-parsers.js.map +1 -1
- package/esm/transports/fetch.js +32 -79
- package/esm/transports/fetch.js.map +1 -1
- package/esm/transports/index.js +3 -7
- package/esm/transports/index.js.map +1 -1
- package/esm/transports/utils.js +56 -52
- package/esm/transports/utils.js.map +1 -1
- package/esm/transports/xhr.js +51 -62
- package/esm/transports/xhr.js.map +1 -1
- package/package.json +4 -4
- package/types/client.d.ts +24 -18
- package/types/client.d.ts.map +1 -1
- package/types/eventbuilder.d.ts +1 -1
- package/types/exports.d.ts +5 -5
- package/types/exports.d.ts.map +1 -1
- package/types/helpers.d.ts +0 -5
- package/types/helpers.d.ts.map +1 -1
- package/types/index.d.ts +2 -3
- package/types/index.d.ts.map +1 -1
- package/types/integrations/breadcrumbs.d.ts +6 -7
- package/types/integrations/breadcrumbs.d.ts.map +1 -1
- package/types/integrations/globalhandlers.d.ts.map +1 -1
- package/types/integrations/{useragent.d.ts → httpcontext.d.ts} +3 -3
- package/types/integrations/httpcontext.d.ts.map +1 -0
- package/types/integrations/index.d.ts +1 -1
- package/types/integrations/index.d.ts.map +1 -1
- package/types/integrations/linkederrors.d.ts.map +1 -1
- package/types/sdk.d.ts +4 -4
- package/types/sdk.d.ts.map +1 -1
- package/types/stack-parsers.d.ts +7 -6
- package/types/stack-parsers.d.ts.map +1 -1
- package/types/transports/fetch.d.ts +6 -15
- package/types/transports/fetch.d.ts.map +1 -1
- package/types/transports/index.d.ts +2 -6
- package/types/transports/index.d.ts.map +1 -1
- package/types/transports/types.d.ts +10 -0
- package/types/transports/types.d.ts.map +1 -0
- package/types/transports/utils.d.ts +1 -1
- package/types/transports/utils.d.ts.map +1 -1
- package/types/transports/xhr.d.ts +6 -10
- package/types/transports/xhr.d.ts.map +1 -1
- package/cjs/client.d.ts +0 -58
- package/cjs/client.d.ts.map +0 -1
- package/cjs/eventbuilder.d.ts +0 -37
- package/cjs/eventbuilder.d.ts.map +0 -1
- package/cjs/exports.d.ts +0 -10
- package/cjs/exports.d.ts.map +0 -1
- package/cjs/flags.d.ts +0 -3
- package/cjs/flags.d.ts.map +0 -1
- package/cjs/helpers.d.ts +0 -52
- package/cjs/helpers.d.ts.map +0 -1
- package/cjs/index.d.ts +0 -16
- package/cjs/index.d.ts.map +0 -1
- package/cjs/integrations/breadcrumbs.d.ts +0 -47
- package/cjs/integrations/breadcrumbs.d.ts.map +0 -1
- package/cjs/integrations/dedupe.d.ts +0 -21
- package/cjs/integrations/dedupe.d.ts.map +0 -1
- package/cjs/integrations/globalhandlers.d.ts +0 -30
- package/cjs/integrations/globalhandlers.d.ts.map +0 -1
- package/cjs/integrations/index.d.ts +0 -7
- package/cjs/integrations/index.d.ts.map +0 -1
- package/cjs/integrations/linkederrors.d.ts +0 -42
- package/cjs/integrations/linkederrors.d.ts.map +0 -1
- package/cjs/integrations/trycatch.d.ts +0 -33
- package/cjs/integrations/trycatch.d.ts.map +0 -1
- package/cjs/integrations/useragent.d.ts +0 -17
- package/cjs/integrations/useragent.d.ts.map +0 -1
- package/cjs/integrations/useragent.js +0 -42
- package/cjs/integrations/useragent.js.map +0 -1
- package/cjs/sdk.d.ts +0 -112
- package/cjs/sdk.d.ts.map +0 -1
- package/cjs/stack-parsers.d.ts +0 -8
- package/cjs/stack-parsers.d.ts.map +0 -1
- package/cjs/transports/base.d.ts +0 -65
- package/cjs/transports/base.d.ts.map +0 -1
- package/cjs/transports/base.js +0 -141
- package/cjs/transports/base.js.map +0 -1
- package/cjs/transports/fetch.d.ts +0 -17
- package/cjs/transports/fetch.d.ts.map +0 -1
- package/cjs/transports/index.d.ts +0 -7
- package/cjs/transports/index.d.ts.map +0 -1
- package/cjs/transports/new-fetch.d.ts +0 -10
- package/cjs/transports/new-fetch.d.ts.map +0 -1
- package/cjs/transports/new-fetch.js +0 -27
- package/cjs/transports/new-fetch.js.map +0 -1
- package/cjs/transports/new-xhr.d.ts +0 -11
- package/cjs/transports/new-xhr.d.ts.map +0 -1
- package/cjs/transports/new-xhr.js +0 -46
- package/cjs/transports/new-xhr.js.map +0 -1
- package/cjs/transports/setup.d.ts +0 -22
- package/cjs/transports/setup.d.ts.map +0 -1
- package/cjs/transports/setup.js +0 -44
- package/cjs/transports/setup.js.map +0 -1
- package/cjs/transports/utils.d.ts +0 -48
- package/cjs/transports/utils.d.ts.map +0 -1
- package/cjs/transports/xhr.d.ts +0 -11
- package/cjs/transports/xhr.d.ts.map +0 -1
- package/cjs/version.d.ts +0 -2
- package/cjs/version.d.ts.map +0 -1
- package/cjs/version.js +0 -4
- package/cjs/version.js.map +0 -1
- package/esm/client.d.ts +0 -58
- package/esm/client.d.ts.map +0 -1
- package/esm/eventbuilder.d.ts +0 -37
- package/esm/eventbuilder.d.ts.map +0 -1
- package/esm/exports.d.ts +0 -10
- package/esm/exports.d.ts.map +0 -1
- package/esm/flags.d.ts +0 -3
- package/esm/flags.d.ts.map +0 -1
- package/esm/helpers.d.ts +0 -52
- package/esm/helpers.d.ts.map +0 -1
- package/esm/index.d.ts +0 -16
- package/esm/index.d.ts.map +0 -1
- package/esm/integrations/breadcrumbs.d.ts +0 -47
- package/esm/integrations/breadcrumbs.d.ts.map +0 -1
- package/esm/integrations/dedupe.d.ts +0 -21
- package/esm/integrations/dedupe.d.ts.map +0 -1
- package/esm/integrations/globalhandlers.d.ts +0 -30
- package/esm/integrations/globalhandlers.d.ts.map +0 -1
- package/esm/integrations/index.d.ts +0 -7
- package/esm/integrations/index.d.ts.map +0 -1
- package/esm/integrations/linkederrors.d.ts +0 -42
- package/esm/integrations/linkederrors.d.ts.map +0 -1
- package/esm/integrations/trycatch.d.ts +0 -33
- package/esm/integrations/trycatch.d.ts.map +0 -1
- package/esm/integrations/useragent.d.ts +0 -17
- package/esm/integrations/useragent.d.ts.map +0 -1
- package/esm/integrations/useragent.js +0 -41
- package/esm/integrations/useragent.js.map +0 -1
- package/esm/sdk.d.ts +0 -112
- package/esm/sdk.d.ts.map +0 -1
- package/esm/stack-parsers.d.ts +0 -8
- package/esm/stack-parsers.d.ts.map +0 -1
- package/esm/transports/base.d.ts +0 -65
- package/esm/transports/base.d.ts.map +0 -1
- package/esm/transports/base.js +0 -140
- package/esm/transports/base.js.map +0 -1
- package/esm/transports/fetch.d.ts +0 -17
- package/esm/transports/fetch.d.ts.map +0 -1
- package/esm/transports/index.d.ts +0 -7
- package/esm/transports/index.d.ts.map +0 -1
- package/esm/transports/new-fetch.d.ts +0 -10
- package/esm/transports/new-fetch.d.ts.map +0 -1
- package/esm/transports/new-fetch.js +0 -25
- package/esm/transports/new-fetch.js.map +0 -1
- package/esm/transports/new-xhr.d.ts +0 -11
- package/esm/transports/new-xhr.d.ts.map +0 -1
- package/esm/transports/new-xhr.js +0 -44
- package/esm/transports/new-xhr.js.map +0 -1
- package/esm/transports/setup.d.ts +0 -22
- package/esm/transports/setup.d.ts.map +0 -1
- package/esm/transports/setup.js +0 -42
- package/esm/transports/setup.js.map +0 -1
- package/esm/transports/utils.d.ts +0 -48
- package/esm/transports/utils.d.ts.map +0 -1
- package/esm/transports/xhr.d.ts +0 -11
- package/esm/transports/xhr.d.ts.map +0 -1
- package/esm/version.d.ts +0 -2
- package/esm/version.d.ts.map +0 -1
- package/esm/version.js +0 -3
- package/esm/version.js.map +0 -1
- package/types/integrations/useragent.d.ts.map +0 -1
- package/types/transports/base.d.ts +0 -65
- package/types/transports/base.d.ts.map +0 -1
- package/types/transports/new-fetch.d.ts +0 -10
- package/types/transports/new-fetch.d.ts.map +0 -1
- package/types/transports/new-xhr.d.ts +0 -11
- package/types/transports/new-xhr.d.ts.map +0 -1
- package/types/transports/setup.d.ts +0 -22
- package/types/transports/setup.d.ts.map +0 -1
- package/types/version.d.ts +0 -2
- package/types/version.d.ts.map +0 -1
package/esm/transports/base.js
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { __read } from "tslib";
|
|
2
|
-
import { eventToSentryRequest, getEnvelopeEndpointWithUrlEncodedAuth, getStoreEndpointWithUrlEncodedAuth, initAPIDetails, sessionToSentryRequest, } from '@sentry/core';
|
|
3
|
-
import { createClientReportEnvelope, disabledUntil, dsnToString, eventStatusFromHttpCode, getGlobalObject, isRateLimited, logger, makePromiseBuffer, serializeEnvelope, updateRateLimits, } from '@sentry/utils';
|
|
4
|
-
import { IS_DEBUG_BUILD } from '../flags';
|
|
5
|
-
import { sendReport } from './utils';
|
|
6
|
-
function requestTypeToCategory(ty) {
|
|
7
|
-
var tyStr = ty;
|
|
8
|
-
return tyStr === 'event' ? 'error' : tyStr;
|
|
9
|
-
}
|
|
10
|
-
var global = getGlobalObject();
|
|
11
|
-
/** Base Transport class implementation */
|
|
12
|
-
var BaseTransport = /** @class */ (function () {
|
|
13
|
-
function BaseTransport(options) {
|
|
14
|
-
var _this = this;
|
|
15
|
-
this.options = options;
|
|
16
|
-
/** A simple buffer holding all requests. */
|
|
17
|
-
this._buffer = makePromiseBuffer(30);
|
|
18
|
-
/** Locks transport after receiving rate limits in a response */
|
|
19
|
-
this._rateLimits = {};
|
|
20
|
-
this._outcomes = {};
|
|
21
|
-
this._api = initAPIDetails(options.dsn, options._metadata, options.tunnel);
|
|
22
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
23
|
-
this.url = getStoreEndpointWithUrlEncodedAuth(this._api.dsn);
|
|
24
|
-
if (this.options.sendClientReports && global.document) {
|
|
25
|
-
global.document.addEventListener('visibilitychange', function () {
|
|
26
|
-
if (global.document.visibilityState === 'hidden') {
|
|
27
|
-
_this._flushOutcomes();
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* @inheritDoc
|
|
34
|
-
*/
|
|
35
|
-
BaseTransport.prototype.sendEvent = function (event) {
|
|
36
|
-
return this._sendRequest(eventToSentryRequest(event, this._api), event);
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* @inheritDoc
|
|
40
|
-
*/
|
|
41
|
-
BaseTransport.prototype.sendSession = function (session) {
|
|
42
|
-
return this._sendRequest(sessionToSentryRequest(session, this._api), session);
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* @inheritDoc
|
|
46
|
-
*/
|
|
47
|
-
BaseTransport.prototype.close = function (timeout) {
|
|
48
|
-
return this._buffer.drain(timeout);
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* @inheritDoc
|
|
52
|
-
*/
|
|
53
|
-
BaseTransport.prototype.recordLostEvent = function (reason, category) {
|
|
54
|
-
var _a;
|
|
55
|
-
if (!this.options.sendClientReports) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
// We want to track each category (event, transaction, session) separately
|
|
59
|
-
// but still keep the distinction between different type of outcomes.
|
|
60
|
-
// We could use nested maps, but it's much easier to read and type this way.
|
|
61
|
-
// A correct type for map-based implementation if we want to go that route
|
|
62
|
-
// would be `Partial<Record<SentryRequestType, Partial<Record<Outcome, number>>>>`
|
|
63
|
-
var key = requestTypeToCategory(category) + ":" + reason;
|
|
64
|
-
IS_DEBUG_BUILD && logger.log("Adding outcome: " + key);
|
|
65
|
-
this._outcomes[key] = ((_a = this._outcomes[key]) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Send outcomes as an envelope
|
|
69
|
-
*/
|
|
70
|
-
BaseTransport.prototype._flushOutcomes = function () {
|
|
71
|
-
if (!this.options.sendClientReports) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
var outcomes = this._outcomes;
|
|
75
|
-
this._outcomes = {};
|
|
76
|
-
// Nothing to send
|
|
77
|
-
if (!Object.keys(outcomes).length) {
|
|
78
|
-
IS_DEBUG_BUILD && logger.log('No outcomes to flush');
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
IS_DEBUG_BUILD && logger.log("Flushing outcomes:\n" + JSON.stringify(outcomes, null, 2));
|
|
82
|
-
var url = getEnvelopeEndpointWithUrlEncodedAuth(this._api.dsn, this._api.tunnel);
|
|
83
|
-
var discardedEvents = Object.keys(outcomes).map(function (key) {
|
|
84
|
-
var _a = __read(key.split(':'), 2), category = _a[0], reason = _a[1];
|
|
85
|
-
return {
|
|
86
|
-
reason: reason,
|
|
87
|
-
category: category,
|
|
88
|
-
quantity: outcomes[key],
|
|
89
|
-
};
|
|
90
|
-
// TODO: Improve types on discarded_events to get rid of cast
|
|
91
|
-
});
|
|
92
|
-
var envelope = createClientReportEnvelope(discardedEvents, this._api.tunnel && dsnToString(this._api.dsn));
|
|
93
|
-
try {
|
|
94
|
-
sendReport(url, serializeEnvelope(envelope));
|
|
95
|
-
}
|
|
96
|
-
catch (e) {
|
|
97
|
-
IS_DEBUG_BUILD && logger.error(e);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
/**
|
|
101
|
-
* Handle Sentry repsonse for promise-based transports.
|
|
102
|
-
*/
|
|
103
|
-
BaseTransport.prototype._handleResponse = function (_a) {
|
|
104
|
-
var requestType = _a.requestType, response = _a.response, headers = _a.headers, resolve = _a.resolve, reject = _a.reject;
|
|
105
|
-
var status = eventStatusFromHttpCode(response.status);
|
|
106
|
-
this._rateLimits = updateRateLimits(this._rateLimits, headers);
|
|
107
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
108
|
-
if (this._isRateLimited(requestType)) {
|
|
109
|
-
IS_DEBUG_BUILD &&
|
|
110
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
111
|
-
logger.warn("Too many " + requestType + " requests, backing off until: " + this._disabledUntil(requestType));
|
|
112
|
-
}
|
|
113
|
-
if (status === 'success') {
|
|
114
|
-
resolve({ status: status });
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
reject(response);
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* Gets the time that given category is disabled until for rate limiting
|
|
121
|
-
*
|
|
122
|
-
* @deprecated Please use `disabledUntil` from @sentry/utils
|
|
123
|
-
*/
|
|
124
|
-
BaseTransport.prototype._disabledUntil = function (requestType) {
|
|
125
|
-
var category = requestTypeToCategory(requestType);
|
|
126
|
-
return new Date(disabledUntil(this._rateLimits, category));
|
|
127
|
-
};
|
|
128
|
-
/**
|
|
129
|
-
* Checks if a category is rate limited
|
|
130
|
-
*
|
|
131
|
-
* @deprecated Please use `isRateLimited` from @sentry/utils
|
|
132
|
-
*/
|
|
133
|
-
BaseTransport.prototype._isRateLimited = function (requestType) {
|
|
134
|
-
var category = requestTypeToCategory(requestType);
|
|
135
|
-
return isRateLimited(this._rateLimits, category);
|
|
136
|
-
};
|
|
137
|
-
return BaseTransport;
|
|
138
|
-
}());
|
|
139
|
-
export { BaseTransport };
|
|
140
|
-
//# sourceMappingURL=base.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,a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,EAAE;YACpC,cAAc;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 isRateLimited,\n logger,\n makePromiseBuffer,\n PromiseBuffer,\n RateLimits,\n serializeEnvelope,\n updateRateLimits,\n} from '@sentry/utils';\n\nimport { IS_DEBUG_BUILD } from '../flags';\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 IS_DEBUG_BUILD && 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 IS_DEBUG_BUILD && logger.log('No outcomes to flush');\n return;\n }\n\n IS_DEBUG_BUILD && 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 IS_DEBUG_BUILD && 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)) {\n IS_DEBUG_BUILD &&\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,17 +0,0 @@
|
|
|
1
|
-
import { Event, Response, SentryRequest, Session, TransportOptions } from '@sentry/types';
|
|
2
|
-
import { BaseTransport } from './base';
|
|
3
|
-
import { FetchImpl } from './utils';
|
|
4
|
-
/** `fetch` based transport */
|
|
5
|
-
export declare class FetchTransport extends BaseTransport {
|
|
6
|
-
/**
|
|
7
|
-
* Fetch API reference which always points to native browser implementation.
|
|
8
|
-
*/
|
|
9
|
-
private _fetch;
|
|
10
|
-
constructor(options: TransportOptions, fetchImpl?: FetchImpl);
|
|
11
|
-
/**
|
|
12
|
-
* @param sentryRequest Prepared SentryRequest to be delivered
|
|
13
|
-
* @param originalPayload Original payload used to create SentryRequest
|
|
14
|
-
*/
|
|
15
|
-
protected _sendRequest(sentryRequest: SentryRequest, originalPayload: Event | Session): PromiseLike<Response>;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=fetch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { BaseTransport } from './base';
|
|
2
|
-
export { FetchTransport } from './fetch';
|
|
3
|
-
export { XHRTransport } from './xhr';
|
|
4
|
-
export { makeNewFetchTransport } from './new-fetch';
|
|
5
|
-
export { makeNewXHRTransport } from './new-xhr';
|
|
6
|
-
export { setupBrowserTransport } from './setup';
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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;AAErC,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BaseTransportOptions, NewTransport } from '@sentry/core';
|
|
2
|
-
import { FetchImpl } from './utils';
|
|
3
|
-
export interface FetchTransportOptions extends BaseTransportOptions {
|
|
4
|
-
requestOptions?: RequestInit;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Creates a Transport that uses the Fetch API to send events to Sentry.
|
|
8
|
-
*/
|
|
9
|
-
export declare function makeNewFetchTransport(options: FetchTransportOptions, nativeFetch?: FetchImpl): NewTransport;
|
|
10
|
-
//# sourceMappingURL=new-fetch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-fetch.d.ts","sourceRoot":"","sources":["../../../../src/transports/new-fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EAEpB,YAAY,EAGb,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAgC,MAAM,SAAS,CAAC;AAElE,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IACjE,cAAc,CAAC,EAAE,WAAW,CAAC;CAC9B;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,qBAAqB,EAC9B,WAAW,GAAE,SAA0C,GACtD,YAAY,CAuBd"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
|
-
import { createTransport, } from '@sentry/core';
|
|
3
|
-
import { getNativeFetchImplementation } from './utils';
|
|
4
|
-
/**
|
|
5
|
-
* Creates a Transport that uses the Fetch API to send events to Sentry.
|
|
6
|
-
*/
|
|
7
|
-
export function makeNewFetchTransport(options, nativeFetch) {
|
|
8
|
-
if (nativeFetch === void 0) { nativeFetch = getNativeFetchImplementation(); }
|
|
9
|
-
function makeRequest(request) {
|
|
10
|
-
var requestOptions = __assign({ body: request.body, method: 'POST', referrerPolicy: 'origin' }, options.requestOptions);
|
|
11
|
-
return nativeFetch(options.url, requestOptions).then(function (response) {
|
|
12
|
-
return response.text().then(function (body) { return ({
|
|
13
|
-
body: body,
|
|
14
|
-
headers: {
|
|
15
|
-
'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),
|
|
16
|
-
'retry-after': response.headers.get('Retry-After'),
|
|
17
|
-
},
|
|
18
|
-
reason: response.statusText,
|
|
19
|
-
statusCode: response.status,
|
|
20
|
-
}); });
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
return createTransport({ bufferSize: options.bufferSize }, makeRequest);
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=new-fetch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-fetch.js","sourceRoot":"","sources":["../../../../src/transports/new-fetch.ts"],"names":[],"mappings":";AAAA,OAAO,EAEL,eAAe,GAIhB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAa,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAMlE;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAA8B,EAC9B,WAAuD;IAAvD,4BAAA,EAAA,cAAyB,4BAA4B,EAAE;IAEvD,SAAS,WAAW,CAAC,OAAyB;QAC5C,IAAM,cAAc,cAClB,IAAI,EAAE,OAAO,CAAC,IAAI,EAClB,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,QAAQ,IACrB,OAAO,CAAC,cAAc,CAC1B,CAAC;QAEF,OAAO,WAAW,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,IAAI,CAAC,UAAA,QAAQ;YAC3D,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,UAAA,IAAI,IAAI,OAAA,CAAC;gBACnC,IAAI,MAAA;gBACJ,OAAO,EAAE;oBACP,sBAAsB,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;oBACpE,aAAa,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;iBACnD;gBACD,MAAM,EAAE,QAAQ,CAAC,UAAU;gBAC3B,UAAU,EAAE,QAAQ,CAAC,MAAM;aAC5B,CAAC,EARkC,CAQlC,CAAC,CAAC;QACN,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,eAAe,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,EAAE,WAAW,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["import {\n BaseTransportOptions,\n createTransport,\n NewTransport,\n TransportMakeRequestResponse,\n TransportRequest,\n} from '@sentry/core';\n\nimport { FetchImpl, getNativeFetchImplementation } from './utils';\n\nexport interface FetchTransportOptions extends BaseTransportOptions {\n requestOptions?: RequestInit;\n}\n\n/**\n * Creates a Transport that uses the Fetch API to send events to Sentry.\n */\nexport function makeNewFetchTransport(\n options: FetchTransportOptions,\n nativeFetch: FetchImpl = getNativeFetchImplementation(),\n): NewTransport {\n function makeRequest(request: TransportRequest): PromiseLike<TransportMakeRequestResponse> {\n const requestOptions: RequestInit = {\n body: request.body,\n method: 'POST',\n referrerPolicy: 'origin',\n ...options.requestOptions,\n };\n\n return nativeFetch(options.url, requestOptions).then(response => {\n return response.text().then(body => ({\n body,\n headers: {\n 'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),\n 'retry-after': response.headers.get('Retry-After'),\n },\n reason: response.statusText,\n statusCode: response.status,\n }));\n });\n }\n\n return createTransport({ bufferSize: options.bufferSize }, makeRequest);\n}\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { BaseTransportOptions, NewTransport } from '@sentry/core';
|
|
2
|
-
export interface XHRTransportOptions extends BaseTransportOptions {
|
|
3
|
-
headers?: {
|
|
4
|
-
[key: string]: string;
|
|
5
|
-
};
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Creates a Transport that uses the XMLHttpRequest API to send events to Sentry.
|
|
9
|
-
*/
|
|
10
|
-
export declare function makeNewXHRTransport(options: XHRTransportOptions): NewTransport;
|
|
11
|
-
//# sourceMappingURL=new-xhr.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-xhr.d.ts","sourceRoot":"","sources":["../../../../src/transports/new-xhr.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EAEpB,YAAY,EAGb,MAAM,cAAc,CAAC;AAatB,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB;IAC/D,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACrC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CAiC9E"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { createTransport, } from '@sentry/core';
|
|
2
|
-
import { SyncPromise } from '@sentry/utils';
|
|
3
|
-
/**
|
|
4
|
-
* The DONE ready state for XmlHttpRequest
|
|
5
|
-
*
|
|
6
|
-
* Defining it here as a constant b/c XMLHttpRequest.DONE is not always defined
|
|
7
|
-
* (e.g. during testing, it is `undefined`)
|
|
8
|
-
*
|
|
9
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/readyState}
|
|
10
|
-
*/
|
|
11
|
-
var XHR_READYSTATE_DONE = 4;
|
|
12
|
-
/**
|
|
13
|
-
* Creates a Transport that uses the XMLHttpRequest API to send events to Sentry.
|
|
14
|
-
*/
|
|
15
|
-
export function makeNewXHRTransport(options) {
|
|
16
|
-
function makeRequest(request) {
|
|
17
|
-
return new SyncPromise(function (resolve, _reject) {
|
|
18
|
-
var xhr = new XMLHttpRequest();
|
|
19
|
-
xhr.onreadystatechange = function () {
|
|
20
|
-
if (xhr.readyState === XHR_READYSTATE_DONE) {
|
|
21
|
-
var response = {
|
|
22
|
-
body: xhr.response,
|
|
23
|
-
headers: {
|
|
24
|
-
'x-sentry-rate-limits': xhr.getResponseHeader('X-Sentry-Rate-Limits'),
|
|
25
|
-
'retry-after': xhr.getResponseHeader('Retry-After'),
|
|
26
|
-
},
|
|
27
|
-
reason: xhr.statusText,
|
|
28
|
-
statusCode: xhr.status,
|
|
29
|
-
};
|
|
30
|
-
resolve(response);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
xhr.open('POST', options.url);
|
|
34
|
-
for (var header in options.headers) {
|
|
35
|
-
if (Object.prototype.hasOwnProperty.call(options.headers, header)) {
|
|
36
|
-
xhr.setRequestHeader(header, options.headers[header]);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
xhr.send(request.body);
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
return createTransport({ bufferSize: options.bufferSize }, makeRequest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AO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;iBACvD;aACF;YAED,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,eAAe,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,EAAE,WAAW,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["import {\n BaseTransportOptions,\n createTransport,\n NewTransport,\n TransportMakeRequestResponse,\n TransportRequest,\n} from '@sentry/core';\nimport { SyncPromise } from '@sentry/utils';\n\n/**\n * The DONE ready state for XmlHttpRequest\n *\n * Defining it here as a constant b/c XMLHttpRequest.DONE is not always defined\n * (e.g. during testing, it is `undefined`)\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/readyState}\n */\nconst XHR_READYSTATE_DONE = 4;\n\nexport interface XHRTransportOptions extends BaseTransportOptions {\n headers?: { [key: string]: string };\n}\n\n/**\n * Creates a Transport that uses the XMLHttpRequest API to send events to Sentry.\n */\nexport function makeNewXHRTransport(options: XHRTransportOptions): NewTransport {\n function makeRequest(request: TransportRequest): PromiseLike<TransportMakeRequestResponse> {\n return new SyncPromise<TransportMakeRequestResponse>((resolve, _reject) => {\n const xhr = new XMLHttpRequest();\n\n xhr.onreadystatechange = (): void => {\n if (xhr.readyState === XHR_READYSTATE_DONE) {\n const response = {\n body: xhr.response,\n headers: {\n 'x-sentry-rate-limits': xhr.getResponseHeader('X-Sentry-Rate-Limits'),\n 'retry-after': xhr.getResponseHeader('Retry-After'),\n },\n reason: xhr.statusText,\n statusCode: xhr.status,\n };\n resolve(response);\n }\n };\n\n xhr.open('POST', options.url);\n\n for (const header in options.headers) {\n if (Object.prototype.hasOwnProperty.call(options.headers, header)) {\n xhr.setRequestHeader(header, options.headers[header]);\n }\n }\n\n xhr.send(request.body);\n });\n }\n\n return createTransport({ bufferSize: options.bufferSize }, makeRequest);\n}\n"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { BaseTransportOptions, NewTransport } from '@sentry/core';
|
|
2
|
-
import { Transport } from '@sentry/types';
|
|
3
|
-
import { BrowserOptions } from '../client';
|
|
4
|
-
export interface BrowserTransportOptions extends BaseTransportOptions {
|
|
5
|
-
fetchParams: Record<string, string>;
|
|
6
|
-
headers?: Record<string, string>;
|
|
7
|
-
sendClientReports?: boolean;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Sets up Browser transports based on the passed `options`. If available, the returned
|
|
11
|
-
* transport will use the fetch API. In case fetch is not supported, an XMLHttpRequest
|
|
12
|
-
* based transport is created.
|
|
13
|
-
*
|
|
14
|
-
* @returns an object currently still containing both, the old `Transport` and
|
|
15
|
-
* `NewTransport` which will eventually replace `Transport`. Once this is replaced,
|
|
16
|
-
* this function will return a ready to use `NewTransport`.
|
|
17
|
-
*/
|
|
18
|
-
export declare function setupBrowserTransport(options: BrowserOptions): {
|
|
19
|
-
transport: Transport;
|
|
20
|
-
newTransport?: NewTransport;
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../../src/transports/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EAGpB,YAAY,EAEb,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,SAAS,EAAoB,MAAM,eAAe,CAAC;AAG5D,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAM3C,MAAM,WAAW,uBAAwB,SAAQ,oBAAoB;IAEnE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;GAQG;AAEH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,cAAc,GAAG;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,YAAY,CAAC,EAAE,YAAY,CAAA;CAAE,CAkCpH"}
|
package/esm/transports/setup.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
|
-
import { getEnvelopeEndpointWithUrlEncodedAuth, initAPIDetails, NoopTransport, } from '@sentry/core';
|
|
3
|
-
import { supportsFetch } from '@sentry/utils';
|
|
4
|
-
import { FetchTransport } from './fetch';
|
|
5
|
-
import { makeNewFetchTransport } from './new-fetch';
|
|
6
|
-
import { makeNewXHRTransport } from './new-xhr';
|
|
7
|
-
import { XHRTransport } from './xhr';
|
|
8
|
-
/**
|
|
9
|
-
* Sets up Browser transports based on the passed `options`. If available, the returned
|
|
10
|
-
* transport will use the fetch API. In case fetch is not supported, an XMLHttpRequest
|
|
11
|
-
* based transport is created.
|
|
12
|
-
*
|
|
13
|
-
* @returns an object currently still containing both, the old `Transport` and
|
|
14
|
-
* `NewTransport` which will eventually replace `Transport`. Once this is replaced,
|
|
15
|
-
* this function will return a ready to use `NewTransport`.
|
|
16
|
-
*/
|
|
17
|
-
// TODO(v7): Adjust return value when NewTransport is the default
|
|
18
|
-
export function setupBrowserTransport(options) {
|
|
19
|
-
if (!options.dsn) {
|
|
20
|
-
// We return the noop transport here in case there is no Dsn.
|
|
21
|
-
return { transport: new NoopTransport() };
|
|
22
|
-
}
|
|
23
|
-
var transportOptions = __assign(__assign({}, options.transportOptions), { dsn: options.dsn, tunnel: options.tunnel, sendClientReports: options.sendClientReports, _metadata: options._metadata });
|
|
24
|
-
var api = initAPIDetails(transportOptions.dsn, transportOptions._metadata, transportOptions.tunnel);
|
|
25
|
-
var url = getEnvelopeEndpointWithUrlEncodedAuth(api.dsn, api.tunnel);
|
|
26
|
-
if (options.transport) {
|
|
27
|
-
return { transport: new options.transport(transportOptions) };
|
|
28
|
-
}
|
|
29
|
-
if (supportsFetch()) {
|
|
30
|
-
var requestOptions = __assign({}, transportOptions.fetchParameters);
|
|
31
|
-
var newTransport_1 = makeNewFetchTransport({ requestOptions: requestOptions, url: url });
|
|
32
|
-
var fetchTransport = new FetchTransport(transportOptions);
|
|
33
|
-
return { transport: fetchTransport, newTransport: newTransport_1 };
|
|
34
|
-
}
|
|
35
|
-
var newTransport = makeNewXHRTransport({
|
|
36
|
-
url: url,
|
|
37
|
-
headers: transportOptions.headers,
|
|
38
|
-
});
|
|
39
|
-
var transport = new XHRTransport(transportOptions);
|
|
40
|
-
return { transport: transport, newTransport: newTransport };
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=setup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../../src/transports/setup.ts"],"names":[],"mappings":";AAAA,OAAO,EAEL,qCAAqC,EACrC,cAAc,EAEd,aAAa,GACd,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AASrC;;;;;;;;GAQG;AACH,iEAAiE;AACjE,MAAM,UAAU,qBAAqB,CAAC,OAAuB;IAC3D,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;QAChB,6DAA6D;QAC7D,OAAO,EAAE,SAAS,EAAE,IAAI,aAAa,EAAE,EAAE,CAAC;KAC3C;IAED,IAAM,gBAAgB,yBACjB,OAAO,CAAC,gBAAgB,KAC3B,GAAG,EAAE,OAAO,CAAC,GAAG,EAChB,MAAM,EAAE,OAAO,CAAC,MAAM,EACtB,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,EAC5C,SAAS,EAAE,OAAO,CAAC,SAAS,GAC7B,CAAC;IAEF,IAAM,GAAG,GAAG,cAAc,CAAC,gBAAgB,CAAC,GAAG,EAAE,gBAAgB,CAAC,SAAS,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACtG,IAAM,GAAG,GAAG,qCAAqC,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAEvE,IAAI,OAAO,CAAC,SAAS,EAAE;QACrB,OAAO,EAAE,SAAS,EAAE,IAAI,OAAO,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAAE,CAAC;KAC/D;IAED,IAAI,aAAa,EAAE,EAAE;QACnB,IAAM,cAAc,gBAAqB,gBAAgB,CAAC,eAAe,CAAE,CAAC;QAC5E,IAAM,cAAY,GAAG,qBAAqB,CAAC,EAAE,cAAc,gBAAA,EAAE,GAAG,KAAA,EAAE,CAAC,CAAC;QACpE,IAAM,cAAc,GAAG,IAAI,cAAc,CAAC,gBAAgB,CAAC,CAAC;QAC5D,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,gBAAA,EAAE,CAAC;KACpD;IAED,IAAM,YAAY,GAAG,mBAAmB,CAAC;QACvC,GAAG,KAAA;QACH,OAAO,EAAE,gBAAgB,CAAC,OAAO;KAClC,CAAC,CAAC;IACH,IAAM,SAAS,GAAG,IAAI,YAAY,CAAC,gBAAgB,CAAC,CAAC;IACrD,OAAO,EAAE,SAAS,WAAA,EAAE,YAAY,cAAA,EAAE,CAAC;AACrC,CAAC","sourcesContent":["import {\n BaseTransportOptions,\n getEnvelopeEndpointWithUrlEncodedAuth,\n initAPIDetails,\n NewTransport,\n NoopTransport,\n} from '@sentry/core';\nimport { Transport, TransportOptions } from '@sentry/types';\nimport { supportsFetch } from '@sentry/utils';\n\nimport { BrowserOptions } from '../client';\nimport { FetchTransport } from './fetch';\nimport { makeNewFetchTransport } from './new-fetch';\nimport { makeNewXHRTransport } from './new-xhr';\nimport { XHRTransport } from './xhr';\n\nexport interface BrowserTransportOptions extends BaseTransportOptions {\n // options to pass into fetch request\n fetchParams: Record<string, string>;\n headers?: Record<string, string>;\n sendClientReports?: boolean;\n}\n\n/**\n * Sets up Browser transports based on the passed `options`. If available, the returned\n * transport will use the fetch API. In case fetch is not supported, an XMLHttpRequest\n * based transport is created.\n *\n * @returns an object currently still containing both, the old `Transport` and\n * `NewTransport` which will eventually replace `Transport`. Once this is replaced,\n * this function will return a ready to use `NewTransport`.\n */\n// TODO(v7): Adjust return value when NewTransport is the default\nexport function setupBrowserTransport(options: BrowserOptions): { transport: Transport; newTransport?: NewTransport } {\n if (!options.dsn) {\n // We return the noop transport here in case there is no Dsn.\n return { transport: new NoopTransport() };\n }\n\n const transportOptions: TransportOptions = {\n ...options.transportOptions,\n dsn: options.dsn,\n tunnel: options.tunnel,\n sendClientReports: options.sendClientReports,\n _metadata: options._metadata,\n };\n\n const api = initAPIDetails(transportOptions.dsn, transportOptions._metadata, transportOptions.tunnel);\n const url = getEnvelopeEndpointWithUrlEncodedAuth(api.dsn, api.tunnel);\n\n if (options.transport) {\n return { transport: new options.transport(transportOptions) };\n }\n\n if (supportsFetch()) {\n const requestOptions: RequestInit = { ...transportOptions.fetchParameters };\n const newTransport = makeNewFetchTransport({ requestOptions, url });\n const fetchTransport = new FetchTransport(transportOptions);\n return { transport: fetchTransport, newTransport };\n }\n\n const newTransport = makeNewXHRTransport({\n url,\n headers: transportOptions.headers,\n });\n const transport = new XHRTransport(transportOptions);\n return { transport, newTransport };\n}\n"]}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export declare type FetchImpl = typeof fetch;
|
|
2
|
-
/**
|
|
3
|
-
* A special usecase for incorrectly wrapped Fetch APIs in conjunction with ad-blockers.
|
|
4
|
-
* Whenever someone wraps the Fetch API and returns the wrong promise chain,
|
|
5
|
-
* this chain becomes orphaned and there is no possible way to capture it's rejections
|
|
6
|
-
* other than allowing it bubble up to this very handler. eg.
|
|
7
|
-
*
|
|
8
|
-
* const f = window.fetch;
|
|
9
|
-
* window.fetch = function () {
|
|
10
|
-
* const p = f.apply(this, arguments);
|
|
11
|
-
*
|
|
12
|
-
* p.then(function() {
|
|
13
|
-
* console.log('hi.');
|
|
14
|
-
* });
|
|
15
|
-
*
|
|
16
|
-
* return p;
|
|
17
|
-
* }
|
|
18
|
-
*
|
|
19
|
-
* `p.then(function () { ... })` is producing a completely separate promise chain,
|
|
20
|
-
* however, what's returned is `p` - the result of original `fetch` call.
|
|
21
|
-
*
|
|
22
|
-
* This mean, that whenever we use the Fetch API to send our own requests, _and_
|
|
23
|
-
* some ad-blocker blocks it, this orphaned chain will _always_ reject,
|
|
24
|
-
* effectively causing another event to be captured.
|
|
25
|
-
* This makes a whole process become an infinite loop, which we need to somehow
|
|
26
|
-
* deal with, and break it in one way or another.
|
|
27
|
-
*
|
|
28
|
-
* To deal with this issue, we are making sure that we _always_ use the real
|
|
29
|
-
* browser Fetch API, instead of relying on what `window.fetch` exposes.
|
|
30
|
-
* The only downside to this would be missing our own requests as breadcrumbs,
|
|
31
|
-
* but because we are already not doing this, it should be just fine.
|
|
32
|
-
*
|
|
33
|
-
* Possible failed fetch error messages per-browser:
|
|
34
|
-
*
|
|
35
|
-
* Chrome: Failed to fetch
|
|
36
|
-
* Edge: Failed to Fetch
|
|
37
|
-
* Firefox: NetworkError when attempting to fetch resource
|
|
38
|
-
* Safari: resource blocked by content blocker
|
|
39
|
-
*/
|
|
40
|
-
export declare function getNativeFetchImplementation(): FetchImpl;
|
|
41
|
-
/**
|
|
42
|
-
* Sends sdk client report using sendBeacon or fetch as a fallback if available
|
|
43
|
-
*
|
|
44
|
-
* @param url report endpoint
|
|
45
|
-
* @param body report payload
|
|
46
|
-
*/
|
|
47
|
-
export declare function sendReport(url: string, body: string): void;
|
|
48
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/transports/utils.ts"],"names":[],"mappings":"AAOA,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/xhr.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Event, Response, SentryRequest, Session } from '@sentry/types';
|
|
2
|
-
import { BaseTransport } from './base';
|
|
3
|
-
/** `XHR` based transport */
|
|
4
|
-
export declare class XHRTransport extends BaseTransport {
|
|
5
|
-
/**
|
|
6
|
-
* @param sentryRequest Prepared SentryRequest to be delivered
|
|
7
|
-
* @param originalPayload Original payload used to create SentryRequest
|
|
8
|
-
*/
|
|
9
|
-
protected _sendRequest(sentryRequest: SentryRequest, originalPayload: Event | Session): PromiseLike<Response>;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=xhr.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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/version.d.ts
DELETED
package/esm/version.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,QAAQ,8BAA8B,CAAC"}
|
package/esm/version.js
DELETED
package/esm/version.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useragent.d.ts","sourceRoot":"","sources":["../../../../src/integrations/useragent.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,WAAW,EAAE,MAAM,eAAe,CAAC;AAKnD,gBAAgB;AAChB,qBAAa,SAAU,YAAW,WAAW;IAC3C;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAe;IAEvC;;OAEG;IACI,IAAI,EAAE,MAAM,CAAgB;IAEnC;;OAEG;IACI,SAAS,IAAI,IAAI;CAyBzB"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { APIDetails } from '@sentry/core';
|
|
2
|
-
import { Event, Outcome, Response as SentryResponse, SentryRequest, SentryRequestType, Session, Transport, TransportOptions } from '@sentry/types';
|
|
3
|
-
import { PromiseBuffer, RateLimits } from '@sentry/utils';
|
|
4
|
-
/** Base Transport class implementation */
|
|
5
|
-
export declare abstract class BaseTransport implements Transport {
|
|
6
|
-
options: TransportOptions;
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated
|
|
9
|
-
*/
|
|
10
|
-
url: string;
|
|
11
|
-
/** Helper to get Sentry API endpoints. */
|
|
12
|
-
protected readonly _api: APIDetails;
|
|
13
|
-
/** A simple buffer holding all requests. */
|
|
14
|
-
protected readonly _buffer: PromiseBuffer<SentryResponse>;
|
|
15
|
-
/** Locks transport after receiving rate limits in a response */
|
|
16
|
-
protected _rateLimits: RateLimits;
|
|
17
|
-
protected _outcomes: {
|
|
18
|
-
[key: string]: number;
|
|
19
|
-
};
|
|
20
|
-
constructor(options: TransportOptions);
|
|
21
|
-
/**
|
|
22
|
-
* @inheritDoc
|
|
23
|
-
*/
|
|
24
|
-
sendEvent(event: Event): PromiseLike<SentryResponse>;
|
|
25
|
-
/**
|
|
26
|
-
* @inheritDoc
|
|
27
|
-
*/
|
|
28
|
-
sendSession(session: Session): PromiseLike<SentryResponse>;
|
|
29
|
-
/**
|
|
30
|
-
* @inheritDoc
|
|
31
|
-
*/
|
|
32
|
-
close(timeout?: number): PromiseLike<boolean>;
|
|
33
|
-
/**
|
|
34
|
-
* @inheritDoc
|
|
35
|
-
*/
|
|
36
|
-
recordLostEvent(reason: Outcome, category: SentryRequestType): void;
|
|
37
|
-
/**
|
|
38
|
-
* Send outcomes as an envelope
|
|
39
|
-
*/
|
|
40
|
-
protected _flushOutcomes(): void;
|
|
41
|
-
/**
|
|
42
|
-
* Handle Sentry repsonse for promise-based transports.
|
|
43
|
-
*/
|
|
44
|
-
protected _handleResponse({ requestType, response, headers, resolve, reject, }: {
|
|
45
|
-
requestType: SentryRequestType;
|
|
46
|
-
response: Response | XMLHttpRequest;
|
|
47
|
-
headers: Record<string, string | null>;
|
|
48
|
-
resolve: (value?: SentryResponse | PromiseLike<SentryResponse> | null | undefined) => void;
|
|
49
|
-
reject: (reason?: unknown) => void;
|
|
50
|
-
}): void;
|
|
51
|
-
/**
|
|
52
|
-
* Gets the time that given category is disabled until for rate limiting
|
|
53
|
-
*
|
|
54
|
-
* @deprecated Please use `disabledUntil` from @sentry/utils
|
|
55
|
-
*/
|
|
56
|
-
protected _disabledUntil(requestType: SentryRequestType): Date;
|
|
57
|
-
/**
|
|
58
|
-
* Checks if a category is rate limited
|
|
59
|
-
*
|
|
60
|
-
* @deprecated Please use `isRateLimited` from @sentry/utils
|
|
61
|
-
*/
|
|
62
|
-
protected _isRateLimited(requestType: SentryRequestType): boolean;
|
|
63
|
-
protected abstract _sendRequest(sentryRequest: SentryRequest, originalPayload: Event | Session): PromiseLike<SentryResponse>;
|
|
64
|
-
}
|
|
65
|
-
//# sourceMappingURL=base.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/transports/base.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAMX,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,KAAK,EACL,OAAO,EACP,QAAQ,IAAI,cAAc,EAC1B,aAAa,EACb,iBAAiB,EACjB,OAAO,EACP,SAAS,EACT,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EASL,aAAa,EACb,UAAU,EAGX,MAAM,eAAe,CAAC;AAYvB,0CAA0C;AAC1C,8BAAsB,aAAc,YAAW,SAAS;IAiB5B,OAAO,EAAE,gBAAgB;IAhBnD;;OAEG;IACI,GAAG,EAAE,MAAM,CAAC;IAEnB,0CAA0C;IAC1C,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAEpC,4CAA4C;IAC5C,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,CAAyB;IAElF,gEAAgE;IAChE,SAAS,CAAC,WAAW,EAAE,UAAU,CAAM;IAEvC,SAAS,CAAC,SAAS,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAM;gBAE1B,OAAO,EAAE,gBAAgB;IAcnD;;OAEG;IACI,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,CAAC,cAAc,CAAC;IAI3D;;OAEG;IACI,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,CAAC,cAAc,CAAC;IAIjE;;OAEG;IACI,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC;IAIpD;;OAEG;IACI,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAc1E;;OAEG;IACH,SAAS,CAAC,cAAc,IAAI,IAAI;IAoChC;;OAEG;IACH,SAAS,CAAC,eAAe,CAAC,EACxB,WAAW,EACX,QAAQ,EACR,OAAO,EACP,OAAO,EACP,MAAM,GACP,EAAE;QACD,WAAW,EAAE,iBAAiB,CAAC;QAC/B,QAAQ,EAAE,QAAQ,GAAG,cAAc,CAAC;QACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;QACvC,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC,GAAG,IAAI,GAAG,SAAS,KAAK,IAAI,CAAC;QAC3F,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;KACpC,GAAG,IAAI;IAmBR;;;;OAIG;IACH,SAAS,CAAC,cAAc,CAAC,WAAW,EAAE,iBAAiB,GAAG,IAAI;IAK9D;;;;OAIG;IACH,SAAS,CAAC,cAAc,CAAC,WAAW,EAAE,iBAAiB,GAAG,OAAO;IAKjE,SAAS,CAAC,QAAQ,CAAC,YAAY,CAC7B,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,KAAK,GAAG,OAAO,GAC/B,WAAW,CAAC,cAAc,CAAC;CAC/B"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BaseTransportOptions, NewTransport } from '@sentry/core';
|
|
2
|
-
import { FetchImpl } from './utils';
|
|
3
|
-
export interface FetchTransportOptions extends BaseTransportOptions {
|
|
4
|
-
requestOptions?: RequestInit;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Creates a Transport that uses the Fetch API to send events to Sentry.
|
|
8
|
-
*/
|
|
9
|
-
export declare function makeNewFetchTransport(options: FetchTransportOptions, nativeFetch?: FetchImpl): NewTransport;
|
|
10
|
-
//# sourceMappingURL=new-fetch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-fetch.d.ts","sourceRoot":"","sources":["../../../../src/transports/new-fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EAEpB,YAAY,EAGb,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAgC,MAAM,SAAS,CAAC;AAElE,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IACjE,cAAc,CAAC,EAAE,WAAW,CAAC;CAC9B;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,qBAAqB,EAC9B,WAAW,GAAE,SAA0C,GACtD,YAAY,CAuBd"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { BaseTransportOptions, NewTransport } from '@sentry/core';
|
|
2
|
-
export interface XHRTransportOptions extends BaseTransportOptions {
|
|
3
|
-
headers?: {
|
|
4
|
-
[key: string]: string;
|
|
5
|
-
};
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Creates a Transport that uses the XMLHttpRequest API to send events to Sentry.
|
|
9
|
-
*/
|
|
10
|
-
export declare function makeNewXHRTransport(options: XHRTransportOptions): NewTransport;
|
|
11
|
-
//# sourceMappingURL=new-xhr.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-xhr.d.ts","sourceRoot":"","sources":["../../../../src/transports/new-xhr.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EAEpB,YAAY,EAGb,MAAM,cAAc,CAAC;AAatB,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB;IAC/D,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACrC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CAiC9E"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { BaseTransportOptions, NewTransport } from '@sentry/core';
|
|
2
|
-
import { Transport } from '@sentry/types';
|
|
3
|
-
import { BrowserOptions } from '../client';
|
|
4
|
-
export interface BrowserTransportOptions extends BaseTransportOptions {
|
|
5
|
-
fetchParams: Record<string, string>;
|
|
6
|
-
headers?: Record<string, string>;
|
|
7
|
-
sendClientReports?: boolean;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Sets up Browser transports based on the passed `options`. If available, the returned
|
|
11
|
-
* transport will use the fetch API. In case fetch is not supported, an XMLHttpRequest
|
|
12
|
-
* based transport is created.
|
|
13
|
-
*
|
|
14
|
-
* @returns an object currently still containing both, the old `Transport` and
|
|
15
|
-
* `NewTransport` which will eventually replace `Transport`. Once this is replaced,
|
|
16
|
-
* this function will return a ready to use `NewTransport`.
|
|
17
|
-
*/
|
|
18
|
-
export declare function setupBrowserTransport(options: BrowserOptions): {
|
|
19
|
-
transport: Transport;
|
|
20
|
-
newTransport?: NewTransport;
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../../src/transports/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EAGpB,YAAY,EAEb,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,SAAS,EAAoB,MAAM,eAAe,CAAC;AAG5D,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAM3C,MAAM,WAAW,uBAAwB,SAAQ,oBAAoB;IAEnE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;GAQG;AAEH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,cAAc,GAAG;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,YAAY,CAAC,EAAE,YAAY,CAAA;CAAE,CAkCpH"}
|
package/types/version.d.ts
DELETED