
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
An end-to-end type-safe JavaScript client for the GitHub v4 GraphQL API.
npm install github-gql
import { GithubGql } from 'github-gql'
const example = async (): Promise<void> => {
// Create the client with a personal or installation access token
const client = new GithubGql({
accessToken: process.env.GITHUB_ACCESS_TOKEN!
})
// Call the query endpoint
const result = await client.query({
// Specify your graphql query with complete type safety
repository: {
__args: {
name: 'github-gql',
owner: 'rpate97'
},
id: true,
nameWithOwner: true,
issues: {
__args: {
first: 10
},
nodes: {
title: true,
body: true,
},
}
}
})
// The result will be correctly typed based on your input query
console.log(result)
}
example()
I found the official client recommendation from GitHub to be difficult to deal with. It is not type safe and requires inline gql queries.
Typically when building my own GraphQL APIs for internal consumption, I'll achieve end-to-end type safety by using a code generation tool such as GraphQL Codegen combined with a compatible GraphQL client such as Apollo Client. Setting this sort of thing up just to interact with an external API from my GitHub bot seems like overkill to me. I believe this should be maintained in a separate package and available to others.
So I decided to create this library and release it for the benefit of anyone else working with the GitHub v4 GraphQL API. Enjoy.
This client is largely automatically generated with the help of GenQL, give them a star to show your appreciation. While you're at it, make sure you star this repo too.
All code is provided under the MIT license.
FAQs
A fully typed GraphQL client for the Github v4 API
We found that github-gql demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.