Skip to content

Commit 48a6a6c

Browse files
committed
Make QueryComplexityOptions.estimators mandatory, remove default
1 parent a1e3b7b commit 48a6a6c

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

src/QueryComplexity.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ import {
2929
getNamedType,
3030
GraphQLError
3131
} from 'graphql';
32-
import {
33-
simpleEstimator
34-
} from './estimators';
3532

3633
declare module 'graphql/type/definition' {
3734
export interface GraphQLField<TSource, TContext, TArgs = { [argName: string]: any }> {
@@ -71,7 +68,7 @@ export interface QueryComplexityOptions {
7168
createError?: (max: number, actual: number) => GraphQLError,
7269

7370
// An array of complexity estimators to use for estimating the complexity
74-
estimators?: Array<ComplexityEstimator>;
71+
estimators: Array<ComplexityEstimator>;
7572
}
7673

7774
function queryComplexityMessage(max: number, actual: number): string {
@@ -126,16 +123,7 @@ export default class QueryComplexity {
126123

127124
this.includeDirectiveDef = this.context.getSchema().getDirective('include');
128125
this.skipDirectiveDef = this.context.getSchema().getDirective('skip');
129-
130-
if (!options.estimators) {
131-
console.warn(
132-
'DEPRECATION WARNING: Estimators should be configured in the queryComplexity options.'
133-
);
134-
}
135-
136-
this.estimators = options.estimators || [
137-
simpleEstimator()
138-
];
126+
this.estimators = options.estimators
139127

140128
this.OperationDefinition = {
141129
enter: this.onOperationDefinitionEnter,

0 commit comments

Comments
 (0)