@sentry/integrations
Advanced tools
Comparing version
@@ -0,4 +1,5 @@ | ||
import * as tslib_1 from "tslib"; | ||
import { getGlobalObject } from '@sentry/utils/misc'; | ||
// See https://github.com/angular/angular.js/blob/v1.4.7/src/minErr.js | ||
const angularPattern = /^\[((?:[$a-zA-Z0-9]+:)?(?:[$a-zA-Z0-9]+))\] (.*?)\n?(\S+)$/; | ||
var angularPattern = /^\[((?:[$a-zA-Z0-9]+:)?(?:[$a-zA-Z0-9]+))\] (.*?)\n?(\S+)$/; | ||
/** | ||
@@ -9,7 +10,8 @@ * AngularJS integration | ||
*/ | ||
export class Angular { | ||
var Angular = /** @class */ (function () { | ||
/** | ||
* @inheritDoc | ||
*/ | ||
constructor(options = {}) { | ||
function Angular(options) { | ||
if (options === void 0) { options = {}; } | ||
/** | ||
@@ -25,3 +27,4 @@ * @inheritDoc | ||
*/ | ||
setupOnce(_, getCurrentHub) { | ||
Angular.prototype.setupOnce = function (_, getCurrentHub) { | ||
var _this = this; | ||
if (!this._angular) { | ||
@@ -35,8 +38,8 @@ console.error('AngularIntegration is missing an Angular instance'); | ||
'$provide', | ||
($provide) => { | ||
$provide.decorator('$exceptionHandler', ['$delegate', this._$exceptionHandlerDecorator.bind(this)]); | ||
function ($provide) { | ||
$provide.decorator('$exceptionHandler', ['$delegate', _this._$exceptionHandlerDecorator.bind(_this)]); | ||
}, | ||
]); | ||
// tslint:enable: no-unsafe-any | ||
} | ||
}; | ||
/** | ||
@@ -46,14 +49,15 @@ * Angular's exceptionHandler for Sentry integration | ||
// tslint:disable-next-line: no-unsafe-any | ||
_$exceptionHandlerDecorator($delegate) { | ||
return (exception, cause) => { | ||
const hub = this._getCurrentHub && this._getCurrentHub(); | ||
Angular.prototype._$exceptionHandlerDecorator = function ($delegate) { | ||
var _this = this; | ||
return function (exception, cause) { | ||
var hub = _this._getCurrentHub && _this._getCurrentHub(); | ||
if (hub && hub.getIntegration(Angular)) { | ||
hub.withScope(scope => { | ||
hub.withScope(function (scope) { | ||
if (cause) { | ||
scope.setExtra('cause', cause); | ||
} | ||
scope.addEventProcessor((event) => { | ||
const ex = event.exception && event.exception.values && event.exception.values[0]; | ||
scope.addEventProcessor(function (event) { | ||
var ex = event.exception && event.exception.values && event.exception.values[0]; | ||
if (ex) { | ||
const matches = angularPattern.exec(ex.value || ''); | ||
var matches = angularPattern.exec(ex.value || ''); | ||
if (matches) { | ||
@@ -63,5 +67,5 @@ // This type now becomes something like: $rootScope:inprog | ||
ex.value = matches[2]; | ||
event.message = `${ex.type}: ${ex.value}`; | ||
event.message = ex.type + ": " + ex.value; | ||
// auto set a new tag specifically for the angular error url | ||
event.extra = Object.assign({}, event.extra, { angularDocs: matches[3].substr(0, 250) }); | ||
event.extra = tslib_1.__assign({}, event.extra, { angularDocs: matches[3].substr(0, 250) }); | ||
} | ||
@@ -77,12 +81,14 @@ } | ||
}; | ||
} | ||
} | ||
/** | ||
* @inheritDoc | ||
*/ | ||
Angular.id = 'AngularJS'; | ||
/** | ||
* moduleName used in Angular's DI resolution algorithm | ||
*/ | ||
Angular.moduleName = 'ngSentry'; | ||
}; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
Angular.id = 'AngularJS'; | ||
/** | ||
* moduleName used in Angular's DI resolution algorithm | ||
*/ | ||
Angular.moduleName = 'ngSentry'; | ||
return Angular; | ||
}()); | ||
export { Angular }; | ||
//# sourceMappingURL=angular.js.map |
@@ -0,7 +1,8 @@ | ||
import * as tslib_1 from "tslib"; | ||
/** JSDoc */ | ||
export class Debug { | ||
var Debug = /** @class */ (function () { | ||
/** | ||
* @inheritDoc | ||
*/ | ||
constructor(options) { | ||
function Debug(options) { | ||
/** | ||
@@ -11,3 +12,3 @@ * @inheritDoc | ||
this.name = Debug.id; | ||
this._options = Object.assign({ debugger: false, stringify: false }, options); | ||
this._options = tslib_1.__assign({ debugger: false, stringify: false }, options); | ||
} | ||
@@ -17,5 +18,5 @@ /** | ||
*/ | ||
setupOnce(addGlobalEventProcessor, getCurrentHub) { | ||
addGlobalEventProcessor((event, hint) => { | ||
const self = getCurrentHub().getIntegration(Debug); | ||
Debug.prototype.setupOnce = function (addGlobalEventProcessor, getCurrentHub) { | ||
addGlobalEventProcessor(function (event, hint) { | ||
var self = getCurrentHub().getIntegration(Debug); | ||
if (self) { | ||
@@ -42,8 +43,10 @@ // tslint:disable:no-console | ||
}); | ||
} | ||
} | ||
/** | ||
* @inheritDoc | ||
*/ | ||
Debug.id = 'Debug'; | ||
}; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
Debug.id = 'Debug'; | ||
return Debug; | ||
}()); | ||
export { Debug }; | ||
//# sourceMappingURL=debug.js.map |
/** Deduplication filter */ | ||
export class Dedupe { | ||
constructor() { | ||
var Dedupe = /** @class */ (function () { | ||
function Dedupe() { | ||
/** | ||
@@ -12,5 +12,5 @@ * @inheritDoc | ||
*/ | ||
setupOnce(addGlobalEventProcessor, getCurrentHub) { | ||
addGlobalEventProcessor((currentEvent) => { | ||
const self = getCurrentHub().getIntegration(Dedupe); | ||
Dedupe.prototype.setupOnce = function (addGlobalEventProcessor, getCurrentHub) { | ||
addGlobalEventProcessor(function (currentEvent) { | ||
var self = getCurrentHub().getIntegration(Dedupe); | ||
if (self) { | ||
@@ -30,5 +30,5 @@ // Juuust in case something goes wrong | ||
}); | ||
} | ||
}; | ||
/** JSDoc */ | ||
_shouldDropEvent(currentEvent, previousEvent) { | ||
Dedupe.prototype._shouldDropEvent = function (currentEvent, previousEvent) { | ||
if (!previousEvent) { | ||
@@ -44,7 +44,7 @@ return false; | ||
return false; | ||
} | ||
}; | ||
/** JSDoc */ | ||
_isSameMessageEvent(currentEvent, previousEvent) { | ||
const currentMessage = currentEvent.message; | ||
const previousMessage = previousEvent.message; | ||
Dedupe.prototype._isSameMessageEvent = function (currentEvent, previousEvent) { | ||
var currentMessage = currentEvent.message; | ||
var previousMessage = previousEvent.message; | ||
// If no event has a message, they were both exceptions, so bail out | ||
@@ -68,6 +68,6 @@ if (!currentMessage && !previousMessage) { | ||
return true; | ||
} | ||
}; | ||
/** JSDoc */ | ||
_getFramesFromEvent(event) { | ||
const exception = event.exception; | ||
Dedupe.prototype._getFramesFromEvent = function (event) { | ||
var exception = event.exception; | ||
if (exception) { | ||
@@ -86,7 +86,7 @@ try { | ||
return undefined; | ||
} | ||
}; | ||
/** JSDoc */ | ||
_isSameStacktrace(currentEvent, previousEvent) { | ||
let currentFrames = this._getFramesFromEvent(currentEvent); | ||
let previousFrames = this._getFramesFromEvent(previousEvent); | ||
Dedupe.prototype._isSameStacktrace = function (currentEvent, previousEvent) { | ||
var currentFrames = this._getFramesFromEvent(currentEvent); | ||
var previousFrames = this._getFramesFromEvent(previousEvent); | ||
// If no event has a fingerprint, they are assumed to be the same | ||
@@ -107,5 +107,5 @@ if (!currentFrames && !previousFrames) { | ||
// Otherwise, compare the two | ||
for (let i = 0; i < previousFrames.length; i++) { | ||
const frameA = previousFrames[i]; | ||
const frameB = currentFrames[i]; | ||
for (var i = 0; i < previousFrames.length; i++) { | ||
var frameA = previousFrames[i]; | ||
var frameB = currentFrames[i]; | ||
if (frameA.filename !== frameB.filename || | ||
@@ -119,11 +119,11 @@ frameA.lineno !== frameB.lineno || | ||
return true; | ||
} | ||
}; | ||
/** JSDoc */ | ||
_getExceptionFromEvent(event) { | ||
Dedupe.prototype._getExceptionFromEvent = function (event) { | ||
return event.exception && event.exception.values && event.exception.values[0]; | ||
} | ||
}; | ||
/** JSDoc */ | ||
_isSameExceptionEvent(currentEvent, previousEvent) { | ||
const previousException = this._getExceptionFromEvent(previousEvent); | ||
const currentException = this._getExceptionFromEvent(currentEvent); | ||
Dedupe.prototype._isSameExceptionEvent = function (currentEvent, previousEvent) { | ||
var previousException = this._getExceptionFromEvent(previousEvent); | ||
var currentException = this._getExceptionFromEvent(currentEvent); | ||
if (!previousException || !currentException) { | ||
@@ -142,7 +142,7 @@ return false; | ||
return true; | ||
} | ||
}; | ||
/** JSDoc */ | ||
_isSameFingerprint(currentEvent, previousEvent) { | ||
let currentFingerprint = currentEvent.fingerprint; | ||
let previousFingerprint = previousEvent.fingerprint; | ||
Dedupe.prototype._isSameFingerprint = function (currentEvent, previousEvent) { | ||
var currentFingerprint = currentEvent.fingerprint; | ||
var previousFingerprint = previousEvent.fingerprint; | ||
// If no event has a fingerprint, they are assumed to be the same | ||
@@ -165,8 +165,10 @@ if (!currentFingerprint && !previousFingerprint) { | ||
} | ||
} | ||
} | ||
/** | ||
* @inheritDoc | ||
*/ | ||
Dedupe.id = 'Dedupe'; | ||
}; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
Dedupe.id = 'Dedupe'; | ||
return Dedupe; | ||
}()); | ||
export { Dedupe }; | ||
//# sourceMappingURL=dedupe.js.map |
@@ -0,8 +1,10 @@ | ||
import * as tslib_1 from "tslib"; | ||
import { getGlobalObject } from '@sentry/utils/misc'; | ||
/** JSDoc */ | ||
export class Ember { | ||
var Ember = /** @class */ (function () { | ||
/** | ||
* @inheritDoc | ||
*/ | ||
constructor(options = {}) { | ||
function Ember(options) { | ||
if (options === void 0) { options = {}; } | ||
/** | ||
@@ -18,4 +20,5 @@ * @inheritDoc | ||
*/ | ||
setupOnce(_, getCurrentHub) { | ||
Ember.prototype.setupOnce = function (_, getCurrentHub) { | ||
// tslint:disable:no-unsafe-any | ||
var _this = this; | ||
if (!this._Ember) { | ||
@@ -25,7 +28,7 @@ console.error('EmberIntegration is missing an Ember instance'); | ||
} | ||
const oldOnError = this._Ember.onerror; | ||
this._Ember.onerror = (error) => { | ||
var oldOnError = this._Ember.onerror; | ||
this._Ember.onerror = function (error) { | ||
if (getCurrentHub().getIntegration(Ember)) { | ||
getCurrentHub().withScope(scope => { | ||
this._addIntegrationToSdkInfo(scope); | ||
getCurrentHub().withScope(function (scope) { | ||
_this._addIntegrationToSdkInfo(scope); | ||
getCurrentHub().captureException(error); | ||
@@ -35,14 +38,14 @@ }); | ||
if (typeof oldOnError === 'function') { | ||
oldOnError.call(this._Ember, error); | ||
oldOnError.call(_this._Ember, error); | ||
} | ||
else if (this._Ember.testing) { | ||
else if (_this._Ember.testing) { | ||
throw error; | ||
} | ||
}; | ||
this._Ember.RSVP.on('error', (reason) => { | ||
this._Ember.RSVP.on('error', function (reason) { | ||
if (getCurrentHub().getIntegration(Ember)) { | ||
getCurrentHub().withScope(scope => { | ||
getCurrentHub().withScope(function (scope) { | ||
if (reason instanceof Error) { | ||
scope.setExtra('context', 'Unhandled Promise error detected'); | ||
this._addIntegrationToSdkInfo(scope); | ||
_this._addIntegrationToSdkInfo(scope); | ||
getCurrentHub().captureException(reason); | ||
@@ -52,3 +55,3 @@ } | ||
scope.setExtra('reason', reason); | ||
this._addIntegrationToSdkInfo(scope); | ||
_this._addIntegrationToSdkInfo(scope); | ||
getCurrentHub().captureMessage('Unhandled Promise error detected'); | ||
@@ -59,3 +62,3 @@ } | ||
}); | ||
} | ||
}; | ||
/** | ||
@@ -65,16 +68,18 @@ * Appends SDK integrations | ||
*/ | ||
_addIntegrationToSdkInfo(scope) { | ||
scope.addEventProcessor((event) => { | ||
Ember.prototype._addIntegrationToSdkInfo = function (scope) { | ||
scope.addEventProcessor(function (event) { | ||
if (event.sdk) { | ||
const integrations = event.sdk.integrations || []; | ||
event.sdk = Object.assign({}, event.sdk, { integrations: [...integrations, 'ember'] }); | ||
var integrations = event.sdk.integrations || []; | ||
event.sdk = tslib_1.__assign({}, event.sdk, { integrations: tslib_1.__spread(integrations, ['ember']) }); | ||
} | ||
return event; | ||
}); | ||
} | ||
} | ||
/** | ||
* @inheritDoc | ||
*/ | ||
Ember.id = 'Ember'; | ||
}; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
Ember.id = 'Ember'; | ||
return Ember; | ||
}()); | ||
export { Ember }; | ||
//# sourceMappingURL=ember.js.map |
@@ -0,9 +1,11 @@ | ||
import * as tslib_1 from "tslib"; | ||
import { isError, isPlainObject } from '@sentry/utils/is'; | ||
import { normalize } from '@sentry/utils/object'; | ||
/** Patch toString calls to return proper name for wrapped functions */ | ||
export class ExtraErrorData { | ||
var ExtraErrorData = /** @class */ (function () { | ||
/** | ||
* @inheritDoc | ||
*/ | ||
constructor(_options = { depth: 3 }) { | ||
function ExtraErrorData(_options) { | ||
if (_options === void 0) { _options = { depth: 3 }; } | ||
this._options = _options; | ||
@@ -18,5 +20,5 @@ /** | ||
*/ | ||
setupOnce(addGlobalEventProcessor, getCurrentHub) { | ||
addGlobalEventProcessor((event, hint) => { | ||
const self = getCurrentHub().getIntegration(ExtraErrorData); | ||
ExtraErrorData.prototype.setupOnce = function (addGlobalEventProcessor, getCurrentHub) { | ||
addGlobalEventProcessor(function (event, hint) { | ||
var self = getCurrentHub().getIntegration(ExtraErrorData); | ||
if (!self) { | ||
@@ -27,44 +29,55 @@ return event; | ||
}); | ||
} | ||
}; | ||
/** | ||
* Attaches extracted information from the Error object to extra field in the Event | ||
*/ | ||
enhanceEventWithErrorData(event, hint) { | ||
ExtraErrorData.prototype.enhanceEventWithErrorData = function (event, hint) { | ||
if (!hint || !hint.originalException || !isError(hint.originalException)) { | ||
return event; | ||
} | ||
const errorData = this._extractErrorData(hint.originalException); | ||
var errorData = this._extractErrorData(hint.originalException); | ||
if (errorData) { | ||
let extra = Object.assign({}, event.extra); | ||
const normalizedErrorData = normalize(errorData, this._options.depth); | ||
var extra = tslib_1.__assign({}, event.extra); | ||
var normalizedErrorData = normalize(errorData, this._options.depth); | ||
if (isPlainObject(normalizedErrorData)) { | ||
extra = Object.assign({}, event.extra, normalizedErrorData); | ||
extra = tslib_1.__assign({}, event.extra, normalizedErrorData); | ||
} | ||
return Object.assign({}, event, { extra }); | ||
return tslib_1.__assign({}, event, { extra: extra }); | ||
} | ||
return event; | ||
} | ||
}; | ||
/** | ||
* Extract extra information from the Error object | ||
*/ | ||
_extractErrorData(error) { | ||
let result = null; | ||
ExtraErrorData.prototype._extractErrorData = function (error) { | ||
var e_1, _a, _b; | ||
var result = null; | ||
// We are trying to enhance already existing event, so no harm done if it won't succeed | ||
try { | ||
const nativeKeys = ['name', 'message', 'stack', 'line', 'column', 'fileName', 'lineNumber', 'columnNumber']; | ||
const name = error.name || error.constructor.name; | ||
const errorKeys = Object.getOwnPropertyNames(error).filter(key => nativeKeys.indexOf(key) === -1); | ||
var nativeKeys_1 = ['name', 'message', 'stack', 'line', 'column', 'fileName', 'lineNumber', 'columnNumber']; | ||
var name_1 = error.name || error.constructor.name; | ||
var errorKeys = Object.getOwnPropertyNames(error).filter(function (key) { return nativeKeys_1.indexOf(key) === -1; }); | ||
if (errorKeys.length) { | ||
const extraErrorInfo = {}; | ||
for (const key of errorKeys) { | ||
let value = error[key]; | ||
if (isError(value)) { | ||
value = value.toString(); | ||
var extraErrorInfo = {}; | ||
try { | ||
for (var errorKeys_1 = tslib_1.__values(errorKeys), errorKeys_1_1 = errorKeys_1.next(); !errorKeys_1_1.done; errorKeys_1_1 = errorKeys_1.next()) { | ||
var key = errorKeys_1_1.value; | ||
var value = error[key]; | ||
if (isError(value)) { | ||
value = value.toString(); | ||
} | ||
// tslint:disable:no-unsafe-any | ||
extraErrorInfo[key] = value; | ||
} | ||
// tslint:disable:no-unsafe-any | ||
extraErrorInfo[key] = value; | ||
} | ||
result = { | ||
[name]: extraErrorInfo, | ||
}; | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (errorKeys_1_1 && !errorKeys_1_1.done && (_a = errorKeys_1.return)) _a.call(errorKeys_1); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
result = (_b = {}, | ||
_b[name_1] = extraErrorInfo, | ||
_b); | ||
} | ||
@@ -76,8 +89,10 @@ } | ||
return result; | ||
} | ||
} | ||
/** | ||
* @inheritDoc | ||
*/ | ||
ExtraErrorData.id = 'ExtraErrorData'; | ||
}; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
ExtraErrorData.id = 'ExtraErrorData'; | ||
return ExtraErrorData; | ||
}()); | ||
export { ExtraErrorData }; | ||
//# sourceMappingURL=extraerrordata.js.map |
@@ -0,1 +1,2 @@ | ||
import * as tslib_1 from "tslib"; | ||
import { getGlobalObject } from '@sentry/utils/misc'; | ||
@@ -14,9 +15,10 @@ import { supportsReportingObserver } from '@sentry/utils/supports'; | ||
/** Reporting API integration - https://w3c.github.io/reporting/ */ | ||
export class ReportingObserver { | ||
var ReportingObserver = /** @class */ (function () { | ||
/** | ||
* @inheritDoc | ||
*/ | ||
constructor(_options = { | ||
types: [ReportTypes.Crash, ReportTypes.Deprecation, ReportTypes.Intervention], | ||
}) { | ||
function ReportingObserver(_options) { | ||
if (_options === void 0) { _options = { | ||
types: [ReportTypes.Crash, ReportTypes.Deprecation, ReportTypes.Intervention], | ||
}; } | ||
this._options = _options; | ||
@@ -31,3 +33,3 @@ /** | ||
*/ | ||
setupOnce(_, getCurrentHub) { | ||
ReportingObserver.prototype.setupOnce = function (_, getCurrentHub) { | ||
// tslint:disable:no-unsafe-any | ||
@@ -38,3 +40,3 @@ if (!supportsReportingObserver()) { | ||
this._getCurrentHub = getCurrentHub; | ||
const observer = new (getGlobalObject()).ReportingObserver(this.handler.bind(this), { | ||
var observer = new (getGlobalObject()).ReportingObserver(this.handler.bind(this), { | ||
buffered: true, | ||
@@ -44,21 +46,22 @@ types: this._options.types, | ||
observer.observe(); | ||
} | ||
}; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
handler(reports) { | ||
const hub = this._getCurrentHub && this._getCurrentHub(); | ||
ReportingObserver.prototype.handler = function (reports) { | ||
var e_1, _a; | ||
var hub = this._getCurrentHub && this._getCurrentHub(); | ||
if (!hub || !hub.getIntegration(ReportingObserver)) { | ||
return; | ||
} | ||
for (const report of reports) { | ||
hub.withScope(scope => { | ||
var _loop_1 = function (report) { | ||
hub.withScope(function (scope) { | ||
scope.setExtra('url', report.url); | ||
const label = `ReportingObserver [${report.type}]`; | ||
let details = 'No details available'; | ||
var label = "ReportingObserver [" + report.type + "]"; | ||
var details = 'No details available'; | ||
if (report.body) { | ||
// Object.keys doesn't work on ReportBody, as all properties are inheirted | ||
const plainBody = {}; | ||
var plainBody = {}; | ||
// tslint:disable-next-line:forin | ||
for (const prop in report.body) { | ||
for (var prop in report.body) { | ||
plainBody[prop] = report.body[prop]; | ||
@@ -68,3 +71,3 @@ } | ||
if (report.type === ReportTypes.Crash) { | ||
const body = report.body; | ||
var body = report.body; | ||
// A fancy way to create a message out of crashId OR reason OR both OR fallback | ||
@@ -74,15 +77,30 @@ details = [body.crashId || '', body.reason || ''].join(' ').trim() || details; | ||
else { | ||
const body = report.body; | ||
var body = report.body; | ||
details = body.message || details; | ||
} | ||
} | ||
hub.captureMessage(`${label}: ${details}`); | ||
hub.captureMessage(label + ": " + details); | ||
}); | ||
}; | ||
try { | ||
for (var reports_1 = tslib_1.__values(reports), reports_1_1 = reports_1.next(); !reports_1_1.done; reports_1_1 = reports_1.next()) { | ||
var report = reports_1_1.value; | ||
_loop_1(report); | ||
} | ||
} | ||
} | ||
} | ||
/** | ||
* @inheritDoc | ||
*/ | ||
ReportingObserver.id = 'ReportingObserver'; | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (reports_1_1 && !reports_1_1.done && (_a = reports_1.return)) _a.call(reports_1); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
}; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
ReportingObserver.id = 'ReportingObserver'; | ||
return ReportingObserver; | ||
}()); | ||
export { ReportingObserver }; | ||
//# sourceMappingURL=reportingobserver.js.map |
import { basename, relative } from '@sentry/utils/path'; | ||
/** Rewrite event frames paths */ | ||
export class RewriteFrames { | ||
var RewriteFrames = /** @class */ (function () { | ||
/** | ||
* @inheritDoc | ||
*/ | ||
constructor(options = {}) { | ||
function RewriteFrames(options) { | ||
if (options === void 0) { options = {}; } | ||
var _this = this; | ||
/** | ||
@@ -15,6 +17,6 @@ * @inheritDoc | ||
*/ | ||
this._iteratee = (frame) => { | ||
this._iteratee = function (frame) { | ||
if (frame.filename && frame.filename.startsWith('/')) { | ||
const base = this._root ? relative(this._root, frame.filename) : basename(frame.filename); | ||
frame.filename = `app:///${base}`; | ||
var base = _this._root ? relative(_this._root, frame.filename) : basename(frame.filename); | ||
frame.filename = "app:///" + base; | ||
} | ||
@@ -33,5 +35,5 @@ return frame; | ||
*/ | ||
setupOnce(addGlobalEventProcessor, getCurrentHub) { | ||
addGlobalEventProcessor(event => { | ||
const self = getCurrentHub().getIntegration(RewriteFrames); | ||
RewriteFrames.prototype.setupOnce = function (addGlobalEventProcessor, getCurrentHub) { | ||
addGlobalEventProcessor(function (event) { | ||
var self = getCurrentHub().getIntegration(RewriteFrames); | ||
if (self) { | ||
@@ -42,8 +44,8 @@ return self.process(event); | ||
}); | ||
} | ||
}; | ||
/** JSDoc */ | ||
process(event) { | ||
const frames = this._getFramesFromEvent(event); | ||
RewriteFrames.prototype.process = function (event) { | ||
var frames = this._getFramesFromEvent(event); | ||
if (frames) { | ||
for (const i in frames) { | ||
for (var i in frames) { | ||
// tslint:disable-next-line | ||
@@ -54,6 +56,6 @@ frames[i] = this._iteratee(frames[i]); | ||
return event; | ||
} | ||
}; | ||
/** JSDoc */ | ||
_getFramesFromEvent(event) { | ||
const exception = event.exception; | ||
RewriteFrames.prototype._getFramesFromEvent = function (event) { | ||
var exception = event.exception; | ||
if (exception) { | ||
@@ -72,8 +74,10 @@ try { | ||
return undefined; | ||
} | ||
} | ||
/** | ||
* @inheritDoc | ||
*/ | ||
RewriteFrames.id = 'RewriteFrames'; | ||
}; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
RewriteFrames.id = 'RewriteFrames'; | ||
return RewriteFrames; | ||
}()); | ||
export { RewriteFrames }; | ||
//# sourceMappingURL=rewriteframes.js.map |
/** Add node transaction to the event */ | ||
export class Transaction { | ||
constructor() { | ||
var Transaction = /** @class */ (function () { | ||
function Transaction() { | ||
/** | ||
@@ -12,5 +12,5 @@ * @inheritDoc | ||
*/ | ||
setupOnce(addGlobalEventProcessor, getCurrentHub) { | ||
addGlobalEventProcessor(event => { | ||
const self = getCurrentHub().getIntegration(Transaction); | ||
Transaction.prototype.setupOnce = function (addGlobalEventProcessor, getCurrentHub) { | ||
addGlobalEventProcessor(function (event) { | ||
var self = getCurrentHub().getIntegration(Transaction); | ||
if (self) { | ||
@@ -21,11 +21,11 @@ return self.process(event); | ||
}); | ||
} | ||
}; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
process(event) { | ||
const frames = this._getFramesFromEvent(event); | ||
Transaction.prototype.process = function (event) { | ||
var frames = this._getFramesFromEvent(event); | ||
// use for loop so we don't have to reverse whole frames array | ||
for (let i = frames.length - 1; i >= 0; i--) { | ||
const frame = frames[i]; | ||
for (var i = frames.length - 1; i >= 0; i--) { | ||
var frame = frames[i]; | ||
if (frame.in_app === true) { | ||
@@ -37,17 +37,19 @@ event.transaction = this._getTransaction(frame); | ||
return event; | ||
} | ||
}; | ||
/** JSDoc */ | ||
_getFramesFromEvent(event) { | ||
const exception = event.exception && event.exception.values && event.exception.values[0]; | ||
Transaction.prototype._getFramesFromEvent = function (event) { | ||
var exception = event.exception && event.exception.values && event.exception.values[0]; | ||
return (exception && exception.stacktrace && exception.stacktrace.frames) || []; | ||
} | ||
}; | ||
/** JSDoc */ | ||
_getTransaction(frame) { | ||
return frame.module || frame.function ? `${frame.module || '?'}/${frame.function || '?'}` : '<unknown>'; | ||
} | ||
} | ||
/** | ||
* @inheritDoc | ||
*/ | ||
Transaction.id = 'Transaction'; | ||
Transaction.prototype._getTransaction = function (frame) { | ||
return frame.module || frame.function ? (frame.module || '?') + "/" + (frame.function || '?') : '<unknown>'; | ||
}; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
Transaction.id = 'Transaction'; | ||
return Transaction; | ||
}()); | ||
export { Transaction }; | ||
//# sourceMappingURL=transaction.js.map |
@@ -0,9 +1,11 @@ | ||
import * as tslib_1 from "tslib"; | ||
import { isPlainObject } from '@sentry/utils/is'; | ||
import { getGlobalObject } from '@sentry/utils/misc'; | ||
/** JSDoc */ | ||
export class Vue { | ||
var Vue = /** @class */ (function () { | ||
/** | ||
* @inheritDoc | ||
*/ | ||
constructor(options = {}) { | ||
function Vue(options) { | ||
if (options === void 0) { options = {}; } | ||
/** | ||
@@ -25,3 +27,3 @@ * @inheritDoc | ||
/** JSDoc */ | ||
_formatComponentName(vm) { | ||
Vue.prototype._formatComponentName = function (vm) { | ||
// tslint:disable:no-unsafe-any | ||
@@ -31,11 +33,12 @@ if (vm.$root === vm) { | ||
} | ||
const name = vm._isVue ? vm.$options.name || vm.$options._componentTag : vm.name; | ||
return ((name ? `component <${name}>` : 'anonymous component') + | ||
(vm._isVue && vm.$options.__file ? ` at ${vm.$options.__file}` : '')); | ||
} | ||
var name = vm._isVue ? vm.$options.name || vm.$options._componentTag : vm.name; | ||
return ((name ? "component <" + name + ">" : 'anonymous component') + | ||
(vm._isVue && vm.$options.__file ? " at " + vm.$options.__file : '')); | ||
}; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
setupOnce(_, getCurrentHub) { | ||
Vue.prototype.setupOnce = function (_, getCurrentHub) { | ||
// tslint:disable:no-unsafe-any | ||
var _this = this; | ||
if (!this._Vue || !this._Vue.config) { | ||
@@ -45,8 +48,8 @@ console.error('VueIntegration is missing a Vue instance'); | ||
} | ||
const oldOnError = this._Vue.config.errorHandler; | ||
this._Vue.config.errorHandler = (error, vm, info) => { | ||
const metadata = {}; | ||
var oldOnError = this._Vue.config.errorHandler; | ||
this._Vue.config.errorHandler = function (error, vm, info) { | ||
var metadata = {}; | ||
if (isPlainObject(vm)) { | ||
metadata.componentName = this._formatComponentName(vm); | ||
if (this._attachProps) { | ||
metadata.componentName = _this._formatComponentName(vm); | ||
if (_this._attachProps) { | ||
metadata.propsData = vm.$options.propsData; | ||
@@ -59,10 +62,10 @@ } | ||
if (getCurrentHub().getIntegration(Vue)) { | ||
getCurrentHub().withScope(scope => { | ||
Object.keys(metadata).forEach(key => { | ||
getCurrentHub().withScope(function (scope) { | ||
Object.keys(metadata).forEach(function (key) { | ||
scope.setExtra(key, metadata[key]); | ||
}); | ||
scope.addEventProcessor((event) => { | ||
scope.addEventProcessor(function (event) { | ||
if (event.sdk) { | ||
const integrations = event.sdk.integrations || []; | ||
event.sdk = Object.assign({}, event.sdk, { integrations: [...integrations, 'vue'] }); | ||
var integrations = event.sdk.integrations || []; | ||
event.sdk = tslib_1.__assign({}, event.sdk, { integrations: tslib_1.__spread(integrations, ['vue']) }); | ||
} | ||
@@ -75,11 +78,13 @@ return event; | ||
if (typeof oldOnError === 'function') { | ||
oldOnError.call(this._Vue, error, vm, info); | ||
oldOnError.call(_this._Vue, error, vm, info); | ||
} | ||
}; | ||
} | ||
} | ||
/** | ||
* @inheritDoc | ||
*/ | ||
Vue.id = 'Vue'; | ||
}; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
Vue.id = 'Vue'; | ||
return Vue; | ||
}()); | ||
export { Vue }; | ||
//# sourceMappingURL=vue.js.map |
{ | ||
"name": "@sentry/integrations", | ||
"version": "5.0.4", | ||
"version": "5.0.5", | ||
"description": "Pluggable integrations that can be used to enchance JS SDKs", | ||
@@ -20,4 +20,4 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"dependencies": { | ||
"@sentry/types": "5.0.0", | ||
"@sentry/utils": "5.0.0" | ||
"@sentry/types": "5.0.5", | ||
"@sentry/utils": "5.0.5" | ||
}, | ||
@@ -47,3 +47,3 @@ "devDependencies": { | ||
"build:bundle": "rollup --config", | ||
"clean": "rimraf dist coverage *.js *.js.map *.d.ts", | ||
"clean": "rimraf dist coverage esm build .rpt2_cache", | ||
"link:yarn": "yarn link", | ||
@@ -50,0 +50,0 @@ "lint": "run-s lint:prettier lint:tslint", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
471201
0.89%3925
1.55%+ Added
+ Added
- Removed
- Removed
Updated
Updated