@sap/wing-service-explorer
Advanced tools
Comparing version 1.6.7 to 1.6.10
@@ -8,2 +8,3 @@ import { IChildLogger } from "@vscode-logging/types"; | ||
static readonly ODATA_CATALOG_SERVICES = "/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/ServiceCollection"; | ||
static readonly ODATA_CATALOG_RECOMMENDED_SERVICES = "/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/RecommendedServiceCollection"; | ||
static readonly ODATA_CATALOG_FILTER_FOR_S4_HANA_SERVICES = "?$filter=((IsSapService%20eq%20true)and(ReleaseStatus%20eq%20%27RELEASED%27))or((IsSapService%20eq%20false))"; | ||
@@ -21,2 +22,4 @@ static readonly ODATA_CATALOG_ATO = "/sap/bc/adt/ato/settings"; | ||
getAnnotations(connectionDetails: ConnectionDetails): Promise<IAnnotation[]>; | ||
private sendRequestGetServices; | ||
private buildGetServiceUrl; | ||
private getAnnotationXML; | ||
@@ -23,0 +26,0 @@ private getAnnotationsList; |
@@ -20,2 +20,3 @@ "use strict"; | ||
const util_1 = require("util"); | ||
const lodash_1 = require("lodash"); | ||
class CatalogExplorer extends serviceExplorer_1.ServiceExplorer { | ||
@@ -53,19 +54,19 @@ constructor(h2oURL, proxy, logger) { | ||
} | ||
let urlPath = CatalogExplorer.DESTINATION_PATH.concat("/") | ||
.concat(connectionDetails.destinationName) | ||
.concat(CatalogExplorer.ODATA_CATALOG_SERVICES); | ||
const isS4HanaSystem = yield this.isS4HanaCloudSystem(connectionDetails); | ||
if (isS4HanaSystem) { | ||
urlPath = urlPath.concat(CatalogExplorer.ODATA_CATALOG_FILTER_FOR_S4_HANA_SERVICES); | ||
this.logger.debug("This is S/4 HANA cloud service catalog/system, so getting ServiceCollection with filter.", { method: this.getServices.name, urlPath }); | ||
} | ||
let urlPath = yield this.buildGetServiceUrl(connectionDetails, CatalogExplorer.ODATA_CATALOG_RECOMMENDED_SERVICES); | ||
this.logger.trace(this.getServices.name, { urlPath }); | ||
const oHeaders = this.initHeaders(connectionDetails); | ||
return this.sendRequest(this.h2oUrl, urlPath, this.proxy, true, oHeaders).then((res) => { | ||
this.services = _.get(res, ["d", "results"]); | ||
if (!this.services) { | ||
return Promise.reject(messages_1.messages.ERROR_RETRIEVE_SERVICES); | ||
} | ||
return this.services; | ||
}); | ||
let services; | ||
try { | ||
services = yield this.sendRequestGetServices(urlPath, oHeaders); | ||
} | ||
catch (e) { | ||
this.logger.debug(`getServices: failed to retrieve data using ${urlPath} url, error: ${e}`); | ||
} | ||
// If empty (null, undefined, empty array) then use the old URL 'ServiceCollection' | ||
if (lodash_1.isEmpty(services)) { | ||
urlPath = yield this.buildGetServiceUrl(connectionDetails, CatalogExplorer.ODATA_CATALOG_SERVICES); | ||
this.logger.debug(`Trying with old API using URL ${urlPath}`); | ||
services = yield this.sendRequestGetServices(urlPath, oHeaders); | ||
} | ||
return services; | ||
}); | ||
@@ -100,2 +101,26 @@ } | ||
} | ||
sendRequestGetServices(urlPath, oHeaders) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.sendRequest(this.h2oUrl, urlPath, this.proxy, true, oHeaders).then((res) => { | ||
this.services = _.get(res, ["d", "results"]); | ||
if (!this.services) { | ||
return Promise.reject(messages_1.messages.ERROR_RETRIEVE_SERVICES); | ||
} | ||
return this.services; | ||
}); | ||
}); | ||
} | ||
buildGetServiceUrl(connectionDetails, odataCatalogService) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let urlPath = CatalogExplorer.DESTINATION_PATH.concat("/") | ||
.concat(connectionDetails.destinationName) | ||
.concat(odataCatalogService); | ||
const isS4HanaSystem = yield this.isS4HanaCloudSystem(connectionDetails); | ||
if (isS4HanaSystem) { | ||
urlPath = urlPath.concat(CatalogExplorer.ODATA_CATALOG_FILTER_FOR_S4_HANA_SERVICES); | ||
this.logger.debug("This is S/4 HANA cloud service catalog/system, so getting ServiceCollection with filter.", { method: this.getServices.name, urlPath }); | ||
} | ||
return urlPath; | ||
}); | ||
} | ||
getAnnotationXML(path, connectionDetails) { | ||
@@ -180,2 +205,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
CatalogExplorer.ODATA_CATALOG_SERVICES = "/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/ServiceCollection"; | ||
CatalogExplorer.ODATA_CATALOG_RECOMMENDED_SERVICES = "/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/RecommendedServiceCollection"; | ||
// Filter to get only sap released services or non sap services. | ||
@@ -182,0 +208,0 @@ CatalogExplorer.ODATA_CATALOG_FILTER_FOR_S4_HANA_SERVICES = "?$filter=((IsSapService%20eq%20true)and(ReleaseStatus%20eq%20%27RELEASED%27))or((IsSapService%20eq%20false))"; |
{ | ||
"name": "@sap/wing-service-explorer", | ||
"version": "1.6.7", | ||
"version": "1.6.10", | ||
"description": "Provide the ability to explore SAP services", | ||
@@ -25,3 +25,3 @@ "license": "See LICENSE.txt", | ||
"dependencies": { | ||
"lodash": "4.17.16", | ||
"lodash": "4.17.21", | ||
"request": "2.88.0", | ||
@@ -28,0 +28,0 @@ "vkbeautify": "0.99.3", |
@@ -1,2 +0,1 @@ | ||
# @sap/wing-service-explorer | ||
@@ -3,0 +2,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
327560
5987
0
64
+ Addedlodash@4.17.21(transitive)
- Removedlodash@4.17.16(transitive)
Updatedlodash@4.17.21