Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const GraphQLContactTag: GraphQLObjectType<
ContactTag
> = new GraphQLObjectType({
name: "ContactTag",
fields: plural
});
export const GraphQLContactRelationship: GraphQLObjectType<
ContactRelationship
> = new GraphQLObjectType({
name: "ContactRelationship",
fields: plural
});
export const GraphQLContact: GraphQLObjectType = new GraphQLObjectType(
{
name: "Contact",
description:
"Portable Contact. Schema defined by http://portablecontacts.net/draft-spec.html",
fields: () => ({
// fixed
id: {
type: new GraphQLNonNull(GraphQLID),
description:
"Unique identifier for the Contact. Each Contact returned MUST include a non-empty id value. This identifier MUST be unique across this user's entire set of Contacts, but MAY not be unique across multiple users' data. It MUST be a stable ID that does not change when the same contact is returned in subsequent requests. For instance, an e-mail address is not a good id, because the same person may use a different e-mail address in the future. Usually, in internal database ID will be the right choice here, e.g. \"12345\"."
},
// user configurable
displayName: {
type: GraphQLString,
description:
function makeSchemaForType (output, input) {
const queryType = new GraphQLObjectType({
name: 'Query',
fields: {
findOne: { type: output }
}
});
const mutationType = input ? new GraphQLObjectType({
name: 'Mutation',
fields: {
create: {
args: {input: {type: input}},
type: output
}
}
}) : undefined;
return new GraphQLSchema({query: queryType, mutation: mutationType});
}
id: { type: graphql.GraphQLInt }
},
resolve: (_, args) => DB.getGroup(args.id)
},
user: {
type: User,
args: {
id: { type: new graphql.GraphQLNonNull(graphql.GraphQLInt) }
},
resolve: (_, args) => DB.getUser(args.id)
}
})
});
const Mutation = new graphql.GraphQLObjectType({
name: 'Mutation',
fields: () => ({
createUser: {
type: User,
args: {
nick: { type: new graphql.GraphQLNonNull(graphql.GraphQLString) }
},
resolve: (_, args) => ({ id: 5, nick: args.nick })
}
})
});
const Schema = new graphql.GraphQLSchema({
query: Query,
mutation: Mutation
}
},
pageContentInterface: {
type: new GraphQLList(contentBlockInterface),
resolve: () => {
return [DataProvider.getPost(2), DataProvider.getBanner(3)];
}
},
enumNull: {
type: postStatus,
resolve: () => {
return null;
}
},
scalarList: {
type: new GraphQLList(new GraphQLObjectType({
name: 'scalarObject',
fields: {
id: {type: GraphQLInt},
cost: {type: GraphQLInt}
}
})),
args: {
count: {type: GraphQLInt, defaultValue: "12"}
},
resolve: (source, args) => {
console.log(args['count'], (args['count'] === "12"));
return [
{
id: 1,
cost: 2
},
exclude: {
type: new GraphQLList(GraphQLString),
description:
"List of artwork IDs to exclude from the response (irrespective of size)",
},
for_sale: {
type: GraphQLBoolean,
defaultValue: false,
},
published: {
type: GraphQLBoolean,
defaultValue: true,
},
}
export const ShowType = new GraphQLObjectType({
name: "Show",
interfaces: [NodeInterface],
fields: () => ({
...SlugAndInternalIDFields,
cached,
artists: {
description: "The Artists presenting in this show",
type: new GraphQLList(Artist.type),
resolve: ({ artists }) => {
return artists
},
},
artworks: {
description: "The artworks featured in this show",
deprecationReason: deprecate({
inVersion: 2,
description: 'Title of the plugin.'
},
version: {
type: new GraphQLNonNull(GraphQLString),
description: 'Version of the plugin, ideally a semver.'
},
uid: {
type: new GraphQLNonNull(GraphQLString),
description: 'UID of the plugin.'
},
name: {
type: new GraphQLNonNull(GraphQLString),
description: 'Name of the plugin class.'
},
icon: {
type: new GraphQLObjectType({
name: 'PluginIcon',
fields: {
path: {
type: new GraphQLNonNull(GraphQLString),
description: 'The path, from the plugin\'s entry point to the icon file.'
},
buffer: {
type: new GraphQLNonNull(GraphQLString),
resolve: plug => plug.buffer.toString('base64'),
description: 'The buffer for the plugin\'s icon.'
}
}
})
},
dateInstalled: {
type: new GraphQLNonNull(DateTime),
export function getGraphQLSchema(manager: ModelApiManager): GraphQLSchema {
const schema: GraphQLSchemaConfig = {} as any;
const queryConfig = getQueryConfig(manager);
const mutationConfig = getMutationConfig(manager);
schema.query = new GraphQLObjectType(queryConfig);
if (mutationConfig) {
schema.mutation = new GraphQLObjectType(mutationConfig);
}
return new GraphQLSchema(schema);
}
text: { type: GraphQLString },
};
const pageFields = {
id: { type: GraphQLID },
width: { type: GraphQLFloat },
height: { type: GraphQLFloat },
pageNumber: { type: GraphQLInt },
};
const documentFields = {
id: { type: GraphQLID },
name: { type: GraphQLString },
};
const ShapeType = new GraphQLObjectType({
name: "Shape",
fields: {
id: { type: GraphQLID },
...shapeFields,
},
});
const ShapeInputType = new GraphQLInputObjectType({
name: "ShapeInput",
fields: {
...shapeFields,
},
});
const PageType = new GraphQLObjectType({
name: "Page",
GraphQLUnionType,
GraphQLBoolean,
GraphQLString,
GraphQLObjectType,
} = require('graphql');
const IdScalar = require('../scalars/id.scalar.js');
const UriScalar = require('../scalars/uri.scalar.js');
const CodeScalar = require('../scalars/code.scalar.js');
const DateTimeScalar = require('../scalars/datetime.scalar.js');
const DateScalar = require('../scalars/date.scalar.js');
/**
* @name exports
* @summary Immunization Schema
*/
module.exports = new GraphQLObjectType({
name: 'Immunization',
description: 'Base StructureDefinition for Immunization Resource',
fields: () => ({
resourceType: {
type: new GraphQLNonNull(
new GraphQLEnumType({
name: 'Immunization_Enum_schema',
values: { Immunization: { value: 'Immunization' } },
}),
),
description: 'Type of resource',
},
_id: {
type: require('./element.schema.js'),
description:
'The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.',