@theconcurrent/graphiql-query-generator
TypeScript icon, indicating that this package has built-in type declarations

0.0.33 • Public • Published

@theconcurrent/graphiql-query-generator

Table of Contents

Introduction

Getting Started

yarn add @theconcurrent/graphiql-query-generator
const config = {
  adminPath: 'admin',
  nodeRepresentatives: ['id'],
  resources: [
    {
      name: 'Announcement',
      list: {},
      show: {},
      create: { path: 'announcementCreate.announcement' },
      update: { path: 'announcementUpdate.announcement' },
      delete: { path: 'announcementDelete.announcement' },
    },
  ],
  collection: {
    dataPath: 'nodes',
    totalPath: 'totalCount',
    typeNameSuffix: 'Collection',
  },
};
# schema.graphql
type Query {
  admin: Admin
}

type Admin {
  user(id: ID): User
  userList: UserCollection!
}

type User {
  id: ID
  name: String
}

type UserCollection {
  nodes: [User!]
  totalCount: Int
}

input UserCreateInput {
  userInput: UserInput!
  clientMutationId: String
}

input UserInput {
  name: String
}

type UserCreatePayload {
  user: User!
  clientMutationId: String
}

type UserDeletePayload {
  user: User!
  clientMutationId: String
}

input UserDeleteInput {
  clientMutationId: String
  id: ID!
}

type UserUpdatePayload {
  user: User!
  clientMutationId: String
}

input UserUpdateInput {
  userInput: UserInput!
  clientMutationId: String
  id: ID!
}

type Mutation {
  userCreate(input: UserCreateInput!): UserCreatePayload
  userDelete(input: UserDeleteInput!): UserDeletePayload
  userUpdate(input: UserUpdateInput!): UserUpdatePayload
}

Package Sidebar

Install

npm i @theconcurrent/graphiql-query-generator

Weekly Downloads

3

Version

0.0.33

License

MIT

Unpacked Size

57.5 kB

Total Files

19

Last publish

Collaborators

  • atsuhiro