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

@venncity/errors

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@venncity/errors - npm Package Compare versions

Comparing version 1.7.18 to 1.7.19

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

## [1.7.19](https://github.com/venn-city/npm-shelf/compare/@venncity/errors@1.7.18...@venncity/errors@1.7.19) (2020-08-25)
**Note:** Version bump only for package @venncity/errors
## [1.7.18](https://github.com/venn-city/npm-shelf/compare/@venncity/errors@1.7.17...@venncity/errors@1.7.18) (2020-08-25)

@@ -8,0 +16,0 @@

2

lib/cjs/errorReporting/sentry.d.ts

@@ -11,3 +11,3 @@ import * as Sentry from '@sentry/node';

};
export declare function buildTags(event: Pick<APIGatewayProxyEvent, 'headers'>, context: Pick<LambdaContext, 'awsRequestId' | 'functionVersion'>, { impersonated, isPublicAccess, isService, id, email }: AuthDetailsFromRequest): Record<string, string>;
export declare function buildTags(event: Pick<APIGatewayProxyEvent, 'headers'>, { impersonated, isPublicAccess, isService, id, email }: AuthDetailsFromRequest, context?: Pick<LambdaContext, 'awsRequestId' | 'functionVersion'>): Record<string, string>;
export declare function buildErrorContexts(event: Pick<APIGatewayProxyEvent, 'body'> & {

@@ -14,0 +14,0 @@ Records?: any;

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

if (isSentryEnabled()) {
const tags = buildTags(event, context, authDetailsFromRequest);
const tags = buildTags(event, authDetailsFromRequest, context);
const contexts = buildErrorContexts(event);

@@ -69,3 +69,3 @@ Sentry.configureScope((scope) => {

// eslint-disable-next-line max-len
function buildTags(event, context, { impersonated, isPublicAccess, isService, id, email }) {
function buildTags(event, { impersonated, isPublicAccess, isService, id, email }, context) {
const tags = {};

@@ -87,7 +87,12 @@ tags.xrayTraceId = lodash_1.get(event, 'headers.xrayTraceId');

}
tags.awsRequestId = context.awsRequestId;
tags.functionVersion = context.functionVersion;
setTagIfDefined(tags, 'awsRequestId', context === null || context === void 0 ? void 0 : context.awsRequestId);
setTagIfDefined(tags, 'functionVersion', context === null || context === void 0 ? void 0 : context.functionVersion);
return tags;
}
exports.buildTags = buildTags;
function setTagIfDefined(tags, key, value) {
if (value) {
tags[key] = value;
}
}
// eslint-disable-next-line max-len

@@ -94,0 +99,0 @@ function buildErrorContexts(event) {

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

};
const tags = sentry.buildTags(testEvents.httpEvent, DUMMY_CONTEXT, authDetails);
const tags = sentry.buildTags(testEvents.httpEvent, authDetails, DUMMY_CONTEXT);
expect(tags).toMatchSnapshot();

@@ -75,3 +75,3 @@ });

};
const tags = sentry.buildTags(testEvents.httpEvent, DUMMY_CONTEXT, authDetails);
const tags = sentry.buildTags(testEvents.httpEvent, authDetails, DUMMY_CONTEXT);
expect(tags).toMatchSnapshot();

@@ -83,3 +83,3 @@ });

};
const tags = sentry.buildTags(testEvents.httpEvent, DUMMY_CONTEXT, authDetails);
const tags = sentry.buildTags(testEvents.httpEvent, authDetails, DUMMY_CONTEXT);
expect(tags).toMatchSnapshot();

@@ -92,5 +92,14 @@ });

};
const tags = sentry.buildTags(testEvents.httpEvent, DUMMY_CONTEXT, authDetails);
const tags = sentry.buildTags(testEvents.httpEvent, authDetails, DUMMY_CONTEXT);
expect(tags).toMatchSnapshot();
});
test('No context passed', () => {
const authDetails = {
id: 'sdvasdvsadv',
email: 'moshe@ufnik.com'
};
// @ts-ignore
const tags = sentry.buildTags(testEvents.httpEvent, authDetails, null);
expect(tags).toMatchSnapshot();
});
});

