@sap-ux/flp-config-inquirer 0.2.17 → 0.2.18

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.
@@ -22,27 +22,22 @@ function getQuestions(inbounds, appId, promptOptions) {
22
22
  const existingKeyRef = { value: false };
23
23
  const silentOverwrite = promptOptions?.silentOverwrite ?? false;
24
24
  const keyedPrompts = {
25
- [types_1.promptNames.inboundId]: (0, questions_1.getInboundIdsPrompt)(inboundKeys, promptOptions?.[types_1.promptNames.inboundId]),
26
- [types_1.promptNames.emptyInboundsInfo]: (0, questions_1.getEmptyInboundsLabelPrompt)(inboundKeys, appId, promptOptions?.[types_1.promptNames.emptyInboundsInfo]),
25
+ [types_1.promptNames.inboundId]: (0, questions_1.getInboundIdsPrompt)(inboundKeys),
26
+ [types_1.promptNames.emptyInboundsInfo]: (0, questions_1.getEmptyInboundsLabelPrompt)(inboundKeys, appId),
27
27
  [types_1.promptNames.semanticObject]: (0, questions_1.getSemanticObjectPrompt)(isCLI, promptOptions?.[types_1.promptNames.semanticObject]),
28
28
  [types_1.promptNames.action]: (0, questions_1.getActionPrompt)(isCLI, promptOptions?.[types_1.promptNames.action]),
29
29
  [types_1.promptNames.overwrite]: (0, questions_1.getOverwritePrompt)(inboundKeys, isCLI, existingKeyRef, promptOptions?.[types_1.promptNames.overwrite]),
30
30
  [types_1.promptNames.title]: (0, questions_1.getTitlePrompt)(existingKeyRef, silentOverwrite, isCLI, promptOptions?.[types_1.promptNames.title]),
31
31
  [types_1.promptNames.subTitle]: (0, questions_1.getSubTitlePrompt)(existingKeyRef, silentOverwrite, promptOptions?.[types_1.promptNames.subTitle]),
32
- [types_1.promptNames.additionalParameters]: (0, questions_1.getParameterStringPrompt)(inboundKeys, promptOptions?.[types_1.promptNames.additionalParameters]),
33
- [types_1.promptNames.createAnotherInbound]: (0, questions_1.getCreateAnotherInboundPrompt)(isCLI, promptOptions?.[types_1.promptNames.createAnotherInbound])
32
+ [types_1.promptNames.additionalParameters]: (0, questions_1.getParameterStringPrompt)(inboundKeys),
33
+ [types_1.promptNames.createAnotherInbound]: (0, questions_1.getCreateAnotherInboundPrompt)(isCLI)
34
34
  };
35
- const questions = [
36
- keyedPrompts[types_1.promptNames.inboundId],
37
- keyedPrompts[types_1.promptNames.emptyInboundsInfo],
38
- keyedPrompts[types_1.promptNames.semanticObject],
39
- keyedPrompts[types_1.promptNames.action],
40
- keyedPrompts[types_1.promptNames.overwrite],
41
- keyedPrompts[types_1.promptNames.title],
42
- keyedPrompts[types_1.promptNames.subTitle],
43
- keyedPrompts[types_1.promptNames.additionalParameters],
44
- keyedPrompts[types_1.promptNames.createAnotherInbound]
45
- ];
35
+ const questions = Object.entries(keyedPrompts)
36
+ .filter(([promptName]) => {
37
+ const option = promptOptions?.[promptName];
38
+ return option && 'hide' in option ? !option.hide : true;
39
+ })
40
+ .map(([_, prompt]) => prompt);
46
41
  return questions;
47
42
  }
48
43
  //# sourceMappingURL=prompts.js.map
@@ -1,35 +1,31 @@
1
- import type { FLPConfigQuestion, InboundIdPromptOptions, CreateAnotherInboundPromptOptions, ParameterStringPromptOptions, EmptyInboundsLabelOptions } from '../../types';
1
+ import type { FLPConfigQuestion } from '../../types';
2
2
  /**
3
3
  * Creates the 'inboundId' prompt for FLP configuration.
4
4
  *
5
5
  * @param {string[]} inboundIds - List of existing inbound IDs to populate the prompt choices.
6
- * @param {InboundIdPromptOptions} [options] - Optional configuration for the inbound ID prompt, including defaults.
7
6
  * @returns {FLPConfigQuestion} The prompt configuration for selecting an inbound ID.
8
7
  */
