Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const fields = {};
const mappings = {
boolean: GraphQLBoolean,
hex_color: GraphQLString,
integer: GraphQLInt,
list: GraphQLString,
number: GraphQLFloat,
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})`,
}
});
const ImgixParamsType = new GraphQLInputObjectType({
name: `DatoCmsImgixParams`,
fields
});
const extension = {
resolutions: {
type: new GraphQLObjectType({
const mappings = {
boolean: 'Boolean',
hex_color: 'String',
integer: 'Int',
list: 'String',
number: 'Float',
path: 'String',
string: 'String',
timestamp: 'String',
unit_scalar: 'Float',
font: 'String',
ratio: 'String',
url: 'String',
};
objectEntries(imgixParams.parameters).forEach(([param, doc]) => {
let type = 'String';
if (doc.expects.length === 1) {
if (mappings[doc.expects[0].type]) {
type = mappings[doc.expects[0].type];
}
}
imgixParamsFields[camelize(param)] = {
type,
description: `${doc.short_description} (${doc.url})`,
};
});
actions.createTypes([
schema.buildInputObjectType({
const fields = {};
const mappings = {
boolean: GraphQLBoolean,
hex_color: GraphQLString,
integer: GraphQLInt,
list: GraphQLString,
number: GraphQLFloat,
path: GraphQLString,
string: GraphQLString,
timestamp: GraphQLString,
unit_scalar: GraphQLFloat,
url: GraphQLString
};
Object.entries(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})`
};
});
const ImgixParamsType = new GraphQLInputObjectType({
name: `DatoCmsImgixParams`,
fields
});
return {
resolutions: {
type: new GraphQLObjectType({
name: `DatoCmsResolutions`,
fields: {
const fields = {};
const mappings = {
boolean: GraphQLBoolean,
hex_color: GraphQLString,
integer: GraphQLInt,
list: GraphQLString,
number: GraphQLFloat,
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,
});