Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
@graphiql/toolkit
Advanced tools
@graphiql/toolkit is a set of utilities and tools designed to help developers build and extend GraphiQL, a popular in-browser IDE for exploring GraphQL. It provides various functionalities to facilitate the creation of custom GraphiQL components and plugins.
GraphiQL Plugin Development
This feature allows developers to create custom fetchers for GraphiQL, enabling them to connect to different GraphQL endpoints. The code sample demonstrates how to create a fetcher and use it within a GraphiQL component.
const { createGraphiQLFetcher } = require('@graphiql/toolkit');
const fetcher = createGraphiQLFetcher({
url: 'https://my-graphql-endpoint.com/graphql',
});
// Use the fetcher in a GraphiQL component
<GraphiQL fetcher={fetcher} />;
Schema Introspection
This feature provides utilities for schema introspection, allowing developers to fetch and explore the schema of a GraphQL endpoint. The code sample shows how to introspect a schema from a given endpoint.
const { introspectSchema } = require('@graphiql/toolkit');
async function getSchema() {
const schema = await introspectSchema('https://my-graphql-endpoint.com/graphql');
console.log(schema);
}
getSchema();
GraphQL Query Parsing
This feature includes tools for parsing GraphQL queries, which can be useful for analyzing and manipulating queries programmatically. The code sample demonstrates how to parse a GraphQL query string.
const { parse } = require('@graphiql/toolkit');
const query = `{
user(id: "1") {
name
email
}
}`;
const parsedQuery = parse(query);
console.log(parsedQuery);
The 'graphql' package is the core reference implementation of GraphQL for JavaScript. It provides the essential building blocks for creating GraphQL schemas and executing queries. While it doesn't offer the same level of integration with GraphiQL as @graphiql/toolkit, it is fundamental for any GraphQL-related development.
Apollo Server is a community-maintained open-source GraphQL server that works with any GraphQL schema. It provides a robust set of features for building a GraphQL API, including schema stitching, subscriptions, and more. Unlike @graphiql/toolkit, it focuses on server-side functionalities rather than client-side tools for GraphiQL.
The 'graphql-tools' package offers a set of utilities for building and manipulating GraphQL schemas. It includes features like schema stitching, schema transforms, and mock data generation. While it overlaps with some functionalities of @graphiql/toolkit, it is more focused on schema management and server-side utilities.
Changelog | API Docs | NPM | Discord
@graphiql/toolkit
This is a general purpose library for building GraphQL IDEs. It's being used by
other packages like graphiql
and @graphiql/react
and also provides utilities
that are useful when working with these packages.
createFetcher
: a utility for creating a
fetcher
prop implementation for HTTP GET, POST including multipart,
websockets fetcherFAQs
Utility to build a fetcher for GraphiQL
The npm package @graphiql/toolkit receives a total of 218,602 weekly downloads. As such, @graphiql/toolkit popularity was classified as popular.
We found that @graphiql/toolkit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
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.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.