变量

读取 GraphQL 操作变量。

你可以通过访问响应解析器参数的 variables 属性来读取拦截的 GraphQL 操作中传递的变量:

¥You can read the variables passed along the intercepted GraphQL operation by accessing the variables property of the response resolver’s argument:

graphql.query('ListUsers', ({ variables }) => {
  console.log(variables) // { limit: 10 }
})
query ListUsers($limit: Int!) {
  users(limit: $limit) {
    id
    name
  }
}