@sentry/hub
Advanced tools
Comparing version 4.0.0-beta.6 to 4.0.0-beta.7
@@ -129,3 +129,3 @@ import { Breadcrumb, SentryEvent } from '@sentry/types'; | ||
*/ | ||
addEventProcessor(callback: (event: SentryEvent) => Promise<void>): void; | ||
addEventProcessor(callback: (event: SentryEvent) => Promise<SentryEvent>): void; | ||
} |
@@ -12,3 +12,3 @@ import { Breadcrumb, SentryEvent, User } from '@sentry/types'; | ||
/** Callback list that will be called after {@link applyToEvent}. */ | ||
protected eventProcessors: Array<(scope: SentryEvent) => Promise<void>>; | ||
protected eventProcessors: Array<(scope: SentryEvent) => Promise<SentryEvent>>; | ||
/** Array of breadcrumbs. */ | ||
@@ -31,3 +31,3 @@ protected breadcrumbs: Breadcrumb[]; | ||
/** Add new event processor that will be called after {@link applyToEvent}. */ | ||
addEventProcessor(callback: (scope: SentryEvent) => Promise<void>): void; | ||
addEventProcessor(callback: (scope: SentryEvent) => Promise<SentryEvent>): void; | ||
/** | ||
@@ -40,3 +40,3 @@ * This will be called on every set call. | ||
*/ | ||
protected notifyEventProcessors(event: SentryEvent): Promise<void>; | ||
protected notifyEventProcessors(event: SentryEvent): Promise<SentryEvent>; | ||
/** | ||
@@ -96,3 +96,3 @@ * Updates user context information for future events. | ||
*/ | ||
applyToEvent(event: SentryEvent, maxBreadcrumbs?: number): Promise<void>; | ||
applyToEvent(event: SentryEvent, maxBreadcrumbs?: number): Promise<SentryEvent>; | ||
} |
@@ -118,2 +118,3 @@ "use strict"; | ||
return [2 /*return*/, this.eventProcessors.reduce(function (prev, callback) { return __awaiter(_this, void 0, void 0, function () { | ||
var prevEvent; | ||
return __generator(this, function (_a) { | ||
@@ -123,7 +124,7 @@ switch (_a.label) { | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/, callback(event)]; | ||
prevEvent = _a.sent(); | ||
return [2 /*return*/, callback(prevEvent)]; | ||
} | ||
}); | ||
}); }, Promise.resolve())]; | ||
}); }, Promise.resolve(event))]; | ||
}); | ||
@@ -227,30 +228,24 @@ }); | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (this.extra && Object.keys(this.extra).length) { | ||
event.extra = __assign({}, this.extra, event.extra); | ||
} | ||
if (this.tags && Object.keys(this.tags).length) { | ||
event.tags = __assign({}, this.tags, event.tags); | ||
} | ||
if (this.user && Object.keys(this.user).length) { | ||
event.user = __assign({}, this.user, event.user); | ||
} | ||
if (this.fingerprint && event.fingerprint === undefined) { | ||
event.fingerprint = this.fingerprint; | ||
} | ||
hasNoBreadcrumbs = !event.breadcrumbs || | ||
event.breadcrumbs.length === 0 || | ||
(event.breadcrumbs.values && event.breadcrumbs.values.length === 0); | ||
if (hasNoBreadcrumbs && this.breadcrumbs.length > 0) { | ||
event.breadcrumbs = | ||
maxBreadcrumbs !== undefined && maxBreadcrumbs >= 0 | ||
? this.breadcrumbs.slice(-maxBreadcrumbs) | ||
: this.breadcrumbs; | ||
} | ||
return [4 /*yield*/, this.notifyEventProcessors(event)]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
if (this.extra && Object.keys(this.extra).length) { | ||
event.extra = __assign({}, this.extra, event.extra); | ||
} | ||
if (this.tags && Object.keys(this.tags).length) { | ||
event.tags = __assign({}, this.tags, event.tags); | ||
} | ||
if (this.user && Object.keys(this.user).length) { | ||
event.user = __assign({}, this.user, event.user); | ||
} | ||
if (this.fingerprint && event.fingerprint === undefined) { | ||
event.fingerprint = this.fingerprint; | ||
} | ||
hasNoBreadcrumbs = !event.breadcrumbs || | ||
event.breadcrumbs.length === 0 || | ||
(event.breadcrumbs.values && event.breadcrumbs.values.length === 0); | ||
if (hasNoBreadcrumbs && this.breadcrumbs.length > 0) { | ||
event.breadcrumbs = | ||
maxBreadcrumbs !== undefined && maxBreadcrumbs >= 0 | ||
? this.breadcrumbs.slice(-maxBreadcrumbs) | ||
: this.breadcrumbs; | ||
} | ||
return [2 /*return*/, this.notifyEventProcessors(event)]; | ||
}); | ||
@@ -257,0 +252,0 @@ }); |
{ | ||
"name": "@sentry/hub", | ||
"version": "4.0.0-beta.6", | ||
"version": "4.0.0-beta.7", | ||
"description": "Sentry hub which handles global state managment.", | ||
@@ -18,4 +18,4 @@ "repository": "git://github.com/getsentry/raven-js.git", | ||
"dependencies": { | ||
"@sentry/types": "4.0.0-beta.6", | ||
"@sentry/utils": "4.0.0-beta.6" | ||
"@sentry/types": "4.0.0-beta.7", | ||
"@sentry/utils": "4.0.0-beta.7" | ||
}, | ||
@@ -22,0 +22,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56925
18
803
+ Added@sentry/types@4.0.0-beta.7(transitive)
+ Added@sentry/utils@4.0.0-beta.7(transitive)
- Removed@sentry/types@4.0.0-beta.6(transitive)
- Removed@sentry/utils@4.0.0-beta.6(transitive)
Updated@sentry/types@4.0.0-beta.7
Updated@sentry/utils@4.0.0-beta.7