UNPKG

@omnigraph/soap

Version:
37 lines (36 loc) 1.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.loadSOAPSubgraph = loadSOAPSubgraph; const tslib_1 = require("tslib"); const utils_1 = require("@graphql-mesh/utils"); const SOAPLoader_js_1 = require("./SOAPLoader.js"); tslib_1.__exportStar(require("./SOAPLoader.js"), exports); tslib_1.__exportStar(require("@graphql-mesh/transport-soap"), exports); function loadSOAPSubgraph(subgraphName, options) { return ({ cwd, fetch, logger }) => { const soapLoader = new SOAPLoader_js_1.SOAPLoader({ subgraphName, fetch: options.fetch || fetch, logger: options.logger || logger, schemaHeaders: options.schemaHeaders, operationHeaders: options.operationHeaders, endpoint: options.endpoint, cwd, }); return { name: subgraphName, schema$: (0, utils_1.readFileOrUrl)(options.source, { allowUnknownExtensions: true, cwd, fetch: options.fetch || fetch, importFn: utils_1.defaultImportFn, logger: new utils_1.DefaultLogger(`SOAP Subgraph ${subgraphName}`), }) .then(wsdl => soapLoader.loadWSDL(wsdl)) .then(object => { soapLoader.loadedLocations.set(options.source, object); return soapLoader.buildSchema(); }), }; }; }