graphql-list-fields-verso

1.1.1 • Public • Published

graphql-list-fields

Build Status npm version Coverage Status

When implementing a GraphQL server, it can be useful to know the list of fields being queried on a given type. This module takes a GraphQLResolveInfo object and returns a list of fields.

Supported features

  • Basic Fields
  • Fragments
  • Inline Fragments
  • @skip and @include directives
  • Nested fields into dot.notation
npm install --save graphql-list-fields

Usage

import getFieldNames from 'graphql-list-fields';
 
// in some resolve function
resolve(parent, args, context, info) {
    const fields = getFieldNames(info);
    return fetch('/someservice/?fields=' + fields.join(','));
}

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.1
    30
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.1
    30
  • 1.1.0
    1

Package Sidebar

Install

npm i graphql-list-fields-verso

Weekly Downloads

31

Version

1.1.1

License

MIT

Last publish

Collaborators

  • npvn