Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!shouldAddFragments) {
shouldAddFragments = getNodes().some(node =>
Boolean(node.internal && node.internal.type === 'SanityImageAsset'),
)
}
if (shouldAddFragments) {
const program = store.getState().program
await copy(
path.join(__dirname, '..', 'fragments', 'imageFragments.js'),
`${program.directory}/.cache/fragments/sanity-image-fragments.js`,
)
}
}
const resolveReferencesConfig = new GraphQLInputObjectType({
name: 'SanityResolveReferencesConfiguration',
fields: {
maxDepth: {
type: new GraphQLNonNull(GraphQLInt),
description: 'Max depth to resolve references to',
},
},
})
export const setFieldsOnGraphQLNodeType = async (
context: GatsbyContext & GatsbyOnNodeTypeContext,
pluginConfig: PluginConfig,
) => {
const {type} = context
const typeMapKey = getCacheKey(pluginConfig, CACHE_KEYS.TYPE_MAP)
const typeMap = (stateCache[typeMapKey] || defaultTypeMap) as TypeMap
path: GraphQLString,
string: GraphQLString,
timestamp: GraphQLString,
unit_scalar: GraphQLFloat,
url: GraphQLString,
};
objectEntries(imgixParams.parameters).forEach(([param, doc]) => {
fields[camelize(param)] = {
type:
doc.expects.length === 1 ? mappings[doc.expects[0].type] : GraphQLString,
description: `${doc.short_description} (${doc.url})`,
};
});
module.exports = new GraphQLInputObjectType({
name: `DatoCmsImgixParams`,
fields,
});