///
/**
* Functions to create resolve functions.
*/
import { ParameterObject } from './types/oas3';
import { ConnectOptions } from './types/options';
import { Operation } from './types/operation';
import { SubscriptionContext } from './types/graphql';
import { PreprocessingData } from './types/preprocessing_data';
import { RequestOptions } from './types/options';
import { GraphQLFieldResolver } from 'graphql';
import { IncomingHttpHeaders } from 'http';
export declare const OPENAPI_TO_GRAPHQL = "_openAPIToGraphQL";
declare type GetResolverParams = {
operation: Operation;
argsFromLink?: {
[key: string]: string;
};
payloadName?: string;
responseName?: string;
data: PreprocessingData;
baseUrl?: string;
requestOptions?: RequestOptions;
};
declare type GetSubscribeParams = {
operation: Operation;
argsFromLink?: {
[key: string]: string;
};
payloadName?: string;
data: PreprocessingData;
baseUrl?: string;
connectOptions?: ConnectOptions;
};
declare type ResolveData = {
/**
* TODO: Determine type
*
* Is it related to TArgs?
*/
usedParams: any;
usedPayload: any;
usedRequestOptions: RequestOptions;
usedStatusCode: string;
responseHeaders: IncomingHttpHeaders;
};
declare type OpenAPIToGraphQLRoot = {
data?: {
[identifier: string]: ResolveData;
};
/**
* TODO: We can define more specific types. See getProcessedSecuritySchemes().
*
* Is it related TArgs?
*/
security: {
[saneProtocolName: string]: any;
};
};
declare type OpenAPIToGraphQLSource = {
_openAPIToGraphQL: OpenAPIToGraphQLRoot;
};
export declare function getSubscribe({ operation, payloadName, data, baseUrl, connectOptions }: GetSubscribeParams): GraphQLFieldResolver;
export declare function getPublishResolver({ operation, responseName, data }: GetResolverParams): GraphQLFieldResolver;
/**
* If the operation type is Query or Mutation, create and return a resolver
* function that performs API requests for the given GraphQL query
*/
export declare function getResolver({ operation, argsFromLink, payloadName, data, baseUrl, requestOptions }: GetResolverParams): GraphQLFieldResolver, TContext, TArgs>;
/**
* Extracts data from the GraphQL arguments of a particular field
*
* Replaces the path parameter in the given path with values in the given args.
* Furthermore adds the query parameters for a request.
*/
export declare function extractRequestDataFromArgs(path: string, parameters: ParameterObject[], args: TArgs, // NOTE: argument keys are sanitized!
data: PreprocessingData): {
path: string;
qs: {
[key: string]: string;
};
headers: {
[key: string]: string;
};
};
export {};