@beforeyoubid/error-adapter
Advanced tools
Comparing version 1.0.27 to 1.1.0
@@ -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", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
46006
13
24
636
1
+ Addedapollo-server-errors@^3.3.0
- Removedapollo-server-core@^3.4.0
- Removed@apollo/protobufjs@1.2.61.2.7(transitive)
- Removed@apollo/usage-reporting-protobuf@4.1.1(transitive)
- Removed@apollo/utils.dropunuseddefinitions@1.1.0(transitive)
- Removed@apollo/utils.keyvaluecache@1.0.2(transitive)
- Removed@apollo/utils.logger@1.0.1(transitive)
- Removed@apollo/utils.printwithreducedwhitespace@1.1.0(transitive)
- Removed@apollo/utils.removealiases@1.0.0(transitive)
- Removed@apollo/utils.sortast@1.1.0(transitive)
- Removed@apollo/utils.stripsensitiveliterals@1.2.0(transitive)
- Removed@apollo/utils.usagereporting@1.0.1(transitive)
- Removed@apollographql/apollo-tools@0.5.4(transitive)
- Removed@apollographql/graphql-playground-html@1.6.29(transitive)
- Removed@graphql-tools/merge@8.3.18.4.2(transitive)
- Removed@graphql-tools/mock@8.7.20(transitive)
- Removed@graphql-tools/schema@8.5.19.0.19(transitive)
- Removed@graphql-tools/utils@8.9.09.2.1(transitive)
- Removed@graphql-typed-document-node/core@3.2.0(transitive)
- Removed@josephg/resolvable@1.0.1(transitive)
- Removed@protobufjs/aspromise@1.1.2(transitive)
- Removed@protobufjs/base64@1.1.2(transitive)
- Removed@protobufjs/codegen@2.0.4(transitive)
- Removed@protobufjs/eventemitter@1.1.0(transitive)
- Removed@protobufjs/fetch@1.1.0(transitive)
- Removed@protobufjs/float@1.0.2(transitive)
- Removed@protobufjs/inquire@1.1.0(transitive)
- Removed@protobufjs/path@1.1.2(transitive)
- Removed@protobufjs/pool@1.1.0(transitive)
- Removed@protobufjs/utf8@1.1.0(transitive)
- Removed@types/long@4.0.2(transitive)
- Removed@types/node@10.17.60(transitive)
- Removedapollo-datasource@3.3.2(transitive)
- Removedapollo-reporting-protobuf@3.4.0(transitive)
- Removedapollo-server-core@3.13.0(transitive)
- Removedapollo-server-env@4.2.1(transitive)
- Removedapollo-server-plugin-base@3.7.2(transitive)
- Removedapollo-server-types@3.8.0(transitive)
- Removedasync-retry@1.3.3(transitive)
- Removedcommander@2.20.3(transitive)
- Removedcssfilter@0.0.10(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedgraphql-tag@2.12.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedlodash.sortby@4.7.0(transitive)
- Removedloglevel@1.9.2(transitive)
- Removedlong@4.0.0(transitive)
- Removedlru-cache@6.0.07.13.1(transitive)
- Removednode-abort-controller@3.1.1(transitive)
- Removednode-fetch@2.7.0(transitive)
- Removedretry@0.13.1(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsha.js@2.4.11(transitive)
- Removedtr46@0.0.3(transitive)
- Removedtslib@2.8.1(transitive)
- Removeduuid@9.0.1(transitive)
- Removedvalue-or-promise@1.0.111.0.12(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-mimetype@3.0.0(transitive)
- Removedwhatwg-url@5.0.0(transitive)
- Removedxss@1.0.15(transitive)
- Removedyallist@4.0.0(transitive)