@sentry/core
Advanced tools
Comparing version 4.2.1 to 4.2.2
@@ -5,3 +5,3 @@ import { Scope } from '@sentry/hub'; | ||
import { Dsn } from './dsn'; | ||
import { IntegrationIndex } from './integrations'; | ||
import { IntegrationIndex } from './integration'; | ||
import { Backend, Client, Options } from './interfaces'; | ||
@@ -8,0 +8,0 @@ /** |
@@ -55,3 +55,3 @@ "use strict"; | ||
var dsn_1 = require("./dsn"); | ||
var integrations_1 = require("./integrations"); | ||
var integration_1 = require("./integration"); | ||
/** | ||
@@ -118,3 +118,3 @@ * Default maximum number of breadcrumbs added to an event. Can be overwritten | ||
// that anyone needs to call client.install(); | ||
this.integrations = integrations_1.setupIntegrations(this.options); | ||
this.integrations = integration_1.setupIntegrations(this.options); | ||
} | ||
@@ -121,0 +121,0 @@ /** |
@@ -47,3 +47,3 @@ "use strict"; | ||
*/ | ||
this.name = 'Dedupe'; | ||
this.name = Dedupe.id; | ||
} | ||
@@ -50,0 +50,0 @@ /** |
@@ -11,3 +11,7 @@ import { Integration } from '@sentry/types'; | ||
*/ | ||
static id: string; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
setupOnce(): void; | ||
} |
@@ -10,3 +10,3 @@ "use strict"; | ||
*/ | ||
this.name = 'FunctionToString'; | ||
this.name = FunctionToString.id; | ||
} | ||
@@ -28,2 +28,6 @@ /** | ||
}; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
FunctionToString.id = 'FunctionToString'; | ||
return FunctionToString; | ||
@@ -30,0 +34,0 @@ }()); |
@@ -76,3 +76,3 @@ "use strict"; | ||
*/ | ||
this.name = 'InboundFilters'; | ||
this.name = InboundFilters.id; | ||
this.configureOptions(); | ||
@@ -79,0 +79,0 @@ } |
@@ -1,3 +0,1 @@ | ||
import { Integration } from '@sentry/types'; | ||
import { Options } from '../interfaces'; | ||
export { Dedupe } from './dedupe'; | ||
@@ -9,17 +7,1 @@ export { FunctionToString } from './functiontostring'; | ||
export { RewriteFrames } from './pluggable/rewriteframes'; | ||
export declare const installedIntegrations: string[]; | ||
/** Map of integrations assigned to a client */ | ||
export interface IntegrationIndex { | ||
[key: string]: Integration; | ||
} | ||
/** Gets integration to install */ | ||
export declare function getIntegrationsToSetup(options: Options): Integration[]; | ||
/** Setup given integration */ | ||
export declare function setupIntegration(integration: Integration, options: Options): void; | ||
/** | ||
* Given a list of integration instances this installs them all. When `withDefaults` is set to `true` then all default | ||
* integrations are added unless they were already provided before. | ||
* @param integrations array of integration instances | ||
* @param withDefault should enable default integrations | ||
*/ | ||
export declare function setupIntegrations<O extends Options>(options: O): IntegrationIndex; |
"use strict"; | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread = (this && this.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
}; | ||
var __values = (this && this.__values) || function (o) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; | ||
if (m) return m.call(o); | ||
return { | ||
next: function () { | ||
if (o && i >= o.length) o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var logger_1 = require("@sentry/utils/logger"); | ||
var dedupe_1 = require("./dedupe"); | ||
@@ -46,104 +15,2 @@ exports.Dedupe = dedupe_1.Dedupe; | ||
exports.RewriteFrames = rewriteframes_1.RewriteFrames; | ||
exports.installedIntegrations = []; | ||
/** Gets integration to install */ | ||
function getIntegrationsToSetup(options) { | ||
var e_1, _a, e_2, _b; | ||
var defaultIntegrations = (options.defaultIntegrations && __spread(options.defaultIntegrations)) || []; | ||
var userIntegrations = options.integrations; | ||
var integrations = []; | ||
if (Array.isArray(userIntegrations)) { | ||
var userIntegrationsNames = userIntegrations.map(function (i) { return i.name; }); | ||
var pickedIntegrationsNames = []; | ||
try { | ||
// Leave only unique default integrations, that were not overridden with provided user integrations | ||
for (var defaultIntegrations_1 = __values(defaultIntegrations), defaultIntegrations_1_1 = defaultIntegrations_1.next(); !defaultIntegrations_1_1.done; defaultIntegrations_1_1 = defaultIntegrations_1.next()) { | ||
var defaultIntegration = defaultIntegrations_1_1.value; | ||
if (userIntegrationsNames.indexOf(getIntegrationName(defaultIntegration)) === -1 && | ||
pickedIntegrationsNames.indexOf(getIntegrationName(defaultIntegration)) === -1) { | ||
integrations.push(defaultIntegration); | ||
pickedIntegrationsNames.push(getIntegrationName(defaultIntegration)); | ||
} | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (defaultIntegrations_1_1 && !defaultIntegrations_1_1.done && (_a = defaultIntegrations_1.return)) _a.call(defaultIntegrations_1); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
try { | ||
// Don't add same user integration twice | ||
for (var userIntegrations_1 = __values(userIntegrations), userIntegrations_1_1 = userIntegrations_1.next(); !userIntegrations_1_1.done; userIntegrations_1_1 = userIntegrations_1.next()) { | ||
var userIntegration = userIntegrations_1_1.value; | ||
if (pickedIntegrationsNames.indexOf(getIntegrationName(userIntegration)) === -1) { | ||
integrations.push(userIntegration); | ||
pickedIntegrationsNames.push(getIntegrationName(userIntegration)); | ||
} | ||
} | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
try { | ||
if (userIntegrations_1_1 && !userIntegrations_1_1.done && (_b = userIntegrations_1.return)) _b.call(userIntegrations_1); | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
} | ||
else if (typeof userIntegrations === 'function') { | ||
integrations = userIntegrations(defaultIntegrations); | ||
integrations = Array.isArray(integrations) ? integrations : [integrations]; | ||
} | ||
else { | ||
return __spread(defaultIntegrations); | ||
} | ||
return integrations; | ||
} | ||
exports.getIntegrationsToSetup = getIntegrationsToSetup; | ||
/** Setup given integration */ | ||
function setupIntegration(integration, options) { | ||
if (exports.installedIntegrations.indexOf(getIntegrationName(integration)) !== -1) { | ||
return; | ||
} | ||
try { | ||
integration.setupOnce(); | ||
} | ||
catch (_Oo) { | ||
/** @deprecated */ | ||
// TODO: Remove in v5 | ||
logger_1.logger.warn("Integration " + getIntegrationName(integration) + ": The install method is deprecated. Use \"setupOnce\"."); | ||
if (integration.install) { | ||
integration.install(options); | ||
} | ||
} | ||
exports.installedIntegrations.push(getIntegrationName(integration)); | ||
logger_1.logger.log("Integration installed: " + getIntegrationName(integration)); | ||
} | ||
exports.setupIntegration = setupIntegration; | ||
/** | ||
* Given a list of integration instances this installs them all. When `withDefaults` is set to `true` then all default | ||
* integrations are added unless they were already provided before. | ||
* @param integrations array of integration instances | ||
* @param withDefault should enable default integrations | ||
*/ | ||
function setupIntegrations(options) { | ||
var integrations = {}; | ||
getIntegrationsToSetup(options).forEach(function (integration) { | ||
integrations[getIntegrationName(integration)] = integration; | ||
setupIntegration(integration, options); | ||
}); | ||
return integrations; | ||
} | ||
exports.setupIntegrations = setupIntegrations; | ||
/** | ||
* Returns the integration static id. | ||
* @param integration Integration to retrieve id | ||
*/ | ||
function getIntegrationName(integration) { | ||
/** | ||
* @depracted | ||
*/ | ||
// tslint:disable-next-line:no-unsafe-any | ||
return integration.constructor.id || integration.name; | ||
} | ||
//# sourceMappingURL=index.js.map |
@@ -59,3 +59,3 @@ "use strict"; | ||
*/ | ||
this.name = 'Debug'; | ||
this.name = Debug.id; | ||
this.options = __assign({ debugger: false, stringify: false }, options); | ||
@@ -62,0 +62,0 @@ } |
@@ -51,3 +51,3 @@ "use strict"; | ||
*/ | ||
this.name = 'RewriteFrames'; | ||
this.name = RewriteFrames.id; | ||
/** | ||
@@ -54,0 +54,0 @@ * @inheritDoc |
{ | ||
"name": "@sentry/core", | ||
"version": "4.2.1", | ||
"version": "4.2.2", | ||
"description": "Base implementation for all Sentry JavaScript SDKs", | ||
@@ -18,6 +18,6 @@ "repository": "git://github.com/getsentry/raven-js.git", | ||
"dependencies": { | ||
"@sentry/hub": "4.2.1", | ||
"@sentry/minimal": "4.2.1", | ||
"@sentry/types": "4.2.1", | ||
"@sentry/utils": "4.2.1" | ||
"@sentry/hub": "4.2.2", | ||
"@sentry/minimal": "4.2.2", | ||
"@sentry/types": "4.2.2", | ||
"@sentry/utils": "4.2.2" | ||
}, | ||
@@ -24,0 +24,0 @@ "devDependencies": { |
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
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
201416
54
2600
+ Added@sentry/hub@4.2.2(transitive)
+ Added@sentry/minimal@4.2.2(transitive)
+ Added@sentry/types@4.2.2(transitive)
+ Added@sentry/utils@4.2.2(transitive)
- Removed@sentry/hub@4.2.1(transitive)
- Removed@sentry/minimal@4.2.1(transitive)
- Removed@sentry/types@4.2.1(transitive)
- Removed@sentry/utils@4.2.1(transitive)
Updated@sentry/hub@4.2.2
Updated@sentry/minimal@4.2.2
Updated@sentry/types@4.2.2
Updated@sentry/utils@4.2.2