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

@graphql-tools/import

Package Overview
Dependencies
Maintainers
4
Versions
866
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-tools/import

A set of utils for faster development of GraphQL tools

  • 7.0.4-alpha-20241204093637-eaca1fc412fd0b1da42b0122711d0d60944afa39
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created

What is @graphql-tools/import?

@graphql-tools/import is a utility package that allows you to import and merge GraphQL type definitions from multiple files. This is particularly useful for organizing your GraphQL schema into smaller, more manageable pieces.

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

Importing Type Definitions

This feature allows you to import and merge GraphQL type definitions from multiple files. The `loadFilesSync` function loads all the type definition files from the specified directory, and `mergeTypeDefs` merges them into a single schema.

const { loadFilesSync } = require('@graphql-tools/load-files');
const { mergeTypeDefs } = require('@graphql-tools/merge');

const typesArray = loadFilesSync(path.join(__dirname, './schemas'));
const typeDefs = mergeTypeDefs(typesArray);

console.log(typeDefs);

Using SDL Imports

This feature allows you to use SDL (Schema Definition Language) imports within your GraphQL schema files. The `importSchema` function reads a schema file and resolves any `#import` statements, merging the imported types into a single schema.

const { importSchema } = require('@graphql-tools/import');

const typeDefs = importSchema('./path/to/schema.graphql');

console.log(typeDefs);

Other packages similar to @graphql-tools/import

FAQs

Package last updated on 04 Dec 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