@sap-ux/deploy-tooling 0.11.4 → 0.11.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.
- package/dist/base/validate.d.ts +1 -0
- package/dist/base/validate.js +51 -8
- package/package.json +5 -5
package/dist/base/validate.d.ts
CHANGED
package/dist/base/validate.js
CHANGED
|
@@ -14,6 +14,7 @@ const axios_extension_1 = require("@sap-ux/axios-extension");
|
|
|
14
14
|
const chalk_1 = require("chalk");
|
|
15
15
|
const project_input_validator_1 = require("@sap-ux/project-input-validator");
|
|
16
16
|
const os_1 = require("os");
|
|
17
|
+
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
17
18
|
var SummaryStatus;
|
|
18
19
|
(function (SummaryStatus) {
|
|
19
20
|
SummaryStatus[SummaryStatus["Valid"] = 0] = "Valid";
|
|
@@ -41,7 +42,7 @@ exports.summaryMessage = {
|
|
|
41
42
|
* @returns Validation result and a summary report of identified issues.
|
|
42
43
|
*/
|
|
43
44
|
function validateBeforeDeploy(config, provider, logger) {
|
|
44
|
-
var _a, _b, _c, _d, _e, _f;
|
|
45
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
45
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
47
|
const output = {
|
|
47
48
|
summary: [],
|
|
@@ -53,10 +54,12 @@ function validateBeforeDeploy(config, provider, logger) {
|
|
|
53
54
|
package: (_c = config.app.package) !== null && _c !== void 0 ? _c : '',
|
|
54
55
|
transport: (_d = config.app.transport) !== null && _d !== void 0 ? _d : '',
|
|
55
56
|
client: (_e = config.target.client) !== null && _e !== void 0 ? _e : '',
|
|
56
|
-
url: (_f = config.target.url) !== null && _f !== void 0 ? _f : ''
|
|
57
|
+
url: (_f = config.target.url) !== null && _f !== void 0 ? _f : '',
|
|
58
|
+
destination: (_g = config.target.destination) !== null && _g !== void 0 ? _g : ''
|
|
57
59
|
};
|
|
58
60
|
// output is passed by reference and status updated during the internal pipeline below.
|
|
59
61
|
yield validateInputTextFormat(input, output, provider, logger);
|
|
62
|
+
convertInputsForAdtValidations(input, output);
|
|
60
63
|
yield validatePackageWithAdt(input, output, provider, logger);
|
|
61
64
|
yield validateTransportRequestWithAdt(input, output, provider, logger);
|
|
62
65
|
return output;
|
|
@@ -86,7 +89,7 @@ function formatSummary(summary) {
|
|
|
86
89
|
statusSymbol = (0, chalk_1.yellow)('?');
|
|
87
90
|
break;
|
|
88
91
|
}
|
|
89
|
-
return `${'
|
|
92
|
+
return `${' '.repeat(4)}${statusSymbol} ${next.message}`;
|
|
90
93
|
})
|
|
91
94
|
.reduce((aggregated, current) => {
|
|
92
95
|
return `${aggregated}${os_1.EOL}${current}`;
|
|
@@ -94,6 +97,29 @@ function formatSummary(summary) {
|
|
|
94
97
|
return summaryStr;
|
|
95
98
|
}
|
|
96
99
|
exports.formatSummary = formatSummary;
|
|
100
|
+
/**
|
|
101
|
+
*
|
|
102
|
+
* @param input
|
|
103
|
+
* @param output
|
|
104
|
+
*/
|
|
105
|
+
function convertInputsForAdtValidations(input, output) {
|
|
106
|
+
const upperCasePackageName = input.package.toUpperCase();
|
|
107
|
+
const upperCaseTransport = input.transport.toUpperCase();
|
|
108
|
+
if (upperCasePackageName !== input.package) {
|
|
109
|
+
input.package = upperCasePackageName;
|
|
110
|
+
output.summary.push({
|
|
111
|
+
message: `Package name contains lower case letter(s). ${input.package} is used for ADT validation.`,
|
|
112
|
+
status: SummaryStatus.Unknown
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
if (upperCaseTransport !== input.transport) {
|
|
116
|
+
input.transport = upperCaseTransport;
|
|
117
|
+
output.summary.push({
|
|
118
|
+
message: `Transport request number contains lower case letter(s). ${input.transport} is used for ADT validation.`,
|
|
119
|
+
status: SummaryStatus.Unknown
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
97
123
|
/**
|
|
98
124
|
* Client-side validation on the deploy configuration based on the
|
|
99
125
|
* known input format constraints.
|
|
@@ -120,7 +146,7 @@ function validateInputTextFormat(input, output, provider, logger) {
|
|
|
120
146
|
processInputValidationResult(result, output);
|
|
121
147
|
result = (0, project_input_validator_1.validateClient)(input.client);
|
|
122
148
|
processInputValidationResult(result, output);
|
|
123
|
-
result = (
|
|
149
|
+
result = validateUrlForOnPremTargetOnly(input.destination, input.url);
|
|
124
150
|
processInputValidationResult(result, output);
|
|
125
151
|
// If all the text validation passed, only show the following success message.
|
|
126
152
|
if (output.result) {
|
|
@@ -131,6 +157,26 @@ function validateInputTextFormat(input, output, provider, logger) {
|
|
|
131
157
|
}
|
|
132
158
|
});
|
|
133
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* A wrapper of validateUrl(). It uses same logic in system-access module's createAbapServiceProvider()
|
|
162
|
+
* function to determine the deploy target. Only validate URL for on-prem ABAP deploy target.
|
|
163
|
+
*
|
|
164
|
+
* @param destination
|
|
165
|
+
* @param url
|
|
166
|
+
* @returns
|
|
167
|
+
*/
|
|
168
|
+
function validateUrlForOnPremTargetOnly(destination, url) {
|
|
169
|
+
if ((0, btp_utils_1.isAppStudio)() && destination) {
|
|
170
|
+
// No validation required for destination name
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
else if (url) {
|
|
174
|
+
return (0, project_input_validator_1.validateUrl)(url);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
return 'Invalid deploy target';
|
|
178
|
+
}
|
|
179
|
+
}
|
|
134
180
|
/**
|
|
135
181
|
* Helper function that calls ADT service to retrieve system specific prefix
|
|
136
182
|
* requirement for Fiori app name.
|
|
@@ -200,10 +246,7 @@ function validatePackageWithAdt(input, output, provider, logger) {
|
|
|
200
246
|
return;
|
|
201
247
|
}
|
|
202
248
|
// ADT expects input package
|
|
203
|
-
|
|
204
|
-
if (inputPackage.toUpperCase() === '$TMP') {
|
|
205
|
-
inputPackage = '$TMP';
|
|
206
|
-
}
|
|
249
|
+
const inputPackage = input.package;
|
|
207
250
|
try {
|
|
208
251
|
const adtService = yield provider.getAdtService(axios_extension_1.ListPackageService);
|
|
209
252
|
if (!adtService) {
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Adeploy-tooling"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.11.
|
|
12
|
+
"version": "0.11.6",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
"prompts": "2.4.2",
|
|
33
33
|
"adm-zip": "0.5.10",
|
|
34
34
|
"chalk": "4.1.2",
|
|
35
|
-
"@sap-ux/axios-extension": "1.7.
|
|
35
|
+
"@sap-ux/axios-extension": "1.7.2",
|
|
36
36
|
"@sap-ux/btp-utils": "0.12.0",
|
|
37
37
|
"@sap-ux/logger": "0.4.0",
|
|
38
|
-
"@sap-ux/system-access": "0.3.
|
|
38
|
+
"@sap-ux/system-access": "0.3.4",
|
|
39
39
|
"@sap-ux/ui5-config": "0.20.0",
|
|
40
|
-
"@sap-ux/project-input-validator": "0.2.
|
|
40
|
+
"@sap-ux/project-input-validator": "0.2.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/prompts": "2.4.4",
|
|
44
|
-
"@types/adm-zip": "0.5.
|
|
44
|
+
"@types/adm-zip": "0.5.3",
|
|
45
45
|
"@sap-ux/store": "0.4.0"
|
|
46
46
|
},
|
|
47
47
|
"ui5": {
|