Socket
Socket
Sign inDemoInstall

graphql-fields

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.1 to 1.3.0

5

build/index.js

@@ -47,2 +47,6 @@ 'use strict';

if (options.excludedFields.indexOf(name) !== -1) {
return flattened;
}
if (flattened[name] && flattened[name] !== '__arguments') {

@@ -75,2 +79,3 @@ _extends(flattened[name], flattenAST(a, info, flattened[name]));

options.processArguments = opts.processArguments;
options.excludedFields = opts.excludedFields || [];
return fields.reduce(function (o, ast) {

@@ -77,0 +82,0 @@ return flattenAST(ast, info, o);

# Changelog
## 1.3.0 (2018-11-15)
### Added
- excludedFields option
## 1.2.1 (2018-10-12)
### Added
- Updated dev dependencies
## 1.2.0 (2018-10-10)

@@ -4,0 +18,0 @@

2

package.json
{
"name": "graphql-fields",
"version": "1.2.1",
"version": "1.3.0",
"description": "Turns GraphQLResolveInfo into a map of the requested fields",

@@ -5,0 +5,0 @@ "main": "build/index.js",

@@ -120,2 +120,8 @@ # graphql-fields

### Exclude specific fields
Most of the time we don't need `__typename` to be sent to backend/rest api, we can exclude `__typename` using this:
```javascript
const graphqlFields = require('graphql-fields');
const fieldsWithoutTypeName = graphqlFields(info, {}, { excludedFields: ['__typename'] });
```
## Why

@@ -122,0 +128,0 @@ An underlying REST api may only return fields based on query params.

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc