@octokit/graphql.js is a lightweight, purpose-built JavaScript library for making GraphQL queries to the GitHub API. It wraps the `@octokit/request` HTTP client to handle authentication, variables, error parsing, and GitHub Enterprise Server base URL normalization. The primary entry point is the `graphql` function, which accepts a query string and optional parameters (variables, headers, operation name) and returns a promise of the response data. It also exposes a `withCustomRequest` factory for injecting a custom request instance, a `GraphqlResponseError` class for structured error handling, and a `withDefaults` method for creating pre-configured instances. The library is fully typed with TypeScript, supports ESM and bundling, and follows the Octokit ecosystem conventions. It does not handle pagination or subscription – it is purely a thin GraphQL client for the GitHub API.
This is an npm library that provides the GitHub GraphQL schema in JSON and IDL formats, along with a validation function and TypeScript type definitions. It is used by other Octokit libraries to validate GraphQL queries against the official GitHub GraphQL API. The schema is automatically updated hourly via a GitHub Action that fetches the latest schema from GitHub and creates pull requests for changes. The library is simple but robust, relying on the `graphql` package for validation and `graphql-codegen` for TypeScript types. It is not a data research project; it is a straightforward software library.