@sap-ux/odata-service-inquirer 2.11.6 → 2.11.8
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/prompts/connectionValidator.d.ts +8 -0
- package/dist/prompts/connectionValidator.js +31 -1
- package/dist/prompts/datasources/sap-system/credentials/questions.d.ts +3 -1
- package/dist/prompts/datasources/sap-system/credentials/questions.js +4 -2
- package/dist/prompts/datasources/sap-system/system-selection/questions.js +1 -1
- package/dist/translations/odata-service-inquirer.i18n.json +7 -3
- package/package.json +11 -11
|
@@ -345,6 +345,14 @@ export declare class ConnectionValidator {
|
|
|
345
345
|
* Reset the validity state.
|
|
346
346
|
*/
|
|
347
347
|
private resetValidity;
|
|
348
|
+
/**
|
|
349
|
+
* Get the specific authorization reason user message. This may be catalog version specific.
|
|
350
|
+
*
|
|
351
|
+
* @param httpStatusCode the http error code returned from a request
|
|
352
|
+
* @param odataVersion optional, the odata version specific request, for example for specific catalog requests
|
|
353
|
+
* @returns the text message indicting the authentication or authorization failure speific to an odata catalog request
|
|
354
|
+
*/
|
|
355
|
+
private getAuthFailureReasonText;
|
|
348
356
|
}
|
|
349
357
|
export {};
|
|
350
358
|
//# sourceMappingURL=connectionValidator.d.ts.map
|
|
@@ -864,7 +864,10 @@ class ConnectionValidator {
|
|
|
864
864
|
return { valResult: true };
|
|
865
865
|
}
|
|
866
866
|
else if (this.validity.authenticated === false) {
|
|
867
|
-
return {
|
|
867
|
+
return {
|
|
868
|
+
valResult: this.getAuthFailureReasonText(status, odataVersion),
|
|
869
|
+
errorType: inquirer_common_1.ERROR_TYPE.AUTH
|
|
870
|
+
};
|
|
868
871
|
}
|
|
869
872
|
}
|
|
870
873
|
return { valResult };
|
|
@@ -891,6 +894,33 @@ class ConnectionValidator {
|
|
|
891
894
|
this._destinationUrl = undefined;
|
|
892
895
|
this._destination = undefined;
|
|
893
896
|
}
|
|
897
|
+
/**
|
|
898
|
+
* Get the specific authorization reason user message. This may be catalog version specific.
|
|
899
|
+
*
|
|
900
|
+
* @param httpStatusCode the http error code returned from a request
|
|
901
|
+
* @param odataVersion optional, the odata version specific request, for example for specific catalog requests
|
|
902
|
+
* @returns the text message indicting the authentication or authorization failure speific to an odata catalog request
|
|
903
|
+
*/
|
|
904
|
+
getAuthFailureReasonText(httpStatusCode, odataVersion) {
|
|
905
|
+
let authFailType;
|
|
906
|
+
if ([403, '403'].includes(httpStatusCode)) {
|
|
907
|
+
authFailType = (0, i18n_1.t)('texts.authorizationFailed');
|
|
908
|
+
}
|
|
909
|
+
else if ([401, '401'].includes(httpStatusCode)) {
|
|
910
|
+
authFailType = (0, i18n_1.t)('texts.authenticationFailed');
|
|
911
|
+
}
|
|
912
|
+
let authFailureReason;
|
|
913
|
+
if (odataVersion) {
|
|
914
|
+
authFailureReason = (0, i18n_1.t)('errors.authenticationFailedSpecificCatalog', {
|
|
915
|
+
odataVersion,
|
|
916
|
+
authFailType
|
|
917
|
+
});
|
|
918
|
+
}
|
|
919
|
+
else {
|
|
920
|
+
authFailureReason = (0, i18n_1.t)('errors.authenticationFailedAllCatalogs', { authFailType });
|
|
921
|
+
}
|
|
922
|
+
return authFailureReason;
|
|
923
|
+
}
|
|
894
924
|
}
|
|
895
925
|
exports.ConnectionValidator = ConnectionValidator;
|
|
896
926
|
//# sourceMappingURL=connectionValidator.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { InputQuestion, PasswordQuestion, ConfirmQuestion } from '@sap-ux/inquirer-common';
|
|
2
2
|
import type { Answers } from 'inquirer';
|
|
3
3
|
import type { ConnectionValidator } from '../../../connectionValidator';
|
|
4
|
+
import type { OdataVersion } from '@sap-ux/odata-service-writer';
|
|
4
5
|
export declare enum BasicCredentialsPromptNames {
|
|
5
6
|
systemUsername = "systemUsername",
|
|
6
7
|
systemPassword = "systemPassword",
|
|
@@ -14,10 +15,11 @@ export declare enum BasicCredentialsPromptNames {
|
|
|
14
15
|
* @param sapClient
|
|
15
16
|
* @param sapClient.sapClient the sapClient value to be used along with the credentials validation
|
|
16
17
|
* @param sapClient.isValid validation of credentials is deferred until a valid sapClient is provided or undefined
|
|
18
|
+
* @param requiredOdataVersion
|
|
17
19
|
* @returns the credentials prompts
|
|
18
20
|
*/
|
|
19
21
|
export declare function getCredentialsPrompts<T extends Answers>(connectionValidator: ConnectionValidator, promptNamespace?: string, sapClient?: {
|
|
20
22
|
sapClient: string | undefined;
|
|
21
23
|
isValid: boolean;
|
|
22
|
-
}): (InputQuestion<T> | PasswordQuestion<T> | ConfirmQuestion<T>)[];
|
|
24
|
+
}, requiredOdataVersion?: OdataVersion): (InputQuestion<T> | PasswordQuestion<T> | ConfirmQuestion<T>)[];
|
|
23
25
|
//# sourceMappingURL=questions.d.ts.map
|
|
@@ -21,9 +21,10 @@ var BasicCredentialsPromptNames;
|
|
|
21
21
|
* @param sapClient
|
|
22
22
|
* @param sapClient.sapClient the sapClient value to be used along with the credentials validation
|
|
23
23
|
* @param sapClient.isValid validation of credentials is deferred until a valid sapClient is provided or undefined
|
|
24
|
+
* @param requiredOdataVersion
|
|
24
25
|
* @returns the credentials prompts
|
|
25
26
|
*/
|
|
26
|
-
function getCredentialsPrompts(connectionValidator, promptNamespace, sapClient) {
|
|
27
|
+
function getCredentialsPrompts(connectionValidator, promptNamespace, sapClient, requiredOdataVersion) {
|
|
27
28
|
const usernamePromptName = `${promptNamespace ? promptNamespace + ':' : ''}${BasicCredentialsPromptNames.systemUsername}`;
|
|
28
29
|
const passwordPromptName = `${promptNamespace ? promptNamespace + ':' : ''}${BasicCredentialsPromptNames.systemPassword}`;
|
|
29
30
|
const storeCredentialsPromptName = `${promptNamespace ? promptNamespace + ':' : ''}${BasicCredentialsPromptNames.storeSystemCredentials}`;
|
|
@@ -79,7 +80,8 @@ function getCredentialsPrompts(connectionValidator, promptNamespace, sapClient)
|
|
|
79
80
|
}
|
|
80
81
|
const { valResult } = await connectionValidator.validateAuth(connectionValidator.validatedUrl, answers?.[usernamePromptName], password, {
|
|
81
82
|
sapClient: sapClient?.sapClient || selectedSystemClient,
|
|
82
|
-
isSystem
|
|
83
|
+
isSystem,
|
|
84
|
+
odataVersion: (0, utils_1.convertODataVersionType)(requiredOdataVersion)
|
|
83
85
|
});
|
|
84
86
|
if (valResult === true && connectionValidator.serviceProvider) {
|
|
85
87
|
updatePromptStateWithConnectedSystem(connectionValidator.serviceProvider, selectedSystem, {
|
|
@@ -202,7 +202,7 @@ async function getSystemConnectionQuestions(connectionValidator, promptOptions,
|
|
|
202
202
|
name: `${systemSelectionPromptNames.systemSelectionCli}`
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
|
-
questions.push(...(0, questions_2.getCredentialsPrompts)(connectionValidator, systemSelectionPromptNamespace));
|
|
205
|
+
questions.push(...(0, questions_2.getCredentialsPrompts)(connectionValidator, systemSelectionPromptNamespace, undefined, requiredOdataVersion));
|
|
206
206
|
return questions;
|
|
207
207
|
}
|
|
208
208
|
//# sourceMappingURL=questions.js.map
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"newSystemChoiceLabel": "New System",
|
|
112
112
|
"hint": "Select a system configuration.",
|
|
113
113
|
"message": "System",
|
|
114
|
-
"authenticationFailedUpdateCredentials": "
|
|
114
|
+
"authenticationFailedUpdateCredentials": "$t(texts.authenticationFailed). Please try updating the credentials."
|
|
115
115
|
},
|
|
116
116
|
"abapOnBTPType": {
|
|
117
117
|
"message": "ABAP environment definition source",
|
|
@@ -217,7 +217,9 @@
|
|
|
217
217
|
"capModelAndServicesLoadError": "An error occurred loading the CAP model and services: {{- error, addMsgWithColonFormatter}}.",
|
|
218
218
|
"capServiceUrlPathNotDefined": "An error occurred reading CAP service metadata: {{serviceName}}. The CAP service property: `urlPath` is not defined but it is required.",
|
|
219
219
|
"unknownError": "An error occurred: {{- error, addMsgWithColonFormatter}}.",
|
|
220
|
-
"authenticationFailed": "
|
|
220
|
+
"authenticationFailed": "$t(texts.authenticationFailed): {{error}}.",
|
|
221
|
+
"authenticationFailedSpecificCatalog": "{{authFailType}}: Unable to access the OData V{{odataVersion}} service catalog",
|
|
222
|
+
"authenticationFailedAllCatalogs": "{{authFailType}}: Unable to access any service catalogs",
|
|
221
223
|
"invalidUrl": "Invalid URL: {{-input, addMsgWithColonFormatter}}.",
|
|
222
224
|
"connectionError": "A connection error occurred. Ensure the target host is available on the network: {{- error}}",
|
|
223
225
|
"urlNotFound": "URL not found.",
|
|
@@ -263,6 +265,8 @@
|
|
|
263
265
|
"httpStatus": "HTTP Status {{httpStatus}}",
|
|
264
266
|
"checkDestinationAuthConfig": "Please check the SAP BTP destination authentication configuration.",
|
|
265
267
|
"choiceNameNone": "None",
|
|
266
|
-
"passwordStoreWarning": "Passwords are stored in your operating system's credential manager and are protected by its security policies."
|
|
268
|
+
"passwordStoreWarning": "Passwords are stored in your operating system's credential manager and are protected by its security policies.",
|
|
269
|
+
"authorizationFailed": "Authorization failed",
|
|
270
|
+
"authenticationFailed": "Authentication failed"
|
|
267
271
|
}
|
|
268
272
|
}
|
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": "2.11.
|
|
4
|
+
"version": "2.11.8",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
"os-name": "4.0.1",
|
|
32
32
|
"@sap-ux/axios-extension": "1.24.2",
|
|
33
33
|
"@sap-ux/btp-utils": "1.1.5",
|
|
34
|
-
"@sap-ux/fiori-generator-shared": "0.13.
|
|
34
|
+
"@sap-ux/fiori-generator-shared": "0.13.34",
|
|
35
35
|
"@sap-ux/guided-answers-helper": "0.4.1",
|
|
36
|
-
"@sap-ux/telemetry": "0.6.
|
|
37
|
-
"@sap-ux/inquirer-common": "0.9.
|
|
36
|
+
"@sap-ux/telemetry": "0.6.39",
|
|
37
|
+
"@sap-ux/inquirer-common": "0.9.4",
|
|
38
38
|
"@sap-ux/logger": "0.7.1",
|
|
39
39
|
"@sap-ux/nodejs-utils": "0.2.8",
|
|
40
|
-
"@sap-ux/project-access": "1.32.
|
|
41
|
-
"@sap-ux/project-input-validator": "0.6.
|
|
40
|
+
"@sap-ux/project-access": "1.32.9",
|
|
41
|
+
"@sap-ux/project-input-validator": "0.6.31",
|
|
42
42
|
"@sap-ux/store": "1.3.3"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"@types/inquirer": "8.2.6",
|
|
49
49
|
"@types/lodash": "4.14.202",
|
|
50
50
|
"jest-extended": "6.0.0",
|
|
51
|
-
"@sap-ux/fiori-generator-shared": "0.13.
|
|
52
|
-
"@sap-ux/fiori-elements-writer": "2.8.
|
|
53
|
-
"@sap-ux/fiori-freestyle-writer": "2.5.
|
|
51
|
+
"@sap-ux/fiori-generator-shared": "0.13.34",
|
|
52
|
+
"@sap-ux/fiori-elements-writer": "2.8.4",
|
|
53
|
+
"@sap-ux/fiori-freestyle-writer": "2.5.2",
|
|
54
54
|
"@sap-ux/feature-toggle": "0.3.4",
|
|
55
|
-
"@sap-ux/odata-service-writer": "0.27.
|
|
56
|
-
"@sap-ux/cap-config-writer": "0.12.
|
|
55
|
+
"@sap-ux/odata-service-writer": "0.27.30",
|
|
56
|
+
"@sap-ux/cap-config-writer": "0.12.25"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">=20.x"
|