serverless-dynamodb-local
Advanced tools
Comparing version 0.2.27 to 0.2.28
47
index.js
@@ -25,3 +25,9 @@ "use strict"; | ||
lifecycleEvents: ["seedHandler"], | ||
usage: "Seeds local DynamoDB tables with data" | ||
usage: "Seeds local DynamoDB tables with data", | ||
options: { | ||
online: { | ||
shortcut: "o", | ||
usage: "Will connect to the tables online to do an online seed run" | ||
} | ||
} | ||
}, | ||
@@ -117,10 +123,22 @@ start: { | ||
dynamodbOptions() { | ||
const dynamoOptions = { | ||
endpoint: `http://${this.host}:${this.port}`, | ||
region: "localhost", | ||
accessKeyId: "MOCK_ACCESS_KEY_ID", | ||
secretAccessKey: "MOCK_SECRET_ACCESS_KEY" | ||
}; | ||
dynamodbOptions(options) { | ||
let dynamoOptions = {}; | ||
if(options && options.online){ | ||
this.serverlessLog("Connecting to online tables..."); | ||
if (!options.region) { | ||
throw new Error("please specify the region"); | ||
} | ||
dynamoOptions = { | ||
region: options.region, | ||
}; | ||
} else { | ||
dynamoOptions = { | ||
endpoint: `http://${this.host}:${this.port}`, | ||
region: "localhost", | ||
accessKeyId: "MOCK_ACCESS_KEY_ID", | ||
secretAccessKey: "MOCK_SECRET_ACCESS_KEY" | ||
}; | ||
} | ||
return { | ||
@@ -139,3 +157,4 @@ raw: new AWS.DynamoDB(dynamoOptions), | ||
seedHandler() { | ||
const documentClient = this.dynamodbOptions().doc; | ||
const options = this.options; | ||
const documentClient = this.dynamodbOptions(options).doc; | ||
const seedSources = this.seedSources; | ||
@@ -168,2 +187,5 @@ return BbPromise.each(seedSources, (source) => { | ||
); | ||
// otherwise endHandler will be mis-informed | ||
this.options = options; | ||
if (!options.noStart) { | ||
@@ -251,2 +273,9 @@ dynamodbLocal.start(options); | ||
} | ||
if (migration.SSESpecification) { | ||
migration.SSESpecification.Enabled = migration.SSESpecification.SSEEnabled; | ||
delete migration.SSESpecification.SSEEnabled; | ||
} | ||
if (migration.Tags) { | ||
delete migration.Tags; | ||
} | ||
dynamodb.raw.createTable(migration, (err) => { | ||
@@ -253,0 +282,0 @@ if (err) { |
{ | ||
"name": "serverless-dynamodb-local", | ||
"version": "0.2.27", | ||
"version": "0.2.28", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=4.0" |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
41734
14
638
3