How to use the nexus.inputObjectType function in nexus

To help you get started, we’ve selected a few nexus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github prisma-labs / nexus-prisma / src / publisher.ts View on Github external
publishInputObjectType(inputType: DMMF.Data.InputType) {
    this.markTypeAsPublished(inputType.name)

    return Nexus.inputObjectType({
      name: inputType.name,
      definition: t => {
        inputType.fields
          .map(field => ({
            ...field,
            inputType: {
              ...field.inputType,
              type: this.isPublished(field.inputType.type)
                ? // Simply reference the field input type if it's already been visited, otherwise create it
                  field.inputType.type
                : this.inputType({
                    arg: field,
                    type: this.getTypeFromArg(field),
                  }),
            },
          }))
github este / este / packages / api / schema / user.ts View on Github external
});

// https://medium.com/workflowgen/graphql-schema-design-the-viewer-field-aeabfacffe72
export const viewer = queryField('viewer', {
  type: User,
  nullable: true,
  resolve: (_root, _args, context) => context.models.user.viewer(),
});

// requiredViewer throws, so the app can redirect.
export const requiredViewer = queryField('requiredViewer', {
  type: User,
  resolve: (_root, _args, context) => context.models.user.requiredViewer(),
});

export const SignInInput = inputObjectType({
  name: 'SignInInput',
  definition(t) {
    t.string('email');
    t.string('password');
    t.boolean('createAccount');
  },
});

export const SignInErrors = objectType({
  nonNullDefaults: { output: false },
  name: 'SignInErrors',
  definition(t) {
    t.field('email', { type: 'EmailError' });
    t.field('password', { type: 'PasswordError' });
  },
});
github este / este / packages / api / schema / web.ts View on Github external
export const UpdateWebPayload = objectType({
  nonNullDefaults: { output: false },
  name: 'UpdateWebPayload',
  definition(t) {
    t.field('errors', { type: UpdateWebErrors });
    t.field('web', { type: Web });
  },
});

export const updateWeb = mutationField('updateWeb', {
  type: UpdateWebPayload,
  args: { input: arg({ type: UpdateWebInput }) },
  resolve: (_root, { input }, context) => context.models.web.updateWeb(input),
});

export const DeleteWebInput = inputObjectType({
  name: 'DeleteWebInput',
  definition(t) {
    t.id('id');
  },
});

export const DeleteWebPayload = objectType({
  nonNullDefaults: { output: false },
  name: 'DeleteWebPayload',
  definition(t) {
    t.field('web', { type: Web });
  },
});

export const deleteWeb = mutationField('deleteWeb', {
  type: DeleteWebPayload,
github este / este / packages / api / schema / web.ts View on Github external
export const CreateWebPayload = objectType({
  nonNullDefaults: { output: false },
  name: 'CreateWebPayload',
  definition(t) {
    t.field('errors', { type: CreateWebErrors });
    t.field('web', { type: Web });
  },
});

export const createWeb = mutationField('createWeb', {
  type: CreateWebPayload,
  args: { input: arg({ type: CreateWebInput }) },
  resolve: (_root, { input }, context) => context.models.web.createWeb(input),
});

export const UpdateWebInput = inputObjectType({
  name: 'UpdateWebInput',
  definition(t) {
    t.id('id');
    t.string('name');
  },
});

export const UpdateWebErrors = objectType({
  nonNullDefaults: { output: false },
  name: 'UpdateWebErrors',
  definition(t) {
    t.field('name', { type: 'Max140CharsError' });
  },
});

export const UpdateWebPayload = objectType({
github Novvum / MarvelQL / packages / graphql / schema / types / Creator.ts View on Github external
description: 'A list of events (Event Types) related to this creator',
            async resolve(parent, args, ctx) {
                const res = await ctx.api.get(`/creators/${parent.id}/events`);
                return res.results;
            }
        });
    }
});

export const CreatorOrderBy = enumType({
    name: "CreatorOrderBy",
    description: 'Order the result set by a field or fields. Multiple values are given priority in the order in which they are passed.',
    members: ['lastName_asc', 'firstName_asc', 'middleName_asc', 'suffix_asc', 'modified_asc', 'lastName_desc', 'firstName_desc', 'middleName_desc', 'suffix_desc', 'modified_desc'],
});

export const CreatorWhereInput = inputObjectType({
    name: "CreatorWhereInput",
    description: 'Optional filters for creators. See notes on individual inputs below.',
    definition(t) {
        t.string("firstName", { description: 'Filter by creator first name (e.g. Brian).' });
        t.string("middleName", { description: 'Filter by creator middle name (e.g. Michael).' });
        t.string("lastName", { description: 'Filter by creator last name (e.g. Bendis).' });
        t.string("suffix", { description: 'Filter by suffix or honorific (e.g. Jr., Sr.).' });
        t.string("nameStartsWith", { description: 'Filter by creator names that match critera (e.g. B, St L).' });
        t.string("firstNameStartsWith", { description: 'Filter by creator first names that match critera (e.g. B, St L).' });
        t.string("middleNameStartsWith", { description: 'Filter by creator middle names that match critera (e.g. Mi).' });
        t.string("lastNameStartsWith", { description: 'Filter by creator last names that match critera (e.g. Ben).' });
        t.field("modifiedSince", {
            type: "DateTime",
            description: 'Return only creators which have been modified since the specified date.',
        });
        t.list.id("comics", { description: 'Return only creators who worked on in the specified comics (accepts a comma-separated list of ids).' });
github arkhn / pyrog / server-v2 / src / types / inputTypes.ts View on Github external
t.string('description')
    t.string('mergingScript')
  },
})

export const UpdateResourceInput = inputObjectType({
  name: 'UpdateResourceInput',
  definition(t) {
    t.field('label', { type: 'String'})
    t.field('primaryKeyOwner', { type: 'String'})
    t.field('primaryKeyTable', { type: 'String'})
    t.field('primaryKeyColumn', { type: 'String'})
  },
})

export const ColumnInput = inputObjectType({
  name: 'ColumnInput',
  definition(t) {
    t.field('owner', { type: 'String', required: true })
    t.field('table', { type: 'String', required: true })
    t.field('column', { type: 'String', required: true })
    t.list.field('joins', {
      type: 'JoinInput',
    })
  },
})

export const ColumnInputWithoutJoins = inputObjectType({
  name: 'ColumnInputWithoutJoins',
  definition(t) {
    t.field('owner', { type: 'String' })
    t.field('table', { type: 'String' })
github Novvum / MarvelQL / packages / graphql / schema / types / Event.ts View on Github external
return res.results;
            }
        });
        t.field("next", {
            type: "Summary",
            nullable: true,
            description: 'The next event (Summary Type) in relation to this event',
        });
        t.field("previous", {
            type: "Summary",
            nullable: true,
            description: 'The previous event (Summary Type) in relation to this event',
        });
    }
});
export const EventsWhereInput = inputObjectType({
    name: "EventsWhereInput",
    description: 'Optional filters for events. See notes on individual inputs below.',
    definition(t) {
        t.string("name", { description: 'Return only events which match the specified name.' });
        t.string("nameStartsWith", { description: 'Return events with names that begin with the specified string (e.g. Sp).' });
        t.field("modifiedSince", {
            type: "DateTime",
            description: 'Return only events which have been modified since the specified date.',
        });
        t.list.id("creators", { description: 'Return only events which feature work by the specified creators (accepts a comma-separated list of ids).' });
        t.list.id("characters", { description: 'Return only events which feature the specified characters (accepts a comma-separated list of ids).' });
        t.list.id("series", { description: 'Return only events which are part of the specified series (accepts a comma-separated list of ids).' });
        t.list.id("comics", { description: 'Return only events which take place in the specified comics (accepts a comma-separated list of ids).' });
    }
});
export const EventsOrderBy = enumType({