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

leo-aws

Package Overview
Dependencies
Maintainers
6
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leo-aws - npm Package Compare versions

Comparing version 2.0.2-beta-x to 2.0.2

tester/package-lock.json

0

factory.js

@@ -0,0 +0,0 @@ 'use strict';

@@ -0,0 +0,0 @@ let config = require("leo-config");

@@ -0,0 +0,0 @@ "use strict";

68

lib/dynamodb.js

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

*/
module.exports = function (configuration) {
module.exports = function(configuration) {
configuration = merge({

@@ -23,3 +23,2 @@ convertEmptyValues: true,

ciphers: 'ALL',
secureProtocol: 'TLSv1_method',
// keepAlive: true

@@ -31,3 +30,3 @@ }),

maxRetries: 2,
}, configuration.dynamodb || configuration || {});
}, configuration || {});

@@ -37,3 +36,3 @@ let docClient = new AWS.DynamoDB.DocumentClient(configuration);

_service: docClient,
batchGetHashkey: function (table, hashkey, ids, opts = {}) {
batchGetHashkey: function(table, hashkey, ids, opts = {}) {
return this.batchGetTable(table, ids.map((e) => {

@@ -60,3 +59,3 @@ let ret = {};

let results = [];
let chunker = chunk(function (items, done) {
let chunker = chunk(function(items, done) {
if (items.length > 0) {

@@ -70,3 +69,3 @@ let params = {

};
docClient.batchGet(params, function (err, data) {
docClient.batchGet(params, function(err, data) {
if (err) {

@@ -142,3 +141,3 @@ logger.error(err);

},
merge: function (table, id, obj, opts = {}) {
merge: function(table, id, obj, opts = {}) {
return new Promise((resolve, reject) => {

@@ -172,3 +171,3 @@ this.get(table, id, opts).then(data => {

},
scan: function (table) {
scan: function(table) {
if (typeof table === 'string') {

@@ -183,3 +182,3 @@ return docClient.scan({

},
smartQuery: function query (params, configuration = {}, stats = {}) {
smartQuery: function query(params, configuration = {}, stats = {}) {
let self = this;

@@ -206,3 +205,3 @@ let config = merge({}, {

return new Promise((resolve, reject) => {
docClient[method](params, function (err, data) {
docClient[method](params, function(err, data) {
if (err) {

@@ -213,3 +212,3 @@ reject(err);

stats.count += data.Count;
config.progress(data, stats, function (shouldContinue) {
config.progress(data, stats, function(shouldContinue) {
shouldContinue = shouldContinue == null || shouldContinue == undefined || shouldContinue;

@@ -223,3 +222,3 @@ if (shouldContinue && data.LastEvaluatedKey && stats.mb < config.mb && (config.count == null || stats.count < config.count)) {

self.smartQuery(params, config, stats).then(function (innerData) {
self.smartQuery(params, config, stats).then(function(innerData) {
data.Items = data.Items.concat(innerData.Items);

@@ -234,3 +233,3 @@ data.ScannedCount += innerData.ScannedCount;

resolve(data);
}).catch(function (err) {
}).catch(function(err) {
reject(err);

@@ -247,3 +246,3 @@ });

},
streamToTable: function (table, opts = {}) {
streamToTable: function(table, opts = {}) {
let self = this;

@@ -274,7 +273,3 @@ opts = merge({

if (key in self.data) {
if (typeof opts.merge === 'function'){
self.data[key] = opts.merge(self.data[key], obj);
}else{
self.data[key] = merge(self.data[key], obj);
}
self.data[key] = merge(self.data[key], obj);
return true;

@@ -288,3 +283,3 @@ } else {

function reset () {
function reset() {
if (opts.hash || opts.range) {

@@ -294,6 +289,6 @@ records = {

length: 0,
map: function (each) {
map: function(each) {
return Object.keys(this.data).map(key => each(this.data[key]));
},
push: function (obj) {
push: function(obj) {
this.length++;

@@ -317,3 +312,3 @@ return assign(this, key(obj), obj);

retry.success = function () {
retry.success = function() {
retry.reset();

@@ -323,3 +318,3 @@ retry.emit('success');

retry.run = function (callback) {
retry.run = function(callback) {
let fail = (err) => {

@@ -336,3 +331,3 @@ retry.removeListener('success', success);

retry.fail = function (err) {
retry.fail = function(err) {
retry.reset();

@@ -343,3 +338,4 @@ callback(err);

};
retry.on('ready', (number, delay) => {
retry.on('ready', function(number, delay) {
if (records.length === 0) {

@@ -370,5 +366,3 @@ retry.success();

let getExisting = opts.merge ? ((done) => {
this.batchGetTable(table, keys).then((existingData => {
done(null, existingData)
})).catch(done);
this.batchGetTable(table, keys);
}) : done => done(null, []);

@@ -379,3 +373,3 @@

let myRecords = all.slice(ndx, ndx + 25);
tasks.push(function (done) {
tasks.push(function(done) {
let retry = {

@@ -426,7 +420,3 @@ backoff: (err) => {

let newObj = lookup[key(e)];
if (typeof opts.merge === 'function'){
newObj.PutRequest.Item = opts.merge(e, newObj.PutRequest.Item);
} else {
newObj.PutRequest.Item = merge(e, newObj.PutRequest.Item);
}
newObj.PutRequest.Item = merge(e, newObj.PutRequest.Item);
});

@@ -469,3 +459,3 @@ async.parallelLimit(tasks, 10, (err, results) => {

writeStream: true,
}, function (obj, done) {
}, function(obj, done) {
records.push(obj);

@@ -477,3 +467,3 @@

});
}, retry.run, function flush (done) {
}, retry.run, function flush(done) {
logger.info('streamToTable On Flush');

@@ -527,3 +517,3 @@ done();

},
updateMulti: function (items, opts = {}) {
updateMulti: function(items, opts = {}) {
opts = merge({

@@ -558,3 +548,3 @@ limit: 20,

*/
writeToTableInChunks: function (table, opts) {
writeToTableInChunks: function(table, opts) {
opts = merge({

@@ -561,0 +551,0 @@ chunk_size: 25,

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

{
"name": "leo-aws",
"version": "2.0.2-beta-x",
"version": "2.0.2",
"description": "Helper wrappers around AWS services, specifically to ease backoff retry and streaming of data into and out of AWS services",

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

# leo-aws
We are currently in the process of moving our existing libraries from our sdk into this repository

@@ -0,0 +0,0 @@ 'use strict';

@@ -0,0 +0,0 @@ module.exports = function(func, opts) {

@@ -0,0 +0,0 @@ const merge = require("lodash.merge");

@@ -0,0 +0,0 @@ module.exports = {

@@ -0,0 +0,0 @@ const autoscale = require("./autoscale");

@@ -0,0 +0,0 @@ 'use strict';

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