We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is the best way to ask from costAnalysis API what is the cost, without any graphql server instance?
We're resorting currently to this, but would be nice to have easy API to get the cost..
const { validate, parse, ValidationContext, TypeInfo } = require('graphql'); const costAnalysis = require('graphql-cost-analysis').default; function getCurrentCost(query, schema, variables) { const queryAST = parse(query); const validationContext = new ValidationContext(schema, queryAST, new TypeInfo(schema)); const costAnalyser = costAnalysis({ variables, ...costLimits })(validationContext); validate(schema, queryAST, [() => costAnalyser]); return costAnalyser.cost; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What is the best way to ask from costAnalysis API what is the cost, without any graphql server instance?
We're resorting currently to this, but would be nice to have easy API to get the cost..
The text was updated successfully, but these errors were encountered: