sentry-uniapp 1.0.11 → 2.8.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/README.md +112 -143
- package/dist/client.d.ts +38 -40
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +46 -38
- package/dist/client.js.map +1 -1
- package/dist/crossPlatform.d.ts +1 -1
- package/dist/crossPlatform.js +11 -10
- package/dist/crossPlatform.js.map +1 -1
- package/dist/eventbuilder.d.ts +9 -10
- package/dist/eventbuilder.d.ts.map +1 -1
- package/dist/eventbuilder.js +131 -58
- package/dist/eventbuilder.js.map +1 -1
- package/dist/flags.js +1 -0
- package/dist/flags.js.map +1 -1
- package/dist/index.d.ts +10 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +84 -21
- package/dist/index.js.map +1 -1
- package/dist/integrations/globalhandlers.d.ts +10 -44
- package/dist/integrations/globalhandlers.d.ts.map +1 -1
- package/dist/integrations/globalhandlers.js +101 -134
- package/dist/integrations/globalhandlers.js.map +1 -1
- package/dist/integrations/ignoreMpcrawlerErrors.d.ts +3 -18
- package/dist/integrations/ignoreMpcrawlerErrors.d.ts.map +1 -1
- package/dist/integrations/ignoreMpcrawlerErrors.js +28 -28
- package/dist/integrations/ignoreMpcrawlerErrors.js.map +1 -1
- package/dist/integrations/index.d.ts +4 -6
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +12 -10
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/router.d.ts +6 -24
- package/dist/integrations/router.d.ts.map +1 -1
- package/dist/integrations/router.js +39 -42
- package/dist/integrations/router.js.map +1 -1
- package/dist/integrations/system.d.ts +5 -16
- package/dist/integrations/system.d.ts.map +1 -1
- package/dist/integrations/system.js +62 -60
- package/dist/integrations/system.js.map +1 -1
- package/dist/parsers.d.ts +2 -2
- package/dist/parsers.d.ts.map +1 -1
- package/dist/parsers.js +27 -26
- package/dist/parsers.js.map +1 -1
- package/dist/sdk.d.ts +9 -85
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +55 -129
- package/dist/sdk.js.map +1 -1
- package/dist/tracekit.js +35 -33
- package/dist/tracekit.js.map +1 -1
- package/dist/transport.d.ts +7 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +45 -0
- package/dist/transport.js.map +1 -0
- package/dist/transports/index.d.ts +1 -2
- package/dist/transports/index.d.ts.map +1 -1
- package/dist/transports/index.js +4 -4
- package/dist/transports/index.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +2 -1
- package/dist/version.js.map +1 -1
- package/esm/client.d.ts +38 -40
- package/esm/client.d.ts.map +1 -1
- package/esm/client.js +43 -37
- package/esm/client.js.map +1 -1
- package/esm/crossPlatform.d.ts +1 -1
- package/esm/crossPlatform.js +10 -10
- package/esm/crossPlatform.js.map +1 -1
- package/esm/eventbuilder.d.ts +9 -10
- package/esm/eventbuilder.d.ts.map +1 -1
- package/esm/eventbuilder.js +125 -52
- package/esm/eventbuilder.js.map +1 -1
- package/esm/flags.js +1 -1
- package/esm/flags.js.map +1 -1
- package/esm/index.d.ts +10 -9
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +13 -8
- package/esm/index.js.map +1 -1
- package/esm/integrations/globalhandlers.d.ts +10 -44
- package/esm/integrations/globalhandlers.d.ts.map +1 -1
- package/esm/integrations/globalhandlers.js +99 -133
- package/esm/integrations/globalhandlers.js.map +1 -1
- package/esm/integrations/ignoreMpcrawlerErrors.d.ts +3 -18
- package/esm/integrations/ignoreMpcrawlerErrors.d.ts.map +1 -1
- package/esm/integrations/ignoreMpcrawlerErrors.js +25 -26
- package/esm/integrations/ignoreMpcrawlerErrors.js.map +1 -1
- package/esm/integrations/index.d.ts +4 -6
- package/esm/integrations/index.d.ts.map +1 -1
- package/esm/integrations/index.js +5 -6
- package/esm/integrations/index.js.map +1 -1
- package/esm/integrations/router.d.ts +6 -24
- package/esm/integrations/router.d.ts.map +1 -1
- package/esm/integrations/router.js +37 -41
- package/esm/integrations/router.js.map +1 -1
- package/esm/integrations/system.d.ts +5 -16
- package/esm/integrations/system.d.ts.map +1 -1
- package/esm/integrations/system.js +60 -59
- package/esm/integrations/system.js.map +1 -1
- package/esm/parsers.d.ts +2 -2
- package/esm/parsers.d.ts.map +1 -1
- package/esm/parsers.js +20 -19
- package/esm/parsers.js.map +1 -1
- package/esm/sdk.d.ts +9 -85
- package/esm/sdk.d.ts.map +1 -1
- package/esm/sdk.js +49 -122
- package/esm/sdk.js.map +1 -1
- package/esm/tracekit.js +33 -31
- package/esm/tracekit.js.map +1 -1
- package/esm/transport.d.ts +7 -0
- package/esm/transport.d.ts.map +1 -0
- package/esm/transport.js +41 -0
- package/esm/transport.js.map +1 -0
- package/esm/transports/index.d.ts +1 -2
- package/esm/transports/index.d.ts.map +1 -1
- package/esm/transports/index.js +1 -2
- package/esm/transports/index.js.map +1 -1
- package/esm/version.d.ts +1 -1
- package/esm/version.d.ts.map +1 -1
- package/esm/version.js +2 -2
- package/esm/version.js.map +1 -1
- package/package.json +24 -28
- package/dist/backend.d.ts +0 -41
- package/dist/backend.d.ts.map +0 -1
- package/dist/backend.js +0 -68
- package/dist/backend.js.map +0 -1
- package/dist/helpers.d.ts +0 -35
- package/dist/helpers.d.ts.map +0 -1
- package/dist/helpers.js +0 -236
- package/dist/helpers.js.map +0 -1
- package/dist/integrations/linkederrors.d.ts +0 -40
- package/dist/integrations/linkederrors.d.ts.map +0 -1
- package/dist/integrations/linkederrors.js +0 -65
- package/dist/integrations/linkederrors.js.map +0 -1
- package/dist/integrations/trycatch.d.ts +0 -26
- package/dist/integrations/trycatch.d.ts.map +0 -1
- package/dist/integrations/trycatch.js +0 -166
- package/dist/integrations/trycatch.js.map +0 -1
- package/dist/sentry-uniapp.min.js +0 -17
- package/dist/sentry-uniapp.min.js.map +0 -1
- package/dist/transports/base.d.ts +0 -22
- package/dist/transports/base.d.ts.map +0 -1
- package/dist/transports/base.js +0 -28
- package/dist/transports/base.js.map +0 -1
- package/dist/transports/xhr.d.ts +0 -10
- package/dist/transports/xhr.d.ts.map +0 -1
- package/dist/transports/xhr.js +0 -42
- package/dist/transports/xhr.js.map +0 -1
- package/esm/backend.d.ts +0 -41
- package/esm/backend.d.ts.map +0 -1
- package/esm/backend.js +0 -66
- package/esm/backend.js.map +0 -1
- package/esm/helpers.d.ts +0 -35
- package/esm/helpers.d.ts.map +0 -1
- package/esm/helpers.js +0 -229
- package/esm/helpers.js.map +0 -1
- package/esm/integrations/linkederrors.d.ts +0 -40
- package/esm/integrations/linkederrors.d.ts.map +0 -1
- package/esm/integrations/linkederrors.js +0 -63
- package/esm/integrations/linkederrors.js.map +0 -1
- package/esm/integrations/trycatch.d.ts +0 -26
- package/esm/integrations/trycatch.d.ts.map +0 -1
- package/esm/integrations/trycatch.js +0 -164
- package/esm/integrations/trycatch.js.map +0 -1
- package/esm/transports/base.d.ts +0 -22
- package/esm/transports/base.d.ts.map +0 -1
- package/esm/transports/base.js +0 -26
- package/esm/transports/base.js.map +0 -1
- package/esm/transports/xhr.d.ts +0 -10
- package/esm/transports/xhr.d.ts.map +0 -1
- package/esm/transports/xhr.js +0 -40
- package/esm/transports/xhr.js.map +0 -1
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Event, Response, Transport, TransportOptions } from "@sentry/types";
|
|
2
|
-
import { PromiseBuffer } from "@sentry/utils";
|
|
3
|
-
/** Base Transport class implementation */
|
|
4
|
-
export declare abstract class BaseTransport implements Transport {
|
|
5
|
-
options: TransportOptions;
|
|
6
|
-
/**
|
|
7
|
-
* @inheritDoc
|
|
8
|
-
*/
|
|
9
|
-
url: string;
|
|
10
|
-
/** A simple buffer holding all requests. */
|
|
11
|
-
protected readonly _buffer: PromiseBuffer<Response>;
|
|
12
|
-
constructor(options: TransportOptions);
|
|
13
|
-
/**
|
|
14
|
-
* @inheritDoc
|
|
15
|
-
*/
|
|
16
|
-
sendEvent(_: Event): PromiseLike<Response>;
|
|
17
|
-
/**
|
|
18
|
-
* @inheritDoc
|
|
19
|
-
*/
|
|
20
|
-
close(timeout?: number): PromiseLike<boolean>;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=base.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/transports/base.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAqB,aAAa,EAAe,MAAM,eAAe,CAAC;AAE9E,0CAA0C;AAC1C,8BAAsB,aAAc,YAAW,SAAS;IAS5B,OAAO,EAAE,gBAAgB;IARnD;;OAEG;IACI,GAAG,EAAE,MAAM,CAAC;IAEnB,4CAA4C;IAC5C,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAyB;gBAElD,OAAO,EAAE,gBAAgB;IAInD;;OAEG;IACI,SAAS,CAAC,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,QAAQ,CAAC;IAMjD;;OAEG;IACI,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC;CAGrD"}
|
package/dist/transports/base.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.BaseTransport = void 0;
|
|
3
|
-
var core_1 = require("@sentry/core");
|
|
4
|
-
var utils_1 = require("@sentry/utils");
|
|
5
|
-
/** Base Transport class implementation */
|
|
6
|
-
var BaseTransport = /** @class */ (function () {
|
|
7
|
-
function BaseTransport(options) {
|
|
8
|
-
this.options = options;
|
|
9
|
-
/** A simple buffer holding all requests. */
|
|
10
|
-
this._buffer = utils_1.makePromiseBuffer(30);
|
|
11
|
-
this.url = new core_1.API(this.options.dsn).getStoreEndpointWithUrlEncodedAuth();
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* @inheritDoc
|
|
15
|
-
*/
|
|
16
|
-
BaseTransport.prototype.sendEvent = function (_) {
|
|
17
|
-
throw new utils_1.SentryError("Transport Class has to implement `sendEvent` method");
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* @inheritDoc
|
|
21
|
-
*/
|
|
22
|
-
BaseTransport.prototype.close = function (timeout) {
|
|
23
|
-
return this._buffer.drain(timeout);
|
|
24
|
-
};
|
|
25
|
-
return BaseTransport;
|
|
26
|
-
}());
|
|
27
|
-
exports.BaseTransport = BaseTransport;
|
|
28
|
-
//# sourceMappingURL=base.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/transports/base.ts"],"names":[],"mappings":";;AAAA,qCAAmC;AAEnC,uCAA8E;AAE9E,0CAA0C;AAC1C;IASE,uBAA0B,OAAyB;QAAzB,YAAO,GAAP,OAAO,CAAkB;QAHnD,4CAA4C;QACzB,YAAO,GAA4B,yBAAiB,CAAC,EAAE,CAAC,CAAC;QAG1E,IAAI,CAAC,GAAG,GAAG,IAAI,UAAG,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,kCAAkC,EAAE,CAAC;IAC5E,CAAC;IAED;;OAEG;IACI,iCAAS,GAAhB,UAAiB,CAAQ;QACvB,MAAM,IAAI,mBAAW,CACnB,qDAAqD,CACtD,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,6BAAK,GAAZ,UAAa,OAAgB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IACH,oBAAC;AAAD,CAAC,AA5BD,IA4BC;AA5BqB,sCAAa","sourcesContent":["import { API } from \"@sentry/core\";\nimport { Event, Response, Transport, TransportOptions } from \"@sentry/types\";\nimport { makePromiseBuffer, PromiseBuffer, SentryError } from \"@sentry/utils\";\n\n/** Base Transport class implementation */\nexport abstract class BaseTransport implements Transport {\n /**\n * @inheritDoc\n */\n public url: string;\n\n /** A simple buffer holding all requests. */\n protected readonly _buffer: PromiseBuffer<Response> = makePromiseBuffer(30);\n\n public constructor(public options: TransportOptions) {\n this.url = new API(this.options.dsn).getStoreEndpointWithUrlEncodedAuth();\n }\n\n /**\n * @inheritDoc\n */\n public sendEvent(_: Event): PromiseLike<Response> {\n throw new SentryError(\n \"Transport Class has to implement `sendEvent` method\"\n );\n }\n\n /**\n * @inheritDoc\n */\n public close(timeout?: number): PromiseLike<boolean> {\n return this._buffer.drain(timeout);\n }\n}\n"]}
|
package/dist/transports/xhr.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Event, Response } from "@sentry/types";
|
|
2
|
-
import { BaseTransport } from "./base";
|
|
3
|
-
/** `XHR` based transport */
|
|
4
|
-
export declare class XHRTransport extends BaseTransport {
|
|
5
|
-
/**
|
|
6
|
-
* @inheritDoc
|
|
7
|
-
*/
|
|
8
|
-
sendEvent(event: Event): PromiseLike<Response>;
|
|
9
|
-
}
|
|
10
|
-
//# 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,MAAM,eAAe,CAAC;AAKhD,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,4BAA4B;AAC5B,qBAAa,YAAa,SAAQ,aAAa;IAC7C;;OAEG;IACI,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,CAAC,QAAQ,CAAC;CAyBtD"}
|
package/dist/transports/xhr.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.XHRTransport = void 0;
|
|
3
|
-
var tslib_1 = require("tslib");
|
|
4
|
-
var utils_1 = require("@sentry/utils");
|
|
5
|
-
var crossPlatform_1 = require("../crossPlatform");
|
|
6
|
-
var base_1 = require("./base");
|
|
7
|
-
/** `XHR` based transport */
|
|
8
|
-
var XHRTransport = /** @class */ (function (_super) {
|
|
9
|
-
tslib_1.__extends(XHRTransport, _super);
|
|
10
|
-
function XHRTransport() {
|
|
11
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* @inheritDoc
|
|
15
|
-
*/
|
|
16
|
-
XHRTransport.prototype.sendEvent = function (event) {
|
|
17
|
-
var _this = this;
|
|
18
|
-
var request = crossPlatform_1.sdk.request || crossPlatform_1.sdk.httpRequest;
|
|
19
|
-
return this._buffer.add(function () { return new Promise(function (resolve, reject) {
|
|
20
|
-
// tslint:disable-next-line: no-unsafe-any
|
|
21
|
-
request({
|
|
22
|
-
url: _this.url,
|
|
23
|
-
method: "POST",
|
|
24
|
-
data: JSON.stringify(event),
|
|
25
|
-
header: {
|
|
26
|
-
"content-type": "application/json"
|
|
27
|
-
},
|
|
28
|
-
success: function (res) {
|
|
29
|
-
resolve({
|
|
30
|
-
status: utils_1.eventStatusFromHttpCode(res.statusCode)
|
|
31
|
-
});
|
|
32
|
-
},
|
|
33
|
-
fail: function (error) {
|
|
34
|
-
reject(error);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}); });
|
|
38
|
-
};
|
|
39
|
-
return XHRTransport;
|
|
40
|
-
}(base_1.BaseTransport));
|
|
41
|
-
exports.XHRTransport = XHRTransport;
|
|
42
|
-
//# sourceMappingURL=xhr.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xhr.js","sourceRoot":"","sources":["../../src/transports/xhr.ts"],"names":[],"mappings":";;;AACA,uCAAwD;AAExD,kDAAuC;AAEvC,+BAAuC;AAEvC,4BAA4B;AAC5B;IAAkC,wCAAa;IAA/C;;IA6BA,CAAC;IA5BC;;OAEG;IACI,gCAAS,GAAhB,UAAiB,KAAY;QAA7B,iBAwBC;QAvBC,IAAM,OAAO,GAAG,mBAAG,CAAC,OAAO,IAAI,mBAAG,CAAC,WAAW,CAAC;QAE/C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CACrB,cAAM,OAAA,IAAI,OAAO,CAAW,UAAC,OAAO,EAAE,MAAM;YAC1C,0CAA0C;YAC1C,OAAO,CAAC;gBACN,GAAG,EAAE,KAAI,CAAC,GAAG;gBACb,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;gBAC3B,MAAM,EAAE;oBACN,cAAc,EAAE,kBAAkB;iBACnC;gBACD,OAAO,EAAP,UAAQ,GAA2B;oBACjC,OAAO,CAAC;wBACN,MAAM,EAAE,+BAAuB,CAAC,GAAG,CAAC,UAAU,CAAC;qBAChD,CAAC,CAAC;gBACL,CAAC;gBACD,IAAI,EAAJ,UAAK,KAAa;oBAChB,MAAM,CAAC,KAAK,CAAC,CAAC;gBAChB,CAAC;aACF,CAAC,CAAC;QACL,CAAC,CAAC,EAlBI,CAkBJ,CACH,CAAC;IACJ,CAAC;IACH,mBAAC;AAAD,CAAC,AA7BD,CAAkC,oBAAa,GA6B9C;AA7BY,oCAAY","sourcesContent":["import { Event, Response } from \"@sentry/types\";\nimport { eventStatusFromHttpCode } from '@sentry/utils';\n\nimport { sdk } from \"../crossPlatform\";\n\nimport { BaseTransport } from \"./base\";\n\n/** `XHR` based transport */\nexport class XHRTransport extends BaseTransport {\n /**\n * @inheritDoc\n */\n public sendEvent(event: Event): PromiseLike<Response> {\n const request = sdk.request || sdk.httpRequest;\n\n return this._buffer.add(\n () => new Promise<Response>((resolve, reject) => {\n // tslint:disable-next-line: no-unsafe-any\n request({\n url: this.url,\n method: \"POST\",\n data: JSON.stringify(event),\n header: {\n \"content-type\": \"application/json\"\n },\n success(res: { statusCode: number }): void {\n resolve({\n status: eventStatusFromHttpCode(res.statusCode)\n });\n },\n fail(error: object): void {\n reject(error);\n }\n });\n })\n );\n }\n}\n"]}
|
package/esm/backend.d.ts
DELETED
|
@@ -1,41 +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 Miniapp SDK.
|
|
5
|
-
* Sentry Miniapp SDK 的配置选项。
|
|
6
|
-
* @see MiniappClient for more information.
|
|
7
|
-
*/
|
|
8
|
-
export interface MiniappOptions extends Options {
|
|
9
|
-
/**
|
|
10
|
-
* A pattern for error URLs which should not be sent to Sentry.
|
|
11
|
-
* To whitelist certain errors instead, use {@link Options.whitelistUrls}.
|
|
12
|
-
* By default, all errors will be sent.
|
|
13
|
-
*/
|
|
14
|
-
blacklistUrls?: Array<string | RegExp>;
|
|
15
|
-
/**
|
|
16
|
-
* A pattern for error URLs which should exclusively be sent to Sentry.
|
|
17
|
-
* This is the opposite of {@link Options.blacklistUrls}.
|
|
18
|
-
* By default, all errors will be sent.
|
|
19
|
-
*/
|
|
20
|
-
whitelistUrls?: Array<string | RegExp>;
|
|
21
|
-
extraOptions?: Object;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* The Sentry Browser SDK Backend.
|
|
25
|
-
* @hidden
|
|
26
|
-
*/
|
|
27
|
-
export declare class MiniappBackend extends BaseBackend<MiniappOptions> {
|
|
28
|
-
/**
|
|
29
|
-
* @inheritDoc
|
|
30
|
-
*/
|
|
31
|
-
protected _setupTransport(): Transport;
|
|
32
|
-
/**
|
|
33
|
-
* @inheritDoc
|
|
34
|
-
*/
|
|
35
|
-
eventFromException(exception: any, hint?: EventHint): PromiseLike<Event>;
|
|
36
|
-
/**
|
|
37
|
-
* @inheritDoc
|
|
38
|
-
*/
|
|
39
|
-
eventFromMessage(message: string, level?: Severity, hint?: EventHint): PromiseLike<Event>;
|
|
40
|
-
}
|
|
41
|
-
//# 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,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAM/E;;;;GAIG;AACH,MAAM,WAAW,cAAe,SAAQ,OAAO;IAC7C;;;;OAIG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAEvC;;;;OAIG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAEvC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,qBAAa,cAAe,SAAQ,WAAW,CAAC,cAAc,CAAC;IAC7D;;OAEG;IACH,SAAS,CAAC,eAAe,IAAI,SAAS;IAkBtC;;OAEG;IACI,kBAAkB,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAe/E;;OAEG;IACI,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,QAAwB,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;CAWhH"}
|
package/esm/backend.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { __assign, __extends } from "tslib";
|
|
2
|
-
import { BaseBackend } from "@sentry/core";
|
|
3
|
-
import { Severity } from "@sentry/types";
|
|
4
|
-
import { addExceptionMechanism, resolvedSyncPromise } from '@sentry/utils';
|
|
5
|
-
import { eventFromString, eventFromUnknownInput } from './eventbuilder';
|
|
6
|
-
import { XHRTransport } from "./transports/index";
|
|
7
|
-
/**
|
|
8
|
-
* The Sentry Browser SDK Backend.
|
|
9
|
-
* @hidden
|
|
10
|
-
*/
|
|
11
|
-
var MiniappBackend = /** @class */ (function (_super) {
|
|
12
|
-
__extends(MiniappBackend, _super);
|
|
13
|
-
function MiniappBackend() {
|
|
14
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* @inheritDoc
|
|
18
|
-
*/
|
|
19
|
-
MiniappBackend.prototype._setupTransport = function () {
|
|
20
|
-
if (!this._options.dsn) {
|
|
21
|
-
// We return the noop transport here in case there is no Dsn.
|
|
22
|
-
return _super.prototype._setupTransport.call(this);
|
|
23
|
-
}
|
|
24
|
-
var transportOptions = __assign(__assign({}, this._options.transportOptions), { dsn: this._options.dsn });
|
|
25
|
-
if (this._options.transport) {
|
|
26
|
-
return new this._options.transport(transportOptions);
|
|
27
|
-
}
|
|
28
|
-
return new XHRTransport(transportOptions);
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* @inheritDoc
|
|
32
|
-
*/
|
|
33
|
-
MiniappBackend.prototype.eventFromException = function (exception, hint) {
|
|
34
|
-
var syntheticException = (hint && hint.syntheticException) || undefined;
|
|
35
|
-
var event = eventFromUnknownInput(exception, syntheticException, {
|
|
36
|
-
attachStacktrace: this._options.attachStacktrace,
|
|
37
|
-
});
|
|
38
|
-
addExceptionMechanism(event, {
|
|
39
|
-
handled: true,
|
|
40
|
-
type: 'generic',
|
|
41
|
-
});
|
|
42
|
-
event.level = Severity.Error;
|
|
43
|
-
if (hint && hint.event_id) {
|
|
44
|
-
event.event_id = hint.event_id;
|
|
45
|
-
}
|
|
46
|
-
return resolvedSyncPromise(event);
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* @inheritDoc
|
|
50
|
-
*/
|
|
51
|
-
MiniappBackend.prototype.eventFromMessage = function (message, level, hint) {
|
|
52
|
-
if (level === void 0) { level = Severity.Info; }
|
|
53
|
-
var syntheticException = (hint && hint.syntheticException) || undefined;
|
|
54
|
-
var event = eventFromString(message, syntheticException, {
|
|
55
|
-
attachStacktrace: this._options.attachStacktrace,
|
|
56
|
-
});
|
|
57
|
-
event.level = level;
|
|
58
|
-
if (hint && hint.event_id) {
|
|
59
|
-
event.event_id = hint.event_id;
|
|
60
|
-
}
|
|
61
|
-
return resolvedSyncPromise(event);
|
|
62
|
-
};
|
|
63
|
-
return MiniappBackend;
|
|
64
|
-
}(BaseBackend));
|
|
65
|
-
export { MiniappBackend };
|
|
66
|
-
//# 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,MAAM,cAAc,CAAC;AAC3C,OAAO,EAA6B,QAAQ,EAAa,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAyBlD;;;GAGG;AACH;IAAoC,kCAA2B;IAA/D;;IAsDA,CAAC;IArDC;;OAEG;IACO,wCAAe,GAAzB;QACE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE;YACtB,6DAA6D;YAC7D,OAAO,iBAAM,eAAe,WAAE,CAAC;SAChC;QAED,IAAM,gBAAgB,yBACjB,IAAI,CAAC,QAAQ,CAAC,gBAAgB,KACjC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,GACvB,CAAC;QAEF,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE;YAC3B,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;SACtD;QAED,OAAO,IAAI,YAAY,CAAC,gBAAgB,CAAC,CAAC;IAC5C,CAAC;IAED;;OA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/core\";\nimport { Event, EventHint, Options, Severity, Transport } from \"@sentry/types\";\nimport { addExceptionMechanism, resolvedSyncPromise } from '@sentry/utils';\n\nimport { eventFromString, eventFromUnknownInput } from './eventbuilder';\nimport { XHRTransport } from \"./transports/index\";\n\n/**\n * Configuration options for the Sentry Miniapp SDK.\n * Sentry Miniapp SDK 的配置选项。\n * @see MiniappClient for more information.\n */\nexport interface MiniappOptions extends Options {\n /**\n * A pattern for error URLs which should not be sent to Sentry.\n * To whitelist certain errors instead, use {@link Options.whitelistUrls}.\n * By default, all errors will be sent.\n */\n blacklistUrls?: Array<string | RegExp>;\n\n /**\n * A pattern for error URLs which should exclusively be sent to Sentry.\n * This is the opposite of {@link Options.blacklistUrls}.\n * By default, all errors will be sent.\n */\n whitelistUrls?: Array<string | RegExp>;\n\n extraOptions?: Object;\n}\n\n/**\n * The Sentry Browser SDK Backend.\n * @hidden\n */\nexport class MiniappBackend extends BaseBackend<MiniappOptions> {\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 = {\n ...this._options.transportOptions,\n dsn: this._options.dsn\n };\n\n if (this._options.transport) {\n return new this._options.transport(transportOptions);\n }\n\n return new XHRTransport(transportOptions);\n }\n\n /**\n * @inheritDoc\n */\n public eventFromException(exception: any, hint?: EventHint): PromiseLike<Event> {\n const syntheticException = (hint && hint.syntheticException) || undefined;\n const event = eventFromUnknownInput(exception, syntheticException, {\n attachStacktrace: this._options.attachStacktrace,\n });\n addExceptionMechanism(event, {\n handled: true,\n type: 'generic',\n });\n event.level = Severity.Error;\n if (hint && hint.event_id) {\n event.event_id = hint.event_id;\n }\n return resolvedSyncPromise(event);\n }\n /**\n * @inheritDoc\n */\n public eventFromMessage(message: string, level: Severity = Severity.Info, hint?: EventHint): PromiseLike<Event> {\n const syntheticException = (hint && hint.syntheticException) || undefined;\n const event = eventFromString(message, syntheticException, {\n attachStacktrace: this._options.attachStacktrace,\n });\n event.level = level;\n if (hint && hint.event_id) {\n event.event_id = hint.event_id;\n }\n return resolvedSyncPromise(event);\n }\n}\n"]}
|
package/esm/helpers.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Mechanism, WrappedFunction } from '@sentry/types';
|
|
2
|
-
/**
|
|
3
|
-
* @hidden
|
|
4
|
-
*/
|
|
5
|
-
export declare function shouldIgnoreOnError(): boolean;
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
*/
|
|
9
|
-
export declare function ignoreNextOnError(): void;
|
|
10
|
-
/**
|
|
11
|
-
* Instruments the given function and sends an event to Sentry every time the
|
|
12
|
-
* function throws an exception.
|
|
13
|
-
*
|
|
14
|
-
* @param fn A function to wrap.
|
|
15
|
-
* @returns The wrapped function.
|
|
16
|
-
* @hidden
|
|
17
|
-
*/
|
|
18
|
-
export declare function wrap(fn: WrappedFunction, options?: {
|
|
19
|
-
mechanism?: Mechanism;
|
|
20
|
-
capture?: boolean;
|
|
21
|
-
}, before?: WrappedFunction): any;
|
|
22
|
-
/**
|
|
23
|
-
* Wraps addEventListener to capture UI breadcrumbs
|
|
24
|
-
* @param eventName the event name (e.g. "click")
|
|
25
|
-
* @returns wrapped breadcrumb events handler
|
|
26
|
-
* @hidden
|
|
27
|
-
*/
|
|
28
|
-
export declare function breadcrumbEventHandler(eventName: string, debounce?: boolean): (event: Event) => void;
|
|
29
|
-
/**
|
|
30
|
-
* Wraps addEventListener to capture keypress UI events
|
|
31
|
-
* @returns wrapped keypress events handler
|
|
32
|
-
* @hidden
|
|
33
|
-
*/
|
|
34
|
-
export declare function keypressEventHandler(): (event: Event) => void;
|
|
35
|
-
//# sourceMappingURL=helpers.d.ts.map
|
package/esm/helpers.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,SAAS,EAAS,eAAe,EAAE,MAAM,eAAe,CAAC;AAQxF;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAMxC;AAED;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAClB,EAAE,EAAE,eAAe,EACnB,OAAO,GAAE;IACP,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACd,EACN,MAAM,CAAC,EAAE,eAAe,GACvB,GAAG,CA2HL;AAID;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,GAAE,OAAe,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAoD3G;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAmC7D"}
|
package/esm/helpers.js
DELETED
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
|
-
import { captureException, getCurrentHub, withScope } from '@sentry/core';
|
|
3
|
-
import { addExceptionMechanism, addExceptionTypeValue, htmlTreeAsString, normalize } from '@sentry/utils';
|
|
4
|
-
var debounceDuration = 1000;
|
|
5
|
-
var keypressTimeout;
|
|
6
|
-
var lastCapturedEvent;
|
|
7
|
-
var ignoreOnError = 0;
|
|
8
|
-
/**
|
|
9
|
-
* @hidden
|
|
10
|
-
*/
|
|
11
|
-
export function shouldIgnoreOnError() {
|
|
12
|
-
return ignoreOnError > 0;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* @hidden
|
|
16
|
-
*/
|
|
17
|
-
export function ignoreNextOnError() {
|
|
18
|
-
// onerror should trigger before setTimeout
|
|
19
|
-
ignoreOnError += 1;
|
|
20
|
-
setTimeout(function () {
|
|
21
|
-
ignoreOnError -= 1;
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Instruments the given function and sends an event to Sentry every time the
|
|
26
|
-
* function throws an exception.
|
|
27
|
-
*
|
|
28
|
-
* @param fn A function to wrap.
|
|
29
|
-
* @returns The wrapped function.
|
|
30
|
-
* @hidden
|
|
31
|
-
*/
|
|
32
|
-
export function wrap(fn, options, before) {
|
|
33
|
-
if (options === void 0) { options = {}; }
|
|
34
|
-
// tslint:disable-next-line:strict-type-predicates
|
|
35
|
-
if (typeof fn !== 'function') {
|
|
36
|
-
return fn;
|
|
37
|
-
}
|
|
38
|
-
try {
|
|
39
|
-
// We don't wanna wrap it twice
|
|
40
|
-
if (fn.__sentry__) {
|
|
41
|
-
return fn;
|
|
42
|
-
}
|
|
43
|
-
// If this has already been wrapped in the past, return that wrapped function
|
|
44
|
-
if (fn.__sentry_wrapped__) {
|
|
45
|
-
return fn.__sentry_wrapped__;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
catch (e) {
|
|
49
|
-
// Just accessing custom props in some Selenium environments
|
|
50
|
-
// can cause a "Permission denied" exception (see raven-js#495).
|
|
51
|
-
// Bail on wrapping and return the function as-is (defers to window.onerror).
|
|
52
|
-
return fn;
|
|
53
|
-
}
|
|
54
|
-
var sentryWrapped = function () {
|
|
55
|
-
// tslint:disable-next-line:strict-type-predicates
|
|
56
|
-
if (before && typeof before === 'function') {
|
|
57
|
-
before.apply(this, arguments);
|
|
58
|
-
}
|
|
59
|
-
var args = Array.prototype.slice.call(arguments);
|
|
60
|
-
// tslint:disable:no-unsafe-any
|
|
61
|
-
try {
|
|
62
|
-
var wrappedArguments = args.map(function (arg) { return wrap(arg, options); });
|
|
63
|
-
if (fn.handleEvent) {
|
|
64
|
-
// Attempt to invoke user-land function
|
|
65
|
-
// NOTE: If you are a Sentry user, and you are seeing this stack frame, it
|
|
66
|
-
// means the sentry.javascript SDK caught an error invoking your application code. This
|
|
67
|
-
// is expected behavior and NOT indicative of a bug with sentry.javascript.
|
|
68
|
-
return fn.handleEvent.apply(this, wrappedArguments);
|
|
69
|
-
}
|
|
70
|
-
// Attempt to invoke user-land function
|
|
71
|
-
// NOTE: If you are a Sentry user, and you are seeing this stack frame, it
|
|
72
|
-
// means the sentry.javascript SDK caught an error invoking your application code. This
|
|
73
|
-
// is expected behavior and NOT indicative of a bug with sentry.javascript.
|
|
74
|
-
return fn.apply(this, wrappedArguments);
|
|
75
|
-
// tslint:enable:no-unsafe-any
|
|
76
|
-
}
|
|
77
|
-
catch (ex) {
|
|
78
|
-
ignoreNextOnError();
|
|
79
|
-
withScope(function (scope) {
|
|
80
|
-
scope.addEventProcessor(function (event) {
|
|
81
|
-
var processedEvent = __assign({}, event);
|
|
82
|
-
if (options.mechanism) {
|
|
83
|
-
addExceptionTypeValue(processedEvent, undefined, undefined);
|
|
84
|
-
addExceptionMechanism(processedEvent, options.mechanism);
|
|
85
|
-
}
|
|
86
|
-
processedEvent.extra = __assign(__assign({}, processedEvent.extra), { arguments: normalize(args, 3) });
|
|
87
|
-
return processedEvent;
|
|
88
|
-
});
|
|
89
|
-
captureException(ex);
|
|
90
|
-
});
|
|
91
|
-
throw ex;
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
// Accessing some objects may throw
|
|
95
|
-
// ref: https://github.com/getsentry/sentry-javascript/issues/1168
|
|
96
|
-
try {
|
|
97
|
-
// tslint:disable-next-line: no-for-in
|
|
98
|
-
for (var property in fn) {
|
|
99
|
-
if (Object.prototype.hasOwnProperty.call(fn, property)) {
|
|
100
|
-
sentryWrapped[property] = fn[property];
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
catch (_oO) { } // tslint:disable-line:no-empty
|
|
105
|
-
fn.prototype = fn.prototype || {};
|
|
106
|
-
sentryWrapped.prototype = fn.prototype;
|
|
107
|
-
Object.defineProperty(fn, '__sentry_wrapped__', {
|
|
108
|
-
enumerable: false,
|
|
109
|
-
value: sentryWrapped,
|
|
110
|
-
});
|
|
111
|
-
// Signal that this function has been wrapped/filled already
|
|
112
|
-
// for both debugging and to prevent it to being wrapped/filled twice
|
|
113
|
-
Object.defineProperties(sentryWrapped, {
|
|
114
|
-
__sentry__: {
|
|
115
|
-
enumerable: false,
|
|
116
|
-
value: true,
|
|
117
|
-
},
|
|
118
|
-
__sentry_original__: {
|
|
119
|
-
enumerable: false,
|
|
120
|
-
value: fn,
|
|
121
|
-
},
|
|
122
|
-
});
|
|
123
|
-
// Restore original function name (not all browsers allow that)
|
|
124
|
-
try {
|
|
125
|
-
var descriptor = Object.getOwnPropertyDescriptor(sentryWrapped, 'name');
|
|
126
|
-
if (descriptor.configurable) {
|
|
127
|
-
Object.defineProperty(sentryWrapped, 'name', {
|
|
128
|
-
get: function () {
|
|
129
|
-
return fn.name;
|
|
130
|
-
},
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
catch (_oO) {
|
|
135
|
-
/*no-empty*/
|
|
136
|
-
}
|
|
137
|
-
return sentryWrapped;
|
|
138
|
-
}
|
|
139
|
-
var debounceTimer = 0;
|
|
140
|
-
/**
|
|
141
|
-
* Wraps addEventListener to capture UI breadcrumbs
|
|
142
|
-
* @param eventName the event name (e.g. "click")
|
|
143
|
-
* @returns wrapped breadcrumb events handler
|
|
144
|
-
* @hidden
|
|
145
|
-
*/
|
|
146
|
-
export function breadcrumbEventHandler(eventName, debounce) {
|
|
147
|
-
if (debounce === void 0) { debounce = false; }
|
|
148
|
-
return function (event) {
|
|
149
|
-
// reset keypress timeout; e.g. triggering a 'click' after
|
|
150
|
-
// a 'keypress' will reset the keypress debounce so that a new
|
|
151
|
-
// set of keypresses can be recorded
|
|
152
|
-
keypressTimeout = undefined;
|
|
153
|
-
// It's possible this handler might trigger multiple times for the same
|
|
154
|
-
// event (e.g. event propagation through node ancestors). Ignore if we've
|
|
155
|
-
// already captured the event.
|
|
156
|
-
// tslint:disable-next-line: strict-comparisons
|
|
157
|
-
if (!event || lastCapturedEvent === event) {
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
lastCapturedEvent = event;
|
|
161
|
-
var captureBreadcrumb = function () {
|
|
162
|
-
var target;
|
|
163
|
-
// Accessing event.target can throw (see getsentry/raven-js#838, #768)
|
|
164
|
-
try {
|
|
165
|
-
target = event.target ? htmlTreeAsString(event.target) : htmlTreeAsString(event);
|
|
166
|
-
}
|
|
167
|
-
catch (e) {
|
|
168
|
-
target = '<unknown>';
|
|
169
|
-
}
|
|
170
|
-
if (target.length === 0) {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
getCurrentHub().addBreadcrumb({
|
|
174
|
-
category: "ui." + eventName,
|
|
175
|
-
message: target,
|
|
176
|
-
}, {
|
|
177
|
-
event: event,
|
|
178
|
-
name: eventName,
|
|
179
|
-
});
|
|
180
|
-
};
|
|
181
|
-
if (debounceTimer) {
|
|
182
|
-
clearTimeout(debounceTimer);
|
|
183
|
-
}
|
|
184
|
-
if (debounce) {
|
|
185
|
-
debounceTimer = setTimeout(captureBreadcrumb);
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
captureBreadcrumb();
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Wraps addEventListener to capture keypress UI events
|
|
194
|
-
* @returns wrapped keypress events handler
|
|
195
|
-
* @hidden
|
|
196
|
-
*/
|
|
197
|
-
export function keypressEventHandler() {
|
|
198
|
-
// TODO: if somehow user switches keypress target before
|
|
199
|
-
// debounce timeout is triggered, we will only capture
|
|
200
|
-
// a single breadcrumb from the FIRST target (acceptable?)
|
|
201
|
-
return function (event) {
|
|
202
|
-
var target;
|
|
203
|
-
try {
|
|
204
|
-
target = event.target;
|
|
205
|
-
}
|
|
206
|
-
catch (e) {
|
|
207
|
-
// just accessing event properties can throw an exception in some rare circumstances
|
|
208
|
-
// see: https://github.com/getsentry/raven-js/issues/838
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
var tagName = target && target.tagName;
|
|
212
|
-
// only consider keypress events on actual input elements
|
|
213
|
-
// this will disregard keypresses targeting body (e.g. tabbing
|
|
214
|
-
// through elements, hotkeys, etc)
|
|
215
|
-
if (!tagName || (tagName !== 'INPUT' && tagName !== 'TEXTAREA' && !target.isContentEditable)) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
// record first keypress in a series, but ignore subsequent
|
|
219
|
-
// keypresses until debounce clears
|
|
220
|
-
if (!keypressTimeout) {
|
|
221
|
-
breadcrumbEventHandler('input')(event);
|
|
222
|
-
}
|
|
223
|
-
clearTimeout(keypressTimeout);
|
|
224
|
-
keypressTimeout = setTimeout(function () {
|
|
225
|
-
keypressTimeout = undefined;
|
|
226
|
-
}, debounceDuration);
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
//# sourceMappingURL=helpers.js.map
|
package/esm/helpers.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE1E,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1G,IAAM,gBAAgB,GAAW,IAAI,CAAC;AACtC,IAAI,eAAmC,CAAC;AACxC,IAAI,iBAAoC,CAAC;AACzC,IAAI,aAAa,GAAW,CAAC,CAAC;AAE9B;;GAEG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO,aAAa,GAAG,CAAC,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,2CAA2C;IAC3C,aAAa,IAAI,CAAC,CAAC;IACnB,UAAU,CAAC;QACT,aAAa,IAAI,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,IAAI,CAClB,EAAmB,EACnB,OAGM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["import { captureException, getCurrentHub, withScope } from '@sentry/core';\nimport { Event as SentryEvent, Mechanism, Scope, WrappedFunction } from '@sentry/types';\nimport { addExceptionMechanism, addExceptionTypeValue, htmlTreeAsString, normalize } from '@sentry/utils';\n\nconst debounceDuration: number = 1000;\nlet keypressTimeout: number | undefined;\nlet lastCapturedEvent: Event | undefined;\nlet ignoreOnError: number = 0;\n\n/**\n * @hidden\n */\nexport function shouldIgnoreOnError(): boolean {\n return ignoreOnError > 0;\n}\n\n/**\n * @hidden\n */\nexport function ignoreNextOnError(): void {\n // onerror should trigger before setTimeout\n ignoreOnError += 1;\n setTimeout(() => {\n ignoreOnError -= 1;\n });\n}\n\n/**\n * Instruments the given function and sends an event to Sentry every time the\n * function throws an exception.\n *\n * @param fn A function to wrap.\n * @returns The wrapped function.\n * @hidden\n */\nexport function wrap(\n fn: WrappedFunction,\n options: {\n mechanism?: Mechanism;\n capture?: boolean;\n } = {},\n before?: WrappedFunction,\n): any {\n // tslint:disable-next-line:strict-type-predicates\n if (typeof fn !== 'function') {\n return fn;\n }\n\n try {\n // We don't wanna wrap it twice\n if (fn.__sentry__) {\n return fn;\n }\n\n // If this has already been wrapped in the past, return that wrapped function\n if (fn.__sentry_wrapped__) {\n return fn.__sentry_wrapped__;\n }\n } catch (e) {\n // Just accessing custom props in some Selenium environments\n // can cause a \"Permission denied\" exception (see raven-js#495).\n // Bail on wrapping and return the function as-is (defers to window.onerror).\n return fn;\n }\n\n const sentryWrapped: WrappedFunction = function (this: any): void {\n // tslint:disable-next-line:strict-type-predicates\n if (before && typeof before === 'function') {\n before.apply(this, arguments);\n }\n\n const args = Array.prototype.slice.call(arguments);\n\n // tslint:disable:no-unsafe-any\n try {\n const wrappedArguments = args.map((arg: any) => wrap(arg, options));\n\n if (fn.handleEvent) {\n // Attempt to invoke user-land function\n // NOTE: If you are a Sentry user, and you are seeing this stack frame, it\n // means the sentry.javascript SDK caught an error invoking your application code. This\n // is expected behavior and NOT indicative of a bug with sentry.javascript.\n return fn.handleEvent.apply(this, wrappedArguments);\n }\n\n // Attempt to invoke user-land function\n // NOTE: If you are a Sentry user, and you are seeing this stack frame, it\n // means the sentry.javascript SDK caught an error invoking your application code. This\n // is expected behavior and NOT indicative of a bug with sentry.javascript.\n return fn.apply(this, wrappedArguments);\n // tslint:enable:no-unsafe-any\n } catch (ex) {\n ignoreNextOnError();\n\n withScope((scope: Scope) => {\n scope.addEventProcessor((event: SentryEvent) => {\n const processedEvent = { ...event };\n\n if (options.mechanism) {\n addExceptionTypeValue(processedEvent, undefined, undefined);\n addExceptionMechanism(processedEvent, options.mechanism);\n }\n\n processedEvent.extra = {\n ...processedEvent.extra,\n arguments: normalize(args, 3),\n };\n\n return processedEvent;\n });\n\n captureException(ex);\n });\n\n throw ex;\n }\n };\n\n // Accessing some objects may throw\n // ref: https://github.com/getsentry/sentry-javascript/issues/1168\n try {\n // tslint:disable-next-line: no-for-in\n for (const property in fn) {\n if (Object.prototype.hasOwnProperty.call(fn, property)) {\n sentryWrapped[property] = fn[property];\n }\n }\n } catch (_oO) { } // tslint:disable-line:no-empty\n\n fn.prototype = fn.prototype || {};\n sentryWrapped.prototype = fn.prototype;\n\n Object.defineProperty(fn, '__sentry_wrapped__', {\n enumerable: false,\n value: sentryWrapped,\n });\n\n // Signal that this function has been wrapped/filled already\n // for both debugging and to prevent it to being wrapped/filled twice\n Object.defineProperties(sentryWrapped, {\n __sentry__: {\n enumerable: false,\n value: true,\n },\n __sentry_original__: {\n enumerable: false,\n value: fn,\n },\n });\n\n // Restore original function name (not all browsers allow that)\n try {\n const descriptor = Object.getOwnPropertyDescriptor(sentryWrapped, 'name') as PropertyDescriptor;\n if (descriptor.configurable) {\n Object.defineProperty(sentryWrapped, 'name', {\n get(): string {\n return fn.name;\n },\n });\n }\n } catch (_oO) {\n /*no-empty*/\n }\n\n return sentryWrapped;\n}\n\nlet debounceTimer: number = 0;\n\n/**\n * Wraps addEventListener to capture UI breadcrumbs\n * @param eventName the event name (e.g. \"click\")\n * @returns wrapped breadcrumb events handler\n * @hidden\n */\nexport function breadcrumbEventHandler(eventName: string, debounce: boolean = false): (event: Event) => void {\n return (event: Event) => {\n // reset keypress timeout; e.g. triggering a 'click' after\n // a 'keypress' will reset the keypress debounce so that a new\n // set of keypresses can be recorded\n keypressTimeout = undefined;\n // It's possible this handler might trigger multiple times for the same\n // event (e.g. event propagation through node ancestors). Ignore if we've\n // already captured the event.\n // tslint:disable-next-line: strict-comparisons\n if (!event || lastCapturedEvent === event) {\n return;\n }\n\n lastCapturedEvent = event;\n\n const captureBreadcrumb = () => {\n let target;\n\n // Accessing event.target can throw (see getsentry/raven-js#838, #768)\n try {\n target = event.target ? htmlTreeAsString(event.target as Node) : htmlTreeAsString((event as unknown) as Node);\n } catch (e) {\n target = '<unknown>';\n }\n\n if (target.length === 0) {\n return;\n }\n\n getCurrentHub().addBreadcrumb(\n {\n category: `ui.${eventName}`, // e.g. ui.click, ui.input\n message: target,\n },\n {\n event,\n name: eventName,\n },\n );\n };\n\n if (debounceTimer) {\n clearTimeout(debounceTimer);\n }\n\n if (debounce) {\n debounceTimer = setTimeout(captureBreadcrumb);\n } else {\n captureBreadcrumb();\n }\n };\n}\n\n/**\n * Wraps addEventListener to capture keypress UI events\n * @returns wrapped keypress events handler\n * @hidden\n */\nexport function keypressEventHandler(): (event: Event) => void {\n // TODO: if somehow user switches keypress target before\n // debounce timeout is triggered, we will only capture\n // a single breadcrumb from the FIRST target (acceptable?)\n return (event: Event) => {\n let target;\n\n try {\n target = event.target;\n } catch (e) {\n // just accessing event properties can throw an exception in some rare circumstances\n // see: https://github.com/getsentry/raven-js/issues/838\n return;\n }\n\n const tagName = target && (target as HTMLElement).tagName;\n\n // only consider keypress events on actual input elements\n // this will disregard keypresses targeting body (e.g. tabbing\n // through elements, hotkeys, etc)\n if (!tagName || (tagName !== 'INPUT' && tagName !== 'TEXTAREA' && !(target as HTMLElement).isContentEditable)) {\n return;\n }\n\n // record first keypress in a series, but ignore subsequent\n // keypresses until debounce clears\n if (!keypressTimeout) {\n breadcrumbEventHandler('input')(event);\n }\n clearTimeout(keypressTimeout);\n\n keypressTimeout = (setTimeout(() => {\n keypressTimeout = undefined;\n }, debounceDuration) as any) as number;\n };\n}\n"]}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Integration } from '@sentry/types';
|
|
2
|
-
/** Adds SDK info to an event. */
|
|
3
|
-
export declare class LinkedErrors implements Integration {
|
|
4
|
-
/**
|
|
5
|
-
* @inheritDoc
|
|
6
|
-
*/
|
|
7
|
-
readonly name: string;
|
|
8
|
-
/**
|
|
9
|
-
* @inheritDoc
|
|
10
|
-
*/
|
|
11
|
-
static id: string;
|
|
12
|
-
/**
|
|
13
|
-
* @inheritDoc
|
|
14
|
-
*/
|
|
15
|
-
private readonly _key;
|
|
16
|
-
/**
|
|
17
|
-
* @inheritDoc
|
|
18
|
-
*/
|
|
19
|
-
private readonly _limit;
|
|
20
|
-
/**
|
|
21
|
-
* @inheritDoc
|
|
22
|
-
*/
|
|
23
|
-
constructor(options?: {
|
|
24
|
-
key?: string;
|
|
25
|
-
limit?: number;
|
|
26
|
-
});
|
|
27
|
-
/**
|
|
28
|
-
* @inheritDoc
|
|
29
|
-
*/
|
|
30
|
-
setupOnce(): void;
|
|
31
|
-
/**
|
|
32
|
-
* @inheritDoc
|
|
33
|
-
*/
|
|
34
|
-
private _handler;
|
|
35
|
-
/**
|
|
36
|
-
* @inheritDoc
|
|
37
|
-
*/
|
|
38
|
-
private _walkErrorTree;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=linkederrors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"linkederrors.d.ts","sourceRoot":"","sources":["../../src/integrations/linkederrors.ts"],"names":[],"mappings":"AACA,OAAO,EAA8C,WAAW,EAAE,MAAM,eAAe,CAAC;AAQxF,iCAAiC;AACjC,qBAAa,YAAa,YAAW,WAAW;IAC9C;;OAEG;IACH,SAAgB,IAAI,EAAE,MAAM,CAAmB;IAE/C;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAkB;IAE1C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAE9B;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAEhC;;OAEG;gBACgB,OAAO,GAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO;IAKjE;;OAEG;IACI,SAAS,IAAI,IAAI;IAUxB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAShB;;OAEG;IACH,OAAO,CAAC,cAAc;CAQvB"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { __read, __spread } from "tslib";
|
|
2
|
-
import { addGlobalEventProcessor, getCurrentHub } from '@sentry/core';
|
|
3
|
-
import { exceptionFromStacktrace } from '../parsers';
|
|
4
|
-
import { computeStackTrace } from '../tracekit';
|
|
5
|
-
var DEFAULT_KEY = 'cause';
|
|
6
|
-
var DEFAULT_LIMIT = 5;
|
|
7
|
-
/** Adds SDK info to an event. */
|
|
8
|
-
var LinkedErrors = /** @class */ (function () {
|
|
9
|
-
/**
|
|
10
|
-
* @inheritDoc
|
|
11
|
-
*/
|
|
12
|
-
function LinkedErrors(options) {
|
|
13
|
-
if (options === void 0) { options = {}; }
|
|
14
|
-
/**
|
|
15
|
-
* @inheritDoc
|
|
16
|
-
*/
|
|
17
|
-
this.name = LinkedErrors.id;
|
|
18
|
-
this._key = options.key || DEFAULT_KEY;
|
|
19
|
-
this._limit = options.limit || DEFAULT_LIMIT;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* @inheritDoc
|
|
23
|
-
*/
|
|
24
|
-
LinkedErrors.prototype.setupOnce = function () {
|
|
25
|
-
addGlobalEventProcessor(function (event, hint) {
|
|
26
|
-
var self = getCurrentHub().getIntegration(LinkedErrors);
|
|
27
|
-
if (self) {
|
|
28
|
-
return self._handler(event, hint);
|
|
29
|
-
}
|
|
30
|
-
return event;
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* @inheritDoc
|
|
35
|
-
*/
|
|
36
|
-
LinkedErrors.prototype._handler = function (event, hint) {
|
|
37
|
-
if (!event.exception || !event.exception.values || !hint || !(hint.originalException instanceof Error)) {
|
|
38
|
-
return event;
|
|
39
|
-
}
|
|
40
|
-
var linkedErrors = this._walkErrorTree(hint.originalException, this._key);
|
|
41
|
-
event.exception.values = __spread(linkedErrors, event.exception.values);
|
|
42
|
-
return event;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* @inheritDoc
|
|
46
|
-
*/
|
|
47
|
-
LinkedErrors.prototype._walkErrorTree = function (error, key, stack) {
|
|
48
|
-
if (stack === void 0) { stack = []; }
|
|
49
|
-
if (!(error[key] instanceof Error) || stack.length + 1 >= this._limit) {
|
|
50
|
-
return stack;
|
|
51
|
-
}
|
|
52
|
-
var stacktrace = computeStackTrace(error[key]);
|
|
53
|
-
var exception = exceptionFromStacktrace(stacktrace);
|
|
54
|
-
return this._walkErrorTree(error[key], key, __spread([exception], stack));
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* @inheritDoc
|
|
58
|
-
*/
|
|
59
|
-
LinkedErrors.id = 'LinkedErrors';
|
|
60
|
-
return LinkedErrors;
|
|
61
|
-
}());
|
|
62
|
-
export { LinkedErrors };
|
|
63
|
-
//# sourceMappingURL=linkederrors.js.map
|