Socket
Socket
Sign inDemoInstall

soap

Package Overview
Dependencies
32
Maintainers
3
Versions
90
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.45.0 to 1.0.0

lib/security/WSSecurityPlusCert.d.ts

7

History.md

@@ -0,1 +1,8 @@

1.0.0 / 2022-12-09
===================
* [ENHANCEMENT] allow soap.createClient to create a new SOAP client from a WSDL string (#1191)
* [FIX] Bump xml-crypto (#1200)
* [FIX] Upgrade to Formidable 3, Node 14, and audit fix (#1192)
* [FIX] Allow WSSecurity and WSSecurityCert to be used together (#1195)
0.45.0 / 2022-06-15

@@ -2,0 +9,0 @@ ===================

1

lib/client.d.ts
/// <reference types="node" />
/// <reference types="node" />
import { EventEmitter } from 'events';

@@ -3,0 +4,0 @@ import { IncomingHttpHeaders } from 'http';

355

lib/client.js

@@ -6,40 +6,25 @@ "use strict";

*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Client = void 0;
var assert = require("assert");
var debugBuilder = require("debug");
var events_1 = require("events");
var getStream = require("get-stream");
var _ = require("lodash");
var uuid_1 = require("uuid");
var http_1 = require("./http");
var utils_1 = require("./utils");
var debug = debugBuilder('node-soap');
var nonIdentifierChars = /[^a-z$_0-9]/i;
var Client = /** @class */ (function (_super) {
__extends(Client, _super);
function Client(wsdl, endpoint, options) {
var _this_1 = _super.call(this) || this;
const assert = require("assert");
const debugBuilder = require("debug");
const events_1 = require("events");
const getStream = require("get-stream");
const _ = require("lodash");
const uuid_1 = require("uuid");
const http_1 = require("./http");
const utils_1 = require("./utils");
const debug = debugBuilder('node-soap');
const nonIdentifierChars = /[^a-z$_0-9]/i;
class Client extends events_1.EventEmitter {
constructor(wsdl, endpoint, options) {
super();
options = options || {};
_this_1.wsdl = wsdl;
_this_1._initializeOptions(options);
_this_1._initializeServices(endpoint);
_this_1.httpClient = options.httpClient || new http_1.HttpClient(options);
return _this_1;
this.wsdl = wsdl;
this._initializeOptions(options);
this._initializeServices(endpoint);
this.httpClient = options.httpClient || new http_1.HttpClient(options);
}
/** add soapHeader to soap:Header node */
Client.prototype.addSoapHeader = function (soapHeader, name, namespace, xmlns) {
addSoapHeader(soapHeader, name, namespace, xmlns) {
if (!this.soapHeaders) {

@@ -50,4 +35,4 @@ this.soapHeaders = [];

return this.soapHeaders.push(soapHeader) - 1;
};
Client.prototype.changeSoapHeader = function (index, soapHeader, name, namespace, xmlns) {
}
changeSoapHeader(index, soapHeader, name, namespace, xmlns) {
if (!this.soapHeaders) {

@@ -58,12 +43,12 @@ this.soapHeaders = [];

this.soapHeaders[index] = soapHeader;
};
}
/** return all defined headers */
Client.prototype.getSoapHeaders = function () {
getSoapHeaders() {
return this.soapHeaders;
};
}
/** remove all defined headers */
Client.prototype.clearSoapHeaders = function () {
clearSoapHeaders() {
this.soapHeaders = null;
};
Client.prototype.addHttpHeader = function (name, value) {
}
addHttpHeader(name, value) {
if (!this.httpHeaders) {

@@ -73,10 +58,10 @@ this.httpHeaders = {};

this.httpHeaders[name] = value;
};
Client.prototype.getHttpHeaders = function () {
}
getHttpHeaders() {
return this.httpHeaders;
};
Client.prototype.clearHttpHeaders = function () {
}
clearHttpHeaders() {
this.httpHeaders = null;
};
Client.prototype.addBodyAttribute = function (bodyAttribute, name, namespace, xmlns) {
}
addBodyAttribute(bodyAttribute, name, namespace, xmlns) {
if (!this.bodyAttributes) {

@@ -86,7 +71,7 @@ this.bodyAttributes = [];

if (typeof bodyAttribute === 'object') {
var composition_1 = '';
Object.getOwnPropertyNames(bodyAttribute).forEach(function (prop, idx, array) {
composition_1 += ' ' + prop + '="' + bodyAttribute[prop] + '"';
let composition = '';
Object.getOwnPropertyNames(bodyAttribute).forEach((prop, idx, array) => {
composition += ' ' + prop + '="' + bodyAttribute[prop] + '"';
});
bodyAttribute = composition_1;
bodyAttribute = composition;
}

@@ -97,33 +82,33 @@ if (bodyAttribute.substr(0, 1) !== ' ') {

this.bodyAttributes.push(bodyAttribute);
};
Client.prototype.getBodyAttributes = function () {
}
getBodyAttributes() {
return this.bodyAttributes;
};
Client.prototype.clearBodyAttributes = function () {
}
clearBodyAttributes() {
this.bodyAttributes = null;
};
}
/** overwrite the SOAP service endpoint address */
Client.prototype.setEndpoint = function (endpoint) {
setEndpoint(endpoint) {
this.endpoint = endpoint;
this._initializeServices(endpoint);
};
}
/** description of services, ports and methods as a JavaScript object */
Client.prototype.describe = function () {
describe() {
return this.wsdl.describeServices();
};
}
/** use the specified security protocol */
Client.prototype.setSecurity = function (security) {
setSecurity(security) {
this.security = security;
};
Client.prototype.setSOAPAction = function (SOAPAction) {
}
setSOAPAction(SOAPAction) {
this.SOAPAction = SOAPAction;
};
Client.prototype._initializeServices = function (endpoint) {
var definitions = this.wsdl.definitions;
var services = definitions.services;
for (var name_1 in services) {
this[name_1] = this._defineService(services[name_1], endpoint);
}
_initializeServices(endpoint) {
const definitions = this.wsdl.definitions;
const services = definitions.services;
for (const name in services) {
this[name] = this._defineService(services[name], endpoint);
}
};
Client.prototype._initializeOptions = function (options) {
}
_initializeOptions(options) {
this.streamAllowed = options.stream;

@@ -136,3 +121,3 @@ this.returnSaxStream = options.returnSaxStream;

this.wsdl.options.preserveWhitespace = !!options.preserveWhitespace;
var igNs = options.ignoredNamespaces;
const igNs = options.ignoredNamespaces;
if (igNs !== undefined && typeof igNs === 'object') {

@@ -151,31 +136,31 @@ if ('override' in igNs) {

this.wsdl.options.forceSoap12Headers = !!options.forceSoap12Headers;
};
Client.prototype._defineService = function (service, endpoint) {
var ports = service.ports;
var def = {};
for (var name_2 in ports) {
def[name_2] = this._definePort(ports[name_2], endpoint ? endpoint : ports[name_2].location);
}
_defineService(service, endpoint) {
const ports = service.ports;
const def = {};
for (const name in ports) {
def[name] = this._definePort(ports[name], endpoint ? endpoint : ports[name].location);
}
return def;
};
Client.prototype._definePort = function (port, endpoint) {
var location = endpoint;
var binding = port.binding;
var methods = binding.methods;
var def = {};
for (var name_3 in methods) {
def[name_3] = this._defineMethod(methods[name_3], location);
var methodName = this.normalizeNames ? name_3.replace(nonIdentifierChars, '_') : name_3;
this[methodName] = def[name_3];
}
_definePort(port, endpoint) {
const location = endpoint;
const binding = port.binding;
const methods = binding.methods;
const def = {};
for (const name in methods) {
def[name] = this._defineMethod(methods[name], location);
const methodName = this.normalizeNames ? name.replace(nonIdentifierChars, '_') : name;
this[methodName] = def[name];
if (!nonIdentifierChars.test(methodName)) {
var suffix = this.overridePromiseSuffix;
this[methodName + suffix] = this._promisifyMethod(def[name_3]);
const suffix = this.overridePromiseSuffix;
this[methodName + suffix] = this._promisifyMethod(def[name]);
}
}
return def;
};
Client.prototype._promisifyMethod = function (method) {
return function (args, options, extraHeaders) {
return new Promise(function (resolve, reject) {
var callback = function (err, result, rawResponse, soapHeader, rawRequest, mtomAttachments) {
}
_promisifyMethod(method) {
return (args, options, extraHeaders) => {
return new Promise((resolve, reject) => {
const callback = (err, result, rawResponse, soapHeader, rawRequest, mtomAttachments) => {
if (err) {

@@ -191,7 +176,6 @@ reject(err);

};
};
Client.prototype._defineMethod = function (method, location) {
var _this_1 = this;
var temp;
return function (args, callback, options, extraHeaders) {
}
_defineMethod(method, location) {
let temp;
return (args, callback, options, extraHeaders) => {
if (typeof args === 'function') {

@@ -212,8 +196,8 @@ callback = args;

}
_this_1._invoke(method, args, location, function (error, result, rawResponse, soapHeader, rawRequest, mtomAttachments) {
this._invoke(method, args, location, (error, result, rawResponse, soapHeader, rawRequest, mtomAttachments) => {
callback(error, result, rawResponse, soapHeader, rawRequest, mtomAttachments);
}, options, extraHeaders);
};
};
Client.prototype._processSoapHeader = function (soapHeader, name, namespace, xmlns) {
}
_processSoapHeader(soapHeader, name, namespace, xmlns) {
switch (typeof soapHeader) {

@@ -223,9 +207,9 @@ case 'object':

case 'function':
var _this_2 = this;
const _this = this;
// arrow function does not support arguments variable
// tslint:disable-next-line
return function () {
var result = soapHeader.apply(null, arguments);
const result = soapHeader.apply(null, arguments);
if (typeof result === 'object') {
return _this_2.wsdl.objectToXML(result, name, namespace, xmlns, true);
return _this.wsdl.objectToXML(result, name, namespace, xmlns, true);
}

@@ -239,23 +223,22 @@ else {

}
};
Client.prototype._invoke = function (method, args, location, callback, options, extraHeaders) {
var _this_1 = this;
var name = method.$name;
var input = method.input;
var output = method.output;
var style = method.style;
var defs = this.wsdl.definitions;
var envelopeKey = this.wsdl.options.envelopeKey;
var ns = defs.$targetNamespace;
var encoding = '';
var message = '';
var xml = null;
var soapAction;
var alias = utils_1.findPrefix(defs.xmlns, ns);
var headers = {
'Content-Type': 'text/xml; charset=utf-8'
}
_invoke(method, args, location, callback, options, extraHeaders) {
const name = method.$name;
const input = method.input;
const output = method.output;
const style = method.style;
const defs = this.wsdl.definitions;
const envelopeKey = this.wsdl.options.envelopeKey;
const ns = defs.$targetNamespace;
let encoding = '';
let message = '';
let xml = null;
let soapAction;
const alias = (0, utils_1.findPrefix)(defs.xmlns, ns);
let headers = {
'Content-Type': 'text/xml; charset=utf-8',
};
var xmlnsSoap = 'xmlns:' + envelopeKey + '="http://schemas.xmlsoap.org/soap/envelope/"';
var finish = function (obj, body, response) {
var result;
let xmlnsSoap = 'xmlns:' + envelopeKey + '="http://schemas.xmlsoap.org/soap/envelope/"';
const finish = (obj, body, response) => {
let result;
if (!output) {

@@ -268,6 +251,6 @@ // one-way, no output expected

if (response.status >= 400) {
var error = new Error('Error http status codes');
const error = new Error('Error http status codes');
error.response = response;
error.body = body;
_this_1.emit('soapError', error, eid);
this.emit('soapError', error, eid);
return callback(error, obj, body, obj.Header);

@@ -278,3 +261,3 @@ }

if (typeof obj.Body !== 'object') {
var error = new Error('Cannot parse response');
const error = new Error('Cannot parse response');
error.response = response;

@@ -292,3 +275,3 @@ error.body = body;

if (!result) {
['Response', 'Out', 'Output'].forEach(function (term) {
['Response', 'Out', 'Output'].forEach((term) => {
if (obj.Body.hasOwnProperty(name + term)) {

@@ -301,6 +284,6 @@ return result = obj.Body[name + term];

};
var parseSync = function (body, response) {
var obj;
const parseSync = (body, response) => {
let obj;
try {
obj = _this_1.wsdl.xmlToObject(body);
obj = this.wsdl.xmlToObject(body);
}

@@ -313,3 +296,3 @@ catch (error) {

// If the response is JSON then return it as-is.
var json = _.isObject(body) ? body : tryJSONparse(body);
const json = _.isObject(body) ? body : tryJSONparse(body);
if (json) {

@@ -321,3 +304,3 @@ return callback(null, response, json, undefined, xml);

error.body = body;
_this_1.emit('soapError', error, eid);
this.emit('soapError', error, eid);
return callback(error, response, body, undefined, xml, response.mtomResponseAttachments);

@@ -337,3 +320,3 @@ }

if (this.wsdl.options.forceSoap12Headers) {
headers['Content-Type'] = "application/soap+xml; charset=utf-8; action=\"" + soapAction + "\"";
headers['Content-Type'] = `application/soap+xml; charset=utf-8; action="${soapAction}"`;
xmlnsSoap = 'xmlns:' + envelopeKey + '="http://www.w3.org/2003/05/soap-envelope"';

@@ -362,5 +345,5 @@ }

}
var decodedHeaders;
let decodedHeaders;
if (this.soapHeaders) {
decodedHeaders = this.soapHeaders.map(function (header) {
decodedHeaders = this.soapHeaders.map((header) => {
if (typeof header === 'function') {

@@ -389,3 +372,2 @@ return header(method, location, soapAction, args);

(this.bodyAttributes ? this.bodyAttributes.join(' ') : '') +
(this.security && this.security.postProcess ? ' Id="_0"' : '') +
'>' +

@@ -404,3 +386,3 @@ message +

this.lastEndpoint = location;
var eid = options.exchangeId || uuid_1.v4();
const eid = options.exchangeId || (0, uuid_1.v4)();
this.emit('message', message, eid);

@@ -413,10 +395,10 @@ this.emit('request', xml, eid);

else {
for (var header in this.httpHeaders) {
for (const header in this.httpHeaders) {
headers[header] = this.httpHeaders[header];
}
for (var attr in extraHeaders) {
for (const attr in extraHeaders) {
headers[attr] = extraHeaders[attr];
}
}
var tryJSONparse = function (body) {
const tryJSONparse = (body) => {
try {

@@ -431,17 +413,17 @@ return JSON.parse(body);

callback = _.once(callback);
var startTime_1 = Date.now();
var onError_1 = function (err) {
_this_1.lastResponse = null;
_this_1.lastResponseHeaders = null;
_this_1.lastElapsedTime = null;
_this_1.lastRequestHeaders = err.config && err.config.headers;
_this_1.emit('response', null, null, eid);
if (_this_1.returnSaxStream || !err.response || !err.response.data) {
const startTime = Date.now();
const onError = (err) => {
this.lastResponse = null;
this.lastResponseHeaders = null;
this.lastElapsedTime = null;
this.lastRequestHeaders = err.config && err.config.headers;
this.emit('response', null, null, eid);
if (this.returnSaxStream || !err.response || !err.response.data) {
callback(err, undefined, undefined, undefined, xml);
}
else {
err.response.data.on('close', function (e) {
err.response.data.on('close', (e) => {
callback(err, undefined, undefined, undefined, xml);
});
err.response.data.on('data', function (e) {
err.response.data.on('data', (e) => {
err.response.data = e.toString();

@@ -451,6 +433,6 @@ });

};
this.httpClient.requestStream(location, xml, headers, options, this).then(function (res) {
_this_1.lastRequestHeaders = res.headers;
this.httpClient.requestStream(location, xml, headers, options, this).then((res) => {
this.lastRequestHeaders = res.headers;
if (res.data.on) {
res.data.on('error', function (err) { return onError_1(err); });
res.data.on('error', (err) => onError(err));
}

@@ -460,9 +442,9 @@ // When the output element cannot be looked up in the wsdl,

if (res.status !== 200 || !output || !output.$lookupTypes) {
getStream(res.data).then(function (body) {
_this_1.lastResponse = body;
_this_1.lastElapsedTime = Date.now() - startTime_1;
_this_1.lastResponseHeaders = res && res.headers;
getStream(res.data).then((body) => {
this.lastResponse = body;
this.lastElapsedTime = Date.now() - startTime;
this.lastResponseHeaders = res && res.headers;
// Added mostly for testability, but possibly useful for debugging
_this_1.lastRequestHeaders = res.config && res.config.headers || res.headers;
_this_1.emit('response', body, res, eid);
this.lastRequestHeaders = res.config && res.config.headers || res.headers;
this.emit('response', body, res, eid);
return parseSync(body, res);

@@ -472,20 +454,20 @@ });

}
if (_this_1.returnSaxStream) {
if (this.returnSaxStream) {
// directly return the saxStream allowing the end user to define
// the parsing logics and corresponding errors managements
var saxStream = _this_1.wsdl.getSaxStream(res.data);
return finish({ saxStream: saxStream }, '<stream>', res.data);
const saxStream = this.wsdl.getSaxStream(res.data);
return finish({ saxStream }, '<stream>', res.data);
}
else {
_this_1.wsdl.xmlToObject(res.data, function (error, obj) {
_this_1.lastResponse = res;
_this_1.lastElapsedTime = Date.now() - startTime_1;
_this_1.lastResponseHeaders = res && res.headers;
this.wsdl.xmlToObject(res.data, (error, obj) => {
this.lastResponse = res;
this.lastElapsedTime = Date.now() - startTime;
this.lastResponseHeaders = res && res.headers;
// Added mostly for testability, but possibly useful for debugging
_this_1.lastRequestHeaders = res.config.headers;
_this_1.emit('response', '<stream>', res.data, eid);
this.lastRequestHeaders = res.config.headers;
this.emit('response', '<stream>', res.data, eid);
if (error) {
error.response = res;
error.body = '<stream>';
_this_1.emit('soapError', error, eid);
this.emit('soapError', error, eid);
return callback(error, res, undefined, undefined, xml);

@@ -496,21 +478,21 @@ }

}
}, onError_1);
}, onError);
return;
}
var startTime = Date.now();
return this.httpClient.request(location, xml, function (err, response, body) {
_this_1.lastResponse = body;
const startTime = Date.now();
return this.httpClient.request(location, xml, (err, response, body) => {
this.lastResponse = body;
if (response) {
_this_1.lastResponseHeaders = response.headers;
_this_1.lastElapsedTime = Date.now() - startTime;
_this_1.lastResponseAttachments = response.mtomResponseAttachments;
this.lastResponseHeaders = response.headers;
this.lastElapsedTime = Date.now() - startTime;
this.lastResponseAttachments = response.mtomResponseAttachments;
// Added mostly for testability, but possibly useful for debugging
_this_1.lastRequestHeaders = response.config && response.config.headers;
this.lastRequestHeaders = response.config && response.config.headers;
}
_this_1.emit('response', body, response, eid);
this.emit('response', body, response, eid);
if (err) {
_this_1.lastRequestHeaders = err.config && err.config.headers;
this.lastRequestHeaders = err.config && err.config.headers;
try {
if (err.response && err.response.data) {
_this_1.wsdl.xmlToObject(err.response.data);
this.wsdl.xmlToObject(err.response.data);
}

@@ -527,6 +509,5 @@ }

}, headers, options, this);
};
return Client;
}(events_1.EventEmitter));
}
}
exports.Client = Client;
//# sourceMappingURL=client.js.map
/// <reference types="node" />
/// <reference types="node" />
import * as req from 'axios';

@@ -3,0 +4,0 @@ import { ReadStream } from 'fs';

@@ -6,25 +6,14 @@ "use strict";

*/
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpClient = void 0;
var req = require("axios");
var axios_ntlm_1 = require("axios-ntlm");
var debugBuilder = require("debug");
var url = require("url");
var uuid_1 = require("uuid");
var MIMEType = require("whatwg-mimetype");
var zlib_1 = require("zlib");
var utils_1 = require("./utils");
var debug = debugBuilder('node-soap');
var VERSION = require('../package.json').version;
const req = require("axios");
const axios_ntlm_1 = require("axios-ntlm");
const debugBuilder = require("debug");
const url = require("url");
const uuid_1 = require("uuid");
const MIMEType = require("whatwg-mimetype");
const zlib_1 = require("zlib");
const utils_1 = require("./utils");
const debug = debugBuilder('node-soap');
const VERSION = require('../package.json').version;
/**

@@ -37,7 +26,7 @@ * A class representing the http client

*/
var HttpClient = /** @class */ (function () {
function HttpClient(options) {
class HttpClient {
constructor(options) {
options = options || {};
this.options = options;
this._request = options.request || req["default"].create();
this._request = options.request || req.default.create();
}

@@ -52,11 +41,8 @@ /**

*/
HttpClient.prototype.buildRequest = function (rurl, data, exheaders, exoptions) {
if (exoptions === void 0) { exoptions = {}; }
var curl = url.parse(rurl);
var method = data ? 'POST' : 'GET';
var secure = curl.protocol === 'https:';
var path = [curl.pathname || '/', curl.search || '', curl.hash || ''].join('');
var host = curl.hostname;
var port = parseInt(curl.port, 10);
var headers = {
buildRequest(rurl, data, exheaders, exoptions = {}) {
const curl = url.parse(rurl);
const method = data ? 'POST' : 'GET';
const host = curl.hostname;
const port = parseInt(curl.port, 10);
const headers = {
'User-Agent': 'node-soap/' + VERSION,

@@ -67,7 +53,7 @@ 'Accept': 'text/html,application/xhtml+xml,application/xml,text/xml;q=0.9,*/*;q=0.8',

'Connection': exoptions.forever ? 'keep-alive' : 'close',
'Host': host + (isNaN(port) ? '' : ':' + port)
'Host': host + (isNaN(port) ? '' : ':' + port),
};
var mergeOptions = ['headers'];
var _attachments = exoptions.attachments, newExoptions = __rest(exoptions, ["attachments"]);
var attachments = _attachments || [];
const mergeOptions = ['headers'];
const { attachments: _attachments, ...newExoptions } = exoptions;
const attachments = _attachments || [];
if (typeof data === 'string' && attachments.length === 0 && !exoptions.forceMTOM) {

@@ -78,10 +64,10 @@ headers['Content-Length'] = Buffer.byteLength(data, 'utf8');

exheaders = exheaders || {};
for (var attr in exheaders) {
for (const attr in exheaders) {
headers[attr] = exheaders[attr];
}
var options = {
const options = {
url: curl.href,
method: method,
headers: headers,
transformResponse: function (data) { return data; }
transformResponse: (data) => data,
};

@@ -92,7 +78,6 @@ if (!exoptions.ntlm) {

if (exoptions.forceMTOM || attachments.length > 0) {
var start = uuid_1.v4();
var action = null;
const start = (0, uuid_1.v4)();
let action = null;
if (headers['Content-Type'].indexOf('action') > -1) {
for (var _i = 0, _a = headers['Content-Type'].split('; '); _i < _a.length; _i++) {
var ct = _a[_i];
for (const ct of headers['Content-Type'].split('; ')) {
if (ct.indexOf('action') > -1) {

@@ -103,14 +88,14 @@ action = ct;

}
var boundary_1 = uuid_1.v4();
headers['Content-Type'] = 'multipart/related; type="application/xop+xml"; start="<' + start + '>"; type="text/xml"; boundary=' + boundary_1;
const boundary = (0, uuid_1.v4)();
headers['Content-Type'] = 'multipart/related; type="application/xop+xml"; start="<' + start + '>"; type="text/xml"; boundary=' + boundary;
if (action) {
headers['Content-Type'] = headers['Content-Type'] + '; ' + action;
}
var multipart_1 = [{
const multipart = [{
'Content-Type': 'application/xop+xml; charset=UTF-8; type="text/xml"',
'Content-ID': '<' + start + '>',
'body': data
'body': data,
}];
attachments.forEach(function (attachment) {
multipart_1.push({
attachments.forEach((attachment) => {
multipart.push({
'Content-Type': attachment.mimetype,

@@ -120,16 +105,16 @@ 'Content-Transfer-Encoding': 'binary',

'Content-Disposition': 'attachment; filename="' + attachment.name + '"',
'body': attachment.body
'body': attachment.body,
});
});
options.data = "--" + boundary_1 + "\r\n";
var multipartCount_1 = 0;
multipart_1.forEach(function (part) {
Object.keys(part).forEach(function (key) {
options.data = `--${boundary}\r\n`;
let multipartCount = 0;
multipart.forEach((part) => {
Object.keys(part).forEach((key) => {
if (key !== 'body') {
options.data += key + ": " + part[key] + "\r\n";
options.data += `${key}: ${part[key]}\r\n`;
}
});
options.data += '\r\n';
options.data += part.body + "\r\n--" + boundary_1 + (multipartCount_1 === multipart_1.length - 1 ? '--' : '') + "\r\n";
multipartCount_1++;
options.data += `${part.body}\r\n--${boundary}${multipartCount === multipart.length - 1 ? '--' : ''}\r\n`;
multipartCount++;
});

@@ -142,9 +127,9 @@ }

options.decompress = true;
options.data = zlib_1.gzipSync(options.data);
options.data = (0, zlib_1.gzipSync)(options.data);
options.headers['Accept-Encoding'] = 'gzip,deflate';
options.headers['Content-Encoding'] = 'gzip';
}
for (var attr in newExoptions) {
for (const attr in newExoptions) {
if (mergeOptions.indexOf(attr) !== -1) {
for (var header in exoptions[attr]) {
for (const header in exoptions[attr]) {
options[attr][header] = exoptions[attr][header];

@@ -159,3 +144,3 @@ }

return options;
};
}
/**

@@ -168,8 +153,8 @@ * Handle the http response

*/
HttpClient.prototype.handleResponse = function (req, res, body) {
handleResponse(req, res, body) {
debug('Http response body: %j', body);
if (typeof body === 'string') {
// Remove any extra characters that appear before or after the SOAP envelope.
var regex = /(?:<\?[^?]*\?>[\s]*)?<([^:]*):Envelope([\S\s]*)<\/\1:Envelope>/i;
var match = body.replace(/<!--[\s\S]*?-->/, '').match(regex);
const regex = /(?:<\?[^?]*\?>[\s]*)?<([^:]*):Envelope([\S\s]*)<\/\1:Envelope>/i;
const match = body.replace(/<!--[\s\S]*?-->/, '').match(regex);
if (match) {

@@ -180,13 +165,12 @@ body = match[0];

return body;
};
HttpClient.prototype.request = function (rurl, data, callback, exheaders, exoptions, caller) {
var _this_1 = this;
var options = this.buildRequest(rurl, data, exheaders, exoptions);
var req;
}
request(rurl, data, callback, exheaders, exoptions, caller) {
const options = this.buildRequest(rurl, data, exheaders, exoptions);
let req;
if (exoptions !== undefined && exoptions.ntlm) {
var ntlmReq = axios_ntlm_1.NtlmClient({
const ntlmReq = (0, axios_ntlm_1.NtlmClient)({
username: exoptions.username,
password: exoptions.password,
workstation: exoptions.workstation || '',
domain: exoptions.domain || ''
domain: exoptions.domain || '',
});

@@ -202,10 +186,14 @@ req = ntlmReq(options);

}
var _this = this;
req.then(function (res) {
var body;
const _this = this;
req.then((res) => {
const handleBody = (body) => {
res.data = this.handleResponse(req, res, body || res.data);
callback(null, res, res.data);
return res;
};
if (_this.options.parseReponseAttachments) {
var isMultipartResp = res.headers['content-type'] && res.headers['content-type'].toLowerCase().indexOf('multipart/related') > -1;
const isMultipartResp = res.headers['content-type'] && res.headers['content-type'].toLowerCase().indexOf('multipart/related') > -1;
if (isMultipartResp) {
var boundary = void 0;
var parsedContentType = MIMEType.parse(res.headers['content-type']);
let boundary;
const parsedContentType = MIMEType.parse(res.headers['content-type']);
if (parsedContentType) {

@@ -217,36 +205,38 @@ boundary = parsedContentType.parameters.get('boundary');

}
var multipartResponse = utils_1.parseMTOMResp(res.data, boundary);
// first part is the soap response
var firstPart = multipartResponse.parts.shift();
if (!firstPart || !firstPart.body) {
return callback(new Error('Cannot parse multipart response'));
}
body = firstPart.body.toString('utf8');
res.mtomResponseAttachments = multipartResponse;
return (0, utils_1.parseMTOMResp)(res.data, boundary, (err, multipartResponse) => {
if (err) {
return callback(err);
}
// first part is the soap response
const firstPart = multipartResponse.parts.shift();
if (!firstPart || !firstPart.body) {
return callback(new Error('Cannot parse multipart response'));
}
res.mtomResponseAttachments = multipartResponse;
return handleBody(firstPart.body.toString('utf8'));
});
}
else {
body = res.data.toString('utf8');
return handleBody(res.data.toString('utf8'));
}
}
res.data = _this_1.handleResponse(req, res, body || res.data);
callback(null, res, res.data);
return res;
}, function (err) {
else {
return handleBody();
}
}, (err) => {
return callback(err);
});
return req;
};
HttpClient.prototype.requestStream = function (rurl, data, exheaders, exoptions, caller) {
var _this_1 = this;
var options = this.buildRequest(rurl, data, exheaders, exoptions);
}
requestStream(rurl, data, exheaders, exoptions, caller) {
const options = this.buildRequest(rurl, data, exheaders, exoptions);
options.responseType = 'stream';
var req = this._request(options).then(function (res) {
res.data = _this_1.handleResponse(req, res, res.data);
const req = this._request(options).then((res) => {
res.data = this.handleResponse(req, res, res.data);
return res;
});
return req;
};
return HttpClient;
}());
}
}
exports.HttpClient = HttpClient;
//# sourceMappingURL=http.js.map
"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NamespaceContext = void 0;

@@ -10,4 +10,4 @@ /**

*/
var NamespaceScope = /** @class */ (function () {
function NamespaceScope(parent) {
class NamespaceScope {
constructor(parent) {
this.parent = parent;

@@ -22,3 +22,3 @@ this.namespaces = {};

*/
NamespaceScope.prototype.getNamespaceURI = function (prefix, localOnly) {
getNamespaceURI(prefix, localOnly) {
switch (prefix) {

@@ -30,3 +30,3 @@ case 'xml':

default:
var nsUri = this.namespaces[prefix];
const nsUri = this.namespaces[prefix];
/*jshint -W116 */

@@ -43,4 +43,4 @@ if (nsUri != null) {

}
};
NamespaceScope.prototype.getNamespaceMapping = function (prefix) {
}
getNamespaceMapping(prefix) {
switch (prefix) {

@@ -51,3 +51,3 @@ case 'xml':

prefix: 'xml',
declared: true
declared: true,
};

@@ -58,6 +58,6 @@ case 'xmlns':

prefix: 'xmlns',
declared: true
declared: true,
};
default:
var mapping = this.namespaces[prefix];
const mapping = this.namespaces[prefix];
/*jshint -W116 */

@@ -74,3 +74,3 @@ if (mapping != null) {

}
};
}
/**

@@ -82,3 +82,3 @@ * Look up the namespace prefix by URI

*/
NamespaceScope.prototype.getPrefix = function (nsUri, localOnly) {
getPrefix(nsUri, localOnly) {
switch (nsUri) {

@@ -90,3 +90,3 @@ case 'http://www.w3.org/XML/1998/namespace':

default:
for (var p in this.namespaces) {
for (const p in this.namespaces) {
if (this.namespaces[p].uri === nsUri) {

@@ -103,5 +103,4 @@ return p;

}
};
return NamespaceScope;
}());
}
}
/**

@@ -112,4 +111,4 @@ * Namespace context that manages hierarchical scopes

*/
var NamespaceContext = /** @class */ (function () {
function NamespaceContext() {
class NamespaceContext {
constructor() {
this.scopes = [];

@@ -127,3 +126,3 @@ this.pushContext();

*/
NamespaceContext.prototype.addNamespace = function (prefix, nsUri, localOnly) {
addNamespace(prefix, nsUri, localOnly) {
if (this.getNamespaceURI(prefix, localOnly) === nsUri) {

@@ -136,3 +135,3 @@ return false;

prefix: prefix,
declared: false
declared: false,
};

@@ -142,3 +141,3 @@ return true;

return false;
};
}
/**

@@ -148,8 +147,8 @@ * Push a scope into the context

*/
NamespaceContext.prototype.pushContext = function () {
var scope = new NamespaceScope(this.currentScope);
pushContext() {
const scope = new NamespaceScope(this.currentScope);
this.scopes.push(scope);
this.currentScope = scope;
return scope;
};
}
/**

@@ -159,4 +158,4 @@ * Pop a scope out of the context

*/
NamespaceContext.prototype.popContext = function () {
var scope = this.scopes.pop();
popContext() {
const scope = this.scopes.pop();
if (scope) {

@@ -169,3 +168,3 @@ this.currentScope = scope.parent;

return scope;
};
}
/**

@@ -177,5 +176,5 @@ * Look up the namespace URI by prefix

*/
NamespaceContext.prototype.getNamespaceURI = function (prefix, localOnly) {
getNamespaceURI(prefix, localOnly) {
return this.currentScope && this.currentScope.getNamespaceURI(prefix, localOnly);
};
}
/**

@@ -187,5 +186,5 @@ * Look up the namespace prefix by URI

*/
NamespaceContext.prototype.getPrefix = function (nsUri, localOnly) {
getPrefix(nsUri, localOnly) {
return this.currentScope && this.currentScope.getPrefix(nsUri, localOnly);
};
}
/**

@@ -196,4 +195,4 @@ * Register a namespace

*/
NamespaceContext.prototype.registerNamespace = function (nsUri) {
var prefix = this.getPrefix(nsUri);
registerNamespace(nsUri) {
let prefix = this.getPrefix(nsUri);
if (prefix) {

@@ -215,3 +214,3 @@ // If the namespace has already mapped to a prefix

return prefix;
};
}
/**

@@ -223,5 +222,5 @@ * Declare a namespace prefix/uri mapping

*/
NamespaceContext.prototype.declareNamespace = function (prefix, nsUri) {
declareNamespace(prefix, nsUri) {
if (this.currentScope) {
var mapping = this.currentScope.getNamespaceMapping(prefix);
const mapping = this.currentScope.getNamespaceMapping(prefix);
if (mapping && mapping.uri === nsUri && mapping.declared) {

@@ -233,3 +232,3 @@ return false;

prefix: prefix,
declared: true
declared: true,
};

@@ -239,6 +238,5 @@ return true;

return false;
};
return NamespaceContext;
}());
}
}
exports.NamespaceContext = NamespaceContext;
//# sourceMappingURL=nscontext.js.map
"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BasicAuthSecurity = void 0;
var _ = require("lodash");
var BasicAuthSecurity = /** @class */ (function () {
function BasicAuthSecurity(username, password, defaults) {
const _ = require("lodash");
class BasicAuthSecurity {
constructor(username, password, defaults) {
this._username = username;

@@ -12,14 +12,13 @@ this._password = password;

}
BasicAuthSecurity.prototype.addHeaders = function (headers) {
addHeaders(headers) {
headers.Authorization = 'Basic ' + Buffer.from((this._username + ':' + this._password) || '').toString('base64');
};
BasicAuthSecurity.prototype.toXML = function () {
}
toXML() {
return '';
};
BasicAuthSecurity.prototype.addOptions = function (options) {
}
addOptions(options) {
_.merge(options, this.defaults);
};
return BasicAuthSecurity;
}());
}
}
exports.BasicAuthSecurity = BasicAuthSecurity;
//# sourceMappingURL=BasicAuthSecurity.js.map
"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BearerSecurity = void 0;
var _ = require("lodash");
var BearerSecurity = /** @class */ (function () {
function BearerSecurity(token, defaults) {
const _ = require("lodash");
class BearerSecurity {
constructor(token, defaults) {
this._token = token;

@@ -11,14 +11,13 @@ this.defaults = {};

}
BearerSecurity.prototype.addHeaders = function (headers) {
addHeaders(headers) {
headers.Authorization = 'Bearer ' + this._token;
};
BearerSecurity.prototype.toXML = function () {
}
toXML() {
return '';
};
BearerSecurity.prototype.addOptions = function (options) {
}
addOptions(options) {
_.merge(options, this.defaults);
};
return BearerSecurity;
}());
}
}
exports.BearerSecurity = BearerSecurity;
//# sourceMappingURL=BearerSecurity.js.map
"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClientSSLSecurity = void 0;
var fs = require("fs");
var https = require("https");
var _ = require("lodash");
const fs = require("fs");
const https = require("https");
const _ = require("lodash");
/**

@@ -17,4 +17,4 @@ * activates SSL for an already existing client

*/
var ClientSSLSecurity = /** @class */ (function () {
function ClientSSLSecurity(key, cert, ca, defaults) {
class ClientSSLSecurity {
constructor(key, cert, ca, defaults) {
if (key) {

@@ -58,7 +58,7 @@ if (Buffer.isBuffer(key)) {

}
ClientSSLSecurity.prototype.toXML = function () {
toXML() {
return '';
};
ClientSSLSecurity.prototype.addOptions = function (options) {
var httpsAgent = null;
}
addOptions(options) {
let httpsAgent = null;
options.key = this.key;

@@ -79,6 +79,5 @@ options.cert = this.cert;

options.httpsAgent = httpsAgent;
};
return ClientSSLSecurity;
}());
}
}
exports.ClientSSLSecurity = ClientSSLSecurity;
//# sourceMappingURL=ClientSSLSecurity.js.map
"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClientSSLSecurityPFX = void 0;
var fs = require("fs");
var https = require("https");
var _ = require("lodash");
const fs = require("fs");
const https = require("https");
const _ = require("lodash");
/**

@@ -15,4 +15,4 @@ * activates SSL for an already existing client using a PFX cert

*/
var ClientSSLSecurityPFX = /** @class */ (function () {
function ClientSSLSecurityPFX(pfx, passphrase, defaults) {
class ClientSSLSecurityPFX {
constructor(pfx, passphrase, defaults) {
if (typeof passphrase === 'object') {

@@ -40,6 +40,6 @@ defaults = passphrase;

}
ClientSSLSecurityPFX.prototype.toXML = function () {
toXML() {
return '';
};
ClientSSLSecurityPFX.prototype.addOptions = function (options) {
}
addOptions(options) {
options.pfx = this.pfx;

@@ -51,6 +51,5 @@ if (this.passphrase) {

options.httpsAgent = new https.Agent(options);
};
return ClientSSLSecurityPFX;
}());
}
}
exports.ClientSSLSecurityPFX = ClientSSLSecurityPFX;
//# sourceMappingURL=ClientSSLSecurityPFX.js.map

@@ -8,1 +8,2 @@ export * from './BasicAuthSecurity';

export * from './WSSecurityCert';
export * from './WSSecurityPlusCert';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -10,5 +14,5 @@ if (k2 === undefined) k2 = k;

var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./BasicAuthSecurity"), exports);

@@ -21,2 +25,3 @@ __exportStar(require("./BearerSecurity"), exports);

__exportStar(require("./WSSecurityCert"), exports);
__exportStar(require("./WSSecurityPlusCert"), exports);
//# sourceMappingURL=index.js.map
"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NTLMSecurity = void 0;
var _ = require("lodash");
var NTLMSecurity = /** @class */ (function () {
function NTLMSecurity(username, password, domain, workstation) {
const _ = require("lodash");
class NTLMSecurity {
constructor(username, password, domain, workstation) {
if (typeof username === 'object') {

@@ -17,18 +17,17 @@ this.defaults = username;

domain: domain,
workstation: workstation
workstation: workstation,
};
}
}
NTLMSecurity.prototype.addHeaders = function (headers) {
addHeaders(headers) {
headers.Connection = 'keep-alive';
};
NTLMSecurity.prototype.toXML = function () {
}
toXML() {
return '';
};
NTLMSecurity.prototype.addOptions = function (options) {
}
addOptions(options) {
_.merge(options, this.defaults);
};
return NTLMSecurity;
}());
}
}
exports.NTLMSecurity = NTLMSecurity;
//# sourceMappingURL=NTLMSecurity.js.map
"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.WSSecurity = void 0;
var crypto = require("crypto");
var utils_1 = require("../utils");
var validPasswordTypes = ['PasswordDigest', 'PasswordText'];
var WSSecurity = /** @class */ (function () {
function WSSecurity(username, password, options) {
const crypto = require("crypto");
const utils_1 = require("../utils");
const validPasswordTypes = ['PasswordDigest', 'PasswordText'];
class WSSecurity {
constructor(username, password, options) {
options = options || {};

@@ -40,3 +40,3 @@ this._username = username;

}
WSSecurity.prototype.toXML = function () {
toXML() {
// avoid dependency on date formatting libraries

@@ -54,7 +54,7 @@ function getDate(d) {

}
var now = new Date();
var created = getDate(now);
var timeStampXml = '';
const now = new Date();
const created = getDate(now);
let timeStampXml = '';
if (this._hasTimeStamp) {
var expires = getDate(new Date(now.getTime() + (1000 * 600)));
const expires = getDate(new Date(now.getTime() + (1000 * 600)));
timeStampXml = '<wsu:Timestamp wsu:Id="Timestamp-' + created + '">' +

@@ -65,7 +65,7 @@ '<wsu:Created>' + created + '</wsu:Created>' +

}
var password;
var nonce;
let password;
let nonce;
if (this._hasNonce || this._passwordType !== 'PasswordText') {
// nonce = base64 ( sha1 ( created + random ) )
var nHash = crypto.createHash('sha1');
const nHash = crypto.createHash('sha1');
nHash.update(created + Math.random());

@@ -75,3 +75,3 @@ nonce = nHash.digest('base64');

if (this._passwordType === 'PasswordText') {
password = '<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">' + utils_1.xmlEscape(this._password) + '</wsse:Password>';
password = '<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">' + (0, utils_1.xmlEscape)(this._password) + '</wsse:Password>';
if (nonce) {

@@ -84,11 +84,11 @@ password += '<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">' + nonce + '</wsse:Nonce>';

/* istanbul ignore next */
password = '<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">' + utils_1.passwordDigest(nonce, created, this._password) + '</wsse:Password>' +
password = '<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">' + (0, utils_1.passwordDigest)(nonce, created, this._password) + '</wsse:Password>' +
'<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">' + nonce + '</wsse:Nonce>';
}
return '<wsse:Security ' + (this._actor ? this._envelopeKey + ":actor=\"" + this._actor + "\" " : '') +
(this._mustUnderstand ? this._envelopeKey + ":mustUnderstand=\"1\" " : '') +
return '<wsse:Security ' + (this._actor ? `${this._envelopeKey}:actor="${this._actor}" ` : '') +
(this._mustUnderstand ? `${this._envelopeKey}:mustUnderstand="1" ` : '') +
'xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">' +
timeStampXml +
'<wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="SecurityToken-' + created + '">' +
'<wsse:Username>' + utils_1.xmlEscape(this._username) + '</wsse:Username>' +
'<wsse:Username>' + (0, utils_1.xmlEscape)(this._username) + '</wsse:Username>' +
password +

@@ -98,6 +98,5 @@ (this._hasTokenCreated ? '<wsu:Created>' + created + '</wsu:Created>' : '') +

'</wsse:Security>';
};
return WSSecurity;
}());
}
}
exports.WSSecurity = WSSecurity;
//# sourceMappingURL=WSSecurity.js.map

@@ -17,2 +17,3 @@ import { ISecurity } from '../types';

};
idMode?: 'wssecurity';
}

@@ -19,0 +20,0 @@ export declare class WSSecurityCert implements ISecurity {

"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.WSSecurityCert = void 0;
var uuid_1 = require("uuid");
var xml_crypto_1 = require("xml-crypto");
const uuid_1 = require("uuid");
const xml_crypto_1 = require("xml-crypto");
function addMinutes(date, minutes) {

@@ -24,7 +24,6 @@ return new Date(date.getTime() + minutes * 60000);

function generateId() {
return uuid_1.v4().replace(/-/gm, '');
return (0, uuid_1.v4)().replace(/-/gm, '');
}
function resolvePlaceholderInReferences(references, bodyXpath) {
for (var _i = 0, references_1 = references; _i < references_1.length; _i++) {
var ref = references_1[_i];
for (const ref of references) {
if (ref.xpath === bodyXpathPlaceholder) {

@@ -35,8 +34,6 @@ ref.xpath = bodyXpath;

}
var oasisBaseUri = 'http://docs.oasis-open.org/wss/2004/01';
var bodyXpathPlaceholder = '[[bodyXpath]]';
var WSSecurityCert = /** @class */ (function () {
function WSSecurityCert(privatePEM, publicP12PEM, password, options) {
var _this = this;
if (options === void 0) { options = {}; }
const oasisBaseUri = 'http://docs.oasis-open.org/wss/2004/01';
const bodyXpathPlaceholder = '[[bodyXpath]]';
class WSSecurityCert {
constructor(privatePEM, publicP12PEM, password, options = {}) {
this.signerOptions = {};

@@ -48,3 +45,3 @@ this.additionalReferences = [];

.replace(/(\r\n|\n|\r)/gm, '');
this.signer = new xml_crypto_1.SignedXml();
this.signer = new xml_crypto_1.SignedXml(options?.signerOptions?.idMode);
if (options.signatureAlgorithm === 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256') {

@@ -58,3 +55,3 @@ this.signer.signatureAlgorithm = options.signatureAlgorithm;

if (options.signerOptions) {
var signerOptions = options.signerOptions;
const { signerOptions } = options;
this.signerOptions = signerOptions;

@@ -65,13 +62,13 @@ if (!this.signerOptions.existingPrefixes) {

if (this.signerOptions.existingPrefixes && !this.signerOptions.existingPrefixes.wsse) {
this.signerOptions.existingPrefixes.wsse = oasisBaseUri + "/oasis-200401-wss-wssecurity-secext-1.0.xsd";
this.signerOptions.existingPrefixes.wsse = `${oasisBaseUri}/oasis-200401-wss-wssecurity-secext-1.0.xsd`;
}
}
else {
this.signerOptions = { existingPrefixes: { wsse: oasisBaseUri + "/oasis-200401-wss-wssecurity-secext-1.0.xsd" } };
this.signerOptions = { existingPrefixes: { wsse: `${oasisBaseUri}/oasis-200401-wss-wssecurity-secext-1.0.xsd` } };
}
this.signer.signingKey = {
key: privatePEM,
passphrase: password
passphrase: password,
};
this.x509Id = "x509-" + generateId();
this.x509Id = `x509-${generateId()}`;
this.hasTimeStamp = typeof options.hasTimeStamp === 'undefined' ? true : !!options.hasTimeStamp;

@@ -81,56 +78,77 @@ this.signatureTransformations = Array.isArray(options.signatureTransformations) ? options.signatureTransformations

this.signer.keyInfoProvider = {};
this.signer.keyInfoProvider.getKeyInfo = function (key) {
return "<wsse:SecurityTokenReference>" +
("<wsse:Reference URI=\"#" + _this.x509Id + "\" ValueType=\"" + oasisBaseUri + "/oasis-200401-wss-x509-token-profile-1.0#X509v3\"/>") +
"</wsse:SecurityTokenReference>";
this.signer.keyInfoProvider.getKeyInfo = (key) => {
return `<wsse:SecurityTokenReference>` +
`<wsse:Reference URI="#${this.x509Id}" ValueType="${oasisBaseUri}/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>` +
`</wsse:SecurityTokenReference>`;
};
}
WSSecurityCert.prototype.postProcess = function (xml, envelopeKey) {
postProcess(xml, envelopeKey) {
this.created = generateCreated();
this.expires = generateExpires();
var timestampStr = '';
let timestampStr = '';
if (this.hasTimeStamp) {
timestampStr =
"<Timestamp xmlns=\"" + oasisBaseUri + "/oasis-200401-wss-wssecurity-utility-1.0.xsd\" Id=\"_1\">" +
("<Created>" + this.created + "</Created>") +
("<Expires>" + this.expires + "</Expires>") +
"</Timestamp>";
`<Timestamp xmlns="${oasisBaseUri}/oasis-200401-wss-wssecurity-utility-1.0.xsd" Id="_1">` +
`<Created>${this.created}</Created>` +
`<Expires>${this.expires}</Expires>` +
`</Timestamp>`;
}
var secHeader = "<wsse:Security xmlns:wsse=\"" + oasisBaseUri + "/oasis-200401-wss-wssecurity-secext-1.0.xsd\" " +
("xmlns:wsu=\"" + oasisBaseUri + "/oasis-200401-wss-wssecurity-utility-1.0.xsd\" ") +
(envelopeKey + ":mustUnderstand=\"1\">") +
"<wsse:BinarySecurityToken " +
("EncodingType=\"" + oasisBaseUri + "/oasis-200401-wss-soap-message-security-1.0#Base64Binary\" ") +
("ValueType=\"" + oasisBaseUri + "/oasis-200401-wss-x509-token-profile-1.0#X509v3\" ") +
("wsu:Id=\"" + this.x509Id + "\">" + this.publicP12PEM + "</wsse:BinarySecurityToken>") +
timestampStr +
"</wsse:Security>";
var xmlWithSec = insertStr(secHeader, xml, xml.indexOf("</" + envelopeKey + ":Header>"));
var references = this.signatureTransformations;
var bodyXpath = "//*[name(.)='" + envelopeKey + ":Body']";
const binarySecurityToken = `<wsse:BinarySecurityToken ` +
`EncodingType="${oasisBaseUri}/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ` +
`ValueType="${oasisBaseUri}/oasis-200401-wss-x509-token-profile-1.0#X509v3" ` +
`wsu:Id="${this.x509Id}">${this.publicP12PEM}</wsse:BinarySecurityToken>` +
timestampStr;
let xmlWithSec;
const secExt = `xmlns:wsse="${oasisBaseUri}/oasis-200401-wss-wssecurity-secext-1.0.xsd"`;
const secUtility = `xmlns:wsu="${oasisBaseUri}/oasis-200401-wss-wssecurity-utility-1.0.xsd"`;
const endOfSecurityHeader = xml.indexOf('</wsse:Security>');
if (endOfSecurityHeader > -1) {
const securityHeaderRegexp = /<wsse:Security( [^>]*)?>/;
const match = xml.match(securityHeaderRegexp);
let insertHeaderAttributes = '';
if (!match[0].includes(` ${envelopeKey}:mustUnderstand="`)) {
insertHeaderAttributes += `${envelopeKey}:mustUnderstand="1" `;
}
if (!match[0].includes(secExt.substring(0, secExt.indexOf('=')))) {
insertHeaderAttributes += `${secExt} `;
}
if (!match[0].includes(secUtility.substring(0, secExt.indexOf('=')))) {
insertHeaderAttributes += `${secUtility} `;
}
const headerMarker = '<wsse:Security ';
const startOfSecurityHeader = xml.indexOf(headerMarker);
xml = insertStr(binarySecurityToken, xml, endOfSecurityHeader);
xmlWithSec = insertStr(insertHeaderAttributes, xml, startOfSecurityHeader + headerMarker.length);
}
else {
const secHeader = `<wsse:Security ${secExt} ` +
secUtility +
`${envelopeKey}:mustUnderstand="1">` +
binarySecurityToken +
`</wsse:Security>`;
xmlWithSec = insertStr(secHeader, xml, xml.indexOf(`</${envelopeKey}:Header>`));
}
const references = this.signatureTransformations;
const bodyXpath = `//*[name(.)='${envelopeKey}:Body']`;
resolvePlaceholderInReferences(this.signer.references, bodyXpath);
if (!(this.signer.references.filter(function (ref) { return (ref.xpath === bodyXpath); }).length > 0)) {
if (!(this.signer.references.filter((ref) => (ref.xpath === bodyXpath)).length > 0)) {
this.signer.addReference(bodyXpath, references);
}
var _loop_1 = function (name_1) {
var xpath = "//*[name(.)='" + name_1 + "']";
if (!(this_1.signer.references.filter(function (ref) { return (ref.xpath === xpath); }).length > 0)) {
this_1.signer.addReference(xpath, references);
for (const name of this.additionalReferences) {
const xpath = `//*[name(.)='${name}']`;
if (!(this.signer.references.filter((ref) => (ref.xpath === xpath)).length > 0)) {
this.signer.addReference(xpath, references);
}
};
var this_1 = this;
for (var _i = 0, _a = this.additionalReferences; _i < _a.length; _i++) {
var name_1 = _a[_i];
_loop_1(name_1);
}
var timestampXpath = "//*[name(.)='wsse:Security']/*[local-name(.)='Timestamp']";
if (this.hasTimeStamp && !(this.signer.references.filter(function (ref) { return (ref.xpath === timestampXpath); }).length > 0)) {
const timestampXpath = `//*[name(.)='wsse:Security']/*[local-name(.)='Timestamp']`;
if (this.hasTimeStamp && !(this.signer.references.filter((ref) => (ref.xpath === timestampXpath)).length > 0)) {
this.signer.addReference(timestampXpath, references);
}
this.signer.computeSignature(xmlWithSec, this.signerOptions);
return insertStr(this.signer.getSignatureXml(), xmlWithSec, xmlWithSec.indexOf('</wsse:Security>'));
};
return WSSecurityCert;
}());
const originalXmlWithIds = this.signer.getOriginalXmlWithIds();
const signatureXml = this.signer.getSignatureXml();
return insertStr(signatureXml, originalXmlWithIds, originalXmlWithIds.indexOf('</wsse:Security>'));
}
}
exports.WSSecurityCert = WSSecurityCert;
//# sourceMappingURL=WSSecurityCert.js.map
/// <reference types="node" />
/// <reference types="node" />
import { EventEmitter } from 'events';

@@ -3,0 +4,0 @@ import * as http from 'http';

@@ -6,21 +6,8 @@ "use strict";

*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Server = void 0;
var events_1 = require("events");
var url = require("url");
var utils_1 = require("./utils");
var zlib;
const events_1 = require("events");
const url = require("url");
const utils_1 = require("./utils");
let zlib;
try {

@@ -48,19 +35,18 @@ zlib = require('zlib');

}
var Server = /** @class */ (function (_super) {
__extends(Server, _super);
function Server(server, path, services, wsdl, options) {
var _this_1 = _super.call(this) || this;
class Server extends events_1.EventEmitter {
constructor(server, path, services, wsdl, options) {
super();
options = options || {
path: path,
services: services
services: services,
};
_this_1.path = path;
_this_1.services = services;
_this_1.wsdl = wsdl;
_this_1.suppressStack = options && options.suppressStack;
_this_1.returnFault = options && options.returnFault;
_this_1.onewayOptions = options && options.oneWay || {};
_this_1.enableChunkedEncoding =
this.path = path;
this.services = services;
this.wsdl = wsdl;
this.suppressStack = options && options.suppressStack;
this.returnFault = options && options.returnFault;
this.onewayOptions = options && options.oneWay || {};
this.enableChunkedEncoding =
options.enableChunkedEncoding === undefined ? true : !!options.enableChunkedEncoding;
_this_1.callback = options.callback ? options.callback : function () { };
this.callback = options.callback ? options.callback : () => { };
if (typeof path === 'string' && path[path.length - 1] !== '/') {

@@ -72,8 +58,8 @@ path += '/';

}
wsdl.onReady(function (err) {
wsdl.onReady((err) => {
if (isExpress(server)) {
// handle only the required URL path for express server
server.route(path).all(function (req, res) {
if (typeof _this_1.authorizeConnection === 'function') {
if (!_this_1.authorizeConnection(req, res)) {
server.route(path).all((req, res) => {
if (typeof this.authorizeConnection === 'function') {
if (!this.authorizeConnection(req, res)) {
res.end();

@@ -83,12 +69,12 @@ return;

}
_this_1._requestListener(req, res);
this._requestListener(req, res);
});
_this_1.callback(err, _this_1);
this.callback(err, this);
}
else {
var listeners_1 = server.listeners('request').slice();
const listeners = server.listeners('request').slice();
server.removeAllListeners('request');
server.addListener('request', function (req, res) {
if (typeof _this_1.authorizeConnection === 'function') {
if (!_this_1.authorizeConnection(req, res)) {
server.addListener('request', (req, res) => {
if (typeof this.authorizeConnection === 'function') {
if (!this.authorizeConnection(req, res)) {
res.end();

@@ -98,3 +84,3 @@ return;

}
var reqPath = url.parse(req.url).pathname;
let reqPath = url.parse(req.url).pathname;
if (reqPath[reqPath.length - 1] !== '/') {

@@ -104,17 +90,16 @@ reqPath += '/';

if (path === reqPath || (path instanceof RegExp && reqPath.match(path))) {
_this_1._requestListener(req, res);
this._requestListener(req, res);
}
else {
for (var i = 0, len = listeners_1.length; i < len; i++) {
listeners_1[i].call(_this_1, req, res);
for (let i = 0, len = listeners.length; i < len; i++) {
listeners[i].call(this, req, res);
}
}
});
_this_1.callback(err, _this_1);
this.callback(err, this);
}
});
_this_1._initializeOptions(options);
return _this_1;
this._initializeOptions(options);
}
Server.prototype.addSoapHeader = function (soapHeader, name, namespace, xmlns) {
addSoapHeader(soapHeader, name, namespace, xmlns) {
if (!this.soapHeaders) {

@@ -125,4 +110,4 @@ this.soapHeaders = [];

return this.soapHeaders.push(soapHeader) - 1;
};
Server.prototype.changeSoapHeader = function (index, soapHeader, name, namespace, xmlns) {
}
changeSoapHeader(index, soapHeader, name, namespace, xmlns) {
if (!this.soapHeaders) {

@@ -133,10 +118,10 @@ this.soapHeaders = [];

this.soapHeaders[index] = soapHeader;
};
Server.prototype.getSoapHeaders = function () {
}
getSoapHeaders() {
return this.soapHeaders;
};
Server.prototype.clearSoapHeaders = function () {
}
clearSoapHeaders() {
this.soapHeaders = null;
};
Server.prototype._processSoapHeader = function (soapHeader, name, namespace, xmlns) {
}
_processSoapHeader(soapHeader, name, namespace, xmlns) {
switch (typeof soapHeader) {

@@ -146,9 +131,9 @@ case 'object':

case 'function':
var _this_2 = this;
const _this = this;
// arrow function does not support arguments variable
// tslint:disable-next-line
return function () {
var result = soapHeader.apply(null, arguments);
const result = soapHeader.apply(null, arguments);
if (typeof result === 'object') {
return _this_2.wsdl.objectToXML(result, name, namespace, xmlns, true);
return _this.wsdl.objectToXML(result, name, namespace, xmlns, true);
}

@@ -162,11 +147,10 @@ else {

}
};
Server.prototype._initializeOptions = function (options) {
}
_initializeOptions(options) {
this.wsdl.options.attributesKey = options.attributesKey || 'attributes';
this.onewayOptions.statusCode = this.onewayOptions.responseCode || 200;
this.onewayOptions.emptyBody = !!this.onewayOptions.emptyBody;
};
Server.prototype._processRequestXml = function (req, res, xml) {
var _this_1 = this;
var error;
}
_processRequestXml(req, res, xml) {
let error;
try {

@@ -176,6 +160,6 @@ if (typeof this.log === 'function') {

}
this._process(xml, req, res, function (result, statusCode) {
_this_1._sendHttpResponse(res, statusCode, result);
if (typeof _this_1.log === 'function') {
_this_1.log('replied', result);
this._process(xml, req, res, (result, statusCode) => {
this._sendHttpResponse(res, statusCode, result);
if (typeof this.log === 'function') {
this.log('replied', result);
}

@@ -186,6 +170,6 @@ });

if (err.Fault !== undefined) {
return this._sendError(err.Fault, function (result, statusCode) {
_this_1._sendHttpResponse(res, statusCode || 500, result);
if (typeof _this_1.log === 'function') {
_this_1.log('error', err);
return this._sendError(err.Fault, (result, statusCode) => {
this._sendHttpResponse(res, statusCode || 500, result);
if (typeof this.log === 'function') {
this.log('error', err);
}

@@ -202,8 +186,7 @@ }, new Date().toISOString());

}
};
Server.prototype._requestListener = function (req, res) {
var _this_1 = this;
var reqParse = url.parse(req.url);
var reqPath = reqParse.pathname;
var reqQuery = reqParse.search;
}
_requestListener(req, res) {
const reqParse = url.parse(req.url);
const reqPath = reqParse.pathname;
const reqQuery = reqParse.search;
if (typeof this.log === 'function') {

@@ -234,5 +217,5 @@ this.log('info', 'Handling ' + req.method + ' on ' + req.url);

}
var chunks_1 = [];
var gunzip = void 0;
var source = req;
const chunks = [];
let gunzip;
let source = req;
if (req.headers['content-encoding'] === 'gzip') {

@@ -243,8 +226,8 @@ gunzip = zlib.createGunzip();

}
source.on('data', function (chunk) {
chunks_1.push(chunk);
source.on('data', (chunk) => {
chunks.push(chunk);
});
source.on('end', function () {
var xml = Buffer.concat(chunks_1).toString();
_this_1._processRequestXml(req, res, xml);
source.on('end', () => {
const xml = Buffer.concat(chunks).toString();
this._processRequestXml(req, res, xml);
});

@@ -255,32 +238,31 @@ }

}
};
Server.prototype._getSoapAction = function (req) {
}
_getSoapAction(req) {
if (typeof req.headers.soapaction === 'undefined') {
return;
}
var soapAction = req.headers.soapaction;
const soapAction = req.headers.soapaction;
return (soapAction.indexOf('"') === 0)
? soapAction.slice(1, -1)
: soapAction;
};
Server.prototype._process = function (input, req, res, cb) {
var _this_1 = this;
var pathname = url.parse(req.url).pathname.replace(/\/$/, '');
var obj = this.wsdl.xmlToObject(input);
var body = obj.Body;
var headers = obj.Header;
var binding;
var methodName;
var serviceName;
var portName;
var includeTimestamp = obj.Header && obj.Header.Security && obj.Header.Security.Timestamp;
var authenticate = this.authenticate || function defaultAuthenticate() { return true; };
var callback = function (result, statusCode) {
var response = { result: result };
_this_1.emit('response', response, methodName);
}
_process(input, req, res, cb) {
const pathname = url.parse(req.url).pathname.replace(/\/$/, '');
const obj = this.wsdl.xmlToObject(input);
const body = obj.Body;
const headers = obj.Header;
let binding;
let methodName;
let serviceName;
let portName;
const includeTimestamp = obj.Header && obj.Header.Security && obj.Header.Security.Timestamp;
const authenticate = this.authenticate || function defaultAuthenticate() { return true; };
const callback = (result, statusCode) => {
const response = { result: result };
this.emit('response', response, methodName);
cb(response.result, statusCode);
};
var process = function () {
if (typeof _this_1.log === 'function') {
_this_1.log('info', 'Attempting to bind to ' + pathname);
const process = () => {
if (typeof this.log === 'function') {
this.log('info', 'Attempting to bind to ' + pathname);
}

@@ -293,16 +275,16 @@ // Avoid Cannot convert undefined or null to object due to Object.keys(body)

// use port.location and current url to find the right binding
binding = (function () {
var services = _this_1.wsdl.definitions.services;
var firstPort;
var name;
binding = (() => {
const services = this.wsdl.definitions.services;
let firstPort;
let name;
for (name in services) {
serviceName = name;
var service = services[serviceName];
var ports = service.ports;
const service = services[serviceName];
const ports = service.ports;
for (name in ports) {
portName = name;
var port = ports[portName];
var portPathname = url.parse(port.location).pathname.replace(/\/$/, '');
if (typeof _this_1.log === 'function') {
_this_1.log('info', 'Trying ' + portName + ' from path ' + portPathname);
const port = ports[portName];
const portPathname = url.parse(port.location).pathname.replace(/\/$/, '');
if (typeof this.log === 'function') {
this.log('info', 'Trying ' + portName + ' from path ' + portPathname);
}

@@ -324,7 +306,7 @@ if (portPathname === pathname) {

try {
var soapAction = _this_1._getSoapAction(req);
var messageElemName = (Object.keys(body)[0] === 'attributes' ? Object.keys(body)[1] : Object.keys(body)[0]);
var pair = binding.topElements[messageElemName];
const soapAction = this._getSoapAction(req);
const messageElemName = (Object.keys(body)[0] === 'attributes' ? Object.keys(body)[1] : Object.keys(body)[0]);
const pair = binding.topElements[messageElemName];
if (soapAction) {
methodName = _this_1._getMethodNameBySoapAction(binding, soapAction);
methodName = this._getMethodNameBySoapAction(binding, soapAction);
}

@@ -335,9 +317,9 @@ else {

/** Style can be defined in method. If method has no style then look in binding */
var style = binding.methods[methodName].style || binding.style;
_this_1.emit('request', obj, methodName);
const style = binding.methods[methodName].style || binding.style;
this.emit('request', obj, methodName);
if (headers) {
_this_1.emit('headers', headers, methodName);
this.emit('headers', headers, methodName);
}
if (style === 'rpc') {
_this_1._executeMethod({
this._executeMethod({
serviceName: serviceName,

@@ -349,7 +331,7 @@ portName: portName,

headers: headers,
style: 'rpc'
style: 'rpc',
}, req, res, callback);
}
else {
_this_1._executeMethod({
this._executeMethod({
serviceName: serviceName,

@@ -361,3 +343,3 @@ portName: portName,

headers: headers,
style: 'document'
style: 'document',
}, req, res, callback, includeTimestamp);

@@ -368,3 +350,3 @@ }

if (error.Fault !== undefined) {
return _this_1._sendError(error.Fault, callback, includeTimestamp);
return this._sendError(error.Fault, callback, includeTimestamp);
}

@@ -376,17 +358,17 @@ throw error;

if (typeof authenticate === 'function') {
var authResultProcessed_1 = false;
var processAuthResult_1 = function (authResult) {
if (authResultProcessed_1) {
let authResultProcessed = false;
const processAuthResult = (authResult) => {
if (authResultProcessed) {
return;
}
authResultProcessed_1 = true;
authResultProcessed = true;
// Handle errors
if (authResult instanceof Error) {
return _this_1._sendError({
return this._sendError({
Code: {
Value: 'SOAP-ENV:Server',
Subcode: { Value: 'InternalServerError' }
Subcode: { Value: 'InternalServerError' },
},
Reason: { Text: authResult.toString() },
statusCode: 500
statusCode: 500,
}, callback, includeTimestamp);

@@ -402,11 +384,11 @@ }

if (error.Fault !== undefined) {
return _this_1._sendError(error.Fault, callback, includeTimestamp);
return this._sendError(error.Fault, callback, includeTimestamp);
}
return _this_1._sendError({
return this._sendError({
Code: {
Value: 'SOAP-ENV:Server',
Subcode: { Value: 'InternalServerError' }
Subcode: { Value: 'InternalServerError' },
},
Reason: { Text: error.toString() },
statusCode: 500
statusCode: 500,
}, callback, includeTimestamp);

@@ -416,9 +398,9 @@ }

else {
return _this_1._sendError({
return this._sendError({
Code: {
Value: 'SOAP-ENV:Client',
Subcode: { Value: 'AuthenticationFailure' }
Subcode: { Value: 'AuthenticationFailure' },
},
Reason: { Text: 'Invalid username or password' },
statusCode: 401
statusCode: 401,
}, callback, includeTimestamp);

@@ -428,12 +410,12 @@ }

};
var functionResult = authenticate(obj.Header && obj.Header.Security, processAuthResult_1, req, obj);
const functionResult = authenticate(obj.Header && obj.Header.Security, processAuthResult, req, obj);
if (isPromiseLike(functionResult)) {
functionResult.then(function (result) {
processAuthResult_1(result);
}, function (err) {
processAuthResult_1(err);
functionResult.then((result) => {
processAuthResult(result);
}, (err) => {
processAuthResult(err);
});
}
if (typeof functionResult === 'boolean') {
processAuthResult_1(functionResult);
processAuthResult(functionResult);
}

@@ -444,5 +426,5 @@ }

}
};
Server.prototype._getMethodNameBySoapAction = function (binding, soapAction) {
for (var methodName in binding.methods) {
}
_getMethodNameBySoapAction(binding, soapAction) {
for (const methodName in binding.methods) {
if (binding.methods[methodName].soapAction === soapAction) {

@@ -452,20 +434,19 @@ return methodName;

}
};
Server.prototype._executeMethod = function (options, req, res, callback, includeTimestamp) {
var _this_1 = this;
}
_executeMethod(options, req, res, callback, includeTimestamp) {
options = options || {};
var method;
var body;
var headers;
var serviceName = options.serviceName;
var portName = options.portName;
var binding = this.wsdl.definitions.services[serviceName].ports[portName].binding;
var methodName = options.methodName;
var outputName = options.outputName;
var args = options.args;
var style = options.style;
let method;
let body;
let headers;
const serviceName = options.serviceName;
const portName = options.portName;
const binding = this.wsdl.definitions.services[serviceName].ports[portName].binding;
const methodName = options.methodName;
const outputName = options.outputName;
const args = options.args;
const style = options.style;
if (this.soapHeaders) {
headers = this.soapHeaders.map(function (header) {
headers = this.soapHeaders.map((header) => {
if (typeof header === 'function') {
return header(methodName, args, options.headers, req, res, _this_1);
return header(methodName, args, options.headers, req, res, this);
}

@@ -483,4 +464,4 @@ else {

}
var handled = false;
var handleResult = function (error, result) {
let handled = false;
const handleResult = (error, result) => {
if (handled) {

@@ -492,12 +473,12 @@ return;

if (error.Fault !== undefined) {
return _this_1._sendError(error.Fault, callback, includeTimestamp);
return this._sendError(error.Fault, callback, includeTimestamp);
}
else {
return _this_1._sendError({
return this._sendError({
Code: {
Value: 'SOAP-ENV:Server',
Subcode: { Value: 'InternalServerError' }
Subcode: { Value: 'InternalServerError' },
},
Reason: { Text: error.toString() },
statusCode: 500
statusCode: 500,
}, callback, includeTimestamp);

@@ -507,20 +488,20 @@ }

if (style === 'rpc') {
body = _this_1.wsdl.objectToRpcXML(outputName, result, '', _this_1.wsdl.definitions.$targetNamespace);
body = this.wsdl.objectToRpcXML(outputName, result, '', this.wsdl.definitions.$targetNamespace);
}
else if (style === 'document') {
var element = binding.methods[methodName].output;
body = _this_1.wsdl.objectToDocumentXML(outputName, result, element.targetNSAlias, element.targetNamespace);
const element = binding.methods[methodName].output;
body = this.wsdl.objectToDocumentXML(outputName, result, element.targetNSAlias, element.targetNamespace);
}
else {
var element = binding.methods[methodName].output;
const element = binding.methods[methodName].output;
// Check for targetNamespace on the element
var elementTargetNamespace = element.$targetNamespace;
var outputNameWithNamespace = outputName;
const elementTargetNamespace = element.$targetNamespace;
let outputNameWithNamespace = outputName;
if (elementTargetNamespace) {
// if targetNamespace is set on the element concatinate it with the outputName
outputNameWithNamespace = elementTargetNamespace + ":" + outputNameWithNamespace;
outputNameWithNamespace = `${elementTargetNamespace}:${outputNameWithNamespace}`;
}
body = _this_1.wsdl.objectToDocumentXML(outputNameWithNamespace, result, element.targetNSAlias, element.targetNamespace);
body = this.wsdl.objectToDocumentXML(outputNameWithNamespace, result, element.targetNSAlias, element.targetNamespace);
}
callback(_this_1._envelope(body, headers, includeTimestamp));
callback(this._envelope(body, headers, includeTimestamp));
};

@@ -536,3 +517,3 @@ if (!binding.methods[methodName].output) {

}
var methodCallback = function (error, result) {
const methodCallback = (error, result) => {
if (error && error.Fault !== undefined) {

@@ -548,8 +529,8 @@ // do nothing

};
var result = method(args, methodCallback, options.headers, req, res, this);
const result = method(args, methodCallback, options.headers, req, res, this);
if (typeof result !== 'undefined') {
if (isPromiseLike(result)) {
result.then(function (value) {
result.then((value) => {
handleResult(null, value);
}, function (err) {
}, (err) => {
handleResult(err);

@@ -562,12 +543,12 @@ });

}
};
Server.prototype._envelope = function (body, headers, includeTimestamp) {
var defs = this.wsdl.definitions;
var ns = defs.$targetNamespace;
var encoding = '';
var alias = utils_1.findPrefix(defs.xmlns, ns);
var envelopeDefinition = this.wsdl.options.forceSoap12Headers
}
_envelope(body, headers, includeTimestamp) {
const defs = this.wsdl.definitions;
const ns = defs.$targetNamespace;
const encoding = '';
const alias = (0, utils_1.findPrefix)(defs.xmlns, ns);
const envelopeDefinition = this.wsdl.options.forceSoap12Headers
? 'http://www.w3.org/2003/05/soap-envelope'
: 'http://schemas.xmlsoap.org/soap/envelope/';
var xml = '<?xml version="1.0" encoding="utf-8"?>' +
let xml = '<?xml version="1.0" encoding="utf-8"?>' +
'<soap:Envelope xmlns:soap="' + envelopeDefinition + '" ' +

@@ -578,5 +559,5 @@ encoding +

if (includeTimestamp) {
var now = new Date();
var created = getDateString(now);
var expires = getDateString(new Date(now.getTime() + (1000 * 600)));
const now = new Date();
const created = getDateString(now);
const expires = getDateString(new Date(now.getTime() + (1000 * 600)));
headers += '<o:Security soap:mustUnderstand="1" ' +

@@ -597,6 +578,6 @@ 'xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" ' +

return xml;
};
Server.prototype._sendError = function (soapFault, callback, includeTimestamp) {
var fault;
var statusCode;
}
_sendError(soapFault, callback, includeTimestamp) {
let fault;
let statusCode;
if (soapFault.statusCode) {

@@ -619,4 +600,4 @@ statusCode = soapFault.statusCode;

return callback(this._envelope(fault, '', includeTimestamp), statusCode);
};
Server.prototype._sendHttpResponse = function (res, statusCode, result) {
}
_sendHttpResponse(res, statusCode, result) {
if (statusCode) {

@@ -638,6 +619,5 @@ res.statusCode = statusCode;

}
};
return Server;
}(events_1.EventEmitter));
}
}
exports.Server = Server;
//# sourceMappingURL=server.js.map

@@ -8,3 +8,3 @@ import { Client } from './client';

export { HttpClient } from './http';
export { BasicAuthSecurity, BearerSecurity, ClientSSLSecurity, ClientSSLSecurityPFX, NTLMSecurity, WSSecurity, WSSecurityCert } from './security';
export { BasicAuthSecurity, BearerSecurity, ClientSSLSecurity, ClientSSLSecurityPFX, NTLMSecurity, WSSecurity, WSSecurityCert, WSSecurityPlusCert } from './security';
export { Server } from './server';

@@ -11,0 +11,0 @@ export { passwordDigest } from './utils';

@@ -8,3 +8,7 @@ "use strict";

if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -15,37 +19,38 @@ if (k2 === undefined) k2 = k;

var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
exports.__esModule = true;
exports.listen = exports.createClientAsync = exports.createClient = exports.security = void 0;
var debugBuilder = require("debug");
var client_1 = require("./client");
var _security = require("./security");
var server_1 = require("./server");
var wsdl_1 = require("./wsdl");
var debug = debugBuilder('node-soap:soap');
Object.defineProperty(exports, "__esModule", { value: true });
exports.listen = exports.createClientAsync = exports.createClient = exports.WSDL = exports.passwordDigest = exports.Server = exports.WSSecurityPlusCert = exports.WSSecurityCert = exports.WSSecurity = exports.NTLMSecurity = exports.ClientSSLSecurityPFX = exports.ClientSSLSecurity = exports.BearerSecurity = exports.BasicAuthSecurity = exports.HttpClient = exports.Client = exports.security = void 0;
const debugBuilder = require("debug");
const client_1 = require("./client");
const _security = require("./security");
const server_1 = require("./server");
const wsdl_1 = require("./wsdl");
const debug = debugBuilder('node-soap:soap');
exports.security = _security;
var client_2 = require("./client");
__createBinding(exports, client_2, "Client");
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return client_2.Client; } });
var http_1 = require("./http");
__createBinding(exports, http_1, "HttpClient");
Object.defineProperty(exports, "HttpClient", { enumerable: true, get: function () { return http_1.HttpClient; } });
var security_1 = require("./security");
__createBinding(exports, security_1, "BasicAuthSecurity");
__createBinding(exports, security_1, "BearerSecurity");
__createBinding(exports, security_1, "ClientSSLSecurity");
__createBinding(exports, security_1, "ClientSSLSecurityPFX");
__createBinding(exports, security_1, "NTLMSecurity");
__createBinding(exports, security_1, "WSSecurity");
__createBinding(exports, security_1, "WSSecurityCert");
Object.defineProperty(exports, "BasicAuthSecurity", { enumerable: true, get: function () { return security_1.BasicAuthSecurity; } });
Object.defineProperty(exports, "BearerSecurity", { enumerable: true, get: function () { return security_1.BearerSecurity; } });
Object.defineProperty(exports, "ClientSSLSecurity", { enumerable: true, get: function () { return security_1.ClientSSLSecurity; } });
Object.defineProperty(exports, "ClientSSLSecurityPFX", { enumerable: true, get: function () { return security_1.ClientSSLSecurityPFX; } });
Object.defineProperty(exports, "NTLMSecurity", { enumerable: true, get: function () { return security_1.NTLMSecurity; } });
Object.defineProperty(exports, "WSSecurity", { enumerable: true, get: function () { return security_1.WSSecurity; } });
Object.defineProperty(exports, "WSSecurityCert", { enumerable: true, get: function () { return security_1.WSSecurityCert; } });
Object.defineProperty(exports, "WSSecurityPlusCert", { enumerable: true, get: function () { return security_1.WSSecurityPlusCert; } });
var server_2 = require("./server");
__createBinding(exports, server_2, "Server");
Object.defineProperty(exports, "Server", { enumerable: true, get: function () { return server_2.Server; } });
var utils_1 = require("./utils");
__createBinding(exports, utils_1, "passwordDigest");
Object.defineProperty(exports, "passwordDigest", { enumerable: true, get: function () { return utils_1.passwordDigest; } });
__exportStar(require("./types"), exports);
var wsdl_2 = require("./wsdl");
__createBinding(exports, wsdl_2, "WSDL");
Object.defineProperty(exports, "WSDL", { enumerable: true, get: function () { return wsdl_2.WSDL; } });
function createCache() {
var cache = {};
return function (key, load, callback) {
const cache = {};
return (key, load, callback) => {
if (!cache[key]) {
load(function (err, result) {
load((err, result) => {
if (err) {

@@ -59,3 +64,3 @@ return callback(err);

else {
process.nextTick(function () {
process.nextTick(() => {
callback(null, cache[key]);

@@ -66,3 +71,3 @@ });

}
var getFromCache = createCache();
const getFromCache = createCache();
function _requestWSDL(url, options, callback) {

@@ -73,4 +78,4 @@ if (typeof options === 'function') {

}
var openWsdl = function (callback) {
wsdl_1.open_wsdl(url, options, callback);
const openWsdl = (callback) => {
(0, wsdl_1.open_wsdl)(url, options, callback);
};

@@ -85,5 +90,5 @@ if (options.disableCache === true) {

function createClient(url, p2, p3, p4) {
var endpoint = p4;
var callback;
var options;
let endpoint = p4;
let callback;
let options;
if (typeof p2 === 'function') {

@@ -100,3 +105,3 @@ callback = p2;

endpoint = options.endpoint || endpoint;
_requestWSDL(url, options, function (err, wsdl) {
_requestWSDL(url, options, (err, wsdl) => {
callback(err, wsdl && new client_1.Client(wsdl, endpoint, options));

@@ -110,4 +115,4 @@ });

}
return new Promise(function (resolve, reject) {
createClient(url, options, function (err, client) {
return new Promise((resolve, reject) => {
createClient(url, options, (err, client) => {
if (err) {

@@ -122,5 +127,5 @@ reject(err);

function listen(server, p2, services, xml, callback) {
var options;
var path;
var uri = '';
let options;
let path;
let uri = '';
if (typeof p2 === 'object' && !(p2 instanceof RegExp)) {

@@ -142,6 +147,6 @@ // p2 is options

services: services,
callback: callback
callback: callback,
};
}
var wsdl = new wsdl_1.WSDL(xml || services, uri, options);
const wsdl = new wsdl_1.WSDL(xml || services, uri, options);
return new server_1.Server(server, path, services, wsdl, options);

@@ -148,0 +153,0 @@ }

/// <reference types="node" />
/// <reference types="node" />
import * as req from 'axios';

@@ -3,0 +4,0 @@ import { ReadStream } from 'fs';

"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map

@@ -20,2 +20,2 @@ /// <reference types="node" />

export declare function xmlEscape(obj: any): any;
export declare function parseMTOMResp(payload: Buffer, boundary: string): IMTOMAttachments;
export declare function parseMTOMResp(payload: Buffer, boundary: string, callback: (err?: Error, resp?: IMTOMAttachments) => void): Promise<void>;
"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseMTOMResp = exports.xmlEscape = exports.splitQName = exports.findPrefix = exports.TNS_PREFIX = exports.passwordDigest = void 0;
var crypto = require("crypto");
var formidable_1 = require("formidable");
const crypto = require("crypto");
function passwordDigest(nonce, created, password) {
// digest = base64 ( sha1 ( nonce + created + password ) )
var pwHash = crypto.createHash('sha1');
var NonceBytes = Buffer.from(nonce || '', 'base64');
var CreatedBytes = Buffer.from(created || '', 'utf8');
var PasswordBytes = Buffer.from(password || '', 'utf8');
var FullBytes = Buffer.concat([NonceBytes, CreatedBytes, PasswordBytes]);
const pwHash = crypto.createHash('sha1');
const NonceBytes = Buffer.from(nonce || '', 'base64');
const CreatedBytes = Buffer.from(created || '', 'utf8');
const PasswordBytes = Buffer.from(password || '', 'utf8');
const FullBytes = Buffer.concat([NonceBytes, CreatedBytes, PasswordBytes]);
pwHash.update(FullBytes);

@@ -25,3 +24,3 @@ return pwHash.digest('base64');

function findPrefix(xmlnsMapping, nsURI) {
for (var n in xmlnsMapping) {
for (const n in xmlnsMapping) {
if (n === exports.TNS_PREFIX) {

@@ -40,10 +39,10 @@ continue;

prefix: exports.TNS_PREFIX,
name: nsName
name: nsName,
};
}
var topLevelName = nsName.split('|')[0];
var prefixOffset = topLevelName.indexOf(':');
const [topLevelName] = nsName.split('|');
const prefixOffset = topLevelName.indexOf(':');
return {
prefix: topLevelName.substring(0, prefixOffset) || exports.TNS_PREFIX,
name: topLevelName.substring(prefixOffset + 1)
name: topLevelName.substring(prefixOffset + 1),
};

@@ -67,44 +66,47 @@ }

exports.xmlEscape = xmlEscape;
function parseMTOMResp(payload, boundary) {
var resp = {
parts: []
};
var headerName = '';
var headerValue = '';
var data;
var partIndex = 0;
var parser = new formidable_1.MultipartParser();
parser.initWithBoundary(boundary);
parser.on('data', function (_a) {
var name = _a.name, buffer = _a.buffer, start = _a.start, end = _a.end;
switch (name) {
case 'partBegin':
resp.parts[partIndex] = {
body: null,
headers: {}
};
data = Buffer.from('');
break;
case 'headerField':
headerName = buffer.slice(start, end).toString();
break;
case 'headerValue':
headerValue = buffer.slice(start, end).toString();
break;
case 'headerEnd':
resp.parts[partIndex].headers[headerName.toLowerCase()] = headerValue;
break;
case 'partData':
data = Buffer.concat([data, buffer.slice(start, end)]);
break;
case 'partEnd':
resp.parts[partIndex].body = data;
partIndex++;
break;
}
});
parser.write(payload);
return resp;
function parseMTOMResp(payload, boundary, callback) {
return import('formidable')
.then(({ MultipartParser }) => {
const resp = {
parts: [],
};
let headerName = '';
let headerValue = '';
let data;
let partIndex = 0;
const parser = new MultipartParser();
parser.initWithBoundary(boundary);
parser.on('data', ({ name, buffer, start, end }) => {
switch (name) {
case 'partBegin':
resp.parts[partIndex] = {
body: null,
headers: {},
};
data = Buffer.from('');
break;
case 'headerField':
headerName = buffer.slice(start, end).toString();
break;
case 'headerValue':
headerValue = buffer.slice(start, end).toString();
break;
case 'headerEnd':
resp.parts[partIndex].headers[headerName.toLowerCase()] = headerValue;
break;
case 'partData':
data = Buffer.concat([data, buffer.slice(start, end)]);
break;
case 'partEnd':
resp.parts[partIndex].body = data;
partIndex++;
break;
}
});
parser.write(payload);
return callback(null, resp);
})
.catch(callback);
}
exports.parseMTOMResp = parseMTOMResp;
//# sourceMappingURL=utils.js.map
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ImportElement = exports.IncludeElement = exports.BodyElement = exports.DefinitionsElement = exports.ServiceElement = exports.PortElement = exports.BindingElement = exports.PortTypeElement = exports.OperationElement = exports.TypesElement = exports.SchemaElement = exports.DocumentationElement = exports.MessageElement = exports.AllElement = exports.SequenceElement = exports.SimpleContentElement = exports.ComplexContentElement = exports.ComplexTypeElement = exports.EnumerationElement = exports.ChoiceElement = exports.ExtensionElement = exports.RestrictionElement = exports.SimpleTypeElement = exports.OutputElement = exports.InputElement = exports.AnyElement = exports.ElementElement = exports.Element = void 0;
var assert_1 = require("assert");
var debugBuilder = require("debug");
var _ = require("lodash");
var utils_1 = require("../utils");
var debug = debugBuilder('node-soap');
var Primitives = {
const assert_1 = require("assert");
const debugBuilder = require("debug");
const _ = require("lodash");
const utils_1 = require("../utils");
const debug = debugBuilder('node-soap');
const Primitives = {
string: 1,

@@ -54,9 +41,9 @@ boolean: 1,

QName: 0,
NOTATION: 0
NOTATION: 0,
};
var Element = /** @class */ (function () {
function Element(nsName, attrs, options, schemaAttrs) {
class Element {
constructor(nsName, attrs, options, schemaAttrs) {
this.allowedChildren = {};
this.children = [];
var parts = utils_1.splitQName(nsName);
const parts = (0, utils_1.splitQName)(nsName);
this.nsName = nsName;

@@ -69,4 +56,4 @@ this.prefix = parts.prefix;

this._initializeOptions(options);
for (var key in attrs) {
var match = /^xmlns:?(.*)$/.exec(key);
for (const key in attrs) {
const match = /^xmlns:?(.*)$/.exec(key);
if (match) {

@@ -84,4 +71,4 @@ this.xmlns[match[1] ? match[1] : utils_1.TNS_PREFIX] = attrs[key];

}
for (var schemaKey in schemaAttrs) {
var schemaMatch = /^xmlns:?(.*)$/.exec(schemaKey);
for (const schemaKey in schemaAttrs) {
const schemaMatch = /^xmlns:?(.*)$/.exec(schemaKey);
if (schemaMatch && schemaMatch[1]) {

@@ -97,3 +84,3 @@ this.schemaXmlns[schemaMatch[1]] = schemaAttrs[schemaKey];

}
Element.prototype.deleteFixedAttrs = function () {
deleteFixedAttrs() {
this.children && this.children.length === 0 && delete this.children;

@@ -104,10 +91,10 @@ this.xmlns && Object.keys(this.xmlns).length === 0 && delete this.xmlns;

delete this.name;
};
Element.prototype.startElement = function (stack, nsName, attrs, options, schemaXmlns) {
}
startElement(stack, nsName, attrs, options, schemaXmlns) {
if (!this.allowedChildren) {
return;
}
var ChildClass = this.allowedChildren[utils_1.splitQName(nsName).name];
const ChildClass = this.allowedChildren[(0, utils_1.splitQName)(nsName).name];
if (ChildClass) {
var child = new ChildClass(nsName, attrs, options, schemaXmlns);
const child = new ChildClass(nsName, attrs, options, schemaXmlns);
child.init();

@@ -119,4 +106,4 @@ stack.push(child);

}
};
Element.prototype.endElement = function (stack, nsName) {
}
endElement(stack, nsName) {
if (this.nsName === nsName) {

@@ -126,24 +113,24 @@ if (stack.length < 2) {

}
var parent_1 = stack[stack.length - 2];
const parent = stack[stack.length - 2];
if (this !== stack[0]) {
_.defaultsDeep(stack[0].xmlns, this.xmlns);
// delete this.xmlns;
parent_1.children.push(this);
parent_1.addChild(this);
parent.children.push(this);
parent.addChild(this);
}
stack.pop();
}
};
Element.prototype.addChild = function (child) {
}
addChild(child) {
return;
};
Element.prototype.unexpected = function (name) {
}
unexpected(name) {
throw new Error('Found unexpected element (' + name + ') inside ' + this.nsName);
};
Element.prototype.description = function (definitions, xmlns) {
}
description(definitions, xmlns) {
return this.$name || this.name;
};
Element.prototype.init = function () {
};
Element.prototype._initializeOptions = function (options) {
}
init() {
}
_initializeOptions(options) {
if (options) {

@@ -159,11 +146,9 @@ this.valueKey = options.valueKey || '$value';

}
};
return Element;
}());
}
}
exports.Element = Element;
var ElementElement = /** @class */ (function (_super) {
__extends(ElementElement, _super);
function ElementElement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowedChildren = buildAllowedChildren([
class ElementElement extends Element {
constructor() {
super(...arguments);
this.allowedChildren = buildAllowedChildren([
'annotation',

@@ -173,11 +158,10 @@ 'complexType',

]);
return _this;
}
ElementElement.prototype.description = function (definitions, xmlns) {
var element = {};
var name = this.$name;
description(definitions, xmlns) {
let element = {};
let name = this.$name;
// Check minOccurs / maxOccurs attributes to see if this element is a list
// These are default values for an element
var minOccurs = 1;
var maxOccurs = 1;
let minOccurs = 1;
let maxOccurs = 1;
if (this.$maxOccurs === 'unbounded') {

@@ -192,3 +176,3 @@ maxOccurs = Infinity;

}
var isMany = maxOccurs > 1;
const isMany = maxOccurs > 1;
if (isMany) {

@@ -200,12 +184,12 @@ name += '[]';

}
var type = this.$type || this.$ref;
let type = this.$type || this.$ref;
if (type) {
type = utils_1.splitQName(type);
var typeName = type.name;
var ns = xmlns && xmlns[type.prefix] ||
type = (0, utils_1.splitQName)(type);
const typeName = type.name;
const ns = xmlns && xmlns[type.prefix] ||
((definitions.xmlns[type.prefix] !== undefined || definitions.xmlns[this.targetNSAlias] !== undefined) && this.schemaXmlns[type.prefix]) ||
definitions.xmlns[type.prefix];
var schema = definitions.schemas[ns];
var typeElement = schema && (this.$type ? schema.complexTypes[typeName] || schema.types[typeName] : schema.elements[typeName]);
var typeStorage = this.$type ? definitions.descriptions.types : definitions.descriptions.elements;
const schema = definitions.schemas[ns];
const typeElement = schema && (this.$type ? schema.complexTypes[typeName] || schema.types[typeName] : schema.elements[typeName]);
const typeStorage = this.$type ? definitions.descriptions.types : definitions.descriptions.elements;
if (ns && definitions.schemas[ns]) {

@@ -216,24 +200,24 @@ xmlns = definitions.schemas[ns].xmlns;

if (!(typeName in typeStorage)) {
var elem_1 = {};
typeStorage[typeName] = elem_1;
var description_1 = typeElement.description(definitions, xmlns);
if (typeof description_1 === 'string') {
elem_1 = description_1;
let elem = {};
typeStorage[typeName] = elem;
const description = typeElement.description(definitions, xmlns);
if (typeof description === 'string') {
elem = description;
}
else {
Object.keys(description_1).forEach(function (key) {
elem_1[key] = description_1[key];
Object.keys(description).forEach((key) => {
elem[key] = description[key];
});
}
if (this.$ref) {
element = elem_1;
element = elem;
}
else {
element[name] = elem_1;
element[name] = elem;
}
if (typeof elem_1 === 'object') {
elem_1.targetNSAlias = type.prefix;
elem_1.targetNamespace = ns;
if (typeof elem === 'object') {
elem.targetNSAlias = type.prefix;
elem.targetNamespace = ns;
}
typeStorage[typeName] = elem_1;
typeStorage[typeName] = elem;
}

@@ -254,6 +238,5 @@ else {

else {
var children = this.children;
const children = this.children;
element[name] = {};
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
var child = children_1[_i];
for (const child of children) {
if (child instanceof ComplexTypeElement || child instanceof SimpleTypeElement) {

@@ -265,19 +248,12 @@ element[name] = child.description(definitions, xmlns);

return element;
};
return ElementElement;
}(Element));
}
}
exports.ElementElement = ElementElement;
var AnyElement = /** @class */ (function (_super) {
__extends(AnyElement, _super);
function AnyElement() {
return _super !== null && _super.apply(this, arguments) || this;
}
return AnyElement;
}(Element));
class AnyElement extends Element {
}
exports.AnyElement = AnyElement;
var InputElement = /** @class */ (function (_super) {
__extends(InputElement, _super);
function InputElement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowedChildren = buildAllowedChildren([
class InputElement extends Element {
constructor() {
super(...arguments);
this.allowedChildren = buildAllowedChildren([
'body',

@@ -288,5 +264,4 @@ 'documentation',

]);
return _this;
}
InputElement.prototype.addChild = function (child) {
addChild(child) {
if (child instanceof BodyElement) {

@@ -299,11 +274,9 @@ this.use = child.$use;

}
};
return InputElement;
}(Element));
}
}
exports.InputElement = InputElement;
var OutputElement = /** @class */ (function (_super) {
__extends(OutputElement, _super);
function OutputElement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowedChildren = buildAllowedChildren([
class OutputElement extends Element {
constructor() {
super(...arguments);
this.allowedChildren = buildAllowedChildren([
'body',

@@ -314,5 +287,4 @@ 'documentation',

]);
return _this;
}
OutputElement.prototype.addChild = function (child) {
addChild(child) {
if (child instanceof BodyElement) {

@@ -325,18 +297,14 @@ this.use = child.$use;

}
};
return OutputElement;
}(Element));
}
}
exports.OutputElement = OutputElement;
var SimpleTypeElement = /** @class */ (function (_super) {
__extends(SimpleTypeElement, _super);
function SimpleTypeElement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowedChildren = buildAllowedChildren([
class SimpleTypeElement extends Element {
constructor() {
super(...arguments);
this.allowedChildren = buildAllowedChildren([
'restriction',
]);
return _this;
}
SimpleTypeElement.prototype.description = function (definitions) {
for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
var child = _a[_i];
description(definitions) {
for (const child of this.children) {
if (child instanceof RestrictionElement) {

@@ -347,11 +315,9 @@ return [this.$name, child.description()].filter(Boolean).join('|');

return {};
};
return SimpleTypeElement;
}(Element));
}
}
exports.SimpleTypeElement = SimpleTypeElement;
var RestrictionElement = /** @class */ (function (_super) {
__extends(RestrictionElement, _super);
function RestrictionElement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowedChildren = buildAllowedChildren([
class RestrictionElement extends Element {
constructor() {
super(...arguments);
this.allowedChildren = buildAllowedChildren([
'all',

@@ -362,8 +328,7 @@ 'choice',

]);
return _this;
}
RestrictionElement.prototype.description = function (definitions, xmlns) {
var children = this.children;
var desc;
for (var i = 0, child = void 0; child = children[i]; i++) {
description(definitions, xmlns) {
const children = this.children;
let desc;
for (let i = 0, child; child = children[i]; i++) {
if (child instanceof SequenceElement || child instanceof ChoiceElement) {

@@ -375,9 +340,9 @@ desc = child.description(definitions, xmlns);

if (desc && this.$base) {
var type = utils_1.splitQName(this.$base);
var typeName = type.name;
var ns = xmlns && xmlns[type.prefix] || definitions.xmlns[type.prefix];
var schema_1 = definitions.schemas[ns];
var typeElement_1 = schema_1 && (schema_1.complexTypes[typeName] || schema_1.types[typeName] || schema_1.elements[typeName]);
desc.getBase = function () {
return typeElement_1.description(definitions, schema_1.xmlns);
const type = (0, utils_1.splitQName)(this.$base);
const typeName = type.name;
const ns = xmlns && xmlns[type.prefix] || definitions.xmlns[type.prefix];
const schema = definitions.schemas[ns];
const typeElement = schema && (schema.complexTypes[typeName] || schema.types[typeName] || schema.elements[typeName]);
desc.getBase = () => {
return typeElement.description(definitions, schema.xmlns);
};

@@ -387,16 +352,14 @@ return desc;

// then simple element
var base = this.$base ? this.$base + '|' : '';
var restrictions = this.children.map(function (child) {
const base = this.$base ? this.$base + '|' : '';
const restrictions = this.children.map((child) => {
return child.description();
}).join(',');
return [this.$base, restrictions].filter(Boolean).join('|');
};
return RestrictionElement;
}(Element));
}
}
exports.RestrictionElement = RestrictionElement;
var ExtensionElement = /** @class */ (function (_super) {
__extends(ExtensionElement, _super);
function ExtensionElement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowedChildren = buildAllowedChildren([
class ExtensionElement extends Element {
constructor() {
super(...arguments);
this.allowedChildren = buildAllowedChildren([
'all',

@@ -406,8 +369,6 @@ 'choice',

]);
return _this;
}
ExtensionElement.prototype.description = function (definitions, xmlns) {
var desc = {};
for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
var child = _a[_i];
description(definitions, xmlns) {
let desc = {};
for (const child of this.children) {
if (child instanceof SequenceElement || child instanceof ChoiceElement) {

@@ -418,6 +379,6 @@ desc = child.description(definitions, xmlns);

if (this.$base) {
var type = utils_1.splitQName(this.$base);
var typeName = type.name;
var ns = xmlns && xmlns[type.prefix] || definitions.xmlns[type.prefix];
var schema = definitions.schemas[ns];
const type = (0, utils_1.splitQName)(this.$base);
const typeName = type.name;
const ns = xmlns && xmlns[type.prefix] || definitions.xmlns[type.prefix];
const schema = definitions.schemas[ns];
if (typeName in Primitives) {

@@ -427,7 +388,7 @@ return this.$base;

else {
var typeElement = schema && (schema.complexTypes[typeName] ||
const typeElement = schema && (schema.complexTypes[typeName] ||
schema.types[typeName] ||
schema.elements[typeName]);
if (typeElement) {
var base = typeElement.description(definitions, schema.xmlns);
const base = typeElement.description(definitions, schema.xmlns);
desc = typeof base === 'string' ? base : _.defaults(base, desc);

@@ -438,11 +399,9 @@ }

return desc;
};
return ExtensionElement;
}(Element));
}
}
exports.ExtensionElement = ExtensionElement;
var ChoiceElement = /** @class */ (function (_super) {
__extends(ChoiceElement, _super);
function ChoiceElement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowedChildren = buildAllowedChildren([
class ChoiceElement extends Element {
constructor() {
super(...arguments);
this.allowedChildren = buildAllowedChildren([
'any',

@@ -453,10 +412,8 @@ 'choice',

]);
return _this;
}
ChoiceElement.prototype.description = function (definitions, xmlns) {
var choice = {};
for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
var child = _a[_i];
var description = child.description(definitions, xmlns);
for (var key in description) {
description(definitions, xmlns) {
const choice = {};
for (const child of this.children) {
const description = child.description(definitions, xmlns);
for (const key in description) {
choice[key] = description[key];

@@ -466,23 +423,16 @@ }

return choice;
};
return ChoiceElement;
}(Element));
}
}
exports.ChoiceElement = ChoiceElement;
var EnumerationElement = /** @class */ (function (_super) {
__extends(EnumerationElement, _super);
function EnumerationElement() {
return _super !== null && _super.apply(this, arguments) || this;
}
class EnumerationElement extends Element {
// no children
EnumerationElement.prototype.description = function () {
description() {
return this[this.valueKey];
};
return EnumerationElement;
}(Element));
}
}
exports.EnumerationElement = EnumerationElement;
var ComplexTypeElement = /** @class */ (function (_super) {
__extends(ComplexTypeElement, _super);
function ComplexTypeElement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowedChildren = buildAllowedChildren([
class ComplexTypeElement extends Element {
constructor() {
super(...arguments);
this.allowedChildren = buildAllowedChildren([
'all',

@@ -495,8 +445,6 @@ 'annotation',

]);
return _this;
}
ComplexTypeElement.prototype.description = function (definitions, xmlns) {
var children = this.children || [];
for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {
var child = children_2[_i];
description(definitions, xmlns) {
const children = this.children || [];
for (const child of children) {
if (child instanceof ChoiceElement ||

@@ -511,18 +459,14 @@ child instanceof SequenceElement ||

return {};
};
return ComplexTypeElement;
}(Element));
}
}
exports.ComplexTypeElement = ComplexTypeElement;
var ComplexContentElement = /** @class */ (function (_super) {
__extends(ComplexContentElement, _super);
function ComplexContentElement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowedChildren = buildAllowedChildren([
class ComplexContentElement extends Element {
constructor() {
super(...arguments);
this.allowedChildren = buildAllowedChildren([
'extension',
]);
return _this;
}
ComplexContentElement.prototype.description = function (definitions, xmlns) {
for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
var child = _a[_i];
description(definitions, xmlns) {
for (const child of this.children) {
if (child instanceof ExtensionElement) {

@@ -533,18 +477,14 @@ return child.description(definitions, xmlns);

return {};
};
return ComplexContentElement;
}(Element));
}
}
exports.ComplexContentElement = ComplexContentElement;
var SimpleContentElement = /** @class */ (function (_super) {
__extends(SimpleContentElement, _super);
function SimpleContentElement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowedChildren = buildAllowedChildren([
class SimpleContentElement extends Element {
constructor() {
super(...arguments);
this.allowedChildren = buildAllowedChildren([
'extension',
]);
return _this;
}
SimpleContentElement.prototype.description = function (definitions, xmlns) {
for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
var child = _a[_i];
description(definitions, xmlns) {
for (const child of this.children) {
if (child instanceof ExtensionElement) {

@@ -555,11 +495,9 @@ return child.description(definitions, xmlns);

return {};
};
return SimpleContentElement;
}(Element));
}
}
exports.SimpleContentElement = SimpleContentElement;
var SequenceElement = /** @class */ (function (_super) {
__extends(SequenceElement, _super);
function SequenceElement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowedChildren = buildAllowedChildren([
class SequenceElement extends Element {
constructor() {
super(...arguments);
this.allowedChildren = buildAllowedChildren([
'any',

@@ -570,13 +508,11 @@ 'choice',

]);
return _this;
}
SequenceElement.prototype.description = function (definitions, xmlns) {
var sequence = {};
for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
var child = _a[_i];
description(definitions, xmlns) {
const sequence = {};
for (const child of this.children) {
if (child instanceof AnyElement) {
continue;
}
var description = child.description(definitions, xmlns);
for (var key in description) {
const description = child.description(definitions, xmlns);
for (const key in description) {
sequence[key] = description[key];

@@ -586,25 +522,21 @@ }

return sequence;
};
return SequenceElement;
}(Element));
}
}
exports.SequenceElement = SequenceElement;
var AllElement = /** @class */ (function (_super) {
__extends(AllElement, _super);
function AllElement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowedChildren = buildAllowedChildren([
class AllElement extends Element {
constructor() {
super(...arguments);
this.allowedChildren = buildAllowedChildren([
'choice',
'element',
]);
return _this;
}
AllElement.prototype.description = function (definitions, xmlns) {
var sequence = {};
for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
var child = _a[_i];
description(definitions, xmlns) {
const sequence = {};
for (const child of this.children) {
if (child instanceof AnyElement) {
continue;
}
var description = child.description(definitions, xmlns);
for (var key in description) {
const description = child.description(definitions, xmlns);
for (const key in description) {
sequence[key] = description[key];

@@ -614,23 +546,19 @@ }

return sequence;
};
return AllElement;
}(Element));
}
}
exports.AllElement = AllElement;
var MessageElement = /** @class */ (function (_super) {
__extends(MessageElement, _super);
function MessageElement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowedChildren = buildAllowedChildren([
class MessageElement extends Element {
constructor() {
super(...arguments);
this.allowedChildren = buildAllowedChildren([
'part',
'documentation',
]);
_this.element = null;
_this.parts = null;
return _this;
this.element = null;
this.parts = null;
}
MessageElement.prototype.postProcess = function (definitions) {
var part = null;
var children = this.children || [];
for (var _i = 0, children_3 = children; _i < children_3.length; _i++) {
var child = children_3[_i];
postProcess(definitions) {
let part = null;
const children = this.children || [];
for (const child of children) {
if (child.name === 'part') {

@@ -645,7 +573,7 @@ part = child;

if (part.$element) {
var lookupTypes = [];
let lookupTypes = [];
delete this.parts;
var nsName = utils_1.splitQName(part.$element);
var ns = nsName.prefix;
var schema = definitions.schemas[definitions.xmlns[ns]];
const nsName = (0, utils_1.splitQName)(part.$element);
const ns = nsName.prefix;
let schema = definitions.schemas[definitions.xmlns[ns]];
this.element = schema.elements[nsName.name];

@@ -661,7 +589,6 @@ if (!this.element) {

this.element.$lookupType = part.$element;
var elementChildren = this.element.children;
const elementChildren = this.element.children;
// get all nested lookup types (only complex types are followed)
if (elementChildren.length > 0) {
for (var _a = 0, elementChildren_1 = elementChildren; _a < elementChildren_1.length; _a++) {
var child = elementChildren_1[_a];
for (const child of elementChildren) {
lookupTypes.push(this._getNestedLookupTypeString(child));

@@ -678,4 +605,4 @@ }

});
var schemaXmlns = definitions.schemas[this.element.targetNamespace].xmlns;
for (var i = 0; i < lookupTypes.length; i++) {
const schemaXmlns = definitions.schemas[this.element.targetNamespace].xmlns;
for (let i = 0; i < lookupTypes.length; i++) {
lookupTypes[i] = this._createLookupTypeObject(lookupTypes[i], schemaXmlns);

@@ -686,4 +613,4 @@ }

if (this.element.$type) {
var type = utils_1.splitQName(this.element.$type);
var typeNs = schema.xmlns && schema.xmlns[type.prefix] || definitions.xmlns[type.prefix];
const type = (0, utils_1.splitQName)(this.element.$type);
const typeNs = schema.xmlns && schema.xmlns[type.prefix] || definitions.xmlns[type.prefix];
if (typeNs) {

@@ -696,3 +623,3 @@ if (type.name in Primitives) {

schema = definitions.schemas[typeNs];
var ctype = schema.complexTypes[type.name] || schema.types[type.name] || schema.elements[type.name];
const ctype = schema.complexTypes[type.name] || schema.types[type.name] || schema.elements[type.name];
if (ctype) {

@@ -705,3 +632,3 @@ this.parts = ctype.description(definitions, schema.xmlns);

else {
var method = this.element.description(definitions, schema.xmlns);
const method = this.element.description(definitions, schema.xmlns);
this.parts = method[nsName.name];

@@ -715,3 +642,3 @@ }

delete this.element;
for (var i = 0; part = this.children[i]; i++) {
for (let i = 0; part = this.children[i]; i++) {
if (part.name === 'documentation') {

@@ -721,7 +648,7 @@ // <wsdl:documentation can be present under <wsdl:message>

}
assert_1.ok(part.name === 'part', 'Expected part element');
var nsName = utils_1.splitQName(part.$type);
var ns = definitions.xmlns[nsName.prefix];
var type = nsName.name;
var schemaDefinition = definitions.schemas[ns];
(0, assert_1.ok)(part.name === 'part', 'Expected part element');
const nsName = (0, utils_1.splitQName)(part.$type);
const ns = definitions.xmlns[nsName.prefix];
const type = nsName.name;
const schemaDefinition = definitions.schemas[ns];
if (typeof schemaDefinition !== 'undefined') {

@@ -741,11 +668,11 @@ this.parts[part.$name] = definitions.schemas[ns].types[type] || definitions.schemas[ns].complexTypes[type];

this.deleteFixedAttrs();
};
MessageElement.prototype.description = function (definitions) {
}
description(definitions) {
if (this.element) {
return this.element && this.element.description(definitions);
}
var desc = {};
const desc = {};
desc[this.$name] = this.parts;
return desc;
};
}
/**

@@ -762,14 +689,14 @@ * Takes a given namespaced String(for example: 'alias:property') and creates a lookupType

*/
MessageElement.prototype._createLookupTypeObject = function (nsString, xmlns) {
var splittedNSString = utils_1.splitQName(nsString);
var nsAlias = splittedNSString.prefix;
var splittedName = splittedNSString.name.split('#');
var type = splittedName[0];
var name = splittedName[1];
_createLookupTypeObject(nsString, xmlns) {
const splittedNSString = (0, utils_1.splitQName)(nsString);
const nsAlias = splittedNSString.prefix;
const splittedName = splittedNSString.name.split('#');
const type = splittedName[0];
const name = splittedName[1];
return {
$namespace: xmlns[nsAlias],
$type: nsAlias + ':' + type,
$name: name
$name: name,
};
};
}
/**

@@ -785,6 +712,5 @@ * Iterates through the element and every nested child to find any defined `$type`

*/
MessageElement.prototype._getNestedLookupTypeString = function (element) {
var _this = this;
var resolvedType = '^';
var excluded = this.ignoredNamespaces.concat('xs'); // do not process $type values wich start with
_getNestedLookupTypeString(element) {
let resolvedType = '^';
const excluded = this.ignoredNamespaces.concat('xs'); // do not process $type values wich start with
if (element.hasOwnProperty('$type') && typeof element.$type === 'string') {

@@ -796,4 +722,4 @@ if (excluded.indexOf(element.$type.split(':')[0]) === -1) {

if (element.children.length > 0) {
element.children.forEach(function (child) {
var resolvedChildType = _this._getNestedLookupTypeString(child).replace(/\^_/, '');
element.children.forEach((child) => {
const resolvedChildType = this._getNestedLookupTypeString(child).replace(/\^_/, '');
if (resolvedChildType && typeof resolvedChildType === 'string') {

@@ -805,19 +731,12 @@ resolvedType += ('_' + resolvedChildType);

return resolvedType;
};
return MessageElement;
}(Element));
}
}
exports.MessageElement = MessageElement;
var DocumentationElement = /** @class */ (function (_super) {
__extends(DocumentationElement, _super);
function DocumentationElement() {
return _super !== null && _super.apply(this, arguments) || this;
}
return DocumentationElement;
}(Element));
class DocumentationElement extends Element {
}
exports.DocumentationElement = DocumentationElement;
var SchemaElement = /** @class */ (function (_super) {
__extends(SchemaElement, _super);
function SchemaElement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowedChildren = buildAllowedChildren([
class SchemaElement extends Element {
constructor() {
super(...arguments);
this.allowedChildren = buildAllowedChildren([
'complexType',

@@ -829,11 +748,9 @@ 'element',

]);
_this.complexTypes = {};
_this.types = {};
_this.elements = {};
_this.includes = [];
return _this;
this.complexTypes = {};
this.types = {};
this.elements = {};
this.includes = [];
}
SchemaElement.prototype.merge = function (source) {
var _this = this;
assert_1.ok(source instanceof SchemaElement);
merge(source) {
(0, assert_1.ok)(source instanceof SchemaElement);
_.merge(this.complexTypes, source.complexTypes);

@@ -844,8 +761,8 @@ _.merge(this.types, source.types);

// Merge attributes from source without overwriting our's
_.merge(this, _.pickBy(source, function (value, key) {
return key.startsWith('$') && !_this.hasOwnProperty(key);
_.merge(this, _.pickBy(source, (value, key) => {
return key.startsWith('$') && !this.hasOwnProperty(key);
}));
return this;
};
SchemaElement.prototype.addChild = function (child) {
}
addChild(child) {
if (child.$name in Primitives) {

@@ -855,7 +772,7 @@ return;

if (child instanceof IncludeElement || child instanceof ImportElement) {
var location_1 = child.$schemaLocation || child.$location;
if (location_1) {
const location = child.$schemaLocation || child.$location;
if (location) {
this.includes.push({
namespace: child.$namespace || child.$targetNamespace || this.$targetNamespace,
location: location_1
location: location,
});

@@ -875,22 +792,18 @@ }

// child.deleteFixedAttrs();
};
return SchemaElement;
}(Element));
}
}
exports.SchemaElement = SchemaElement;
var TypesElement = /** @class */ (function (_super) {
__extends(TypesElement, _super);
function TypesElement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowedChildren = buildAllowedChildren([
class TypesElement extends Element {
constructor() {
super(...arguments);
this.allowedChildren = buildAllowedChildren([
'documentation',
'schema',
]);
_this.schemas = {};
return _this;
this.schemas = {};
}
// fix#325
TypesElement.prototype.addChild = function (child) {
var _a;
assert_1.ok(child instanceof SchemaElement);
var targetNamespace = child.$targetNamespace || ((_a = child.includes[0]) === null || _a === void 0 ? void 0 : _a.namespace);
addChild(child) {
(0, assert_1.ok)(child instanceof SchemaElement);
const targetNamespace = child.$targetNamespace || child.includes[0]?.namespace;
if (!this.schemas.hasOwnProperty(targetNamespace)) {

@@ -902,11 +815,9 @@ this.schemas[targetNamespace] = child;

}
};
return TypesElement;
}(Element));
}
}
exports.TypesElement = TypesElement;
var OperationElement = /** @class */ (function (_super) {
__extends(OperationElement, _super);
function OperationElement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowedChildren = buildAllowedChildren([
class OperationElement extends Element {
constructor() {
super(...arguments);
this.allowedChildren = buildAllowedChildren([
'documentation',

@@ -918,11 +829,10 @@ 'fault',

]);
_this.input = null;
_this.output = null;
_this.inputSoap = null;
_this.outputSoap = null;
_this.style = '';
_this.soapAction = '';
return _this;
this.input = null;
this.output = null;
this.inputSoap = null;
this.outputSoap = null;
this.style = '';
this.soapAction = '';
}
OperationElement.prototype.addChild = function (child) {
addChild(child) {
if (child instanceof OperationElement) {

@@ -933,6 +843,6 @@ this.soapAction = child.$soapAction || '';

}
};
OperationElement.prototype.postProcess = function (definitions, tag) {
var children = this.children;
for (var i = 0, child = void 0; child = children[i]; i++) {
}
postProcess(definitions, tag) {
const children = this.children;
for (let i = 0, child; child = children[i]; i++) {
if (child.name !== 'input' && child.name !== 'output') {

@@ -946,4 +856,4 @@ continue;

}
var messageName = utils_1.splitQName(child.$message).name;
var message = definitions.messages[messageName];
const messageName = (0, utils_1.splitQName)(child.$message).name;
const message = definitions.messages[messageName];
message.postProcess(definitions);

@@ -960,31 +870,28 @@ if (message.element) {

this.deleteFixedAttrs();
};
OperationElement.prototype.description = function (definitions) {
var inputDesc = this.input ? this.input.description(definitions) : null;
var outputDesc = this.output ? this.output.description(definitions) : null;
}
description(definitions) {
const inputDesc = this.input ? this.input.description(definitions) : null;
const outputDesc = this.output ? this.output.description(definitions) : null;
return {
input: inputDesc && inputDesc[Object.keys(inputDesc)[0]],
output: outputDesc && outputDesc[Object.keys(outputDesc)[0]]
output: outputDesc && outputDesc[Object.keys(outputDesc)[0]],
};
};
return OperationElement;
}(Element));
}
}
exports.OperationElement = OperationElement;
var PortTypeElement = /** @class */ (function (_super) {
__extends(PortTypeElement, _super);
function PortTypeElement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowedChildren = buildAllowedChildren([
class PortTypeElement extends Element {
constructor() {
super(...arguments);
this.allowedChildren = buildAllowedChildren([
'documentation',
'operation',
]);
_this.methods = {};
return _this;
this.methods = {};
}
PortTypeElement.prototype.postProcess = function (definitions) {
var children = this.children;
postProcess(definitions) {
const children = this.children;
if (typeof children === 'undefined') {
return;
}
for (var i = 0, child = void 0; child = children[i]; i++) {
for (let i = 0, child; child = children[i]; i++) {
if (child.name !== 'operation') {

@@ -999,19 +906,17 @@ continue;

this.deleteFixedAttrs();
};
PortTypeElement.prototype.description = function (definitions) {
var methods = {};
for (var name_1 in this.methods) {
var method = this.methods[name_1];
methods[name_1] = method.description(definitions);
}
description(definitions) {
const methods = {};
for (const name in this.methods) {
const method = this.methods[name];
methods[name] = method.description(definitions);
}
return methods;
};
return PortTypeElement;
}(Element));
}
}
exports.PortTypeElement = PortTypeElement;
var BindingElement = /** @class */ (function (_super) {
__extends(BindingElement, _super);
function BindingElement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowedChildren = buildAllowedChildren([
class BindingElement extends Element {
constructor() {
super(...arguments);
this.allowedChildren = buildAllowedChildren([
'binding',

@@ -1022,8 +927,7 @@ 'documentation',

]);
_this.transport = '';
_this.style = '';
_this.methods = {};
return _this;
this.transport = '';
this.style = '';
this.methods = {};
}
BindingElement.prototype.addChild = function (child) {
addChild(child) {
if (child.name === 'binding') {

@@ -1034,12 +938,12 @@ this.transport = child.$transport;

}
};
BindingElement.prototype.postProcess = function (definitions) {
var type = utils_1.splitQName(this.$type).name;
var portType = definitions.portTypes[type];
var style = this.style;
var children = this.children;
}
postProcess(definitions) {
const type = (0, utils_1.splitQName)(this.$type).name;
const portType = definitions.portTypes[type];
const style = this.style;
const children = this.children;
if (portType) {
portType.postProcess(definitions);
this.methods = portType.methods;
for (var i = 0, child = void 0; child = children[i]; i++) {
for (let i = 0, child; child = children[i]; i++) {
if (child.name !== 'operation') {

@@ -1051,3 +955,3 @@ continue;

child.style || (child.style = style);
var method = this.methods[child.$name];
const method = this.methods[child.$name];
if (method) {

@@ -1066,54 +970,48 @@ method.style = child.style;

this.deleteFixedAttrs();
};
BindingElement.prototype.description = function (definitions) {
var methods = {};
for (var name_2 in this.methods) {
var method = this.methods[name_2];
methods[name_2] = method.description(definitions);
}
description(definitions) {
const methods = {};
for (const name in this.methods) {
const method = this.methods[name];
methods[name] = method.description(definitions);
}
return methods;
};
return BindingElement;
}(Element));
}
}
exports.BindingElement = BindingElement;
var PortElement = /** @class */ (function (_super) {
__extends(PortElement, _super);
function PortElement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowedChildren = buildAllowedChildren([
class PortElement extends Element {
constructor() {
super(...arguments);
this.allowedChildren = buildAllowedChildren([
'address',
'documentation',
]);
_this.location = null;
return _this;
this.location = null;
}
PortElement.prototype.addChild = function (child) {
addChild(child) {
if (child.name === 'address' && typeof (child.$location) !== 'undefined') {
this.location = child.$location;
}
};
return PortElement;
}(Element));
}
}
exports.PortElement = PortElement;
var ServiceElement = /** @class */ (function (_super) {
__extends(ServiceElement, _super);
function ServiceElement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowedChildren = buildAllowedChildren([
class ServiceElement extends Element {
constructor() {
super(...arguments);
this.allowedChildren = buildAllowedChildren([
'documentation',
'port',
]);
_this.ports = {};
return _this;
this.ports = {};
}
ServiceElement.prototype.postProcess = function (definitions) {
var children = this.children;
var bindings = definitions.bindings;
postProcess(definitions) {
const children = this.children;
const bindings = definitions.bindings;
if (children && children.length > 0) {
for (var i = 0, child = void 0; child = children[i]; i++) {
for (let i = 0, child; child = children[i]; i++) {
if (child.name !== 'port') {
continue;
}
var bindingName = utils_1.splitQName(child.$binding).name;
var binding = bindings[bindingName];
const bindingName = (0, utils_1.splitQName)(child.$binding).name;
const binding = bindings[bindingName];
if (binding) {

@@ -1123,3 +1021,3 @@ binding.postProcess(definitions);

location: child.location,
binding: binding
binding: binding,
};

@@ -1132,19 +1030,17 @@ children.splice(i--, 1);

this.deleteFixedAttrs();
};
ServiceElement.prototype.description = function (definitions) {
var ports = {};
for (var name_3 in this.ports) {
var port = this.ports[name_3];
ports[name_3] = port.binding.description(definitions);
}
description(definitions) {
const ports = {};
for (const name in this.ports) {
const port = this.ports[name];
ports[name] = port.binding.description(definitions);
}
return ports;
};
return ServiceElement;
}(Element));
}
}
exports.ServiceElement = ServiceElement;
var DefinitionsElement = /** @class */ (function (_super) {
__extends(DefinitionsElement, _super);
function DefinitionsElement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowedChildren = buildAllowedChildren([
class DefinitionsElement extends Element {
constructor() {
super(...arguments);
this.allowedChildren = buildAllowedChildren([
'binding',

@@ -1158,19 +1054,18 @@ 'documentation',

]);
_this.messages = {};
_this.portTypes = {};
_this.bindings = {};
_this.services = {};
_this.schemas = {};
_this.descriptions = {
this.messages = {};
this.portTypes = {};
this.bindings = {};
this.services = {};
this.schemas = {};
this.descriptions = {
types: {},
elements: {}
elements: {},
};
return _this;
}
DefinitionsElement.prototype.init = function () {
init() {
if (this.name !== 'definitions') {
this.unexpected(this.nsName);
}
};
DefinitionsElement.prototype.addChild = function (child) {
}
addChild(child) {
if (child instanceof TypesElement) {

@@ -1184,3 +1079,3 @@ // Merge types.schemas into definitions.schemas

else if (child.name === 'import') {
var schemaElement = new SchemaElement(child.$namespace, {});
const schemaElement = new SchemaElement(child.$namespace, {});
schemaElement.init();

@@ -1205,31 +1100,15 @@ this.schemas[child.$namespace] = schemaElement;

this.children.pop();
};
return DefinitionsElement;
}(Element));
}
}
exports.DefinitionsElement = DefinitionsElement;
var BodyElement = /** @class */ (function (_super) {
__extends(BodyElement, _super);
function BodyElement() {
return _super !== null && _super.apply(this, arguments) || this;
}
return BodyElement;
}(Element));
class BodyElement extends Element {
}
exports.BodyElement = BodyElement;
var IncludeElement = /** @class */ (function (_super) {
__extends(IncludeElement, _super);
function IncludeElement() {
return _super !== null && _super.apply(this, arguments) || this;
}
return IncludeElement;
}(Element));
class IncludeElement extends Element {
}
exports.IncludeElement = IncludeElement;
var ImportElement = /** @class */ (function (_super) {
__extends(ImportElement, _super);
function ImportElement() {
return _super !== null && _super.apply(this, arguments) || this;
}
return ImportElement;
}(Element));
class ImportElement extends Element {
}
exports.ImportElement = ImportElement;
var ElementTypeMap = {
const ElementTypeMap = {
// group: [GroupElement, 'element group'],

@@ -1249,3 +1128,3 @@ all: AllElement,

fault: Element,
"import": ImportElement,
import: ImportElement,
include: IncludeElement,

@@ -1264,8 +1143,7 @@ input: InputElement,

simpleType: SimpleTypeElement,
types: TypesElement
types: TypesElement,
};
function buildAllowedChildren(elementList) {
var rtn = {};
for (var _i = 0, elementList_1 = elementList; _i < elementList_1.length; _i++) {
var element = elementList_1[_i];
const rtn = {};
for (const element of elementList) {
rtn[element.replace(/^_/, '')] = ElementTypeMap[element] || Element;

@@ -1272,0 +1150,0 @@ }

@@ -8,20 +8,20 @@ "use strict";

/*jshint proto:true*/
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.open_wsdl = exports.WSDL = void 0;
var assert_1 = require("assert");
var debugBuilder = require("debug");
var fs = require("fs");
var _ = require("lodash");
var path = require("path");
var sax = require("sax");
var stripBom = require("strip-bom");
var url = require("url");
var http_1 = require("../http");
var nscontext_1 = require("../nscontext");
var utils_1 = require("../utils");
var elements = require("./elements");
var debug = debugBuilder('node-soap');
var XSI_URI = 'http://www.w3.org/2001/XMLSchema-instance';
var trimLeft = /^[\s\xA0]+/;
var trimRight = /[\s\xA0]+$/;
const assert_1 = require("assert");
const debugBuilder = require("debug");
const fs = require("fs");
const _ = require("lodash");
const path = require("path");
const sax = require("sax");
const stripBom = require("strip-bom");
const url = require("url");
const http_1 = require("../http");
const nscontext_1 = require("../nscontext");
const utils_1 = require("../utils");
const elements = require("./elements");
const debug = debugBuilder('node-soap');
const XSI_URI = 'http://www.w3.org/2001/XMLSchema-instance';
const trimLeft = /^[\s\xA0]+/;
const trimRight = /[\s\xA0]+$/;
function trim(text) {

@@ -31,3 +31,3 @@ return text.replace(trimLeft, '').replace(trimRight, '');

function deepMerge(destination, source) {
return _.mergeWith(destination, source, function (a, b) {
return _.mergeWith(destination, source, (a, b) => {
return Array.isArray(a) ? a.concat(b) : undefined;

@@ -42,5 +42,4 @@ });

}
var WSDL = /** @class */ (function () {
function WSDL(definition, uri, options) {
var _this = this;
class WSDL {
constructor(definition, uri, options) {
this.ignoredNamespaces = ['tns', 'targetNamespace', 'typedNamespace'];

@@ -50,5 +49,5 @@ this.ignoreBaseNameSpaces = false;

this.xmlKey = '$xml';
var fromFunc;
let fromFunc;
this.uri = uri;
this.callback = function () { };
this.callback = () => { };
this._includesWsdl = [];

@@ -71,23 +70,23 @@ // initialize WSDL cache

}
process.nextTick(function () {
process.nextTick(() => {
try {
fromFunc.call(_this, definition);
fromFunc.call(this, definition);
}
catch (e) {
return _this.callback(e);
return this.callback(e);
}
_this.processIncludes(function (err) {
var name;
this.processIncludes((err) => {
let name;
if (err) {
return _this.callback(err);
return this.callback(err);
}
try {
_this.definitions.deleteFixedAttrs();
var services = _this.services = _this.definitions.services;
this.definitions.deleteFixedAttrs();
const services = this.services = this.definitions.services;
if (services) {
for (name in services) {
services[name].postProcess(_this.definitions);
services[name].postProcess(this.definitions);
}
}
var complexTypes = _this.definitions.complexTypes;
const complexTypes = this.definitions.complexTypes;
if (complexTypes) {

@@ -99,11 +98,11 @@ for (name in complexTypes) {

// for document style, for every binding, prepare input message element name to (methodName, output message element name) mapping
var bindings = _this.definitions.bindings;
for (var bindingName in bindings) {
var binding = bindings[bindingName];
const bindings = this.definitions.bindings;
for (const bindingName in bindings) {
const binding = bindings[bindingName];
if (typeof binding.style === 'undefined') {
binding.style = 'document';
}
var methods = binding.methods;
var topEls = binding.topElements = {};
for (var methodName in methods) {
const methods = binding.methods;
const topEls = binding.topElements = {};
for (const methodName in methods) {
if ((methods[methodName].style || binding.style) !== 'document') {

@@ -113,4 +112,4 @@ continue;

if (methods[methodName].input) {
var inputName = methods[methodName].input.$name;
var outputName = '';
const inputName = methods[methodName].input.$name;
let outputName = '';
if (methods[methodName].output) {

@@ -124,7 +123,7 @@ outputName = methods[methodName].output.$name;

// prepare soap envelope xmlns definition string
_this.xmlnsInEnvelope = _this._xmlnsMap();
_this.callback(err, _this);
this.xmlnsInEnvelope = this._xmlnsMap();
this.callback(err, this);
}
catch (e) {
_this.callback(e);
this.callback(e);
}

@@ -134,38 +133,37 @@ });

}
WSDL.prototype.onReady = function (callback) {
onReady(callback) {
if (callback) {
this.callback = callback;
}
};
WSDL.prototype.processIncludes = function (callback) {
var schemas = this.definitions.schemas;
var includes = [];
for (var ns in schemas) {
var schema = schemas[ns];
}
processIncludes(callback) {
const schemas = this.definitions.schemas;
let includes = [];
for (const ns in schemas) {
const schema = schemas[ns];
includes = includes.concat(schema.includes || []);
}
this._processNextInclude(includes, callback);
};
WSDL.prototype.describeServices = function () {
var services = {};
for (var name_1 in this.services) {
var service = this.services[name_1];
services[name_1] = service.description(this.definitions);
}
describeServices() {
const services = {};
for (const name in this.services) {
const service = this.services[name];
services[name] = service.description(this.definitions);
}
return services;
};
WSDL.prototype.toXML = function () {
}
toXML() {
return this.xml || '';
};
WSDL.prototype.getSaxStream = function (xml) {
var saxStream = sax.createStream(true, null);
}
getSaxStream(xml) {
const saxStream = sax.createStream(true, null);
xml.pipe(saxStream);
return saxStream;
};
WSDL.prototype.xmlToObject = function (xml, callback) {
var _this = this;
var p = typeof callback === 'function' ? {} : sax.parser(true, null);
var objectName = null;
var root = {};
var schema = {
}
xmlToObject(xml, callback) {
const p = typeof callback === 'function' ? {} : sax.parser(true, null);
let objectName = null;
const root = {};
const schema = {
Envelope: {

@@ -176,5 +174,5 @@ Header: {

Username: 'string',
Password: 'string'
}
}
Password: 'string',
},
},
},

@@ -185,25 +183,25 @@ Body: {

faultstring: 'string',
detail: 'string'
}
}
}
detail: 'string',
},
},
},
};
var stack = [{ name: null, object: root, schema: schema }];
var xmlns = {};
var refs = {};
var id; // {id:{hrefs:[],obj:}, ...}
p.onopentag = function (node) {
var nsName = node.name;
var attrs = node.attributes;
var name = utils_1.splitQName(nsName).name;
var attributeName;
var top = stack[stack.length - 1];
var topSchema = top.schema;
var elementAttributes = {};
var hasNonXmlnsAttribute = false;
var hasNilAttribute = false;
var obj = {};
var originalName = name;
const stack = [{ name: null, object: root, schema: schema }];
const xmlns = {};
const refs = {};
let id; // {id:{hrefs:[],obj:}, ...}
p.onopentag = (node) => {
const nsName = node.name;
const attrs = node.attributes;
let name = (0, utils_1.splitQName)(nsName).name;
let attributeName;
const top = stack[stack.length - 1];
let topSchema = top.schema;
const elementAttributes = {};
let hasNonXmlnsAttribute = false;
let hasNilAttribute = false;
const obj = {};
const originalName = name;
if (!objectName && top.name === 'Body' && name !== 'Fault') {
var message = _this.definitions.messages[name];
let message = this.definitions.messages[name];
// Support RPC/literal messages where response body contains one element named

@@ -214,4 +212,4 @@ // after the operation + 'Response'. See http://www.w3.org/TR/wsdl#_names

// Determine if this is request or response
var isInput = false;
var isOutput = false;
let isInput = false;
let isOutput = false;
if ((/Response$/).test(name)) {

@@ -230,6 +228,6 @@ isOutput = true;

// Look up the appropriate message as given in the portType's operations
var portTypes = _this.definitions.portTypes;
var portTypeNames = Object.keys(portTypes);
const portTypes = this.definitions.portTypes;
const portTypeNames = Object.keys(portTypes);
// Currently this supports only one portType definition.
var portType = portTypes[portTypeNames[0]];
const portType = portTypes[portTypeNames[0]];
if (isInput) {

@@ -241,8 +239,8 @@ name = portType.methods[name].input.$name;

}
message = _this.definitions.messages[name];
message = this.definitions.messages[name];
// 'cache' this alias to speed future lookups
_this.definitions.messages[originalName] = _this.definitions.messages[name];
this.definitions.messages[originalName] = this.definitions.messages[name];
}
catch (e) {
if (_this.options.returnFault) {
if (this.options.returnFault) {
p.onerror(e);

@@ -252,3 +250,3 @@ }

}
topSchema = message.description(_this.definitions);
topSchema = message.description(this.definitions);
objectName = originalName;

@@ -271,3 +269,3 @@ }

if (/^xmlns:|^xmlns$/.test(attributeName)) {
xmlns[utils_1.splitQName(attributeName).name] = attrs[attributeName];
xmlns[(0, utils_1.splitQName)(attributeName).name] = attrs[attributeName];
continue;

@@ -279,3 +277,3 @@ }

for (attributeName in elementAttributes) {
var res = utils_1.splitQName(attributeName);
const res = (0, utils_1.splitQName)(attributeName);
if (res.name === 'nil' && xmlns[res.prefix] === XSI_URI && elementAttributes[attributeName] &&

@@ -288,10 +286,10 @@ (elementAttributes[attributeName].toLowerCase() === 'true' || elementAttributes[attributeName] === '1')) {

if (hasNonXmlnsAttribute) {
obj[_this.options.attributesKey] = elementAttributes;
obj[this.options.attributesKey] = elementAttributes;
}
// Pick up the schema for the type specified in element's xsi:type attribute.
var xsiTypeSchema;
var xsiType;
for (var prefix in xmlns) {
if (xmlns[prefix] === XSI_URI && (prefix + ":type" in elementAttributes)) {
xsiType = elementAttributes[prefix + ":type"];
let xsiTypeSchema;
let xsiType;
for (const prefix in xmlns) {
if (xmlns[prefix] === XSI_URI && (`${prefix}:type` in elementAttributes)) {
xsiType = elementAttributes[`${prefix}:type`];
break;

@@ -301,4 +299,4 @@ }

if (xsiType) {
var type = utils_1.splitQName(xsiType);
var typeURI = void 0;
const type = (0, utils_1.splitQName)(xsiType);
let typeURI;
if (type.prefix === utils_1.TNS_PREFIX) {

@@ -311,5 +309,5 @@ // In case of xsi:type = "MyType"

}
var typeDef = _this.findSchemaObject(typeURI, type.name);
const typeDef = this.findSchemaObject(typeURI, type.name);
if (typeDef) {
xsiTypeSchema = typeDef.description(_this.definitions);
xsiTypeSchema = typeDef.description(this.definitions);
}

@@ -322,9 +320,9 @@ }

};
p.onclosetag = function (nsName) {
var cur = stack.pop();
var obj = cur.object;
var top = stack[stack.length - 1];
var topObject = top.object;
var topSchema = top.schema;
var name = utils_1.splitQName(nsName).name;
p.onclosetag = (nsName) => {
const cur = stack.pop();
let obj = cur.object;
const top = stack[stack.length - 1];
const topObject = top.object;
const topSchema = top.schema;
const name = (0, utils_1.splitQName)(nsName).name;
if (typeof cur.schema === 'string' && (cur.schema === 'string' || cur.schema.split(':')[1] === 'string')) {

@@ -336,3 +334,3 @@ if (typeof obj === 'object' && Object.keys(obj).length === 0) {

if (cur.nil === true) {
if (_this.options.handleNilAsNull) {
if (this.options.handleNilAsNull) {
obj = null;

@@ -366,4 +364,4 @@ }

};
p.oncdata = function (text) {
var originalText = text;
p.oncdata = (text) => {
const originalText = text;
text = trim(text);

@@ -374,9 +372,9 @@ if (!text.length) {

if (/<\?xml[\s\S]+\?>/.test(text)) {
var top_1 = stack[stack.length - 1];
var value = _this.xmlToObject(text);
if (top_1.object[_this.options.attributesKey]) {
top_1.object[_this.options.valueKey] = value;
const top = stack[stack.length - 1];
const value = this.xmlToObject(text);
if (top.object[this.options.attributesKey]) {
top.object[this.options.valueKey] = value;
}
else {
top_1.object = value;
top.object = value;
}

@@ -388,3 +386,3 @@ }

};
p.onerror = function (e) {
p.onerror = (e) => {
p.resume();

@@ -396,8 +394,8 @@ throw {

detail: new Error(e).message,
statusCode: 500
}
statusCode: 500,
},
};
};
p.ontext = function (text) {
var originalText = text;
p.ontext = (text) => {
const originalText = text;
text = trim(text);

@@ -407,7 +405,7 @@ if (!text.length) {

}
var top = stack[stack.length - 1];
var name = utils_1.splitQName(top.schema).name;
var value;
if (_this.options && _this.options.customDeserializer && _this.options.customDeserializer[name]) {
value = _this.options.customDeserializer[name](text, top);
const top = stack[stack.length - 1];
const name = (0, utils_1.splitQName)(top.schema).name;
let value;
if (this.options && this.options.customDeserializer && this.options.customDeserializer[name]) {
value = this.options.customDeserializer[name](text, top);
}

@@ -428,3 +426,3 @@ else {

else {
if (_this.options.preserveWhitespace) {
if (this.options.preserveWhitespace) {
text = originalText;

@@ -441,4 +439,4 @@ }

}
if (top.object[_this.options.attributesKey]) {
top.object[_this.options.valueKey] = value;
if (top.object[this.options.attributesKey]) {
top.object[this.options.valueKey] = value;
}

@@ -451,3 +449,3 @@ else {

// we be streaming
var saxStream = sax.createStream(true, null);
const saxStream = sax.createStream(true, null);
saxStream.on('opentag', p.onopentag);

@@ -458,7 +456,7 @@ saxStream.on('closetag', p.onclosetag);

xml.pipe(saxStream)
.on('error', function (err) {
.on('error', (err) => {
callback(err);
})
.on('end', function () {
var r;
.on('end', () => {
let r;
try {

@@ -478,6 +476,5 @@ r = finish();

// MultiRef support: merge objects instead of replacing
for (var n in refs) {
var ref = refs[n];
for (var _i = 0, _a = ref.hrefs; _i < _a.length; _i++) {
var href = _a[_i];
for (const n in refs) {
const ref = refs[n];
for (const href of ref.hrefs) {
Object.assign(href.obj, ref.obj);

@@ -487,11 +484,11 @@ }

if (root.Envelope) {
var body = root.Envelope.Body;
const body = root.Envelope.Body;
if (body && body.Fault) {
var code = body.Fault.faultcode && body.Fault.faultcode.$value;
var string = body.Fault.faultstring && body.Fault.faultstring.$value;
var detail = body.Fault.detail && body.Fault.detail.$value;
let code = body.Fault.faultcode && body.Fault.faultcode.$value;
let string = body.Fault.faultstring && body.Fault.faultstring.$value;
let detail = body.Fault.detail && body.Fault.detail.$value;
code = code || body.Fault.faultcode;
string = string || body.Fault.faultstring;
detail = detail || body.Fault.detail;
var error = new Error(code + ': ' + string + (detail ? ': ' + JSON.stringify(detail) : ''));
const error = new Error(code + ': ' + string + (detail ? ': ' + JSON.stringify(detail) : ''));
error.root = root;

@@ -504,3 +501,3 @@ throw error;

}
};
}
/**

@@ -512,9 +509,9 @@ * Look up a XSD type or element by namespace URI and name

*/
WSDL.prototype.findSchemaObject = function (nsURI, qname) {
findSchemaObject(nsURI, qname) {
if (!nsURI || !qname) {
return null;
}
var def = null;
let def = null;
if (this.definitions.schemas) {
var schema = this.definitions.schemas[nsURI];
const schema = this.definitions.schemas[nsURI];
if (schema) {

@@ -530,3 +527,3 @@ if (qname.indexOf(':') !== -1) {

return def;
};
}
/**

@@ -540,3 +537,3 @@ * Create document style xml string from the parameters

*/
WSDL.prototype.objectToDocumentXML = function (name, params, nsPrefix, nsURI, type) {
objectToDocumentXML(name, params, nsPrefix, nsURI, type) {
// If user supplies XML already, just use that. XML Declaration should not be present.

@@ -546,7 +543,7 @@ if (params && params._xml) {

}
var args = {};
const args = {};
args[name] = params;
var parameterTypeObj = type ? this.findSchemaObject(nsURI, type) : null;
const parameterTypeObj = type ? this.findSchemaObject(nsURI, type) : null;
return this.objectToXML(args, null, nsPrefix, nsURI, true, null, parameterTypeObj);
};
}
/**

@@ -560,11 +557,11 @@ * Create RPC style xml string from the parameters

*/
WSDL.prototype.objectToRpcXML = function (name, params, nsPrefix, nsURI, isParts) {
var parts = [];
var defs = this.definitions;
var nsAttrName = '_xmlns';
nsPrefix = nsPrefix || utils_1.findPrefix(defs.xmlns, nsURI);
objectToRpcXML(name, params, nsPrefix, nsURI, isParts) {
const parts = [];
const defs = this.definitions;
const nsAttrName = '_xmlns';
nsPrefix = nsPrefix || (0, utils_1.findPrefix)(defs.xmlns, nsURI);
nsURI = nsURI || defs.xmlns[nsPrefix];
nsPrefix = nsPrefix === utils_1.TNS_PREFIX ? '' : (nsPrefix + ':');
parts.push(['<', nsPrefix, name, '>'].join(''));
for (var key in params) {
for (const key in params) {
if (!params.hasOwnProperty(key)) {

@@ -574,8 +571,8 @@ continue;

if (key !== nsAttrName) {
var value = params[key];
var prefixedKey = (isParts ? '' : nsPrefix) + key;
var attributes = [];
const value = params[key];
const prefixedKey = (isParts ? '' : nsPrefix) + key;
const attributes = [];
if (typeof value === 'object' && value.hasOwnProperty(this.options.attributesKey)) {
var attrs = value[this.options.attributesKey];
for (var n in attrs) {
const attrs = value[this.options.attributesKey];
for (const n in attrs) {
attributes.push(' ' + n + '=' + '"' + attrs[n] + '"');

@@ -585,3 +582,3 @@ }

parts.push(['<', prefixedKey].concat(attributes).concat('>').join(''));
parts.push((typeof value === 'object') ? this.objectToXML(value, key, nsPrefix, nsURI) : utils_1.xmlEscape(value));
parts.push((typeof value === 'object') ? this.objectToXML(value, key, nsPrefix, nsURI) : (0, utils_1.xmlEscape)(value));
parts.push(['</', prefixedKey, '>'].join(''));

@@ -592,10 +589,10 @@ }

return parts.join('');
};
WSDL.prototype.isIgnoredNameSpace = function (ns) {
}
isIgnoredNameSpace(ns) {
return this.options.ignoredNamespaces.indexOf(ns) > -1;
};
WSDL.prototype.filterOutIgnoredNameSpace = function (ns) {
var namespace = noColonNameSpace(ns);
}
filterOutIgnoredNameSpace(ns) {
const namespace = noColonNameSpace(ns);
return this.isIgnoredNameSpace(namespace) ? '' : namespace;
};
}
/**

@@ -614,5 +611,5 @@ * Convert an object to XML. This is a recursive method as it calls itself.

*/
WSDL.prototype.objectToXML = function (obj, name, nsPrefix, nsURI, isFirst, xmlnsAttr, schemaObject, nsContext) {
var schema = this.definitions.schemas[nsURI];
var parentNsPrefix = nsPrefix ? nsPrefix.parent : undefined;
objectToXML(obj, name, nsPrefix, nsURI, isFirst, xmlnsAttr, schemaObject, nsContext) {
const schema = this.definitions.schemas[nsURI];
let parentNsPrefix = nsPrefix ? nsPrefix.parent : undefined;
if (typeof parentNsPrefix !== 'undefined') {

@@ -626,10 +623,10 @@ // we got the parentNsPrefix for our array. setting the namespace-variable back to the current namespace string

}
var soapHeader = !schema;
var qualified = schema && schema.$elementFormDefault === 'qualified';
var parts = [];
var prefixNamespace = (nsPrefix || qualified) && nsPrefix !== utils_1.TNS_PREFIX;
var xmlnsAttrib = '';
const soapHeader = !schema;
const qualified = schema && schema.$elementFormDefault === 'qualified';
const parts = [];
const prefixNamespace = (nsPrefix || qualified) && nsPrefix !== utils_1.TNS_PREFIX;
let xmlnsAttrib = '';
if (nsURI && isFirst) {
if (this.options.overrideRootElement && this.options.overrideRootElement.xmlnsAttributes) {
this.options.overrideRootElement.xmlnsAttributes.forEach(function (attribute) {
this.options.overrideRootElement.xmlnsAttributes.forEach((attribute) => {
xmlnsAttrib += ' ' + attribute.name + '="' + attribute.value + '"';

@@ -660,3 +657,3 @@ });

}
var ns = '';
let ns = '';
if (this.options.overrideRootElement && isFirst) {

@@ -668,9 +665,9 @@ ns = this.options.overrideRootElement.namespace;

}
var i;
var n;
let i;
let n;
// start building out XML string.
if (Array.isArray(obj)) {
var nonSubNameSpace = '';
var emptyNonSubNameSpaceForArray = false;
var nameWithNsRegex = /^([^:]+):([^:]+)$/.exec(name);
let nonSubNameSpace = '';
let emptyNonSubNameSpaceForArray = false;
const nameWithNsRegex = /^([^:]+):([^:]+)$/.exec(name);
if (nameWithNsRegex) {

@@ -685,7 +682,7 @@ nonSubNameSpace = nameWithNsRegex[1];

for (i = 0, n = obj.length; i < n; i++) {
var item = obj[i];
var arrayAttr = this.processAttributes(item, nsContext);
var correctOuterNsPrefix = nonSubNameSpace || parentNsPrefix || ns; // using the parent namespace prefix if given
var body = this.objectToXML(item, name, nsPrefix, nsURI, false, null, schemaObject, nsContext);
var openingTagParts = ['<', name, arrayAttr, xmlnsAttrib];
const item = obj[i];
const arrayAttr = this.processAttributes(item, nsContext);
const correctOuterNsPrefix = nonSubNameSpace || parentNsPrefix || ns; // using the parent namespace prefix if given
const body = this.objectToXML(item, name, nsPrefix, nsURI, false, null, schemaObject, nsContext);
let openingTagParts = ['<', name, arrayAttr, xmlnsAttrib];
if (!emptyNonSubNameSpaceForArray) {

@@ -717,3 +714,3 @@ openingTagParts = ['<', appendColon(correctOuterNsPrefix), name, arrayAttr, xmlnsAttrib];

else if (typeof obj === 'object') {
var currentChildXmlnsAttrib = '';
let currentChildXmlnsAttrib = '';
for (name in obj) {

@@ -739,13 +736,13 @@ // Happens when Object.create(null) is used, it will not inherit the Object prototype

nsContext.popContext();
return utils_1.xmlEscape(obj[name]);
return (0, utils_1.xmlEscape)(obj[name]);
}
var child = obj[name];
const child = obj[name];
if (typeof child === 'undefined') {
continue;
}
var attr = this.processAttributes(child, nsContext);
var value = '';
var nonSubNameSpace = '';
var emptyNonSubNameSpace = false;
var nameWithNsRegex = /^([^:]+):([^:]+)$/.exec(name);
const attr = this.processAttributes(child, nsContext);
let value = '';
let nonSubNameSpace = '';
let emptyNonSubNameSpace = false;
const nameWithNsRegex = /^([^:]+):([^:]+)$/.exec(name);
if (nameWithNsRegex) {

@@ -765,3 +762,3 @@ nonSubNameSpace = nameWithNsRegex[1] + ':';

if (schema) {
var childSchemaObject = this.findChildSchemaObject(schemaObject, name);
const childSchemaObject = this.findChildSchemaObject(schemaObject, name);
// find sub namespace if not a primitive

@@ -774,9 +771,9 @@ if (childSchemaObject &&

*/
var childNsPrefix = '';
var childName = '';
var childNsURI = void 0;
var childXmlnsAttrib = '';
var elementQName = childSchemaObject.$ref || childSchemaObject.$name;
let childNsPrefix = '';
let childName = '';
let childNsURI;
let childXmlnsAttrib = '';
let elementQName = childSchemaObject.$ref || childSchemaObject.$name;
if (elementQName) {
elementQName = utils_1.splitQName(elementQName);
elementQName = (0, utils_1.splitQName)(elementQName);
childName = elementQName.name;

@@ -798,3 +795,3 @@ if (elementQName.prefix === utils_1.TNS_PREFIX) {

}
var unqualified = false;
let unqualified = false;
// Check qualification form for local elements

@@ -825,7 +822,7 @@ if (childSchemaObject.$name && childSchemaObject.targetNamespace === undefined) {

}
var resolvedChildSchemaObject = void 0;
let resolvedChildSchemaObject;
if (childSchemaObject.$type) {
var typeQName = utils_1.splitQName(childSchemaObject.$type);
var typePrefix = typeQName.prefix;
var typeURI = schema.xmlns[typePrefix] || this.definitions.xmlns[typePrefix];
const typeQName = (0, utils_1.splitQName)(childSchemaObject.$type);
const typePrefix = typeQName.prefix;
const typeURI = schema.xmlns[typePrefix] || this.definitions.xmlns[typePrefix];
childNsURI = typeURI;

@@ -856,3 +853,3 @@ if (typeURI !== 'http://www.w3.org/2001/XMLSchema' && typePrefix !== utils_1.TNS_PREFIX) {

current: childNsPrefix,
parent: ns
parent: ns,
};

@@ -869,3 +866,3 @@ childXmlnsAttrib = childXmlnsAttrib && childXmlnsAttrib.length ? childXmlnsAttrib : currentChildXmlnsAttrib;

// if parent object has complex type defined and child not found in parent
var completeChildParamTypeObject = this.findChildSchemaObject(obj[this.options.attributesKey].xsi_type.type, obj[this.options.attributesKey].xsi_type.xmlns);
const completeChildParamTypeObject = this.findChildSchemaObject(obj[this.options.attributesKey].xsi_type.type, obj[this.options.attributesKey].xsi_type.xmlns);
nonSubNameSpace = obj[this.options.attributesKey].xsi_type.prefix;

@@ -899,3 +896,3 @@ nsContext.addNamespace(obj[this.options.attributesKey].xsi_type.prefix, obj[this.options.attributesKey].xsi_type.xmlns);

}
var useEmptyTag = !value && this.options.useEmptyTag;
const useEmptyTag = !value && this.options.useEmptyTag;
if (!Array.isArray(child)) {

@@ -918,16 +915,16 @@ // start tag

else if (obj !== undefined) {
parts.push((this.options.escapeXML) ? utils_1.xmlEscape(obj) : obj);
parts.push((this.options.escapeXML) ? (0, utils_1.xmlEscape)(obj) : obj);
}
nsContext.popContext();
return parts.join('');
};
WSDL.prototype.processAttributes = function (child, nsContext) {
var attr = '';
}
processAttributes(child, nsContext) {
let attr = '';
if (child === null || child === undefined) {
child = [];
}
var attrObj = child[this.options.attributesKey] || {};
const attrObj = child[this.options.attributesKey] || {};
if (attrObj && attrObj.xsi_type) {
var xsiType = attrObj.xsi_type;
var prefix = xsiType.prefix || xsiType.namespace;
const xsiType = attrObj.xsi_type;
let prefix = xsiType.prefix || xsiType.namespace;
if (xsiType.xmlns) {

@@ -944,20 +941,20 @@ // Generate a new namespace for complex extension if one not provided

}
Object.keys(attrObj).forEach(function (k) {
var v = attrObj[k];
Object.keys(attrObj).forEach((k) => {
const v = attrObj[k];
if (k === 'xsi_type') {
var name_2 = v.type;
let name = v.type;
if (v.prefix) {
name_2 = v.prefix + ":" + name_2;
name = `${v.prefix}:${name}`;
}
attr += " xsi:type=\"" + name_2 + "\"";
attr += ` xsi:type="${name}"`;
if (v.xmlns) {
attr += " xmlns:" + v.prefix + "=\"" + v.xmlns + "\"";
attr += ` xmlns:${v.prefix}="${v.xmlns}"`;
}
}
else {
attr += " " + k + "=\"" + utils_1.xmlEscape(v) + "\"";
attr += ` ${k}="${(0, utils_1.xmlEscape)(v)}"`;
}
});
return attr;
};
}
/**

@@ -969,7 +966,7 @@ * Look up a schema type definition

*/
WSDL.prototype.findSchemaType = function (name, nsURI) {
findSchemaType(name, nsURI) {
if (!this.definitions.schemas || !name || !nsURI) {
return null;
}
var schema = this.definitions.schemas[nsURI];
const schema = this.definitions.schemas[nsURI];
if (!schema || !schema.complexTypes) {

@@ -979,4 +976,4 @@ return null;

return schema.complexTypes[name];
};
WSDL.prototype.findChildSchemaObject = function (parameterTypeObj, childName, backtrace) {
}
findChildSchemaObject(parameterTypeObj, childName, backtrace) {
if (!parameterTypeObj || !childName) {

@@ -995,10 +992,10 @@ return null;

}
var found = null;
var i = 0;
var child;
var ref;
let found = null;
let i = 0;
let child;
let ref;
if (Array.isArray(parameterTypeObj.$lookupTypes) && parameterTypeObj.$lookupTypes.length) {
var types = parameterTypeObj.$lookupTypes;
const types = parameterTypeObj.$lookupTypes;
for (i = 0; i < types.length; i++) {
var typeObj = types[i];
const typeObj = types[i];
if (typeObj.$name === childName) {

@@ -1010,3 +1007,3 @@ found = typeObj;

}
var object = parameterTypeObj;
const object = parameterTypeObj;
if (object.$name === childName && object.name === 'element') {

@@ -1016,3 +1013,3 @@ return object;

if (object.$ref) {
ref = utils_1.splitQName(object.$ref);
ref = (0, utils_1.splitQName)(object.$ref);
if (ref.name === childName) {

@@ -1022,6 +1019,6 @@ return object;

}
var childNsURI;
let childNsURI;
// want to avoid unecessary recursion to improve performance
if (object.$type && backtrace.length === 1) {
var typeInfo = utils_1.splitQName(object.$type);
const typeInfo = (0, utils_1.splitQName)(object.$type);
if (typeInfo.prefix === utils_1.TNS_PREFIX) {

@@ -1033,3 +1030,3 @@ childNsURI = parameterTypeObj.$targetNamespace;

}
var typeDef = this.findSchemaType(typeInfo.name, childNsURI);
const typeDef = this.findSchemaType(typeInfo.name, childNsURI);
if (typeDef) {

@@ -1041,3 +1038,3 @@ return this.findChildSchemaObject(typeDef, childName, backtrace);

if (object.$base && (!Array.isArray(object.children) || !object.children.length)) {
var baseInfo = utils_1.splitQName(object.$base);
const baseInfo = (0, utils_1.splitQName)(object.$base);
childNsURI = parameterTypeObj.$targetNamespace;

@@ -1047,3 +1044,3 @@ if (baseInfo.prefix !== utils_1.TNS_PREFIX) {

}
var baseDef = this.findSchemaType(baseInfo.name, childNsURI);
const baseDef = this.findSchemaType(baseInfo.name, childNsURI);
if (baseDef) {

@@ -1060,6 +1057,6 @@ return this.findChildSchemaObject(baseDef, childName, backtrace);

if (child.$base) {
var baseQName = utils_1.splitQName(child.$base);
var childNameSpace = baseQName.prefix === utils_1.TNS_PREFIX ? '' : baseQName.prefix;
const baseQName = (0, utils_1.splitQName)(child.$base);
const childNameSpace = baseQName.prefix === utils_1.TNS_PREFIX ? '' : baseQName.prefix;
childNsURI = child.xmlns[baseQName.prefix] || child.schemaXmlns[baseQName.prefix];
var foundBase = this.findSchemaType(baseQName.name, childNsURI);
const foundBase = this.findSchemaType(baseQName.name, childNsURI);
if (foundBase) {

@@ -1080,7 +1077,7 @@ found = this.findChildSchemaObject(foundBase, childName, backtrace);

return found;
};
WSDL.prototype._initializeOptions = function (options) {
}
_initializeOptions(options) {
this._originalIgnoredNamespaces = (options || {}).ignoredNamespaces;
this.options = {};
var ignoredNamespaces = options ? options.ignoredNamespaces : null;
const ignoredNamespaces = options ? options.ignoredNamespaces : null;
if (ignoredNamespaces &&

@@ -1129,3 +1126,3 @@ (Array.isArray(ignoredNamespaces.namespaces) || typeof ignoredNamespaces.namespaces === 'string')) {

}
var ignoreBaseNameSpaces = options ? options.ignoreBaseNameSpaces : null;
const ignoreBaseNameSpaces = options ? options.ignoreBaseNameSpaces : null;
if (ignoreBaseNameSpaces !== null && typeof ignoreBaseNameSpaces !== 'undefined') {

@@ -1144,12 +1141,11 @@ this.options.ignoreBaseNameSpaces = ignoreBaseNameSpaces;

this.options.useEmptyTag = !!options.useEmptyTag;
};
WSDL.prototype._processNextInclude = function (includes, callback) {
var _this = this;
var include = includes.shift();
}
_processNextInclude(includes, callback) {
const include = includes.shift();
if (!include) {
return callback();
}
var includePath;
let includePath;
if (!/^https?:/i.test(this.uri) && !/^https?:/i.test(include.location)) {
var isFixed = (this.options.wsdl_options !== undefined && this.options.wsdl_options.hasOwnProperty('fixedPath')) ? this.options.wsdl_options.fixedPath : false;
const isFixed = (this.options.wsdl_options !== undefined && this.options.wsdl_options.hasOwnProperty('fixedPath')) ? this.options.wsdl_options.fixedPath : false;
if (isFixed) {

@@ -1168,13 +1164,13 @@ includePath = path.resolve(path.dirname(this.uri), path.parse(include.location).base);

}
var options = Object.assign({}, this.options);
const options = Object.assign({}, this.options);
// follow supplied ignoredNamespaces option
options.ignoredNamespaces = this._originalIgnoredNamespaces || this.options.ignoredNamespaces;
options.WSDL_CACHE = this.WSDL_CACHE;
open_wsdl_recursive(includePath, options, function (err, wsdl) {
open_wsdl_recursive(includePath, options, (err, wsdl) => {
if (err) {
return callback(err);
}
_this._includesWsdl.push(wsdl);
this._includesWsdl.push(wsdl);
if (wsdl.definitions instanceof elements.DefinitionsElement) {
_.mergeWith(_this.definitions, wsdl.definitions, function (a, b) {
_.mergeWith(this.definitions, wsdl.definitions, (a, b) => {
return (a instanceof elements.SchemaElement) ? a.merge(b) : undefined;

@@ -1186,21 +1182,20 @@ });

}
_this._processNextInclude(includes, function (err) {
this._processNextInclude(includes, (err) => {
callback(err);
});
});
};
WSDL.prototype._parse = function (xml) {
var _this = this;
var p = sax.parser(true, null);
var stack = [];
var root = null;
var types = null;
var schema = null;
var schemaAttrs = null;
var options = this.options;
p.onopentag = function (node) {
var nsName = node.name;
var attrs = node.attributes;
var top = stack[stack.length - 1];
var name = utils_1.splitQName(nsName).name;
}
_parse(xml) {
const p = sax.parser(true, null);
const stack = [];
let root = null;
let types = null;
let schema = null;
let schemaAttrs = null;
const options = this.options;
p.onopentag = (node) => {
const nsName = node.name;
const attrs = node.attributes;
const top = stack[stack.length - 1];
const name = (0, utils_1.splitQName)(nsName).name;
if (name === 'schema') {

@@ -1214,3 +1209,3 @@ schemaAttrs = attrs;

catch (e) {
if (_this.options.strict) {
if (this.options.strict) {
throw e;

@@ -1242,5 +1237,5 @@ }

};
p.onclosetag = function (name) {
var top = stack[stack.length - 1];
assert_1.ok(top, 'Unmatched close tag: ' + name);
p.onclosetag = (name) => {
const top = stack[stack.length - 1];
(0, assert_1.ok)(top, 'Unmatched close tag: ' + name);
top.endElement(stack, name);

@@ -1250,21 +1245,21 @@ };

return root;
};
WSDL.prototype._fromXML = function (xml) {
}
_fromXML(xml) {
this.definitions = this._parse(xml);
this.definitions.descriptions = {
types: {},
elements: {}
elements: {},
};
this.xml = xml;
};
WSDL.prototype._fromServices = function (services) {
};
WSDL.prototype._xmlnsMap = function () {
var xmlns = this.definitions.xmlns;
var str = '';
for (var alias in xmlns) {
}
_fromServices(services) {
}
_xmlnsMap() {
const xmlns = this.definitions.xmlns;
let str = '';
for (const alias in xmlns) {
if (alias === '' || alias === utils_1.TNS_PREFIX) {
continue;
}
var ns = xmlns[alias];
const ns = xmlns[alias];
switch (ns) {

@@ -1291,11 +1286,10 @@ case 'http://xml.apache.org/xml-soap': // apachesoap

return str;
};
return WSDL;
}());
}
}
exports.WSDL = WSDL;
function open_wsdl_recursive(uri, p2, p3) {
var fromCache;
var WSDL_CACHE;
var options;
var callback;
let fromCache;
let WSDL_CACHE;
let options;
let callback;
if (typeof p2 === 'function') {

@@ -1316,4 +1310,4 @@ options = {};

function open_wsdl(uri, p2, p3) {
var options;
var callback;
let options;
let callback;
if (typeof p2 === 'function') {

@@ -1328,9 +1322,15 @@ options = {};

// initialize cache when calling open_wsdl directly
var WSDL_CACHE = options.WSDL_CACHE || {};
var request_headers = options.wsdl_headers;
var request_options = options.wsdl_options;
var wsdl;
if (!/^https?:/i.test(uri)) {
const WSDL_CACHE = options.WSDL_CACHE || {};
const request_headers = options.wsdl_headers;
const request_options = options.wsdl_options;
let wsdl;
if (/^\<\?xml[^>]*?>/i.test(uri)) {
wsdl = new WSDL(uri, uri, options);
WSDL_CACHE[uri] = wsdl;
wsdl.WSDL_CACHE = WSDL_CACHE;
wsdl.onReady(callback);
}
else if (!/^https?:/i.test(uri)) {
debug('Reading file: %s', uri);
fs.readFile(uri, 'utf8', function (err, definition) {
fs.readFile(uri, 'utf8', (err, definition) => {
if (err) {

@@ -1349,4 +1349,4 @@ callback(err);

debug('Reading url: %s', uri);
var httpClient = options.httpClient || new http_1.HttpClient(options);
httpClient.request(uri, null /* options */, function (err, response, definition) {
const httpClient = options.httpClient || new http_1.HttpClient(options);
httpClient.request(uri, null /* options */, (err, response, definition) => {
if (err) {

@@ -1353,0 +1353,0 @@ callback(err);

{
"name": "soap",
"version": "0.45.0",
"version": "1.0.0",
"description": "A minimal node SOAP client",
"engines": {
"node": ">=12.0.0"
"node": ">=14.0.0"
},

@@ -12,3 +12,3 @@ "author": "Vinay Pulim <v@pulim.com>",

"debug": "^4.3.2",
"formidable": "^2.0.1",
"formidable": "^3.2.4",
"get-stream": "^6.0.1",

@@ -20,6 +20,6 @@ "lodash": "^4.17.21",

"whatwg-mimetype": "3.0.0",
"xml-crypto": "^2.1.3"
"xml-crypto": "^3.0.0"
},
"peerDependencies": {
"axios": ">=0.21.1"
"axios": "^0.27.2"
},

@@ -53,2 +53,3 @@ "repository": {

"devDependencies": {
"@types/axios": "^0.14.0",
"@types/debug": "^4.1.7",

@@ -83,5 +84,5 @@ "@types/express": "^4.17.13",

"tslint": "^5.18.0",
"typedoc": "^0.20.37",
"typescript": "^3.9.10"
"typedoc": "^0.23.10",
"typescript": "^4.7.4"
}
}

@@ -932,3 +932,15 @@ # Soap [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url]

* `attrs`: (optional) A hash of attributes and values attrName: value to add to the signature root node
* `idMode`: (optional) either 'wssecurity' to generate wsse-scoped reference Id on <Body> or undefined for an unscoped reference Id
### WSSecurityPlusCert
Use WSSecurity and WSSecurityCert together.
``` javascript
var wsSecurity = new soap.WSSecurity(/* see WSSecurity above */);
var wsSecurityCert = new soap.WSSecurityCert(/* see WSSecurityCert above */);
var wsSecurityPlusCert = new soap.WSSecurityPlusCert(wsSecurity, wsSecurityCert);
client.setSecurity(wsSecurityPlusCert);
```
#### Option examples

@@ -935,0 +947,0 @@

{
"compileOnSave": true,
"compilerOptions": {
"target": "es3",
"target": "es2020",
"module": "commonjs",
"moduleResolution": "nodenext",
"outDir": "lib",

@@ -7,0 +8,0 @@ "sourceMap": true,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc