File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -4,14 +4,9 @@ import { GraphQLDirective } from 'graphql/type/directives';
44import { DirectiveLocation } from 'graphql/language/directiveLocation' ;
55import get from 'lodash.get' ;
66
7- export default function ( options ?: { } ) : ComplexityEstimator {
8- const mergedOptions = {
9- name : 'complexity' ,
10- ...( options || { } )
11- } ;
12-
13- const directive = new GraphQLDirective ( {
14- name : mergedOptions . name ,
7+ export function complexityDirective ( name : string = 'complexity' ) {
8+ return new GraphQLDirective ( {
9+ name,
1510 description : 'Define a relation between the field and other nodes' ,
1611 locations : [
1712 DirectiveLocation . FIELD ,
@@ -26,6 +21,10 @@ export default function (options?: {}): ComplexityEstimator {
2621 }
2722 } ,
2823 } ) ;
24+ }
25+
26+ export default function ( options : { name ?: string } = { } ) : ComplexityEstimator {
27+ const directive = complexityDirective ( options . name ) ;
2928
3029 return ( args : ComplexityEstimatorArgs ) => {
3130 // Ignore if astNode is undefined
Original file line number Diff line number Diff line change 11export { default as simpleEstimator } from './simple' ;
2- export { default as directiveEstimator } from './directive' ;
2+ export { default as directiveEstimator , complexityDirective } from './directive' ;
33export { default as fieldExtensionsEstimator } from './fieldExtensions' ;
You can’t perform that action at this time.
0 commit comments