Socket
Socket
Sign inDemoInstall

@sentry/core

Package Overview
Dependencies
Maintainers
8
Versions
526
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sentry/core - npm Package Compare versions

Comparing version 4.0.0-beta.12 to 4.0.0-rc.0

dist/api.d.ts

20

dist/dsn.d.ts

@@ -1,6 +0,6 @@

import { DSNComponents, DSNLike, DSNProtocol } from '@sentry/types';
/** The Sentry DSN, identifying a Sentry instance and project. */
export declare class DSN implements DSNComponents {
import { DsnComponents, DsnLike, DsnProtocol } from '@sentry/types';
/** The Sentry Dsn, identifying a Sentry instance and project. */
export declare class Dsn implements DsnComponents {
/** Protocol used to connect to Sentry. */
protocol: DSNProtocol;
protocol: DsnProtocol;
/** Public authorization key. */

@@ -18,6 +18,6 @@ user: string;

projectId: string;
/** Creates a new DSN component */
constructor(from: DSNLike);
/** Creates a new Dsn component */
constructor(from: DsnLike);
/**
* Renders the string representation of this DSN.
* Renders the string representation of this Dsn.
*

@@ -31,8 +31,8 @@ * By default, this will render the public representation without the password

toString(withPassword?: boolean): string;
/** Parses a string into this DSN. */
/** Parses a string into this Dsn. */
private fromString;
/** Maps DSN components into this instance. */
/** Maps Dsn components into this instance. */
private fromComponents;
/** Validates this DSN and throws on error. */
/** Validates this Dsn and throws on error. */
private validate;
}

@@ -30,8 +30,8 @@ "use strict";

var error_1 = require("./error");
/** Regular expression used to parse a DSN. */
/** Regular expression used to parse a Dsn. */
var DSN_REGEX = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+))?@)([\w\.-]+)(?::(\d+))?\/(.+)/;
/** The Sentry DSN, identifying a Sentry instance and project. */
var DSN = /** @class */ (function () {
/** Creates a new DSN component */
function DSN(from) {
/** The Sentry Dsn, identifying a Sentry instance and project. */
var Dsn = /** @class */ (function () {
/** Creates a new Dsn component */
function Dsn(from) {
if (typeof from === 'string') {

@@ -46,3 +46,3 @@ this.fromString(from);

/**
* Renders the string representation of this DSN.
* Renders the string representation of this Dsn.
*

@@ -55,3 +55,3 @@ * By default, this will render the public representation without the password

*/
DSN.prototype.toString = function (withPassword) {
Dsn.prototype.toString = function (withPassword) {
if (withPassword === void 0) { withPassword = false; }

@@ -63,7 +63,7 @@ // tslint:disable-next-line:no-this-assignment

};
/** Parses a string into this DSN. */
DSN.prototype.fromString = function (str) {
/** Parses a string into this Dsn. */
Dsn.prototype.fromString = function (str) {
var match = DSN_REGEX.exec(str);
if (!match) {
throw new error_1.SentryError('Invalid DSN');
throw new error_1.SentryError('Invalid Dsn');
}

@@ -80,4 +80,4 @@ var _a = __read(match.slice(1), 6), protocol = _a[0], user = _a[1], _b = _a[2], pass = _b === void 0 ? '' : _b, host = _a[3], _c = _a[4], port = _c === void 0 ? '' : _c, lastPath = _a[5];

};
/** Maps DSN components into this instance. */
DSN.prototype.fromComponents = function (components) {
/** Maps Dsn components into this instance. */
Dsn.prototype.fromComponents = function (components) {
this.protocol = components.protocol;

@@ -91,4 +91,4 @@ this.user = components.user;

};
/** Validates this DSN and throws on error. */
DSN.prototype.validate = function () {
/** Validates this Dsn and throws on error. */
Dsn.prototype.validate = function () {
var e_1, _a;

@@ -99,3 +99,3 @@ try {

if (!this[component]) {
throw new error_1.SentryError("Invalid DSN: Missing " + component);
throw new error_1.SentryError("Invalid Dsn: Missing " + component);
}

@@ -112,11 +112,11 @@ }

if (this.protocol !== 'http' && this.protocol !== 'https') {
throw new error_1.SentryError("Invalid DSN: Unsupported protocol \"" + this.protocol + "\"");
throw new error_1.SentryError("Invalid Dsn: Unsupported protocol \"" + this.protocol + "\"");
}
if (this.port && isNaN(parseInt(this.port, 10))) {
throw new error_1.SentryError("Invalid DSN: Invalid port number \"" + this.port + "\"");
throw new error_1.SentryError("Invalid Dsn: Invalid port number \"" + this.port + "\"");
}
};
return DSN;
return Dsn;
}());
exports.DSN = DSN;
exports.Dsn = Dsn;
//# sourceMappingURL=dsn.js.map
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {

@@ -7,0 +10,0 @@ extendStatics(d, b);

@@ -0,7 +1,11 @@

export { logger } from './logger';
export { captureException, captureMessage, configureScope } from '@sentry/minimal';
export { Hub, Scope } from '@sentry/hub';
export { BackendClass, BaseClient } from './base';
export { DSN } from './dsn';
export { API } from './api';
export { BaseClient } from './baseclient';
export { BackendClass, BaseBackend } from './basebackend';
export { Dsn } from './dsn';
export { SentryError } from './error';
export { RequestBuffer } from './requestbuffer';
export { Backend, Client, LogLevel, Options } from './interfaces';
export { initAndBind, ClientClass } from './sdk';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var logger_1 = require("./logger");
exports.logger = logger_1.logger;
var minimal_1 = require("@sentry/minimal");

@@ -10,8 +12,14 @@ exports.captureException = minimal_1.captureException;

exports.Scope = hub_1.Scope;
var base_1 = require("./base");
exports.BaseClient = base_1.BaseClient;
var api_1 = require("./api");
exports.API = api_1.API;
var baseclient_1 = require("./baseclient");
exports.BaseClient = baseclient_1.BaseClient;
var basebackend_1 = require("./basebackend");
exports.BaseBackend = basebackend_1.BaseBackend;
var dsn_1 = require("./dsn");
exports.DSN = dsn_1.DSN;
exports.Dsn = dsn_1.Dsn;
var error_1 = require("./error");
exports.SentryError = error_1.SentryError;
var requestbuffer_1 = require("./requestbuffer");
exports.RequestBuffer = requestbuffer_1.RequestBuffer;
var interfaces_1 = require("./interfaces");

@@ -18,0 +26,0 @@ exports.LogLevel = interfaces_1.LogLevel;

import { Scope } from '@sentry/hub';
import { Breadcrumb, Integration, SentryEvent, SentryResponse, Transport, TransportClass, TransportOptions } from '@sentry/types';
import { DSN } from './dsn';
import { Breadcrumb, Integration, Repo, SentryBreadcrumbHint, SentryEvent, SentryEventHint, SentryResponse, Severity, Transport, TransportClass, TransportOptions } from '@sentry/types';
import { Dsn } from './dsn';
import { RequestBuffer } from './requestbuffer';
/** Console logging verbosity for the SDK. */

@@ -18,2 +19,6 @@ export declare enum LogLevel {

/**
* Enable debug functionality in the SDK itself
*/
debug?: boolean;
/**
* Specifies whether this SDK should activate and send events to Sentry.

@@ -25,3 +30,3 @@ * Disabling the SDK reduces all overhead from instrumentation, collecting

/**
* The DSN used to connect to Sentry and identify the project. If omitted, the
* The Dsn used to connect to Sentry and identify the project. If omitted, the
* SDK will not send any data to Sentry.

@@ -52,2 +57,6 @@ */

environment?: string;
/** Configures the repository spec for events */
repos?: Repo[];
/** Sets the distribution for all events */
dist?: string;
/** The maximum number of breadcrumbs sent with events. Defaults to 100. */

@@ -57,67 +66,31 @@ maxBreadcrumbs?: number;

logLevel?: LogLevel;
/** A global sample rate to apply to all events (0 - 1). */
sampleRate?: number;
/** Attaches stacktraces to pure capture message / log integrations */
attachStacktrace?: boolean;
/**
* A callback invoked during event submission, allowing to cancel the process.
* If unspecified, all events will be sent to Sentry.
*
* This function is called for both error and message events before all other
* callbacks. Note that the SDK might perform other actions after calling this
* function. Use {@link Options.beforeSend} for notifications on events
* instead.
*
* @param event The error or message event generated by the SDK.
* @returns True if the event should be sent, false otherwise.
*/
shouldSend?(event: SentryEvent): boolean;
/**
* A callback invoked during event submission, allowing to optionally modify
* the event before it is sent to Sentry.
*
* This function is called after {@link Options.shouldSend} and just before
* sending the event and must return synchronously.
*
* Note that you must return a valid event from this callback. If you do not
* wish to modify the event, simply return it at the end. To cancel event
* submission instead, use {@link Options.shouldSend}.
* wish to modify the event, simply return it at the end.
* Returning null will case the event to be dropped.
*
* @param event The error or message event generated by the SDK.
* @returns A new event that will be sent.
* @param hint May contain additional information about the original exception.
* @returns A new event that will be sent | null.
*/
beforeSend?(event: SentryEvent): SentryEvent;
beforeSend?(event: SentryEvent, hint?: SentryEventHint): SentryEvent | null;
/**
* A callback invoked after event submission has completed.
* @param event The error or message event sent to Sentry.
*/
afterSend?(event: SentryEvent, status: SentryResponse): void;
/**
* A callback allowing to skip breadcrumbs.
*
* This function is called for both manual and automatic breadcrumbs before
* all other callbacks. Note that the SDK might perform other actions after
* calling this function. Use {@link Options.beforeBreadcrumb} for
* notifications on breadcrumbs instead.
*
* @param breadcrumb The breadcrumb as created by the SDK.
* @returns True if the breadcrumb should be added, false otherwise.
*/
shouldAddBreadcrumb?(breadcrumb: Breadcrumb): boolean;
/**
* A callback invoked when adding a breadcrumb, allowing to optionally modify
* it before adding it to future events.
*
* This function is called after {@link Options.shouldAddBreadcrumb} and just
* before persisting the breadcrumb. It must return synchronously.
*
* Note that you must return a valid breadcrumb from this callback. If you do
* not wish to modify the breadcrumb, simply return it at the end. To skip a
* breadcrumb instead, use {@link Options.shouldAddBreadcrumb}.
* not wish to modify the breadcrumb, simply return it at the end.
* Returning null will case the breadcrumb to be dropped.
*
* @param breadcrumb The breadcrumb as created by the SDK.
* @returns The breadcrumb that will be added.
* @returns The breadcrumb that will be added | null.
*/
beforeBreadcrumb?(breadcrumb: Breadcrumb): Breadcrumb;
/**
* A callback invoked after adding a breadcrumb.
* @param breadcrumb The breadcrumb as created by the SDK.
*/
afterBreadcrumb?(breadcrumb: Breadcrumb): void;
beforeBreadcrumb?(breadcrumb: Breadcrumb, hint?: SentryBreadcrumbHint): Breadcrumb | null;
}

@@ -155,6 +128,7 @@ /**

* @param exception An exception-like object.
* @param hint May contain additional information about the original exception.
* @param scope An optional scope containing event metadata.
* @returns The created event id.
* @returns SentryResponse status and event
*/
captureException(exception: any, scope?: Scope): Promise<void>;
captureException(exception: any, hint?: SentryEventHint, scope?: Scope): Promise<SentryResponse>;
/**

@@ -164,6 +138,8 @@ * Captures a message event and sends it to Sentry.

* @param message The message to send to Sentry.
* @param level Define the level of the message.
* @param hint May contain additional information about the original exception.
* @param scope An optional scope containing event metadata.
* @returns The created event id.
* @returns SentryResponse status and event
*/
captureMessage(message: string, scope?: Scope): Promise<void>;
captureMessage(message: string, level?: Severity, hint?: SentryEventHint, scope?: Scope): Promise<SentryResponse>;
/**

@@ -173,6 +149,7 @@ * Captures a manually created event and sends it to Sentry.

* @param event The event to send to Sentry.
* @param hint May contain additional information about the original exception.
* @param scope An optional scope containing event metadata.
* @returns The created event id.
* @returns SentryResponse status and event
*/
captureEvent(event: SentryEvent, scope?: Scope): Promise<SentryResponse>;
captureEvent(event: SentryEvent, hint?: SentryEventHint, scope?: Scope): Promise<SentryResponse>;
/**

@@ -186,9 +163,17 @@ * Records a new breadcrumb which will be attached to future events.

* @param breadcrumb The breadcrumb to record.
* @param hint May contain additional information about the original breadcrumb.
* @param scope An optional scope to store this breadcrumb in.
*/
addBreadcrumb(breadcrumb: Breadcrumb, scope?: Scope): void;
/** Returns the current DSN. */
getDSN(): DSN | undefined;
addBreadcrumb(breadcrumb: Breadcrumb, hint?: SentryBreadcrumbHint, scope?: Scope): void;
/** Returns the current Dsn. */
getDsn(): Dsn | undefined;
/** Returns the current options. */
getOptions(): O;
/**
* A promise that resolves whenever the request buffer is empty.
* If you provide a timeout and the buffer takes longer to drain the promise returns false.
*
* @param timeout Maximum time in ms the client should wait.
*/
close(timeout?: number): Promise<boolean>;
}

@@ -220,5 +205,5 @@ /**

/** Creates a {@link SentryEvent} from an exception. */
eventFromException(exception: any): Promise<SentryEvent>;
eventFromException(exception: any, hint?: SentryEventHint): Promise<SentryEvent>;
/** Creates a {@link SentryEvent} from a plain message. */
eventFromMessage(message: string): Promise<SentryEvent>;
eventFromMessage(message: string, level?: Severity, hint?: SentryEventHint): Promise<SentryEvent>;
/** Submits the event to Sentry */

@@ -249,2 +234,7 @@ sendEvent(event: SentryEvent): Promise<SentryResponse>;

storeScope(scope: Scope): void;
/**
* Returns the internal instance of the request buffer.
* Only used internally.
*/
getBuffer(): RequestBuffer<SentryResponse>;
}

@@ -24,2 +24,3 @@ "use strict";

var hub_1 = require("@sentry/hub");
var logger_1 = require("./logger");
/**

@@ -35,5 +36,8 @@ * Internal function to create a new SDK client instance. The client is

if (defaultIntegrations === void 0) { defaultIntegrations = []; }
if (hub_1.getDefaultHub().getClient()) {
if (hub_1.getCurrentHub().getClient()) {
return;
}
if (options.debug) {
logger_1.logger.enable();
}
var client = new clientClass(options);

@@ -43,3 +47,3 @@ client.install();

// there needs to be a client on the hub already.
hub_1.getDefaultHub().bindClient(client);
hub_1.getCurrentHub().bindClient(client);
var integrations = __spread(defaultIntegrations);

@@ -55,3 +59,4 @@ if (Array.isArray(options.integrations)) {

integrations.forEach(function (integration) {
integration.install();
integration.install(options);
logger_1.logger.log("Integration installed: " + integration.name);
});

@@ -58,0 +63,0 @@ }

{
"name": "@sentry/core",
"version": "4.0.0-beta.12",
"version": "4.0.0-rc.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-beta.12",
"@sentry/minimal": "4.0.0-beta.12",
"@sentry/types": "4.0.0-beta.12",
"@sentry/utils": "4.0.0-beta.12"
"@sentry/hub": "4.0.0-rc.0",
"@sentry/minimal": "4.0.0-rc.0",
"@sentry/types": "4.0.0-rc.0",
"@sentry/utils": "4.0.0-rc.0"
},

@@ -27,7 +27,7 @@ "devDependencies": {

"npm-run-all": "^4.1.2",
"prettier": "^1.12.1",
"prettier": "^1.14.0",
"prettier-check": "^2.0.0",
"rimraf": "^2.6.2",
"tslint": "^5.9.1",
"typescript": "^2.8.3"
"tslint": "^5.11.0",
"typescript": "^3.0.1"
},

@@ -34,0 +34,0 @@ "scripts": {

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc