@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,46 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
var core_1 = require("@sentry/core");
|
|
3
|
-
var utils_1 = require("@sentry/utils");
|
|
4
|
-
/**
|
|
5
|
-
* The DONE ready state for XmlHttpRequest
|
|
6
|
-
*
|
|
7
|
-
* Defining it here as a constant b/c XMLHttpRequest.DONE is not always defined
|
|
8
|
-
* (e.g. during testing, it is `undefined`)
|
|
9
|
-
*
|
|
10
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/readyState}
|
|
11
|
-
*/
|
|
12
|
-
var XHR_READYSTATE_DONE = 4;
|
|
13
|
-
/**
|
|
14
|
-
* Creates a Transport that uses the XMLHttpRequest API to send events to Sentry.
|
|
15
|
-
*/
|
|
16
|
-
function makeNewXHRTransport(options) {
|
|
17
|
-
function makeRequest(request) {
|
|
18
|
-
return new utils_1.SyncPromise(function (resolve, _reject) {
|
|
19
|
-
var xhr = new XMLHttpRequest();
|
|
20
|
-
xhr.onreadystatechange = function () {
|
|
21
|
-
if (xhr.readyState === XHR_READYSTATE_DONE) {
|
|
22
|
-
var response = {
|
|
23
|
-
body: xhr.response,
|
|
24
|
-
headers: {
|
|
25
|
-
'x-sentry-rate-limits': xhr.getResponseHeader('X-Sentry-Rate-Limits'),
|
|
26
|
-
'retry-after': xhr.getResponseHeader('Retry-After'),
|
|
27
|
-
},
|
|
28
|
-
reason: xhr.statusText,
|
|
29
|
-
statusCode: xhr.status,
|
|
30
|
-
};
|
|
31
|
-
resolve(response);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
xhr.open('POST', options.url);
|
|
35
|
-
for (var header in options.headers) {
|
|
36
|
-
if (Object.prototype.hasOwnProperty.call(options.headers, header)) {
|
|
37
|
-
xhr.setRequestHeader(header, options.headers[header]);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
xhr.send(request.body);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
return core_1.createTransport({ bufferSize: options.bufferSize }, makeRequest);
|
|
44
|
-
}
|
|
45
|
-
exports.makeNewXHRTransport = makeNewXHRTransport;
|
|
46
|
-
//# sourceMappingURL=new-xhr.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-xhr.js","sourceRoot":"","sources":["../../../../src/transports/new-xhr.ts"],"names":[],"mappings":";AAAA,qCAMsB;AACtB,uCAA4C;AAE5C;;;;;;;GAOG;AACH,IAAM,mBAAmB,GAAG,CAAC,CAAC;AAM9B;;GAEG;AACH,SAAgB,mBAAmB,CAAC,OAA4B;IAC9D,SAAS,WAAW,CAAC,OAAyB;QAC5C,OAAO,IAAI,mBAAW,CAA+B,UAAC,OAAO,EAAE,OAAO;YACpE,IAAM,GAAG,GAAG,IAAI,cAAc,EAAE,CAAC;YAEjC,GAAG,CAAC,kBAAkB,GAAG;gBACvB,IAAI,GAAG,CAAC,UAAU,KAAK,mBAAmB,EAAE;oBAC1C,IAAM,QAAQ,GAAG;wBACf,IAAI,EAAE,GAAG,CAAC,QAAQ;wBAClB,OAAO,EAAE;4BACP,sBAAsB,EAAE,GAAG,CAAC,iBAAiB,CAAC,sBAAsB,CAAC;4BACrE,aAAa,EAAE,GAAG,CAAC,iBAAiB,CAAC,aAAa,CAAC;yBACpD;wBACD,MAAM,EAAE,GAAG,CAAC,UAAU;wBACtB,UAAU,EAAE,GAAG,CAAC,MAAM;qBACvB,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,IAAM,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,sBAAe,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,EAAE,WAAW,CAAC,CAAC;AAC1E,CAAC;AAjCD,kDAiCC","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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/transports/utils.ts"],"names":[],"mappings":";AAAA,uCAA8F;AAE9F,kCAA0C;AAE1C,IAAM,MAAM,GAAG,uBAAe,EAAU,CAAC;AACzC,IAAI,eAA0B,CAAC;AAI/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,SAAgB,4BAA4B;IAC1C,IAAI,eAAe,EAAE;QACnB,OAAO,eAAe,CAAC;KACxB;IAED,sDAAsD;IAEtD,6BAA6B;IAC7B,IAAI,qBAAa,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;QAC/B,OAAO,CAAC,eAAe,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;KACtD;IAED,IAAM,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,IAAM,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,IAAM,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,sBAAc;gBACZ,cAAM,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;AAjCD,oEAiCC;AAED;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,GAAW,EAAE,IAAY;IAClD,IAAM,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,oBAAoB,CAAC;IAC5G,IAAM,aAAa,GAAG,eAAe,IAAI,OAAO,MAAM,CAAC,SAAS,CAAC,UAAU,KAAK,UAAU,CAAC;IAE3F,IAAI,aAAa,EAAE;QACjB,wHAAwH;QACxH,IAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACtE,OAAO,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;KAC9B;IAED,IAAI,qBAAa,EAAE,EAAE;QACnB,IAAM,OAAK,GAAG,4BAA4B,EAAE,CAAC;QAC7C,OAAO,cAAM,CACX,OAAK,CAAC,GAAG,EAAE;YACT,IAAI,MAAA;YACJ,MAAM,EAAE,MAAM;YACd,WAAW,EAAE,MAAM;YACnB,SAAS,EAAE,IAAI;SAChB,CAAC,CACH,CAAC;KACH;AACH,CAAC;AArBD,gCAqBC","sourcesContent":["import { forget, 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 return sendBeacon(url, body);\n }\n\n if (supportsFetch()) {\n const fetch = getNativeFetchImplementation();\n return forget(\n fetch(url, {\n body,\n method: 'POST',\n credentials: 'omit',\n keepalive: true,\n }),\n );\n }\n}\n"]}
|
package/dist/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/dist/transports/xhr.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
var tslib_1 = require("tslib");
|
|
3
|
-
var utils_1 = require("@sentry/utils");
|
|
4
|
-
var base_1 = require("./base");
|
|
5
|
-
/** `XHR` based transport */
|
|
6
|
-
var XHRTransport = /** @class */ (function (_super) {
|
|
7
|
-
tslib_1.__extends(XHRTransport, _super);
|
|
8
|
-
function XHRTransport() {
|
|
9
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* @param sentryRequest Prepared SentryRequest to be delivered
|
|
13
|
-
* @param originalPayload Original payload used to create SentryRequest
|
|
14
|
-
*/
|
|
15
|
-
XHRTransport.prototype._sendRequest = function (sentryRequest, originalPayload) {
|
|
16
|
-
var _this = this;
|
|
17
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
18
|
-
if (this._isRateLimited(sentryRequest.type)) {
|
|
19
|
-
this.recordLostEvent('ratelimit_backoff', sentryRequest.type);
|
|
20
|
-
return Promise.reject({
|
|
21
|
-
event: originalPayload,
|
|
22
|
-
type: sentryRequest.type,
|
|
23
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
24
|
-
reason: "Transport for " + sentryRequest.type + " requests locked till " + this._disabledUntil(sentryRequest.type) + " due to too many requests.",
|
|
25
|
-
status: 429,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
return this._buffer
|
|
29
|
-
.add(function () {
|
|
30
|
-
return new utils_1.SyncPromise(function (resolve, reject) {
|
|
31
|
-
var request = new XMLHttpRequest();
|
|
32
|
-
request.onreadystatechange = function () {
|
|
33
|
-
if (request.readyState === 4) {
|
|
34
|
-
var headers = {
|
|
35
|
-
'x-sentry-rate-limits': request.getResponseHeader('X-Sentry-Rate-Limits'),
|
|
36
|
-
'retry-after': request.getResponseHeader('Retry-After'),
|
|
37
|
-
};
|
|
38
|
-
_this._handleResponse({ requestType: sentryRequest.type, response: request, headers: headers, resolve: resolve, reject: reject });
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
request.open('POST', sentryRequest.url);
|
|
42
|
-
for (var header in _this.options.headers) {
|
|
43
|
-
if (Object.prototype.hasOwnProperty.call(_this.options.headers, header)) {
|
|
44
|
-
request.setRequestHeader(header, _this.options.headers[header]);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
request.send(sentryRequest.body);
|
|
48
|
-
});
|
|
49
|
-
})
|
|
50
|
-
.then(undefined, function (reason) {
|
|
51
|
-
// It's either buffer rejection or any other xhr/fetch error, which are treated as NetworkError.
|
|
52
|
-
if (reason instanceof utils_1.SentryError) {
|
|
53
|
-
_this.recordLostEvent('queue_overflow', sentryRequest.type);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
_this.recordLostEvent('network_error', sentryRequest.type);
|
|
57
|
-
}
|
|
58
|
-
throw reason;
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
return XHRTransport;
|
|
62
|
-
}(base_1.BaseTransport));
|
|
63
|
-
exports.XHRTransport = XHRTransport;
|
|
64
|
-
//# sourceMappingURL=xhr.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xhr.js","sourceRoot":"","sources":["../../../../src/transports/xhr.ts"],"names":[],"mappings":";;AACA,uCAAyD;AAEzD,+BAAuC;AAEvC,4BAA4B;AAC5B;IAAkC,wCAAa;IAA/C;;IAwDA,CAAC;IAvDC;;;OAGG;IACO,mCAAY,GAAtB,UAAuB,aAA4B,EAAE,eAAgC;QAArF,iBAkDC;QAjDC,mDAAmD;QACnD,IAAI,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE;YAC3C,IAAI,CAAC,eAAe,CAAC,mBAAmB,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;YAE9D,OAAO,OAAO,CAAC,MAAM,CAAC;gBACpB,KAAK,EAAE,eAAe;gBACtB,IAAI,EAAE,aAAa,CAAC,I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L;aACA,IAAI,CAAC,SAAS,EAAE,UAAA,MAAM;YACrB,gGAAgG;YAChG,IAAI,MAAM,YAAY,mBAAW,EAAE;gBACjC,KAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;aAC5D;iBAAM;gBACL,KAAI,CAAC,eAAe,CAAC,eAAe,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;aAC3D;YACD,MAAM,MAAM,CAAC;QACf,CAAC,CAAC,CAAC;IACP,CAAC;IACH,mBAAC;AAAD,CAAC,AAxDD,CAAkC,oBAAa,GAwD9C;AAxDY,oCAAY","sourcesContent":["import { Event, Response, SentryRequest, Session } from '@sentry/types';\nimport { SentryError, SyncPromise } from '@sentry/utils';\n\nimport { BaseTransport } from './base';\n\n/** `XHR` based transport */\nexport class XHRTransport extends BaseTransport {\n /**\n * @param sentryRequest Prepared SentryRequest to be delivered\n * @param originalPayload Original payload used to create SentryRequest\n */\n protected _sendRequest(sentryRequest: SentryRequest, originalPayload: Event | Session): PromiseLike<Response> {\n // eslint-disable-next-line deprecation/deprecation\n if (this._isRateLimited(sentryRequest.type)) {\n this.recordLostEvent('ratelimit_backoff', sentryRequest.type);\n\n return Promise.reject({\n event: originalPayload,\n type: sentryRequest.type,\n // eslint-disable-next-line deprecation/deprecation\n reason: `Transport for ${sentryRequest.type} requests locked till ${this._disabledUntil(\n sentryRequest.type,\n )} due to too many requests.`,\n status: 429,\n });\n }\n\n return this._buffer\n .add(\n () =>\n new SyncPromise<Response>((resolve, reject) => {\n const request = new XMLHttpRequest();\n\n request.onreadystatechange = (): void => {\n if (request.readyState === 4) {\n const headers = {\n 'x-sentry-rate-limits': request.getResponseHeader('X-Sentry-Rate-Limits'),\n 'retry-after': request.getResponseHeader('Retry-After'),\n };\n this._handleResponse({ requestType: sentryRequest.type, response: request, headers, resolve, reject });\n }\n };\n\n request.open('POST', sentryRequest.url);\n for (const header in this.options.headers) {\n if (Object.prototype.hasOwnProperty.call(this.options.headers, header)) {\n request.setRequestHeader(header, this.options.headers[header]);\n }\n }\n request.send(sentryRequest.body);\n }),\n )\n .then(undefined, reason => {\n // It's either buffer rejection or any other xhr/fetch error, which are treated as NetworkError.\n if (reason instanceof SentryError) {\n this.recordLostEvent('queue_overflow', sentryRequest.type);\n } else {\n this.recordLostEvent('network_error', sentryRequest.type);\n }\n throw reason;\n });\n }\n}\n"]}
|
package/esm/backend.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { BaseBackend } from '@sentry/core';
|
|
2
|
-
import { Event, EventHint, Options, Severity, Transport } from '@sentry/types';
|
|
3
|
-
/**
|
|
4
|
-
* Configuration options for the Sentry Browser SDK.
|
|
5
|
-
* @see BrowserClient for more information.
|
|
6
|
-
*/
|
|
7
|
-
export interface BrowserOptions extends Options {
|
|
8
|
-
/**
|
|
9
|
-
* A pattern for error URLs which should exclusively be sent to Sentry.
|
|
10
|
-
* This is the opposite of {@link Options.denyUrls}.
|
|
11
|
-
* By default, all errors will be sent.
|
|
12
|
-
*/
|
|
13
|
-
allowUrls?: Array<string | RegExp>;
|
|
14
|
-
/**
|
|
15
|
-
* A pattern for error URLs which should not be sent to Sentry.
|
|
16
|
-
* To allow certain errors instead, use {@link Options.allowUrls}.
|
|
17
|
-
* By default, all errors will be sent.
|
|
18
|
-
*/
|
|
19
|
-
denyUrls?: Array<string | RegExp>;
|
|
20
|
-
/** @deprecated use {@link Options.allowUrls} instead. */
|
|
21
|
-
whitelistUrls?: Array<string | RegExp>;
|
|
22
|
-
/** @deprecated use {@link Options.denyUrls} instead. */
|
|
23
|
-
blacklistUrls?: Array<string | RegExp>;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* The Sentry Browser SDK Backend.
|
|
27
|
-
* @hidden
|
|
28
|
-
*/
|
|
29
|
-
export declare class BrowserBackend extends BaseBackend<BrowserOptions> {
|
|
30
|
-
/**
|
|
31
|
-
* @inheritDoc
|
|
32
|
-
*/
|
|
33
|
-
eventFromException(exception: unknown, hint?: EventHint): PromiseLike<Event>;
|
|
34
|
-
/**
|
|
35
|
-
* @inheritDoc
|
|
36
|
-
*/
|
|
37
|
-
eventFromMessage(message: string, level?: Severity, hint?: EventHint): PromiseLike<Event>;
|
|
38
|
-
/**
|
|
39
|
-
* @inheritDoc
|
|
40
|
-
*/
|
|
41
|
-
protected _setupTransport(): Transport;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=backend.d.ts.map
|
package/esm/backend.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../../src/backend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAyD,MAAM,cAAc,CAAC;AAClG,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAoB,MAAM,eAAe,CAAC;AAMjG;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,OAAO;IAC7C;;;;OAIG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAEnC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAElC,yDAAyD;IACzD,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAEvC,wDAAwD;IACxD,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;CACxC;AAED;;;GAGG;AACH,qBAAa,cAAe,SAAQ,WAAW,CAAC,cAAc,CAAC;IAC7D;;OAEG;IACI,kBAAkB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAGnF;;OAEG;IACI,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,QAAwB,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAI/G;;OAEG;IACH,SAAS,CAAC,eAAe,IAAI,SAAS;CAgCvC"}
|
package/esm/backend.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { __assign, __extends } from "tslib";
|
|
2
|
-
import { BaseBackend, getEnvelopeEndpointWithUrlEncodedAuth, initAPIDetails } from '@sentry/core';
|
|
3
|
-
import { Severity } from '@sentry/types';
|
|
4
|
-
import { supportsFetch } from '@sentry/utils';
|
|
5
|
-
import { eventFromException, eventFromMessage } from './eventbuilder';
|
|
6
|
-
import { FetchTransport, makeNewFetchTransport, makeNewXHRTransport, XHRTransport } from './transports';
|
|
7
|
-
/**
|
|
8
|
-
* The Sentry Browser SDK Backend.
|
|
9
|
-
* @hidden
|
|
10
|
-
*/
|
|
11
|
-
var BrowserBackend = /** @class */ (function (_super) {
|
|
12
|
-
__extends(BrowserBackend, _super);
|
|
13
|
-
function BrowserBackend() {
|
|
14
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* @inheritDoc
|
|
18
|
-
*/
|
|
19
|
-
BrowserBackend.prototype.eventFromException = function (exception, hint) {
|
|
20
|
-
return eventFromException(exception, hint, this._options.attachStacktrace);
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* @inheritDoc
|
|
24
|
-
*/
|
|
25
|
-
BrowserBackend.prototype.eventFromMessage = function (message, level, hint) {
|
|
26
|
-
if (level === void 0) { level = Severity.Info; }
|
|
27
|
-
return eventFromMessage(message, level, hint, this._options.attachStacktrace);
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* @inheritDoc
|
|
31
|
-
*/
|
|
32
|
-
BrowserBackend.prototype._setupTransport = function () {
|
|
33
|
-
if (!this._options.dsn) {
|
|
34
|
-
// We return the noop transport here in case there is no Dsn.
|
|
35
|
-
return _super.prototype._setupTransport.call(this);
|
|
36
|
-
}
|
|
37
|
-
var transportOptions = __assign(__assign({}, this._options.transportOptions), { dsn: this._options.dsn, tunnel: this._options.tunnel, sendClientReports: this._options.sendClientReports, _metadata: this._options._metadata });
|
|
38
|
-
var api = initAPIDetails(transportOptions.dsn, transportOptions._metadata, transportOptions.tunnel);
|
|
39
|
-
var url = getEnvelopeEndpointWithUrlEncodedAuth(api.dsn, api.tunnel);
|
|
40
|
-
if (this._options.transport) {
|
|
41
|
-
return new this._options.transport(transportOptions);
|
|
42
|
-
}
|
|
43
|
-
if (supportsFetch()) {
|
|
44
|
-
var requestOptions = __assign({}, transportOptions.fetchParameters);
|
|
45
|
-
this._newTransport = makeNewFetchTransport({ requestOptions: requestOptions, url: url });
|
|
46
|
-
return new FetchTransport(transportOptions);
|
|
47
|
-
}
|
|
48
|
-
this._newTransport = makeNewXHRTransport({
|
|
49
|
-
url: url,
|
|
50
|
-
headers: transportOptions.headers,
|
|
51
|
-
});
|
|
52
|
-
return new XHRTransport(transportOptions);
|
|
53
|
-
};
|
|
54
|
-
return BrowserBackend;
|
|
55
|
-
}(BaseBackend));
|
|
56
|
-
export { BrowserBackend };
|
|
57
|
-
//# sourceMappingURL=backend.js.map
|
package/esm/backend.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../../../src/backend.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,qCAAqC,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAClG,OAAO,EAA6B,QAAQ,EAA+B,MAAM,eAAe,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AA4BxG;;;GAGG;AACH;IAAoC,kCAA2B;IAA/D;;IAiDA,CAAC;IAhDC;;O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B,CAAC,eAAe,CAAE,CAAC;YAC5E,IAAI,CAAC,aAAa,GAAG,qBAAqB,CAAC,EAAE,cAAc,gBAAA,EAAE,GAAG,KAAA,EAAE,CAAC,CAAC;YACpE,OAAO,IAAI,cAAc,CAAC,gBAAgB,CAAC,CAAC;SAC7C;QAED,IAAI,CAAC,aAAa,GAAG,mBAAmB,CAAC;YACvC,GAAG,KAAA;YACH,OAAO,EAAE,gBAAgB,CAAC,OAAO;SAClC,CAAC,CAAC;QACH,OAAO,IAAI,YAAY,CAAC,gBAAgB,CAAC,CAAC;IAC5C,CAAC;IACH,qBAAC;AAAD,CAAC,AAjDD,CAAoC,WAAW,GAiD9C","sourcesContent":["import { BaseBackend, getEnvelopeEndpointWithUrlEncodedAuth, initAPIDetails } from '@sentry/core';\nimport { Event, EventHint, Options, Severity, Transport, TransportOptions } from '@sentry/types';\nimport { supportsFetch } from '@sentry/utils';\n\nimport { eventFromException, eventFromMessage } from './eventbuilder';\nimport { FetchTransport, makeNewFetchTransport, makeNewXHRTransport, XHRTransport } from './transports';\n\n/**\n * Configuration options for the Sentry Browser SDK.\n * @see BrowserClient for more information.\n */\nexport interface BrowserOptions extends Options {\n /**\n * A pattern for error URLs which should exclusively be sent to Sentry.\n * This is the opposite of {@link Options.denyUrls}.\n * By default, all errors will be sent.\n */\n allowUrls?: Array<string | RegExp>;\n\n /**\n * A pattern for error URLs which should not be sent to Sentry.\n * To allow certain errors instead, use {@link Options.allowUrls}.\n * By default, all errors will be sent.\n */\n denyUrls?: Array<string | RegExp>;\n\n /** @deprecated use {@link Options.allowUrls} instead. */\n whitelistUrls?: Array<string | RegExp>;\n\n /** @deprecated use {@link Options.denyUrls} instead. */\n blacklistUrls?: Array<string | RegExp>;\n}\n\n/**\n * The Sentry Browser SDK Backend.\n * @hidden\n */\nexport class BrowserBackend extends BaseBackend<BrowserOptions> {\n /**\n * @inheritDoc\n */\n public eventFromException(exception: unknown, hint?: EventHint): PromiseLike<Event> {\n return eventFromException(exception, hint, this._options.attachStacktrace);\n }\n /**\n * @inheritDoc\n */\n public eventFromMessage(message: string, level: Severity = Severity.Info, hint?: EventHint): PromiseLike<Event> {\n return eventFromMessage(message, level, hint, this._options.attachStacktrace);\n }\n\n /**\n * @inheritDoc\n */\n protected _setupTransport(): Transport {\n if (!this._options.dsn) {\n // We return the noop transport here in case there is no Dsn.\n return super._setupTransport();\n }\n\n const transportOptions: TransportOptions = {\n ...this._options.transportOptions,\n dsn: this._options.dsn,\n tunnel: this._options.tunnel,\n sendClientReports: this._options.sendClientReports,\n _metadata: this._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 (this._options.transport) {\n return new this._options.transport(transportOptions);\n }\n if (supportsFetch()) {\n const requestOptions: RequestInit = { ...transportOptions.fetchParameters };\n this._newTransport = makeNewFetchTransport({ requestOptions, url });\n return new FetchTransport(transportOptions);\n }\n\n this._newTransport = makeNewXHRTransport({\n url,\n headers: transportOptions.headers,\n });\n return new XHRTransport(transportOptions);\n }\n}\n"]}
|
package/esm/transports/base.d.ts
DELETED
|
@@ -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"}
|
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], (_a !== 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,aAAa,EACb,WAAW,EACX,uBAAuB,EACvB,eAAe,EACf,aAAa,EACb,MAAM,EACN,iBAAiB,EAGjB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,SAAS,qBAAqB,CAAC,EAAqB;IAClD,IAAM,KAAK,GAAG,EAAY,CAAC;IAC3B,OAAO,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AAC7C,CAAC;AAED,IAAM,MAAM,GAAG,eAAe,EAAU,CAAC;AAEzC,0CAA0C;AAC1C;IAiBE,uBAA0B,OAAyB;QAAnD,iBAYC;QAZyB,YAAO,GAAP,OAAO,CAAkB;QARnD,4CAA4C;QACzB,YAAO,GAAkC,iBAAiB,CAAC,EAAE,CAAC,CAAC;QAElF,gEAAgE;QACtD,gBAAW,GAAe,EAAE,CAAC;QAE7B,cAAS,GAA8B,EAAE,CAAC;QAGlD,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,OA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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 +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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-xhr.js","sourceRoot":"","sources":["../../../../src/transports/new-xhr.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,GAIhB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;;;;GAOG;AACH,IAAM,mBAAmB,GAAG,CAAC,CAAC;AAM9B;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAA4B;IAC9D,SAAS,WAAW,CAAC,OAAyB;QAC5C,OAAO,IAAI,WAAW,CAA+B,UAAC,OAAO,EAAE,OAAO;YACpE,IAAM,GAAG,GAAG,IAAI,cAAc,EAAE,CAAC;YAEjC,GAAG,CAAC,kBAAkB,GAAG;gBACvB,IAAI,GAAG,CAAC,UAAU,KAAK,mBAAmB,EAAE;oBAC1C,IAAM,QAAQ,GAAG;wBACf,IAAI,EAAE,GAAG,CAAC,QAAQ;wBAClB,OAAO,EAAE;4BACP,sBAAsB,EAAE,GAAG,CAAC,iBAAiB,CAAC,sBAAsB,CAAC;4BACrE,aAAa,EAAE,GAAG,CAAC,iBAAiB,CAAC,aAAa,CAAC;yBACpD;wBACD,MAAM,EAAE,GAAG,CAAC,UAAU;wBACtB,UAAU,EAAE,GAAG,CAAC,MAAM;qBACvB,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,IAAM,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,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"]}
|
package/types/backend.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { BaseBackend } from '@sentry/core';
|
|
2
|
-
import { Event, EventHint, Options, Severity, Transport } from '@sentry/types';
|
|
3
|
-
/**
|
|
4
|
-
* Configuration options for the Sentry Browser SDK.
|
|
5
|
-
* @see BrowserClient for more information.
|
|
6
|
-
*/
|
|
7
|
-
export interface BrowserOptions extends Options {
|
|
8
|
-
/**
|
|
9
|
-
* A pattern for error URLs which should exclusively be sent to Sentry.
|
|
10
|
-
* This is the opposite of {@link Options.denyUrls}.
|
|
11
|
-
* By default, all errors will be sent.
|
|
12
|
-
*/
|
|
13
|
-
allowUrls?: Array<string | RegExp>;
|
|
14
|
-
/**
|
|
15
|
-
* A pattern for error URLs which should not be sent to Sentry.
|
|
16
|
-
* To allow certain errors instead, use {@link Options.allowUrls}.
|
|
17
|
-
* By default, all errors will be sent.
|
|
18
|
-
*/
|
|
19
|
-
denyUrls?: Array<string | RegExp>;
|
|
20
|
-
/** @deprecated use {@link Options.allowUrls} instead. */
|
|
21
|
-
whitelistUrls?: Array<string | RegExp>;
|
|
22
|
-
/** @deprecated use {@link Options.denyUrls} instead. */
|
|
23
|
-
blacklistUrls?: Array<string | RegExp>;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* The Sentry Browser SDK Backend.
|
|
27
|
-
* @hidden
|
|
28
|
-
*/
|
|
29
|
-
export declare class BrowserBackend extends BaseBackend<BrowserOptions> {
|
|
30
|
-
/**
|
|
31
|
-
* @inheritDoc
|
|
32
|
-
*/
|
|
33
|
-
eventFromException(exception: unknown, hint?: EventHint): PromiseLike<Event>;
|
|
34
|
-
/**
|
|
35
|
-
* @inheritDoc
|
|
36
|
-
*/
|
|
37
|
-
eventFromMessage(message: string, level?: Severity, hint?: EventHint): PromiseLike<Event>;
|
|
38
|
-
/**
|
|
39
|
-
* @inheritDoc
|
|
40
|
-
*/
|
|
41
|
-
protected _setupTransport(): Transport;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=backend.d.ts.map
|
package/types/backend.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../../src/backend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAyD,MAAM,cAAc,CAAC;AAClG,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAoB,MAAM,eAAe,CAAC;AAMjG;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,OAAO;IAC7C;;;;OAIG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAEnC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAElC,yDAAyD;IACzD,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAEvC,wDAAwD;IACxD,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;CACxC;AAED;;;GAGG;AACH,qBAAa,cAAe,SAAQ,WAAW,CAAC,cAAc,CAAC;IAC7D;;OAEG;IACI,kBAAkB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAGnF;;OAEG;IACI,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,QAAwB,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAI/G;;OAEG;IACH,SAAS,CAAC,eAAe,IAAI,SAAS;CAgCvC"}
|