@sap-ux/odata-service-inquirer 2.14.9 → 2.14.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.
- package/dist/index.d.ts +2 -1
- package/dist/index.js +5 -1
- package/dist/prompts/datasources/sap-system/service-selection/questions.js +2 -1
- package/dist/prompts/datasources/sap-system/service-selection/service-helper.d.ts +3 -1
- package/dist/prompts/datasources/sap-system/service-selection/service-helper.js +14 -2
- package/dist/prompts/datasources/sap-system/system-selection/prompt-helpers.d.ts +3 -1
- package/dist/prompts/datasources/sap-system/system-selection/prompt-helpers.js +8 -7
- package/dist/prompts/datasources/sap-system/system-selection/questions.js +8 -2
- package/dist/translations/odata-service-inquirer.i18n.json +4 -2
- package/dist/types.d.ts +6 -3
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -30,9 +30,10 @@ declare function getPrompts(promptOptions?: OdataServicePromptOptions, logger?:
|
|
|
30
30
|
*
|
|
31
31
|
* @param promptOptions - options that can control some of the prompt behavior. See {@link OdataServicePromptOptions} for details
|
|
32
32
|
* @param isYUI - if true, the prompt is being called from the Yeoman UI extension host. PromptState.isYUI will be set to this value
|
|
33
|
+
* @param logger - set an externally configured logger
|
|
33
34
|
* @returns the prompts used to provide input for system selection and a reference to the answers object which will be populated with the user's responses once `inquirer.prompt` returns
|
|
34
35
|
*/
|
|
35
|
-
declare function getSystemSelectionQuestions(promptOptions?: OdataServicePromptOptions, isYUI?: boolean): Promise<{
|
|
36
|
+
declare function getSystemSelectionQuestions(promptOptions?: OdataServicePromptOptions, isYUI?: boolean, logger?: Logger): Promise<{
|
|
36
37
|
prompts: Question<SystemSelectionAnswers & ServiceAnswer>[];
|
|
37
38
|
answers: Partial<OdataServiceAnswers>;
|
|
38
39
|
}>;
|
package/dist/index.js
CHANGED
|
@@ -58,12 +58,16 @@ async function getPrompts(promptOptions, logger, enableGuidedAnswers = false, te
|
|
|
58
58
|
*
|
|
59
59
|
* @param promptOptions - options that can control some of the prompt behavior. See {@link OdataServicePromptOptions} for details
|
|
60
60
|
* @param isYUI - if true, the prompt is being called from the Yeoman UI extension host. PromptState.isYUI will be set to this value
|
|
61
|
+
* @param logger - set an externally configured logger
|
|
61
62
|
* @returns the prompts used to provide input for system selection and a reference to the answers object which will be populated with the user's responses once `inquirer.prompt` returns
|
|
62
63
|
*/
|
|
63
|
-
async function getSystemSelectionQuestions(promptOptions, isYUI) {
|
|
64
|
+
async function getSystemSelectionQuestions(promptOptions, isYUI, logger) {
|
|
64
65
|
if (isYUI !== undefined) {
|
|
65
66
|
utils_1.PromptState.isYUI = isYUI;
|
|
66
67
|
}
|
|
68
|
+
if (logger) {
|
|
69
|
+
logger_helper_1.default.logger = logger;
|
|
70
|
+
}
|
|
67
71
|
return {
|
|
68
72
|
prompts: await (0, system_selection_1.getSystemSelectionQuestions)(promptOptions),
|
|
69
73
|
answers: utils_1.PromptState.odataService
|
|
@@ -98,7 +98,8 @@ function getSystemServiceQuestion(connectValidator, promptNamespace, promptOptio
|
|
|
98
98
|
showCollabDraftWarning: !!promptOptions?.showCollaborativeDraftWarning,
|
|
99
99
|
edmx: convertedMetadataRef.convertedMetadata
|
|
100
100
|
}
|
|
101
|
-
: undefined
|
|
101
|
+
: undefined,
|
|
102
|
+
serviceFilter: promptOptions?.serviceFilter
|
|
102
103
|
}),
|
|
103
104
|
default: () => (0, utils_1.getDefaultChoiceIndex)(serviceChoices),
|
|
104
105
|
// Warning: only executes in YUI and cli when automcomplete is used
|
|
@@ -73,12 +73,14 @@ type ShowCollabDraftWarnOptions = {
|
|
|
73
73
|
* @param options.hasAnnotations used to determine whether to show a warning message that annotations could not be retrieved
|
|
74
74
|
* @param options.showCollabDraftWarnOptions to show the collaborative draft warning, the option `showCollabDraftWarning` must be true
|
|
75
75
|
* and the edmx metadata must be provided
|
|
76
|
+
* @param options.serviceFilter if a service filter has been specified this may alter the user messages when no services are listed
|
|
76
77
|
* @returns the service selection prompt additional message
|
|
77
78
|
*/
|
|
78
|
-
export declare function getSelectedServiceMessage(serviceChoices: ListChoiceOptions<ServiceAnswer>[], selectedService: ServiceAnswer | undefined, connectValidator: ConnectionValidator, { requiredOdataVersion, hasAnnotations, showCollabDraftWarnOptions }: {
|
|
79
|
+
export declare function getSelectedServiceMessage(serviceChoices: ListChoiceOptions<ServiceAnswer>[], selectedService: ServiceAnswer | undefined, connectValidator: ConnectionValidator, { requiredOdataVersion, hasAnnotations, showCollabDraftWarnOptions, serviceFilter }: {
|
|
79
80
|
requiredOdataVersion?: OdataVersion;
|
|
80
81
|
hasAnnotations?: boolean;
|
|
81
82
|
showCollabDraftWarnOptions?: ShowCollabDraftWarnOptions;
|
|
83
|
+
serviceFilter?: string[];
|
|
82
84
|
}): Promise<IMessageSeverity | undefined>;
|
|
83
85
|
export {};
|
|
84
86
|
//# sourceMappingURL=service-helper.d.ts.map
|
|
@@ -127,7 +127,7 @@ async function getServiceChoices(catalogs, serviceFilter) {
|
|
|
127
127
|
logServiceCatalogErrorsForHelp(requestErrors, catalogs.length);
|
|
128
128
|
}
|
|
129
129
|
if (serviceFilter) {
|
|
130
|
-
flatServices = flatServices.filter((service) => serviceFilter.includes(service.id));
|
|
130
|
+
flatServices = flatServices.filter((service) => serviceFilter.includes(service.id) || serviceFilter.includes(service.path));
|
|
131
131
|
}
|
|
132
132
|
return createServiceChoices(flatServices);
|
|
133
133
|
}
|
|
@@ -295,10 +295,22 @@ function getSelectedServiceLabel(username) {
|
|
|
295
295
|
* @param options.hasAnnotations used to determine whether to show a warning message that annotations could not be retrieved
|
|
296
296
|
* @param options.showCollabDraftWarnOptions to show the collaborative draft warning, the option `showCollabDraftWarning` must be true
|
|
297
297
|
* and the edmx metadata must be provided
|
|
298
|
+
* @param options.serviceFilter if a service filter has been specified this may alter the user messages when no services are listed
|
|
298
299
|
* @returns the service selection prompt additional message
|
|
299
300
|
*/
|
|
300
|
-
async function getSelectedServiceMessage(serviceChoices, selectedService, connectValidator, { requiredOdataVersion, hasAnnotations = true, showCollabDraftWarnOptions }) {
|
|
301
|
+
async function getSelectedServiceMessage(serviceChoices, selectedService, connectValidator, { requiredOdataVersion, hasAnnotations = true, showCollabDraftWarnOptions, serviceFilter }) {
|
|
302
|
+
// Note that the order of these conditions is critical
|
|
301
303
|
if (serviceChoices?.length === 0) {
|
|
304
|
+
if (serviceFilter && serviceFilter.length > 0) {
|
|
305
|
+
return {
|
|
306
|
+
message: (0, i18n_1.t)('warnings.specifiedServicesNotAvailable', {
|
|
307
|
+
odataVersion: requiredOdataVersion ? `V${requiredOdataVersion} ` : undefined,
|
|
308
|
+
service: serviceFilter[0],
|
|
309
|
+
count: serviceFilter.length
|
|
310
|
+
}),
|
|
311
|
+
severity: yeoman_ui_types_1.Severity.warning
|
|
312
|
+
};
|
|
313
|
+
}
|
|
302
314
|
if (requiredOdataVersion) {
|
|
303
315
|
return {
|
|
304
316
|
message: (0, i18n_1.t)('warnings.noServicesAvailableForOdataVersion', {
|
|
@@ -51,5 +51,7 @@ export declare function createSystemChoices(destinationFilters?: Partial<Destina
|
|
|
51
51
|
* @param defaultChoice the default choice value
|
|
52
52
|
* @returns the index of the default choice in the system choices list
|
|
53
53
|
*/
|
|
54
|
-
export declare function findDefaultSystemSelectionIndex(systemChoices: ListChoiceOptions<SystemSelectionAnswerType>[], defaultChoice: string |
|
|
54
|
+
export declare function findDefaultSystemSelectionIndex(systemChoices: ListChoiceOptions<SystemSelectionAnswerType>[], defaultChoice: string | {
|
|
55
|
+
value?: string;
|
|
56
|
+
} | undefined): number;
|
|
55
57
|
//# sourceMappingURL=prompt-helpers.d.ts.map
|
|
@@ -212,22 +212,23 @@ async function createSystemChoices(destinationFilters, includeCloudFoundryAbapEn
|
|
|
212
212
|
* @returns the index of the default choice in the system choices list
|
|
213
213
|
*/
|
|
214
214
|
function findDefaultSystemSelectionIndex(systemChoices, defaultChoice) {
|
|
215
|
-
|
|
215
|
+
const choice = typeof defaultChoice === 'string' ? defaultChoice : defaultChoice?.value;
|
|
216
|
+
if (!choice) {
|
|
216
217
|
return -1;
|
|
217
218
|
}
|
|
218
|
-
const defaultChoiceIndex = systemChoices.findIndex((
|
|
219
|
-
const { type: systemType, system } =
|
|
219
|
+
const defaultChoiceIndex = systemChoices.findIndex((systemChoice) => {
|
|
220
|
+
const { type: systemType, system } = systemChoice.value;
|
|
220
221
|
if (systemType === 'destination') {
|
|
221
|
-
return system.Name ===
|
|
222
|
+
return system.Name === choice;
|
|
222
223
|
}
|
|
223
224
|
if (systemType === 'backendSystem') {
|
|
224
|
-
return system.name ===
|
|
225
|
+
return system.name === choice;
|
|
225
226
|
}
|
|
226
227
|
if (systemType === 'newSystemChoice') {
|
|
227
|
-
return
|
|
228
|
+
return choice === exports.NewSystemChoice;
|
|
228
229
|
}
|
|
229
230
|
if (systemType === 'cfAbapEnvService') {
|
|
230
|
-
return
|
|
231
|
+
return choice === exports.CfAbapEnvServiceChoice;
|
|
231
232
|
}
|
|
232
233
|
});
|
|
233
234
|
return defaultChoiceIndex;
|
|
@@ -100,7 +100,7 @@ async function getSystemConnectionQuestions(connectionValidator, promptOptions,
|
|
|
100
100
|
const requiredOdataVersion = promptOptions?.serviceSelection?.requiredOdataVersion;
|
|
101
101
|
const destinationFilters = promptOptions?.systemSelection?.destinationFilters;
|
|
102
102
|
const systemChoices = await (0, prompt_helpers_1.createSystemChoices)(destinationFilters, promptOptions?.systemSelection?.includeCloudFoundryAbapEnvChoice, promptOptions?.systemSelection?.hideNewSystem);
|
|
103
|
-
|
|
103
|
+
let defaultChoiceIndex = (0, prompt_helpers_1.findDefaultSystemSelectionIndex)(systemChoices, promptOptions?.systemSelection?.defaultChoice);
|
|
104
104
|
const shouldOnlyShowDefaultChoice = promptOptions?.systemSelection?.onlyShowDefaultChoice && promptOptions?.systemSelection?.defaultChoice;
|
|
105
105
|
const questions = [
|
|
106
106
|
{
|
|
@@ -113,7 +113,13 @@ async function getSystemConnectionQuestions(connectionValidator, promptOptions,
|
|
|
113
113
|
},
|
|
114
114
|
source: (prevAnswers, input) => (0, inquirer_common_1.searchChoices)(input, systemChoices),
|
|
115
115
|
choices: shouldOnlyShowDefaultChoice ? [systemChoices[defaultChoiceIndex]] : systemChoices,
|
|
116
|
-
default:
|
|
116
|
+
default: () => {
|
|
117
|
+
if (shouldOnlyShowDefaultChoice) {
|
|
118
|
+
return 0;
|
|
119
|
+
}
|
|
120
|
+
defaultChoiceIndex = (0, prompt_helpers_1.findDefaultSystemSelectionIndex)(systemChoices, promptOptions?.systemSelection?.defaultChoice); // Recalc to allow default choice to be bound to ref from another prompt
|
|
121
|
+
return defaultChoiceIndex;
|
|
122
|
+
},
|
|
117
123
|
validate: async (selectedSystem) => {
|
|
118
124
|
if (!selectedSystem) {
|
|
119
125
|
return false;
|
|
@@ -261,8 +261,10 @@
|
|
|
261
261
|
"certificateErrors": "A certificate error occurred when connecting to the host: {{-url}}. Certificate error: {{error}}.",
|
|
262
262
|
"allowingUnauthorizedCertsNode": "Setting the `NODE_TLS_REJECT_UNAUTHORIZED` environment variable to `0` makes TLS connections and HTTPS requests insecure by disabling certificate verification. It is important to understand the security risks when using this setting.",
|
|
263
263
|
"certErrorIgnoredByNodeSetting": "An SSL certificate error is being ignored by the 'NODE_TLS_REJECT_UNAUTHORIZED=0' Node.js setting. This makes TLS connections and HTTPS requests insecure by disabling certificate verification. For details of the certification error, see the logs.",
|
|
264
|
-
"noExternalServiceMetdataFetched": "No external service metadata
|
|
265
|
-
"missingServices": "OData V{{odataVersion}} services are not available."
|
|
264
|
+
"noExternalServiceMetdataFetched": "No external service metadata was fetched. $t(texts.seeLogForDetails)",
|
|
265
|
+
"missingServices": "OData V{{odataVersion}} services are not available.",
|
|
266
|
+
"specifiedServicesNotAvailable_one": "The required OData service: {{-service}} is not available from the {{odataVersion}}services catalog. Please ensure the service is available.",
|
|
267
|
+
"specifiedServicesNotAvailable_other": "The required OData services are not available from the {{odataVersion}}services catalog. Please ensure the services are available. $t(texts.seeLogForDetails)"
|
|
266
268
|
},
|
|
267
269
|
"texts": {
|
|
268
270
|
"suggestedSystemNameClient": ", client {{client}}",
|
package/dist/types.d.ts
CHANGED
|
@@ -286,9 +286,12 @@ export type SystemSelectionPromptOptions = {
|
|
|
286
286
|
* Provide a default choice for the system selection prompt, this is used to pre-select a system based on the system name.
|
|
287
287
|
* Set as string literal types `NewSystemChoice` or `CfAbapEnvServiceChoice` to specify the default choice to create a new system connection config in VSCode
|
|
288
288
|
* or to select the Cloud Foundry Abap environments service discovery choice in BAS respectively.
|
|
289
|
+
* Supported as object reference `{ value: }` to allow binding to runtime variables of other prompts or as string
|
|
289
290
|
*
|
|
290
291
|
*/
|
|
291
|
-
defaultChoice?: string
|
|
292
|
+
defaultChoice?: string | {
|
|
293
|
+
value?: string;
|
|
294
|
+
};
|
|
292
295
|
/**
|
|
293
296
|
* Only show the default choice in the system selection prompt, this is used to skip the system selection prompt if the default choice is already known.
|
|
294
297
|
* If the `defaultChoice` value is not found in the systems choices, or the `defaultChoice` option is not specified,
|
|
@@ -296,7 +299,7 @@ export type SystemSelectionPromptOptions = {
|
|
|
296
299
|
*/
|
|
297
300
|
onlyShowDefaultChoice?: boolean;
|
|
298
301
|
/**
|
|
299
|
-
* If true, the 'New System' option is not added to the system selection list.
|
|
302
|
+
* If true, the 'New System' option is not added to the system selection list. Default is false - the 'New System' option will be available.
|
|
300
303
|
*/
|
|
301
304
|
hideNewSystem?: boolean;
|
|
302
305
|
};
|
|
@@ -327,7 +330,7 @@ export type ServiceSelectionPromptOptions = {
|
|
|
327
330
|
*/
|
|
328
331
|
showCollaborativeDraftWarning?: boolean;
|
|
329
332
|
/**
|
|
330
|
-
* A list of service ids ({@link ODataServiceInfo.id}), used to filter the catalog results
|
|
333
|
+
* A list of service ids ({@link ODataServiceInfo.id}) or service paths ({@link ODataServiceInfo.path}), used to filter the service catalog results
|
|
331
334
|
*/
|
|
332
335
|
serviceFilter?: string[];
|
|
333
336
|
} & Pick<CommonPromptOptions, 'additionalMessages'>;
|
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.14.
|
|
4
|
+
"version": "2.14.10",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -31,15 +31,15 @@
|
|
|
31
31
|
"os-name": "4.0.1",
|
|
32
32
|
"@sap-ux/axios-extension": "1.25.6",
|
|
33
33
|
"@sap-ux/btp-utils": "1.1.6",
|
|
34
|
+
"@sap-ux/fiori-generator-shared": "0.13.54",
|
|
35
|
+
"@sap-ux/guided-answers-helper": "0.4.2",
|
|
34
36
|
"@sap-ux/telemetry": "0.6.56",
|
|
35
37
|
"@sap-ux/inquirer-common": "0.10.14",
|
|
36
38
|
"@sap-ux/logger": "0.8.0",
|
|
37
|
-
"@sap-ux/fiori-generator-shared": "0.13.54",
|
|
38
39
|
"@sap-ux/nodejs-utils": "0.2.11",
|
|
39
|
-
"@sap-ux/
|
|
40
|
+
"@sap-ux/project-access": "1.34.2",
|
|
40
41
|
"@sap-ux/project-input-validator": "0.6.45",
|
|
41
|
-
"@sap-ux/store": "1.5.0"
|
|
42
|
-
"@sap-ux/project-access": "1.34.2"
|
|
42
|
+
"@sap-ux/store": "1.5.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@sap-ux/vocabularies-types": "0.14.5",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@types/lodash": "4.14.202",
|
|
50
50
|
"jest-extended": "6.0.0",
|
|
51
51
|
"@sap-ux/fiori-generator-shared": "0.13.54",
|
|
52
|
-
"@sap-ux/fiori-elements-writer": "2.8.
|
|
52
|
+
"@sap-ux/fiori-elements-writer": "2.8.42",
|
|
53
53
|
"@sap-ux/fiori-freestyle-writer": "2.5.29",
|
|
54
54
|
"@sap-ux/feature-toggle": "0.3.5",
|
|
55
55
|
"@sap-ux/odata-service-writer": "0.29.8",
|