@@ -97,0 +106,0 @@ describe('buildErrorContexts', () => {

@@ -11,3 +11,3 @@ import * as Sentry from '@sentry/node';

};
export declare function buildTags(event: Pick<APIGatewayProxyEvent, 'headers'>, context: Pick<LambdaContext, 'awsRequestId' | 'functionVersion'>, { impersonated, isPublicAccess, isService, id, email }: AuthDetailsFromRequest): Record<string, string>;
export declare function buildTags(event: Pick<APIGatewayProxyEvent, 'headers'>, { impersonated, isPublicAccess, isService, id, email }: AuthDetailsFromRequest, context?: Pick<LambdaContext, 'awsRequestId' | 'functionVersion'>): Record<string, string>;
export declare function buildErrorContexts(event: Pick<APIGatewayProxyEvent, 'body'> & {

@@ -14,0 +14,0 @@ Records?: any;

@@ -13,3 +13,3 @@ import { get, pick } from 'lodash';

if (isSentryEnabled()) {
const tags = buildTags(event, context, authDetailsFromRequest);
const tags = buildTags(event, authDetailsFromRequest, context);
const contexts = buildErrorContexts(event);

@@ -46,3 +46,3 @@ Sentry.configureScope((scope) => {

// eslint-disable-next-line max-len
export function buildTags(event, context, { impersonated, isPublicAccess, isService, id, email }) {
export function buildTags(event, { impersonated, isPublicAccess, isService, id, email }, context) {
const tags = {};

@@ -64,6 +64,11 @@ tags.xrayTraceId = get(event, 'headers.xrayTraceId');

}
tags.awsRequestId = context.awsRequestId;
tags.functionVersion = context.functionVersion;
setTagIfDefined(tags, 'awsRequestId', context === null || context === void 0 ? void 0 : context.awsRequestId);
setTagIfDefined(tags, 'functionVersion', context === null || context === void 0 ? void 0 : context.functionVersion);
return tags;
}
function setTagIfDefined(tags, key, value) {
if (value) {
tags[key] = value;
}
}
// eslint-disable-next-line max-len

@@ -70,0 +75,0 @@ export function buildErrorContexts(event) {

@@ -44,3 +44,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
const tags = sentry.buildTags(testEvents.httpEvent, DUMMY_CONTEXT, authDetails);
const tags = sentry.buildTags(testEvents.httpEvent, authDetails, DUMMY_CONTEXT);
expect(tags).toMatchSnapshot();

@@ -54,3 +54,3 @@ });

};
const tags = sentry.buildTags(testEvents.httpEvent, DUMMY_CONTEXT, authDetails);
const tags = sentry.buildTags(testEvents.httpEvent, authDetails, DUMMY_CONTEXT);
expect(tags).toMatchSnapshot();

@@ -62,3 +62,3 @@ });

};
const tags = sentry.buildTags(testEvents.httpEvent, DUMMY_CONTEXT, authDetails);
const tags = sentry.buildTags(testEvents.httpEvent, authDetails, DUMMY_CONTEXT);
expect(tags).toMatchSnapshot();

@@ -71,5 +71,14 @@ });

};
const tags = sentry.buildTags(testEvents.httpEvent, DUMMY_CONTEXT, authDetails);
const tags = sentry.buildTags(testEvents.httpEvent, authDetails, DUMMY_CONTEXT);
expect(tags).toMatchSnapshot();
});
test('No context passed', () => {
const authDetails = {
id: 'sdvasdvsadv',
email: 'moshe@ufnik.com'
};
// @ts-ignore
const tags = sentry.buildTags(testEvents.httpEvent, authDetails, null);
expect(tags).toMatchSnapshot();
});
});

