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

@graphql-tools/optimize

Package Overview
Dependencies
Maintainers
3
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-tools/optimize

A set of utils for faster development of GraphQL tools

  • 1.3.0-alpha-b76ec274.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.4M
increased by10.24%
Maintainers
3
Weekly downloads
 
Created

What is @graphql-tools/optimize?

The @graphql-tools/optimize package is designed to optimize GraphQL schemas and queries. It provides functionalities to simplify and enhance the performance of GraphQL operations by removing unnecessary fields, types, and directives, and by optimizing query execution.

What are @graphql-tools/optimize's main functionalities?

Optimize GraphQL Schema

This feature allows you to optimize GraphQL documents based on a given schema. It removes unused fragments and fields that are not required for the queries to execute, which can lead to performance improvements in query execution.

import { optimizeDocuments } from '@graphql-tools/optimize';
import { parse, print } from 'graphql';

const schema = parse(`type Query { hello: String }`);
const documents = [parse(`query { hello }`)];

const optimizedDocuments = optimizeDocuments(schema, documents);
console.log(print(optimizedDocuments[0]));

Remove Unused Types

This feature optimizes the GraphQL schema by removing types that are not used in any of the operations. This can help in reducing the size of the schema and improving the load times and performance of GraphQL servers.

import { optimizeSchema } from '@graphql-tools/optimize';
import { makeExecutableSchema } from '@graphql-tools/schema';

const schema = makeExecutableSchema({ typeDefs: `type Query { hello: String } type Unused { id: ID }` });
const optimizedSchema = optimizeSchema(schema);
console.log(optimizedSchema.getTypeMap());

Other packages similar to @graphql-tools/optimize

FAQs

Package last updated on 24 Jun 2022

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