Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sentry-api

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sentry-api - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

.bash_history

48

lib/client.js
var fs = require('fs');
var util = require('util');
var winston = require('winston');
var lodash = require('lodash');
var debug = require('debug');
var request = require('request');
var Promise = require('promise');

@@ -38,3 +36,3 @@ var DSN = require('./dsn').DSN;

// If no DSN is provided, use the default.
if (lodash.isObject(dsn)) {
if (typeof dsn === 'object') {
config = dsn;

@@ -46,16 +44,10 @@ dsn = 'https://app.getsentry.com';

this.config = lodash.defaults(config || {}, {
this.config = {
version: 0,
logging: false,
token: null,
});
...(config || {}),
};
this.logger = new(winston.Logger)({
transports: this.config.logging ? [
new (winston.transports.Console)({
colorize: true,
label: 'SentryAPI'
})
] : []
});
this.debug = debug('SentryAPI');

@@ -116,13 +108,10 @@ this.projects = new Projects(this);

this.logger.info(options.method, uri);
this.debug(options.method, uri);
if (lodash.isUndefined(callback)) {
callback = function() {};
}
return new Promise(function (resolve, reject) {
var requestOptions = lodash.extend({
var p = new Promise(function (resolve, reject) {
var requestOptions = {
uri: uri,
json: true,
}, options);
...options,
};

@@ -142,13 +131,11 @@ if (this.config.token) {

if (error) {
this.logger.error(error);
callback(error, null);
this.debug(error);
reject(error);
}
else if (response.statusCode >= 200 && response.statusCode < 300) {
this.logger.info(response.statusCode, response.statusMessage);
callback(null, body);
this.debug(response.statusCode, response.statusMessage);
resolve(body);
}
else {
this.logger.warn(response.statusCode, response.statusMessage);
this.debug(response.statusCode, response.statusMessage);
if (body && body.detail) {

@@ -163,3 +150,2 @@ error = new Error(body.detail);

}
callback(error);
reject(error)

@@ -169,2 +155,8 @@ }

}.bind(this));
if (callback) {
p.then(body => callback(null, body), err => callback(err));
} else {
return p;
}
};

@@ -171,0 +163,0 @@

{
"name": "sentry-api",
"version": "0.1.1",
"version": "0.2.0",
"description": "A client for the Sentry API",

@@ -15,10 +15,8 @@ "main": "index.js",

"dependencies": {
"lodash": "^3.10.1",
"promise": "^7.0.4",
"request": "^2.65.0",
"winston": "^2.1.0"
"debug": "^4.1.1",
"request": "^2.65.0"
},
"devDependencies": {
"nock": "^2.17.0",
"nodeunit": "^0.9.1",
"nock": "^13.0.2",
"nodeunit": "^0.11.3",
"yuidoc-lucid-theme": "^0.1.1",

@@ -25,0 +23,0 @@ "yuidocjs": "^0.9.0"

# sentry-api
![Build Status](https://travis-ci.org/pifantastic/node-sentry-api.svg?branch=master)
![Dependency Status](https://david-dm.org/pifantastic/node-sentry-api.svg)
A node client for the [Sentry API](https://docs.sentry.io/api/). This is distinct from the reporting API, for which Sentry itself publishes useful libraries.
A node client for the [Sentry](https://getsentry.com/welcome/) web API.
This library is in *maintenance mode*: bug-fixes and version-bumps will be applied, but new functionality will not be developed.
More information about the Sentry web API can be found [here](https://docs.getsentry.com/hosted/api/).
## Installation

@@ -18,3 +15,3 @@

[http://pifantastic.github.io/node-sentry-api/](http://pifantastic.github.io/node-sentry-api/)
[http://taskcluster.github.io/node-sentry-api/](http://taskcluster.github.io/node-sentry-api/)

@@ -21,0 +18,0 @@ ## Example

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