import { OperationDefinitionNode , visit } from 'graphql' ; import { QueryMap } from './query-map' ; export class Query { private queryMap : QueryMap | undefined ; constructor ( private queryID , public ast , public variables ) { if ( ! variables ) { this . variables = { } ; } if ( ast . operation !== 'query' ) { throw new Error ( 'unsupported operation: ' + ast . operation ) ; } } public getQueryMap ( ) { return this . queryMap || null ; } public setQueryMap ( qm ) { if ( qm ) { this . queryMap = qm ; } } public getQueryID ( ) { return this . queryID ; } }