apollo-directives-package
TypeScript icon, indicating that this package has built-in type declarations

1.2.11 • Public • Published

Apollo-directives-package

npm package

This is directives package for Apollo

Usage example

in .js

var { RenameDirective } = require('apollo-directives-package') // in VanillaJS(javascript)
// or
import { RenameDirective } from 'apollo-directives-package' // in ES
 
const schema = makeExecutableSchema({
  schemaDirectives: {
    ...
    rename: RenameDirective,
  }
})

in .ts

// in Typescript
import { RenameDirective } from 'apollo-directives-package'
 
const schema = makeExecutableSchema({
  schemaDirectives: {
    ...
    renameRenameDirective, // if graphql-tools >= 3.x.x
    rename: RenameDirective as any, // if graphql-tools < 3.x.x
  }
})
type Query {
  getBook: Book
  anotherGetBook: Book @rename(type: "Query", to: "allBook")
}
 
type Mutation {
  createBook(title: "Apollo Directives Package"): Book
  newBook(title: "Apollo Directives Package"): Book @rename(type: "Mutation", to: "createBook")
}

Directives list

  1. RenameDirective: To rename(redirect) other Query, Mutation, Field resolve

Please pull-request to update your awesome directive!🤩 and give me your username in github, npm to register collaborators.

To Do

Bugs

  • Directive type is no match in Typescript -> Resolved.(Refer to version of graphql-tools)
makeExecutableSchema({
    schemaDirectives: {...} // <- type no match error in Typescript
})

License

Code copyright 2018 Yoonho Go. Code released under the MIT license.

Readme

Keywords

Package Sidebar

Install

npm i apollo-directives-package

Weekly Downloads

2

Version

1.2.11

License

MIT

Unpacked Size

11.4 kB

Total Files

18

Last publish

Collaborators

  • yoonho_go