@sentry/angular 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.
Files changed (96) hide show
  1. package/README.md +4 -0
  2. package/bundles/sentry-angular.umd.js +442 -0
  3. package/bundles/sentry-angular.umd.js.map +1 -0
  4. package/bundles/sentry-angular.umd.min.js +2 -0
  5. package/bundles/sentry-angular.umd.min.js.map +1 -0
  6. package/{build/types/constants.d.ts → constants.d.ts} +4 -0
  7. package/constants.d.ts.map +1 -0
  8. package/{build/types/errorhandler.d.ts → errorhandler.d.ts} +0 -0
  9. package/errorhandler.d.ts.map +1 -0
  10. package/esm2015/constants.js +8 -0
  11. package/esm2015/errorhandler.js +90 -0
  12. package/esm2015/flags.js +16 -0
  13. package/esm2015/index.js +9 -0
  14. package/esm2015/sdk.js +33 -0
  15. package/esm2015/sentry-angular.js +5 -0
  16. package/esm2015/tracing.js +218 -0
  17. package/esm2015/zone.js +24 -0
  18. package/fesm2015/sentry-angular.js +385 -0
  19. package/fesm2015/sentry-angular.js.map +1 -0
  20. package/{build/types/flags.d.ts → flags.d.ts} +0 -0
  21. package/flags.d.ts.map +1 -0
  22. package/{build/types/index.d.ts → index.d.ts} +2 -1
  23. package/index.d.ts.map +1 -0
  24. package/package.json +16 -41
  25. package/{build/types/sdk.d.ts → sdk.d.ts} +0 -0
  26. package/sdk.d.ts.map +1 -0
  27. package/sentry-angular.d.ts +5 -0
  28. package/sentry-angular.d.ts.map +1 -0
  29. package/sentry-angular.metadata.json +1 -0
  30. package/{build/types/tracing.d.ts → tracing.d.ts} +0 -0
  31. package/tracing.d.ts.map +1 -0
  32. package/{build/types/zone.d.ts → zone.d.ts} +0 -0
  33. package/zone.d.ts.map +1 -0
  34. package/build/types/constants.d.ts.map +0 -1
  35. package/build/types/errorhandler.d.ts.map +0 -1
  36. package/build/types/flags.d.ts.map +0 -1
  37. package/build/types/index.d.ts.map +0 -1
  38. package/build/types/sdk.d.ts.map +0 -1
  39. package/build/types/tracing.d.ts.map +0 -1
  40. package/build/types/zone.d.ts.map +0 -1
  41. package/dist/constants.d.ts +0 -4
  42. package/dist/constants.d.ts.map +0 -1
  43. package/dist/constants.js +0 -5
  44. package/dist/constants.js.map +0 -1
  45. package/dist/errorhandler.d.ts +0 -41
  46. package/dist/errorhandler.d.ts.map +0 -1
  47. package/dist/errorhandler.js +0 -89
  48. package/dist/errorhandler.js.map +0 -1
  49. package/dist/flags.d.ts +0 -3
  50. package/dist/flags.d.ts.map +0 -1
  51. package/dist/flags.js +0 -17
  52. package/dist/flags.js.map +0 -1
  53. package/dist/index.d.ts +0 -7
  54. package/dist/index.d.ts.map +0 -1
  55. package/dist/index.js +0 -19
  56. package/dist/index.js.map +0 -1
  57. package/dist/sdk.d.ts +0 -6
  58. package/dist/sdk.d.ts.map +0 -1
  59. package/dist/sdk.js +0 -21
  60. package/dist/sdk.js.map +0 -1
  61. package/dist/tracing.d.ts +0 -61
  62. package/dist/tracing.d.ts.map +0 -1
  63. package/dist/tracing.js +0 -241
  64. package/dist/tracing.js.map +0 -1
  65. package/dist/zone.d.ts +0 -5
  66. package/dist/zone.d.ts.map +0 -1
  67. package/dist/zone.js +0 -26
  68. package/dist/zone.js.map +0 -1
  69. package/esm/constants.d.ts +0 -4
  70. package/esm/constants.d.ts.map +0 -1
  71. package/esm/constants.js +0 -4
  72. package/esm/constants.js.map +0 -1
  73. package/esm/errorhandler.d.ts +0 -41
  74. package/esm/errorhandler.d.ts.map +0 -1
  75. package/esm/errorhandler.js +0 -87
  76. package/esm/errorhandler.js.map +0 -1
  77. package/esm/flags.d.ts +0 -3
  78. package/esm/flags.d.ts.map +0 -1
  79. package/esm/flags.js +0 -16
  80. package/esm/flags.js.map +0 -1
  81. package/esm/index.d.ts +0 -7
  82. package/esm/index.d.ts.map +0 -1
  83. package/esm/index.js +0 -9
  84. package/esm/index.js.map +0 -1
  85. package/esm/sdk.d.ts +0 -6
  86. package/esm/sdk.d.ts.map +0 -1
  87. package/esm/sdk.js +0 -19
  88. package/esm/sdk.js.map +0 -1
  89. package/esm/tracing.d.ts +0 -61
  90. package/esm/tracing.d.ts.map +0 -1
  91. package/esm/tracing.js +0 -236
  92. package/esm/tracing.js.map +0 -1
  93. package/esm/zone.d.ts +0 -5
  94. package/esm/zone.d.ts.map +0 -1
  95. package/esm/zone.js +0 -24
  96. package/esm/zone.js.map +0 -1
