@sap-ux/axios-extension 0.9.3 → 0.9.6
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
|
*/
|
|
@@ -41,7 +41,8 @@ class LayeredRepositoryService extends axios_1.Axios {
|
|
|
41
41
|
const response = yield this.get(DTA_PATH_SUFFIX, {
|
|
42
42
|
params: {
|
|
43
43
|
name: getNamespaceAsString(namespace),
|
|
44
|
-
layer: 'CUSTOMER_BASE'
|
|
44
|
+
layer: 'CUSTOMER_BASE',
|
|
45
|
+
timestamp: Date.now()
|
|
45
46
|
}
|
|
46
47
|
});
|
|
47
48
|
this.tryLogResponse(response);
|
|
@@ -56,6 +57,7 @@ class LayeredRepositoryService extends axios_1.Axios {
|
|
|
56
57
|
* @returns the Axios response object for futher processing
|
|
57
58
|
*/
|
|
58
59
|
deploy(archivePath, config) {
|
|
60
|
+
var _a;
|
|
59
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
60
62
|
const archive = fs_1.readFileSync(archivePath);
|
|
61
63
|
const checkResponse = yield this.isExistingVariant(config.namespace);
|
|
@@ -63,11 +65,9 @@ class LayeredRepositoryService extends axios_1.Axios {
|
|
|
63
65
|
name: getNamespaceAsString(config.namespace),
|
|
64
66
|
layer: 'CUSTOMER_BASE'
|
|
65
67
|
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
params['changeList'] = config.transport;
|
|
70
|
-
}
|
|
68
|
+
params['package'] = (_a = config.package) !== null && _a !== void 0 ? _a : '$TMP';
|
|
69
|
+
if (params['package'].toUpperCase() !== '$TMP') {
|
|
70
|
+
params['changelist'] = config.transport;
|
|
71
71
|
}
|
|
72
72
|
const response = yield this.request({
|
|
73
73
|
method: checkResponse.status === 200 ? 'PUT' : 'POST',
|
|
@@ -99,7 +99,7 @@ class LayeredRepositoryService extends axios_1.Axios {
|
|
|
99
99
|
layer: 'CUSTOMER_BASE'
|
|
100
100
|
};
|
|
101
101
|
if (config.transport) {
|
|
102
|
-
params['
|
|
102
|
+
params['changelist'] = config.transport;
|
|
103
103
|
}
|
|
104
104
|
const response = yield this.delete(DTA_PATH_SUFFIX, { params });
|
|
105
105
|
this.tryLogResponse(response, 'Undeployment successful.');
|
|
@@ -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/axios-extension",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
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.0",
|
|
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",
|