@architect/inventory
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -5,3 +5,3 @@ # Architect Inventory changelog | ||
## [1.0.1 - 1.0.2] 2020-09-08 | ||
## [1.0.1 - 1.0.3] 2020-09-08 | ||
@@ -11,3 +11,3 @@ ### Fixed | ||
- Fixed issue where projects without `get /` would return an error during Lambda source dir population | ||
- Fixed inventory rules around @http + @static | ||
- Fixed inventory rules around @http + @static inferring each other | ||
- Fixed getter when accessing pragmas with null values | ||
@@ -14,0 +14,0 @@ |
{ | ||
"name": "@architect/inventory", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Architect project resource enumeration utility", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
let populate = require('./populate-lambda') | ||
module.exports = function configureHTTP ({ arc, inventory }) { | ||
if (!arc.http) return null | ||
// @http get / is inferred by @static | ||
if (!arc.http && !arc.static) return null | ||
@@ -6,0 +7,0 @@ // Populate normally returns null on an empty Lambda pragma |
module.exports = function configureStatic ({ arc }) { | ||
// @static is inferred by @http | ||
if (!arc.static && !arc.http) return null | ||
@@ -3,0 +4,0 @@ |
module.exports = function _get (inventory) { | ||
function getter (pragma, name) { | ||
let isType = type => typeof inventory[pragma] === type | ||
if (inventory[pragma] === null) return null | ||
if (Array.isArray(inventory[pragma])) { | ||
return inventory[pragma].find(i => { | ||
function getter (prag, name) { | ||
let pragma = inventory[prag] | ||
let isType = type => typeof pragma === type | ||
// Getters | ||
if (pragma === null) return null | ||
if (Array.isArray(pragma)) { | ||
return pragma.find(i => { | ||
// Handle arrays of named entities | ||
@@ -14,6 +17,6 @@ if (i.name) return i.name === name | ||
else if (isType('object')) { | ||
return inventory[pragma][name] | ||
return pragma[name] | ||
} | ||
else if (isType('string') && !name) { | ||
return inventory[pragma] | ||
return pragma | ||
} | ||
@@ -20,0 +23,0 @@ return undefined // jic |
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
49494
1113