@sap-ux/odata-service-inquirer 2.9.2 → 2.9.3
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/datasources/sap-system/abap-on-btp/questions.js +16 -1
- package/dist/prompts/datasources/sap-system/abap-on-prem/questions.js +11 -2
- package/dist/prompts/datasources/sap-system/shared-prompts/shared-prompts.d.ts +2 -1
- package/dist/prompts/datasources/sap-system/shared-prompts/shared-prompts.js +3 -2
- package/package.json +1 -1
|
@@ -174,7 +174,22 @@ function getCFDiscoverPrompts(connectionValidator, promptNamespace, requiredOdat
|
|
|
174
174
|
message: (0, i18n_1.t)('prompts.cloudFoundryAbapSystem.message'),
|
|
175
175
|
validate: async (abapService) => {
|
|
176
176
|
if (abapService) {
|
|
177
|
-
|
|
177
|
+
const valResult = await validateCFServiceInfo(abapService, connectionValidator, requiredOdataVersion, (0, utils_1.getPromptHostEnvironment)() === fiori_generator_shared_1.hostEnvironment.cli, cachedConnectedSystem);
|
|
178
|
+
// If the system exists already stop progress
|
|
179
|
+
if (!(0, btp_utils_1.isAppStudio)() && valResult === true && connectionValidator.validatedUrl) {
|
|
180
|
+
const existingBackend = (0, utils_1.isBackendSystemKeyExisting)(utils_1.PromptState.backendSystemsCache, connectionValidator.validatedUrl, connectionValidator.validatedClient);
|
|
181
|
+
if (existingBackend) {
|
|
182
|
+
// Invalidate the connection to prevent service selection
|
|
183
|
+
// This is a temp workaround until multiple systems with the same url/client key is supported
|
|
184
|
+
// This is necessary since the ServiceInstanceInfo does not include url/client information
|
|
185
|
+
connectionValidator.resetConnectionState(true);
|
|
186
|
+
// Cannot create a new store system with the same key
|
|
187
|
+
return (0, i18n_1.t)('prompts.validationMessages.backendSystemExistsWarning', {
|
|
188
|
+
backendName: existingBackend.name
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return valResult;
|
|
178
193
|
}
|
|
179
194
|
const errorType = prompt_helpers_1.errorHandler.getCurrentErrorType();
|
|
180
195
|
if (errorType === inquirer_common_1.ERROR_TYPE.NO_ABAP_ENVS) {
|
|
@@ -47,7 +47,7 @@ function getAbapOnPremSystemQuestions(systemNamePromptOptions, connectionValidat
|
|
|
47
47
|
// This allows re-usability of the credentials prompts where a client prompt was not used (client was loaded from store).
|
|
48
48
|
const sapClientRef = { sapClient: undefined, isValid: true };
|
|
49
49
|
const questions = [
|
|
50
|
-
(0, shared_prompts_1.getSystemUrlQuestion)(connectValidator, abapOnPremPromptNamespace, requiredOdataVersion),
|
|
50
|
+
(0, shared_prompts_1.getSystemUrlQuestion)(connectValidator, abapOnPremPromptNamespace, requiredOdataVersion, undefined, false),
|
|
51
51
|
{
|
|
52
52
|
type: 'input',
|
|
53
53
|
name: abapOnPremPromptNames.sapClient,
|
|
@@ -55,11 +55,20 @@ function getAbapOnPremSystemQuestions(systemNamePromptOptions, connectionValidat
|
|
|
55
55
|
guiOptions: {
|
|
56
56
|
breadcrumb: (0, i18n_1.t)('prompts.sapClient.breadcrumb')
|
|
57
57
|
},
|
|
58
|
-
validate: (client) => {
|
|
58
|
+
validate: (client, prevAnswers) => {
|
|
59
59
|
const valRes = (0, project_input_validator_1.validateClient)(client);
|
|
60
60
|
if (valRes === true) {
|
|
61
61
|
sapClientRef.sapClient = client;
|
|
62
62
|
sapClientRef.isValid = true;
|
|
63
|
+
// If we also have a system url, warn about existing stored system overwrite
|
|
64
|
+
if (prevAnswers?.[systemUrlPromptName]) {
|
|
65
|
+
const existingBackend = (0, utils_1.isBackendSystemKeyExisting)(utils_1.PromptState.backendSystemsCache, prevAnswers[systemUrlPromptName], client);
|
|
66
|
+
if (existingBackend) {
|
|
67
|
+
return (0, i18n_1.t)('prompts.validationMessages.backendSystemExistsWarning', {
|
|
68
|
+
backendName: existingBackend.name
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
63
72
|
return true;
|
|
64
73
|
}
|
|
65
74
|
sapClientRef.sapClient = undefined;
|
|
@@ -14,9 +14,10 @@ import { type NewSystemAnswers } from '../new-system/types';
|
|
|
14
14
|
* @param promptNamespace The namespace for the prompt, used to identify the prompt instance and namespaced answers.
|
|
15
15
|
* @param requiredOdataVersion The required OData version for the system connection, only catalogs supporting the specifc odata version will be used.
|
|
16
16
|
* @param cachedConnectedSystem An existing connection may be passed which will prevent reauthentication
|
|
17
|
+
* @param showExistingSystemWarning if the url exists in secure store a validation message will be returned
|
|
17
18
|
* @returns the system url prompt
|
|
18
19
|
*/
|
|
19
|
-
export declare function getSystemUrlQuestion<T extends Answers>(connectValidator: ConnectionValidator, promptNamespace?: string, requiredOdataVersion?: OdataVersion, cachedConnectedSystem?: ConnectedSystem): InputQuestion<T>;
|
|
20
|
+
export declare function getSystemUrlQuestion<T extends Answers>(connectValidator: ConnectionValidator, promptNamespace?: string, requiredOdataVersion?: OdataVersion, cachedConnectedSystem?: ConnectedSystem, showExistingSystemWarning?: boolean): InputQuestion<T>;
|
|
20
21
|
/**
|
|
21
22
|
* Get a prompt for new system name.
|
|
22
23
|
*
|
|
@@ -36,9 +36,10 @@ function systemAuthTypeToAuthenticationType(systemAuthType) {
|
|
|
36
36
|
* @param promptNamespace The namespace for the prompt, used to identify the prompt instance and namespaced answers.
|
|
37
37
|
* @param requiredOdataVersion The required OData version for the system connection, only catalogs supporting the specifc odata version will be used.
|
|
38
38
|
* @param cachedConnectedSystem An existing connection may be passed which will prevent reauthentication
|
|
39
|
+
* @param showExistingSystemWarning if the url exists in secure store a validation message will be returned
|
|
39
40
|
* @returns the system url prompt
|
|
40
41
|
*/
|
|
41
|
-
function getSystemUrlQuestion(connectValidator, promptNamespace, requiredOdataVersion, cachedConnectedSystem) {
|
|
42
|
+
function getSystemUrlQuestion(connectValidator, promptNamespace, requiredOdataVersion, cachedConnectedSystem, showExistingSystemWarning = true) {
|
|
42
43
|
const promptName = `${promptNamespace ? promptNamespace + ':' : ''}${types_2.newSystemPromptNames.newSystemUrl}`;
|
|
43
44
|
const newSystemUrlQuestion = {
|
|
44
45
|
type: 'input',
|
|
@@ -58,7 +59,7 @@ function getSystemUrlQuestion(connectValidator, promptNamespace, requiredOdataVe
|
|
|
58
59
|
cachedConnectedSystem.backendSystem?.authenticationType === 'reentranceTicket') {
|
|
59
60
|
connectValidator.setConnectedSystem(cachedConnectedSystem);
|
|
60
61
|
}
|
|
61
|
-
else {
|
|
62
|
+
else if (showExistingSystemWarning) {
|
|
62
63
|
const existingBackend = (0, utils_1.isBackendSystemKeyExisting)(utils_1.PromptState.backendSystemsCache, url);
|
|
63
64
|
if (existingBackend) {
|
|
64
65
|
// Not a cached connection so re-validate as new backend system entry
|
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.9.
|
|
4
|
+
"version": "2.9.3",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|