@sentry/core
Advanced tools
Comparing version 4.0.0-rc.2 to 4.0.0
@@ -50,5 +50,39 @@ "use strict"; | ||
var types_1 = require("@sentry/types"); | ||
var async_1 = require("@sentry/utils/async"); | ||
var misc_1 = require("@sentry/utils/misc"); | ||
var string_1 = require("@sentry/utils/string"); | ||
var dsn_1 = require("./dsn"); | ||
/** JSDoc */ | ||
function beforeBreadcrumbConsoleLoopGuard(callback) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var global, levels, originalConsole, result; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
global = misc_1.getGlobalObject(); | ||
levels = ['debug', 'info', 'warn', 'error', 'log']; | ||
if (!('console' in global)) { | ||
return [2 /*return*/, callback()]; | ||
} | ||
originalConsole = global.console; | ||
// Restore all wrapped console methods | ||
levels.forEach(function (level) { | ||
if (level in global.console && originalConsole[level].__sentry__) { | ||
originalConsole[level] = originalConsole[level].__sentry_original__; | ||
} | ||
}); | ||
return [4 /*yield*/, callback()]; | ||
case 1: | ||
result = _a.sent(); | ||
// Revert restoration to wrapped state | ||
levels.forEach(function (level) { | ||
if (level in global.console && originalConsole[level].__sentry__) { | ||
originalConsole[level] = originalConsole[level].__sentry_wrapped__; | ||
} | ||
}); | ||
return [2 /*return*/, result]; | ||
} | ||
}); | ||
}); | ||
} | ||
/** | ||
@@ -220,3 +254,3 @@ * Default maximum number of breadcrumbs added to an event. Can be overwritten | ||
if (!beforeBreadcrumb) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, beforeBreadcrumb(mergedBreadcrumb, hint)]; | ||
return [4 /*yield*/, beforeBreadcrumbConsoleLoopGuard(function () { return beforeBreadcrumb(mergedBreadcrumb, hint); })]; | ||
case 1: | ||
@@ -338,5 +372,5 @@ _c = _d.sent(); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, beforeSend, sampleRate, prepared, finalEvent, _b, response; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
var _a, beforeSend, sampleRate, prepared, finalEvent, isInternalException, exception_1, response; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
@@ -356,3 +390,3 @@ if (!this.isEnabled()) { | ||
case 1: | ||
prepared = _c.sent(); | ||
prepared = _b.sent(); | ||
if (prepared === null) { | ||
@@ -363,14 +397,29 @@ return [2 /*return*/, { | ||
} | ||
if (!beforeSend) return [3 /*break*/, 3]; | ||
finalEvent = prepared; | ||
_b.label = 2; | ||
case 2: | ||
_b.trys.push([2, 5, , 6]); | ||
isInternalException = hint && hint.data && hint.data.__sentry__ === true; | ||
if (!(!isInternalException && beforeSend)) return [3 /*break*/, 4]; | ||
return [4 /*yield*/, beforeSend(prepared, hint)]; | ||
case 2: | ||
_b = _c.sent(); | ||
return [3 /*break*/, 4]; | ||
case 3: | ||
_b = prepared; | ||
_c.label = 4; | ||
case 4: | ||
finalEvent = _b; | ||
finalEvent = _b.sent(); | ||
_b.label = 4; | ||
case 4: return [3 /*break*/, 6]; | ||
case 5: | ||
exception_1 = _b.sent(); | ||
async_1.forget(this.captureException(exception_1, { | ||
data: { | ||
__sentry__: true, | ||
}, | ||
originalException: exception_1, | ||
})); | ||
return [2 /*return*/, { | ||
reason: 'Event processing in beforeSend method threw an exception', | ||
status: types_1.Status.Invalid, | ||
}]; | ||
case 6: | ||
if (finalEvent === null) { | ||
return [2 /*return*/, { | ||
reason: 'Event dropped due to being discarded by beforeSend method', | ||
status: types_1.Status.Skipped, | ||
@@ -380,4 +429,4 @@ }]; | ||
return [4 /*yield*/, send(finalEvent)]; | ||
case 5: | ||
response = _c.sent(); | ||
case 7: | ||
response = _b.sent(); | ||
response.event = finalEvent; | ||
@@ -384,0 +433,0 @@ if (response.status === types_1.Status.RateLimit) { |
export { logger } from './logger'; | ||
export { captureException, captureMessage, configureScope } from '@sentry/minimal'; | ||
export { Hub, Scope } from '@sentry/hub'; | ||
export { addBreadcrumb, captureException, captureEvent, captureMessage, configureScope, withScope, } from '@sentry/minimal'; | ||
export { getCurrentHub, Hub, getHubFromCarrier, Scope } from '@sentry/hub'; | ||
export { API } from './api'; | ||
@@ -5,0 +5,0 @@ export { BaseClient } from './baseclient'; |
@@ -6,7 +6,12 @@ "use strict"; | ||
var minimal_1 = require("@sentry/minimal"); | ||
exports.addBreadcrumb = minimal_1.addBreadcrumb; | ||
exports.captureException = minimal_1.captureException; | ||
exports.captureEvent = minimal_1.captureEvent; | ||
exports.captureMessage = minimal_1.captureMessage; | ||
exports.configureScope = minimal_1.configureScope; | ||
exports.withScope = minimal_1.withScope; | ||
var hub_1 = require("@sentry/hub"); | ||
exports.getCurrentHub = hub_1.getCurrentHub; | ||
exports.Hub = hub_1.Hub; | ||
exports.getHubFromCarrier = hub_1.getHubFromCarrier; | ||
exports.Scope = hub_1.Scope; | ||
@@ -13,0 +18,0 @@ var api_1 = require("./api"); |
@@ -34,2 +34,6 @@ import { Scope } from '@sentry/hub'; | ||
/** | ||
* If this is set to false, default integrations will not be added. | ||
*/ | ||
defaultIntegrations?: boolean; | ||
/** | ||
* List of integrations that should be installed after SDK was initialized. | ||
@@ -36,0 +40,0 @@ * Accepts either a list of integrations or a function that receives |
@@ -46,5 +46,6 @@ "use strict"; | ||
hub_1.getCurrentHub().bindClient(client); | ||
var integrations = __spread(defaultIntegrations); | ||
var integrations = options.defaultIntegrations === false ? [] : __spread(defaultIntegrations); | ||
if (Array.isArray(options.integrations)) { | ||
integrations = __spread(integrations, options.integrations); | ||
var providedIntegrationsNames_1 = options.integrations.map(function (i) { return i.name; }); | ||
integrations = __spread(integrations.filter(function (integration) { return providedIntegrationsNames_1.indexOf(integration.name) === -1; }), options.integrations); | ||
} | ||
@@ -51,0 +52,0 @@ else if (typeof options.integrations === 'function') { |
{ | ||
"name": "@sentry/core", | ||
"version": "4.0.0-rc.2", | ||
"version": "4.0.0", | ||
"description": "Base implementation for all Sentry JavaScript SDKs", | ||
@@ -18,6 +18,6 @@ "repository": "git://github.com/getsentry/raven-js.git", | ||
"dependencies": { | ||
"@sentry/hub": "4.0.0-rc.2", | ||
"@sentry/minimal": "4.0.0-rc.2", | ||
"@sentry/types": "4.0.0-rc.2", | ||
"@sentry/utils": "4.0.0-rc.2" | ||
"@sentry/hub": "4.0.0", | ||
"@sentry/minimal": "4.0.0", | ||
"@sentry/types": "4.0.0", | ||
"@sentry/utils": "4.0.0" | ||
}, | ||
@@ -24,0 +24,0 @@ "devDependencies": { |
@@ -13,4 +13,12 @@ <p align="center"> | ||
[![npm dt](https://img.shields.io/npm/dt/@sentry/core.svg)](https://www.npmjs.com/package/@sentry/core) | ||
[![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 contains interface definitions, base classes and utilities for building Sentry JavaScript SDKs, like | ||
`@sentry/node` or `@sentry/browser`. |
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
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
128877
1596
0
24
+ Added@sentry/hub@4.0.0(transitive)
+ Added@sentry/minimal@4.0.0(transitive)
+ Added@sentry/types@4.0.0(transitive)
+ Added@sentry/utils@4.0.0(transitive)
- Removed@sentry/hub@4.0.0-rc.2(transitive)
- Removed@sentry/minimal@4.0.0-rc.2(transitive)
- Removed@sentry/types@4.0.0-rc.2(transitive)
- Removed@sentry/utils@4.0.0-rc.2(transitive)
Updated@sentry/hub@4.0.0
Updated@sentry/minimal@4.0.0
Updated@sentry/types@4.0.0
Updated@sentry/utils@4.0.0