UNPKG

n8n-nodes-soaprequest

Version:
34 lines 1.86 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.interpolateSOAPHeaderCredentials = exports.interpolateSOAPBodyCredentials = void 0; const Authentication_operations_1 = require("./Authentication.operations"); const Soap_operations_1 = require("./Soap.operations"); async function interpolateSOAPBodyCredentials(execution, index) { return await interpolateCredentials(execution, index, Soap_operations_1.SOAP_BODY); } exports.interpolateSOAPBodyCredentials = interpolateSOAPBodyCredentials; async function interpolateSOAPHeaderCredentials(execution, index) { return await interpolateCredentials(execution, index, Soap_operations_1.SOAP_HEADERS); } exports.interpolateSOAPHeaderCredentials = interpolateSOAPHeaderCredentials; async function interpolateCredentials(execution, index, parameterName) { let content = execution.getNodeParameter(parameterName, index, '', { rawExpressions: true }); const authentication = execution.getNodeParameter(Authentication_operations_1.AUTHENTICATION, index, ''); const credentials = authentication === Authentication_operations_1.SOAP_API_CREDENTIALS_TYPE ? await execution.getCredentials(Authentication_operations_1.SOAP_API_CREDENTIAL, index) : undefined; if (credentials !== undefined) { const username = credentials['username']; const password = credentials['password']; content = content .replace(/{{\s?\$credentials\.username\s?}}/g, username.toString()) .replace(/{{\s?\$credentials\.password\s?}}/g, password.toString()); } const evaluatedExpression = execution.evaluateExpression(content, index); return evaluatedExpression.indexOf('=') === 0 ? evaluatedExpression.substring(1) : evaluatedExpression; } //# sourceMappingURL=Authentication.utils.js.map