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

@beforeyoubid/error-adapter

Package Overview
Dependencies
Maintainers
8
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@beforeyoubid/error-adapter - npm Package Compare versions

Comparing version 1.0.27 to 1.1.0

2

dist/errors.d.ts

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

import { UserInputError } from 'apollo-server-core';
import { UserInputError } from 'apollo-server-errors';
import { GraphQLError, GraphQLFormattedError } from 'graphql';

@@ -3,0 +3,0 @@ import { ActivityLogError, PermanentActivityLogError, APIFailureActivityLogError, MissingFieldActivityLogError, ExternalAPIAuthenticationFailActivityLogError, MissingExternalResourceActivityLogError, InternalAPIFailureActivityLogError, EmailActivityLogError, SMSActivityLogError, DBActivityLogError, RedisActivityLogError, InvestorOptOutActivityError } from './activity-log-errors';

@@ -5,4 +5,4 @@ "use strict";

const sentry_1 = require("./sentry");
const apollo_server_core_1 = require("apollo-server-core");
Object.defineProperty(exports, "UserInputError", { enumerable: true, get: function () { return apollo_server_core_1.UserInputError; } });
const apollo_server_errors_1 = require("apollo-server-errors");
Object.defineProperty(exports, "UserInputError", { enumerable: true, get: function () { return apollo_server_errors_1.UserInputError; } });
const graphql_1 = require("graphql");

@@ -9,0 +9,0 @@ const constants_1 = require("./constants");

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

declare let Sentry: any;
export { Sentry };
import Sentry from '@sentry/node';
/**
* Initialise Sentry based on provided options
* @param options
*/
declare const initialise: (options?: Sentry.NodeOptions | undefined) => void;
declare const SentryWithInitialise: typeof Sentry & {
initialise: typeof initialise;
};
export { SentryWithInitialise as Sentry };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Sentry = void 0;
let Sentry = require('@sentry/node');
exports.Sentry = Sentry;
const node_1 = require("@sentry/node");
const utils_1 = require("../utils");

@@ -15,9 +14,9 @@ let isSentryInitialised = false;

const { defaultSentryOptions, sendToSentry } = utils_1.getDefaultSentryParams();
// replace defaulted options with options passed in if they exist
var sentryOptions = Object.assign(Object.assign({}, defaultSentryOptions), options);
// replace defaulted options with options passed in if they exist
const sentryOptions = Object.assign(Object.assign({}, defaultSentryOptions), options);
if (sendToSentry) {
Sentry.init(sentryOptions);
node_1.default.init(sentryOptions);
}
else {
Sentry.init({ dsn: '', enabled: false });
node_1.default.init({ dsn: '', enabled: false });
}

@@ -28,2 +27,5 @@ }

// attach custom initialise function
Sentry.initialise = initialise;
const SentryWithInitialise = Object.assign({}, node_1.default !== null && node_1.default !== void 0 ? node_1.default : {}, {
initialise,
});
exports.Sentry = SentryWithInitialise;

@@ -0,5 +1,7 @@

import { WithSentryOptions, Handler } from 'serverless-sentry-lib';
/**
* Wrap the serverless-sentry-lib function call to default to using own Sentry client unless custom options provided
*/
declare const withSentry: (arg1: object, arg2?: any) => any;
declare function withSentry(options: WithSentryOptions, handler: Handler<any, any>): Handler<any, any>;
declare function withSentry(handler: Handler<any, any>): Handler<any, any>;
export default withSentry;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
let serverlessSentry = require('serverless-sentry-lib');
const serverless_sentry_lib_1 = require("serverless-sentry-lib");
const node_1 = require("../node");
/**
* Wrap the serverless-sentry-lib function call to default to using own Sentry client unless custom options provided
*/
const withSentry = (arg1, arg2) => {
if (typeof arg1 === 'object') {
const isArgOptions = (arg) => typeof arg === 'object';
const isArgHandler = (arg) => typeof arg === 'function';
function withSentry(arg1, arg2) {
if (isArgOptions(arg1) && arg2 !== undefined && isArgHandler(arg2)) {
// custom options passed in, include in callback
// this allows the use of serverless-sentry-lib to handle custom options
return serverlessSentry(arg1, arg2);
return serverless_sentry_lib_1.default(arg1, arg2);
}
else if (typeof arg1 === 'function') {
else if (isArgHandler(arg1)) {
// no custom options, intialise and pass in Sentry client, arg1 is the callback function
node_1.Sentry.initialise();
return serverlessSentry({ sentry: node_1.Sentry }, arg1);
return serverless_sentry_lib_1.default({ sentry: node_1.Sentry }, arg1);
}

@@ -22,3 +21,3 @@ else {

}
};
}
exports.default = withSentry;

@@ -22,3 +22,3 @@ "use strict";

environment: SENTRY_ENVIRONMENT,
sampleRate: SENTRY_SAMPLE_RATE,
sampleRate: Number(SENTRY_SAMPLE_RATE),
beforeSend: sentry_1.handleBeforeSend,

@@ -25,0 +25,0 @@ };

@@ -1,13 +0,5 @@

export interface ISentryOptions {
dsn?: string;
environment?: string;
sampleRate?: string | number;
beforeSend?: any;
integrations?: [any];
tracesSampleRate?: string | number;
enabled?: boolean;
}
import { NodeOptions } from '@sentry/node';
export interface ISentryParams {
sendToSentry: boolean;
defaultSentryOptions: ISentryOptions;
defaultSentryOptions: NodeOptions;
}
{
"name": "@beforeyoubid/error-adapter",
"version": "1.0.27",
"version": "1.1.0",
"description": "A module to standardize error handling across the BYB platform",

@@ -8,11 +8,11 @@ "main": "dist/index.js",

"files": [
"dist/**/*",
"src/**/*"
"dist/**/*"
],
"scripts": {
"lint": "eslint --max-warnings 0 '**/*.{ts,tsx,js,jsx}' && tsc --noEmit",
"lint": "eslint --max-warnings 0 '**/*.{ts,tsx,js,jsx}'",
"ts": "tsc --noEmit",
"lint:fix": "eslint --fix --max-warnings 0 '**/*.{ts,tsx,js,jsx}'",
"test": "yarn build && jest --config jestconfig.json",
"test:coverage": "yarn build && jest --config jestconfig.json --watch --coverage",
"test:ci": "yarn build && jest --config jestconfig.json --verbose=false --coverage",
"test": "yarn build && yarn jest --config jestconfig.json",
"test:coverage": "yarn build && yarn jest --config jestconfig.json --watch --coverage",
"test:ci": "yarn build && yarn jest --config jestconfig.json --verbose=false --coverage",
"test-only": "jest --config jestconfig.json",

@@ -35,3 +35,3 @@ "build": "tsc",

"@sentry/node": "6.2.2",
"apollo-server-core": "^3.4.0",
"apollo-server-errors": "^3.3.0",
"graphql": "^15.3.0",

@@ -43,3 +43,3 @@ "serverless-sentry-lib": "^2.4.0"

"@types/jest": "^26.0.9",
"@types/node": "^14.0.27",
"@types/node": "^16.11.12",
"@typescript-eslint/eslint-plugin": "^5.1.0",

@@ -51,2 +51,3 @@ "@typescript-eslint/parser": "^5.1.0",

"jest": "^26.4.0",
"jest-junit": "^13.0.0",
"prettier": "^2.0.5",

@@ -53,0 +54,0 @@ "ts-jest": "^26.2.0",

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