@architect/data
Advanced tools
Comparing version 2.0.17 to 2.1.0
{ | ||
"name": "@architect/data", | ||
"version": "2.0.17", | ||
"version": "2.1.0", | ||
"description": "Dynamically generate a DynamoDB data access layer from an .arc file", | ||
@@ -13,2 +13,3 @@ "homepage": "https://github.com/arc-repos/arc-data", | ||
"scripts": { | ||
"t": "NODE_ENV=testing tape 'test/cloudformation-test.js' | tap-spec", | ||
"test": "NODE_ENV=testing tape 'test/*-test.js' | tap-spec", | ||
@@ -15,0 +16,0 @@ "lint": "eslint . --fix --ignore-pattern node_modules" |
@@ -1,6 +0,7 @@ | ||
var _db = require('./db') | ||
var _doc = require('./doc') | ||
var pfy = require('./_promisify-object') | ||
var env = process.env.NODE_ENV || 'testing' | ||
var testing = env === 'testing' || env === 'staging' | ||
let _db = require('./db') | ||
let _doc = require('./doc') | ||
let tables = require('./_get-tables') | ||
let pfy = require('./_promisify-object') | ||
let env = process.env.NODE_ENV || 'testing' | ||
let testing = env === 'testing' || env === 'staging' | ||
@@ -11,4 +12,2 @@ /** | ||
module.exports = function _init(arc) { | ||
// the app namespace | ||
let app = arc.app[0] | ||
@@ -19,11 +18,8 @@ | ||
// otherwise falls back to the appname-tablename-env convention | ||
var _name = name=> `${app}-${testing? 'staging' : process.env.NODE_ENV}-${name}` | ||
let _name = name=> `${app}-${testing? 'staging' : process.env.NODE_ENV}-${name}` | ||
// list of all tables (if any) defined in .arc | ||
let tables = arc.tables? arc.tables.slice(0).map(t=> _name(Object.keys(t)[0])) : [] | ||
// create a map of data access methods for each table | ||
var data = tables.map(TableName=> ({ | ||
let data = tables(arc).map(TableName=> ({ | ||
delete(key, callback) { | ||
var params = {} | ||
let params = {} | ||
params.TableName = TableName | ||
@@ -34,3 +30,3 @@ params.Key = key | ||
get(key, callback) { | ||
var params = {} | ||
let params = {} | ||
params.TableName = TableName | ||
@@ -44,3 +40,3 @@ params.Key = key | ||
put(item, callback) { | ||
var params = {} | ||
let params = {} | ||
params.TableName = TableName | ||
@@ -68,3 +64,3 @@ params.Item = item | ||
// builds out a data layer object | ||
var layer = {} | ||
let layer = {} | ||
@@ -71,0 +67,0 @@ // add _name, _db and _doc helper shortcuts |
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
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
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
13326
11
231
13