@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 +8 -0
- package/package.json +1 -1
- package/src/defaults/function-config.js +1 -0
- package/src/validate/config.js +17 -2
package/changelog.md
CHANGED
package/package.json
CHANGED
package/src/validate/config.js
CHANGED
|
@@ -9,7 +9,8 @@ module.exports = function configValidator (params, inventory, errors) {
|
|
|
9
9
|
let {
|
|
10
10
|
runtime: globalRuntime,
|
|
11
11
|
memory: globalMemory,
|
|
12
|
-
|
|
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`
|