9
- export declare function getInboundIdsPrompt(inboundIds: string[], options?: InboundIdPromptOptions): FLPConfigQuestion;
8
+ export declare function getInboundIdsPrompt(inboundIds: string[]): FLPConfigQuestion;
10
9
  /**
11
10
  * Creates the 'emptyInboundsInfo' label prompt for cases where no inbounds exist.
12
11
  *
13
12
  * @param {string[]} inboundIds - List of existing inbound IDs to determine whether to display this label.
14
13
  * @param {string} [appId] - Application ID to generate a link for the Fiori application library.
15
- * @param {EmptyInboundsLabelOptions} [options] - Optional configuration for the label prompt.
16
14
  * @returns {FLPConfigQuestion} The prompt configuration for displaying an information label when no inbounds exist.
17
15
  */
18
- export declare function getEmptyInboundsLabelPrompt(inboundIds: string[], appId?: string, options?: EmptyInboundsLabelOptions): FLPConfigQuestion;
16
+ export declare function getEmptyInboundsLabelPrompt(inboundIds: string[], appId?: string): FLPConfigQuestion;
19
17
  /**
20
18
  * Creates the 'additionalParameters' prompt for specifying parameters in JSON format.
21
19
  *
22
20
  * @param {string[]} inboundIds - List of existing inbound IDs to conditionally display this prompt.
23
- * @param {ParameterStringPromptOptions} [options] - Optional configuration for the additional parameter string prompt, including defaults.
24
21
  * @returns {FLPConfigQuestion} The prompt configuration for specifying a parameter string.
25
22
  */
26
- export declare function getParameterStringPrompt(inboundIds: string[], options?: ParameterStringPromptOptions): FLPConfigQuestion;
23
+ export declare function getParameterStringPrompt(inboundIds: string[]): FLPConfigQuestion;
27
24
  /**
28
25
  * Creates the 'createAnotherInbound' confirmation prompt for adding additional inbounds.
29
26
  *
30
27
  * @param {boolean} isCLI - Indicates if the platform is CLI.
31
- * @param {CreateAnotherInboundPromptOptions} [options] - Optional configuration for the confirmation prompt, including defaults.
32
28
  * @returns {FLPConfigQuestion} The prompt configuration for confirming whether to create another inbound.
33
29
  */
34
- export declare function getCreateAnotherInboundPrompt(isCLI: boolean, options?: CreateAnotherInboundPromptOptions): FLPConfigQuestion;
30
+ export declare function getCreateAnotherInboundPrompt(isCLI: boolean): FLPConfigQuestion;
35
31
  //# sourceMappingURL=advanced.d.ts.map
@@ -12,10 +12,9 @@ const types_1 = require("../../types");
12
12
  * Creates the 'inboundId' prompt for FLP configuration.
13
13
  *
14
14
  * @param {string[]} inboundIds - List of existing inbound IDs to populate the prompt choices.
15
- * @param {InboundIdPromptOptions} [options] - Optional configuration for the inbound ID prompt, including defaults.
16
15
  * @returns {FLPConfigQuestion} The prompt configuration for selecting an inbound ID.
17
16
  */
