Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fields.forEach((field) => {
// get item by dot notation
const value = getByDot(items, field);
// set cleaned item by dot notation
setByDot(items, field, clean(value));
});
}
return (parent: any, args: ArgMap, content: ResolverContext, ast: GraphQLResolveInfo) => {
let batchLoader = getByDot(content, contentByDot);
if (!batchLoader) {
batchLoader = getBatchLoader(batchLoaderName, parent, args, content, ast);
setByDot(content, contentByDot, batchLoader);
}
const returns1 = batchLoader.load(parent[fieldName]);
return !isArray ? returns1 : returns1.then((result: any) => result || []);
};
}
return (parent, args, content, ast) => {
let batchLoader = getByDot(content, contentByDot);
if (!batchLoader) {
batchLoader = getBatchLoader(batchLoaderName, parent, args, content, ast);
setByDot(content, contentByDot, batchLoader);
}
const returns1 = batchLoader.load(parent[fieldName]);
return !isArray ? returns1 : returns1.then(result => result || []);
};
}
return (parent: any, args: ArgMap, content: ResolverContext, ast: GraphQLResolveInfo) => {
let batchLoader = getByDot(content, contentByDot);
if (!batchLoader) {
batchLoader = getBatchLoader(batchLoaderName, parent, args, content, ast);
setByDot(content, contentByDot, batchLoader);
}
const returns1 = batchLoader.load(parent[fieldName]);
return !isArray ? returns1 : returns1.then((result: any) => result || []);
};
}
return (parent, args, content, ast) => {
let batchLoader = getByDot(content, contentByDot);
if (!batchLoader) {
batchLoader = getBatchLoader(batchLoaderName, parent, args, content, ast);
setByDot(content, contentByDot, batchLoader);
}
const returns1 = batchLoader.load(parent[fieldName]);
return !isArray ? returns1 : returns1.then(result => result || []);
};
}
data.forEach(item => {
const keyHere = getByDot(item, include.keyHere)
if (keyHere) {
if (Array.isArray(keyHere)) {
if (!include.asArray) {
setByDot(item, include.nameAs, getRelatedItems(keyHere[0], relatedItems, include))
} else {
setByDot(item, include.nameAs, getRelatedItems(keyHere, relatedItems, include))
}
} else {
setByDot(item, include.nameAs, getRelatedItems(keyHere, relatedItems, include))
}
}
})
})
return (parent, args, content, ast) => {
let batchLoader = getByDot(content, contentByDot);
if (!batchLoader) {
batchLoader = getBatchLoader(batchLoaderName, parent, args, content, ast);
setByDot(content, contentByDot, batchLoader);
}
const returns = batchLoader.load(parent[fieldName]);
return !isArray ? returns : returns.then(result => result || []);
};
}
return (parent: any, args: ArgMap, content: ResolverContext, ast: GraphQLResolveInfo) => {
let batchLoader = getByDot(content, contentByDot);
if (!batchLoader) {
batchLoader = getBatchLoader(batchLoaderName, parent, args, content, ast);
setByDot(content, contentByDot, batchLoader);
}
const returns1 = batchLoader.load(parent[fieldName]);
return !isArray ? returns1 : returns1.then((result: any) => result || []);
};
}