@sap-ux/axios-extension 1.14.0 → 1.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -20,6 +20,14 @@ export interface ODataServiceV2Info {
|
|
|
20
20
|
export declare class V2CatalogService extends CatalogService {
|
|
21
21
|
static readonly PATH = "/sap/opu/odata/IWFND/CATALOGSERVICE;v=2";
|
|
22
22
|
protected determineEntitySet(): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Returns the service path for the provided serivce URL.
|
|
25
|
+
*
|
|
26
|
+
* @param serviceUrl - service url (may be full service url or service path)
|
|
27
|
+
* @param baseUrl - base url for the odata service
|
|
28
|
+
* @returns - service path
|
|
29
|
+
*/
|
|
30
|
+
private getServicePath;
|
|
23
31
|
/**
|
|
24
32
|
* Map the V2 service information to a version independent structure.
|
|
25
33
|
*
|
|
@@ -28,6 +28,24 @@ class V2CatalogService extends base_1.CatalogService {
|
|
|
28
28
|
: V2_CLASSIC_ENTITYSET;
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Returns the service path for the provided serivce URL.
|
|
33
|
+
*
|
|
34
|
+
* @param serviceUrl - service url (may be full service url or service path)
|
|
35
|
+
* @param baseUrl - base url for the odata service
|
|
36
|
+
* @returns - service path
|
|
37
|
+
*/
|
|
38
|
+
getServicePath(serviceUrl, baseUrl) {
|
|
39
|
+
let parsedUrl;
|
|
40
|
+
try {
|
|
41
|
+
parsedUrl = new URL(serviceUrl);
|
|
42
|
+
}
|
|
43
|
+
catch (_a) {
|
|
44
|
+
// there are cases where the service url is just the path and not the full service url
|
|
45
|
+
parsedUrl = new URL(serviceUrl, baseUrl);
|
|
46
|
+
}
|
|
47
|
+
return parsedUrl.pathname;
|
|
48
|
+
}
|
|
31
49
|
/**
|
|
32
50
|
* Map the V2 service information to a version independent structure.
|
|
33
51
|
*
|
|
@@ -36,10 +54,11 @@ class V2CatalogService extends base_1.CatalogService {
|
|
|
36
54
|
*/
|
|
37
55
|
mapServices(services) {
|
|
38
56
|
return services.map((service) => {
|
|
57
|
+
const path = this.getServicePath(service.ServiceUrl, this.defaults.baseURL);
|
|
39
58
|
return {
|
|
40
59
|
id: service.ID,
|
|
41
60
|
name: service.TechnicalServiceName,
|
|
42
|
-
path:
|
|
61
|
+
path: path,
|
|
43
62
|
serviceVersion: service.TechnicalServiceVersion + '',
|
|
44
63
|
odataVersion: odata_service_1.ODataVersion.v2
|
|
45
64
|
};
|
package/package.json
CHANGED