@sap-ux/flp-config-inquirer 0.3.27 → 0.3.29
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 +8 -6
- package/dist/index.js +12 -7
- package/dist/prompts/prompts.d.ts +10 -3
- package/dist/prompts/prompts.js +21 -7
- package/dist/prompts/questions/advanced.d.ts +15 -16
- package/dist/prompts/questions/advanced.js +55 -51
- package/dist/prompts/questions/basic.d.ts +3 -1
- package/dist/prompts/questions/basic.js +58 -17
- package/dist/prompts/questions/index.d.ts +1 -0
- package/dist/prompts/questions/index.js +1 -0
- package/dist/prompts/questions/tile-settings.d.ts +9 -0
- package/dist/prompts/questions/tile-settings.js +40 -0
- package/dist/translations/flp-config-inquirer.i18n.json +13 -4
- package/dist/types.d.ts +39 -14
- package/dist/types.js +12 -3
- package/dist/utils.d.ts +21 -0
- package/dist/utils.js +80 -0
- package/package.json +7 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import type { ManifestNamespace } from '@sap-ux/project-access';
|
|
2
2
|
import type { InquirerAdapter, PromptDefaultValue } from '@sap-ux/inquirer-common';
|
|
3
|
+
import { addi18nResourceBundle } from './i18n';
|
|
3
4
|
import { promptNames } from './types';
|
|
4
|
-
import
|
|
5
|
+
import { getExistingFlpConfigInfoPrompt } from './prompts/questions';
|
|
6
|
+
import { getTileSettingsQuestions } from './prompts';
|
|
7
|
+
import type { FLPConfigAnswers, FLPConfigQuestion, FLPConfigPromptOptions, TileSettingsAnswers } from './types';
|
|
8
|
+
import { getAdpFlpConfigPromptOptions, getAdpFlpInboundsWriterConfig } from './utils';
|
|
5
9
|
/**
|
|
6
10
|
* Retrieves the inquirer prompts for the FLP configuration.
|
|
7
11
|
*
|
|
8
12
|
* @param {ManifestNamespace.Inbound | undefined} inbounds - An object containing existing inbound keys to check for duplicates.
|
|
9
|
-
* @param {string | undefined} appId - The application ID used to generate unique prompt keys.
|
|
10
13
|
* @param {FLPConfigPromptOptions | undefined} promptOptions - Options that control prompt behavior. See {@link FLPConfigPromptOptions} for details.
|
|
11
14
|
* @returns {Promise<FLPConfigQuestion[]>} A promise that resolves to an array of FLP configuration questions.
|
|
12
15
|
*/
|
|
13
|
-
declare function getPrompts(inbounds?: ManifestNamespace.Inbound,
|
|
16
|
+
declare function getPrompts(inbounds?: ManifestNamespace.Inbound, promptOptions?: FLPConfigPromptOptions): Promise<FLPConfigQuestion[]>;
|
|
14
17
|
/**
|
|
15
18
|
* Prompts the user for FLP configuration inputs.
|
|
16
19
|
*
|
|
17
20
|
* @param {InquirerAdapter} adapter - An instance of `InquirerAdapter` to handle prompting.
|
|
18
21
|
* @param {ManifestNamespace.Inbound | undefined} inbounds - An object containing existing inbound keys to check for duplicates.
|
|
19
|
-
* @param {string | undefined} appId - The application ID used to generate unique prompt keys.
|
|
20
22
|
* @param {FLPConfigPromptOptions | undefined} promptOptions - Options that control prompt behavior. See {@link FLPConfigPromptOptions} for details.
|
|
21
23
|
* @returns {Promise<FLPConfigAnswers>} A promise that resolves to the user's answers for the FLP configuration.
|
|
22
24
|
*/
|
|
23
|
-
declare function prompt(adapter: InquirerAdapter, inbounds?: ManifestNamespace.Inbound,
|
|
24
|
-
export { getPrompts, prompt, promptNames, type InquirerAdapter, type PromptDefaultValue, type FLPConfigAnswers, type FLPConfigPromptOptions };
|
|
25
|
+
declare function prompt(adapter: InquirerAdapter, inbounds?: ManifestNamespace.Inbound, promptOptions?: FLPConfigPromptOptions): Promise<FLPConfigAnswers>;
|
|
26
|
+
export { getPrompts, getExistingFlpConfigInfoPrompt, prompt, addi18nResourceBundle, promptNames, type InquirerAdapter, type PromptDefaultValue, type FLPConfigAnswers, type FLPConfigPromptOptions, type FLPConfigQuestion, type TileSettingsAnswers, getAdpFlpConfigPromptOptions, getAdpFlpInboundsWriterConfig, getTileSettingsQuestions };
|
|
25
27
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -3,37 +3,42 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.promptNames = void 0;
|
|
6
|
+
exports.getTileSettingsQuestions = exports.getAdpFlpInboundsWriterConfig = exports.getAdpFlpConfigPromptOptions = exports.promptNames = exports.addi18nResourceBundle = exports.getExistingFlpConfigInfoPrompt = void 0;
|
|
7
7
|
exports.getPrompts = getPrompts;
|
|
8
8
|
exports.prompt = prompt;
|
|
9
9
|
const isNil_1 = __importDefault(require("lodash/isNil"));
|
|
10
10
|
const i18n_1 = require("./i18n");
|
|
11
|
+
Object.defineProperty(exports, "addi18nResourceBundle", { enumerable: true, get: function () { return i18n_1.addi18nResourceBundle; } });
|
|
11
12
|
const types_1 = require("./types");
|
|
12
13
|
Object.defineProperty(exports, "promptNames", { enumerable: true, get: function () { return types_1.promptNames; } });
|
|
14
|
+
const questions_1 = require("./prompts/questions");
|
|
15
|
+
Object.defineProperty(exports, "getExistingFlpConfigInfoPrompt", { enumerable: true, get: function () { return questions_1.getExistingFlpConfigInfoPrompt; } });
|
|
13
16
|
const prompts_1 = require("./prompts");
|
|
17
|
+
Object.defineProperty(exports, "getTileSettingsQuestions", { enumerable: true, get: function () { return prompts_1.getTileSettingsQuestions; } });
|
|
18
|
+
const utils_1 = require("./utils");
|
|
19
|
+
Object.defineProperty(exports, "getAdpFlpConfigPromptOptions", { enumerable: true, get: function () { return utils_1.getAdpFlpConfigPromptOptions; } });
|
|
20
|
+
Object.defineProperty(exports, "getAdpFlpInboundsWriterConfig", { enumerable: true, get: function () { return utils_1.getAdpFlpInboundsWriterConfig; } });
|
|
14
21
|
/**
|
|
15
22
|
* Retrieves the inquirer prompts for the FLP configuration.
|
|
16
23
|
*
|
|
17
24
|
* @param {ManifestNamespace.Inbound | undefined} inbounds - An object containing existing inbound keys to check for duplicates.
|
|
18
|
-
* @param {string | undefined} appId - The application ID used to generate unique prompt keys.
|
|
19
25
|
* @param {FLPConfigPromptOptions | undefined} promptOptions - Options that control prompt behavior. See {@link FLPConfigPromptOptions} for details.
|
|
20
26
|
* @returns {Promise<FLPConfigQuestion[]>} A promise that resolves to an array of FLP configuration questions.
|
|
21
27
|
*/
|
|
22
|
-
async function getPrompts(inbounds,
|
|
28
|
+
async function getPrompts(inbounds, promptOptions) {
|
|
23
29
|
await (0, i18n_1.initI18n)();
|
|
24
|
-
return (0, prompts_1.getQuestions)(inbounds,
|
|
30
|
+
return (0, prompts_1.getQuestions)(inbounds, promptOptions);
|
|
25
31
|
}
|
|
26
32
|
/**
|
|
27
33
|
* Prompts the user for FLP configuration inputs.
|
|
28
34
|
*
|
|
29
35
|
* @param {InquirerAdapter} adapter - An instance of `InquirerAdapter` to handle prompting.
|
|
30
36
|
* @param {ManifestNamespace.Inbound | undefined} inbounds - An object containing existing inbound keys to check for duplicates.
|
|
31
|
-
* @param {string | undefined} appId - The application ID used to generate unique prompt keys.
|
|
32
37
|
* @param {FLPConfigPromptOptions | undefined} promptOptions - Options that control prompt behavior. See {@link FLPConfigPromptOptions} for details.
|
|
33
38
|
* @returns {Promise<FLPConfigAnswers>} A promise that resolves to the user's answers for the FLP configuration.
|
|
34
39
|
*/
|
|
35
|
-
async function prompt(adapter, inbounds,
|
|
36
|
-
const flpPrompts = await getPrompts(inbounds,
|
|
40
|
+
async function prompt(adapter, inbounds, promptOptions) {
|
|
41
|
+
const flpPrompts = await getPrompts(inbounds, promptOptions);
|
|
37
42
|
const answers = await adapter.prompt(flpPrompts);
|
|
38
43
|
// Apply default values to prompts in case they have not been executed
|
|
39
44
|
if (promptOptions) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ManifestNamespace } from '@sap-ux/project-access';
|
|
2
|
-
import type { FLPConfigPromptOptions, FLPConfigQuestion } from '../types';
|
|
2
|
+
import type { FLPConfigPromptOptions, FLPConfigQuestion, TileSettingsAnswers } from '../types';
|
|
3
|
+
import type { YUIQuestion } from '@sap-ux/inquirer-common';
|
|
3
4
|
/**
|
|
4
5
|
* Generates a list of prompts for FLP (Fiori Launchpad) configuration.
|
|
5
6
|
*
|
|
@@ -8,9 +9,15 @@ import type { FLPConfigPromptOptions, FLPConfigQuestion } from '../types';
|
|
|
8
9
|
* prompts can be customized through the provided `promptOptions` parameter.
|
|
9
10
|
*
|
|
10
11
|
* @param {ManifestNamespace.Inbound | undefined} [inbounds] - Existing inbounds for the application, if any.
|
|
11
|
-
* @param {string | undefined} [appId] - Application ID for generating relevant prompts.
|
|
12
12
|
* @param {FLPConfigPromptOptions | undefined} [promptOptions] - Optional configuration to control prompt behavior and defaults.
|
|
13
13
|
* @returns {FLPConfigQuestion[]} An array of FLPConfigQuestion objects to be used for prompting the user.
|
|
14
14
|
*/
|
|
15
|
-
export declare function getQuestions(inbounds?: ManifestNamespace.Inbound,
|
|
15
|
+
export declare function getQuestions(inbounds?: ManifestNamespace.Inbound, promptOptions?: FLPConfigPromptOptions): FLPConfigQuestion[];
|
|
16
|
+
/**
|
|
17
|
+
* Generates a list of prompts for configuring tile settings in the FLP configuration.
|
|
18
|
+
*
|
|
19
|
+
* @param {FLPConfigPromptOptions} [promptOptions] - Optional configuration to control prompt behavior and defaults.
|
|
20
|
+
* @returns {YUIQuestion<TileSettingsAnswers>[] | FLPConfigQuestion[]} An array of questions for tile settings.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getTileSettingsQuestions(promptOptions?: FLPConfigPromptOptions): YUIQuestion<TileSettingsAnswers>[];
|
|
16
23
|
//# sourceMappingURL=prompts.d.ts.map
|
package/dist/prompts/prompts.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getQuestions = getQuestions;
|
|
4
|
+
exports.getTileSettingsQuestions = getTileSettingsQuestions;
|
|
4
5
|
const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
|
|
5
6
|
const questions_1 = require("./questions");
|
|
6
7
|
const types_1 = require("../types");
|
|
@@ -12,25 +13,24 @@ const types_1 = require("../types");
|
|
|
12
13
|
* prompts can be customized through the provided `promptOptions` parameter.
|
|
13
14
|
*
|
|
14
15
|
* @param {ManifestNamespace.Inbound | undefined} [inbounds] - Existing inbounds for the application, if any.
|
|
15
|
-
* @param {string | undefined} [appId] - Application ID for generating relevant prompts.
|
|
16
16
|
* @param {FLPConfigPromptOptions | undefined} [promptOptions] - Optional configuration to control prompt behavior and defaults.
|
|
17
17
|
* @returns {FLPConfigQuestion[]} An array of FLPConfigQuestion objects to be used for prompting the user.
|
|
18
18
|
*/
|
|
19
|
-
function getQuestions(inbounds,
|
|
19
|
+
function getQuestions(inbounds, promptOptions) {
|
|
20
20
|
const inboundKeys = Object.keys(inbounds ?? {});
|
|
21
21
|
const isCLI = (0, fiori_generator_shared_1.getHostEnvironment)() === fiori_generator_shared_1.hostEnvironment.cli;
|
|
22
22
|
const existingKeyRef = { value: false };
|
|
23
23
|
const silentOverwrite = promptOptions?.silentOverwrite ?? false;
|
|
24
24
|
const keyedPrompts = {
|
|
25
|
-
[types_1.promptNames.
|
|
26
|
-
[types_1.promptNames.
|
|
25
|
+
[types_1.promptNames.existingFlpConfigInfo]: (0, questions_1.getExistingFlpConfigInfoPrompt)(isCLI),
|
|
26
|
+
[types_1.promptNames.inboundId]: (0, questions_1.getInboundIdsPrompt)(inbounds ?? {}),
|
|
27
27
|
[types_1.promptNames.semanticObject]: (0, questions_1.getSemanticObjectPrompt)(isCLI, promptOptions?.[types_1.promptNames.semanticObject]),
|
|
28
|
-
[types_1.promptNames.action]: (0, questions_1.getActionPrompt)(isCLI, promptOptions?.[types_1.promptNames.action]),
|
|
28
|
+
[types_1.promptNames.action]: (0, questions_1.getActionPrompt)(isCLI, promptOptions?.[types_1.promptNames.action], inbounds),
|
|
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.
|
|
33
|
-
[types_1.promptNames.
|
|
32
|
+
[types_1.promptNames.icon]: (0, questions_1.getIconPrompt)(promptOptions?.[types_1.promptNames.icon]),
|
|
33
|
+
[types_1.promptNames.additionalParameters]: (0, questions_1.getParameterStringPrompt)()
|
|
34
34
|
};
|
|
35
35
|
const questions = Object.entries(keyedPrompts)
|
|
36
36
|
.filter(([promptName]) => {
|
|
@@ -40,4 +40,18 @@ function getQuestions(inbounds, appId, promptOptions) {
|
|
|
40
40
|
.map(([_, prompt]) => prompt);
|
|
41
41
|
return questions;
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Generates a list of prompts for configuring tile settings in the FLP configuration.
|
|
45
|
+
*
|
|
46
|
+
* @param {FLPConfigPromptOptions} [promptOptions] - Optional configuration to control prompt behavior and defaults.
|
|
47
|
+
* @returns {YUIQuestion<TileSettingsAnswers>[] | FLPConfigQuestion[]} An array of questions for tile settings.
|
|
48
|
+
*/
|
|
49
|
+
function getTileSettingsQuestions(promptOptions) {
|
|
50
|
+
const isCLI = (0, fiori_generator_shared_1.getHostEnvironment)() === fiori_generator_shared_1.hostEnvironment.cli;
|
|
51
|
+
const questions = (0, questions_1.getTileSettingsPrompts)();
|
|
52
|
+
if (!promptOptions?.existingFlpConfigInfo?.hide) {
|
|
53
|
+
questions.unshift((0, questions_1.getExistingFlpConfigInfoPrompt)(isCLI));
|
|
54
|
+
}
|
|
55
|
+
return questions;
|
|
56
|
+
}
|
|
43
57
|
//# sourceMappingURL=prompts.js.map
|
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
import type { FLPConfigQuestion } from '../../types';
|
|
1
|
+
import type { FLPConfigQuestion, IconPromptOptions } from '../../types';
|
|
2
|
+
import type { ManifestNamespace } from '@sap-ux/project-access';
|
|
2
3
|
/**
|
|
3
4
|
* Creates the 'inboundId' prompt for FLP configuration.
|
|
4
5
|
*
|
|
5
|
-
* @param {
|
|
6
|
+
* @param {ManifestNamespace.Inbound} inbounds - List of existing inbounds to populate the prompt choices.
|
|
6
7
|
* @returns {FLPConfigQuestion} The prompt configuration for selecting an inbound ID.
|
|
7
8
|
*/
|
|
8
|
-
export declare function getInboundIdsPrompt(
|
|
9
|
+
export declare function getInboundIdsPrompt(inbounds: ManifestNamespace.Inbound): FLPConfigQuestion;
|
|
9
10
|
/**
|
|
10
|
-
* Creates the '
|
|
11
|
+
* Creates the 'additionalParameters' prompt for specifying parameters in JSON format.
|
|
11
12
|
*
|
|
12
|
-
* @
|
|
13
|
-
* @param {string} [appId] - Application ID to generate a link for the Fiori application library.
|
|
14
|
-
* @returns {FLPConfigQuestion} The prompt configuration for displaying an information label when no inbounds exist.
|
|
13
|
+
* @returns {FLPConfigQuestion} The prompt configuration for specifying a parameter string.
|
|
15
14
|
*/
|
|
16
|
-
export declare function
|
|
15
|
+
export declare function getParameterStringPrompt(): FLPConfigQuestion;
|
|
17
16
|
/**
|
|
18
|
-
* Creates the '
|
|
17
|
+
* Creates the 'existingFlpConfigInfo' prompt for displaying existing FLP configuration information.
|
|
19
18
|
*
|
|
20
|
-
* @param
|
|
21
|
-
* @returns {FLPConfigQuestion} The prompt configuration for
|
|
19
|
+
* @param isCLI - Indicates if the platform is CLI (unused).
|
|
20
|
+
* @returns {FLPConfigQuestion} The prompt configuration for displaying existing FLP config info.
|
|
22
21
|
*/
|
|
23
|
-
export declare function
|
|
22
|
+
export declare function getExistingFlpConfigInfoPrompt(isCLI: boolean): FLPConfigQuestion;
|
|
24
23
|
/**
|
|
25
|
-
* Creates the '
|
|
24
|
+
* Creates the 'icon' prompt for FLP configuration.
|
|
26
25
|
*
|
|
27
|
-
* @param {
|
|
28
|
-
* @returns {FLPConfigQuestion} The prompt configuration for
|
|
26
|
+
* @param {IconPromptOptions} [options] - Optional configuration for the icon prompt, including default values.
|
|
27
|
+
* @returns {FLPConfigQuestion} The prompt configuration for the icon.
|
|
29
28
|
*/
|
|
30
|
-
export declare function
|
|
29
|
+
export declare function getIconPrompt(options?: IconPromptOptions): FLPConfigQuestion;
|
|
31
30
|
//# sourceMappingURL=advanced.d.ts.map
|
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getInboundIdsPrompt = getInboundIdsPrompt;
|
|
4
|
-
exports.getEmptyInboundsLabelPrompt = getEmptyInboundsLabelPrompt;
|
|
5
4
|
exports.getParameterStringPrompt = getParameterStringPrompt;
|
|
6
|
-
exports.
|
|
7
|
-
|
|
5
|
+
exports.getExistingFlpConfigInfoPrompt = getExistingFlpConfigInfoPrompt;
|
|
6
|
+
exports.getIconPrompt = getIconPrompt;
|
|
8
7
|
const project_input_validator_1 = require("@sap-ux/project-input-validator");
|
|
9
8
|
const i18n_1 = require("../../i18n");
|
|
10
9
|
const types_1 = require("../../types");
|
|
11
10
|
/**
|
|
12
11
|
* Creates the 'inboundId' prompt for FLP configuration.
|
|
13
12
|
*
|
|
14
|
-
* @param {
|
|
13
|
+
* @param {ManifestNamespace.Inbound} inbounds - List of existing inbounds to populate the prompt choices.
|
|
15
14
|
* @returns {FLPConfigQuestion} The prompt configuration for selecting an inbound ID.
|
|
16
15
|
*/
|
|
17
|
-
function getInboundIdsPrompt(
|
|
16
|
+
function getInboundIdsPrompt(inbounds) {
|
|
17
|
+
const choices = Object.entries(inbounds).map(([inboundId, data]) => ({
|
|
18
|
+
name: inboundId,
|
|
19
|
+
value: data
|
|
20
|
+
}));
|
|
18
21
|
return {
|
|
19
22
|
type: 'list',
|
|
20
23
|
name: types_1.promptNames.inboundId,
|
|
21
24
|
message: (0, i18n_1.t)('prompts.inboundIds'),
|
|
22
|
-
choices:
|
|
23
|
-
default:
|
|
24
|
-
validate: project_input_validator_1.validateEmptyString,
|
|
25
|
-
when:
|
|
25
|
+
choices: choices,
|
|
26
|
+
default: () => choices[0]?.value,
|
|
27
|
+
validate: (value) => (0, project_input_validator_1.validateEmptyString)(value.semanticObject) && (0, project_input_validator_1.validateEmptyString)(value.action),
|
|
28
|
+
when: choices?.length > 0,
|
|
26
29
|
guiOptions: {
|
|
27
30
|
hint: (0, i18n_1.t)('tooltips.inboundId'),
|
|
28
31
|
breadcrumb: (0, i18n_1.t)('prompts.inboundIds'),
|
|
@@ -30,53 +33,32 @@ function getInboundIdsPrompt(inboundIds) {
|
|
|
30
33
|
}
|
|
31
34
|
};
|
|
32
35
|
}
|
|
33
|
-
/**
|
|
34
|
-
* Creates the 'emptyInboundsInfo' label prompt for cases where no inbounds exist.
|
|
35
|
-
*
|
|
36
|
-
* @param {string[]} inboundIds - List of existing inbound IDs to determine whether to display this label.
|
|
37
|
-
* @param {string} [appId] - Application ID to generate a link for the Fiori application library.
|
|
38
|
-
* @returns {FLPConfigQuestion} The prompt configuration for displaying an information label when no inbounds exist.
|
|
39
|
-
*/
|
|
40
|
-
function getEmptyInboundsLabelPrompt(inboundIds, appId) {
|
|
41
|
-
return {
|
|
42
|
-
type: 'input',
|
|
43
|
-
name: types_1.promptNames.emptyInboundsInfo,
|
|
44
|
-
message: (0, i18n_1.t)('prompts.emptyInboundsInfo'),
|
|
45
|
-
guiOptions: {
|
|
46
|
-
type: 'label',
|
|
47
|
-
mandatory: false,
|
|
48
|
-
link: {
|
|
49
|
-
text: 'application page.',
|
|
50
|
-
url: `https://fioriappslibrary.hana.ondemand.com/sap/fix/externalViewer/${appId ? `index.html?appId=${appId}&releaseGroupTextCombined=SC` : '#/home'}`
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
when: inboundIds.length === 0
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
36
|
/**
|
|
57
37
|
* Creates the 'additionalParameters' prompt for specifying parameters in JSON format.
|
|
58
38
|
*
|
|
59
|
-
* @param {string[]} inboundIds - List of existing inbound IDs to conditionally display this prompt.
|
|
60
39
|
* @returns {FLPConfigQuestion} The prompt configuration for specifying a parameter string.
|
|
61
40
|
*/
|
|
62
|
-
function getParameterStringPrompt(
|
|
41
|
+
function getParameterStringPrompt() {
|
|
63
42
|
return {
|
|
64
43
|
type: 'editor',
|
|
65
44
|
name: types_1.promptNames.additionalParameters,
|
|
66
45
|
message: (0, i18n_1.t)('prompts.additionalParameters'),
|
|
46
|
+
default: (answers) => {
|
|
47
|
+
const parameters = answers?.inboundId?.signature?.parameters;
|
|
48
|
+
return parameters ? JSON.stringify(parameters, null, 2) : '';
|
|
49
|
+
},
|
|
67
50
|
validate: (value) => {
|
|
68
51
|
if (!value) {
|
|
69
|
-
return true;
|
|
52
|
+
return true; // No additional parameters provided, skip validation
|
|
70
53
|
}
|
|
71
54
|
try {
|
|
72
|
-
|
|
55
|
+
JSON.parse(value);
|
|
56
|
+
return true;
|
|
73
57
|
}
|
|
74
|
-
catch
|
|
75
|
-
return
|
|
58
|
+
catch {
|
|
59
|
+
return (0, i18n_1.t)('validators.invalidParameterString');
|
|
76
60
|
}
|
|
77
|
-
return true;
|
|
78
61
|
},
|
|
79
|
-
when: inboundIds?.length === 0,
|
|
80
62
|
guiOptions: {
|
|
81
63
|
hint: (0, i18n_1.t)('tooltips.additionalParameters'),
|
|
82
64
|
mandatory: false
|
|
@@ -84,22 +66,44 @@ function getParameterStringPrompt(inboundIds) {
|
|
|
84
66
|
};
|
|
85
67
|
}
|
|
86
68
|
/**
|
|
87
|
-
* Creates the '
|
|
69
|
+
* Creates the 'existingFlpConfigInfo' prompt for displaying existing FLP configuration information.
|
|
88
70
|
*
|
|
89
|
-
* @param
|
|
90
|
-
* @returns {FLPConfigQuestion} The prompt configuration for
|
|
71
|
+
* @param isCLI - Indicates if the platform is CLI (unused).
|
|
72
|
+
* @returns {FLPConfigQuestion} The prompt configuration for displaying existing FLP config info.
|
|
91
73
|
*/
|
|
92
|
-
function
|
|
74
|
+
function getExistingFlpConfigInfoPrompt(isCLI) {
|
|
93
75
|
return {
|
|
94
|
-
type: '
|
|
95
|
-
name: types_1.promptNames.
|
|
96
|
-
message: (0, i18n_1.t)('prompts.
|
|
97
|
-
|
|
98
|
-
when: (answers) => !isCLI && !!answers?.inboundId,
|
|
76
|
+
type: 'input',
|
|
77
|
+
name: types_1.promptNames.existingFlpConfigInfo,
|
|
78
|
+
message: (0, i18n_1.t)('prompts.existingFLPConfig'),
|
|
79
|
+
when: () => !isCLI,
|
|
99
80
|
guiOptions: {
|
|
100
|
-
|
|
101
|
-
|
|
81
|
+
type: 'label',
|
|
82
|
+
mandatory: false
|
|
102
83
|
}
|
|
103
84
|
};
|
|
104
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Creates the 'icon' prompt for FLP configuration.
|
|
88
|
+
*
|
|
89
|
+
* @param {IconPromptOptions} [options] - Optional configuration for the icon prompt, including default values.
|
|
90
|
+
* @returns {FLPConfigQuestion} The prompt configuration for the icon.
|
|
91
|
+
*/
|
|
92
|
+
function getIconPrompt(options) {
|
|
93
|
+
return {
|
|
94
|
+
name: types_1.promptNames.icon,
|
|
95
|
+
type: 'input',
|
|
96
|
+
guiOptions: {
|
|
97
|
+
breadcrumb: true
|
|
98
|
+
},
|
|
99
|
+
message: (0, i18n_1.t)('prompts.icon'),
|
|
100
|
+
default: (answers) => {
|
|
101
|
+
if (options?.default) {
|
|
102
|
+
return options.default;
|
|
103
|
+
}
|
|
104
|
+
return answers?.inboundId?.icon ?? '';
|
|
105
|
+
},
|
|
106
|
+
filter: (val) => val?.trim()
|
|
107
|
+
};
|
|
108
|
+
}
|
|
105
109
|
//# sourceMappingURL=advanced.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ActionPromptOptions, ExistingInboundRef, FLPConfigQuestion, OverwritePromptOptions, SemanticObjectPromptOptions, SubTitlePromptOptions, TitlePromptOptions } from '../../types';
|
|
2
|
+
import type { ManifestNamespace } from '@sap-ux/project-access';
|
|
2
3
|
/**
|
|
3
4
|
* Creates the 'semanticObject' prompt for FLP configuration.
|
|
4
5
|
*
|
|
@@ -12,9 +13,10 @@ export declare function getSemanticObjectPrompt(isCLI: boolean, options?: Semant
|
|
|
12
13
|
*
|
|
13
14
|
* @param {boolean} isCLI - Indicates if the platform is CLI.
|
|
14
15
|
* @param {ActionPromptOptions} [options] - Optional configuration for the action prompt, including default values.
|
|
16
|
+
* @param {ManifestNamespace.Inbound} [inbounds] - Existing inbound configuration to derive default action.
|
|
15
17
|
* @returns {FLPConfigQuestion} The prompt configuration for the action.
|
|
16
18
|
*/
|
|
17
|
-
export declare function getActionPrompt(isCLI: boolean, options?: ActionPromptOptions): FLPConfigQuestion;
|
|
19
|
+
export declare function getActionPrompt(isCLI: boolean, options?: ActionPromptOptions, inbounds?: ManifestNamespace.Inbound): FLPConfigQuestion;
|
|
18
20
|
/**
|
|
19
21
|
* Creates the 'overwrite' prompt for FLP configuration.
|
|
20
22
|
*
|
|
@@ -17,18 +17,26 @@ const types_1 = require("../../types");
|
|
|
17
17
|
* @returns {FLPConfigQuestion} The prompt configuration for the semantic object.
|
|
18
18
|
*/
|
|
19
19
|
function getSemanticObjectPrompt(isCLI, options) {
|
|
20
|
+
const guiOptions = {
|
|
21
|
+
mandatory: true,
|
|
22
|
+
breadcrumb: true
|
|
23
|
+
};
|
|
24
|
+
if (options?.showTooltip) {
|
|
25
|
+
guiOptions.hint = (0, i18n_1.t)('tooltips.semObjectActionDuplication');
|
|
26
|
+
}
|
|
20
27
|
return {
|
|
21
28
|
name: types_1.promptNames.semanticObject,
|
|
22
29
|
type: 'input',
|
|
23
|
-
guiOptions
|
|
24
|
-
mandatory: true,
|
|
25
|
-
breadcrumb: true
|
|
26
|
-
},
|
|
30
|
+
guiOptions,
|
|
27
31
|
message: (0, i18n_1.t)('prompts.semanticObject'),
|
|
28
|
-
default:
|
|
32
|
+
default: (answers) => {
|
|
33
|
+
if (options?.default) {
|
|
34
|
+
return options.default;
|
|
35
|
+
}
|
|
36
|
+
return answers?.inboundId?.semanticObject ? `${answers?.inboundId?.semanticObject}_New` : '';
|
|
37
|
+
},
|
|
29
38
|
filter: (val) => val?.trim(),
|
|
30
|
-
validate: (val) => (0, project_input_validator_1.validateText)(val, isCLI, 30, ['_'])
|
|
31
|
-
when: (answers) => !answers?.inboundId
|
|
39
|
+
validate: (val) => (0, project_input_validator_1.validateText)(val, isCLI, 30, ['_'])
|
|
32
40
|
};
|
|
33
41
|
}
|
|
34
42
|
/**
|
|
@@ -36,21 +44,44 @@ function getSemanticObjectPrompt(isCLI, options) {
|
|
|
36
44
|
*
|
|
37
45
|
* @param {boolean} isCLI - Indicates if the platform is CLI.
|
|
38
46
|
* @param {ActionPromptOptions} [options] - Optional configuration for the action prompt, including default values.
|
|
47
|
+
* @param {ManifestNamespace.Inbound} [inbounds] - Existing inbound configuration to derive default action.
|
|
39
48
|
* @returns {FLPConfigQuestion} The prompt configuration for the action.
|
|
40
49
|
*/
|
|
41
|
-
function getActionPrompt(isCLI, options) {
|
|
50
|
+
function getActionPrompt(isCLI, options, inbounds) {
|
|
51
|
+
const guiOptions = {
|
|
52
|
+
mandatory: true,
|
|
53
|
+
breadcrumb: true
|
|
54
|
+
};
|
|
55
|
+
if (options?.showTooltip) {
|
|
56
|
+
guiOptions.hint = (0, i18n_1.t)('tooltips.semObjectActionDuplication');
|
|
57
|
+
}
|
|
42
58
|
return {
|
|
43
59
|
name: types_1.promptNames.action,
|
|
44
60
|
type: 'input',
|
|
45
|
-
guiOptions
|
|
46
|
-
mandatory: true,
|
|
47
|
-
breadcrumb: true
|
|
48
|
-
},
|
|
61
|
+
guiOptions,
|
|
49
62
|
message: (0, i18n_1.t)('prompts.action'),
|
|
50
|
-
default:
|
|
63
|
+
default: (answers) => {
|
|
64
|
+
if (options?.default) {
|
|
65
|
+
return options.default;
|
|
66
|
+
}
|
|
67
|
+
return answers?.inboundId?.action ? `${answers?.inboundId?.action}_New` : '';
|
|
68
|
+
},
|
|
51
69
|
filter: (val) => val?.trim(),
|
|
52
|
-
validate: (val
|
|
53
|
-
|
|
70
|
+
validate: (val, answers) => {
|
|
71
|
+
const textValidation = (0, project_input_validator_1.validateText)(val, isCLI, 60, ['_']);
|
|
72
|
+
if (textValidation !== true) {
|
|
73
|
+
return textValidation;
|
|
74
|
+
}
|
|
75
|
+
if (!inbounds || !answers.semanticObject) {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
// If executeDuplicateValidation is not set to true, skip duplicate validation
|
|
79
|
+
if (!options?.executeDuplicateValidation) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
const isDuplicate = Object.values(inbounds).some((inbound) => inbound.semanticObject === answers.semanticObject && inbound.action === val);
|
|
83
|
+
return isDuplicate ? (0, i18n_1.t)('validators.duplicateInbound') : true;
|
|
84
|
+
}
|
|
54
85
|
};
|
|
55
86
|
}
|
|
56
87
|
/**
|
|
@@ -107,7 +138,12 @@ function getTitlePrompt(existingKeyRef, silentOverwrite, isCLI, options) {
|
|
|
107
138
|
breadcrumb: true
|
|
108
139
|
},
|
|
109
140
|
message: (0, i18n_1.t)('prompts.title'),
|
|
110
|
-
default:
|
|
141
|
+
default: (answers) => {
|
|
142
|
+
if (options?.default) {
|
|
143
|
+
return options.default;
|
|
144
|
+
}
|
|
145
|
+
return answers?.inboundId?.title ?? '';
|
|
146
|
+
},
|
|
111
147
|
filter: (val) => val?.trim(),
|
|
112
148
|
validate: (val) => (0, project_input_validator_1.validateText)(val, isCLI, 0)
|
|
113
149
|
};
|
|
@@ -129,7 +165,12 @@ function getSubTitlePrompt(existingKeyRef, silentOverwrite, options) {
|
|
|
129
165
|
breadcrumb: (0, i18n_1.t)('prompts.subTitle')
|
|
130
166
|
},
|
|
131
167
|
message: (0, i18n_1.t)('prompts.subTitle'),
|
|
132
|
-
default:
|
|
168
|
+
default: (answers) => {
|
|
169
|
+
if (options?.default) {
|
|
170
|
+
return options.default;
|
|
171
|
+
}
|
|
172
|
+
return answers?.inboundId?.subTitle ?? '';
|
|
173
|
+
},
|
|
133
174
|
filter: (val) => val?.trim()
|
|
134
175
|
};
|
|
135
176
|
}
|
|
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./basic"), exports);
|
|
18
18
|
__exportStar(require("./advanced"), exports);
|
|
19
|
+
__exportStar(require("./tile-settings"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { YUIQuestion } from '@sap-ux/inquirer-common';
|
|
2
|
+
import { type TileSettingsAnswers } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Returns the list of questions for tile handling actions.
|
|
5
|
+
*
|
|
6
|
+
* @returns {YUIQuestion<TileSettingsAnswers>[]} Array of tile action questions.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getTileSettingsPrompts(): YUIQuestion<TileSettingsAnswers>[];
|
|
9
|
+
//# sourceMappingURL=tile-settings.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTileSettingsPrompts = getTileSettingsPrompts;
|
|
4
|
+
const types_1 = require("../../types");
|
|
5
|
+
const i18n_1 = require("../../i18n");
|
|
6
|
+
/**
|
|
7
|
+
* Returns the list of questions for tile handling actions.
|
|
8
|
+
*
|
|
9
|
+
* @returns {YUIQuestion<TileSettingsAnswers>[]} Array of tile action questions.
|
|
10
|
+
*/
|
|
11
|
+
function getTileSettingsPrompts() {
|
|
12
|
+
return [
|
|
13
|
+
{
|
|
14
|
+
type: 'list',
|
|
15
|
+
name: types_1.tilePromptNames.tileHandlingAction,
|
|
16
|
+
message: (0, i18n_1.t)('prompts.tileHandlingAction'),
|
|
17
|
+
choices: [
|
|
18
|
+
{ name: (0, i18n_1.t)('choices.replaceOriginalTile'), value: types_1.tileActions.REPLACE },
|
|
19
|
+
{ name: (0, i18n_1.t)('choices.addNewTile'), value: types_1.tileActions.ADD }
|
|
20
|
+
],
|
|
21
|
+
store: false,
|
|
22
|
+
guiOptions: {
|
|
23
|
+
mandatory: true,
|
|
24
|
+
breadcrumb: true
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
type: 'confirm',
|
|
29
|
+
name: types_1.tilePromptNames.copyFromExisting,
|
|
30
|
+
message: (0, i18n_1.t)('prompts.copyFromExisting'),
|
|
31
|
+
default: false,
|
|
32
|
+
guiOptions: {
|
|
33
|
+
mandatory: true,
|
|
34
|
+
breadcrumb: true
|
|
35
|
+
},
|
|
36
|
+
when: (answers) => answers.tileHandlingAction === types_1.tileActions.ADD
|
|
37
|
+
}
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=tile-settings.js.map
|
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"prompts": {
|
|
3
3
|
"inboundIds": "Inbound ID",
|
|
4
|
-
"emptyInboundsInfo": "Original application target mapping and the default parameters can be found in Fiori reference library under Implementation Information -> Configuration -> Target Mapping(s) in",
|
|
5
4
|
"semanticObject": "Semantic Object",
|
|
6
5
|
"action": "Action",
|
|
7
6
|
"title": "Title",
|
|
8
7
|
"subTitle": "Subtitle",
|
|
9
8
|
"additionalParameters": "Parameters",
|
|
10
|
-
"createAnotherInbound": "Do you want to add or edit another inbound?"
|
|
9
|
+
"createAnotherInbound": "Do you want to add or edit another inbound?",
|
|
10
|
+
"icon": "Icon",
|
|
11
|
+
"existingFLPConfig": "This project already has a SAP Fiori launchpad configuration. If you create a new configuration, it will overwrite the existing one.",
|
|
12
|
+
"tileHandlingAction": "Choose a Tile Handling Action",
|
|
13
|
+
"copyFromExisting": "Copy Configurations from an Existing Inbound?"
|
|
11
14
|
},
|
|
12
15
|
"tooltips": {
|
|
13
16
|
"inboundId": "Choose the inbound ID that will be used to set the FLP tile configuration",
|
|
14
|
-
"additionalParameters": "Enter the value for the parameters in the Target Mappings section from the URL mentioned above"
|
|
17
|
+
"additionalParameters": "Enter the value for the parameters in the Target Mappings section from the URL mentioned above",
|
|
18
|
+
"semObjectActionDuplication": "When generating a new tile, you must modify the Semantic Object value, the Action value, or both. You can use the default suggestions, which include a '_New' suffix for each value or use your own designations."
|
|
15
19
|
},
|
|
16
20
|
"validators": {
|
|
17
21
|
"inboundConfigKeyExists": "An inbound configuration with the key: '{{inboundKey}}' is already defined.",
|
|
22
|
+
"invalidParameterString": "The parameter string is not valid JSON.",
|
|
18
23
|
"flpConfigOverwrite": "Overwrite existing configuration?",
|
|
19
|
-
"
|
|
24
|
+
"duplicateInbound": "The base application has an existing inbound that matches the values for Semantic Object and Action. To create a new tile you must modify the Semantic Object value, the Action value, or both."
|
|
25
|
+
},
|
|
26
|
+
"choices": {
|
|
27
|
+
"replaceOriginalTile": "Replace Base Application's Existing Tiles",
|
|
28
|
+
"addNewTile": "Add a New Tile"
|
|
20
29
|
}
|
|
21
30
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,32 +1,37 @@
|
|
|
1
1
|
import type { YUIQuestion, GuiOptions, PromptSeverityMessage } from '@sap-ux/inquirer-common';
|
|
2
2
|
import type { ListQuestionOptions } from 'inquirer';
|
|
3
|
+
import type { InboundContent } from '@sap-ux/axios-extension';
|
|
3
4
|
/**
|
|
4
5
|
* Enumeration of prompt names used in the FLP configuration.
|
|
5
6
|
*/
|
|
6
7
|
export declare enum promptNames {
|
|
8
|
+
existingFlpConfigInfo = "existingFlpConfigInfo",
|
|
7
9
|
inboundId = "inboundId",
|
|
8
|
-
emptyInboundsInfo = "emptyInboundsInfo",
|
|
9
10
|
semanticObject = "semanticObject",
|
|
10
11
|
action = "action",
|
|
11
12
|
overwrite = "overwrite",
|
|
12
13
|
title = "title",
|
|
13
14
|
subTitle = "subTitle",
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
icon = "icon",
|
|
16
|
+
additionalParameters = "additionalParameters"
|
|
17
|
+
}
|
|
18
|
+
export declare enum tilePromptNames {
|
|
19
|
+
tileHandlingAction = "tileHandlingAction",
|
|
20
|
+
copyFromExisting = "copyFromExisting"
|
|
16
21
|
}
|
|
17
22
|
/**
|
|
18
23
|
* Interface representing the answers collected from the FLP configuration prompts.
|
|
19
24
|
*/
|
|
20
25
|
export interface FLPConfigAnswers {
|
|
21
|
-
[promptNames.
|
|
22
|
-
[promptNames.
|
|
26
|
+
[promptNames.existingFlpConfigInfo]?: string;
|
|
27
|
+
[promptNames.inboundId]?: InboundContent;
|
|
23
28
|
[promptNames.semanticObject]: string;
|
|
24
29
|
[promptNames.action]: string;
|
|
25
30
|
[promptNames.overwrite]?: boolean;
|
|
26
31
|
[promptNames.title]?: string;
|
|
27
32
|
[promptNames.subTitle]?: string;
|
|
33
|
+
[promptNames.icon]?: string;
|
|
28
34
|
[promptNames.additionalParameters]?: string;
|
|
29
|
-
[promptNames.createAnotherInbound]?: boolean;
|
|
30
35
|
s4Continue?: boolean;
|
|
31
36
|
}
|
|
32
37
|
/**
|
|
@@ -53,7 +58,7 @@ export interface InboundIdPromptOptions {
|
|
|
53
58
|
/**
|
|
54
59
|
* Options for the 'empty inbound label' prompt.
|
|
55
60
|
*/
|
|
56
|
-
export interface
|
|
61
|
+
export interface ExistingFlpConfigInfo {
|
|
57
62
|
hide?: boolean;
|
|
58
63
|
}
|
|
59
64
|
/**
|
|
@@ -61,12 +66,26 @@ export interface EmptyInboundsLabelOptions {
|
|
|
61
66
|
*/
|
|
62
67
|
export interface SemanticObjectPromptOptions {
|
|
63
68
|
default?: string;
|
|
69
|
+
hide?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* If set to true, the prompt will show a tooltip with information about semantic objects prompt.
|
|
72
|
+
*/
|
|
73
|
+
showTooltip?: boolean;
|
|
64
74
|
}
|
|
65
75
|
/**
|
|
66
76
|
* Options for the 'action' prompt.
|
|
67
77
|
*/
|
|
68
78
|
export interface ActionPromptOptions {
|
|
69
79
|
default?: string;
|
|
80
|
+
hide?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* If set to false, the prompt will not validate for duplicate semantic object/action combination.
|
|
83
|
+
*/
|
|
84
|
+
executeDuplicateValidation?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* If set to true, the prompt will show a tooltip with information about action prompt.
|
|
87
|
+
*/
|
|
88
|
+
showTooltip?: boolean;
|
|
70
89
|
}
|
|
71
90
|
/**
|
|
72
91
|
* Options for the 'overwrite' prompt.
|
|
@@ -87,17 +106,14 @@ export interface TitlePromptOptions {
|
|
|
87
106
|
export interface SubTitlePromptOptions {
|
|
88
107
|
default?: string;
|
|
89
108
|
}
|
|
90
|
-
|
|
91
|
-
* Options for the 'additionalParameters' prompt.
|
|
92
|
-
*/
|
|
93
|
-
export interface ParameterStringPromptOptions {
|
|
109
|
+
export interface IconPromptOptions {
|
|
94
110
|
default?: string;
|
|
95
111
|
hide?: boolean;
|
|
96
112
|
}
|
|
97
113
|
/**
|
|
98
|
-
* Options for the '
|
|
114
|
+
* Options for the 'additionalParameters' prompt.
|
|
99
115
|
*/
|
|
100
|
-
export interface
|
|
116
|
+
export interface ParameterStringPromptOptions {
|
|
101
117
|
default?: string;
|
|
102
118
|
hide?: boolean;
|
|
103
119
|
}
|
|
@@ -110,10 +126,19 @@ type FLPConfigCommonInquirerOptions = {
|
|
|
110
126
|
/**
|
|
111
127
|
* The options for the FLP config inquirer & the prompts.
|
|
112
128
|
*/
|
|
113
|
-
type flpConfigPromptOptions = Record<promptNames.inboundId, InboundIdPromptOptions> & Record<promptNames.
|
|
129
|
+
type flpConfigPromptOptions = Record<promptNames.inboundId, InboundIdPromptOptions> & Record<promptNames.semanticObject, SemanticObjectPromptOptions> & Record<promptNames.action, ActionPromptOptions> & Record<promptNames.overwrite, OverwritePromptOptions> & Record<promptNames.title, TitlePromptOptions> & Record<promptNames.subTitle, SubTitlePromptOptions> & Record<promptNames.icon, IconPromptOptions> & Record<promptNames.additionalParameters, ParameterStringPromptOptions> & Record<promptNames.existingFlpConfigInfo, ExistingFlpConfigInfo>;
|
|
114
130
|
/**
|
|
115
131
|
* The options for the FLP config inquirer & the prompts.
|
|
116
132
|
*/
|
|
117
133
|
export type FLPConfigPromptOptions = Partial<flpConfigPromptOptions> & FLPConfigCommonInquirerOptions;
|
|
134
|
+
export declare const tileActions: {
|
|
135
|
+
readonly REPLACE: "replace";
|
|
136
|
+
readonly ADD: "add";
|
|
137
|
+
};
|
|
138
|
+
export interface TileSettingsAnswers {
|
|
139
|
+
[promptNames.existingFlpConfigInfo]?: string;
|
|
140
|
+
[tilePromptNames.tileHandlingAction]: string;
|
|
141
|
+
[tilePromptNames.copyFromExisting]: boolean;
|
|
142
|
+
}
|
|
118
143
|
export {};
|
|
119
144
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.js
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.promptNames = void 0;
|
|
3
|
+
exports.tileActions = exports.tilePromptNames = exports.promptNames = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Enumeration of prompt names used in the FLP configuration.
|
|
6
6
|
*/
|
|
7
7
|
var promptNames;
|
|
8
8
|
(function (promptNames) {
|
|
9
|
+
promptNames["existingFlpConfigInfo"] = "existingFlpConfigInfo";
|
|
9
10
|
promptNames["inboundId"] = "inboundId";
|
|
10
|
-
promptNames["emptyInboundsInfo"] = "emptyInboundsInfo";
|
|
11
11
|
promptNames["semanticObject"] = "semanticObject";
|
|
12
12
|
promptNames["action"] = "action";
|
|
13
13
|
promptNames["overwrite"] = "overwrite";
|
|
14
14
|
promptNames["title"] = "title";
|
|
15
15
|
promptNames["subTitle"] = "subTitle";
|
|
16
|
+
promptNames["icon"] = "icon";
|
|
16
17
|
promptNames["additionalParameters"] = "additionalParameters";
|
|
17
|
-
promptNames["createAnotherInbound"] = "createAnotherInbound";
|
|
18
18
|
})(promptNames || (exports.promptNames = promptNames = {}));
|
|
19
|
+
var tilePromptNames;
|
|
20
|
+
(function (tilePromptNames) {
|
|
21
|
+
tilePromptNames["tileHandlingAction"] = "tileHandlingAction";
|
|
22
|
+
tilePromptNames["copyFromExisting"] = "copyFromExisting";
|
|
23
|
+
})(tilePromptNames || (exports.tilePromptNames = tilePromptNames = {}));
|
|
24
|
+
exports.tileActions = {
|
|
25
|
+
REPLACE: 'replace',
|
|
26
|
+
ADD: 'add'
|
|
27
|
+
};
|
|
19
28
|
//# sourceMappingURL=types.js.map
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type DescriptorVariant, type NewInboundNavigation, type InternalInboundNavigation } from '@sap-ux/adp-tooling';
|
|
2
|
+
import type { ManifestNamespace } from '@sap-ux/project-access';
|
|
3
|
+
import { type FLPConfigPromptOptions, type FLPConfigAnswers, type TileSettingsAnswers } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Returns FLP configuration prompt options based on the provided inbounds, variant, and tile settings answers.
|
|
6
|
+
*
|
|
7
|
+
* @param {TileSettingsAnswers} tileSettingsAnswers - The answers for tile settings.
|
|
8
|
+
* @param {ManifestNamespace.Inbound} inbounds - The inbounds from the manifest.
|
|
9
|
+
* @param {DescriptorVariant} variant - The descriptor variant object.
|
|
10
|
+
* @returns {FLPConfigPromptOptions} The FLP configuration prompt options.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getAdpFlpConfigPromptOptions(tileSettingsAnswers: TileSettingsAnswers, inbounds?: ManifestNamespace.Inbound, variant?: DescriptorVariant): FLPConfigPromptOptions;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the configuration for writing FLP inbounds based on the provided answers and inbound content.
|
|
15
|
+
*
|
|
16
|
+
* @param {FLPConfigAnswers} flpConfigAnswers - The answers for FLP configuration.
|
|
17
|
+
* @param {TileSettingsAnswers} tileSettingsAnswers - The answers for tile settings.
|
|
18
|
+
* @returns {InternalInboundNavigation | NewInboundNavigation} The configuration for FLP inbounds writer.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getAdpFlpInboundsWriterConfig(flpConfigAnswers: FLPConfigAnswers, tileSettingsAnswers?: TileSettingsAnswers): InternalInboundNavigation | NewInboundNavigation;
|
|
21
|
+
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAdpFlpConfigPromptOptions = getAdpFlpConfigPromptOptions;
|
|
4
|
+
exports.getAdpFlpInboundsWriterConfig = getAdpFlpInboundsWriterConfig;
|
|
5
|
+
const adp_tooling_1 = require("@sap-ux/adp-tooling");
|
|
6
|
+
const types_1 = require("./types");
|
|
7
|
+
/**
|
|
8
|
+
* Returns FLP configuration prompt options based on the provided inbounds, variant, and tile settings answers.
|
|
9
|
+
*
|
|
10
|
+
* @param {TileSettingsAnswers} tileSettingsAnswers - The answers for tile settings.
|
|
11
|
+
* @param {ManifestNamespace.Inbound} inbounds - The inbounds from the manifest.
|
|
12
|
+
* @param {DescriptorVariant} variant - The descriptor variant object.
|
|
13
|
+
* @returns {FLPConfigPromptOptions} The FLP configuration prompt options.
|
|
14
|
+
*/
|
|
15
|
+
function getAdpFlpConfigPromptOptions(tileSettingsAnswers, inbounds, variant) {
|
|
16
|
+
const { tileHandlingAction, copyFromExisting } = tileSettingsAnswers ?? {};
|
|
17
|
+
// If the user chooses to add a new tile and copy the original, semantic object and action are required
|
|
18
|
+
if (!inbounds || (tileHandlingAction === types_1.tileActions.ADD && copyFromExisting === false)) {
|
|
19
|
+
const hideExistingFlpConfigInfo = variant ? !(!inbounds && (0, adp_tooling_1.flpConfigurationExists)(variant)) : true;
|
|
20
|
+
return {
|
|
21
|
+
existingFlpConfigInfo: { hide: hideExistingFlpConfigInfo },
|
|
22
|
+
action: { executeDuplicateValidation: true },
|
|
23
|
+
inboundId: { hide: true },
|
|
24
|
+
overwrite: { hide: true }
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
// If the user chooses to replace the original tile, are not required and are taken from the existing selected inbound
|
|
28
|
+
if (tileHandlingAction === types_1.tileActions.REPLACE) {
|
|
29
|
+
return {
|
|
30
|
+
existingFlpConfigInfo: { hide: true },
|
|
31
|
+
overwrite: { hide: true },
|
|
32
|
+
semanticObject: { hide: true },
|
|
33
|
+
action: { hide: true, showTooltip: true },
|
|
34
|
+
additionalParameters: { hide: true }
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
// If the user chooses to add a new tile and copy the original, semantic object and action are required
|
|
38
|
+
return {
|
|
39
|
+
existingFlpConfigInfo: { hide: true },
|
|
40
|
+
semanticObject: { showTooltip: true },
|
|
41
|
+
action: { executeDuplicateValidation: true, showTooltip: true },
|
|
42
|
+
overwrite: { hide: true }
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Returns the configuration for writing FLP inbounds based on the provided answers and inbound content.
|
|
47
|
+
*
|
|
48
|
+
* @param {FLPConfigAnswers} flpConfigAnswers - The answers for FLP configuration.
|
|
49
|
+
* @param {TileSettingsAnswers} tileSettingsAnswers - The answers for tile settings.
|
|
50
|
+
* @returns {InternalInboundNavigation | NewInboundNavigation} The configuration for FLP inbounds writer.
|
|
51
|
+
*/
|
|
52
|
+
function getAdpFlpInboundsWriterConfig(flpConfigAnswers, tileSettingsAnswers) {
|
|
53
|
+
const { tileHandlingAction } = tileSettingsAnswers ?? {};
|
|
54
|
+
if (tileHandlingAction === types_1.tileActions.REPLACE) {
|
|
55
|
+
const { semanticObject, action, signature: { parameters } = {} } = flpConfigAnswers.inboundId ?? {};
|
|
56
|
+
const inboundId = !semanticObject || !action ? '' : `${semanticObject}-${action}`;
|
|
57
|
+
return {
|
|
58
|
+
inboundId,
|
|
59
|
+
semanticObject: semanticObject ?? '',
|
|
60
|
+
action: action ?? '',
|
|
61
|
+
title: flpConfigAnswers.title ?? '',
|
|
62
|
+
subTitle: flpConfigAnswers.subTitle ?? '',
|
|
63
|
+
icon: flpConfigAnswers.icon ?? '',
|
|
64
|
+
additionalParameters: parameters ? JSON.stringify(parameters) : ''
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const inboundId = !flpConfigAnswers.semanticObject || !flpConfigAnswers.action
|
|
68
|
+
? ''
|
|
69
|
+
: `${flpConfigAnswers.semanticObject}-${flpConfigAnswers.action}`;
|
|
70
|
+
return {
|
|
71
|
+
inboundId,
|
|
72
|
+
semanticObject: flpConfigAnswers.semanticObject ?? '',
|
|
73
|
+
action: flpConfigAnswers.action ?? '',
|
|
74
|
+
title: flpConfigAnswers.title ?? '',
|
|
75
|
+
subTitle: flpConfigAnswers.subTitle ?? '',
|
|
76
|
+
icon: flpConfigAnswers.icon ?? '',
|
|
77
|
+
additionalParameters: flpConfigAnswers.additionalParameters ?? ''
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=utils.js.map
|
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.3.
|
|
4
|
+
"version": "0.3.29",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -21,12 +21,13 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"i18next": "23.5.1",
|
|
23
23
|
"lodash": "4.17.21",
|
|
24
|
-
"@sap-ux/inquirer-common": "0.7.
|
|
24
|
+
"@sap-ux/inquirer-common": "0.7.14",
|
|
25
25
|
"@sap-ux/btp-utils": "1.1.0",
|
|
26
|
-
"@sap-ux/project-input-validator": "0.6.
|
|
27
|
-
"@sap-ux/fiori-generator-shared": "0.12.
|
|
28
|
-
"@sap-ux/project-access": "1.30.
|
|
29
|
-
"@sap-ux/
|
|
26
|
+
"@sap-ux/project-input-validator": "0.6.4",
|
|
27
|
+
"@sap-ux/fiori-generator-shared": "0.12.9",
|
|
28
|
+
"@sap-ux/project-access": "1.30.3",
|
|
29
|
+
"@sap-ux/axios-extension": "1.22.3",
|
|
30
|
+
"@sap-ux/adp-tooling": "0.14.29"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@sap-devx/yeoman-ui-types": "1.14.4",
|