UNPKG

@omnigraph/soap

Version:
33 lines (32 loc) 1.24 kB
import { defaultImportFn, DefaultLogger, readFileOrUrl } from '@graphql-mesh/utils'; import { SOAPLoader } from './SOAPLoader.js'; export * from './SOAPLoader.js'; export * from '@graphql-mesh/transport-soap'; export function loadSOAPSubgraph(subgraphName, options) { return ({ cwd, fetch, logger }) => { const soapLoader = new SOAPLoader({ subgraphName, fetch: options.fetch || fetch, logger: options.logger || logger, schemaHeaders: options.schemaHeaders, operationHeaders: options.operationHeaders, endpoint: options.endpoint, cwd, }); return { name: subgraphName, schema$: readFileOrUrl(options.source, { allowUnknownExtensions: true, cwd, fetch: options.fetch || fetch, importFn: defaultImportFn, logger: new DefaultLogger(`SOAP Subgraph ${subgraphName}`), }) .then(wsdl => soapLoader.loadWSDL(wsdl)) .then(object => { soapLoader.loadedLocations.set(options.source, object); return soapLoader.buildSchema(); }), }; }; }