@sentry/hub
Advanced tools
Comparing version 4.0.0-rc.2 to 4.0.0
@@ -64,4 +64,6 @@ import { Breadcrumb, SentryBreadcrumbHint, SentryEvent, SentryEventHint, Severity } from '@sentry/types'; | ||
* when the operation finishes or throws. | ||
* | ||
* @returns Scope, the new cloned scope | ||
*/ | ||
pushScope(): void; | ||
pushScope(): Scope; | ||
/** | ||
@@ -88,3 +90,3 @@ * Removes a previously pushed scope from the stack. | ||
*/ | ||
withScope(callback: (() => void)): void; | ||
withScope(callback: ((scope: Scope) => void)): void; | ||
/** Returns the client of the top stack. */ | ||
@@ -91,0 +93,0 @@ getClient(): any | undefined; |
@@ -137,2 +137,4 @@ "use strict"; | ||
* when the operation finishes or throws. | ||
* | ||
* @returns Scope, the new cloned scope | ||
*/ | ||
@@ -143,6 +145,8 @@ Hub.prototype.pushScope = function () { | ||
var parentScope = stack.length > 0 ? stack[stack.length - 1].scope : undefined; | ||
var scope = scope_1.Scope.clone(parentScope); | ||
this.getStack().push({ | ||
client: this.getClient(), | ||
scope: scope_1.Scope.clone(parentScope), | ||
scope: scope, | ||
}); | ||
return scope; | ||
}; | ||
@@ -173,5 +177,5 @@ /** | ||
Hub.prototype.withScope = function (callback) { | ||
this.pushScope(); | ||
var scope = this.pushScope(); | ||
try { | ||
callback(); | ||
callback(scope); | ||
} | ||
@@ -178,0 +182,0 @@ finally { |
@@ -1,2 +0,2 @@ | ||
import { Breadcrumb, SentryEvent, SentryEventHint, User } from '@sentry/types'; | ||
import { Breadcrumb, SentryEvent, SentryEventHint, Severity, User } from '@sentry/types'; | ||
/** | ||
@@ -27,6 +27,8 @@ * Holds additional event information. {@link Scope.applyToEvent} will be | ||
protected fingerprint?: string[]; | ||
/** Severity */ | ||
protected level?: Severity; | ||
/** Add internal on change listener. */ | ||
addScopeListener(callback: (scope: Scope) => void): void; | ||
/** Add new event processor that will be called after {@link applyToEvent}. */ | ||
addEventProcessor(callback: (scope: SentryEvent, hint?: SentryEventHint) => Promise<SentryEvent | null>): void; | ||
addEventProcessor(callback: (scope: SentryEvent, hint?: SentryEventHint) => Promise<SentryEvent | null>): Scope; | ||
/** | ||
@@ -44,3 +46,3 @@ * This will be called on every set call. | ||
*/ | ||
setUser(user: User): void; | ||
setUser(user: User): Scope; | ||
/** | ||
@@ -50,3 +52,3 @@ * Updates tags context information for future events. | ||
*/ | ||
setTag(key: string, value: string): void; | ||
setTag(key: string, value: string): Scope; | ||
/** | ||
@@ -56,3 +58,3 @@ * Updates extra context information for future events. | ||
*/ | ||
setExtra(key: string, extra: any): void; | ||
setExtra(key: string, extra: any): Scope; | ||
/** | ||
@@ -62,4 +64,9 @@ * Sets the fingerprint on the scope to send with the events. | ||
*/ | ||
setFingerprint(fingerprint: string[]): void; | ||
setFingerprint(fingerprint: string[]): Scope; | ||
/** | ||
* Sets the level on the scope for future events. | ||
* @param level string {@link Severity} | ||
*/ | ||
setLevel(level: Severity): Scope; | ||
/** | ||
* Inherit values from the parent scope. | ||
@@ -83,2 +90,4 @@ * @param scope to clone. | ||
getBreadcrumbs(): Breadcrumb[]; | ||
/** Returns level. */ | ||
getLevel(): Severity | undefined; | ||
/** Clears the current scope and resets its properties. */ | ||
@@ -85,0 +94,0 @@ clear(): void; |
@@ -107,2 +107,3 @@ "use strict"; | ||
this.eventProcessors.push(callback); | ||
return this; | ||
}; | ||
@@ -181,2 +182,3 @@ /** | ||
this.notifyScopeListeners(); | ||
return this; | ||
}; | ||
@@ -191,2 +193,3 @@ /** | ||
this.notifyScopeListeners(); | ||
return this; | ||
}; | ||
@@ -201,2 +204,3 @@ /** | ||
this.notifyScopeListeners(); | ||
return this; | ||
}; | ||
@@ -210,4 +214,14 @@ /** | ||
this.notifyScopeListeners(); | ||
return this; | ||
}; | ||
/** | ||
* Sets the level on the scope for future events. | ||
* @param level string {@link Severity} | ||
*/ | ||
Scope.prototype.setLevel = function (level) { | ||
this.level = level; | ||
this.notifyScopeListeners(); | ||
return this; | ||
}; | ||
/** | ||
* Inherit values from the parent scope. | ||
@@ -246,2 +260,6 @@ * @param scope to clone. | ||
}; | ||
/** Returns level. */ | ||
Scope.prototype.getLevel = function () { | ||
return this.level; | ||
}; | ||
/** Clears the current scope and resets its properties. */ | ||
@@ -253,2 +271,3 @@ Scope.prototype.clear = function () { | ||
this.user = {}; | ||
this.level = undefined; | ||
this.fingerprint = undefined; | ||
@@ -255,0 +274,0 @@ this.notifyScopeListeners(); |
{ | ||
"name": "@sentry/hub", | ||
"version": "4.0.0-rc.2", | ||
"version": "4.0.0", | ||
"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-rc.2", | ||
"@sentry/utils": "4.0.0-rc.2" | ||
"@sentry/types": "4.0.0", | ||
"@sentry/utils": "4.0.0" | ||
}, | ||
@@ -22,0 +22,0 @@ "devDependencies": { |
@@ -13,1 +13,11 @@ <p align="center"> | ||
[![npm dt](https://img.shields.io/npm/dt/@sentry/hub.svg)](https://www.npmjs.com/package/@sentry/hub) | ||
[![typedoc](https://img.shields.io/badge/docs-typedoc-blue.svg)](http://getsentry.github.io/sentry-javascript/) | ||
## Links | ||
- [Official SDK Docs](https://docs.sentry.io/quickstart/) | ||
- [TypeDoc](http://getsentry.github.io/sentry-javascript/) | ||
## General | ||
This package provides the `Hub` and `Scope` for all JavaScript related SDKs. |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
65315
923
1
23
+ Added@sentry/types@4.0.0(transitive)
+ Added@sentry/utils@4.0.0(transitive)
- Removed@sentry/types@4.0.0-rc.2(transitive)
- Removed@sentry/utils@4.0.0-rc.2(transitive)
Updated@sentry/types@4.0.0
Updated@sentry/utils@4.0.0