@sap-ux/odata-service-inquirer 0.7.9 → 0.7.12
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 +1 -1
- package/dist/prompts/datasources/sap-system/abap-on-prem/questions.js +1 -1
- package/dist/prompts/datasources/sap-system/service-selection/questions.d.ts +2 -2
- package/dist/prompts/datasources/sap-system/service-selection/questions.js +14 -6
- package/dist/prompts/datasources/sap-system/service-selection/service-helper.js +1 -1
- package/dist/prompts/datasources/sap-system/system-selection/questions.js +1 -1
- package/package.json +9 -9
|
@@ -71,7 +71,7 @@ function getAbapOnBTPSystemQuestions(promptOptions) {
|
|
|
71
71
|
(connectValidator.validity.authenticated ?? connectValidator.validity.authRequired !== true))[0]);
|
|
72
72
|
}
|
|
73
73
|
// Service selection prompt
|
|
74
|
-
questions.push(...(0, service_selection_1.getSystemServiceQuestion)(connectValidator, abapOnBtpPromptNamespace, promptOptions));
|
|
74
|
+
questions.push(...(0, service_selection_1.getSystemServiceQuestion)(connectValidator, abapOnBtpPromptNamespace, promptOptions?.serviceSelection));
|
|
75
75
|
return questions;
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
@@ -30,7 +30,7 @@ function getAbapOnPremQuestions(promptOptions) {
|
|
|
30
30
|
// Prompt options
|
|
31
31
|
const requiredOdataVersion = promptOptions?.serviceSelection?.requiredOdataVersion;
|
|
32
32
|
const questions = getAbapOnPremSystemQuestions(promptOptions?.userSystemName, connectValidator, requiredOdataVersion);
|
|
33
|
-
questions.push(...(0, service_selection_1.getSystemServiceQuestion)(connectValidator, abapOnPremPromptNamespace, promptOptions));
|
|
33
|
+
questions.push(...(0, service_selection_1.getSystemServiceQuestion)(connectValidator, abapOnPremPromptNamespace, promptOptions?.serviceSelection));
|
|
34
34
|
return questions;
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Question } from 'inquirer';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ServiceSelectionPromptOptions } from '../../../../types';
|
|
3
3
|
import type { ConnectionValidator } from '../../../connectionValidator';
|
|
4
4
|
import { type ServiceAnswer } from './types';
|
|
5
5
|
/**
|
|
@@ -11,5 +11,5 @@ import { type ServiceAnswer } from './types';
|
|
|
11
11
|
* @param promptOptions Options for the service selection prompt see {@link OdataServicePromptOptions}
|
|
12
12
|
* @returns the service selection prompt
|
|
13
13
|
*/
|
|
14
|
-
export declare function getSystemServiceQuestion(connectValidator: ConnectionValidator, promptNamespace: string, promptOptions?:
|
|
14
|
+
export declare function getSystemServiceQuestion(connectValidator: ConnectionValidator, promptNamespace: string, promptOptions?: ServiceSelectionPromptOptions): Question<ServiceAnswer>[];
|
|
15
15
|
//# sourceMappingURL=questions.d.ts.map
|
|
@@ -29,11 +29,12 @@ function getSystemServiceQuestion(connectValidator, promptNamespace, promptOptio
|
|
|
29
29
|
let previousSystemUrl;
|
|
30
30
|
let previousClient;
|
|
31
31
|
let previousService;
|
|
32
|
-
const requiredOdataVersion = promptOptions?.
|
|
33
|
-
const
|
|
32
|
+
const requiredOdataVersion = promptOptions?.requiredOdataVersion;
|
|
33
|
+
const serviceSelectionPromptName = `${promptNamespace}:${types_1.promptNames.serviceSelection}`;
|
|
34
|
+
let systemServiceQuestion = {
|
|
34
35
|
when: () => connectValidator.validity.authenticated || connectValidator.validity.authRequired === false,
|
|
35
|
-
name:
|
|
36
|
-
type: promptOptions?.
|
|
36
|
+
name: serviceSelectionPromptName,
|
|
37
|
+
type: promptOptions?.useAutoComplete ? 'autocomplete' : 'list',
|
|
37
38
|
message: () => (0, service_helper_1.getSelectedServiceLabel)(connectValidator.connectedUserName),
|
|
38
39
|
guiOptions: {
|
|
39
40
|
breadcrumb: (0, i18n_1.t)('prompts.systemService.breadcrumb'),
|
|
@@ -86,7 +87,7 @@ function getSystemServiceQuestion(connectValidator, promptNamespace, promptOptio
|
|
|
86
87
|
validate: async (service) => {
|
|
87
88
|
let serviceAnswer = service;
|
|
88
89
|
// Autocomplete passes the entire choice object as the answer, so we need to extract the value
|
|
89
|
-
if (promptOptions?.
|
|
90
|
+
if (promptOptions?.useAutoComplete && service.value) {
|
|
90
91
|
serviceAnswer = service.value;
|
|
91
92
|
}
|
|
92
93
|
if (!connectValidator.validatedUrl) {
|
|
@@ -104,9 +105,16 @@ function getSystemServiceQuestion(connectValidator, promptNamespace, promptOptio
|
|
|
104
105
|
return true;
|
|
105
106
|
}
|
|
106
107
|
};
|
|
108
|
+
// Add additional messages to prompts if specified in the prompt options
|
|
109
|
+
if (promptOptions?.additionalMessages) {
|
|
110
|
+
const promptOptsToApply = {
|
|
111
|
+
[serviceSelectionPromptName]: { additionalMessages: promptOptions.additionalMessages }
|
|
112
|
+
};
|
|
113
|
+
systemServiceQuestion = (0, inquirer_common_1.extendWithOptions)([systemServiceQuestion], promptOptsToApply, utils_1.PromptState.odataService)[0];
|
|
114
|
+
}
|
|
107
115
|
const questions = [systemServiceQuestion];
|
|
108
116
|
// Only for CLI use as `list` prompt validation does not run on CLI unless autocomplete plugin is used
|
|
109
|
-
if ((0, utils_1.getPromptHostEnvironment)() === fiori_generator_shared_1.hostEnvironment.cli && !promptOptions?.
|
|
117
|
+
if ((0, utils_1.getPromptHostEnvironment)() === fiori_generator_shared_1.hostEnvironment.cli && !promptOptions?.useAutoComplete) {
|
|
110
118
|
questions.push({
|
|
111
119
|
when: async (answers) => {
|
|
112
120
|
const selectedService = answers?.[`${promptNamespace}:${types_1.promptNames.serviceSelection}`];
|
|
@@ -220,7 +220,7 @@ async function getServiceDetails(service, connectionValidator, requiredOdataVers
|
|
|
220
220
|
utils_1.PromptState.odataService.annotations = serviceResult?.annotations;
|
|
221
221
|
utils_1.PromptState.odataService.metadata = serviceResult?.metadata;
|
|
222
222
|
utils_1.PromptState.odataService.odataVersion =
|
|
223
|
-
version ?? service.serviceODataVersion === axios_extension_1.ODataVersion.v2 ? odata_service_writer_1.OdataVersion.v2 : odata_service_writer_1.OdataVersion.v4;
|
|
223
|
+
version ?? (service.serviceODataVersion === axios_extension_1.ODataVersion.v2 ? odata_service_writer_1.OdataVersion.v2 : odata_service_writer_1.OdataVersion.v4);
|
|
224
224
|
utils_1.PromptState.odataService.servicePath = service.servicePath;
|
|
225
225
|
utils_1.PromptState.odataService.origin = origin;
|
|
226
226
|
utils_1.PromptState.odataService.sapClient = connectionValidator.validatedClient;
|
|
@@ -67,7 +67,7 @@ async function getSystemSelectionQuestions(promptOptions) {
|
|
|
67
67
|
const questions = await getSystemConnectionQuestions(connectValidator, promptOptions);
|
|
68
68
|
// Existing system (BackendSystem or Destination) selected,
|
|
69
69
|
// In future, make the service prompt optional by wrapping in condition `[promptOptions?.serviceSelection?.hide]`
|
|
70
|
-
questions.push(...(0, inquirer_common_1.withCondition)((0, questions_3.getSystemServiceQuestion)(connectValidator, systemSelectionPromptNamespace, promptOptions), (answers) => answers.systemSelection?.type !== 'newSystemChoice'));
|
|
70
|
+
questions.push(...(0, inquirer_common_1.withCondition)((0, questions_3.getSystemServiceQuestion)(connectValidator, systemSelectionPromptNamespace, promptOptions?.serviceSelection), (answers) => answers.systemSelection?.type !== 'newSystemChoice'));
|
|
71
71
|
// Create new system connection for storage only supported on non-App Studio environments
|
|
72
72
|
if (!(0, btp_utils_1.isAppStudio)()) {
|
|
73
73
|
questions.push(...(0, inquirer_common_1.withCondition)((0, questions_2.getNewSystemQuestions)(promptOptions), (answers) => answers.systemSelection?.type === 'newSystemChoice'));
|
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.7.
|
|
4
|
+
"version": "0.7.12",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
"i18next": "23.5.1",
|
|
27
27
|
"inquirer-autocomplete-prompt": "2.0.1",
|
|
28
28
|
"os-name": "4.0.1",
|
|
29
|
-
"@sap-ux/axios-extension": "1.17.
|
|
30
|
-
"@sap-ux/btp-utils": "0.17.
|
|
31
|
-
"@sap-ux/fiori-generator-shared": "0.7.
|
|
29
|
+
"@sap-ux/axios-extension": "1.17.8",
|
|
30
|
+
"@sap-ux/btp-utils": "0.17.2",
|
|
31
|
+
"@sap-ux/fiori-generator-shared": "0.7.17",
|
|
32
32
|
"@sap-ux/guided-answers-helper": "0.1.1",
|
|
33
|
-
"@sap-ux/telemetry": "0.5.
|
|
34
|
-
"@sap-ux/inquirer-common": "0.5.
|
|
33
|
+
"@sap-ux/telemetry": "0.5.50",
|
|
34
|
+
"@sap-ux/inquirer-common": "0.5.14",
|
|
35
35
|
"@sap-ux/logger": "0.6.0",
|
|
36
|
-
"@sap-ux/project-access": "1.28.
|
|
36
|
+
"@sap-ux/project-access": "1.28.10",
|
|
37
37
|
"@sap-ux/project-input-validator": "0.3.4",
|
|
38
38
|
"@sap-ux/store": "1.0.0"
|
|
39
39
|
},
|
|
@@ -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.
|
|
46
|
+
"@sap-ux/fiori-generator-shared": "0.7.17",
|
|
47
47
|
"@sap-ux/feature-toggle": "0.2.3",
|
|
48
|
-
"@sap-ux/odata-service-writer": "0.
|
|
48
|
+
"@sap-ux/odata-service-writer": "0.25.0"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
51
|
"node": ">=18.x"
|