soap-graphql
Version:
Create a GraphQL schema from a WSDL-defined SOAP endpoint.
61 lines (60 loc) • 2.78 kB
TypeScript
import { NodeSoapClient, NodeSoapOptions } from './node-soap/node-soap';
import { SchemaOptions } from './soap2graphql/soap2graphql';
import { SoapCaller } from './soap2graphql/soap-caller';
import { GraphQLSchema, GraphQLSchemaConfig } from 'graphql/type/schema';
export declare type SoapGraphqlOptions = {
/**
* node-soap client to use.
* Either this field or 'createClient' must be filled.
*/
soapClient?: NodeSoapClient;
/**
* Creation parameters for a node-soap client.
* Will only be used if 'soapClient' is empty.
* Either this field or 'soapClient' must be filled.
*/
createClient?: {
url: string;
options?: NodeSoapOptions;
};
/**
* Options for the GraphQL schema.
*/
schemaOptions?: SchemaOptions;
/**
* Handler for executing a soap call based on input from GraphQL.
* Use this, if request do need pre-processing (resp.: responses need post-processing) before execution.
*
* default: NodeSoapCaller
*/
soapCaller?: SoapCaller;
/**
* If set to true, (a lot of) debug-information will be dumped to console.log
* Do not use this in production!
*
* default: false
*/
debug?: boolean;
/**
* If set to true, warnings will be printed to console.log
* A warning means: The GraphQL schema can be generated, but it might not work as intended.
*
* default: false
*/
warnings?: boolean;
};
/**
* Creates a GraphQL schema for the WSDL defined by the given parameters.
*
* The created GraphQL schema will include:
* - A Mutation-field for every operation in the WSDL.
* If the field is queried via GraphQL, the SOAP endpoint declared in the WSDL will be called and the result of the call will be returned via GraphQL.
* - A GraphQL output type for every WSDL type that is: a) used as a result of an operation and b) declared in the schema section of the WSDL.
* - A GraphQL interface type for every WSDL type that is: a) used as a base type of another type and b) declared in the schema section of the WSDL.
* - A GraphQL input type for every WSDL type that is: a) used as a input type of an operation and b) declared in the schema section of the WSDL.
* - A Query-field that returns the content of the WSDL (this is necessary, since a GraphQL schema must include at least one Query-field)
*
* @param options either an instance of SoapGraphQLOptions or the URL (http/https or path to a file) to a WSDL.
*/
export declare function soapGraphqlSchema(options: SoapGraphqlOptions | string): Promise<GraphQLSchema>;
export declare function soapGraphqlSchemaConfig(options: SoapGraphqlOptions | string): Promise<GraphQLSchemaConfig>;