@architect/inventory 2.2.1-RC.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/changelog.md CHANGED
@@ -6,7 +6,8 @@
6
6
 
7
7
  ### Fixed
8
8
 
9
- - Adds HTTP route sorting, which should ensure Sandbox behaves much more like API Gateway despite how you've organized your `@http` pragma; fixes #977
9
+ - Fixed HTTP route sorting; however you've organized your `@http` pragma, Sandbox should now behave much more like API Gateway; fixes #977
10
+ - Fixed overly strict path parameter validation; allow `_`, `.`, `-`; thanks @jkarsrud!
10
11
 
11
12
  ---
12
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@architect/inventory",
3
- "version": "2.2.1-RC.0",
3
+ "version": "2.2.1",
4
4
  "description": "Architect project resource enumeration utility",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -100,7 +100,7 @@ function getLambda (params) {
100
100
  if (type === 'scheduled') return getScheduled(params)
101
101
  if (type === ts) return getTablesStreams(params)
102
102
  if (type === 'tables') return getTablesStreams(params) // Shortcut for creating streams
103
- /* istanbul ignore else */ /* Clearer to be explicit here */
103
+ /* istanbul ignore else: clearer to be explicit here */
104
104
  if (type === 'ws') return getWS(params)
105
105
  }
106
106
 
@@ -55,6 +55,7 @@ module.exports = function sortHTTP (http) {
55
55
  if (a.path < b.path) return -1
56
56
  if (a.path > b.path) return 1
57
57
  })
58
+ // Trailing capture sort
58
59
  .sort((a, b) => {
59
60
  if (!a.depth && b.depth === 1 && b.trailingCapture) return -1
60
61
  if (a.depth - b.depth < 0) return
@@ -49,7 +49,7 @@ module.exports = function validateHTTP (http, errors) {
49
49
  let params = path.match(/\/:/g)
50
50
  if (params) {
51
51
  // Params cannot have non-alphanumeric characters
52
- let match = path.match(/\/:[a-zA-Z0-9]+(\/|$)/g)
52
+ let match = path.match(/\/:[\w.-]+(\/|$)/g)
53
53
  if (!match) errors.push(`Invalid @http path (parameters must have only alphanumeric characters): ${name}`)
54
54
  }
55
55
 
@@ -36,7 +36,7 @@ module.exports = function getProjectConfig (params, errors) {
36
36
  project[`${scope}PreferencesFile`] = p.preferencesFile
37
37
 
38
38
  // Build out the final preferences
39
- /* istanbul ignore else */ // jic
39
+ /* istanbul ignore else: jic */
40
40
  if (!project.preferences) project.preferences = {}
41
41
  Object.keys(p.preferences).forEach(pragma => {
42
42
  // Ignore the raw data
@@ -47,7 +47,7 @@ module.exports = function getProjectConfig (params, errors) {
47
47
  return
48
48
  }
49
49
  // Traverse and merge individual settings
50
- /* istanbul ignore else */ // jic
50
+ /* istanbul ignore else: jic */
51
51
  if (!project.preferences[pragma]) project.preferences[pragma] = {}
52
52
  Object.entries(p.preferences[pragma]).forEach(([ setting, value ]) => {
53
53
  project.preferences[pragma][setting] = value
@@ -18,13 +18,13 @@ module.exports = function getPrefs ({ scope, inventory, errors }) {
18
18
  Object.entries(prefs.arc).forEach(([ key, val ]) => {
19
19
  // TODO add additional preferences checks and normalization
20
20
 
21
- /* istanbul ignore else */ // Parser should get this, but jic
21
+ /* istanbul ignore else: Parser should get this, but jic */
22
22
  if (!preferences[key]) preferences[key] = {}
23
- /* istanbul ignore else */ // Parser should only produce arrays, but jic
23
+ /* istanbul ignore else: Parser should only produce arrays, but jic */
24
24
  if (is.array(val)) {
25
25
  val.forEach(v => {
26
26
  if (is.array(v)) {
27
- /* istanbul ignore if */ // Single vals should be strings, but jic
27
+ /* istanbul ignore if: Single vals should be strings, but jic */
28
28
  if (v.length === 1) preferences[key] = v[0]
29
29
  if (v.length === 2) preferences[key][v[0]] = v[1]
30
30
  if (v.length > 2) preferences[key][v[0]] = [ ...v.slice(1) ]
@@ -39,7 +39,7 @@ module.exports = function getPrefs ({ scope, inventory, errors }) {
39
39
  // Turn env vars with spaces into strings
40
40
  if (key === 'env') {
41
41
  [ 'testing', 'staging', 'production' ].forEach(e => {
42
- /* istanbul ignore else */ // Yet another jic
42
+ /* istanbul ignore else: Yet another jic */
43
43
  if (preferences.env[e]) {
44
44
  Object.entries(preferences.env[e]).forEach(([ key, val ]) => {
45
45
  if (is.array(val)) preferences.env[e][key] = val.join(' ')
@@ -51,7 +51,7 @@ module.exports = function getPrefs ({ scope, inventory, errors }) {
51
51
  if (key === 'sandbox-startup') {
52
52
  preferences[key] = val.map(v => {
53
53
  if (is.string(v)) return v
54
- /* istanbul ignore else */ // Yet another jic
54
+ /* istanbul ignore else: Yet another jic */
55
55
  if (is.array(v)) return v.join(' ')
56
56
  })
57
57
  }
package/src/env/index.js CHANGED
@@ -45,7 +45,7 @@ module.exports = function env (params, inventory, callback) {
45
45
  }
46
46
  }))
47
47
  // Check for more data and, if so, recurse
48
- /* istanbul ignore if */ // Sadly no way to easily mock this for testing
48
+ /* istanbul ignore if: Sadly no way to easily mock this for testing */
49
49
  if (data.NextToken) {
50
50
  getSomeEnvVars(name, data.NextToken, callback)
51
51
  }