Batch
This example shows how to write batches of GraphQL root fields (aka. entrypoints) in the TypeScript interface.
ts
import { Graffle } from './graffle/__.js'
const pokemon = Graffle.create()
const pokemons = await pokemon.query.$batch({
pokemonByName: {
$: { name: `Pikachu` },
name: true,
id: true,
},
trainerByName: {
$: { name: `Ash` },
name: true,
id: true,
},
})
console.log(pokemons)
Outputs
json
{
"pokemonByName": [
{
"name": "Pikachu",
"id": "1"
}
],
"trainerByName": {
"name": "Ash",
"id": "1"
}
}