
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.
aido-graphql
Advanced tools
A simple GraphQL client for your Aido applications.
The aido-graphql package can be installed with your package manager of choice :
npm install --save aido-graphql
# or
yarn add aido-graphql
To use it in your Aido application, you'll need to import it as a plugin :
const aidoGraphQL = require('aido-graphql')
aido.init({
plugins: [aidoGraphQL],
})
You can pass a configuration to aido-graphql when you initialize your Aido application :
aido.init({
// ...
graphQL: {
apiURL: 'https://your-api/graphql',
defaultHeaders: {
'X-special-auth': 'XXXXXXXXX',
},
errorManager: (res) => {
console.log(`GraphQL error : ${res.error}`)
},
},
// ...
})
const { Slash } = require('/aido')
const query = `
query fetchUser($userId: Int!) {
user(id: $userId) {
id
name
}
}
`
class MySlash extends Slash {
someAction() {
const user = this.graphQL.query(query, { userId: 1 })
this.state.userName = user.name
}
}
const startupTime = new Date()
const mutation = `
mutation logStartTime($date: Date!) {
logStartTime(date: $date)
}
`
aido.start().then(() => {
aido.helpers.graphQL.mutate(mutation, { date: startupTime })
})
const startupTime = new Date()
const mutation = `
mutation logPluginStartTime($date: Date!, $plugin: String!) {
logStartTime(date: $date, plugin: $plugin)
}
`
function pluginFactory(koa, utils) {
async function initPlugin() {
utils.helpers.graphQL.mutate(mutation, { date: startupTime, plugin: 'my-plugin' })
}
}
By default, the following HTTP header will be added to every request : 'Content-Type': 'application/json'. You can change it on application startup, or when initializing a plugin, using the helper baseHeaders :
aido.start().then(() => {
aido.helpers.graphQL.baseHeaders['X-extra-special-header'] = 'YYYYYYYYYY'
})
You can add default headers, which will be added to every request, by specifying them in the GraphQL configuration (see above).
Finally, you can add additional headers to a specific query or mutation. The headers will be merged in the following order : baseHeaders, defaultHeaders, additionalHeaders.
FAQs
A simple GraphQL client for your Aido applications
The npm package aido-graphql receives a total of 3 weekly downloads. As such, aido-graphql popularity was classified as not popular.
We found that aido-graphql demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.