@architect/inventory 3.0.0 → 3.1.0

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
@@ -2,6 +2,14 @@
2
2
 
3
3
  ---
4
4
 
5
+ ## [3.1.0] 2022-03-24
6
+
7
+ ### Added
8
+
9
+ - Added support for configuring Lambda's ephemeral storage feature
10
+
11
+ ---
12
+
5
13
  ## [3.0.0] 2022-01-04
6
14
 
7
15
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@architect/inventory",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "Architect project resource enumeration utility",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -10,6 +10,7 @@ module.exports = function createDefaultFunctionConfig () {
10
10
  handler: 'index.handler',
11
11
  state: 'n/a',
12
12
  concurrency: 'unthrottled',
13
+ storage: 512,
13
14
  layers: [],
14
15
  policies: [],
15
16
  shared: true,
@@ -9,7 +9,8 @@ module.exports = function configValidator (params, inventory, errors) {
9
9
  let {
10
10
  runtime: globalRuntime,
11
11
  memory: globalMemory,
12
- timeout: globalTimeout
12
+ storage: globalStorage,
13
+ timeout: globalTimeout,
13
14
  } = inventory.aws
14
15
 
15
16
  let customRuntimes = inventory._project?.customRuntimes?.runtimes || []
@@ -28,6 +29,10 @@ module.exports = function configValidator (params, inventory, errors) {
28
29
  !aliases[globalRuntime] && !aliases[globalRuntime.toLowerCase()])) {
29
30
  errors.push(`Invalid project-level runtime: ${globalRuntime}`)
30
31
  }
32
+ // Storage
33
+ if (!is.nullish(globalStorage) && invalidStorage(globalStorage)) {
34
+ errors.push(invalidStorageMsg(`${globalStorage} MB (@aws)`))
35
+ }
31
36
  // Timeout
32
37
  if (!is.nullish(globalTimeout) && invalidTimeout(globalTimeout)) {
33
38
  errors.push(invalidTimeoutMsg(`${globalTimeout} seconds (@aws)`))
@@ -39,7 +44,7 @@ module.exports = function configValidator (params, inventory, errors) {
39
44
  lambdas.forEach(p => {
40
45
  let pragma = inventory[p]
41
46
  if (pragma) pragma.forEach(({ name, config }) => {
42
- let { memory, runtime, timeout } = config
47
+ let { memory, runtime, storage, timeout } = config
43
48
 
44
49
  // Memory
45
50
  if (invalidMemory(memory) && memory !== globalMemory) {
@@ -49,6 +54,10 @@ module.exports = function configValidator (params, inventory, errors) {
49
54
  if (!allRuntimes.includes(runtime) && runtime !== globalRuntime) {
50
55
  errors.push(`Invalid runtime: ${runtime} (@${p} ${name})`)
51
56
  }
57
+ // Storage
58
+ if (invalidStorage(storage) && storage !== globalStorage) {
59
+ errors.push(invalidStorageMsg(`${storage} MB (@${p} ${name})`))
60
+ }
52
61
  // Timeout
53
62
  if (invalidTimeout(timeout) && timeout !== globalTimeout) {
54
63
  errors.push(invalidTimeoutMsg(`${timeout} seconds (@${p} ${name})`))
@@ -68,3 +77,9 @@ let minTimeout = 1
68
77
  let maxTimeout = 1 * 60 * 15 // 15 mins
69
78
  let invalidTimeout = timeout => !is.number(timeout) || (timeout < minTimeout) || (timeout > maxTimeout)
70
79
  let invalidTimeoutMsg = info => `Invalid Lambda timeout setting: ${info}, timeout must be between ${minTimeout} - ${maxTimeout} seconds`
80
+
81
+ // Memory
82
+ let minStorage = 512
83
+ let maxStorage = 10240
84
+ let invalidStorage = storage => !is.number(storage) || (storage < minStorage) || (storage > maxStorage)
85
+ let invalidStorageMsg = info => `Invalid Lambda storage setting: ${info}, storage must be between ${minStorage} - ${maxStorage} MB`