@pact-foundation/pact
Version:
Pact for all things Javascript
31 lines (30 loc) • 1.42 kB
TypeScript
import type { ASTNode } from 'graphql';
import type { GraphQLVariables } from '../../common/graphQL/graphQL';
import type { JsonMap } from '../../common/jsonTypes';
import type { Path, TemplateHeaders, TemplateQuery } from '../../v3';
import type { V4InteractionWithRequest } from '../http/types';
export declare enum OperationType {
Mutation = "Mutation",
Query = "Query"
}
export interface V4UnconfiguredGraphQLInteraction {
given(state: string, parameters?: JsonMap): V4UnconfiguredGraphQLInteraction;
uponReceiving(description: string): V4UnconfiguredGraphQLInteraction;
withOperation(operation: string): V4UnconfiguredGraphQLInteraction;
withVariables(variables: GraphQLVariables): V4UnconfiguredGraphQLInteraction;
withRequest(method: string, path: Path, builder?: V4GraphQLRequestBuilderFunc): V4GraphQLInteractionWithRequest;
}
export interface V4GraphQLInteractionWithRequest {
withQuery(query: string | ASTNode): V4InteractionWithRequest;
withMutation(mutation: string | ASTNode): V4InteractionWithRequest;
}
export type V4GraphQLRequestBuilderFunc = (builder: V4GraphQLRequestBuilder) => void;
export interface V4GraphQLRequestBuilder {
query(query: TemplateQuery): V4GraphQLRequestBuilder;
headers(headers: TemplateHeaders): V4GraphQLRequestBuilder;
}
export type GraphqlRequest = {
operation?: string;
mutation?: string;
variables?: GraphQLVariables;
};