@@ -76,0 +85,0 @@ describe('buildErrorContexts', () => {

{
"name": "@venncity/errors",
"version": "1.7.18",
"version": "1.7.19",
"author": "Venn Engineering",

@@ -34,5 +34,5 @@ "main": "lib/cjs/index.js",

"dependencies": {
"@sentry/node": "^5.21.1",
"@sentry/types": "^5.21.1",
"@venncity/nested-config": "^2.0.26",
"@sentry/node": "^5.21.4",
"@sentry/types": "^5.21.4",
"@venncity/nested-config": "^2.0.27",
"fast-safe-stringify": "^2.0.7",

@@ -44,3 +44,3 @@ "joi": "^14.3.1",

},
"gitHead": "61616de38590629c91ebb3b1fe74546a65c0294b"
"gitHead": "d4152cfe26e7a07eacc5d47ac88c4a2fa4bf1522"
}

@@ -41,3 +41,3 @@ import * as sentry from './sentry';

};
const tags = sentry.buildTags(testEvents.httpEvent, DUMMY_CONTEXT, authDetails);
const tags = sentry.buildTags(testEvents.httpEvent, authDetails, DUMMY_CONTEXT);
expect(tags).toMatchSnapshot();

@@ -51,3 +51,3 @@ });

};
const tags = sentry.buildTags(testEvents.httpEvent, DUMMY_CONTEXT, authDetails);
const tags = sentry.buildTags(testEvents.httpEvent, authDetails, DUMMY_CONTEXT);
expect(tags).toMatchSnapshot();

@@ -59,3 +59,3 @@ });

};
const tags = sentry.buildTags(testEvents.httpEvent, DUMMY_CONTEXT, authDetails);
const tags = sentry.buildTags(testEvents.httpEvent, authDetails, DUMMY_CONTEXT);
expect(tags).toMatchSnapshot();

@@ -68,5 +68,14 @@ });

};
const tags = sentry.buildTags(testEvents.httpEvent, DUMMY_CONTEXT, authDetails);
const tags = sentry.buildTags(testEvents.httpEvent, authDetails, DUMMY_CONTEXT);
expect(tags).toMatchSnapshot();
});
test('No context passed', () => {
const authDetails = {
id: 'sdvasdvsadv',
email: 'moshe@ufnik.com'
};
// @ts-ignore
const tags = sentry.buildTags(testEvents.httpEvent, authDetails, null);
expect(tags).toMatchSnapshot();
});
});

@@ -73,0 +82,0 @@

@@ -18,3 +18,3 @@ import { get, pick } from 'lodash';

if (isSentryEnabled()) {
const tags = buildTags(event, context, authDetailsFromRequest);
const tags = buildTags(event, authDetailsFromRequest, context);
const contexts = buildErrorContexts(event);

@@ -53,3 +53,3 @@ Sentry.configureScope((scope) => {

// eslint-disable-next-line max-len
export function buildTags(event: Pick<APIGatewayProxyEvent, 'headers'>, context: Pick<LambdaContext, 'awsRequestId' | 'functionVersion'>, { impersonated, isPublicAccess, isService, id, email }: AuthDetailsFromRequest) {
export function buildTags(event: Pick<APIGatewayProxyEvent, 'headers'>, { impersonated, isPublicAccess, isService, id, email }: AuthDetailsFromRequest, context?: Pick<LambdaContext, 'awsRequestId' | 'functionVersion'>) {
const tags: Record<string, string> = {};

@@ -70,8 +70,13 @@ tags.xrayTraceId = get(event, 'headers.xrayTraceId');

}
tags.awsRequestId = context.awsRequestId;
tags.functionVersion = context.functionVersion;
setTagIfDefined(tags, 'awsRequestId', context?.awsRequestId);
setTagIfDefined(tags, 'functionVersion', context?.functionVersion);
return tags;
}
function setTagIfDefined(tags: Record<string, string>, key: string, value?: string) {
if (value) {
tags[key] = value;
}
}
// eslint-disable-next-line max-len

@@ -78,0 +83,0 @@ export function buildErrorContexts(event: Pick<APIGatewayProxyEvent, 'body'> & { Records?: any }): Record<string, any> {

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