@architect/inventory
Advanced tools
+2
-2
| { | ||
| "name": "@architect/inventory", | ||
| "version": "6.1.0-RC.0", | ||
| "version": "6.1.0-RC.1", | ||
| "description": "Architect project resource enumeration utility", | ||
@@ -11,3 +11,3 @@ "main": "src/index.js", | ||
| "test:coverage": "node --test --test-reporter=spec --experimental-test-coverage --test-coverage-lines=100 --test-coverage-exclude='test/**/*' 'test/unit/**/*-test.js'", | ||
| "test:unit": "node --test --test-reporter=spec --test-coverage-exclude='test/**/*' 'test/unit/**/*-test.js'", | ||
| "test:unit": "node --test --test-reporter=spec 'test/unit/**/*-test.js'", | ||
| "rc": "npm version prerelease --preid RC", | ||
@@ -14,0 +14,0 @@ "vendor": "scripts/vendor" |
@@ -36,2 +36,3 @@ let { is, getLambdaDirs } = require('../../../lib') | ||
| let cron = null | ||
| let timezone = null | ||
| if (plugin) { | ||
@@ -42,3 +43,4 @@ let { name, src } = item | ||
| if (item.cron) cron = get.cron(item.cron) | ||
| return { ...item, rate, cron, ...getLambdaDirs(params, { plugin }) } | ||
| if (item.timezone) timezone = item.timezone | ||
| return { ...item, rate, cron, timezone, ...getLambdaDirs(params, { plugin }) } | ||
| } | ||
@@ -62,3 +64,3 @@ errors.push(`Invalid plugin-generated @scheduled item: name: ${name}, rate: ${item.rate}, cron: ${item.cron}, src: ${src}`) | ||
| let dirs = getLambdaDirs(params, { name }) | ||
| return { name, rate, cron, ...dirs } | ||
| return { name, rate, cron, timezone, ...dirs } | ||
| } | ||
@@ -68,3 +70,3 @@ else if (is.object(item)) { | ||
| // Handle rate + cron props | ||
| // Handle rate + cron + timezone props | ||
| if (item[name].rate) { | ||
@@ -80,7 +82,10 @@ let itemRate = item[name].rate | ||
| } | ||
| if (item[name].timezone) { | ||
| timezone = item[name].timezone | ||
| } | ||
| let dirs = getLambdaDirs(params, { name, customSrc: item[name].src }) | ||
| return { name, rate, cron, ...dirs } | ||
| return { name, rate, cron, timezone, ...dirs } | ||
| } | ||
| errors.push(`Invalid @scheduled item: ${item}`) | ||
| } |
@@ -177,3 +177,3 @@ let { basename, sep } = require('path') | ||
| // Lambda setter plugins can technically return anything, so this ensures everything is tidy | ||
| let lambdaProps = [ 'cron', 'batchSize', 'batchWindow', 'fifo', 'method', 'path', 'plugin', 'rate', 'route', 'table', 'type' ] | ||
| let lambdaProps = [ 'cron', 'batchSize', 'batchWindow', 'fifo', 'method', 'path', 'plugin', 'rate', 'route', 'table', 'timezone', 'type' ] | ||
| let configProps = [ ...Object.keys(defaultFunctionConfig()), 'fifo', 'views' ] | ||
@@ -180,0 +180,0 @@ let getKnownProps = (knownProps, raw = {}) => { |
@@ -46,9 +46,9 @@ let { is } = require('../../../lib') | ||
| if (!is.nullish(fifo) && !is.bool(fifo)) { | ||
| errors.push(`Invalid ${pragmaName} item (fifo must be a boolean): ${name}`) | ||
| errors.push(`Invalid ${pragmaName} item (fifo must be a boolean): ${name}`) | ||
| } | ||
| if (!is.nullish(batchSize) && !is.number(batchSize)) { | ||
| errors.push(`Invalid ${pragmaName} item (batchSize must be a number): ${name}`) | ||
| errors.push(`Invalid ${pragmaName} item (batchSize must be a number): ${name}`) | ||
| } | ||
| if (!is.nullish(batchWindow) && !is.number(batchWindow)) { | ||
| errors.push(`Invalid ${pragmaName} item (batchWindow must be a number): ${name}`) | ||
| errors.push(`Invalid ${pragmaName} item (batchWindow must be a number): ${name}`) | ||
| } | ||
@@ -55,0 +55,0 @@ } |
@@ -17,3 +17,3 @@ let { is } = require('../../../lib') | ||
| scheduled.forEach(schedule => { | ||
| let { name, rate, cron } = schedule | ||
| let { name, rate, cron, timezone } = schedule | ||
| regex(name, 'veryLooseName', '@scheduled', errors) | ||
@@ -26,2 +26,3 @@ | ||
| if (rate) validateRate(schedule, errors) | ||
| if (timezone) validateTimezone(schedule, errors) | ||
@@ -58,2 +59,18 @@ if (!cron && !rate) errors.push(`Invalid @scheduled item (no cron or rate expression found): ${name}`) | ||
| function validateTimezone (schedule, errors) { | ||
| let { name, timezone } = schedule | ||
| if (!is.string(timezone) || !timezone.length) { | ||
| errors.push(`Invalid @scheduled item (timezone must be a non-empty string): ${name}`) | ||
| } | ||
| else { | ||
| // AWS EventBridge accepts IANA timezone identifiers (e.g., America/New_York, Europe/London) | ||
| try { | ||
| Intl.DateTimeFormat(undefined, { timeZone: timezone }) | ||
| } | ||
| catch { | ||
| errors.push(`Invalid @scheduled item (timezone must be a valid IANA timzone identifier): ${name}`) | ||
| } | ||
| } | ||
| } | ||
| let singular = [ 'minute', 'hour', 'day' ] | ||
@@ -60,0 +77,0 @@ let plural = [ 'minutes', 'hours', 'days' ] |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
140850
0.55%3380
0.63%