@@ -1,41 +0,0 @@
1
- import { ErrorHandler as AngularErrorHandler } from '@angular/core';
2
- import * as Sentry from '@sentry/browser';
3
- /**
4
- * Options used to configure the behavior of the Angular ErrorHandler.
5
- */
6
- export interface ErrorHandlerOptions {
7
- logErrors?: boolean;
8
- showDialog?: boolean;
9
- dialogOptions?: Sentry.ReportDialogOptions;
10
- /**
11
- * Custom implementation of error extraction from the raw value captured by the Angular.
12
- * @param error Value captured by Angular's ErrorHandler provider
13
- * @param defaultExtractor Default implementation that can be used as the fallback in case of custom implementation
14
- */
15
- extractor?(error: unknown, defaultExtractor: (error: unknown) => unknown): unknown;
16
- }
17
- /**
18
- * Implementation of Angular's ErrorHandler provider that can be used as a drop-in replacement for the stock one.
19
- */
20
- declare class SentryErrorHandler implements AngularErrorHandler {
21
- protected readonly _options: ErrorHandlerOptions;
22
- constructor(options?: ErrorHandlerOptions);
23
- /**
24
- * Method called for every value captured through the ErrorHandler
25
- */
26
- handleError(error: unknown): void;
27
- /**
28
- * Used to pull a desired value that will be used to capture an event out of the raw value captured by ErrorHandler.
29
- */
30
- protected _extractError(error: unknown): unknown;
31
- /**
32
- * Default implementation of error extraction that handles default error wrapping, HTTP responses, ErrorEvent and few other known cases.
33
- */
34
- protected _defaultExtractor(errorCandidate: unknown): unknown;
35
- }
36
- /**
37
- * Factory function that creates an instance of a preconfigured ErrorHandler provider.
38
- */
39
- declare function createErrorHandler(config?: ErrorHandlerOptions): SentryErrorHandler;
40
- export { createErrorHandler, SentryErrorHandler };
41
- //# sourceMappingURL=errorhandler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errorhandler.d.ts","sourceRoot":"","sources":["../src/errorhandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,IAAI,mBAAmB,EAAc,MAAM,eAAe,CAAC;AAChF,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAI1C;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC,mBAAmB,CAAC;IAC3C;;;;OAIG;IACH,SAAS,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,GAAG,OAAO,CAAC;CACpF;AAED;;GAEG;AACH,cACM,kBAAmB,YAAW,mBAAmB;IACrD,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;gBAE9B,OAAO,CAAC,EAAE,mBAAmB;IAOhD;;OAEG;IACI,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAkBxC;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAUhD;;OAEG;IACH,SAAS,CAAC,iBAAiB,CAAC,cAAc,EAAE,OAAO,GAAG,OAAO;CAsC9D;AAED;;GAEG;AACH,iBAAS,kBAAkB,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,kBAAkB,CAE5E;AAED,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC"}
@@ -1,89 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- var tslib_1 = require("tslib");
3
- var http_1 = require("@angular/common/http");
4
- var core_1 = require("@angular/core");
5
- var Sentry = require("@sentry/browser");
6
- var zone_1 = require("./zone");
7
- /**
8
- * Implementation of Angular's ErrorHandler provider that can be used as a drop-in replacement for the stock one.
9
- */
10
- var SentryErrorHandler = /** @class */ (function () {
11
- function SentryErrorHandler(options) {
12
- this._options = tslib_1.__assign({ logErrors: true }, options);
13
- }
14
- /**
15
- * Method called for every value captured through the ErrorHandler
16
- */
17
- SentryErrorHandler.prototype.handleError = function (error) {
18
- var extractedError = this._extractError(error) || 'Handled unknown error';
19
- // Capture handled exception and send it to Sentry.
20
- var eventId = zone_1.runOutsideAngular(function () { return Sentry.captureException(extractedError); });
21
- // When in development mode, log the error to console for immediate feedback.
22
- if (this._options.logErrors) {
23
- // eslint-disable-next-line no-console
24
- console.error(extractedError);
25
- }
26
- // Optionally show user dialog to provide details on what happened.
27
- if (this._options.showDialog) {
28
- Sentry.showReportDialog(tslib_1.__assign(tslib_1.__assign({}, this._options.dialogOptions), { eventId: eventId }));
29
- }
30
- };
31
- /**
32
- * Used to pull a desired value that will be used to capture an event out of the raw value captured by ErrorHandler.
33
- */
34
- SentryErrorHandler.prototype._extractError = function (error) {
35
- // Allow custom overrides of extracting function
36
- if (this._options.extractor) {
37
- var defaultExtractor = this._defaultExtractor.bind(this);
38
- return this._options.extractor(error, defaultExtractor);
39
- }
40
- return this._defaultExtractor(error);
41
- };
42
- /**
43
- * Default implementation of error extraction that handles default error wrapping, HTTP responses, ErrorEvent and few other known cases.
44
- */
45
- SentryErrorHandler.prototype._defaultExtractor = function (errorCandidate) {
46
- var error = errorCandidate;
47
- // Try to unwrap zone.js error.
48
- // https://github.com/angular/angular/blob/master/packages/core/src/util/errors.ts
49
- if (error && error.ngOriginalError) {
50
- error = error.ngOriginalError;
51
- }
52
- // We can handle messages and Error objects directly.
53
- if (typeof error === 'string' || error instanceof Error) {
54
- return error;
55
- }
56
- // If it's http module error, extract as much information from it as we can.
57
- if (error instanceof http_1.HttpErrorResponse) {
58
- // The `error` property of http exception can be either an `Error` object, which we can use directly...
59
- if (error.error instanceof Error) {
60
- return error.error;
61
- }
62
- // ... or an`ErrorEvent`, which can provide us with the message but no stack...
63
- if (error.error instanceof ErrorEvent && error.error.message) {
64
- return error.error.message;
65
- }
66
- // ...or the request body itself, which we can use as a message instead.
67
- if (typeof error.error === 'string') {
68
- return "Server returned code " + error.status + " with body \"" + error.error + "\"";
69
- }
70
- // If we don't have any detailed information, fallback to the request message itself.
71
- return error.message;
72
- }
73
- // Nothing was extracted, fallback to default error message.
74
- return null;
75
- };
76
- SentryErrorHandler = tslib_1.__decorate([
77
- core_1.Injectable({ providedIn: 'root' })
78
- ], SentryErrorHandler);
79
- return SentryErrorHandler;
80
- }());
81
- exports.SentryErrorHandler = SentryErrorHandler;
82
- /**
83
- * Factory function that creates an instance of a preconfigured ErrorHandler provider.
84
- */
85
- function createErrorHandler(config) {
86
- return new SentryErrorHandler(config);
87
- }
88
- exports.createErrorHandler = createErrorHandler;
89
- //# sourceMappingURL=errorhandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errorhandler.js","sourceRoot":"","sources":["../src/errorhandler.ts"],"names":[],"mappings":";;AAAA,6CAAyD;AACzD,sCAAgF;AAChF,wCAA0C;AAE1C,+BAA2C;AAiB3C;;GAEG;AAEH;IAGE,4BAAmB,OAA6B;QAC9C,IAAI,CAAC,QAAQ,sBACX,SAAS,EAAE,IAAI,IACZ,OAAO,CACX,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,wCAAW,GAAlB,UAAmB,KAAc;QAC/B,IAAM,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,uBAAuB,CAAC;QAE5E,mDAAmD;QACnD,IAAM,OAAO,GAAG,wBAAiB,CAAC,cAAM,OAAA,MAAM,CAAC,gBAAgB,CAAC,cAAc,CAAC,EAAvC,CAAuC,CAAC,CAAC;QAEjF,6EAA6E;QAC7E,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE;YAC3B,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;SAC/B;QAED,mEAAmE;QACnE,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE;YAC5B,MAAM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C;aAC1E;YAED,qFAAqF;YACrF,OAAO,KAAK,CAAC,OAAO,CAAC;SACtB;QAED,4DAA4D;QAC5D,OAAO,IAAI,CAAC;IACd,CAAC;IApFG,kBAAkB;QADvB,iBAAU,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;OAC7B,kBAAkB,CAqFvB;IAAD,yBAAC;CAAA,AArFD,IAqFC;AAS4B,gDAAkB;AAP/C;;GAEG;AACH,SAAS,kBAAkB,CAAC,MAA4B;IACtD,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;AACxC,CAAC;AAEQ,gDAAkB","sourcesContent":["import { HttpErrorResponse } from '@angular/common/http';\nimport { ErrorHandler as AngularErrorHandler, Injectable } from '@angular/core';\nimport * as Sentry from '@sentry/browser';\n\nimport { runOutsideAngular } from './zone';\n\n/**\n * Options used to configure the behavior of the Angular ErrorHandler.\n */\nexport interface ErrorHandlerOptions {\n logErrors?: boolean;\n showDialog?: boolean;\n dialogOptions?: Sentry.ReportDialogOptions;\n /**\n * Custom implementation of error extraction from the raw value captured by the Angular.\n * @param error Value captured by Angular's ErrorHandler provider\n * @param defaultExtractor Default implementation that can be used as the fallback in case of custom implementation\n */\n extractor?(error: unknown, defaultExtractor: (error: unknown) => unknown): unknown;\n}\n\n/**\n * Implementation of Angular's ErrorHandler provider that can be used as a drop-in replacement for the stock one.\n */\n@Injectable({ providedIn: 'root' })\nclass SentryErrorHandler implements AngularErrorHandler {\n protected readonly _options: ErrorHandlerOptions;\n\n public constructor(options?: ErrorHandlerOptions) {\n this._options = {\n logErrors: true,\n ...options,\n };\n }\n\n /**\n * Method called for every value captured through the ErrorHandler\n */\n public handleError(error: unknown): void {\n const extractedError = this._extractError(error) || 'Handled unknown error';\n\n // Capture handled exception and send it to Sentry.\n const eventId = runOutsideAngular(() => Sentry.captureException(extractedError));\n\n // When in development mode, log the error to console for immediate feedback.\n if (this._options.logErrors) {\n // eslint-disable-next-line no-console\n console.error(extractedError);\n }\n\n // Optionally show user dialog to provide details on what happened.\n if (this._options.showDialog) {\n Sentry.showReportDialog({ ...this._options.dialogOptions, eventId });\n }\n }\n\n /**\n * Used to pull a desired value that will be used to capture an event out of the raw value captured by ErrorHandler.\n */\n protected _extractError(error: unknown): unknown {\n // Allow custom overrides of extracting function\n if (this._options.extractor) {\n const defaultExtractor = this._defaultExtractor.bind(this);\n return this._options.extractor(error, defaultExtractor);\n }\n\n return this._defaultExtractor(error);\n }\n\n /**\n * Default implementation of error extraction that handles default error wrapping, HTTP responses, ErrorEvent and few other known cases.\n */\n protected _defaultExtractor(errorCandidate: unknown): unknown {\n let error = errorCandidate;\n\n // Try to unwrap zone.js error.\n // https://github.com/angular/angular/blob/master/packages/core/src/util/errors.ts\n if (error && (error as { ngOriginalError: Error }).ngOriginalError) {\n error = (error as { ngOriginalError: Error }).ngOriginalError;\n }\n\n // We can handle messages and Error objects directly.\n if (typeof error === 'string' || error instanceof Error) {\n return error;\n }\n\n // If it's http module error, extract as much information from it as we can.\n if (error instanceof HttpErrorResponse) {\n // The `error` property of http exception can be either an `Error` object, which we can use directly...\n if (error.error instanceof Error) {\n return error.error;\n }\n\n // ... or an`ErrorEvent`, which can provide us with the message but no stack...\n if (error.error instanceof ErrorEvent && error.error.message) {\n return error.error.message;\n }\n\n // ...or the request body itself, which we can use as a message instead.\n if (typeof error.error === 'string') {\n return `Server returned code ${error.status} with body \"${error.error}\"`;\n }\n\n // If we don't have any detailed information, fallback to the request message itself.\n return error.message;\n }\n\n // Nothing was extracted, fallback to default error message.\n return null;\n }\n}\n\n/**\n * Factory function that creates an instance of a preconfigured ErrorHandler provider.\n */\nfunction createErrorHandler(config?: ErrorHandlerOptions): SentryErrorHandler {\n return new SentryErrorHandler(config);\n}\n\nexport { createErrorHandler, SentryErrorHandler };\n"]}
package/dist/flags.d.ts DELETED
@@ -1,3 +0,0 @@
1
- /** Flag that is true for debug builds, false otherwise. */
2
- export declare const IS_DEBUG_BUILD: boolean;
3
- //# sourceMappingURL=flags.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../src/flags.ts"],"names":[],"mappings":"AAgBA,2DAA2D;AAC3D,eAAO,MAAM,cAAc,SAAoE,CAAC"}
package/dist/flags.js DELETED
@@ -1,17 +0,0 @@
1
- /*
2
- * This file defines flags and constants that can be modified during compile time in order to facilitate tree shaking
3
- * for users.
4
- *
5
- * Debug flags need to be declared in each package individually and must not be imported across package boundaries,
6
- * because some build tools have trouble tree-shaking imported guards.
7
- *
8
- * As a convention, we define debug flags in a `flags.ts` file in the root of a package's `src` folder.
9
- *
10
- * Debug flag files will contain "magic strings" like `__SENTRY_DEBUG__` that may get replaced with actual values during
11
- * our, or the user's build process. Take care when introducing new flags - they must not throw if they are not
12
- * replaced.
13
- */
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- /** Flag that is true for debug builds, false otherwise. */
16
- exports.IS_DEBUG_BUILD = typeof __SENTRY_DEBUG__ === 'undefined' ? true : __SENTRY_DEBUG__;
17
- //# sourceMappingURL=flags.js.map
package/dist/flags.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"flags.js","sourceRoot":"","sources":["../src/flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;;AAIH,2DAA2D;AAC9C,QAAA,cAAc,GAAG,OAAO,gBAAgB,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC","sourcesContent":["/*\n * This file defines flags and constants that can be modified during compile time in order to facilitate tree shaking\n * for users.\n *\n * Debug flags need to be declared in each package individually and must not be imported across package boundaries,\n * because some build tools have trouble tree-shaking imported guards.\n *\n * As a convention, we define debug flags in a `flags.ts` file in the root of a package's `src` folder.\n *\n * Debug flag files will contain \"magic strings\" like `__SENTRY_DEBUG__` that may get replaced with actual values during\n * our, or the user's build process. Take care when introducing new flags - they must not throw if they are not\n * replaced.\n */\n\ndeclare const __SENTRY_DEBUG__: boolean;\n\n/** Flag that is true for debug builds, false otherwise. */\nexport const IS_DEBUG_BUILD = typeof __SENTRY_DEBUG__ === 'undefined' ? true : __SENTRY_DEBUG__;\n"]}
package/dist/index.d.ts DELETED
@@ -1,7 +0,0 @@
1
- export * from '@sentry/browser';
2
- export { init } from './sdk';
3
- export { createErrorHandler, ErrorHandlerOptions, SentryErrorHandler } from './errorhandler';
4
- export { getActiveTransaction, instrumentAngularRouting, // new name
5
- routingInstrumentation, // legacy name
6
- TraceClassDecorator, TraceMethodDecorator, TraceDirective, TraceModule, TraceService, } from './tracing';
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC7F,OAAO,EACL,oBAAoB,EAEpB,wBAAwB,EAAE,WAAW;AACrC,sBAAsB,EAAE,cAAc;AACtC,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,YAAY,GACb,MAAM,WAAW,CAAC"}
package/dist/index.js DELETED
@@ -1,19 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- var tslib_1 = require("tslib");
3
- tslib_1.__exportStar(require("@sentry/browser"), exports);
4
- var sdk_1 = require("./sdk");
5
- exports.init = sdk_1.init;
6
- var errorhandler_1 = require("./errorhandler");
7
- exports.createErrorHandler = errorhandler_1.createErrorHandler;
8
- exports.SentryErrorHandler = errorhandler_1.SentryErrorHandler;
9
- var tracing_1 = require("./tracing");
10
- exports.getActiveTransaction = tracing_1.getActiveTransaction;
11
- // TODO `instrumentAngularRouting` is just an alias for `routingInstrumentation`; deprecate the latter at some point
12
- exports.instrumentAngularRouting = tracing_1.instrumentAngularRouting;
13
- exports.routingInstrumentation = tracing_1.routingInstrumentation;
14
- exports.TraceClassDecorator = tracing_1.TraceClassDecorator;
15
- exports.TraceMethodDecorator = tracing_1.TraceMethodDecorator;
16
- exports.TraceDirective = tracing_1.TraceDirective;
17
- exports.TraceModule = tracing_1.TraceModule;
18
- exports.TraceService = tracing_1.TraceService;
19
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,0DAAgC;AAEhC,6BAA6B;AAApB,qBAAA,IAAI,CAAA;AACb,+CAA6F;AAApF,4CAAA,kBAAkB,CAAA;AAAuB,4CAAA,kBAAkB,CAAA;AACpE,qCAUmB;AATjB,yCAAA,oBAAoB,CAAA;AACpB,oHAAoH;AACpH,6CAAA,wBAAwB,CAAA;AACxB,2CAAA,sBAAsB,CAAA;AACtB,wCAAA,mBAAmB,CAAA;AACnB,yCAAA,oBAAoB,CAAA;AACpB,mCAAA,cAAc,CAAA;AACd,gCAAA,WAAW,CAAA;AACX,iCAAA,YAAY,CAAA","sourcesContent":["export * from '@sentry/browser';\n\nexport { init } from './sdk';\nexport { createErrorHandler, ErrorHandlerOptions, SentryErrorHandler } from './errorhandler';\nexport {\n getActiveTransaction,\n // TODO `instrumentAngularRouting` is just an alias for `routingInstrumentation`; deprecate the latter at some point\n instrumentAngularRouting, // new name\n routingInstrumentation, // legacy name\n TraceClassDecorator,\n TraceMethodDecorator,\n TraceDirective,\n TraceModule,\n TraceService,\n} from './tracing';\n"]}
package/dist/sdk.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { BrowserOptions } from '@sentry/browser';
2
- /**
3
- * Inits the Angular SDK
4
- */
5
- export declare function init(options: BrowserOptions): void;
6
- //# sourceMappingURL=sdk.d.ts.map
package/dist/sdk.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAoC,MAAM,iBAAiB,CAAC;AAEnF;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAalD"}
package/dist/sdk.js DELETED
@@ -1,21 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- var browser_1 = require("@sentry/browser");
3
- /**
4
- * Inits the Angular SDK
5
- */
6
- function init(options) {
7
- options._metadata = options._metadata || {};
8
- options._metadata.sdk = {
9
- name: 'sentry.javascript.angular',
10
- packages: [
11
- {
12
- name: 'npm:@sentry/angular',
13
- version: browser_1.SDK_VERSION,
14
- },
15
- ],
16
- version: browser_1.SDK_VERSION,
17
- };
18
- browser_1.init(options);
19
- }
20
- exports.init = init;
21
- //# sourceMappingURL=sdk.js.map
package/dist/sdk.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":";AAAA,2CAAmF;AAEnF;;GAEG;AACH,SAAgB,IAAI,CAAC,OAAuB;IAC1C,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;IAC5C,OAAO,CAAC,SAAS,CAAC,GAAG,GAAG;QACtB,IAAI,EAAE,2BAA2B;QACjC,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,qBAAqB;gBAC3B,OAAO,EAAE,qBAAW;aACrB;SACF;QACD,OAAO,EAAE,qBAAW;KACrB,CAAC;IACF,cAAW,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC;AAbD,oBAaC","sourcesContent":["import { BrowserOptions, init as browserInit, SDK_VERSION } from '@sentry/browser';\n\n/**\n * Inits the Angular SDK\n */\nexport function init(options: BrowserOptions): void {\n options._metadata = options._metadata || {};\n options._metadata.sdk = {\n name: 'sentry.javascript.angular',\n packages: [\n {\n name: 'npm:@sentry/angular',\n version: SDK_VERSION,\n },\n ],\n version: SDK_VERSION,\n };\n browserInit(options);\n}\n"]}
package/dist/tracing.d.ts DELETED
@@ -1,61 +0,0 @@
1
- import { AfterViewInit, OnDestroy, OnInit } from '@angular/core';
2
- import { Event, Router } from '@angular/router';
3
- import { Transaction, TransactionContext } from '@sentry/types';
4
- import { Observable } from 'rxjs';
5
- /**
6
- * Creates routing instrumentation for Angular Router.
7
- */
8
- export declare function routingInstrumentation(customStartTransaction: (context: TransactionContext) => Transaction | undefined, startTransactionOnPageLoad?: boolean, startTransactionOnLocationChange?: boolean): void;
9
- export declare const instrumentAngularRouting: typeof routingInstrumentation;
10
- /**
11
- * Grabs active transaction off scope
12
- */
13
- export declare function getActiveTransaction(): Transaction | undefined;
14
- /**
15
- * Angular's Service responsible for hooking into Angular Router and tracking current navigation process.
16
- * Creates a new transaction for every route change and measures a duration of routing process.
17
- */
18
- export declare class TraceService implements OnDestroy {
19
- private readonly _router;
20
- navStart$: Observable<Event>;
21
- navEnd$: Observable<Event>;
22
- private _routingSpan;
23
- private _subscription;
24
- constructor(_router: Router);
25
- /**
26
- * This is used to prevent memory leaks when the root view is created and destroyed multiple times,
27
- * since `subscribe` callbacks capture `this` and prevent many resources from being GC'd.
28
- */
29
- ngOnDestroy(): void;
30
- }
31
- /**
32
- * A directive that can be used to capture initialization lifecycle of the whole component.
33
- */
34
- export declare class TraceDirective implements OnInit, AfterViewInit {
35
- componentName: string;
36
- private _tracingSpan?;
37
- /**
38
- * Implementation of OnInit lifecycle method
39
- * @inheritdoc
40
- */
41
- ngOnInit(): void;
42
- /**
43
- * Implementation of AfterViewInit lifecycle method
44
- * @inheritdoc
45
- */
46
- ngAfterViewInit(): void;
47
- }
48
- /**
49
- * A module serves as a single compilation unit for the `TraceDirective` and can be re-used by any other module.
50
- */
51
- export declare class TraceModule {
52
- }
53
- /**
54
- * Decorator function that can be used to capture initialization lifecycle of the whole component.
55
- */
56
- export declare function TraceClassDecorator(): ClassDecorator;
57
- /**
58
- * Decorator function that can be used to capture a single lifecycle methods of the component.
59
- */
60
- export declare function TraceMethodDecorator(): MethodDecorator;
61
- //# sourceMappingURL=tracing.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../src/tracing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA0C,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACzG,OAAO,EAAE,KAAK,EAAkC,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEhF,OAAO,EAAQ,WAAW,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAgB,MAAM,MAAM,CAAC;AAahD;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,sBAAsB,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,WAAW,GAAG,SAAS,EAChF,0BAA0B,GAAE,OAAc,EAC1C,gCAAgC,GAAE,OAAc,GAC/C,IAAI,CAWN;AAED,eAAO,MAAM,wBAAwB,+BAAyB,CAAC;AAE/D;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,WAAW,GAAG,SAAS,CAW9D;AAED;;;GAGG;AACH,qBACa,YAAa,YAAW,SAAS;IAwDzB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAvDpC,SAAS,EAAE,UAAU,CAAC,KAAK,CAAC,CAqCjC;IAEK,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,CAW/B;IAEF,OAAO,CAAC,YAAY,CAAqB;IACzC,OAAO,CAAC,aAAa,CAAoC;gBAErB,OAAO,EAAE,MAAM;IAKnD;;;OAGG;IACI,WAAW,IAAI,IAAI;CAG3B;AAID;;GAEG;AACH,qBACa,cAAe,YAAW,MAAM,EAAE,aAAa;IACnC,aAAa,EAAE,MAAM,CAAqB;IAEjE,OAAO,CAAC,YAAY,CAAC,CAAO;IAE5B;;;OAGG;IACI,QAAQ,IAAI,IAAI;IAUvB;;;OAGG;IACI,eAAe,IAAI,IAAI;CAK/B;AAED;;GAEG;AACH,qBAIa,WAAW;CAAG;AAE3B;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,cAAc,CAiCpD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,eAAe,CAuBtD"}
package/dist/tracing.js DELETED
@@ -1,241 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- var tslib_1 = require("tslib");
3
- var core_1 = require("@angular/core");
4
- var router_1 = require("@angular/router");
5
- var browser_1 = require("@sentry/browser");
6
- var utils_1 = require("@sentry/utils");
7
- var rxjs_1 = require("rxjs");
8
- var operators_1 = require("rxjs/operators");
9
- var constants_1 = require("./constants");
10
- var flags_1 = require("./flags");
11
- var zone_1 = require("./zone");
12
- var instrumentationInitialized;
13
- var stashedStartTransaction;
14
- var stashedStartTransactionOnLocationChange;
15
- var global = utils_1.getGlobalObject();
16
- /**
17
- * Creates routing instrumentation for Angular Router.
18
- */
19
- function routingInstrumentation(customStartTransaction, startTransactionOnPageLoad, startTransactionOnLocationChange) {
20
- if (startTransactionOnPageLoad === void 0) { startTransactionOnPageLoad = true; }
21
- if (startTransactionOnLocationChange === void 0) { startTransactionOnLocationChange = true; }
22
- instrumentationInitialized = true;
23
- stashedStartTransaction = customStartTransaction;
24
- stashedStartTransactionOnLocationChange = startTransactionOnLocationChange;
25
- if (startTransactionOnPageLoad && global && global.location) {
26
- customStartTransaction({
27
- name: global.location.pathname,
28
- op: 'pageload',
29
- });
30
- }
31
- }
32
- exports.routingInstrumentation = routingInstrumentation;
33
- exports.instrumentAngularRouting = routingInstrumentation;
34
- /**
35
- * Grabs active transaction off scope
36
- */
37
- function getActiveTransaction() {
38
- var currentHub = browser_1.getCurrentHub();
39
- if (currentHub) {
40
- var scope = currentHub.getScope();
41
- if (scope) {
42
- return scope.getTransaction();
43
- }
44
- }
45
- return undefined;
46
- }
47
- exports.getActiveTransaction = getActiveTransaction;
48
- /**
49
- * Angular's Service responsible for hooking into Angular Router and tracking current navigation process.
50
- * Creates a new transaction for every route change and measures a duration of routing process.
51
- */
52
- var TraceService = /** @class */ (function () {
53
- function TraceService(_router) {
54
- var _this = this;
55
- this._router = _router;
56
- this.navStart$ = this._router.events.pipe(operators_1.filter(function (event) { return event instanceof router_1.NavigationStart; }), operators_1.tap(function (event) {
57
- if (!instrumentationInitialized) {
58
- flags_1.IS_DEBUG_BUILD &&
59
- utils_1.logger.error('Angular integration has tracing enabled, but Tracing integration is not configured');
60
- return;
61
- }
62
- var navigationEvent = event;
63
- var strippedUrl = utils_1.stripUrlQueryAndFragment(navigationEvent.url);
64
- var activeTransaction = getActiveTransaction();
65
- if (!activeTransaction && stashedStartTransactionOnLocationChange) {
66
- activeTransaction = stashedStartTransaction({
67
- name: strippedUrl,
68
- op: 'navigation',
69
- });
70
- }
71
- if (activeTransaction) {
72
- if (_this._routingSpan) {
73
- _this._routingSpan.finish();
74
- }
75
- _this._routingSpan = activeTransaction.startChild({
76
- description: "" + navigationEvent.url,
77
- op: constants_1.ANGULAR_ROUTING_OP,
78
- tags: tslib_1.__assign({ 'routing.instrumentation': '@sentry/angular', url: strippedUrl }, (navigationEvent.navigationTrigger && {
79
- navigationTrigger: navigationEvent.navigationTrigger,
80
- })),
81
- });
82
- }
83
- }));
84
- this.navEnd$ = this._router.events.pipe(operators_1.filter(function (event) { return event instanceof router_1.NavigationEnd; }), operators_1.tap(function () {
85
- if (_this._routingSpan) {
86
- zone_1.runOutsideAngular(function () {
87
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
88
- _this._routingSpan.finish();
89
- });
90
- _this._routingSpan = null;
91
- }
92
- }));
93
- this._routingSpan = null;
94
- this._subscription = new rxjs_1.Subscription();
95
- this._subscription.add(this.navStart$.subscribe());
96
- this._subscription.add(this.navEnd$.subscribe());
97
- }
98
- /**
99
- * This is used to prevent memory leaks when the root view is created and destroyed multiple times,
100
- * since `subscribe` callbacks capture `this` and prevent many resources from being GC'd.
101
- */
102
- TraceService.prototype.ngOnDestroy = function () {
103
- this._subscription.unsubscribe();
104
- };
105
- TraceService = tslib_1.__decorate([
106
- core_1.Injectable({ providedIn: 'root' })
107
- ], TraceService);
108
- return TraceService;
109
- }());
110
- exports.TraceService = TraceService;
111
- var UNKNOWN_COMPONENT = 'unknown';
112
- /**
113
- * A directive that can be used to capture initialization lifecycle of the whole component.
114
- */
115
- var TraceDirective = /** @class */ (function () {
116
- function TraceDirective() {
117
- this.componentName = UNKNOWN_COMPONENT;
118
- }
119
- /**
120
- * Implementation of OnInit lifecycle method
121
- * @inheritdoc
122
- */
123
- TraceDirective.prototype.ngOnInit = function () {
124
- var activeTransaction = getActiveTransaction();
125
- if (activeTransaction) {
126
- this._tracingSpan = activeTransaction.startChild({
127
- description: "<" + this.componentName + ">",
128
- op: constants_1.ANGULAR_INIT_OP,
129
- });
130
- }
131
- };
132
- /**
133
- * Implementation of AfterViewInit lifecycle method
134
- * @inheritdoc
135
- */
136
- TraceDirective.prototype.ngAfterViewInit = function () {
137
- if (this._tracingSpan) {
138
- this._tracingSpan.finish();
139
- }
140
- };
141
- tslib_1.__decorate([
142
- core_1.Input('trace')
143
- ], TraceDirective.prototype, "componentName", void 0);
144
- TraceDirective = tslib_1.__decorate([
145
- core_1.Directive({ selector: '[trace]' })
146
- ], TraceDirective);
147
- return TraceDirective;
148
- }());
149
- exports.TraceDirective = TraceDirective;
150
- /**
151
- * A module serves as a single compilation unit for the `TraceDirective` and can be re-used by any other module.
152
- */
153
- var TraceModule = /** @class */ (function () {
154
- function TraceModule() {
155
- }
156
- TraceModule = tslib_1.__decorate([
157
- core_1.NgModule({
158
- declarations: [TraceDirective],
159
- exports: [TraceDirective],
160
- })
161
- ], TraceModule);
162
- return TraceModule;
163
- }());
164
- exports.TraceModule = TraceModule;
165
- /**
166
- * Decorator function that can be used to capture initialization lifecycle of the whole component.
167
- */
168
- function TraceClassDecorator() {
169
- var tracingSpan;
170
- /* eslint-disable @typescript-eslint/no-unsafe-member-access */
171
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
172
- return function (target) {
173
- var originalOnInit = target.prototype.ngOnInit;
174
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
175
- target.prototype.ngOnInit = function () {
176
- var args = [];
177
- for (var _i = 0; _i < arguments.length; _i++) {
178
- args[_i] = arguments[_i];
179
- }
180
- var activeTransaction = getActiveTransaction();
181
- if (activeTransaction) {
182
- tracingSpan = activeTransaction.startChild({
183
- description: "<" + target.name + ">",
184
- op: constants_1.ANGULAR_INIT_OP,
185
- });
186
- }
187
- if (originalOnInit) {
188
- return originalOnInit.apply(this, args);
189
- }
190
- };
191
- var originalAfterViewInit = target.prototype.ngAfterViewInit;
192
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
193
- target.prototype.ngAfterViewInit = function () {
194
- var args = [];
195
- for (var _i = 0; _i < arguments.length; _i++) {
196
- args[_i] = arguments[_i];
197
- }
198
- if (tracingSpan) {
199
- tracingSpan.finish();
200
- }
201
- if (originalAfterViewInit) {
202
- return originalAfterViewInit.apply(this, args);
203
- }
204
- };
205
- };
206
- /* eslint-enable @typescript-eslint/no-unsafe-member-access */
207
- }
208
- exports.TraceClassDecorator = TraceClassDecorator;
209
- /**
210
- * Decorator function that can be used to capture a single lifecycle methods of the component.
211
- */
212
- function TraceMethodDecorator() {
213
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/ban-types
214
- return function (target, propertyKey, descriptor) {
215
- var originalMethod = descriptor.value;
216
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
217
- descriptor.value = function () {
218
- var args = [];
219
- for (var _i = 0; _i < arguments.length; _i++) {
220
- args[_i] = arguments[_i];
221
- }
222
- var now = utils_1.timestampWithMs();
223
- var activeTransaction = getActiveTransaction();
224
- if (activeTransaction) {
225
- activeTransaction.startChild({
226
- description: "<" + target.constructor.name + ">",
227
- endTimestamp: now,
228
- op: constants_1.ANGULAR_OP + "." + String(propertyKey),
229
- startTimestamp: now,
230
- });
231
- }
232
- if (originalMethod) {
233
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
234
- return originalMethod.apply(this, args);
235
- }
236
- };
237
- return descriptor;
238
- };
239
- }
240
- exports.TraceMethodDecorator = TraceMethodDecorator;
241
- //# sourceMappingURL=tracing.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tracing.js","sourceRoot":"","sources":["../src/tracing.ts"],"names":[],"mappings":";;AAAA,sCAAyG;AACzG,0CAAgF;AAChF,2CAAgD;AAEhD,uCAAmG;AACnG,6BAAgD;AAChD,4CAA6C;AAE7C,yCAA8E;AAC9E,iCAAyC;AACzC,+BAA2C;AAE3C,IAAI,0BAAmC,CAAC;AACxC,IAAI,uBAAiF,CAAC;AACtF,IAAI,uCAAgD,CAAC;AAErD,IAAM,MAAM,GAAG,uBAAe,EAAU,CAAC;AAEzC;;GAEG;AACH,SAAgB,sBAAsB,CACpC,sBAAgF,EAChF,0BAA0C,EAC1C,gCAAgD;IADhD,2CAAA,EAAA,iCAA0C;IAC1C,iDAAA,EAAA,uCAAgD;IAEhD,0BAA0B,GAAG,IAAI,CAAC;IAClC,uBAAuB,GAAG,sBAAsB,CAAC;IACjD,uCAAuC,GAAG,gCAAgC,CAAC;IAE3E,IAAI,0BAA0B,IAAI,MAAM,IAAI,MAAM,CAAC,QAAQ,EAAE;QAC3D,sBAAsB,CAAC;YACrB,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ;YAC9B,EAAE,EAAE,UAAU;SACf,CAAC,CAAC;KACJ;AACH,CAAC;AAfD,wDAeC;AAEY,QAAA,wBAAwB,GAAG,sBAAsB,CAAC;AAE/D;;GAEG;AACH,SAAgB,oBAAoB;IAClC,IAAM,UAAU,GAAG,uBAAa,EAAE,CAAC;IAEnC,IAAI,UAAU,EAAE;QACd,IAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC;QACpC,IAAI,KAAK,EAAE;YACT,OAAO,KAAK,CAAC,cAAc,EAAE,CAAC;SAC/B;KACF;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAXD,oDAWC;AAED;;;GAGG;A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SAAS,CAAC,eAAe,GAAG;YAAU,cAAc;iBAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;gBAAd,yBAAc;;YACzD,IAAI,WAAW,EAAE;gBACf,WAAW,CAAC,MAAM,EAAE,CAAC;aACtB;YACD,IAAI,qBAAqB,EAAE;gBACzB,OAAO,qBAAqB,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;aAChD;QACH,CAAC,CAAC;IACJ,CAAC,CAAC;IACF,8DAA8D;AAChE,CAAC;AAjCD,kDAiCC;AAED;;GAEG;AACH,SAAgB,oBAAoB;IAClC,0GAA0G;IAC1G,OAAO,UAAC,MAAc,EAAE,WAA4B,EAAE,UAA8B;QAClF,IAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QACxC,8DAA8D;QAC9D,UAAU,CAAC,KAAK,GAAG;YAAU,cAAc;iBAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;gBAAd,yBAAc;;YACzC,IAAM,GAAG,GAAG,uBAAe,EAAE,CAAC;YAC9B,IAAM,iBAAiB,GAAG,oBAAoB,EAAE,CAAC;YACjD,IAAI,iBAAiB,EAAE;gBACrB,iBAAiB,CAAC,UAAU,CAAC;oBAC3B,WAAW,EAAE,MAAI,MAAM,CAAC,WAAW,CAAC,IAAI,MAAG;oBAC3C,YAAY,EAAE,GAAG;oBACjB,EAAE,EAAK,sBAAU,SAAI,MAAM,CAAC,WAAW,CAAG;oBAC1C,cAAc,EAAE,GAAG;iBACpB,CAAC,CAAC;aACJ;YACD,IAAI,cAAc,EAAE;gBAClB,sEAAsE;gBACtE,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;aACzC;QACH,CAAC,CAAC;QACF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AAvBD,oDAuBC","sourcesContent":["import { AfterViewInit, Directive, Injectable, Input, NgModule, OnDestroy, OnInit } from '@angular/core';\nimport { Event, NavigationEnd, NavigationStart, Router } from '@angular/router';\nimport { getCurrentHub } from '@sentry/browser';\nimport { Span, Transaction, TransactionContext } from '@sentry/types';\nimport { getGlobalObject, logger, stripUrlQueryAndFragment, timestampWithMs } from '@sentry/utils';\nimport { Observable, Subscription } from 'rxjs';\nimport { filter, tap } from 'rxjs/operators';\n\nimport { ANGULAR_INIT_OP, ANGULAR_OP, ANGULAR_ROUTING_OP } from './constants';\nimport { IS_DEBUG_BUILD } from './flags';\nimport { runOutsideAngular } from './zone';\n\nlet instrumentationInitialized: boolean;\nlet stashedStartTransaction: (context: TransactionContext) => Transaction | undefined;\nlet stashedStartTransactionOnLocationChange: boolean;\n\nconst global = getGlobalObject<Window>();\n\n/**\n * Creates routing instrumentation for Angular Router.\n */\nexport function routingInstrumentation(\n customStartTransaction: (context: TransactionContext) => Transaction | undefined,\n startTransactionOnPageLoad: boolean = true,\n startTransactionOnLocationChange: boolean = true,\n): void {\n instrumentationInitialized = true;\n stashedStartTransaction = customStartTransaction;\n stashedStartTransactionOnLocationChange = startTransactionOnLocationChange;\n\n if (startTransactionOnPageLoad && global && global.location) {\n customStartTransaction({\n name: global.location.pathname,\n op: 'pageload',\n });\n }\n}\n\nexport const instrumentAngularRouting = routingInstrumentation;\n\n/**\n * Grabs active transaction off scope\n */\nexport function getActiveTransaction(): Transaction | undefined {\n const currentHub = getCurrentHub();\n\n if (currentHub) {\n const scope = currentHub.getScope();\n if (scope) {\n return scope.getTransaction();\n }\n }\n\n return undefined;\n}\n\n/**\n * Angular's Service responsible for hooking into Angular Router and tracking current navigation process.\n * Creates a new transaction for every route change and measures a duration of routing process.\n */\n@Injectable({ providedIn: 'root' })\nexport class TraceService implements OnDestroy {\n public navStart$: Observable<Event> = this._router.events.pipe(\n filter(event => event instanceof NavigationStart),\n tap(event => {\n if (!instrumentationInitialized) {\n IS_DEBUG_BUILD &&\n logger.error('Angular integration has tracing enabled, but Tracing integration is not configured');\n return;\n }\n\n const navigationEvent = event as NavigationStart;\n const strippedUrl = stripUrlQueryAndFragment(navigationEvent.url);\n let activeTransaction = getActiveTransaction();\n\n if (!activeTransaction && stashedStartTransactionOnLocationChange) {\n activeTransaction = stashedStartTransaction({\n name: strippedUrl,\n op: 'navigation',\n });\n }\n\n if (activeTransaction) {\n if (this._routingSpan) {\n this._routingSpan.finish();\n }\n this._routingSpan = activeTransaction.startChild({\n description: `${navigationEvent.url}`,\n op: ANGULAR_ROUTING_OP,\n tags: {\n 'routing.instrumentation': '@sentry/angular',\n url: strippedUrl,\n ...(navigationEvent.navigationTrigger && {\n navigationTrigger: navigationEvent.navigationTrigger,\n }),\n },\n });\n }\n }),\n );\n\n public navEnd$: Observable<Event> = this._router.events.pipe(\n filter(event => event instanceof NavigationEnd),\n tap(() => {\n if (this._routingSpan) {\n runOutsideAngular(() => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this._routingSpan!.finish();\n });\n this._routingSpan = null;\n }\n }),\n );\n\n private _routingSpan: Span | null = null;\n private _subscription: Subscription = new Subscription();\n\n public constructor(private readonly _router: Router) {\n this._subscription.add(this.navStart$.subscribe());\n this._subscription.add(this.navEnd$.subscribe());\n }\n\n /**\n * This is used to prevent memory leaks when the root view is created and destroyed multiple times,\n * since `subscribe` callbacks capture `this` and prevent many resources from being GC'd.\n */\n public ngOnDestroy(): void {\n this._subscription.unsubscribe();\n }\n}\n\nconst UNKNOWN_COMPONENT = 'unknown';\n\n/**\n * A directive that can be used to capture initialization lifecycle of the whole component.\n */\n@Directive({ selector: '[trace]' })\nexport class TraceDirective implements OnInit, AfterViewInit {\n @Input('trace') public componentName: string = UNKNOWN_COMPONENT;\n\n private _tracingSpan?: Span;\n\n /**\n * Implementation of OnInit lifecycle method\n * @inheritdoc\n */\n public ngOnInit(): void {\n const activeTransaction = getActiveTransaction();\n if (activeTransaction) {\n this._tracingSpan = activeTransaction.startChild({\n description: `<${this.componentName}>`,\n op: ANGULAR_INIT_OP,\n });\n }\n }\n\n /**\n * Implementation of AfterViewInit lifecycle method\n * @inheritdoc\n */\n public ngAfterViewInit(): void {\n if (this._tracingSpan) {\n this._tracingSpan.finish();\n }\n }\n}\n\n/**\n * A module serves as a single compilation unit for the `TraceDirective` and can be re-used by any other module.\n */\n@NgModule({\n declarations: [TraceDirective],\n exports: [TraceDirective],\n})\nexport class TraceModule {}\n\n/**\n * Decorator function that can be used to capture initialization lifecycle of the whole component.\n */\nexport function TraceClassDecorator(): ClassDecorator {\n let tracingSpan: Span;\n\n /* eslint-disable @typescript-eslint/no-unsafe-member-access */\n // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n return target => {\n const originalOnInit = target.prototype.ngOnInit;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n target.prototype.ngOnInit = function (...args: any[]): ReturnType<typeof originalOnInit> {\n const activeTransaction = getActiveTransaction();\n if (activeTransaction) {\n tracingSpan = activeTransaction.startChild({\n description: `<${target.name}>`,\n op: ANGULAR_INIT_OP,\n });\n }\n if (originalOnInit) {\n return originalOnInit.apply(this, args);\n }\n };\n\n const originalAfterViewInit = target.prototype.ngAfterViewInit;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n target.prototype.ngAfterViewInit = function (...args: any[]): ReturnType<typeof originalAfterViewInit> {\n if (tracingSpan) {\n tracingSpan.finish();\n }\n if (originalAfterViewInit) {\n return originalAfterViewInit.apply(this, args);\n }\n };\n };\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n}\n\n/**\n * Decorator function that can be used to capture a single lifecycle methods of the component.\n */\nexport function TraceMethodDecorator(): MethodDecorator {\n // eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/ban-types\n return (target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n const originalMethod = descriptor.value;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n descriptor.value = function (...args: any[]): ReturnType<typeof originalMethod> {\n const now = timestampWithMs();\n const activeTransaction = getActiveTransaction();\n if (activeTransaction) {\n activeTransaction.startChild({\n description: `<${target.constructor.name}>`,\n endTimestamp: now,\n op: `${ANGULAR_OP}.${String(propertyKey)}`,\n startTimestamp: now,\n });\n }\n if (originalMethod) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return originalMethod.apply(this, args);\n }\n };\n return descriptor;\n };\n}\n"]}
package/dist/zone.d.ts DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * The function that does the same job as `NgZone.runOutsideAngular`.
3
- */
4
- export declare function runOutsideAngular<T>(callback: () => T): T;
5
- //# sourceMappingURL=zone.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"zone.d.ts","sourceRoot":"","sources":["../src/zone.ts"],"names":[],"mappings":"AAaA;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAWzD"}
package/dist/zone.js DELETED
@@ -1,26 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- // There're 2 types of Angular applications:
3
- // 1) zone-full (by default)
4
- // 2) zone-less
5
- // The developer can avoid importing the `zone.js` package and tells Angular that
6
- // he is responsible for running the change detection by himself. This is done by
7
- // "nooping" the zone through `CompilerOptions` when bootstrapping the root module.
8
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
9
- var isNgZoneEnabled = typeof Zone !== 'undefined' && !!Zone.current;
10
- /**
11
- * The function that does the same job as `NgZone.runOutsideAngular`.
12
- */
13
- function runOutsideAngular(callback) {
14
- // The `Zone.root.run` basically will run the `callback` in the most parent zone.
15
- // Any asynchronous API used inside the `callback` won't catch Angular's zone
16
- // since `Zone.current` will reference `Zone.root`.
17
- // The Angular's zone is forked from the `Zone.root`. In this case, `zone.js` won't
18
- // trigger change detection, and `ApplicationRef.tick()` will not be run.
19
- // Caretaker note: we're using `Zone.root` except `NgZone.runOutsideAngular` since this
20
- // will require injecting the `NgZone` facade. That will create a breaking change for
21
- // projects already using the `@sentry/angular`.
22
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
23
- return isNgZoneEnabled ? Zone.root.run(callback) : callback();
24
- }
25
- exports.runOutsideAngular = runOutsideAngular;
26
- //# sourceMappingURL=zone.js.map