# augment-gql-operations

> This is a small plugin for graphql-codegen to augment all operations with arbitrary graphql.

Latest version **0.0.5** (published 2020-10-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install augment-gql-operations
pnpm add augment-gql-operations
yarn add augment-gql-operations
bun add augment-gql-operations
```

## 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.0.5 |
| Published | 2020-10-04 |
| First published | 2020-10-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | dannycochran |
| Maintainers | dannycochran |

## Links

- npm: https://www.npmjs.com/package/augment-gql-operations
- npm.io page: https://npm.io/package/augment-gql-operations

## Recent versions

- 0.0.5 (latest) — 2020-10-04
- 0.0.4 — 2020-10-04
- 0.0.3 — 2020-10-03
- 0.0.2 — 2020-10-03
- 0.0.1 — 2020-10-03

## README

### augment-gql-operation

This is a small plugin for [graphql-codegen](https://github.com/dotansimha/graphql-code-generator).
It allows you to add arbitrary GraphQL code to your operations (e.g. queries, mutations, subscriptions).

** Disclaimer: this is an experimental plugin for `graphql-codegen` and may not play nicely with all plugins. In theory it should be harmless but who knows!

### why?

There may be a call you always to make in every query and mutation but don't want to to remember to write it every time. For instance, your graph may expose "request details", e.g. meta information about the request (such as a debugging link).

This library allows you to add it to all your queries and mutations so that information is readily available.

### usage

Here's an example usage specifically with TypeScript output:

```yaml
generates:
  ./src/graphql/typesAndHooks.tsx:
    plugins:
      - 'augment-gql-operations':
        content: 'requestDetails { debugLink }'
      - 'typescript'
      - 'typescript-operations'
      - 'typescript-react-apollo'
      - 'fragment-matcher'
```

This will append the following graphql to all your queries, mutations, and subscriptions in `./src/graphql/typesAndHooks.tsx` (note it will not modify your original query files or documents):

```graphql
query GetItemQuery($id: String!) {
  getItem(id: $id) {
    name
    description
  }

  requestDetails {
    debugLink
  }
}
```

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