Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (options.only) {
if (typeof options.only === 'function' && !options.only(key)) return memo;
if (Array.isArray(options.only) && options.only.indexOf(key)) return memo;
}
const attribute = Model.rawAttributes[key];
if (options.map) {
if (typeof options.map === 'function') {
key = options.map(key) || key;
} else {
key = options.map[key] || key;
}
}
const _type = typeMapper.toGraphQL(attribute.type, Model.sequelize.constructor);
memo[key] = {
type: _type
};
if (memo[key].type instanceof GraphQLEnumType) {
const typeName = `${Model.name}${key}EnumType`;
/*
Cache enum types to prevent duplicate type name error
when calling attributeFields multiple times on the same model
*/
if (cache[typeName]) {
memo[key].type = cache[typeName];
} else {