dynamodb-admin
Advanced tools
Comparing version 1.2.0 to 1.3.0
52
index.js
@@ -6,3 +6,7 @@ const express = require('express') | ||
const path = require('path') | ||
const errorhandler = require('errorhandler') | ||
const { serializeKey, unserializeKey } = require('./util') | ||
require('es7-object-polyfill') | ||
const app = express() | ||
@@ -29,2 +33,3 @@ app.set('json spaces', 2) | ||
app.use(errorhandler()) | ||
app.use('/assets', express.static(path.join(__dirname, '/public'))) | ||
@@ -48,3 +53,3 @@ | ||
app.get('/tables/:TableName', (req, res) => { | ||
app.get('/tables/:TableName', (req, res, next) => { | ||
const TableName = req.params.TableName | ||
@@ -54,11 +59,15 @@ Promise.all([ | ||
scan({TableName}) | ||
]).then(([description, items]) => { | ||
]).then(([description, result]) => { | ||
const data = Object.assign({}, | ||
description, | ||
items | ||
{ | ||
Items: result.Items.map((item) => { | ||
return Object.assign({}, item, { | ||
__key: serializeKey(item, description.Table) | ||
}) | ||
}) | ||
} | ||
) | ||
res.render('scan', data) | ||
}).catch((error) => { | ||
res.json({error}) | ||
}) | ||
}).catch(next) | ||
}) | ||
@@ -82,21 +91,20 @@ | ||
app.get('/tables/:TableName/items/:id', (req, res) => { | ||
const params = { | ||
TableName : req.params.TableName, | ||
Key: { | ||
id: req.params.id | ||
app.get('/tables/:TableName/items/:key', (req, res, next) => { | ||
const TableName = req.params.TableName | ||
describeTable({TableName}).then((result) => { | ||
const params = { | ||
TableName, | ||
Key: unserializeKey(req.params.key, result.Table) | ||
} | ||
} | ||
get(params).then((response) => { | ||
if (!response) { | ||
return res.status(404).end() | ||
} | ||
res.render('item', { | ||
TableName: req.params.TableName, | ||
Item: response.Item | ||
get(params).then((response) => { | ||
if (!response) { | ||
return res.status(404).end() | ||
} | ||
res.render('item', { | ||
TableName: req.params.TableName, | ||
Item: response.Item | ||
}) | ||
}) | ||
}).catch((error) => { | ||
res.json({error}) | ||
}) | ||
}).catch(next) | ||
}) | ||
@@ -103,0 +111,0 @@ |
{ | ||
"name": "dynamodb-admin", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "GUI for DynamoDB. Useful for local development.", | ||
@@ -24,3 +24,5 @@ "main": "index.js", | ||
"ejs": "^2.5.1", | ||
"errorhandler": "^1.4.3", | ||
"es6-promisify": "^4.1.0", | ||
"es7-object-polyfill": "0.0.1", | ||
"express": "^4.14.0", | ||
@@ -27,0 +29,0 @@ "get-port": "^2.1.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
107633
14
508
0
7
+ Addederrorhandler@^1.4.3
+ Addedes7-object-polyfill@0.0.1
+ Addederrorhandler@1.5.1(transitive)
+ Addedes7-object-polyfill@0.0.1(transitive)
+ Addedreflect.ownkeys@0.2.0(transitive)