Improve raw command handlers and remove dayjs dependency (switched to native Intl.DateTimeFormat API)

This commit is contained in:
lowlighter
2021-02-09 18:50:25 +01:00
parent 7d9d259f23
commit b80eecc3f5
10 changed files with 37 additions and 21 deletions

View File

@@ -60,10 +60,8 @@
if (!account)
logger(`metrics/inputs > account type not set for plugin ${name}!`)
if (account !== "bypass") {
if (!meta.supports?.includes(account))
if (!meta.supports?.includes(q.repo ? "repository" : account))
throw {error:{message:`Not supported for: ${account}`, instance:new Error()}}
if ((q.repo)&&(!meta.supports?.includes("repository")))
throw {error:{message:`Not supported for: ${account} repositories`, instance:new Error()}}
}
//Inputs checks
const result = Object.fromEntries(Object.entries(inputs).map(([key, {type, format, default:defaulted, min, max, values}]) => [