@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.
- package/README.md +4 -0
- package/bundles/sentry-angular.umd.js +442 -0
- package/bundles/sentry-angular.umd.js.map +1 -0
- package/bundles/sentry-angular.umd.min.js +2 -0
- package/bundles/sentry-angular.umd.min.js.map +1 -0
- package/{build/types/constants.d.ts → constants.d.ts} +4 -0
- package/constants.d.ts.map +1 -0
- package/{build/types/errorhandler.d.ts → errorhandler.d.ts} +0 -0
- package/errorhandler.d.ts.map +1 -0
- package/esm2015/constants.js +8 -0
- package/esm2015/errorhandler.js +90 -0
- package/esm2015/flags.js +16 -0
- package/esm2015/index.js +9 -0
- package/esm2015/sdk.js +33 -0
- package/esm2015/sentry-angular.js +5 -0
- package/esm2015/tracing.js +218 -0
- package/esm2015/zone.js +24 -0
- package/fesm2015/sentry-angular.js +385 -0
- package/fesm2015/sentry-angular.js.map +1 -0
- package/{build/types/flags.d.ts → flags.d.ts} +0 -0
- package/flags.d.ts.map +1 -0
- package/{build/types/index.d.ts → index.d.ts} +2 -1
- package/index.d.ts.map +1 -0
- package/package.json +16 -41
- package/{build/types/sdk.d.ts → sdk.d.ts} +0 -0
- package/sdk.d.ts.map +1 -0
- package/sentry-angular.d.ts +5 -0
- package/sentry-angular.d.ts.map +1 -0
- package/sentry-angular.metadata.json +1 -0
- package/{build/types/tracing.d.ts → tracing.d.ts} +0 -0
- package/tracing.d.ts.map +1 -0
- package/{build/types/zone.d.ts → zone.d.ts} +0 -0
- package/zone.d.ts.map +1 -0
- package/build/types/constants.d.ts.map +0 -1
- package/build/types/errorhandler.d.ts.map +0 -1
- package/build/types/flags.d.ts.map +0 -1
- package/build/types/index.d.ts.map +0 -1
- package/build/types/sdk.d.ts.map +0 -1
- package/build/types/tracing.d.ts.map +0 -1
- package/build/types/zone.d.ts.map +0 -1
- package/dist/constants.d.ts +0 -4
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -5
- package/dist/constants.js.map +0 -1
- package/dist/errorhandler.d.ts +0 -41
- package/dist/errorhandler.d.ts.map +0 -1
- package/dist/errorhandler.js +0 -89
- package/dist/errorhandler.js.map +0 -1
- package/dist/flags.d.ts +0 -3
- package/dist/flags.d.ts.map +0 -1
- package/dist/flags.js +0 -17
- package/dist/flags.js.map +0 -1
- package/dist/index.d.ts +0 -7
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -19
- package/dist/index.js.map +0 -1
- package/dist/sdk.d.ts +0 -6
- package/dist/sdk.d.ts.map +0 -1
- package/dist/sdk.js +0 -21
- package/dist/sdk.js.map +0 -1
- package/dist/tracing.d.ts +0 -61
- package/dist/tracing.d.ts.map +0 -1
- package/dist/tracing.js +0 -241
- package/dist/tracing.js.map +0 -1
- package/dist/zone.d.ts +0 -5
- package/dist/zone.d.ts.map +0 -1
- package/dist/zone.js +0 -26
- package/dist/zone.js.map +0 -1
- package/esm/constants.d.ts +0 -4
- package/esm/constants.d.ts.map +0 -1
- package/esm/constants.js +0 -4
- package/esm/constants.js.map +0 -1
- package/esm/errorhandler.d.ts +0 -41
- package/esm/errorhandler.d.ts.map +0 -1
- package/esm/errorhandler.js +0 -87
- package/esm/errorhandler.js.map +0 -1
- package/esm/flags.d.ts +0 -3
- package/esm/flags.d.ts.map +0 -1
- package/esm/flags.js +0 -16
- package/esm/flags.js.map +0 -1
- package/esm/index.d.ts +0 -7
- package/esm/index.d.ts.map +0 -1
- package/esm/index.js +0 -9
- package/esm/index.js.map +0 -1
- package/esm/sdk.d.ts +0 -6
- package/esm/sdk.d.ts.map +0 -1
- package/esm/sdk.js +0 -19
- package/esm/sdk.js.map +0 -1
- package/esm/tracing.d.ts +0 -61
- package/esm/tracing.d.ts.map +0 -1
- package/esm/tracing.js +0 -236
- package/esm/tracing.js.map +0 -1
- package/esm/zone.d.ts +0 -5
- package/esm/zone.d.ts.map +0 -1
- package/esm/zone.js +0 -24
- package/esm/zone.js.map +0 -1
package/README.md
CHANGED
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
- [Official SDK Docs](https://docs.sentry.io/platforms/javascript/angular/)
|
|
13
13
|
- [TypeDoc](http://getsentry.github.io/sentry-javascript/)
|
|
14
14
|
|
|
15
|
+
## Angular Version Compatibility
|
|
16
|
+
|
|
17
|
+
The latest version of this SDK officially supports Angular 10-13. If you are using an older version of Angular and experience problems with the Angular SDK, we recommend downgrading the SDK to version 6.x.
|
|
18
|
+
|
|
15
19
|
## General
|
|
16
20
|
|
|
17
21
|
This package is a wrapper around `@sentry/browser`, with added functionality related to Angular. All methods available
|
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@sentry/browser'), require('@angular/core'), require('@sentry/utils'), require('@angular/common/http'), require('@angular/router'), require('rxjs'), require('rxjs/operators')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@sentry/angular', ['exports', '@sentry/browser', '@angular/core', '@sentry/utils', '@angular/common/http', '@angular/router', 'rxjs', 'rxjs/operators'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.sentry = global.sentry || {}, global.sentry.angular = {}), global.Sentry, global.ng.core, global.Sentry.util, global.ng.common.http, global.ng.router, global.rxjs, global.rxjs.operators));
|
|
5
|
+
})(this, (function (exports, Sentry, i0, utils, http, i1, rxjs, operators) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var Sentry__namespace = /*#__PURE__*/_interopNamespace(Sentry);
|
|
26
|
+
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
27
|
+
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
28
|
+
|
|
29
|
+
var ANGULAR_ROUTING_OP = 'ui.angular.routing';
|
|
30
|
+
var ANGULAR_INIT_OP = 'ui.angular.init';
|
|
31
|
+
var ANGULAR_OP = 'ui.angular';
|
|
32
|
+
/**
|
|
33
|
+
* Minimum Angular version this SDK supports
|
|
34
|
+
*/
|
|
35
|
+
var ANGULAR_MINIMUM_VERSION = 10;
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
* This file defines flags and constants that can be modified during compile time in order to facilitate tree shaking
|
|
39
|
+
* for users.
|
|
40
|
+
*
|
|
41
|
+
* Debug flags need to be declared in each package individually and must not be imported across package boundaries,
|
|
42
|
+
* because some build tools have trouble tree-shaking imported guards.
|
|
43
|
+
*
|
|
44
|
+
* As a convention, we define debug flags in a `flags.ts` file in the root of a package's `src` folder.
|
|
45
|
+
*
|
|
46
|
+
* Debug flag files will contain "magic strings" like `__SENTRY_DEBUG__` that may get replaced with actual values during
|
|
47
|
+
* our, or the user's build process. Take care when introducing new flags - they must not throw if they are not
|
|
48
|
+
* replaced.
|
|
49
|
+
*/
|
|
50
|
+
/** Flag that is true for debug builds, false otherwise. */
|
|
51
|
+
var IS_DEBUG_BUILD = typeof __SENTRY_DEBUG__ === 'undefined' ? true : __SENTRY_DEBUG__;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Inits the Angular SDK
|
|
55
|
+
*/
|
|
56
|
+
function init(options) {
|
|
57
|
+
options._metadata = options._metadata || {};
|
|
58
|
+
options._metadata.sdk = {
|
|
59
|
+
name: 'sentry.javascript.angular',
|
|
60
|
+
packages: [
|
|
61
|
+
{
|
|
62
|
+
name: 'npm:@sentry/angular',
|
|
63
|
+
version: Sentry.SDK_VERSION,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
version: Sentry.SDK_VERSION,
|
|
67
|
+
};
|
|
68
|
+
checkAngularVersion();
|
|
69
|
+
Sentry.init(options);
|
|
70
|
+
}
|
|
71
|
+
function checkAngularVersion() {
|
|
72
|
+
if (i0.VERSION && i0.VERSION.major) {
|
|
73
|
+
var major = parseInt(i0.VERSION.major, 10);
|
|
74
|
+
if (major < ANGULAR_MINIMUM_VERSION) {
|
|
75
|
+
IS_DEBUG_BUILD &&
|
|
76
|
+
utils.logger.warn("The Sentry SDK does not officially support Angular " + major + ".", "This version of the Sentry SDK supports Angular " + ANGULAR_MINIMUM_VERSION + " and above.", 'Please consider upgrading your Angular version or downgrading the Sentry SDK.');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// There're 2 types of Angular applications:
|
|
82
|
+
// 1) zone-full (by default)
|
|
83
|
+
// 2) zone-less
|
|
84
|
+
// The developer can avoid importing the `zone.js` package and tells Angular that
|
|
85
|
+
// he is responsible for running the change detection by himself. This is done by
|
|
86
|
+
// "nooping" the zone through `CompilerOptions` when bootstrapping the root module.
|
|
87
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
88
|
+
var isNgZoneEnabled = typeof Zone !== 'undefined' && !!Zone.current;
|
|
89
|
+
/**
|
|
90
|
+
* The function that does the same job as `NgZone.runOutsideAngular`.
|
|
91
|
+
*/
|
|
92
|
+
function runOutsideAngular(callback) {
|
|
93
|
+
// The `Zone.root.run` basically will run the `callback` in the most parent zone.
|
|
94
|
+
// Any asynchronous API used inside the `callback` won't catch Angular's zone
|
|
95
|
+
// since `Zone.current` will reference `Zone.root`.
|
|
96
|
+
// The Angular's zone is forked from the `Zone.root`. In this case, `zone.js` won't
|
|
97
|
+
// trigger change detection, and `ApplicationRef.tick()` will not be run.
|
|
98
|
+
// Caretaker note: we're using `Zone.root` except `NgZone.runOutsideAngular` since this
|
|
99
|
+
// will require injecting the `NgZone` facade. That will create a breaking change for
|
|
100
|
+
// projects already using the `@sentry/angular`.
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
102
|
+
return isNgZoneEnabled ? Zone.root.run(callback) : callback();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Implementation of Angular's ErrorHandler provider that can be used as a drop-in replacement for the stock one.
|
|
107
|
+
*/
|
|
108
|
+
var SentryErrorHandler = /** @class */ (function () {
|
|
109
|
+
function SentryErrorHandler(options) {
|
|
110
|
+
this._options = Object.assign({ logErrors: true }, options);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Method called for every value captured through the ErrorHandler
|
|
114
|
+
*/
|
|
115
|
+
SentryErrorHandler.prototype.handleError = function (error) {
|
|
116
|
+
var extractedError = this._extractError(error) || 'Handled unknown error';
|
|
117
|
+
// Capture handled exception and send it to Sentry.
|
|
118
|
+
var eventId = runOutsideAngular(function () { return Sentry__namespace.captureException(extractedError); });
|
|
119
|
+
// When in development mode, log the error to console for immediate feedback.
|
|
120
|
+
if (this._options.logErrors) {
|
|
121
|
+
// eslint-disable-next-line no-console
|
|
122
|
+
console.error(extractedError);
|
|
123
|
+
}
|
|
124
|
+
// Optionally show user dialog to provide details on what happened.
|
|
125
|
+
if (this._options.showDialog) {
|
|
126
|
+
Sentry__namespace.showReportDialog(Object.assign(Object.assign({}, this._options.dialogOptions), { eventId: eventId }));
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Used to pull a desired value that will be used to capture an event out of the raw value captured by ErrorHandler.
|
|
131
|
+
*/
|
|
132
|
+
SentryErrorHandler.prototype._extractError = function (error) {
|
|
133
|
+
// Allow custom overrides of extracting function
|
|
134
|
+
if (this._options.extractor) {
|
|
135
|
+
var defaultExtractor = this._defaultExtractor.bind(this);
|
|
136
|
+
return this._options.extractor(error, defaultExtractor);
|
|
137
|
+
}
|
|
138
|
+
return this._defaultExtractor(error);
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Default implementation of error extraction that handles default error wrapping, HTTP responses, ErrorEvent and few other known cases.
|
|
142
|
+
*/
|
|
143
|
+
SentryErrorHandler.prototype._defaultExtractor = function (errorCandidate) {
|
|
144
|
+
var error = errorCandidate;
|
|
145
|
+
// Try to unwrap zone.js error.
|
|
146
|
+
// https://github.com/angular/angular/blob/master/packages/core/src/util/errors.ts
|
|
147
|
+
if (error && error.ngOriginalError) {
|
|
148
|
+
error = error.ngOriginalError;
|
|
149
|
+
}
|
|
150
|
+
// We can handle messages and Error objects directly.
|
|
151
|
+
if (typeof error === 'string' || error instanceof Error) {
|
|
152
|
+
return error;
|
|
153
|
+
}
|
|
154
|
+
// If it's http module error, extract as much information from it as we can.
|
|
155
|
+
if (error instanceof http.HttpErrorResponse) {
|
|
156
|
+
// The `error` property of http exception can be either an `Error` object, which we can use directly...
|
|
157
|
+
if (error.error instanceof Error) {
|
|
158
|
+
return error.error;
|
|
159
|
+
}
|
|
160
|
+
// ... or an`ErrorEvent`, which can provide us with the message but no stack...
|
|
161
|
+
if (error.error instanceof ErrorEvent && error.error.message) {
|
|
162
|
+
return error.error.message;
|
|
163
|
+
}
|
|
164
|
+
// ...or the request body itself, which we can use as a message instead.
|
|
165
|
+
if (typeof error.error === 'string') {
|
|
166
|
+
return "Server returned code " + error.status + " with body \"" + error.error + "\"";
|
|
167
|
+
}
|
|
168
|
+
// If we don't have any detailed information, fallback to the request message itself.
|
|
169
|
+
return error.message;
|
|
170
|
+
}
|
|
171
|
+
// Nothing was extracted, fallback to default error message.
|
|
172
|
+
return null;
|
|
173
|
+
};
|
|
174
|
+
return SentryErrorHandler;
|
|
175
|
+
}());
|
|
176
|
+
SentryErrorHandler.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function SentryErrorHandler_Factory() { return new SentryErrorHandler(i0__namespace.ɵɵinject("errorHandlerOptions")); }, token: SentryErrorHandler, providedIn: "root" });
|
|
177
|
+
SentryErrorHandler.decorators = [
|
|
178
|
+
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
|
179
|
+
];
|
|
180
|
+
SentryErrorHandler.ctorParameters = function () { return [
|
|
181
|
+
{ type: undefined, decorators: [{ type: i0.Inject, args: ['errorHandlerOptions',] }] }
|
|
182
|
+
]; };
|
|
183
|
+
/**
|
|
184
|
+
* Factory function that creates an instance of a preconfigured ErrorHandler provider.
|
|
185
|
+
*/
|
|
186
|
+
function createErrorHandler(config) {
|
|
187
|
+
return new SentryErrorHandler(config);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
var instrumentationInitialized;
|
|
191
|
+
var stashedStartTransaction;
|
|
192
|
+
var stashedStartTransactionOnLocationChange;
|
|
193
|
+
var global = utils.getGlobalObject();
|
|
194
|
+
/**
|
|
195
|
+
* Creates routing instrumentation for Angular Router.
|
|
196
|
+
*/
|
|
197
|
+
function routingInstrumentation(customStartTransaction, startTransactionOnPageLoad, startTransactionOnLocationChange) {
|
|
198
|
+
if (startTransactionOnPageLoad === void 0) { startTransactionOnPageLoad = true; }
|
|
199
|
+
if (startTransactionOnLocationChange === void 0) { startTransactionOnLocationChange = true; }
|
|
200
|
+
instrumentationInitialized = true;
|
|
201
|
+
stashedStartTransaction = customStartTransaction;
|
|
202
|
+
stashedStartTransactionOnLocationChange = startTransactionOnLocationChange;
|
|
203
|
+
if (startTransactionOnPageLoad && global && global.location) {
|
|
204
|
+
customStartTransaction({
|
|
205
|
+
name: global.location.pathname,
|
|
206
|
+
op: 'pageload',
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
var instrumentAngularRouting = routingInstrumentation;
|
|
211
|
+
/**
|
|
212
|
+
* Grabs active transaction off scope
|
|
213
|
+
*/
|
|
214
|
+
function getActiveTransaction() {
|
|
215
|
+
var currentHub = Sentry.getCurrentHub();
|
|
216
|
+
if (currentHub) {
|
|
217
|
+
var scope = currentHub.getScope();
|
|
218
|
+
if (scope) {
|
|
219
|
+
return scope.getTransaction();
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return undefined;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Angular's Service responsible for hooking into Angular Router and tracking current navigation process.
|
|
226
|
+
* Creates a new transaction for every route change and measures a duration of routing process.
|
|
227
|
+
*/
|
|
228
|
+
var TraceService = /** @class */ (function () {
|
|
229
|
+
function TraceService(_router) {
|
|
230
|
+
var _this = this;
|
|
231
|
+
this._router = _router;
|
|
232
|
+
this.navStart$ = this._router.events.pipe(operators.filter(function (event) { return event instanceof i1.NavigationStart; }), operators.tap(function (event) {
|
|
233
|
+
if (!instrumentationInitialized) {
|
|
234
|
+
IS_DEBUG_BUILD &&
|
|
235
|
+
utils.logger.error('Angular integration has tracing enabled, but Tracing integration is not configured');
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
var navigationEvent = event;
|
|
239
|
+
var strippedUrl = utils.stripUrlQueryAndFragment(navigationEvent.url);
|
|
240
|
+
var activeTransaction = getActiveTransaction();
|
|
241
|
+
if (!activeTransaction && stashedStartTransactionOnLocationChange) {
|
|
242
|
+
activeTransaction = stashedStartTransaction({
|
|
243
|
+
name: strippedUrl,
|
|
244
|
+
op: 'navigation',
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
if (activeTransaction) {
|
|
248
|
+
if (_this._routingSpan) {
|
|
249
|
+
_this._routingSpan.finish();
|
|
250
|
+
}
|
|
251
|
+
_this._routingSpan = activeTransaction.startChild({
|
|
252
|
+
description: "" + navigationEvent.url,
|
|
253
|
+
op: ANGULAR_ROUTING_OP,
|
|
254
|
+
tags: Object.assign({ 'routing.instrumentation': '@sentry/angular', url: strippedUrl }, (navigationEvent.navigationTrigger && {
|
|
255
|
+
navigationTrigger: navigationEvent.navigationTrigger,
|
|
256
|
+
})),
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}));
|
|
260
|
+
this.navEnd$ = this._router.events.pipe(operators.filter(function (event) { return event instanceof i1.NavigationEnd; }), operators.tap(function () {
|
|
261
|
+
if (_this._routingSpan) {
|
|
262
|
+
runOutsideAngular(function () {
|
|
263
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
264
|
+
_this._routingSpan.finish();
|
|
265
|
+
});
|
|
266
|
+
_this._routingSpan = null;
|
|
267
|
+
}
|
|
268
|
+
}));
|
|
269
|
+
this._routingSpan = null;
|
|
270
|
+
this._subscription = new rxjs.Subscription();
|
|
271
|
+
this._subscription.add(this.navStart$.subscribe());
|
|
272
|
+
this._subscription.add(this.navEnd$.subscribe());
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* This is used to prevent memory leaks when the root view is created and destroyed multiple times,
|
|
276
|
+
* since `subscribe` callbacks capture `this` and prevent many resources from being GC'd.
|
|
277
|
+
*/
|
|
278
|
+
TraceService.prototype.ngOnDestroy = function () {
|
|
279
|
+
this._subscription.unsubscribe();
|
|
280
|
+
};
|
|
281
|
+
return TraceService;
|
|
282
|
+
}());
|
|
283
|
+
TraceService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function TraceService_Factory() { return new TraceService(i0__namespace.ɵɵinject(i1__namespace.Router)); }, token: TraceService, providedIn: "root" });
|
|
284
|
+
TraceService.decorators = [
|
|
285
|
+
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
|
286
|
+
];
|
|
287
|
+
TraceService.ctorParameters = function () { return [
|
|
288
|
+
{ type: i1.Router }
|
|
289
|
+
]; };
|
|
290
|
+
var UNKNOWN_COMPONENT = 'unknown';
|
|
291
|
+
/**
|
|
292
|
+
* A directive that can be used to capture initialization lifecycle of the whole component.
|
|
293
|
+
*/
|
|
294
|
+
var TraceDirective = /** @class */ (function () {
|
|
295
|
+
function TraceDirective() {
|
|
296
|
+
this.componentName = UNKNOWN_COMPONENT;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Implementation of OnInit lifecycle method
|
|
300
|
+
* @inheritdoc
|
|
301
|
+
*/
|
|
302
|
+
TraceDirective.prototype.ngOnInit = function () {
|
|
303
|
+
var activeTransaction = getActiveTransaction();
|
|
304
|
+
if (activeTransaction) {
|
|
305
|
+
this._tracingSpan = activeTransaction.startChild({
|
|
306
|
+
description: "<" + this.componentName + ">",
|
|
307
|
+
op: ANGULAR_INIT_OP,
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* Implementation of AfterViewInit lifecycle method
|
|
313
|
+
* @inheritdoc
|
|
314
|
+
*/
|
|
315
|
+
TraceDirective.prototype.ngAfterViewInit = function () {
|
|
316
|
+
if (this._tracingSpan) {
|
|
317
|
+
this._tracingSpan.finish();
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
return TraceDirective;
|
|
321
|
+
}());
|
|
322
|
+
TraceDirective.decorators = [
|
|
323
|
+
{ type: i0.Directive, args: [{ selector: '[trace]' },] }
|
|
324
|
+
];
|
|
325
|
+
TraceDirective.propDecorators = {
|
|
326
|
+
componentName: [{ type: i0.Input, args: ['trace',] }]
|
|
327
|
+
};
|
|
328
|
+
/**
|
|
329
|
+
* A module serves as a single compilation unit for the `TraceDirective` and can be re-used by any other module.
|
|
330
|
+
*/
|
|
331
|
+
var TraceModule = /** @class */ (function () {
|
|
332
|
+
function TraceModule() {
|
|
333
|
+
}
|
|
334
|
+
return TraceModule;
|
|
335
|
+
}());
|
|
336
|
+
TraceModule.decorators = [
|
|
337
|
+
{ type: i0.NgModule, args: [{
|
|
338
|
+
declarations: [TraceDirective],
|
|
339
|
+
exports: [TraceDirective],
|
|
340
|
+
},] }
|
|
341
|
+
];
|
|
342
|
+
/**
|
|
343
|
+
* Decorator function that can be used to capture initialization lifecycle of the whole component.
|
|
344
|
+
*/
|
|
345
|
+
function TraceClassDecorator() {
|
|
346
|
+
var tracingSpan;
|
|
347
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
348
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
349
|
+
return function (target) {
|
|
350
|
+
var originalOnInit = target.prototype.ngOnInit;
|
|
351
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
352
|
+
target.prototype.ngOnInit = function () {
|
|
353
|
+
var args = [];
|
|
354
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
355
|
+
args[_i] = arguments[_i];
|
|
356
|
+
}
|
|
357
|
+
var activeTransaction = getActiveTransaction();
|
|
358
|
+
if (activeTransaction) {
|
|
359
|
+
tracingSpan = activeTransaction.startChild({
|
|
360
|
+
description: "<" + target.name + ">",
|
|
361
|
+
op: ANGULAR_INIT_OP,
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
if (originalOnInit) {
|
|
365
|
+
return originalOnInit.apply(this, args);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
var originalAfterViewInit = target.prototype.ngAfterViewInit;
|
|
369
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
370
|
+
target.prototype.ngAfterViewInit = function () {
|
|
371
|
+
var args = [];
|
|
372
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
373
|
+
args[_i] = arguments[_i];
|
|
374
|
+
}
|
|
375
|
+
if (tracingSpan) {
|
|
376
|
+
tracingSpan.finish();
|
|
377
|
+
}
|
|
378
|
+
if (originalAfterViewInit) {
|
|
379
|
+
return originalAfterViewInit.apply(this, args);
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
};
|
|
383
|
+
/* eslint-enable @typescript-eslint/no-unsafe-member-access */
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Decorator function that can be used to capture a single lifecycle methods of the component.
|
|
387
|
+
*/
|
|
388
|
+
function TraceMethodDecorator() {
|
|
389
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/ban-types
|
|
390
|
+
return function (target, propertyKey, descriptor) {
|
|
391
|
+
var originalMethod = descriptor.value;
|
|
392
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
393
|
+
descriptor.value = function () {
|
|
394
|
+
var args = [];
|
|
395
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
396
|
+
args[_i] = arguments[_i];
|
|
397
|
+
}
|
|
398
|
+
var now = utils.timestampWithMs();
|
|
399
|
+
var activeTransaction = getActiveTransaction();
|
|
400
|
+
if (activeTransaction) {
|
|
401
|
+
activeTransaction.startChild({
|
|
402
|
+
description: "<" + target.constructor.name + ">",
|
|
403
|
+
endTimestamp: now,
|
|
404
|
+
op: ANGULAR_OP + "." + String(propertyKey),
|
|
405
|
+
startTimestamp: now,
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
if (originalMethod) {
|
|
409
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
410
|
+
return originalMethod.apply(this, args);
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
return descriptor;
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Generated bundle index. Do not edit.
|
|
419
|
+
*/
|
|
420
|
+
|
|
421
|
+
exports.SentryErrorHandler = SentryErrorHandler;
|
|
422
|
+
exports.TraceClassDecorator = TraceClassDecorator;
|
|
423
|
+
exports.TraceDirective = TraceDirective;
|
|
424
|
+
exports.TraceMethodDecorator = TraceMethodDecorator;
|
|
425
|
+
exports.TraceModule = TraceModule;
|
|
426
|
+
exports.TraceService = TraceService;
|
|
427
|
+
exports.createErrorHandler = createErrorHandler;
|
|
428
|
+
exports.getActiveTransaction = getActiveTransaction;
|
|
429
|
+
exports.init = init;
|
|
430
|
+
exports.instrumentAngularRouting = instrumentAngularRouting;
|
|
431
|
+
exports.routingInstrumentation = routingInstrumentation;
|
|
432
|
+
Object.keys(Sentry).forEach(function (k) {
|
|
433
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
434
|
+
enumerable: true,
|
|
435
|
+
get: function () { return Sentry[k]; }
|
|
436
|
+
});
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
440
|
+
|
|
441
|
+
}));
|
|
442
|
+
//# sourceMappingURL=sentry-angular.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry-angular.umd.js","sources":["../../src/constants.ts","../../src/flags.ts","../../src/sdk.ts","../../src/zone.ts","../../src/errorhandler.ts","../../src/tracing.ts","../../src/sentry-angular.ts"],"sourcesContent":["export const ANGULAR_ROUTING_OP = 'ui.angular.routing';\n\nexport const ANGULAR_INIT_OP = 'ui.angular.init';\n\nexport const ANGULAR_OP = 'ui.angular';\n\n/**\n * Minimum Angular version this SDK supports\n */\nexport const ANGULAR_MINIMUM_VERSION = 10;\n","/*\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","import { VERSION } from '@angular/core';\nimport { BrowserOptions, init as browserInit, SDK_VERSION } from '@sentry/browser';\nimport { logger } from '@sentry/utils';\n\nimport { ANGULAR_MINIMUM_VERSION } from './constants';\nimport { IS_DEBUG_BUILD } from './flags';\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 checkAngularVersion();\n browserInit(options);\n}\n\nfunction checkAngularVersion(): void {\n if (VERSION && VERSION.major) {\n const major = parseInt(VERSION.major, 10);\n if (major < ANGULAR_MINIMUM_VERSION) {\n IS_DEBUG_BUILD &&\n logger.warn(\n `The Sentry SDK does not officially support Angular ${major}.`,\n `This version of the Sentry SDK supports Angular ${ANGULAR_MINIMUM_VERSION} and above.`,\n 'Please consider upgrading your Angular version or downgrading the Sentry SDK.',\n );\n }\n }\n}\n","// That's the `global.Zone` exposed when the `zone.js` package is used.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ndeclare const Zone: any;\n\n// There're 2 types of Angular applications:\n// 1) zone-full (by default)\n// 2) zone-less\n// The developer can avoid importing the `zone.js` package and tells Angular that\n// he is responsible for running the change detection by himself. This is done by\n// \"nooping\" the zone through `CompilerOptions` when bootstrapping the root module.\n// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\nconst isNgZoneEnabled = typeof Zone !== 'undefined' && !!Zone.current;\n\n/**\n * The function that does the same job as `NgZone.runOutsideAngular`.\n */\nexport function runOutsideAngular<T>(callback: () => T): T {\n // The `Zone.root.run` basically will run the `callback` in the most parent zone.\n // Any asynchronous API used inside the `callback` won't catch Angular's zone\n // since `Zone.current` will reference `Zone.root`.\n // The Angular's zone is forked from the `Zone.root`. In this case, `zone.js` won't\n // trigger change detection, and `ApplicationRef.tick()` will not be run.\n // Caretaker note: we're using `Zone.root` except `NgZone.runOutsideAngular` since this\n // will require injecting the `NgZone` facade. That will create a breaking change for\n // projects already using the `@sentry/angular`.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return isNgZoneEnabled ? Zone.root.run(callback) : callback();\n}\n","import { HttpErrorResponse } from '@angular/common/http';\nimport { ErrorHandler as AngularErrorHandler, Inject, 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(@Inject('errorHandlerOptions') 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","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","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["SDK_VERSION","browserInit","VERSION","logger","Sentry","HttpErrorResponse","Injectable","Inject","getGlobalObject","getCurrentHub","filter","NavigationStart","tap","stripUrlQueryAndFragment","NavigationEnd","Subscription","Router","Directive","Input","NgModule","timestampWithMs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAO,IAAM,kBAAkB,GAAG,oBAAoB,CAAC;IAEhD,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CAAC;IAChD,aAAA;IACH,SAAC,CAAC;IACJ,KAAC,CAAC;;IAEJ,CAAC;IAED;;IAEG;aACa,oBAAoB,GAAA;;IAElC,IAAA,OAAO,UAAC,MAAc,EAAE,WAA4B,EAAE,UAA8B,EAAA;IAClF,QAAA,IAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;;YAExC,UAAU,CAAC,KAAK,GAAG,YAAA;gBAAU,IAAc,IAAA,GAAA,EAAA,CAAA;qBAAd,IAAc,EAAA,GAAA,CAAA,EAAd,EAAc,GAAA,SAAA,CAAA,MAAA,EAAd,EAAc,EAAA,EAAA;oBAAd,IAAc,CAAA,EAAA,CAAA,GAAA,SAAA,CAAA,EAAA,CAAA,CAAA;;IACzC,YAAA,IAAM,GAAG,GAAGC,qBAAe,EAAE,CAAC;IAC9B,YAAA,IAAM,iBAAiB,GAAG,oBAAoB,EAAE,CAAC;IACjD,YAAA,IAAI,iBAAiB,EAAE;oBACrB,iBAAiB,CAAC,UAAU,CAAC;IAC3B,oBAAA,WAAW,EAAE,GAAI,GAAA,MAAM,CAAC,WAAW,CAAC,IAAI,GAAG,GAAA;IAC3C,oBAAA,YAAY,EAAE,GAAG;IACjB,oBAAA,EAAE,EAAK,UAAU,GAAA,GAAA,GAAI,MAAM,CAAC,WAAW,CAAG;IAC1C,oBAAA,cAAc,EAAE,GAAG;IACpB,iBAAA,CAAC,CAAC;IACJ,aAAA;IACD,YAAA,IAAI,cAAc,EAAE;;oBAElB,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACzC,aAAA;IACH,SAAC,CAAC;IACF,QAAA,OAAO,UAAU,CAAC;IACpB,KAAC,CAAC;IACJ;;IChPA;;IAEG;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@sentry/browser"),require("@angular/core"),require("@sentry/utils"),require("@angular/common/http"),require("@angular/router"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@sentry/angular",["exports","@sentry/browser","@angular/core","@sentry/utils","@angular/common/http","@angular/router","rxjs","rxjs/operators"],t):t(((r="undefined"!=typeof globalThis?globalThis:r||self).sentry=r.sentry||{},r.sentry.angular={}),r.Sentry,r.ng.core,r.Sentry.util,r.ng.common.http,r.ng.router,r.rxjs,r.rxjs.operators)}(this,(function(r,t,n,e,o,i,a,s){"use strict";function u(r){if(r&&r.__esModule)return r;var t=Object.create(null);return r&&Object.keys(r).forEach((function(n){if("default"!==n){var e=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,e.get?e:{enumerable:!0,get:function(){return r[n]}})}})),t.default=r,Object.freeze(t)}var c=u(t),p=u(n),g=u(i),f="ui.angular.init",l="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;var d="undefined"!=typeof Zone&&!!Zone.current;function v(r){return d?Zone.root.run(r):r()}var h,y,_,m=function(){function r(r){this._options=Object.assign({logErrors:!0},r)}return r.prototype.handleError=function(r){var t=this._extractError(r)||"Handled unknown error",n=v((function(){return c.captureException(t)}));this._options.logErrors&&console.error(t),this._options.showDialog&&c.showReportDialog(Object.assign(Object.assign({},this._options.dialogOptions),{eventId:n}))},r.prototype._extractError=function(r){if(this._options.extractor){var t=this._defaultExtractor.bind(this);return this._options.extractor(r,t)}return this._defaultExtractor(r)},r.prototype._defaultExtractor=function(r){var t=r;return t&&t.ngOriginalError&&(t=t.ngOriginalError),"string"==typeof t||t instanceof Error?t:t instanceof o.HttpErrorResponse?t.error instanceof Error?t.error:t.error instanceof ErrorEvent&&t.error.message?t.error.message:"string"==typeof t.error?"Server returned code "+t.status+' with body "'+t.error+'"':t.message:null},r}();m.ɵprov=p.ɵɵdefineInjectable({factory:function(){return new m(p.ɵɵinject("errorHandlerOptions"))},token:m,providedIn:"root"}),m.decorators=[{type:n.Injectable,args:[{providedIn:"root"}]}],m.ctorParameters=function(){return[{type:void 0,decorators:[{type:n.Inject,args:["errorHandlerOptions"]}]}]};var b=e.getGlobalObject();function S(r,t,n){void 0===t&&(t=!0),void 0===n&&(n=!0),h=!0,y=r,_=n,t&&b&&b.location&&r({name:b.location.pathname,op:"pageload"})}var E=S;function j(){var r=t.getCurrentHub();if(r){var n=r.getScope();if(n)return n.getTransaction()}}var O=function(){function r(r){var t=this;this._router=r,this.navStart$=this._router.events.pipe(s.filter((function(r){return r instanceof i.NavigationStart})),s.tap((function(r){if(h){var n=r,o=e.stripUrlQueryAndFragment(n.url),i=j();!i&&_&&(i=y({name:o,op:"navigation"})),i&&(t._routingSpan&&t._routingSpan.finish(),t._routingSpan=i.startChild({description:""+n.url,op:"ui.angular.routing",tags:Object.assign({"routing.instrumentation":"@sentry/angular",url:o},n.navigationTrigger&&{navigationTrigger:n.navigationTrigger})}))}else l&&e.logger.error("Angular integration has tracing enabled, but Tracing integration is not configured")}))),this.navEnd$=this._router.events.pipe(s.filter((function(r){return r instanceof i.NavigationEnd})),s.tap((function(){t._routingSpan&&(v((function(){t._routingSpan.finish()})),t._routingSpan=null)}))),this._routingSpan=null,this._subscription=new a.Subscription,this._subscription.add(this.navStart$.subscribe()),this._subscription.add(this.navEnd$.subscribe())}return r.prototype.ngOnDestroy=function(){this._subscription.unsubscribe()},r}();O.ɵprov=p.ɵɵdefineInjectable({factory:function(){return new O(p.ɵɵinject(g.Router))},token:O,providedIn:"root"}),O.decorators=[{type:n.Injectable,args:[{providedIn:"root"}]}],O.ctorParameters=function(){return[{type:i.Router}]};var I=function(){function r(){this.componentName="unknown"}return r.prototype.ngOnInit=function(){var r=j();r&&(this._tracingSpan=r.startChild({description:"<"+this.componentName+">",op:f}))},r.prototype.ngAfterViewInit=function(){this._tracingSpan&&this._tracingSpan.finish()},r}();I.decorators=[{type:n.Directive,args:[{selector:"[trace]"}]}],I.propDecorators={componentName:[{type:n.Input,args:["trace"]}]};var T=function(){};T.decorators=[{type:n.NgModule,args:[{declarations:[I],exports:[I]}]}],r.SentryErrorHandler=m,r.TraceClassDecorator=function(){var r;return function(t){var n=t.prototype.ngOnInit;t.prototype.ngOnInit=function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];var i=j();if(i&&(r=i.startChild({description:"<"+t.name+">",op:f})),n)return n.apply(this,e)};var e=t.prototype.ngAfterViewInit;t.prototype.ngAfterViewInit=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if(r&&r.finish(),e)return e.apply(this,t)}}},r.TraceDirective=I,r.TraceMethodDecorator=function(){return function(r,t,n){var o=n.value;return n.value=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a=e.timestampWithMs(),s=j();if(s&&s.startChild({description:"<"+r.constructor.name+">",endTimestamp:a,op:"ui.angular."+String(t),startTimestamp:a}),o)return o.apply(this,n)},n}},r.TraceModule=T,r.TraceService=O,r.createErrorHandler=function(r){return new m(r)},r.getActiveTransaction=j,r.init=function(r){r._metadata=r._metadata||{},r._metadata.sdk={name:"sentry.javascript.angular",packages:[{name:"npm:@sentry/angular",version:t.SDK_VERSION}],version:t.SDK_VERSION},function(){if(n.VERSION&&n.VERSION.major){var r=parseInt(n.VERSION.major,10);r<10&&l&&e.logger.warn("The Sentry SDK does not officially support Angular "+r+".","This version of the Sentry SDK supports Angular 10 and above.","Please consider upgrading your Angular version or downgrading the Sentry SDK.")}}(),t.init(r)},r.instrumentAngularRouting=E,r.routingInstrumentation=S,Object.keys(t).forEach((function(n){"default"===n||r.hasOwnProperty(n)||Object.defineProperty(r,n,{enumerable:!0,get:function(){return t[n]}})})),Object.defineProperty(r,"__esModule",{value:!0})}));
|
|
2
|
+
//# sourceMappingURL=sentry-angular.umd.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/constants.ts","../../src/flags.ts","../../src/zone.ts","../../src/errorhandler.ts","../../src/tracing.ts","../../src/sdk.ts"],"names":["ANGULAR_INIT_OP","IS_DEBUG_BUILD","__SENTRY_DEBUG__","isNgZoneEnabled","Zone","current","runOutsideAngular","callback","root","run","instrumentationInitialized","stashedStartTransaction","stashedStartTransactionOnLocationChange","SentryErrorHandler","options","this","_options","Object","assign","logErrors","prototype","handleError","error","extractedError","_extractError","eventId","Sentry","captureException","console","showDialog","showReportDialog","dialogOptions","extractor","defaultExtractor","_defaultExtractor","bind","errorCandidate","ngOriginalError","Error","HttpErrorResponse","ErrorEvent","message","status","type","Injectable","args","providedIn","undefined","decorators","Inject","global","getGlobalObject","routingInstrumentation","customStartTransaction","startTransactionOnPageLoad","startTransactionOnLocationChange","location","name","pathname","op","instrumentAngularRouting","getActiveTransaction","currentHub","getCurrentHub","scope","getScope","getTransaction","TraceService","_router","_this","navStart$","events","pipe","filter","event","NavigationStart","tap","navigationEvent","strippedUrl","stripUrlQueryAndFragment","url","activeTransaction","_routingSpan","finish","startChild","description","tags","navigationTrigger","logger","navEnd$","NavigationEnd","_subscription","Subscription","add","subscribe","ngOnDestroy","unsubscribe","Router","TraceDirective","componentName","ngOnInit","_tracingSpan","ngAfterViewInit","Directive","selector","Input","TraceModule","NgModule","declarations","exports","tracingSpan","target","originalOnInit","_i","arguments","length","apply","originalAfterViewInit","propertyKey","descriptor","originalMethod","value","now","timestampWithMs","constructor","endTimestamp","ANGULAR_OP","String","startTimestamp","config","_metadata","sdk","packages","version","SDK_VERSION","VERSION","major","parseInt","warn","checkAngularVersion","browserInit"],"mappings":"i+BAEaA,EAAkB,kBCelBC,EAA6C,oBAArBC,kBAA0CA,iBCN/E,IAAMC,EAAkC,oBAATC,QAA0BA,KAAKC,QAKxD,SAAUC,EAAqBC,GAUnC,OAAOJ,EAAkBC,KAAKI,KAAKC,IAAIF,GAAYA,ICFrD,ICZIG,EACAC,EACAC,EDUJC,EAAA,WAIE,SAAAA,EAAkDC,GAChDC,KAAKC,SACHC,OAAAC,OAAA,CAAAC,WAAW,GACRL,UAOAD,EAAWO,UAAAC,YAAX,SAAYC,GACjB,IAAMC,EAAiBR,KAA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,OAAO,SAACkE,EAAgBO,EAA8BC,GACpD,IAAMC,EAAiBD,EAAWE,MAkBlC,OAhBAF,EAAWE,MAAQ,eAAU,IAAc5E,EAAA,GAAAoE,EAAA,EAAdA,EAAcC,UAAAC,OAAdF,IAAApE,EAAcoE,GAAAC,UAAAD,GACzC,IAAMS,EAAMC,EAAAA,kBACN1C,EAAoBpB,IAS1B,GARIoB,GACFA,EAAkBG,WAAW,CAC3BC,YAAa,IAAI0B,EAAOa,YAAYnE,KAAO,IAC3CoE,aAAcH,EACd/D,GAAOmE,cAAcC,OAAOT,GAC5BU,eAAgBN,IAGhBF,EAEF,OAAOA,EAAeJ,MAAMrG,KAAM8B,IAG/B0E,0DD3HX,SAA4BU,GAC1B,OAAO,IAAIpH,EAAmBoH,oCE1G1B,SAAenH,GACnBA,EAAQoH,UAAYpH,EAAQoH,WAAa,GACzCpH,EAAQoH,UAAUC,IAAM,CACtB1E,KAAM,4BACN2E,SAAU,CACR,CACE3E,KAAM,sBACN4E,QAASC,EAAAA,cAGbD,QAASC,EAAAA,aAMb,WACE,GAAIC,EAAAA,SAAWA,EAAAA,QAAQC,MAAO,CAC5B,IAAMA,EAAQC,SAASF,EAAAA,QAAQC,MAAO,IAClCA,ELpB+B,IKqBjCvI,GACEuF,EAAAA,OAAOkD,KACL,sDAAsDF,EAAK,IAC3D,gEACA,kFAZRG,GACAC,EAAAA,KAAY9H","sourcesContent":["export const ANGULAR_ROUTING_OP = 'ui.angular.routing';\n\nexport const ANGULAR_INIT_OP = 'ui.angular.init';\n\nexport const ANGULAR_OP = 'ui.angular';\n\n/**\n * Minimum Angular version this SDK supports\n */\nexport const ANGULAR_MINIMUM_VERSION = 10;\n","/*\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","// That's the `global.Zone` exposed when the `zone.js` package is used.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ndeclare const Zone: any;\n\n// There're 2 types of Angular applications:\n// 1) zone-full (by default)\n// 2) zone-less\n// The developer can avoid importing the `zone.js` package and tells Angular that\n// he is responsible for running the change detection by himself. This is done by\n// \"nooping\" the zone through `CompilerOptions` when bootstrapping the root module.\n// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\nconst isNgZoneEnabled = typeof Zone !== 'undefined' && !!Zone.current;\n\n/**\n * The function that does the same job as `NgZone.runOutsideAngular`.\n */\nexport function runOutsideAngular<T>(callback: () => T): T {\n // The `Zone.root.run` basically will run the `callback` in the most parent zone.\n // Any asynchronous API used inside the `callback` won't catch Angular's zone\n // since `Zone.current` will reference `Zone.root`.\n // The Angular's zone is forked from the `Zone.root`. In this case, `zone.js` won't\n // trigger change detection, and `ApplicationRef.tick()` will not be run.\n // Caretaker note: we're using `Zone.root` except `NgZone.runOutsideAngular` since this\n // will require injecting the `NgZone` facade. That will create a breaking change for\n // projects already using the `@sentry/angular`.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return isNgZoneEnabled ? Zone.root.run(callback) : callback();\n}\n","import { HttpErrorResponse } from '@angular/common/http';\nimport { ErrorHandler as AngularErrorHandler, Inject, 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(@Inject('errorHandlerOptions') 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","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","import { VERSION } from '@angular/core';\nimport { BrowserOptions, init as browserInit, SDK_VERSION } from '@sentry/browser';\nimport { logger } from '@sentry/utils';\n\nimport { ANGULAR_MINIMUM_VERSION } from './constants';\nimport { IS_DEBUG_BUILD } from './flags';\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 checkAngularVersion();\n browserInit(options);\n}\n\nfunction checkAngularVersion(): void {\n if (VERSION && VERSION.major) {\n const major = parseInt(VERSION.major, 10);\n if (major < ANGULAR_MINIMUM_VERSION) {\n IS_DEBUG_BUILD &&\n logger.warn(\n `The Sentry SDK does not officially support Angular ${major}.`,\n `This version of the Sentry SDK supports Angular ${ANGULAR_MINIMUM_VERSION} and above.`,\n 'Please consider upgrading your Angular version or downgrading the Sentry SDK.',\n );\n }\n }\n}\n"]}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export declare const ANGULAR_ROUTING_OP = "ui.angular.routing";
|
|
2
2
|
export declare const ANGULAR_INIT_OP = "ui.angular.init";
|
|
3
3
|
export declare const ANGULAR_OP = "ui.angular";
|
|
4
|
+
/**
|
|
5
|
+
* Minimum Angular version this SDK supports
|
|
6
|
+
*/
|
|
7
|
+
export declare const ANGULAR_MINIMUM_VERSION = 10;
|
|
4
8
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"/home/runner/work/sentry-javascript/sentry-javascript/packages/angular/src/","sources":["constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAEvD,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAEjD,eAAO,MAAM,UAAU,eAAe,CAAC;AAEvC;;GAEG;AACH,eAAO,MAAM,uBAAuB,KAAK,CAAC"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorhandler.d.ts","sourceRoot":"/home/runner/work/sentry-javascript/sentry-javascript/packages/angular/src/","sources":["errorhandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,IAAI,mBAAmB,EAAsB,MAAM,eAAe,CAAC;AACxF,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;gBAEC,OAAO,CAAC,EAAE,mBAAmB;IAO/E;;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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const ANGULAR_ROUTING_OP = 'ui.angular.routing';
|
|
2
|
+
export const ANGULAR_INIT_OP = 'ui.angular.init';
|
|
3
|
+
export const ANGULAR_OP = 'ui.angular';
|
|
4
|
+
/**
|
|
5
|
+
* Minimum Angular version this SDK supports
|
|
6
|
+
*/
|
|
7
|
+
export const ANGULAR_MINIMUM_VERSION = 10;
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmpzIiwic291cmNlUm9vdCI6Ii9ob21lL3J1bm5lci93b3JrL3NlbnRyeS1qYXZhc2NyaXB0L3NlbnRyeS1qYXZhc2NyaXB0L3BhY2thZ2VzL2FuZ3VsYXIvc3JjLyIsInNvdXJjZXMiOlsiY29uc3RhbnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE1BQU0sQ0FBQyxNQUFNLGtCQUFrQixHQUFHLG9CQUFvQixDQUFDO0FBRXZELE1BQU0sQ0FBQyxNQUFNLGVBQWUsR0FBRyxpQkFBaUIsQ0FBQztBQUVqRCxNQUFNLENBQUMsTUFBTSxVQUFVLEdBQUcsWUFBWSxDQUFDO0FBRXZDOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sdUJBQXVCLEdBQUcsRUFBRSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNvbnN0IEFOR1VMQVJfUk9VVElOR19PUCA9ICd1aS5hbmd1bGFyLnJvdXRpbmcnO1xuXG5leHBvcnQgY29uc3QgQU5HVUxBUl9JTklUX09QID0gJ3VpLmFuZ3VsYXIuaW5pdCc7XG5cbmV4cG9ydCBjb25zdCBBTkdVTEFSX09QID0gJ3VpLmFuZ3VsYXInO1xuXG4vKipcbiAqIE1pbmltdW0gQW5ndWxhciB2ZXJzaW9uIHRoaXMgU0RLIHN1cHBvcnRzXG4gKi9cbmV4cG9ydCBjb25zdCBBTkdVTEFSX01JTklNVU1fVkVSU0lPTiA9IDEwO1xuIl19
|