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.11 to 1.0.12

70

index.js

@@ -28,3 +28,3 @@ 'use strict';

//ToDo: Add response code, global and lambda request tracking numbers
function saveEvent(event, type) { // Saves the incoming copy of data to a table as is
async function saveEvent(event, type) { // Saves the incoming copy of data to a table as is
const params = {

@@ -38,3 +38,3 @@ TableName: process.env.incomingTable,

};
dynamoDb.put(params).promise().then(
await dynamoDb.put(params).promise().then(
(result) => {

@@ -49,3 +49,3 @@ console.log("Successfully saved to EventLog table. ");

//ToDo: Add global and lambda request tracking numbers
function saveError(message, error, data, type) { // Saves the given error to the error table
async function saveError(message, error, data, type) { // Saves the given error to the error table
console.error(error);

@@ -63,3 +63,3 @@ const params = {

};
dynamoDb.put(params).promise().then(
await dynamoDb.put(params).promise().then(
(result) => {

@@ -73,6 +73,6 @@ console.log("Successfully saved to Error table. ");

function handleValidation(message, validation, event, functionType) {
async function handleValidation(message, validation, event, functionType) {
if (validation.status === false) {
const error = new Error("Missing params: (" + validation.props.toString() + "). ");
saveError(message, error, event, functionType);
await saveError(message, error, event, functionType);
return {statusCode: 400};

@@ -82,38 +82,34 @@ }

function sendToQueue(body, queueName) { // Sends a message to the given queue
async function sendToQueue(body, queueName) { // Sends a message to the given queue
try {
var params = {QueueName: queueName};
const queueInfo = await sqs.getQueueUrl(params);
sqs.getQueueUrl({QueueName: queueName}, function (err, data) {
if (err) {
saveError("Unable to get url to send message to (" + queueName + ") queue: ", err, null, "EXTERNAL");
} else {
const params = {
MessageBody: JSON.stringify(body),
QueueUrl: data.QueueUrl
};
sqs.sendMessage(params, function (err, data) {
if (err) {
saveError("Unable to send message to notification queue: ", err, params, "EXTERNAL");
} else {
console.log("Successfully sent message to notification queue.");
}
});
}
})
params = {
MessageBody: JSON.stringify(body),
QueueUrl: queueInfo.QueueUrl
};
const result = await sqs.sendMessage(params);
console.log(result);
} catch (err) {
await saveError("Unable to send message to (" + queueName + ") queue: ", err, params, "EXTERNAL");
}
}
function publishToTopic(topicName, message) { // Sends the given message object to given sns topic
const topicArn = util.getSnsArn(process.env.region, process.env.accountid, topicName);
async function publishToTopic(topicName, message) { // Sends the given message object to given sns topic
try {
const topicArn = util.getSnsArn(process.env.region, process.env.accountid, topicName);
const params = {
Message: JSON.stringify(message),
TopicArn: topicArn
};
const params = {
Message: JSON.stringify(message),
TopicArn: topicArn
};
const result = await sns.publish(params);
console.log(result);
sns.publish(params, function (err, data) {
if (err) {
saveError("Unable to publish message to topic (" + topicName + ") : ", err, params, "EXTERNAL");
} else {
console.log("Successfully published message to topic (" + topicName + ").");
}
});
} catch (err) {
await saveError("Unable to publish message to topic (" + topicName + ") : ", err, params, "EXTERNAL");
}
}
{
"name": "oneday-core",
"version": "1.0.11",
"version": "1.0.12",
"description": "Basic AWS util functions to ease development.",

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

@@ -10,3 +10,3 @@ /*

userCanInviteOthers: false,
invitationValidityDays: 30
invitationValidityDays: 7
};

@@ -13,0 +13,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