Socket
Socket
Sign inDemoInstall

@sentry/node

Package Overview
Dependencies
Maintainers
9
Versions
510
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.2 to 0.5.0-beta.0

dist/lib/sdk.d.ts

3

dist/index.d.ts
export { NodeBackend, NodeOptions } from './lib/backend';
export { NodeFrontend, SentryClient } from './lib/frontend';
export { NodeFrontend } from './lib/frontend';
export { addBreadcrumb, create, captureEvent, captureException, captureMessage, popScope, pushScope, setUserContext, setExtraContext, setTagsContext } from './lib/sdk';

@@ -7,3 +7,13 @@ "use strict";

exports.NodeFrontend = frontend_1.NodeFrontend;
exports.SentryClient = frontend_1.SentryClient;
var sdk_1 = require("./lib/sdk");
exports.addBreadcrumb = sdk_1.addBreadcrumb;
exports.create = sdk_1.create;
exports.captureEvent = sdk_1.captureEvent;
exports.captureException = sdk_1.captureException;
exports.captureMessage = sdk_1.captureMessage;
exports.popScope = sdk_1.popScope;
exports.pushScope = sdk_1.pushScope;
exports.setUserContext = sdk_1.setUserContext;
exports.setExtraContext = sdk_1.setExtraContext;
exports.setTagsContext = sdk_1.setTagsContext;
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import { Backend, Breadcrumb, Context, Frontend, Options, SentryEvent } from '@sentry/core';
import { Backend, Frontend, Options, SentryEvent } from '@sentry/core';
/**

@@ -30,6 +30,2 @@ * Configuration options for the Sentry Node SDK.

private readonly frontend;
/** In memory store for breadcrumbs. */
private breadcrumbs;
/** In memory store for context infos. */
private context;
/** Creates a new Node backend instance. */

@@ -40,3 +36,3 @@ constructor(frontend: Frontend<NodeOptions>);

*/
install(): Promise<boolean>;
install(): boolean;
/**

@@ -53,19 +49,3 @@ * @inheritDoc

*/
storeContext(context: Context): Promise<void>;
/**
* @inheritDoc
*/
loadContext(): Promise<Context>;
/**
* @inheritDoc
*/
sendEvent(event: SentryEvent): Promise<number>;
/**
* @inheritDoc
*/
storeBreadcrumbs(breadcrumbs: Breadcrumb[]): Promise<void>;
/**
* @inheritDoc
*/
loadBreadcrumbs(): Promise<Breadcrumb[]>;
}
"use strict";
var __assign = (this && this.__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;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -45,25 +37,5 @@ return new (P || (P = Promise))(function (resolve, reject) {

};
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;
};
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@sentry/core");
var utils_1 = require("@sentry/utils");
var shim_1 = require("@sentry/shim");
var raven_1 = require("./raven");

@@ -76,6 +48,2 @@ /** Original Raven send function. */

function NodeBackend(frontend) {
/** In memory store for breadcrumbs. */
this.breadcrumbs = [];
/** In memory store for context infos. */
this.context = {};
this.frontend = frontend;

@@ -87,35 +55,34 @@ }

NodeBackend.prototype.install = function () {
return __awaiter(this, void 0, void 0, function () {
var _this = this;
var dsn, onFatalError;
return __generator(this, function (_a) {
dsn = this.frontend.getDSN();
if (!dsn) {
throw new core_1.SentryError('Invariant exception: install() must not be called when disabled');
}
raven_1.Raven.config(dsn.toString(true), this.frontend.getOptions()).install();
onFatalError = this.frontend.getOptions().onFatalError;
if (onFatalError) {
raven_1.Raven.onFatalError = onFatalError;
}
// Hook into Raven's breadcrumb mechanism. This allows us to intercept
// both breadcrumbs created internally by Raven and pass them to the
// Frontend first, before actually capturing them.
raven_1.Raven.captureBreadcrumb = function (breadcrumb) {
utils_1.forget(_this.frontend.addBreadcrumb(breadcrumb));
};
// Hook into Raven's internal event sending mechanism. This allows us to
// pass events to the frontend, before they will be sent back here for
// actual submission.
raven_1.Raven.send = function (event, callback) {
if (callback) {
callback(event);
}
else {
utils_1.forget(_this.frontend.captureEvent(event));
}
};
return [2 /*return*/, true];
});
});
// We are only called by the frontend if the SDK is enabled and a valid DSN
// has been configured. If no DSN is present, this indicates a programming
// error.
var dsn = this.frontend.getDSN();
if (!dsn) {
throw new core_1.SentryError('Invariant exception: install() must not be called when disabled');
}
raven_1.Raven.config(dsn.toString(true), this.frontend.getOptions()).install();
// There is no option for this so we have to overwrite it like this.
// We need this in SentryElectron.
var onFatalError = this.frontend.getOptions().onFatalError;
if (onFatalError) {
raven_1.Raven.onFatalError = onFatalError;
}
// Hook into Raven's breadcrumb mechanism. This allows us to intercept
// both breadcrumbs created internally by Raven and pass them to the
// Frontend first, before actually capturing them.
raven_1.Raven.captureBreadcrumb = function (breadcrumb) {
shim_1.addBreadcrumb(breadcrumb);
};
// Hook into Raven's internal event sending mechanism. This allows us to
// pass events to the frontend, before they will be sent back here for
// actual submission.
raven_1.Raven.send = function (event, callback) {
if (callback) {
callback(event);
}
else {
shim_1.captureEvent(event);
}
};
return true;
};

@@ -149,23 +116,2 @@ /**

*/
NodeBackend.prototype.storeContext = function (context) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
this.context = __assign({}, context);
return [2 /*return*/];
});
});
};
/**
* @inheritDoc
*/
NodeBackend.prototype.loadContext = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.context];
});
});
};
/**
* @inheritDoc
*/
NodeBackend.prototype.sendEvent = function (event) {

@@ -183,23 +129,2 @@ return __awaiter(this, void 0, void 0, function () {

};
/**
* @inheritDoc
*/
NodeBackend.prototype.storeBreadcrumbs = function (breadcrumbs) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
this.breadcrumbs = __spread(breadcrumbs);
return [2 /*return*/];
});
});
};
/**
* @inheritDoc
*/
NodeBackend.prototype.loadBreadcrumbs = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, __spread(this.breadcrumbs)];
});
});
};
return NodeBackend;

