1.7.4 • Published 4 years ago

@thiscover/enhance v1.7.4

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

thiscover enhance

This library will enhance your schema from a simple delcaration to feature rich document

const schema = `
    type Task {
      id: ID
      name: String
    }
  `;

const newScheam = enhance({ schema, includeDirectives: false });

console.log(printSchema(newScheam));
type Query {
  allTasks(
    limit: Int
    skip: Int
    orderBy: Task_OrderBy
    where: TaskFilter
  ): [Task]

  aTask(where: TaskFilter): Task
}

type Task {
  id: ID
  name: String
}

enum Task_OrderBy {
  id_DESC
  id_ASC
  name_DESC
  name_ASC
}

input TaskFilter {
  id_is: ID
  id_is_not: ID
  id_like: ID
  id_in: [ID!]
  id_not_in: [ID!]
  name_is: String
  name_is_not: String
  name_like: String
  name_in: [String!]
  name_not_in: [String!]
  and: [TaskFilter!]
  or: [TaskFilter!]
}

Now you can query your server like

  query {
    allTasks (skip: 5, limit: 10, where: { name_like: "Find James Bond"} ) {
      id
      name
    }
  }

or

query {
  aTask (where: {id_is: 1}) {
    name
  }
}

or

  query {
    allTasks (skip: 5, limit: 10, where: {
      or: [{ name_like: "Find James Bond"}, { name_like: "Find 007" }]
      }) {
      id
      name
    }
  }

See it in action here using the IMDB dataset that has a basic schema and has been enhanced

1.7.4

4 years ago

1.7.3

4 years ago

1.7.2

4 years ago

1.7.1

4 years ago

1.7.0

4 years ago

1.6.3

4 years ago

1.6.2

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.5.0

4 years ago