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

idea-toolbox

Package Overview
Dependencies
Maintainers
1
Versions
377
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

idea-toolbox - npm Package Compare versions

Comparing version 0.9.0 to 0.9.1

32

index.js

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

// SNS
createSNSPushPlatormEndpoint,
createSNSPushPlatormEndpoint, publishSNSPush,
// OTHER

@@ -398,3 +398,3 @@ ISODateToItalianFormat, cleanStr, joinArraysOnKeys

case 'FCM': platformARN = SNS_PUSH_PLATFORM_ARN_ANDROID; break;
default: return done(new Error(`E.USERS.FAILED_CREATING_ENDPOINT`));
default: return done(new Error());
}

@@ -405,3 +405,3 @@ // create a new endpoint in the platform

console.log('Creating SNS platform endpoint', platformARN, err, data);
if(err || !data.EndpointArn) return done(new Error(`E.USERS.FAILED_CREATING_ENDPOINT`));
if(err || !data.EndpointArn) done(err || new Error());
else done(null, data.EndpointArn);

@@ -411,2 +411,28 @@ });

/**
* Send a push notification through a SNS endpoint.
* @param {string} message the message to send
* @param {string} platform enum: APNS, FCM
* @param {string} endpoint endpoint to a specific device
* @param {*} done cb(err, data) => {}
*/
function publishSNSPush(message, platform, endpoint, done) {
let structuredMessage;
switch(platform) {
case 'APNS':
structuredMessage = { APNS: JSON.stringify({ aps: { alert: message } }) };
break;
case 'FCM':
structuredMessage = { GCM: JSON.stringify({ data: { message: message } }) };
break;
default: return done(new Error());
}
SNS.publish({
MessageStructure: 'json', Message: JSON.stringify(structuredMessage), TargetArn: endpoint
}, (err, data) => {
console.log('Sending push notification', endpoint, err, data);
done(err, data);
});
}
///

@@ -413,0 +439,0 @@ /// OTHER

2

package.json
{
"name": "idea-toolbox",
"version": "0.9.0",
"version": "0.9.1",
"description": "IDEA's utility functions",

@@ -5,0 +5,0 @@ "engines": {

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