@@ -206,0 +131,0 @@ }());

@@ -1,2 +0,2 @@

import { FrontendBase, Sdk, SdkInfo } from '@sentry/core';
import { FrontendBase, SdkInfo } from '@sentry/core';
import { NodeBackend, NodeOptions } from './backend';

@@ -20,42 +20,1 @@ /**

}
/**
* The Sentry Node SDK Client.
*
* To use this SDK, call the {@link Sdk.create} function as early as possible
* in the main entry module. To set context information or send manual events,
* use the provided methods.
*
* @example
* const { SentryClient } = require('@sentry/node');
*
* SentryClient.create({
* dsn: '__DSN__',
* // ...
* });
*
* @example
* SentryClient.setContext({
* extra: { battery: 0.7 },
* tags: { user_mode: 'admin' },
* user: { id: '4711' },
* });
*
* @example
* SentryClient.addBreadcrumb({
* message: 'My Breadcrumb',
* // ...
* });
*
* @example
* SentryClient.captureMessage('Hello, world!');
* SentryClient.captureException(new Error('Good bye'));
* SentryClient.captureEvent({
* message: 'Manual',
* stacktrace: [
* // ...
* ],
* });
*
* @see NodeOptions for documentation on configuration options.
*/
export declare const SentryClient: Sdk<NodeFrontend, NodeOptions>;

@@ -43,44 +43,2 @@ "use strict";

exports.NodeFrontend = NodeFrontend;
/**
* The Sentry Node SDK Client.
*
* To use this SDK, call the {@link Sdk.create} function as early as possible
* in the main entry module. To set context information or send manual events,
* use the provided methods.
*
* @example
* const { SentryClient } = require('@sentry/node');
*
* SentryClient.create({
* dsn: '__DSN__',
* // ...
* });
*
* @example
* SentryClient.setContext({
* extra: { battery: 0.7 },
* tags: { user_mode: 'admin' },
* user: { id: '4711' },
* });
*
* @example
* SentryClient.addBreadcrumb({
* message: 'My Breadcrumb',
* // ...
* });
*
* @example
* SentryClient.captureMessage('Hello, world!');
* SentryClient.captureException(new Error('Good bye'));
* SentryClient.captureEvent({
* message: 'Manual',
* stacktrace: [
* // ...
* ],
* });
*
* @see NodeOptions for documentation on configuration options.
*/
// tslint:disable-next-line:variable-name
exports.SentryClient = new core_1.Sdk(NodeFrontend);
//# sourceMappingURL=frontend.js.map
{
"name": "@sentry/node",
"version": "0.4.2",
"version": "0.5.0-beta.0",
"description": "Offical Sentry SDK for Node.js",

@@ -17,4 +17,5 @@ "repository": "https://github.com/getsentry/raven-js",

"dependencies": {
"@sentry/core": "0.4.2",
"@sentry/utils": "0.4.2",
"@sentry/core": "0.5.0-beta.0",
"@sentry/shim": "0.5.0-beta.0",
"@sentry/utils": "0.5.0-beta.0",
"raven": "^2.4.2"

@@ -21,0 +22,0 @@ },

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc