{"repo":"slicknode/graphql-query-complexity","free":true,"listed":false,"github":"https://github.com/slicknode/graphql-query-complexity","clone":"git clone https://github.com/slicknode/graphql-query-complexity.git","description":"GraphQL query complexity analysis and validation for graphql-js","language":"TypeScript","stars":751,"topics":["complexity","graphql-js","graphql","analysis","validation","graphql-query-complexity","graphql-query-analysis","dos-attack"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"GraphQL Query Complexity Analysis for graphql-js This library provides GraphQL query analysis to reject complex queries to your GraphQL server. It can be used to protect your GraphQL servers against resource exhaustion and DoS attacks. This library was originally developed as part of the Slicknode GraphQL Framework + Headless CMS. Works with graphql-js reference implementation. Installation Install the package via npm Usage Create the rule with a maximum query complexity: Configuration / Complexity Estimators The complexity calculation of a GraphQL query can be customized with so called complexity estimators. A complexity estimator is a simple function that calculates the complexity for a field. You can add any number of complexity estimators to the rule, which are then executed one after another. The first estimator that returns a numeric complexity value determines the complexity for that field. At least one estimator has to return a complexity value, otherwise an exception is raised. You can for example use the simpleEstimator as the last estimator in your chain to define a default value. You can use any of the available estimators to calculate the complexity of a field or write your own: - simpleEstimator : The simple estimator returns a fixed complexity for each field. Can be used as last estimator in the chain for a default value. - directiveEstimator : Set the complexity via a directive in your schema definition (for example via GraphQL SDL) - fieldExtensionsEstimator ","default_branch":null,"files":null,"tree":[],"storefront":"/r/slicknode","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/slicknode/graphql-query-complexity/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}