soap-graphql
Version:
Create a GraphQL schema from a WSDL-defined SOAP endpoint.
145 lines • 4.97 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var node_soap_resolver_1 = require("./node-soap-resolver");
function createSoapEndpoint(soapClient, logger) {
return new NodeSoapEndpoint(soapClient, logger);
}
exports.createSoapEndpoint = createSoapEndpoint;
var NodeSoapEndpoint = /** @class */ (function () {
function NodeSoapEndpoint(soapClient, logger) {
this.soapClient = soapClient;
this._describe = null;
this._resolver = new node_soap_resolver_1.NodeSoapWsdlResolver(this.soapClient.wsdl, logger);
}
NodeSoapEndpoint.prototype.description = function () {
return this.soapClient.wsdl.toXML();
};
NodeSoapEndpoint.prototype.services = function () {
var services = [];
var content = this.describe();
for (var key in content) {
services.push(new NodeSoapService(this, key, content[key]));
}
return services;
};
NodeSoapEndpoint.prototype.resolver = function () {
return this._resolver;
};
NodeSoapEndpoint.prototype.describe = function () {
if (!this._describe) {
this._describe = this.soapClient.describe();
}
return this._describe;
};
return NodeSoapEndpoint;
}());
exports.NodeSoapEndpoint = NodeSoapEndpoint;
var NodeSoapService = /** @class */ (function () {
function NodeSoapService(_wsdl, _name, _content) {
this._wsdl = _wsdl;
this._name = _name;
this._content = _content;
this._ports = null;
}
NodeSoapService.prototype.endpoint = function () {
return this._wsdl;
};
NodeSoapService.prototype.name = function () {
return this._name;
};
NodeSoapService.prototype.ports = function () {
if (!this._ports) {
this._ports = this.createPorts();
}
return this._ports;
};
NodeSoapService.prototype.createPorts = function () {
var ports = [];
for (var key in this._content) {
ports.push(new NodeSoapPort(this, key, this._content[key]));
}
return ports;
};
return NodeSoapService;
}());
exports.NodeSoapService = NodeSoapService;
var NodeSoapPort = /** @class */ (function () {
function NodeSoapPort(_service, _name, _content) {
this._service = _service;
this._name = _name;
this._content = _content;
this._operations = null;
}
NodeSoapPort.prototype.endpoint = function () {
return this.service().endpoint();
};
NodeSoapPort.prototype.service = function () {
return this._service;
};
NodeSoapPort.prototype.name = function () {
return this._name;
};
NodeSoapPort.prototype.operations = function () {
if (!this._operations) {
this._operations = this.createOperations();
}
return this._operations;
};
NodeSoapPort.prototype.createOperations = function () {
var operations = [];
for (var key in this._content) {
operations.push(new NodeSoapOperation(this, key, this._content[key]));
}
return operations;
};
return NodeSoapPort;
}());
exports.NodeSoapPort = NodeSoapPort;
var NodeSoapOperation = /** @class */ (function () {
function NodeSoapOperation(_port, _name, _content) {
this._port = _port;
this._name = _name;
this._content = _content;
this._inputs = null;
this._output = null;
}
NodeSoapOperation.prototype.endpoint = function () {
return this.port().endpoint();
};
NodeSoapOperation.prototype.service = function () {
return this.port().service();
};
NodeSoapOperation.prototype.port = function () {
return this._port;
};
NodeSoapOperation.prototype.name = function () {
return this._name;
};
NodeSoapOperation.prototype.content = function () {
return this._content;
};
NodeSoapOperation.prototype.args = function () {
if (!this._inputs) {
this._inputs = this.endpoint().resolver().createOperationArgs(this);
}
return this._inputs;
};
NodeSoapOperation.prototype.output = function () {
if (!this._output) {
this._output = this.createOutput();
}
return this._output.type;
};
NodeSoapOperation.prototype.resultField = function () {
if (!this._output) {
this._output = this.createOutput();
}
return this._output.resultField;
};
NodeSoapOperation.prototype.createOutput = function () {
return this.endpoint().resolver().createOperationOutput(this);
};
return NodeSoapOperation;
}());
exports.NodeSoapOperation = NodeSoapOperation;
//# sourceMappingURL=node-soap-endpoint.js.map