# graphql-result-proxy

> Proxy implementation for GraphQL results to throw errors where the keys are used

Latest version **0.1.2** (published 2020-01-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install graphql-result-proxy
pnpm add graphql-result-proxy
yarn add graphql-result-proxy
bun add graphql-result-proxy
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2020-01-23 |
| First published | 2020-01-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 114.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Oliver Wright |
| Maintainers | meiamsome |

## Links

- npm: https://www.npmjs.com/package/graphql-result-proxy
- Repository: https://github.com/meiamsome/graphql-result-proxy
- Homepage: https://github.com/meiamsome/graphql-result-proxy#readme
- Issues: https://github.com/meiamsome/graphql-result-proxy/issues
- npm.io page: https://npm.io/package/graphql-result-proxy

## Recent versions

- 0.1.2 (latest) — 2020-01-23
- 0.1.1 — 2020-01-21
- 0.1.0 — 2020-01-21

## README

# GraphQL Result Proxy

This module provides a Proxy implementation that takes the result of a graphql
execution and produces a version that will throw errors when the key that are
located at is accessed.

For example:

```js
const { execute } = require('graphql')
const { createResultProxy } = require('graphql-result-proxy')

const exampleFn = async () => {
  const result = await execute(/* args here */)
  // Let's assume this request is of the form
  // query {
  //   getItem {
  //     keyA
  //     keyB
  //   }
  // }
  // And that there is an error localized to getItem.keyB

  const data = createResultProxy(result)

  // This returns the value of keyA
  console.log(data.getItem.keyA)

  // This would throw the error at keyB
  console.log(data.getItem.keyB)

  // This would throw an error that keyC was not in the original graphql request
  console.log(data.getItem.keyC)
}
```

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