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

@graphql-tools/utils

Package Overview
Dependencies
Maintainers
3
Versions
1284
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-tools/utils

Common package containing utils and types for GraphQL tools

  • 10.3.3-alpha-20240805200235-c7ec3748aa84fdf34ade7fa8c5f9a10a439cc688
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19M
increased by13.54%
Maintainers
3
Weekly downloads
 
Created

What is @graphql-tools/utils?

The @graphql-tools/utils package provides a variety of utility functions to manipulate and work with GraphQL schemas. It is part of the larger GraphQL Tools ecosystem, which is designed to provide a more efficient and flexible way to work with GraphQL, especially in regards to schema handling and transformation.

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

Schema Merging

This feature allows you to merge multiple GraphQL schemas into one. This is particularly useful in a microservices architecture where different parts of your application might have their own schemas.

const { mergeSchemas } = require('@graphql-tools/utils');
const schema1 = /* GraphQLSchema object */;
const schema2 = /* GraphQLSchema object */;
const mergedSchema = mergeSchemas({ schemas: [schema1, schema2] });

Type Filtering

This utility helps in filtering out specific types from a GraphQL schema based on custom logic. It's useful for creating permission-based schema views.

const { filterSchema, removeTypes } = require('@graphql-tools/utils');
const schema = /* GraphQLSchema object */;
const filteredSchema = filterSchema({
  schema,
  typeFilter: (typeName, type) => typeName.startsWith('User')
});

Schema Printing

This function extends the basic functionality of GraphQL's printSchema to include custom directives in the output, which is essential for schemas that use them extensively.

const { printSchemaWithDirectives } = require('@graphql-tools/utils');
const schema = /* GraphQLSchema object */;
const schemaSDL = printSchemaWithDirectives(schema);

Other packages similar to @graphql-tools/utils

FAQs

Package last updated on 05 Aug 2024

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