@omnigraph/soap
Version:
39 lines (38 loc) • 1.57 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadSOAPSubgraph = loadSOAPSubgraph;
const tslib_1 = require("tslib");
const utils_1 = require("@graphql-mesh/utils");
const promise_helpers_1 = require("@whatwg-node/promise-helpers");
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,
logger,
cwd,
// Configuration from the user
schemaHeaders: options.schemaHeaders,
operationHeaders: options.operationHeaders,
endpoint: options.endpoint,
bodyAlias: options.bodyAlias,
soapHeaders: options.soapHeaders,
});
return {
name: subgraphName,
schema$: (0, promise_helpers_1.handleMaybePromise)(() => (0, utils_1.readFileOrUrl)(options.source, {
allowUnknownExtensions: true,
cwd,
fetch,
importFn: utils_1.defaultImportFn,
logger,
}), wsdl => (0, promise_helpers_1.handleMaybePromise)(() => soapLoader.loadWSDL(wsdl), object => {
soapLoader.loadedLocations.set(options.source, object);
return soapLoader.buildSchema();
})),
};
};
}
;