Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sap/wing-service-explorer

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap/wing-service-explorer - npm Package Compare versions

Comparing version 1.7.3 to 1.8.0

1

dist/lib/serviceExplorer.d.ts

@@ -27,2 +27,3 @@ import { IChildLogger } from "@vscode-logging/types";

getServices(connectionDetails: ConnectionDetails): Promise<any>;
private convertProxy;
protected sendRequest(url: string, urlPath: string, proxy: string, json: boolean, headers?: any): Promise<any>;

@@ -29,0 +30,0 @@ protected filterDestinationByWebIDEUsage(listOfDestinationsObj: any, webIDEUsage: string): any;

124

dist/lib/serviceExplorer.js

@@ -14,3 +14,2 @@ "use strict";

const _ = require("lodash");
const request = require("request");
const vkbeautify = require("vkbeautify");

@@ -20,2 +19,3 @@ const messages_1 = require("./i18n/messages");

const defaultLogger_1 = require("./defaultLogger");
const axios_1 = require("axios");
class ServiceExplorer {

@@ -74,28 +74,35 @@ constructor(h2oURL, proxy, logger) {

}
convertProxy(proxy) {
if (!proxy) {
return undefined;
}
const proxyUrl = new URL(proxy);
return {
port: Number(proxyUrl.port),
host: proxyUrl.hostname,
};
}
sendRequest(url, urlPath, proxy, json, headers) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const prop = {
json,
strictSSL: false,
proxy,
const config = {
url: url.concat(urlPath),
method: "GET",
proxy: this.convertProxy(proxy),
headers,
};
this.serviceExplorerlogger.debug(this.sendRequest.name, { url: url, urlPath: urlPath });
return new Promise((resolve, reject) => {
request.get(url.concat(urlPath), prop, (err, resp, body) => {
if (err) {
this.serviceExplorerlogger.error(this.sendRequest.name, { error: err });
reject(err);
}
else {
if (resp.statusCode === ServiceExplorer.STATUS_NOT_AUTH) {
reject(ServiceExplorer.ERROR_NEED_AUTH);
}
else {
this.serviceExplorerlogger.trace(this.sendRequest.name, { responseBody: body });
resolve(body);
}
}
});
});
this.serviceExplorerlogger.debug(this.sendRequest.name, { url, urlPath });
try {
const response = yield axios_1.default.request(config);
const { data } = response;
this.serviceExplorerlogger.trace(this.sendRequest.name, { responseBody: data });
return data;
}
catch (err) {
if (((_a = err.response) === null || _a === void 0 ? void 0 : _a.status) === ServiceExplorer.STATUS_NOT_AUTH) {
throw new Error(ServiceExplorer.ERROR_NEED_AUTH);
}
this.serviceExplorerlogger.error(this.sendRequest.name, { err });
throw err;
}
});

@@ -110,38 +117,39 @@ }

sendMetaDataRequest(serviceMetadataUrl, headers) {
this.serviceExplorerlogger.debug(this.sendMetaDataRequest.name, { url: serviceMetadataUrl });
return new Promise((resolve, reject) => {
request.get(serviceMetadataUrl, { strictSSL: false, proxy: this.proxy, headers }, (err, resp, body) => {
if (err) {
this.serviceExplorerlogger.error(this.sendMetaDataRequest.name, { error: err });
reject(err);
var _a;
return __awaiter(this, void 0, void 0, function* () {
this.serviceExplorerlogger.debug(this.sendMetaDataRequest.name, { url: serviceMetadataUrl });
try {
const config = {
url: serviceMetadataUrl,
method: "GET",
proxy: this.convertProxy(this.proxy),
headers,
};
const response = yield axios_1.default.request(config);
const { data } = response;
const beautifiedBody = vkbeautify.xml(data);
this.serviceExplorerlogger.trace(this.sendMetaDataRequest.name, {
receivedMetaDataBody: beautifiedBody,
});
return beautifiedBody;
}
catch (err) {
const status = (_a = err.response) === null || _a === void 0 ? void 0 : _a.status;
if (status === ServiceExplorer.STATUS_NOT_AUTH) {
const errorMessage = ServiceExplorer.ERROR_NEED_AUTH;
this.serviceExplorerlogger.error(this.sendMetaDataRequest.name, {
receivedStatusCode: status,
error: "ERROR_NEED_AUTH",
returnedErrorMessage: errorMessage,
});
throw new Error(errorMessage);
}
else {
if (resp.statusCode === ServiceExplorer.STATUS_NOT_AUTH) {
const errorMessage = ServiceExplorer.ERROR_NEED_AUTH;
this.serviceExplorerlogger.error(this.sendMetaDataRequest.name, {
receivedStatusCode: resp.statusCode,
error: "ERROR_NEED_AUTH",
returnedErrorMessage: errorMessage,
});
reject(errorMessage);
}
else if (resp.statusCode !== ServiceExplorer.STATUS_SUCCESS) {
const errorMessage = messages_1.messages.ERROR_RETRIEVE_METADATA;
this.serviceExplorerlogger.debug(this.sendMetaDataRequest.name, {
receivedStatusCode: resp.statusCode,
error: "ERROR_RETRIEVE_METADATA",
returnedErrorMessage: errorMessage,
receivedMetaDataBody: body,
});
reject(errorMessage);
}
else {
const beautifiedBody = vkbeautify.xml(body);
this.serviceExplorerlogger.trace(this.sendMetaDataRequest.name, {
receivedMetaDataBody: beautifiedBody,
});
resolve(beautifiedBody);
}
}
});
const errorMessage = messages_1.messages.ERROR_RETRIEVE_METADATA;
this.serviceExplorerlogger.debug(this.sendMetaDataRequest.name, {
receivedStatusCode: status,
error: err,
returnedErrorMessage: errorMessage,
});
throw new Error(errorMessage);
}
});

@@ -148,0 +156,0 @@ }

{
"name": "@sap/wing-service-explorer",
"version": "1.7.3",
"version": "1.8.0",
"description": "Provide the ability to explore SAP services",

@@ -26,5 +26,5 @@ "license": "See LICENSE.txt",

"lodash": "4.17.21",
"request": "2.88.0",
"axios": "^0.21.1",
"vkbeautify": "0.99.3",
"xml2js": "0.4.19",
"xml2js": "0.5.0",
"fs-extra": "7.0.1",

@@ -43,3 +43,2 @@ "@vscode-logging/types": "~0.1.1",

"@types/node": "^12.0.8",
"@types/request": "2.48.1",
"@types/sinon": "^7.0.13",

@@ -64,3 +63,4 @@ "@types/vkbeautify": "^0.99.2",

"typescript": "^3.9.7",
"ts-node": "^8.3.0"
"ts-node": "^8.3.0",
"axios-mock-adapter": "1.21.2"
},

@@ -67,0 +67,0 @@ "engines": {

@@ -64,2 +64,1 @@ # @sap/wing-service-explorer

Returns a list of destinations which contain an additional property named **XFSystemName**.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc