Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

augment-gql-operations

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

augment-gql-operations

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

  • 0.0.5
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

augment-gql-operation

This is a small plugin for graphql-codegen. 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:

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):

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

  requestDetails {
    debugLink
  }
}

FAQs

Package last updated on 04 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc