Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'datetime-only',
'file'
]),
inputTypes
)
const coreInputs = mapObjIndexed((value) => resolve(value), pick(keys(coreInputTypes), inputs))
const schema = validate({ ...coreInputTypes }, 'RAML10')
const validation = schema({ ...coreInputs })
if (!validation.valid) {
let errorMessages = []
const typeName = chalk.white(`"${Type.props.name}"`)
const header = chalk.redBright.bold(`\ninputType error(s) in Type ${typeName}:\n`)
errorMessages = append(header, errorMessages)
forEach((error) => {
const value = chalk.cyanBright(`"${error.value}"`)
const key = `${chalk.yellowBright(error.key)}`
const suppliedInputType = typeof error.value
const msg = ` - inputType ${key} has invalid \`${suppliedInputType}\` value of ${value} according to the rule: ${chalk.yellowBright(
error.rule
)} ${chalk.yellowBright(error.attr)}.\n`
errorMessages = append(msg, errorMessages)
}, prop('errors', validation))
const message = errorMessages.join('')
throw Error(message)
}
// set defaults if any...
forEachObjIndexed((coreInputType, key) => {
const appendKey = (key, keyPart) => join('.', append(keyPart, split('.', key)))
(accum, componentReference) => {
const { instanceId } = componentReference
if (isNil(instanceId)) {
throw new Error(
`Found a Component reference without an instanceId while getting reference ids. This should not happen. The reference was ${componentReference} and belongs to component ${component}`
)
}
return append(instanceId, accum)
},
[],
async (accum, func) => append(await func.info(), accum),
[],
(accum, nodeId) => {
const node = graph.node(nodeId)
if (!node) {
throw new Error(`could not find node for nodeId:${nodeId}`)
}
graph.removeNode(nodeId)
return append(execNode(iteratee, node, context), accum)
},
[],
async (accum, component) => append(await component.info(), accum),
[],
(accum, childKey) => {
const instanceId = resolve(get('instanceId', children[childKey]))
if (isNil(instanceId)) {
throw new Error(
`Found a child without an instanceId while getting children ids. This should not happen. The child was ${
children[childKey]
} and belongs to parent ${component}`
)
}
return append(instanceId, accum)
},
[],
forEach((error) => {
const value = chalk.cyanBright(`"${error.value}"`)
const key = `${chalk.yellowBright(error.key)}`
const suppliedInputType = typeof error.value
const msg = ` - inputType ${key} has invalid \`${suppliedInputType}\` value of ${value} according to the rule: ${chalk.yellowBright(
error.rule
)} ${chalk.yellowBright(error.attr)}.\n`
errorMessages = append(msg, errorMessages)
}, prop('errors', validation))
async (accum, component) => append(await component.info(), accum),
[],