Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fields: () => ({
id: globalIdField('OrderItem'),
quantity: { type: new GraphQLNonNull(GraphQLInt) },
product: {
// This can be null if product has been removed
type: productType,
resolve: (item) => item.getProduct(),
},
}),
interfaces: [nodeInterface],
export function getGraphQLFieldsFromTable(table) {
const schema = table.getSchema();
return {
...getGraphQLfieldsFromSchema(_.omit(schema, table.pk)),
[table.pk]: globalIdField(table.tableName),
};
}
fields: () => ({
id: globalIdField('Cart'),
entries: {
type: cartEntryConnectionType,
args: connectionArgs,
resolve: ({ entries }, args) => {
logger.info('Resolving cartType.entries with params:', args);
const connection = connectionFromArray(
entries,
args,
);
return connection;
},
},
totalNumberOfItems: {
type: GraphQLInt,
},
fields: () => ({
id: globalIdField('Example'),
text: {
type: GraphQLString,
description: 'Hello World'
}
}),
interfaces: [ nodeInterface ]
fields: () => ({
id: globalIdField("Character"),
name: {
type: GraphQLString,
description: "The name of the character",
},
wins: {
type: GraphQLInt,
description: "The number of wins for the character",
},
}),
interfaces: [nodeInterface],
description: 'The fields to be used when sorting the data fetched.',
type: classGraphQLOrderType
? new GraphQLList(new GraphQLNonNull(classGraphQLOrderType))
: GraphQLString,
},
skip: defaultGraphQLTypes.SKIP_ATT,
...connectionArgs,
options: defaultGraphQLTypes.READ_OPTIONS_ATT,
};
const classGraphQLOutputTypeName = `${graphQLClassName}`;
const interfaces = [
defaultGraphQLTypes.PARSE_OBJECT,
parseGraphQLSchema.relayNodeInterface,
];
const parseObjectFields = {
id: globalIdField(className, obj => obj.objectId),
...defaultGraphQLTypes.PARSE_OBJECT_FIELDS,
};
const outputFields = () => {
return classOutputFields.reduce((fields, field) => {
const type = transformOutputTypeToGraphQL(
parseClass.fields[field].type,
parseClass.fields[field].targetClass,
parseGraphQLSchema.parseClassTypes
);
if (parseClass.fields[field].type === 'Relation') {
const targetParseClassTypes =
parseGraphQLSchema.parseClassTypes[
parseClass.fields[field].targetClass
];
const args = targetParseClassTypes
? targetParseClassTypes.classGraphQLFindArgs
fields: () => ({
id: globalIdField('ReadingProgress'),
percentage: {
type: GraphQLFloat
}
})
})
fields: () => ({
id: globalIdField(entityTypeName),
...(mapObject(entityType, attribute => ({
type: getGraphQLTypeForAttribute(attribute),
description: attribute.doc,
}))),
}),
interfaces: [nodeInterface],
fields: () => ({
id: globalIdField(),
story: {
type: new GraphQLNonNull(StoryType),
resolve(parent, args, ctx: Context) {
return ctx.storyById.load(parent.story_id);
},
},
parent: {
type: CommentType,
resolve(parent, args, ctx: Context) {
return parent.parent_id && ctx.commentById.load(parent.parent_id);
},
},
author: {
fields: () => ({
id: globalIdField('Organisation'),
name: { type: GraphQLString },
logo: { type: keystoneTypes.cloudinaryImage },
website: { type: GraphQLString },
isHiring: { type: GraphQLBoolean },
description: { type: keystoneTypes.markdown },
location: { type: keystoneTypes.location },
members: {
type: userConnection,
args: connectionArgs,
resolve: ({id}, args) => connectionFromPromisedArray(
User.model.find().where('organisation', id).exec(),
args
),
},
}),
interfaces: [nodeInterface],