@sap-ux/axios-extension 0.9.4 → 0.9.7
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.
|
@@ -96,6 +96,7 @@ function getTransportList(doc) {
|
|
|
96
96
|
/**
|
|
97
97
|
* This function processes ADT response for new project name that have not been deployed before,
|
|
98
98
|
* all the available transport numbers are returned.
|
|
99
|
+
*
|
|
99
100
|
* @param doc
|
|
100
101
|
* @returns
|
|
101
102
|
*/
|
|
@@ -115,6 +116,7 @@ function getTransportableList(doc) {
|
|
|
115
116
|
/**
|
|
116
117
|
* This function processes ADT response for existing project name that has been locked.
|
|
117
118
|
* A single, previously provided transport number is returned in the list.
|
|
119
|
+
*
|
|
118
120
|
* @param doc
|
|
119
121
|
* @returns
|
|
120
122
|
*/
|
|
@@ -18,6 +18,23 @@ exports.abapUrlReplaceMap = new Map([
|
|
|
18
18
|
[/-api\.s4hana\.ondemand\.com/, '.s4hana.ondemand.com'],
|
|
19
19
|
[/-api\.saps4hanacloud\.cn/, '.saps4hanacloud.cn']
|
|
20
20
|
]);
|
|
21
|
+
const xmlReplaceMap = {
|
|
22
|
+
'&': '&',
|
|
23
|
+
'"': '"',
|
|
24
|
+
"'": ''',
|
|
25
|
+
'<': '<',
|
|
26
|
+
'>': '>'
|
|
27
|
+
};
|
|
28
|
+
const xmlReplaceRegex = /[<>&"']/g;
|
|
29
|
+
/**
|
|
30
|
+
* Escape invalid characters for XML values.
|
|
31
|
+
*
|
|
32
|
+
* @param xmlValue
|
|
33
|
+
* @returns escaped xml value
|
|
34
|
+
*/
|
|
35
|
+
function encodeXmlValue(xmlValue) {
|
|
36
|
+
return xmlValue.replace(xmlReplaceRegex, (c) => xmlReplaceMap[c]);
|
|
37
|
+
}
|
|
21
38
|
/**
|
|
22
39
|
* Extension of the generic OData client simplifying the consumption of the UI5 repository service
|
|
23
40
|
*/
|
|
@@ -150,20 +167,21 @@ class Ui5AbapRepositoryService extends odata_service_1.ODataService {
|
|
|
150
167
|
createPayload(archive, name, description, abapPackage) {
|
|
151
168
|
const base64Data = fs_1.readFileSync(archive, { encoding: 'base64' });
|
|
152
169
|
const time = new Date().toISOString();
|
|
170
|
+
const escapedName = encodeXmlValue(name);
|
|
153
171
|
return (`<entry xmlns="http://www.w3.org/2005/Atom"` +
|
|
154
172
|
` xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"` +
|
|
155
173
|
` xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"` +
|
|
156
174
|
` xml:base="${this.defaults.baseURL}">` +
|
|
157
|
-
` <id>${this.defaults.baseURL}/Repositories('${
|
|
158
|
-
` <title type="text">Repositories('${
|
|
175
|
+
` <id>${this.defaults.baseURL}/Repositories('${escapedName}')</id>` +
|
|
176
|
+
` <title type="text">Repositories('${escapedName}')</title>` +
|
|
159
177
|
` <updated>${time}</updated>` +
|
|
160
178
|
` <category term="/UI5/ABAP_REPOSITORY_SRV.Repository" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>` +
|
|
161
|
-
` <link href="Repositories('${
|
|
179
|
+
` <link href="Repositories('${escapedName}')" rel="edit" title="Repository"/>` +
|
|
162
180
|
` <content type="application/xml">` +
|
|
163
181
|
` <m:properties>` +
|
|
164
|
-
` <d:Name>${
|
|
182
|
+
` <d:Name>${escapedName}</d:Name>` +
|
|
165
183
|
` <d:Package>${abapPackage === null || abapPackage === void 0 ? void 0 : abapPackage.toUpperCase()}</d:Package>` +
|
|
166
|
-
` <d:Description>${description}</d:Description>` +
|
|
184
|
+
` <d:Description>${encodeXmlValue(description)}</d:Description>` +
|
|
167
185
|
` <d:ZipArchive>${base64Data}</d:ZipArchive>` +
|
|
168
186
|
` <d:Info/>` +
|
|
169
187
|
` </m:properties>` +
|
package/dist/factory.d.ts
CHANGED
|
@@ -51,6 +51,10 @@ declare type AbapCloudOptions = AbapCloudStandaloneOptions | AbapEmbeddedSteampu
|
|
|
51
51
|
* @returns instance of an {@link AbapServiceProvider}
|
|
52
52
|
*/
|
|
53
53
|
export declare function createForAbapOnCloud(options: AbapCloudOptions & Partial<ProviderConfiguration>): AbapServiceProvider;
|
|
54
|
+
/**
|
|
55
|
+
* To create a destination provider only the destination name is absolutely required.
|
|
56
|
+
*/
|
|
57
|
+
export declare type MinimalDestinationConfig = Pick<Destination, 'Name'> & Partial<Destination>;
|
|
54
58
|
/**
|
|
55
59
|
* Create an instance of a service provider for the given destination.
|
|
56
60
|
*
|
|
@@ -59,7 +63,7 @@ export declare function createForAbapOnCloud(options: AbapCloudOptions & Partial
|
|
|
59
63
|
* @param destinationServiceInstance optional id of a destination service instance providing the destination
|
|
60
64
|
* @returns instance of a service provider
|
|
61
65
|
*/
|
|
62
|
-
export declare function createForDestination(options: AxiosRequestConfig & Partial<ProviderConfiguration>, destination:
|
|
66
|
+
export declare function createForDestination(options: AxiosRequestConfig & Partial<ProviderConfiguration>, destination: MinimalDestinationConfig, destinationServiceInstance?: string): ServiceProvider;
|
|
63
67
|
/**
|
|
64
68
|
* Create an instance of a basic service provider and then generate an extension for a service based on the given url.
|
|
65
69
|
*
|
package/dist/factory.js
CHANGED
|
@@ -144,7 +144,7 @@ exports.createForAbapOnCloud = createForAbapOnCloud;
|
|
|
144
144
|
function createForDestination(options, destination, destinationServiceInstance) {
|
|
145
145
|
var _a;
|
|
146
146
|
const { cookies } = options, config = __rest(options, ["cookies"]);
|
|
147
|
-
const providerConfig = Object.assign(Object.assign({}, config), { baseURL: btp_utils_1.getDestinationUrlForAppStudio(destination.Name, new URL(destination.Host).pathname), cookies: cookies });
|
|
147
|
+
const providerConfig = Object.assign(Object.assign({}, config), { baseURL: btp_utils_1.getDestinationUrlForAppStudio(destination.Name, destination.Host ? new URL(destination.Host).pathname : undefined), cookies: cookies });
|
|
148
148
|
// SAML in AppStudio is not yet supported
|
|
149
149
|
providerConfig.params = (_a = providerConfig.params) !== null && _a !== void 0 ? _a : {};
|
|
150
150
|
providerConfig.params.saml2 = 'disabled';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/axios-extension",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.7",
|
|
4
4
|
"description": "Extension of the Axios module adding convinience methods to interact with SAP systems especially with OData services.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"private": false,
|
|
15
15
|
"main": "dist/index.js",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@sap-ux/btp-utils": "0.
|
|
18
|
-
"@sap-ux/logger": "0.
|
|
17
|
+
"@sap-ux/btp-utils": "0.11.1",
|
|
18
|
+
"@sap-ux/logger": "0.3.0",
|
|
19
19
|
"axios": "0.24.0",
|
|
20
20
|
"detect-content-type": "1.2.0",
|
|
21
21
|
"express": "4.17.1",
|