The simple estimator just adds a fixed complexity to every field that is queried. This can be used as the last estimator in the chain to return the default value.
import queryComplexity, {simpleEstimator} from 'graphql-query-complexity';
const rule = queryComplexity({
estimators: [
simpleEstimator({
// Add a default complexity of 1 for each queried field
defaultComplexity: 1
})
]
// ... other config
});