cc.voox.graphql.GraphQLInterceptor Maven / Gradle / Ivy
package cc.voox.graphql;
import graphql.ExecutionResult;
import graphql.execution.ExecutionContext;
import graphql.execution.instrumentation.DeferredFieldInstrumentationContext;
import graphql.execution.instrumentation.ExecutionStrategyInstrumentationContext;
import graphql.execution.instrumentation.Instrumentation;
import graphql.execution.instrumentation.InstrumentationContext;
import graphql.execution.instrumentation.InstrumentationState;
import graphql.execution.instrumentation.SimpleInstrumentation;
import graphql.execution.instrumentation.SimpleInstrumentationContext;
import graphql.execution.instrumentation.parameters.InstrumentationDeferredFieldParameters;
import graphql.execution.instrumentation.parameters.InstrumentationExecuteOperationParameters;
import graphql.execution.instrumentation.parameters.InstrumentationExecutionParameters;
import graphql.execution.instrumentation.parameters.InstrumentationExecutionStrategyParameters;
import graphql.execution.instrumentation.parameters.InstrumentationFieldCompleteParameters;
import graphql.execution.instrumentation.parameters.InstrumentationFieldFetchParameters;
import graphql.execution.instrumentation.parameters.InstrumentationFieldParameters;
import graphql.execution.instrumentation.parameters.InstrumentationValidationParameters;
import graphql.language.Document;
import graphql.schema.DataFetcher;
import graphql.schema.GraphQLSchema;
import graphql.validation.ValidationError;
import java.util.List;
import java.util.concurrent.CompletableFuture;
public interface GraphQLInterceptor extends Instrumentation {
public static final SimpleInstrumentation INSTANCE = new SimpleInstrumentation();
default int getOrder() {
return 0;
}
public default InstrumentationContext beginExecution(InstrumentationExecutionParameters parameters) {
return new SimpleInstrumentationContext();
}
public default InstrumentationContext beginParse(InstrumentationExecutionParameters parameters) {
return new SimpleInstrumentationContext();
}
public default InstrumentationContext> beginValidation(InstrumentationValidationParameters parameters) {
return new SimpleInstrumentationContext();
}
public default ExecutionStrategyInstrumentationContext beginExecutionStrategy(InstrumentationExecutionStrategyParameters parameters) {
return new ExecutionStrategyInstrumentationContext() {
public void onDispatched(CompletableFuture result) {
}
public void onCompleted(ExecutionResult result, Throwable t) {
}
};
}
public default DeferredFieldInstrumentationContext beginDeferredField(InstrumentationDeferredFieldParameters parameters) {
return new DeferredFieldInstrumentationContext() {
public void onDispatched(CompletableFuture result) {
}
public void onCompleted(ExecutionResult result, Throwable t) {
}
};
}
public default InstrumentationContext beginExecuteOperation(InstrumentationExecuteOperationParameters parameters) {
return new SimpleInstrumentationContext();
}
public default InstrumentationContext beginField(InstrumentationFieldParameters parameters) {
return new SimpleInstrumentationContext();
}
public default InstrumentationContext