New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

oneday-core

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oneday-core - npm Package Compare versions

Comparing version 1.0.17 to 1.0.18

error.js

33

index.js

@@ -12,3 +12,6 @@ 'use strict';

const enums = require('./enum');
const {ValidationError, NotFoundError, ConflictError, InternalError} = require('./error');
module.exports = {ValidationError, NotFoundError, ConflictError, InternalError};
module.exports.saveEvent = saveEvent;

@@ -36,2 +39,8 @@ module.exports.saveError = saveError;

async function saveEvent(event, type) { // Saves the incoming copy of data to a table as is
var requestId = uuid.v1();
if (event.requestContext.authorizer !== undefined && event.requestContext.authorizer.requestId !== undefined) {
requestId = event.requestContext.authorizer.requestId;
}
const params = {

@@ -42,3 +51,5 @@ TableName: process.env.incomingTable,

function: type,
event: event
event: event,
requestId: requestId,
created: new Date().toISOString()
},

@@ -66,3 +77,3 @@ };

message: message,
timestamp: new Date().toISOString()
created: new Date().toISOString()
}

@@ -79,10 +90,22 @@ };

async function handleValidation(message, validation, event, functionType) {
class Error {
}
function handleValidation(validation) {
if (validation.status === false) {
const error = new Error('Missing params: (' + validation.props.toString() + '). ');
await saveError(message, error, event, functionType);
return {statusCode: 400};
error.statusCode = 400;
throw error;
}
}
async function generateErrorResponse(message, error, event, caller) {
await saveError(message, error, event, caller);
return {
statusCode: error.statusCode !== undefined ? error.statusCode : 500,
message: message
};
}
async function sendToQueue(body, queueName) { // Sends a message to the given queue

@@ -89,0 +112,0 @@ try {

2

package.json
{
"name": "oneday-core",
"version": "1.0.17",
"version": "1.0.18",
"description": "Basic AWS util functions to ease development.",

@@ -5,0 +5,0 @@ "main": "index.js",

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