@sentry/browser 6.19.7 → 7.0.0-beta.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/cjs/client.d.ts +63 -0
- package/cjs/client.d.ts.map +1 -0
- package/cjs/client.js +116 -0
- package/cjs/client.js.map +1 -0
- package/cjs/eventbuilder.d.ts +37 -0
- package/cjs/eventbuilder.d.ts.map +1 -0
- package/{dist → cjs}/eventbuilder.js +52 -53
- package/cjs/eventbuilder.js.map +1 -0
- package/cjs/exports.d.ts +11 -0
- package/cjs/exports.d.ts.map +1 -0
- package/{dist → cjs}/exports.js +21 -7
- package/cjs/exports.js.map +1 -0
- package/{dist → cjs}/flags.d.ts +0 -0
- package/{dist → cjs}/flags.d.ts.map +0 -0
- package/{dist → cjs}/flags.js +0 -0
- package/{dist → cjs}/flags.js.map +0 -0
- package/{dist → cjs}/helpers.d.ts +0 -5
- package/cjs/helpers.d.ts.map +1 -0
- package/{dist → cjs}/helpers.js +15 -49
- package/cjs/helpers.js.map +1 -0
- package/{dist → cjs}/index.d.ts +1 -2
- package/{dist → cjs}/index.d.ts.map +1 -1
- package/cjs/index.js +15 -0
- package/cjs/index.js.map +1 -0
- package/{dist → cjs}/integrations/breadcrumbs.d.ts +6 -7
- package/cjs/integrations/breadcrumbs.d.ts.map +1 -0
- package/{dist → cjs}/integrations/breadcrumbs.js +39 -57
- package/cjs/integrations/breadcrumbs.js.map +1 -0
- package/{dist → cjs}/integrations/dedupe.d.ts +0 -0
- package/{dist → cjs}/integrations/dedupe.d.ts.map +1 -1
- package/{dist → cjs}/integrations/dedupe.js +28 -30
- package/cjs/integrations/dedupe.js.map +1 -0
- package/{dist → cjs}/integrations/globalhandlers.d.ts +0 -0
- package/cjs/integrations/globalhandlers.d.ts.map +1 -0
- package/{dist → cjs}/integrations/globalhandlers.js +57 -57
- package/cjs/integrations/globalhandlers.js.map +1 -0
- package/{dist → cjs}/integrations/index.d.ts +0 -0
- package/{dist → cjs}/integrations/index.d.ts.map +0 -0
- package/{dist → cjs}/integrations/index.js +0 -0
- package/{dist → cjs}/integrations/index.js.map +0 -0
- package/{dist → cjs}/integrations/linkederrors.d.ts +3 -3
- package/cjs/integrations/linkederrors.d.ts.map +1 -0
- package/cjs/integrations/linkederrors.js +62 -0
- package/cjs/integrations/linkederrors.js.map +1 -0
- package/{dist → cjs}/integrations/trycatch.d.ts +0 -0
- package/{dist → cjs}/integrations/trycatch.d.ts.map +0 -0
- package/{dist → cjs}/integrations/trycatch.js +30 -40
- package/cjs/integrations/trycatch.js.map +1 -0
- package/{dist → cjs}/integrations/useragent.d.ts +0 -0
- package/{dist → cjs}/integrations/useragent.d.ts.map +0 -0
- package/cjs/integrations/useragent.js +40 -0
- package/cjs/integrations/useragent.js.map +1 -0
- package/{dist → cjs}/sdk.d.ts +3 -3
- package/cjs/sdk.d.ts.map +1 -0
- package/{dist → cjs}/sdk.js +47 -28
- package/cjs/sdk.js.map +1 -0
- package/cjs/stack-parsers.d.ts +9 -0
- package/cjs/stack-parsers.d.ts.map +1 -0
- package/{dist → cjs}/stack-parsers.js +45 -44
- package/cjs/stack-parsers.js.map +1 -0
- package/{esm/transports/new-fetch.d.ts → cjs/transports/fetch.d.ts} +3 -3
- package/cjs/transports/fetch.d.ts.map +1 -0
- package/cjs/transports/fetch.js +20 -0
- package/cjs/transports/fetch.js.map +1 -0
- package/cjs/transports/index.d.ts +3 -0
- package/cjs/transports/index.d.ts.map +1 -0
- package/cjs/transports/index.js +6 -0
- package/cjs/transports/index.js.map +1 -0
- package/{dist → cjs}/transports/utils.d.ts +0 -0
- package/{dist → cjs}/transports/utils.d.ts.map +1 -1
- package/{dist → cjs}/transports/utils.js +17 -17
- package/cjs/transports/utils.js.map +1 -0
- package/{types/transports/new-xhr.d.ts → cjs/transports/xhr.d.ts} +3 -3
- package/cjs/transports/xhr.d.ts.map +1 -0
- package/{esm/transports/new-xhr.js → cjs/transports/xhr.js} +14 -14
- package/cjs/transports/xhr.js.map +1 -0
- package/{dist → cjs}/version.d.ts +0 -0
- package/{dist → cjs}/version.d.ts.map +0 -0
- package/{dist → cjs}/version.js +0 -0
- package/{dist → cjs}/version.js.map +0 -0
- package/esm/client.d.ts +41 -11
- package/esm/client.d.ts.map +1 -1
- package/esm/client.js +79 -41
- package/esm/client.js.map +1 -1
- package/esm/eventbuilder.d.ts +10 -12
- package/esm/eventbuilder.d.ts.map +1 -1
- package/esm/eventbuilder.js +52 -53
- package/esm/eventbuilder.js.map +1 -1
- package/esm/exports.d.ts +7 -6
- package/esm/exports.d.ts.map +1 -1
- package/esm/exports.js +4 -4
- package/esm/exports.js.map +1 -1
- package/esm/flags.js +1 -1
- package/esm/flags.js.map +1 -1
- package/esm/helpers.d.ts +0 -5
- package/esm/helpers.d.ts.map +1 -1
- package/esm/helpers.js +15 -48
- package/esm/helpers.js.map +1 -1
- package/esm/index.d.ts +1 -2
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +4 -6
- package/esm/index.js.map +1 -1
- package/esm/integrations/breadcrumbs.d.ts +6 -7
- package/esm/integrations/breadcrumbs.d.ts.map +1 -1
- package/esm/integrations/breadcrumbs.js +38 -57
- package/esm/integrations/breadcrumbs.js.map +1 -1
- package/esm/integrations/dedupe.d.ts.map +1 -1
- package/esm/integrations/dedupe.js +26 -29
- package/esm/integrations/dedupe.js.map +1 -1
- package/esm/integrations/globalhandlers.d.ts.map +1 -1
- package/esm/integrations/globalhandlers.js +52 -53
- package/esm/integrations/globalhandlers.js.map +1 -1
- package/esm/integrations/linkederrors.d.ts +3 -3
- package/esm/integrations/linkederrors.d.ts.map +1 -1
- package/esm/integrations/linkederrors.js +24 -25
- package/esm/integrations/linkederrors.js.map +1 -1
- package/esm/integrations/trycatch.js +28 -39
- package/esm/integrations/trycatch.js.map +1 -1
- package/esm/integrations/useragent.js +17 -20
- package/esm/integrations/useragent.js.map +1 -1
- package/esm/sdk.d.ts +3 -3
- package/esm/sdk.d.ts.map +1 -1
- package/esm/sdk.js +44 -25
- package/esm/sdk.js.map +1 -1
- package/esm/stack-parsers.d.ts +8 -6
- package/esm/stack-parsers.d.ts.map +1 -1
- package/esm/stack-parsers.js +45 -44
- package/esm/stack-parsers.js.map +1 -1
- package/esm/transports/fetch.d.ts +7 -14
- package/esm/transports/fetch.d.ts.map +1 -1
- package/esm/transports/fetch.js +15 -77
- package/esm/transports/fetch.js.map +1 -1
- package/esm/transports/index.d.ts +2 -5
- package/esm/transports/index.d.ts.map +1 -1
- package/esm/transports/index.js +2 -5
- package/esm/transports/index.js.map +1 -1
- package/esm/transports/utils.d.ts.map +1 -1
- package/esm/transports/utils.js +16 -16
- package/esm/transports/utils.js.map +1 -1
- package/esm/transports/xhr.d.ts +9 -9
- package/esm/transports/xhr.d.ts.map +1 -1
- package/esm/transports/xhr.js +38 -59
- package/esm/transports/xhr.js.map +1 -1
- package/esm/version.js +1 -1
- package/esm/version.js.map +1 -1
- package/package.json +6 -7
- package/types/client.d.ts +41 -11
- package/types/client.d.ts.map +1 -1
- package/types/eventbuilder.d.ts +10 -12
- package/types/eventbuilder.d.ts.map +1 -1
- package/types/exports.d.ts +7 -6
- 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 +1 -2
- 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/dedupe.d.ts.map +1 -1
- package/types/integrations/globalhandlers.d.ts.map +1 -1
- package/types/integrations/linkederrors.d.ts +3 -3
- package/types/integrations/linkederrors.d.ts.map +1 -1
- package/types/sdk.d.ts +3 -3
- package/types/sdk.d.ts.map +1 -1
- package/types/stack-parsers.d.ts +8 -6
- package/types/stack-parsers.d.ts.map +1 -1
- package/types/transports/fetch.d.ts +7 -14
- package/types/transports/fetch.d.ts.map +1 -1
- package/types/transports/index.d.ts +2 -5
- package/types/transports/index.d.ts.map +1 -1
- package/types/transports/utils.d.ts.map +1 -1
- package/types/transports/xhr.d.ts +9 -9
- package/types/transports/xhr.d.ts.map +1 -1
- package/build/bundle.debug.min.js +0 -3
- package/build/bundle.debug.min.js.map +0 -1
- package/build/bundle.es6.debug.min.js +0 -3
- package/build/bundle.es6.debug.min.js.map +0 -1
- package/build/bundle.es6.js +0 -6868
- 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 +0 -7169
- package/build/bundle.js.map +0 -1
- package/build/bundle.min.js +0 -3
- package/build/bundle.min.js.map +0 -1
- package/dist/backend.d.ts +0 -43
- package/dist/backend.d.ts.map +0 -1
- package/dist/backend.js +0 -58
- package/dist/backend.js.map +0 -1
- package/dist/client.d.ts +0 -33
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -77
- package/dist/client.js.map +0 -1
- package/dist/eventbuilder.d.ts +0 -39
- package/dist/eventbuilder.d.ts.map +0 -1
- package/dist/eventbuilder.js.map +0 -1
- package/dist/exports.d.ts +0 -10
- package/dist/exports.d.ts.map +0 -1
- package/dist/exports.js.map +0 -1
- package/dist/helpers.d.ts.map +0 -1
- package/dist/helpers.js.map +0 -1
- package/dist/index.js +0 -17
- package/dist/index.js.map +0 -1
- package/dist/integrations/breadcrumbs.d.ts.map +0 -1
- package/dist/integrations/breadcrumbs.js.map +0 -1
- package/dist/integrations/dedupe.js.map +0 -1
- package/dist/integrations/globalhandlers.d.ts.map +0 -1
- package/dist/integrations/globalhandlers.js.map +0 -1
- package/dist/integrations/linkederrors.d.ts.map +0 -1
- package/dist/integrations/linkederrors.js +0 -62
- package/dist/integrations/linkederrors.js.map +0 -1
- package/dist/integrations/trycatch.js.map +0 -1
- package/dist/integrations/useragent.js +0 -42
- package/dist/integrations/useragent.js.map +0 -1
- package/dist/sdk.d.ts.map +0 -1
- package/dist/sdk.js.map +0 -1
- package/dist/stack-parsers.d.ts +0 -7
- package/dist/stack-parsers.d.ts.map +0 -1
- package/dist/stack-parsers.js.map +0 -1
- package/dist/transports/base.d.ts +0 -65
- package/dist/transports/base.d.ts.map +0 -1
- package/dist/transports/base.js +0 -141
- package/dist/transports/base.js.map +0 -1
- package/dist/transports/fetch.d.ts +0 -17
- package/dist/transports/fetch.d.ts.map +0 -1
- package/dist/transports/fetch.js +0 -81
- package/dist/transports/fetch.js.map +0 -1
- package/dist/transports/index.d.ts +0 -6
- package/dist/transports/index.d.ts.map +0 -1
- package/dist/transports/index.js +0 -12
- package/dist/transports/index.js.map +0 -1
- package/dist/transports/new-fetch.d.ts +0 -10
- package/dist/transports/new-fetch.d.ts.map +0 -1
- package/dist/transports/new-fetch.js +0 -27
- package/dist/transports/new-fetch.js.map +0 -1
- package/dist/transports/new-xhr.d.ts +0 -11
- package/dist/transports/new-xhr.d.ts.map +0 -1
- package/dist/transports/new-xhr.js +0 -46
- package/dist/transports/new-xhr.js.map +0 -1
- package/dist/transports/utils.js.map +0 -1
- package/dist/transports/xhr.d.ts +0 -11
- package/dist/transports/xhr.d.ts.map +0 -1
- package/dist/transports/xhr.js +0 -64
- package/dist/transports/xhr.js.map +0 -1
- package/esm/backend.d.ts +0 -43
- package/esm/backend.d.ts.map +0 -1
- package/esm/backend.js +0 -57
- package/esm/backend.js.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/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.map +0 -1
- package/types/backend.d.ts +0 -43
- package/types/backend.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.map +0 -1
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BaseTransport } from './base';
|
|
1
|
+
import { BaseTransportOptions, Transport } from '@sentry/types';
|
|
3
2
|
import { FetchImpl } from './utils';
|
|
4
|
-
|
|
5
|
-
|
|
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>;
|
|
3
|
+
export interface FetchTransportOptions extends BaseTransportOptions {
|
|
4
|
+
requestOptions?: RequestInit;
|
|
16
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Creates a Transport that uses the Fetch API to send events to Sentry.
|
|
8
|
+
*/
|
|
9
|
+
export declare function makeFetchTransport(options: FetchTransportOptions, nativeFetch?: FetchImpl): Transport;
|
|
17
10
|
//# sourceMappingURL=fetch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../../src/transports/fetch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../../src/transports/fetch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAkD,MAAM,eAAe,CAAC;AAEhH,OAAO,EAAE,SAAS,EAAgC,MAAM,SAAS,CAAC;AAElE,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IACjE,cAAc,CAAC,EAAE,WAAW,CAAC;CAC9B;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,qBAAqB,EAC9B,WAAW,GAAE,SAA0C,GACtD,SAAS,CAkBX"}
|
package/esm/transports/fetch.js
CHANGED
|
@@ -1,80 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SentryError, supportsReferrerPolicy, SyncPromise } from '@sentry/utils';
|
|
3
|
-
import { BaseTransport } from './base';
|
|
1
|
+
import { createTransport } from '@sentry/core';
|
|
4
2
|
import { getNativeFetchImplementation } from './utils';
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Creates a Transport that uses the Fetch API to send events to Sentry.
|
|
5
|
+
*/
|
|
6
|
+
export function makeFetchTransport(options, nativeFetch = getNativeFetchImplementation()) {
|
|
7
|
+
function makeRequest(request) {
|
|
8
|
+
const requestOptions = Object.assign({ body: request.body, method: 'POST', referrerPolicy: 'origin' }, options.requestOptions);
|
|
9
|
+
return nativeFetch(options.url, requestOptions).then(response => ({
|
|
10
|
+
headers: {
|
|
11
|
+
'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),
|
|
12
|
+
'retry-after': response.headers.get('Retry-After'),
|
|
13
|
+
},
|
|
14
|
+
}));
|
|
13
15
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* @param originalPayload Original payload used to create SentryRequest
|
|
17
|
-
*/
|
|
18
|
-
FetchTransport.prototype._sendRequest = function (sentryRequest, originalPayload) {
|
|
19
|
-
var _this = this;
|
|
20
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
21
|
-
if (this._isRateLimited(sentryRequest.type)) {
|
|
22
|
-
this.recordLostEvent('ratelimit_backoff', sentryRequest.type);
|
|
23
|
-
return Promise.reject({
|
|
24
|
-
event: originalPayload,
|
|
25
|
-
type: sentryRequest.type,
|
|
26
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
27
|
-
reason: "Transport for " + sentryRequest.type + " requests locked till " + this._disabledUntil(sentryRequest.type) + " due to too many requests.",
|
|
28
|
-
status: 429,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
var options = {
|
|
32
|
-
body: sentryRequest.body,
|
|
33
|
-
method: 'POST',
|
|
34
|
-
// Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default'
|
|
35
|
-
// (see https://caniuse.com/#feat=referrer-policy),
|
|
36
|
-
// it doesn't. And it throws an exception instead of ignoring this parameter...
|
|
37
|
-
// REF: https://github.com/getsentry/raven-js/issues/1233
|
|
38
|
-
referrerPolicy: (supportsReferrerPolicy() ? 'origin' : ''),
|
|
39
|
-
};
|
|
40
|
-
if (this.options.fetchParameters !== undefined) {
|
|
41
|
-
Object.assign(options, this.options.fetchParameters);
|
|
42
|
-
}
|
|
43
|
-
if (this.options.headers !== undefined) {
|
|
44
|
-
options.headers = this.options.headers;
|
|
45
|
-
}
|
|
46
|
-
return this._buffer
|
|
47
|
-
.add(function () {
|
|
48
|
-
return new SyncPromise(function (resolve, reject) {
|
|
49
|
-
void _this._fetch(sentryRequest.url, options)
|
|
50
|
-
.then(function (response) {
|
|
51
|
-
var headers = {
|
|
52
|
-
'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),
|
|
53
|
-
'retry-after': response.headers.get('Retry-After'),
|
|
54
|
-
};
|
|
55
|
-
_this._handleResponse({
|
|
56
|
-
requestType: sentryRequest.type,
|
|
57
|
-
response: response,
|
|
58
|
-
headers: headers,
|
|
59
|
-
resolve: resolve,
|
|
60
|
-
reject: reject,
|
|
61
|
-
});
|
|
62
|
-
})
|
|
63
|
-
.catch(reject);
|
|
64
|
-
});
|
|
65
|
-
})
|
|
66
|
-
.then(undefined, function (reason) {
|
|
67
|
-
// It's either buffer rejection or any other xhr/fetch error, which are treated as NetworkError.
|
|
68
|
-
if (reason instanceof SentryError) {
|
|
69
|
-
_this.recordLostEvent('queue_overflow', sentryRequest.type);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
_this.recordLostEvent('network_error', sentryRequest.type);
|
|
73
|
-
}
|
|
74
|
-
throw reason;
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
return FetchTransport;
|
|
78
|
-
}(BaseTransport));
|
|
79
|
-
export { FetchTransport };
|
|
16
|
+
return createTransport(options, makeRequest);
|
|
17
|
+
}
|
|
80
18
|
//# sourceMappingURL=fetch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../../src/transports/fetch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../../src/transports/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,EAAa,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAMlE;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAA8B,EAC9B,cAAyB,4BAA4B,EAAE;IAEvD,SAAS,WAAW,CAAC,OAAyB;QAC5C,MAAM,cAAc,mBAClB,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,QAAQ,CAAC,EAAE,CAAC,CAAC;YAChE,OAAO,EAAE;gBACP,sBAAsB,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;gBACpE,aAAa,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;aACnD;SACF,CAAC,CAAC,CAAC;IACN,CAAC;IAED,OAAO,eAAe,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import { createTransport } from '@sentry/core';\nimport { BaseTransportOptions, Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/types';\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 makeFetchTransport(\n options: FetchTransportOptions,\n nativeFetch: FetchImpl = getNativeFetchImplementation(),\n): Transport {\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 headers: {\n 'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),\n 'retry-after': response.headers.get('Retry-After'),\n },\n }));\n }\n\n return createTransport(options, makeRequest);\n}\n"]}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export { XHRTransport } from './xhr';
|
|
4
|
-
export { makeNewFetchTransport } from './new-fetch';
|
|
5
|
-
export { makeNewXHRTransport } from './new-xhr';
|
|
1
|
+
export { makeFetchTransport } from './fetch';
|
|
2
|
+
export { makeXHRTransport } from './xhr';
|
|
6
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/transports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/transports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC"}
|
package/esm/transports/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export { XHRTransport } from './xhr';
|
|
4
|
-
export { makeNewFetchTransport } from './new-fetch';
|
|
5
|
-
export { makeNewXHRTransport } from './new-xhr';
|
|
1
|
+
export { makeFetchTransport } from './fetch';
|
|
2
|
+
export { makeXHRTransport } from './xhr';
|
|
6
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/transports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/transports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC","sourcesContent":["export { makeFetchTransport } from './fetch';\nexport { makeXHRTransport } from './xhr';\n"]}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,CAiB1D"}
|
package/esm/transports/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getGlobalObject, isNativeFetch, logger, supportsFetch } from '@sentry/utils';
|
|
2
2
|
import { IS_DEBUG_BUILD } from '../flags';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const global = getGlobalObject();
|
|
4
|
+
let cachedFetchImpl;
|
|
5
5
|
/**
|
|
6
6
|
* A special usecase for incorrectly wrapped Fetch APIs in conjunction with ad-blockers.
|
|
7
7
|
* Whenever someone wraps the Fetch API and returns the wrong promise chain,
|
|
@@ -49,15 +49,15 @@ export function getNativeFetchImplementation() {
|
|
|
49
49
|
if (isNativeFetch(global.fetch)) {
|
|
50
50
|
return (cachedFetchImpl = global.fetch.bind(global));
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
const document = global.document;
|
|
53
|
+
let fetchImpl = global.fetch;
|
|
54
54
|
// eslint-disable-next-line deprecation/deprecation
|
|
55
55
|
if (document && typeof document.createElement === 'function') {
|
|
56
56
|
try {
|
|
57
|
-
|
|
57
|
+
const sandbox = document.createElement('iframe');
|
|
58
58
|
sandbox.hidden = true;
|
|
59
59
|
document.head.appendChild(sandbox);
|
|
60
|
-
|
|
60
|
+
const contentWindow = sandbox.contentWindow;
|
|
61
61
|
if (contentWindow && contentWindow.fetch) {
|
|
62
62
|
fetchImpl = contentWindow.fetch;
|
|
63
63
|
}
|
|
@@ -78,21 +78,21 @@ export function getNativeFetchImplementation() {
|
|
|
78
78
|
* @param body report payload
|
|
79
79
|
*/
|
|
80
80
|
export function sendReport(url, body) {
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
const isRealNavigator = Object.prototype.toString.call(global && global.navigator) === '[object Navigator]';
|
|
82
|
+
const hasSendBeacon = isRealNavigator && typeof global.navigator.sendBeacon === 'function';
|
|
83
83
|
if (hasSendBeacon) {
|
|
84
84
|
// Prevent illegal invocations - https://xgwang.me/posts/you-may-not-know-beacon/#it-may-throw-error%2C-be-sure-to-catch
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
const sendBeacon = global.navigator.sendBeacon.bind(global.navigator);
|
|
86
|
+
sendBeacon(url, body);
|
|
87
87
|
}
|
|
88
|
-
if (supportsFetch()) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
body
|
|
88
|
+
else if (supportsFetch()) {
|
|
89
|
+
const fetch = getNativeFetchImplementation();
|
|
90
|
+
fetch(url, {
|
|
91
|
+
body,
|
|
92
92
|
method: 'POST',
|
|
93
93
|
credentials: 'omit',
|
|
94
94
|
keepalive: true,
|
|
95
|
-
}));
|
|
95
|
+
}).then(null, error => logger.error(error));
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/transports/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/transports/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEtF,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,MAAM,GAAG,eAAe,EAAU,CAAC;AACzC,IAAI,eAA0B,CAAC;AAI/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,UAAU,4BAA4B;IAC1C,IAAI,eAAe,EAAE;QACnB,OAAO,eAAe,CAAC;KACxB;IAED,sDAAsD;IAEtD,6BAA6B;IAC7B,IAAI,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;QAC/B,OAAO,CAAC,eAAe,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;KACtD;IAED,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IACjC,IAAI,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC;IAC7B,mDAAmD;IACnD,IAAI,QAAQ,IAAI,OAAO,QAAQ,CAAC,aAAa,KAAK,UAAU,EAAE;QAC5D,IAAI;YACF,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;YACjD,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;YACtB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YACnC,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;YAC5C,IAAI,aAAa,IAAI,aAAa,CAAC,KAAK,EAAE;gBACxC,SAAS,GAAG,aAAa,CAAC,KAAK,CAAC;aACjC;YACD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;SACpC;QAAC,OAAO,CAAC,EAAE;YACV,cAAc;gBACZ,MAAM,CAAC,IAAI,CAAC,iFAAiF,EAAE,CAAC,CAAC,CAAC;SACrG;KACF;IAED,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAClD,qDAAqD;AACvD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW,EAAE,IAAY;IAClD,MAAM,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,oBAAoB,CAAC;IAC5G,MAAM,aAAa,GAAG,eAAe,IAAI,OAAO,MAAM,CAAC,SAAS,CAAC,UAAU,KAAK,UAAU,CAAC;IAE3F,IAAI,aAAa,EAAE;QACjB,wHAAwH;QACxH,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACtE,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;KACvB;SAAM,IAAI,aAAa,EAAE,EAAE;QAC1B,MAAM,KAAK,GAAG,4BAA4B,EAAE,CAAC;QAC7C,KAAK,CAAC,GAAG,EAAE;YACT,IAAI;YACJ,MAAM,EAAE,MAAM;YACd,WAAW,EAAE,MAAM;YACnB,SAAS,EAAE,IAAI;SAChB,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;KAC7C;AACH,CAAC","sourcesContent":["import { getGlobalObject, isNativeFetch, logger, supportsFetch } from '@sentry/utils';\n\nimport { IS_DEBUG_BUILD } from '../flags';\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 IS_DEBUG_BUILD &&\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 sendBeacon(url, body);\n } else if (supportsFetch()) {\n const fetch = getNativeFetchImplementation();\n fetch(url, {\n body,\n method: 'POST',\n credentials: 'omit',\n keepalive: true,\n }).then(null, error => logger.error(error));\n }\n}\n"]}
|
package/esm/transports/xhr.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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>;
|
|
1
|
+
import { BaseTransportOptions, Transport } from '@sentry/types';
|
|
2
|
+
export interface XHRTransportOptions extends BaseTransportOptions {
|
|
3
|
+
headers?: {
|
|
4
|
+
[key: string]: string;
|
|
5
|
+
};
|
|
10
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Creates a Transport that uses the XMLHttpRequest API to send events to Sentry.
|
|
9
|
+
*/
|
|
10
|
+
export declare function makeXHRTransport(options: XHRTransportOptions): Transport;
|
|
11
11
|
//# sourceMappingURL=xhr.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xhr.d.ts","sourceRoot":"","sources":["../../../../src/transports/xhr.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"xhr.d.ts","sourceRoot":"","sources":["../../../../src/transports/xhr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAkD,MAAM,eAAe,CAAC;AAahH,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,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,SAAS,CAgCxE"}
|
package/esm/transports/xhr.js
CHANGED
|
@@ -1,63 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
'retry-after': request.getResponseHeader('Retry-After'),
|
|
36
|
-
};
|
|
37
|
-
_this._handleResponse({ requestType: sentryRequest.type, response: request, headers: headers, resolve: resolve, reject: reject });
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
request.open('POST', sentryRequest.url);
|
|
41
|
-
for (var header in _this.options.headers) {
|
|
42
|
-
if (Object.prototype.hasOwnProperty.call(_this.options.headers, header)) {
|
|
43
|
-
request.setRequestHeader(header, _this.options.headers[header]);
|
|
44
|
-
}
|
|
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
|
+
const XHR_READYSTATE_DONE = 4;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a Transport that uses the XMLHttpRequest API to send events to Sentry.
|
|
14
|
+
*/
|
|
15
|
+
export function makeXHRTransport(options) {
|
|
16
|
+
function makeRequest(request) {
|
|
17
|
+
return new SyncPromise((resolve, reject) => {
|
|
18
|
+
const xhr = new XMLHttpRequest();
|
|
19
|
+
xhr.onerror = reject;
|
|
20
|
+
xhr.onreadystatechange = () => {
|
|
21
|
+
if (xhr.readyState === XHR_READYSTATE_DONE) {
|
|
22
|
+
const response = {
|
|
23
|
+
headers: {
|
|
24
|
+
'x-sentry-rate-limits': xhr.getResponseHeader('X-Sentry-Rate-Limits'),
|
|
25
|
+
'retry-after': xhr.getResponseHeader('Retry-After'),
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
resolve(response);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
xhr.open('POST', options.url);
|
|
32
|
+
for (const header in options.headers) {
|
|
33
|
+
if (Object.prototype.hasOwnProperty.call(options.headers, header)) {
|
|
34
|
+
xhr.setRequestHeader(header, options.headers[header]);
|
|
45
35
|
}
|
|
46
|
-
request.send(sentryRequest.body);
|
|
47
|
-
});
|
|
48
|
-
})
|
|
49
|
-
.then(undefined, function (reason) {
|
|
50
|
-
// It's either buffer rejection or any other xhr/fetch error, which are treated as NetworkError.
|
|
51
|
-
if (reason instanceof SentryError) {
|
|
52
|
-
_this.recordLostEvent('queue_overflow', sentryRequest.type);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
_this.recordLostEvent('network_error', sentryRequest.type);
|
|
56
36
|
}
|
|
57
|
-
|
|
37
|
+
xhr.send(request.body);
|
|
58
38
|
});
|
|
59
|
-
}
|
|
60
|
-
return
|
|
61
|
-
}
|
|
62
|
-
export { XHRTransport };
|
|
39
|
+
}
|
|
40
|
+
return createTransport(options, makeRequest);
|
|
41
|
+
}
|
|
63
42
|
//# sourceMappingURL=xhr.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xhr.js","sourceRoot":"","sources":["../../../../src/transports/xhr.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"xhr.js","sourceRoot":"","sources":["../../../../src/transports/xhr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAM9B;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAA4B;IAC3D,SAAS,WAAW,CAAC,OAAyB;QAC5C,OAAO,IAAI,WAAW,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACzC,MAAM,GAAG,GAAG,IAAI,cAAc,EAAE,CAAC;YAEjC,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;YAErB,GAAG,CAAC,kBAAkB,GAAG,GAAS,EAAE;gBAClC,IAAI,GAAG,CAAC,UAAU,KAAK,mBAAmB,EAAE;oBAC1C,MAAM,QAAQ,GAAG;wBACf,OAAO,EAAE;4BACP,sBAAsB,EAAE,GAAG,CAAC,iBAAiB,CAAC,sBAAsB,CAAC;4BACrE,aAAa,EAAE,GAAG,CAAC,iBAAiB,CAAC,aAAa,CAAC;yBACpD;qBACF,CAAC;oBACF,OAAO,CAAC,QAAQ,CAAC,CAAC;iBACnB;YACH,CAAC,CAAC;YAEF,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;YAE9B,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE;gBACpC,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE;oBACjE,GAAG,CAAC,gBAAgB,CAAC,MAAM,EAAE,OAAO,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,OAAO,EAAE,WAAW,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import { createTransport } from '@sentry/core';\nimport { BaseTransportOptions, Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/types';\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 makeXHRTransport(options: XHRTransportOptions): Transport {\n function makeRequest(request: TransportRequest): PromiseLike<TransportMakeRequestResponse> {\n return new SyncPromise((resolve, reject) => {\n const xhr = new XMLHttpRequest();\n\n xhr.onerror = reject;\n\n xhr.onreadystatechange = (): void => {\n if (xhr.readyState === XHR_READYSTATE_DONE) {\n const response = {\n headers: {\n 'x-sentry-rate-limits': xhr.getResponseHeader('X-Sentry-Rate-Limits'),\n 'retry-after': xhr.getResponseHeader('Retry-After'),\n },\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(options, makeRequest);\n}\n"]}
|
package/esm/version.js
CHANGED
package/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,MAAM,CAAC,MAAM,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,24 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/browser",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-beta.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",
|
|
7
7
|
"author": "Sentry",
|
|
8
8
|
"license": "BSD-3-Clause",
|
|
9
9
|
"engines": {
|
|
10
|
-
"node": ">=
|
|
10
|
+
"node": ">=8"
|
|
11
11
|
},
|
|
12
|
-
"main": "
|
|
12
|
+
"main": "cjs/index.js",
|
|
13
13
|
"module": "esm/index.js",
|
|
14
14
|
"types": "types/index.d.ts",
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@sentry/core": "
|
|
20
|
-
"@sentry/types": "
|
|
21
|
-
"@sentry/utils": "
|
|
19
|
+
"@sentry/core": "7.0.0-beta.0",
|
|
20
|
+
"@sentry/types": "7.0.0-beta.0",
|
|
21
|
+
"@sentry/utils": "7.0.0-beta.0",
|
|
22
22
|
"tslib": "^1.9.3"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"btoa": "^1.2.1",
|
|
27
27
|
"chai": "^4.1.2",
|
|
28
28
|
"chokidar": "^3.0.2",
|
|
29
|
-
"jsdom": "^15.0.0",
|
|
30
29
|
"karma": "^6.3.16",
|
|
31
30
|
"karma-chai": "^0.1.0",
|
|
32
31
|
"karma-chrome-launcher": "^2.2.0",
|
package/types/client.d.ts
CHANGED
|
@@ -1,33 +1,63 @@
|
|
|
1
1
|
import { BaseClient, Scope } from '@sentry/core';
|
|
2
|
-
import { Event, EventHint } from '@sentry/types';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { ClientOptions, Event, EventHint, Options, Severity, SeverityLevel } from '@sentry/types';
|
|
3
|
+
export interface BaseBrowserOptions {
|
|
4
|
+
/**
|
|
5
|
+
* A pattern for error URLs which should exclusively be sent to Sentry.
|
|
6
|
+
* This is the opposite of {@link Options.denyUrls}.
|
|
7
|
+
* By default, all errors will be sent.
|
|
8
|
+
*/
|
|
9
|
+
allowUrls?: Array<string | RegExp>;
|
|
10
|
+
/**
|
|
11
|
+
* A pattern for error URLs which should not be sent to Sentry.
|
|
12
|
+
* To allow certain errors instead, use {@link Options.allowUrls}.
|
|
13
|
+
* By default, all errors will be sent.
|
|
14
|
+
*/
|
|
15
|
+
denyUrls?: Array<string | RegExp>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Configuration options for the Sentry Browser SDK.
|
|
19
|
+
* @see @sentry/types Options for more information.
|
|
20
|
+
*/
|
|
21
|
+
export interface BrowserOptions extends Options, BaseBrowserOptions {
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Configuration options for the Sentry Browser SDK Client class
|
|
25
|
+
* @see BrowserClient for more information.
|
|
26
|
+
*/
|
|
27
|
+
export interface BrowserClientOptions extends ClientOptions, BaseBrowserOptions {
|
|
28
|
+
}
|
|
5
29
|
/**
|
|
6
30
|
* The Sentry Browser SDK Client.
|
|
7
31
|
*
|
|
8
32
|
* @see BrowserOptions for documentation on configuration options.
|
|
9
33
|
* @see SentryClient for usage documentation.
|
|
10
34
|
*/
|
|
11
|
-
export declare class BrowserClient extends BaseClient<
|
|
35
|
+
export declare class BrowserClient extends BaseClient<BrowserClientOptions> {
|
|
12
36
|
/**
|
|
13
37
|
* Creates a new Browser SDK instance.
|
|
14
38
|
*
|
|
15
39
|
* @param options Configuration options for this SDK.
|
|
16
40
|
*/
|
|
17
|
-
constructor(options
|
|
41
|
+
constructor(options: BrowserClientOptions);
|
|
18
42
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* @param options Set individual options for the dialog
|
|
43
|
+
* @inheritDoc
|
|
22
44
|
*/
|
|
23
|
-
|
|
45
|
+
eventFromException(exception: unknown, hint?: EventHint): PromiseLike<Event>;
|
|
24
46
|
/**
|
|
25
47
|
* @inheritDoc
|
|
26
48
|
*/
|
|
27
|
-
|
|
49
|
+
eventFromMessage(message: string, level?: Severity | SeverityLevel, hint?: EventHint): PromiseLike<Event>;
|
|
50
|
+
/**
|
|
51
|
+
* @inheritDoc
|
|
52
|
+
*/
|
|
53
|
+
sendEvent(event: Event): void;
|
|
28
54
|
/**
|
|
29
55
|
* @inheritDoc
|
|
30
56
|
*/
|
|
31
|
-
protected
|
|
57
|
+
protected _prepareEvent(event: Event, scope?: Scope, hint?: EventHint): PromiseLike<Event | null>;
|
|
58
|
+
/**
|
|
59
|
+
* Sends client reports as an envelope.
|
|
60
|
+
*/
|
|
61
|
+
private _flushOutcomes;
|
|
32
62
|
}
|
|
33
63
|
//# sourceMappingURL=client.d.ts.map
|
package/types/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAwD,KAAK,EAAe,MAAM,cAAc,CAAC;AACpH,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAkBlG,MAAM,WAAW,kBAAkB;IACjC;;;;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;CACnC;AAED;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,OAAO,EAAE,kBAAkB;CAAG;AAEtE;;;GAGG;AACH,MAAM,WAAW,oBAAqB,SAAQ,aAAa,EAAE,kBAAkB;CAAG;AAElF;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,UAAU,CAAC,oBAAoB,CAAC;IACjE;;;;OAIG;gBACgB,OAAO,EAAE,oBAAoB;IAwBhD;;OAEG;IACI,kBAAkB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAInF;;OAEG;IACI,gBAAgB,CACrB,OAAO,EAAE,MAAM,EAEf,KAAK,GAAE,QAAQ,GAAG,aAAsB,EACxC,IAAI,CAAC,EAAE,SAAS,GACf,WAAW,CAAC,KAAK,CAAC;IAIrB;;OAEG;IACI,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAgCpC;;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,OAAO,CAAC,cAAc;CAwBvB"}
|