18
- function getInboundIdsPrompt(inboundIds, options) {
17
+ function getInboundIdsPrompt(inboundIds) {
19
18
  return {
20
19
  type: 'list',
21
20
  name: types_1.promptNames.inboundId,
@@ -23,7 +22,7 @@ function getInboundIdsPrompt(inboundIds, options) {
23
22
  choices: inboundIds,
24
23
  default: inboundIds[0],
25
24
  validate: project_input_validator_1.validateEmptyString,
26
- when: options?.hide ? false : inboundIds?.length > 0,
25
+ when: inboundIds?.length > 0,
27
26
  guiOptions: {
28
27
  hint: (0, i18n_1.t)('tooltips.inboundId'),
29
28
  breadcrumb: (0, i18n_1.t)('prompts.inboundIds'),
@@ -36,10 +35,9 @@ function getInboundIdsPrompt(inboundIds, options) {
36
35
  *
37
36
  * @param {string[]} inboundIds - List of existing inbound IDs to determine whether to display this label.
38
37
  * @param {string} [appId] - Application ID to generate a link for the Fiori application library.
39
- * @param {EmptyInboundsLabelOptions} [options] - Optional configuration for the label prompt.
40
38
  * @returns {FLPConfigQuestion} The prompt configuration for displaying an information label when no inbounds exist.
41
39
  */
42
- function getEmptyInboundsLabelPrompt(inboundIds, appId, options) {
40
+ function getEmptyInboundsLabelPrompt(inboundIds, appId) {
43
41
  return {
44
42
  type: 'input',
45
43
  name: types_1.promptNames.emptyInboundsInfo,
@@ -52,17 +50,16 @@ function getEmptyInboundsLabelPrompt(inboundIds, appId, options) {
52
50
  url: `https://fioriappslibrary.hana.ondemand.com/sap/fix/externalViewer/${appId ? `index.html?appId=${appId}&releaseGroupTextCombined=SC` : '#/home'}`
53
51
  }
54
52
  },
55
- when: options?.hide ? false : inboundIds.length === 0
53
+ when: inboundIds.length === 0
56
54
  };
57
55
  }
58
56
  /**
59
57
  * Creates the 'additionalParameters' prompt for specifying parameters in JSON format.
60
58
  *
61
59
  * @param {string[]} inboundIds - List of existing inbound IDs to conditionally display this prompt.
62
- * @param {ParameterStringPromptOptions} [options] - Optional configuration for the additional parameter string prompt, including defaults.
63
60
  * @returns {FLPConfigQuestion} The prompt configuration for specifying a parameter string.
64
61
  */
65
- function getParameterStringPrompt(inboundIds, options) {
62
+ function getParameterStringPrompt(inboundIds) {
66
63
  return {
67
64
  type: 'editor',
68
65
  name: types_1.promptNames.additionalParameters,
@@ -79,7 +76,7 @@ function getParameterStringPrompt(inboundIds, options) {
79
76
  }
80
77
  return true;
81
78
  },
82
- when: options?.hide ? false : inboundIds?.length === 0,
79
+ when: inboundIds?.length === 0,
83
80
  guiOptions: {
84
81
  hint: (0, i18n_1.t)('tooltips.additionalParameters'),
85
82
  mandatory: false
@@ -90,16 +87,15 @@ function getParameterStringPrompt(inboundIds, options) {
90
87
  * Creates the 'createAnotherInbound' confirmation prompt for adding additional inbounds.
91
88
  *
92
89
  * @param {boolean} isCLI - Indicates if the platform is CLI.
93
- * @param {CreateAnotherInboundPromptOptions} [options] - Optional configuration for the confirmation prompt, including defaults.
94
90
  * @returns {FLPConfigQuestion} The prompt configuration for confirming whether to create another inbound.
95
91
  */
96
- function getCreateAnotherInboundPrompt(isCLI, options) {
92
+ function getCreateAnotherInboundPrompt(isCLI) {
97
93
  return {
98
94
  type: 'confirm',
99
95
  name: types_1.promptNames.createAnotherInbound,
100
96
  message: (0, i18n_1.t)('prompts.createAnotherInbound'),
101
97
  default: false,
102
- when: options?.hide ? false : (answers) => !isCLI && !!answers?.inboundId,
98
+ when: (answers) => !isCLI && !!answers?.inboundId,
103
99
  guiOptions: {
104
100
  hint: (0, i18n_1.t)('tooltips.inboundId'),
105
101
  breadcrumb: (0, i18n_1.t)('prompts.inboundIds')
@@ -75,13 +75,11 @@ function getOverwritePrompt(inboundKeys, isCLI, existingKeyRef, options) {
75
75
  applyDefaultWhenDirty: true
76
76
  },
77
77
  default: options?.default ?? (() => !existingKeyRef.value),
78
- when: options?.hide
79
- ? false
80
- : (previousAnswers) => {
81
- existingKeyRef.value =
82
- inboundKeys.indexOf(`${previousAnswers.semanticObject}-${previousAnswers.action}`) > -1;
83
- return existingKeyRef.value;
84
- },
78
+ when: (previousAnswers) => {
79
+ existingKeyRef.value =
80
+ inboundKeys.indexOf(`${previousAnswers.semanticObject}-${previousAnswers.action}`) > -1;
81
+ return existingKeyRef.value;
82
+ },
85
83
  additionalMessages: (_, previousAnswers) => ({
86
84
  message: (0, i18n_1.t)('validators.inboundConfigKeyExists', {
87
85
  inboundKey: `${previousAnswers.semanticObject}-${previousAnswers.action}`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/flp-config-inquirer",
3
3
  "description": "Prompts module that can prompt users for inputs required for FLP configuration",
4
- "version": "0.2.17",
4
+ "version": "0.2.18",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",