Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
defaultVisitor(node, visitNode) {
if (node.nodes) {
// Recurse into the child nodes array
node.nodes = node.nodes.map(childNode => visitNode(childNode));
}
return node;
},
}),
};
return result;
}
export class Content extends Relationship.implementation {
constructor(path, { blocks: inputBlocks, ...fieldConfig }, listConfig) {
// To maintain consistency with other types, we grab the sanitised name
// directly from the list.
const { itemQueryName } = listConfig.getListByKey(listConfig.listKey).gqlNames;
// We prefix with `_` here to avoid any possible conflict with a list called
// `ContentType`.
// Including the list name + path to make sure these input types are unique
// to this list+field and don't collide.
const type = `${GQL_TYPE_PREFIX}_${itemQueryName}_${path}`;
// Normalise blocks to always be a tuple with a config object
let blocks = (Array.isArray(inputBlocks) ? inputBlocks : []).map(block =>
Array.isArray(block) ? block : [block, {}]
);