@everymundo/data-integration-framework
Advanced tools
Comparing version 0.3.3 to 0.4.0
@@ -55,2 +55,10 @@ 'use strict' | ||
const results = await Promise.all(promises) | ||
const newDocs = [] | ||
results.forEach((r, i) => { | ||
if (r.modifiedCount || r.upsertedCount) { | ||
newDocs.push(toShortFare(prices[i]).mongoDoc) | ||
} | ||
}) | ||
logr.info(`${results.length} updates completed!`) | ||
@@ -66,3 +74,28 @@ | ||
return results | ||
if (process.env.KINESIS_STREAM && process.env.AWS_REGION) { | ||
const Kinesis = require('aws-sdk/clients/kinesis') | ||
const kinesisClient = new Kinesis({ region: process.env.AWS_REGION }) | ||
const Records = newDocs.map((newDoc, i) => ({ | ||
Data: JSON.stringify(newDoc), | ||
PartitionKey: '1' | ||
})) | ||
if (Records.length === 0) { | ||
return console.log('Nothing to do with Kinesis') | ||
} | ||
console.log(`Publishing ${Records.length} Records to Kinesis`) | ||
return kinesisClient.putRecords({ | ||
Records, | ||
StreamName: process.env.KINESIS_STREAM | ||
}).promise() | ||
.then((res) => { | ||
console.log('KINESIS UPDATE WORKED', res) | ||
}) | ||
.catch((err) => { | ||
console.log('KINESIS DID NOT WORK', err) | ||
}) | ||
} | ||
return { results, newDocs } | ||
} | ||
@@ -69,0 +102,0 @@ |
{ | ||
"name": "@everymundo/data-integration-framework", | ||
"version": "0.3.3", | ||
"version": "0.4.0", | ||
"description": "Common logic shared across data integration applications", | ||
@@ -34,2 +34,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"aws-sdk": "^2.493.0", | ||
"chai": "^4.2.0", | ||
@@ -36,0 +37,0 @@ "dotenv": "^8.0.0", |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
21036
566
6
9