@sap-ux/odata-service-inquirer 0.6.9 → 0.6.10
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.
|
@@ -476,15 +476,20 @@ class ConnectionValidator {
|
|
|
476
476
|
this.resetValidity();
|
|
477
477
|
// Get the destination URL in the BAS specific form <protocol>://<destinationName>.dest
|
|
478
478
|
const destUrl = (0, btp_utils_1.getDestinationUrlForAppStudio)(destination.Name, servicePath);
|
|
479
|
-
// Get the destination URL in the portable form <protocol>://<host>:<port
|
|
480
|
-
|
|
479
|
+
// Get the destination URL in the portable form <protocol>://<host>:<port>.
|
|
480
|
+
// We remove trailing slashes (up to 10, infinite would allow DOS attack) from the host to avoid double slashes when appending the service path.
|
|
481
|
+
this._destinationUrl = servicePath
|
|
482
|
+
? destUrl.replace(`https://${destination.Name}.dest`, destination.Host.replace(/\/{1,10}$/, ''))
|
|
483
|
+
: destination.Host;
|
|
481
484
|
this._destination = destination;
|
|
482
485
|
// No need to apply sap-client as this happens automatically (from destination config) when going through the BAS proxy
|
|
483
486
|
const status = await this.checkUrl(new URL(destUrl), undefined, undefined, {
|
|
484
487
|
odataVersion: requiredOdataVersion
|
|
485
488
|
});
|
|
486
|
-
this._validatedUrl = destUrl;
|
|
487
489
|
const validationResult = this.getValidationResultFromStatusCode(status);
|
|
490
|
+
if (this.validity.reachable && (!this.validity.authRequired || this.validity.authenticated)) {
|
|
491
|
+
this._validatedUrl = destUrl;
|
|
492
|
+
}
|
|
488
493
|
if (!this.validity.reachable) {
|
|
489
494
|
// Log the error
|
|
490
495
|
const errorLog = prompt_helpers_1.errorHandler.logErrorMsgs(status);
|
|
@@ -137,16 +137,22 @@ async function getSystemConnectionQuestions(connectionValidator, promptOptions)
|
|
|
137
137
|
guiOptions: {
|
|
138
138
|
hint: (0, i18n_1.t)('prompts.destinationServicePath.hint'),
|
|
139
139
|
mandatory: true,
|
|
140
|
-
breadcrumb: true
|
|
140
|
+
breadcrumb: true,
|
|
141
|
+
applyDefaultWhenDirty: true
|
|
141
142
|
},
|
|
143
|
+
default: '',
|
|
142
144
|
validate: async (servicePath, answers) => {
|
|
143
|
-
|
|
145
|
+
// @sap-ux/btp-utils getDestinationUrlForAppStudio() enforces a path length of > 1, even though it could be a valid path
|
|
146
|
+
// Double slashes are not allowed at the start of the path as they break URL construction
|
|
147
|
+
if (!servicePath || servicePath.trim().length < 2 || servicePath.startsWith('//')) {
|
|
148
|
+
connectionValidator.resetConnectionState(true);
|
|
144
149
|
return (0, i18n_1.t)('prompts.destinationServicePath.invalidServicePathWarning');
|
|
145
150
|
}
|
|
146
151
|
// Validate format of the service path, note this relies on the assumption that the destination is correctly configured with a valid URL
|
|
147
152
|
const selectedDestination = answers?.[types_1.promptNames.systemSelection]?.system;
|
|
148
153
|
const valUrlResult = (0, validators_1.validateServiceUrl)(selectedDestination.Host, servicePath);
|
|
149
154
|
if (valUrlResult !== true) {
|
|
155
|
+
connectionValidator.resetConnectionState(true);
|
|
150
156
|
return valUrlResult;
|
|
151
157
|
}
|
|
152
158
|
const connectValResult = await (0, prompt_helpers_1.connectWithDestination)(selectedDestination, connectionValidator, requiredOdataVersion, servicePath);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/odata-service-inquirer",
|
|
3
3
|
"description": "Prompts module that can prompt users for inputs required for odata service writing",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.10",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"inquirer-autocomplete-prompt": "2.0.1",
|
|
28
28
|
"os-name": "4.0.1",
|
|
29
29
|
"@sap-ux/axios-extension": "1.17.4",
|
|
30
|
-
"@sap-ux/fiori-generator-shared": "0.7.10",
|
|
31
30
|
"@sap-ux/btp-utils": "0.17.0",
|
|
32
31
|
"@sap-ux/guided-answers-helper": "0.1.0",
|
|
32
|
+
"@sap-ux/fiori-generator-shared": "0.7.10",
|
|
33
33
|
"@sap-ux/inquirer-common": "0.5.4",
|
|
34
|
-
"@sap-ux/telemetry": "0.5.44",
|
|
35
|
-
"@sap-ux/logger": "0.6.0",
|
|
36
34
|
"@sap-ux/project-access": "1.28.7",
|
|
35
|
+
"@sap-ux/telemetry": "0.5.44",
|
|
37
36
|
"@sap-ux/project-input-validator": "0.3.3",
|
|
37
|
+
"@sap-ux/logger": "0.6.0",
|
|
38
38
|
"@sap-ux/store": "0.9.3"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"@types/inquirer": "8.2.6",
|
|
44
44
|
"@types/lodash": "4.14.202",
|
|
45
45
|
"jest-extended": "3.2.4",
|
|
46
|
-
"@sap-ux/fiori-generator-shared": "0.7.10",
|
|
47
46
|
"@sap-ux/feature-toggle": "0.2.2",
|
|
48
|
-
"@sap-ux/odata-service-writer": "0.23.3"
|
|
47
|
+
"@sap-ux/odata-service-writer": "0.23.3",
|
|
48
|
+
"@sap-ux/fiori-generator-shared": "0.7.10"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
51
|
"node": ">=18.x"
|