@sentry/hub
Advanced tools
Comparing version 4.0.5 to 4.0.6
import { Breadcrumb, SentryBreadcrumbHint, SentryEvent, SentryEventHint, Severity } from '@sentry/types'; | ||
import { Layer } from './interfaces'; | ||
import { Carrier, Layer } from './interfaces'; | ||
import { Scope } from './scope'; | ||
@@ -147,5 +147,27 @@ /** | ||
* This function is useful if you want to run your own client and hook into an already initialized one | ||
* e.g.: Reporting issues to your own sentry when running in your component while still using the users configuration | ||
* e.g.: Reporting issues to your own sentry when running in your component while still using the users configuration. | ||
*/ | ||
run(callback: ((hub: Hub) => void)): void; | ||
} | ||
/** Returns the global shim registry. */ | ||
export declare function getMainCarrier(): Carrier; | ||
/** | ||
* Replaces the current main hub with the passed one on the global object | ||
* | ||
* @returns The old replaced hub | ||
*/ | ||
export declare function makeMain(hub?: Hub): Hub | undefined; | ||
/** | ||
* Returns the default hub instance. | ||
* | ||
* If a hub is already registered in the global carrier but this module | ||
* contains a more recent version, it replaces the registered version. | ||
* Otherwise, the currently registered hub will be returned. | ||
*/ | ||
export declare function getCurrentHub(): Hub; | ||
/** | ||
* This will create a new {@link Hub} and add to the passed object on | ||
* __SENTRY__.hub. | ||
* @param carrier object | ||
*/ | ||
export declare function getHubFromCarrier(carrier: any): Hub; |
@@ -35,3 +35,2 @@ "use strict"; | ||
var misc_1 = require("@sentry/utils/misc"); | ||
var global_1 = require("./global"); | ||
var scope_1 = require("./scope"); | ||
@@ -272,6 +271,6 @@ /** | ||
* This function is useful if you want to run your own client and hook into an already initialized one | ||
* e.g.: Reporting issues to your own sentry when running in your component while still using the users configuration | ||
* e.g.: Reporting issues to your own sentry when running in your component while still using the users configuration. | ||
*/ | ||
Hub.prototype.run = function (callback) { | ||
var oldHub = global_1.makeMain(this); | ||
var oldHub = makeMain(this); | ||
try { | ||
@@ -281,3 +280,3 @@ callback(this); | ||
finally { | ||
global_1.makeMain(oldHub); | ||
makeMain(oldHub); | ||
} | ||
@@ -288,2 +287,54 @@ }; | ||
exports.Hub = Hub; | ||
/** Returns the global shim registry. */ | ||
function getMainCarrier() { | ||
var carrier = misc_1.getGlobalObject(); | ||
carrier.__SENTRY__ = carrier.__SENTRY__ || { | ||
hub: undefined, | ||
}; | ||
return carrier.__SENTRY__; | ||
} | ||
exports.getMainCarrier = getMainCarrier; | ||
/** | ||
* Replaces the current main hub with the passed one on the global object | ||
* | ||
* @returns The old replaced hub | ||
*/ | ||
function makeMain(hub) { | ||
var registry = getMainCarrier(); | ||
var oldHub = registry.hub; | ||
registry.hub = hub; | ||
return oldHub; | ||
} | ||
exports.makeMain = makeMain; | ||
/** | ||
* Returns the default hub instance. | ||
* | ||
* If a hub is already registered in the global carrier but this module | ||
* contains a more recent version, it replaces the registered version. | ||
* Otherwise, the currently registered hub will be returned. | ||
*/ | ||
function getCurrentHub() { | ||
var registry = getMainCarrier(); | ||
if (!registry.hub || registry.hub.isOlderThan(exports.API_VERSION)) { | ||
registry.hub = new Hub(); | ||
} | ||
return registry.hub; | ||
} | ||
exports.getCurrentHub = getCurrentHub; | ||
/** | ||
* This will create a new {@link Hub} and add to the passed object on | ||
* __SENTRY__.hub. | ||
* @param carrier object | ||
*/ | ||
function getHubFromCarrier(carrier) { | ||
if (carrier && carrier.__SENTRY__ && carrier.__SENTRY__.hub) { | ||
return carrier.__SENTRY__.hub; | ||
} | ||
else { | ||
carrier.__SENTRY__ = {}; | ||
carrier.__SENTRY__.hub = new Hub(); | ||
return carrier.__SENTRY__.hub; | ||
} | ||
} | ||
exports.getHubFromCarrier = getHubFromCarrier; | ||
//# sourceMappingURL=hub.js.map |
export { Carrier, Layer } from './interfaces'; | ||
export { Scope } from './scope'; | ||
export { Hub } from './hub'; | ||
export { getCurrentHub, getHubFromCarrier } from './global'; | ||
export { getCurrentHub, getHubFromCarrier, Hub } from './hub'; |
@@ -6,6 +6,5 @@ "use strict"; | ||
var hub_1 = require("./hub"); | ||
exports.getCurrentHub = hub_1.getCurrentHub; | ||
exports.getHubFromCarrier = hub_1.getHubFromCarrier; | ||
exports.Hub = hub_1.Hub; | ||
var global_1 = require("./global"); | ||
exports.getCurrentHub = global_1.getCurrentHub; | ||
exports.getHubFromCarrier = global_1.getHubFromCarrier; | ||
//# sourceMappingURL=index.js.map |
@@ -305,2 +305,5 @@ "use strict"; | ||
} | ||
if (this.level && event.level === undefined) { | ||
event.level = this.level; | ||
} | ||
hasNoBreadcrumbs = !event.breadcrumbs || event.breadcrumbs.length === 0; | ||
@@ -307,0 +310,0 @@ if (hasNoBreadcrumbs && this.breadcrumbs.length > 0) { |
{ | ||
"name": "@sentry/hub", | ||
"version": "4.0.5", | ||
"version": "4.0.6", | ||
"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.1", | ||
"@sentry/utils": "4.0.5" | ||
"@sentry/types": "4.0.6", | ||
"@sentry/utils": "4.0.6" | ||
}, | ||
@@ -38,2 +38,3 @@ "devDependencies": { | ||
"lint:tslint": "tslint -t stylish -p .", | ||
"lint:tslint:json": "tslint --format json -p . | tee lint-results.json", | ||
"fix": "run-s fix:tslint fix:prettier", | ||
@@ -40,0 +41,0 @@ "fix:prettier": "prettier --write '{src,test}/**/*.ts'", |
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
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
67667
15
956
+ Added@sentry/types@4.0.6(transitive)
+ Added@sentry/utils@4.0.6(transitive)
- Removed@sentry/types@4.0.1(transitive)
- Removed@sentry/utils@4.0.5(transitive)
Updated@sentry/types@4.0.6
Updated@sentry/utils@4.0.6