import { QueryReducer } from '../execution/QueryReducer' ; export default class ComplexityReducer implements QueryReducer < number , Object > { public initial : number ; constructor ( ) { this . initial = 0 ; } public reduceField ( parent , child ) { const estimate = 1 + child ; return parent + estimate ; } public reduceScalar ( ) { return 0 ; } public reduceEnum ( ) { return 0 ; } public reduceCtx ( acc , ctx ) { return { ... ctx , complexity : acc , } ; } }