# graphql-directive-private

> 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.

Latest version **4.0.3** (published 2023-07-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install graphql-directive-private
pnpm add graphql-directive-private
yarn add graphql-directive-private
bun add graphql-directive-private
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.3 |
| Published | 2023-07-05 |
| First published | 2018-11-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=12.0.0 |
| Dependencies | 2 |
| Unpacked size | 263.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Taylor Goolsby |
| Maintainers | taylorgoolsby |
| Keywords | graphql, sdl, graphql-schema-language, graphql-schema, schema, cut, private, api, expose, hide, remove |

## Links

- npm: https://www.npmjs.com/package/graphql-directive-private
- Repository: https://github.com/taylrun/graphql-directive-private
- Homepage: https://github.com/taylrun/graphql-directive-private#readme
- Issues: https://github.com/taylrun/graphql-directive-private/issues
- npm.io page: https://npm.io/package/graphql-directive-private

## Dependencies (2)

- [@graphql-tools/utils](https://npm.io/package/@graphql-tools/utils.md) ^10.0.3
- [@graphql-tools/schema](https://npm.io/package/@graphql-tools/schema.md) ^10.0.0

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 4.0.3 (latest) — 2023-07-05
- 4.0.2 — 2023-07-05
- 4.0.1 — 2023-07-04
- 4.0.0 — 2023-07-04
- 3.0.2 — 2023-03-24
- 3.0.0 — 2023-03-23
- 2.0.3 — 2021-07-27
- 2.0.2 — 2021-07-27
- 2.0.1 — 2021-07-27
- 2.0.0 — 2021-07-27
- 1.0.0 — 2018-11-21

## 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

```js
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 } } }
```

---
_Source: https://npm.io/package/graphql-directive-private · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
