JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 38
  • Score
    100M100P100Q61757F
  • License MIT

Fields and Objects marked with @private will not be removed from the schema. They will not appear in introspection and they will not be queryable.

Package Exports

  • graphql-directive-private
  • graphql-directive-private/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (graphql-directive-private) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

graphql-directive-private

Fields and Objects marked with @private will be removed from the schema. They will not appear in introspection and they will not be queryable.

Example

import privateDirective from 'graphql-directive-private'

const { privateDirectiveTransform } = privateDirective('private')

const typeDefs = `
  directive @private on OBJECT | FIELD_DEFINITION

  type User @private {
    userId: Int
    post: Post
  }

  type Post {
    postId: Int @private
    user: User
  }

  type Query {
    user: User
    post: Post
  }
  `

let schema = makeExecutableSchema({
  typeDefs
})

schema = privateDirectiveTransform(schema)

const query = `
  query {
    user {
      userId
      post {
        postId
      }
    }
    post {
      postId
      user {
        userId
      }
    }
  }
`
const response = await execute(schema, query)
// response == { data: { post: { postId: null } } }