import { TypedDocumentNode } from "@graphql-typed-document-node/core"; import { DeenruvConfig } from "@deenruv/core"; import { DocumentNode } from "graphql"; import { RequestInit, Response } from "node-fetch"; import { QueryParams } from "./types"; /** * @description * A minimalistic GraphQL client for populating and querying test data. * * @docsCategory testing */ export declare class SimpleGraphQLClient { private deenruvConfig; private apiUrl; private authToken; private channelToken; private headers; constructor(deenruvConfig: Required, apiUrl?: string); /** * @description * Sets the authToken to be used in each GraphQL request. */ setAuthToken(token: string): void; /** * @description * Sets the authToken to be used in each GraphQL request. */ setChannelToken(token: string | null): void; /** * @description * Returns the authToken currently being used. */ getAuthToken(): string; /** * @description * Performs both query and mutation operations. */ query = Record>(query: DocumentNode | TypedDocumentNode, variables?: V, queryParams?: QueryParams): Promise; /** * @description * Performs a raw HTTP request to the given URL, but also includes the authToken & channelToken * headers if they have been set. Useful for testing non-GraphQL endpoints, e.g. for plugins * which make use of REST controllers. */ fetch(url: string, options?: RequestInit): Promise; /** * @description * Performs a query or mutation and returns the resulting status code. */ queryStatus = Record>(query: DocumentNode, variables?: V): Promise; /** * @description * Attempts to log in with the specified credentials. */ asUserWithCredentials(username: string, password: string): Promise; /** * @description * Logs in as the SuperAdmin user. */ asSuperAdmin(): Promise; /** * @description * Logs out so that the client is then treated as an anonymous user. */ asAnonymousUser(): Promise; private makeGraphQlRequest; private getResult; /** * @description * Perform a file upload mutation. * * Upload spec: https://github.com/jaydenseric/graphql-multipart-request-spec * Discussion of issue: https://github.com/jaydenseric/apollo-upload-client/issues/32 */ fileUploadMutation(options: { mutation: DocumentNode; filePaths: string[]; mapVariables: (filePaths: string[]) => any; }): Promise; } export declare class ClientError extends Error { response: any; request: any; constructor(response: any, request: any); private static extractMessage; }