UNPKG

@pact-foundation/pact

Version:
36 lines (35 loc) 1.46 kB
import type { ConsumerInteraction, ConsumerPact } from '@pact-foundation/pact-core'; import type { ASTNode } from 'graphql'; import type { PactV4Options, V4InteractionWithRequest } from '../http/types'; import { type GraphqlRequest, type V4GraphQLInteractionWithRequest } from './types'; export declare class GraphQLInteractionWithRequest implements V4GraphQLInteractionWithRequest { protected pact: ConsumerPact; protected interaction: ConsumerInteraction; protected opts: PactV4Options; protected cleanupFn: () => void; protected graphQLRequest: GraphqlRequest; constructor(pact: ConsumerPact, interaction: ConsumerInteraction, opts: PactV4Options, cleanupFn: () => void, graphQLRequest: GraphqlRequest); /** * The actual GraphQL query as a string. * * NOTE: spaces are not important, Pact will auto-generate a space-insensitive matcher * * e.g. the value for the "query" field in the GraphQL HTTP payload: * '{ "query": "{ * Category(id:7) { * id, * name, * subcategories { * id, * name * } * } * }" * }' * @param query {string|ASTNode} parsed or unparsed query * @return this object */ withQuery(query: string | ASTNode): V4InteractionWithRequest; withMutation(mutation: string | ASTNode): V4InteractionWithRequest; private setQueryDetails; }