@sentry/core
Advanced tools
Comparing version 4.0.6 to 4.1.0
@@ -51,2 +51,5 @@ "use strict"; | ||
header.push("sentry_key=" + dsn.user); | ||
if (dsn.pass) { | ||
header.push("sentry_secret=" + dsn.pass); | ||
} | ||
return { | ||
@@ -53,0 +56,0 @@ 'Content-Type': 'application/json', |
@@ -54,2 +54,3 @@ "use strict"; | ||
var dsn_1 = require("./dsn"); | ||
var logger_1 = require("./logger"); | ||
/** JSDoc */ | ||
@@ -312,5 +313,5 @@ function beforeBreadcrumbConsoleLoopGuard(callback) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, environment, _b, maxBreadcrumbs, release, repos, dist, prepared, exception, request; | ||
var _a, environment, _b, maxBreadcrumbs, release, dist, prepared, exception, request; | ||
return __generator(this, function (_c) { | ||
_a = this.getOptions(), environment = _a.environment, _b = _a.maxBreadcrumbs, maxBreadcrumbs = _b === void 0 ? DEFAULT_BREADCRUMBS : _b, release = _a.release, repos = _a.repos, dist = _a.dist; | ||
_a = this.getOptions(), environment = _a.environment, _b = _a.maxBreadcrumbs, maxBreadcrumbs = _b === void 0 ? DEFAULT_BREADCRUMBS : _b, release = _a.release, dist = _a.dist; | ||
prepared = __assign({}, event); | ||
@@ -323,5 +324,2 @@ if (prepared.environment === undefined && environment !== undefined) { | ||
} | ||
if (prepared.repos === undefined && repos !== undefined) { | ||
prepared.repos = repos; | ||
} | ||
if (prepared.dist === undefined && dist !== undefined) { | ||
@@ -383,3 +381,5 @@ prepared.dist = dist; | ||
_a = this.getOptions(), beforeSend = _a.beforeSend, sampleRate = _a.sampleRate; | ||
if (typeof sampleRate === 'number' && sampleRate > Math.random()) { | ||
// 1.0 === 100% events are sent | ||
// 0.0 === 0% events are sent | ||
if (typeof sampleRate === 'number' && Math.random() > sampleRate) { | ||
return [2 /*return*/, { | ||
@@ -406,2 +406,5 @@ status: types_1.Status.Skipped, | ||
finalEvent = _b.sent(); | ||
if (typeof finalEvent === 'undefined') { | ||
logger_1.logger.error('`beforeSend` method has to return `null` or a valid event'); | ||
} | ||
_b.label = 4; | ||
@@ -408,0 +411,0 @@ case 4: return [3 /*break*/, 6]; |
@@ -29,2 +29,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var is_1 = require("@sentry/utils/is"); | ||
var object_1 = require("@sentry/utils/object"); | ||
var error_1 = require("./error"); | ||
@@ -75,3 +77,3 @@ /** Regular expression used to parse a Dsn. */ | ||
} | ||
Object.assign(this, { host: host, pass: pass, path: path, projectId: projectId, port: port, protocol: protocol, user: user }); | ||
object_1.assign(this, { host: host, pass: pass, path: path, projectId: projectId, port: port, protocol: protocol, user: user }); | ||
}; | ||
@@ -109,3 +111,3 @@ /** Maps Dsn components into this instance. */ | ||
} | ||
if (this.port && isNaN(parseInt(this.port, 10))) { | ||
if (this.port && is_1.isNaN(parseInt(this.port, 10))) { | ||
throw new error_1.SentryError("Invalid Dsn: Invalid port number \"" + this.port + "\""); | ||
@@ -112,0 +114,0 @@ } |
@@ -61,2 +61,3 @@ "use strict"; | ||
var misc_1 = require("@sentry/utils/misc"); | ||
var string_1 = require("@sentry/utils/string"); | ||
var logger_1 = require("../logger"); | ||
@@ -147,3 +148,3 @@ // "Script error." is hard coded into browsers for errors that it can't read. | ||
else if (typeof pattern === 'string') { | ||
return value.includes(pattern); | ||
return string_1.includes(value, pattern); | ||
} | ||
@@ -150,0 +151,0 @@ else { |
@@ -6,1 +6,2 @@ export { Dedupe } from './dedupe'; | ||
export { Debug } from './pluggable/debug'; | ||
export { RewriteFrames } from './pluggable/rewriteframes'; |
@@ -13,2 +13,4 @@ "use strict"; | ||
exports.Debug = debug_1.Debug; | ||
var rewriteframes_1 = require("./pluggable/rewriteframes"); | ||
exports.RewriteFrames = rewriteframes_1.RewriteFrames; | ||
//# sourceMappingURL=index.js.map |
import { Integration } from '@sentry/types'; | ||
/** JSDoc */ | ||
interface DebugOptions { | ||
stringify?: boolean; | ||
debugger?: boolean; | ||
} | ||
/** JSDoc */ | ||
export declare class Debug implements Integration { | ||
@@ -8,6 +13,13 @@ /** | ||
name: string; | ||
/** JSDoc */ | ||
private readonly options; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
constructor(options?: DebugOptions); | ||
/** | ||
* @inheritDoc | ||
*/ | ||
install(): void; | ||
} | ||
export {}; |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -41,3 +52,6 @@ return new (P || (P = Promise))(function (resolve, reject) { | ||
var Debug = /** @class */ (function () { | ||
function Debug() { | ||
/** | ||
* @inheritDoc | ||
*/ | ||
function Debug(options) { | ||
/** | ||
@@ -47,2 +61,3 @@ * @inheritDoc | ||
this.name = 'Debug'; | ||
this.options = __assign({ debugger: false, stringify: false }, options); | ||
} | ||
@@ -55,6 +70,21 @@ /** | ||
minimal_1.configureScope(function (scope) { | ||
scope.addEventProcessor(function (event) { return __awaiter(_this, void 0, void 0, function () { | ||
scope.addEventProcessor(function (event, hint) { return __awaiter(_this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
// tslint:disable-next-line:no-console | ||
console.log(event); | ||
// tslint:disable:no-console | ||
// tslint:disable:no-debugger | ||
if (this.options.debugger) { | ||
debugger; | ||
} | ||
if (this.options.stringify) { | ||
console.log(JSON.stringify(event, null, 2)); | ||
if (hint) { | ||
console.log(JSON.stringify(hint, null, 2)); | ||
} | ||
} | ||
else { | ||
console.log(event); | ||
if (hint) { | ||
console.log(hint); | ||
} | ||
} | ||
return [2 /*return*/, event]; | ||
@@ -61,0 +91,0 @@ }); |
import { Scope } from '@sentry/hub'; | ||
import { Breadcrumb, Integration, Repo, SentryBreadcrumbHint, SentryEvent, SentryEventHint, SentryResponse, Severity, Transport, TransportClass, TransportOptions } from '@sentry/types'; | ||
import { Breadcrumb, Integration, SentryBreadcrumbHint, SentryEvent, SentryEventHint, SentryResponse, Severity, Transport, TransportClass, TransportOptions } from '@sentry/types'; | ||
import { Dsn } from './dsn'; | ||
@@ -64,4 +64,2 @@ import { RequestBuffer } from './requestbuffer'; | ||
environment?: string; | ||
/** Configures the repository spec for events */ | ||
repos?: Record<string, Repo>; | ||
/** Sets the distribution for all events */ | ||
@@ -68,0 +66,0 @@ dist?: string; |
@@ -13,2 +13,9 @@ /** A simple queue that holds promises. */ | ||
/** | ||
* Remove a promise to the queue. | ||
* | ||
* @param task Can be any Promise<T> | ||
* @returns Removed promise. | ||
*/ | ||
remove(task: Promise<T>): Promise<T>; | ||
/** | ||
* This function returns the number of unresolved promises in the queue. | ||
@@ -15,0 +22,0 @@ */ |
@@ -42,3 +42,3 @@ "use strict"; | ||
/** Internal set of queued Promises */ | ||
this.buffer = new Set(); | ||
this.buffer = []; | ||
} | ||
@@ -55,4 +55,10 @@ /** | ||
return __generator(this, function (_a) { | ||
this.buffer.add(task); | ||
task.then(function () { return _this.buffer.delete(task); }).catch(function () { return _this.buffer.delete(task); }); | ||
if (this.buffer.indexOf(task) === -1) { | ||
this.buffer.push(task); | ||
} | ||
task.then(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { | ||
return [2 /*return*/, this.remove(task)]; | ||
}); }); }).catch(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { | ||
return [2 /*return*/, this.remove(task)]; | ||
}); }); }); | ||
return [2 /*return*/, task]; | ||
@@ -63,6 +69,21 @@ }); | ||
/** | ||
* Remove a promise to the queue. | ||
* | ||
* @param task Can be any Promise<T> | ||
* @returns Removed promise. | ||
*/ | ||
RequestBuffer.prototype.remove = function (task) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var removedTask; | ||
return __generator(this, function (_a) { | ||
removedTask = this.buffer.splice(this.buffer.indexOf(task), 1)[0]; | ||
return [2 /*return*/, removedTask]; | ||
}); | ||
}); | ||
}; | ||
/** | ||
* This function returns the number of unresolved promises in the queue. | ||
*/ | ||
RequestBuffer.prototype.length = function () { | ||
return this.buffer.size; | ||
return this.buffer.length; | ||
}; | ||
@@ -85,3 +106,3 @@ /** | ||
}, timeout); | ||
Promise.all(_this.buffer.values()) | ||
Promise.all(_this.buffer) | ||
.then(function () { | ||
@@ -88,0 +109,0 @@ clearTimeout(capturedSetTimeout); |
{ | ||
"name": "@sentry/core", | ||
"version": "4.0.6", | ||
"version": "4.1.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.6", | ||
"@sentry/minimal": "4.0.6", | ||
"@sentry/types": "4.0.6", | ||
"@sentry/utils": "4.0.6" | ||
"@sentry/hub": "4.1.0", | ||
"@sentry/minimal": "4.1.0", | ||
"@sentry/types": "4.1.0", | ||
"@sentry/utils": "4.1.0" | ||
}, | ||
@@ -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
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
195689
54
2511
+ Added@sentry/hub@4.1.0(transitive)
+ Added@sentry/minimal@4.1.0(transitive)
+ Added@sentry/types@4.1.0(transitive)
+ Added@sentry/utils@4.1.0(transitive)
- Removed@sentry/hub@4.0.6(transitive)
- Removed@sentry/minimal@4.0.6(transitive)
- Removed@sentry/types@4.0.6(transitive)
- Removed@sentry/utils@4.0.6(transitive)
Updated@sentry/hub@4.1.0
Updated@sentry/minimal@4.1.0
Updated@sentry/types@4.1.0
Updated@sentry/utils@4.1.0