@sap-ux/cf-deploy-config-inquirer 0.0.11 → 0.1.0

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 CHANGED
@@ -1,5 +1,5 @@
1
- import type { CfDeployConfigPromptOptions, CfDeployConfigQuestions, CfSystemChoice, CfDeployConfigAnswers } from './types';
2
- import { promptNames } from './types';
1
+ import type { CfDeployConfigPromptOptions, CfDeployConfigQuestions, CfSystemChoice, CfDeployConfigAnswers, CfAppRouterDeployConfigPromptOptions, CfAppRouterDeployConfigQuestions } from './types';
2
+ import { promptNames, appRouterPromptNames, RouterModuleType } from './types';
3
3
  import type { InquirerAdapter } from '@sap-ux/inquirer-common';
4
4
  import type { Logger } from '@sap-ux/logger';
5
5
  /**
@@ -12,6 +12,15 @@ import type { Logger } from '@sap-ux/logger';
12
12
  * @returns {Promise<CfDeployConfigQuestions[]>} A promise that resolves to an array of questions for cf target prompting.
13
13
  */
14
14
  declare function getPrompts(promptOptions: CfDeployConfigPromptOptions, logger?: Logger): Promise<CfDeployConfigQuestions[]>;
15
+ /**
16
+ * Retrieves the application router configuration prompts.
17
+ *
18
+ * @param {CfDeployConfigPromptOptions} promptOptions - The options for configuring application router prompts.
19
+ * @param {Logger} [logger] - An optional logger instance.
20
+ * @returns {Promise<CfAppRouterDeployConfigQuestions[]>} A promise that resolves to an array of
21
+ * application router deployment configuration questions.
22
+ */
23
+ declare function getAppRouterPrompts(promptOptions: CfAppRouterDeployConfigPromptOptions, logger?: Logger): Promise<CfAppRouterDeployConfigQuestions[]>;
15
24
  /**
16
25
  * Prompt for cf inquirer inputs.
17
26
  *
@@ -21,5 +30,5 @@ declare function getPrompts(promptOptions: CfDeployConfigPromptOptions, logger?:
21
30
  * @returns the prompt answers
22
31
  */
23
32
  declare function prompt(adapter: InquirerAdapter, promptOptions: CfDeployConfigPromptOptions, logger?: Logger): Promise<CfDeployConfigAnswers>;
24
- export { getPrompts, CfDeployConfigPromptOptions, CfSystemChoice, promptNames, prompt };
33
+ export { getPrompts, type CfDeployConfigPromptOptions, type CfSystemChoice, promptNames, prompt, appRouterPromptNames, getAppRouterPrompts, type CfAppRouterDeployConfigPromptOptions, RouterModuleType };
25
34
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -3,12 +3,15 @@ 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.RouterModuleType = exports.appRouterPromptNames = exports.promptNames = void 0;
7
7
  exports.getPrompts = getPrompts;
8
8
  exports.prompt = prompt;
9
+ exports.getAppRouterPrompts = getAppRouterPrompts;
9
10
  const prompts_1 = require("./prompts");
10
11
  const types_1 = require("./types");
11
12
  Object.defineProperty(exports, "promptNames", { enumerable: true, get: function () { return types_1.promptNames; } });
13
+ Object.defineProperty(exports, "appRouterPromptNames", { enumerable: true, get: function () { return types_1.appRouterPromptNames; } });
14
+ Object.defineProperty(exports, "RouterModuleType", { enumerable: true, get: function () { return types_1.RouterModuleType; } });
12
15
  const i18n_1 = require("./i18n");
13
16
  const inquirer_autocomplete_prompt_1 = __importDefault(require("inquirer-autocomplete-prompt"));
14
17
  const logger_helper_1 = __importDefault(require("./logger-helper"));
@@ -28,6 +31,21 @@ async function getPrompts(promptOptions, logger) {
28
31
  await (0, i18n_1.initI18nCfDeployConfigInquirer)();
29
32
  return (0, prompts_1.getQuestions)(promptOptions, logger_helper_1.default.logger);
30
33
  }
34
+ /**
35
+ * Retrieves the application router configuration prompts.
36
+ *
37
+ * @param {CfDeployConfigPromptOptions} promptOptions - The options for configuring application router prompts.
38
+ * @param {Logger} [logger] - An optional logger instance.
39
+ * @returns {Promise<CfAppRouterDeployConfigQuestions[]>} A promise that resolves to an array of
40
+ * application router deployment configuration questions.
41
+ */
42
+ async function getAppRouterPrompts(promptOptions, logger) {
43
+ if (logger) {
44
+ logger_helper_1.default.logger = logger;
45
+ }
46
+ await (0, i18n_1.initI18nCfDeployConfigInquirer)();
47
+ return (0, prompts_1.getAppRouterQuestions)(promptOptions, logger_helper_1.default.logger);
48
+ }
31
49
  /**
32
50
  * Prompt for cf inquirer inputs.
33
51
  *
@@ -0,0 +1,11 @@
1
+ import type { CfAppRouterDeployConfigQuestions, CfAppRouterDeployConfigPromptOptions } from '../types';
2
+ import type { Logger } from '@sap-ux/logger';
3
+ /**
4
+ * Retrieves a list of deployment questions based on the application root and prompt options.
5
+ *
6
+ * @param {CfAppRouterDeployConfigPromptOptions} promptOptions - The configuration options for prompting during cf target deployment.
7
+ * @param {Logger} [log] - The logger instance to use for logging.
8
+ * @returns {CfAppRouterDeployConfigQuestions[]} Returns an array of questions related to cf deployment configuration.
9
+ */
10
+ export declare function getAppRouterQuestions(promptOptions: CfAppRouterDeployConfigPromptOptions, log?: Logger): Promise<CfAppRouterDeployConfigQuestions[]>;
11
+ //# sourceMappingURL=app-router-prompts.d.ts.map
@@ -0,0 +1,206 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAppRouterQuestions = getAppRouterQuestions;
4
+ const i18n_1 = require("../i18n");
5
+ const types_1 = require("../types");
6
+ const validators_1 = require("./validators");
7
+ const inquirer_common_1 = require("@sap-ux/inquirer-common");
8
+ /**
9
+ * Generates a prompt for selecting the MTA path.
10
+ *
11
+ * @param mtaPath Mta Path string which allows the user to browse and select a folder for the MTA path
12
+ * @returns {CfAppRouterDeployConfigQuestions} - The prompt configuration object for selecting the MTA path.
13
+ */
14
+ function getMtaPathPrompt(mtaPath) {
15
+ return {
16
+ type: 'input',
17
+ guiOptions: {
18
+ type: 'folder-browser',
19
+ breadcrumb: (0, i18n_1.t)('prompts.mtaPathBreadcrumbMessage')
20
+ },
21
+ name: types_1.appRouterPromptNames.mtaPath,
22
+ message: (0, i18n_1.t)('prompts.mtaPathMessage'),
23
+ default: () => mtaPath,
24
+ validate: (input) => (0, validators_1.validateMtaPath)(input)
25
+ };
26
+ }
27
+ /**
28
+ * Generates a prompt for entering the MTA ID.
29
+ *
30
+ * @returns {CfAppRouterDeployConfigQuestions} - The prompt configuration object for entering the MTA ID.
31
+ */
32
+ function getMtaIdPrompt() {
33
+ return {
34
+ type: 'input',
35
+ guiOptions: {
36
+ mandatory: true,
37
+ breadcrumb: true
38
+ },
39
+ name: types_1.appRouterPromptNames.mtaId,
40
+ message: (0, i18n_1.t)('prompts.mtaIdMessage'),
41
+ validate: (input, previousAnswers) => (0, validators_1.validateMtaId)(input, previousAnswers),
42
+ filter: (input) => input.replace(/\./g, '-')
43
+ };
44
+ }
45
+ /**
46
+ * Generates a prompt for entering the MTA description.
47
+ *
48
+ * @returns {CfAppRouterDeployConfigQuestions} - The prompt configuration object for entering the MTA description.
49
+ */
50
+ function getMtaDescriptionPrompt() {
51
+ return {
52
+ type: 'input',
53
+ name: types_1.appRouterPromptNames.mtaDescription,
54
+ guiOptions: {
55
+ breadcrumb: true
56
+ },
57
+ message: (0, i18n_1.t)('prompts.mtaDescriptionMessage'),
58
+ filter: (input) => input?.trim() ?? 'Fiori elements app'
59
+ };
60
+ }
61
+ /**
62
+ * Generates a prompt for entering the MTA version.
63
+ *
64
+ * @returns {CfAppRouterDeployConfigQuestions} - The prompt configuration object for entering the MTA version.
65
+ */
66
+ function getMtaVersionPrompt() {
67
+ return {
68
+ default: '0.0.1',
69
+ name: types_1.appRouterPromptNames.mtaVersion
70
+ };
71
+ }
72
+ /**
73
+ * Generates a prompt for selecting the router type.
74
+ *
75
+ * This prompt allows users to choose between a standalone app router or a managed app router for deployment.
76
+ * The prompt is mandatory, with a default selection of the "standard" router type.
77
+ *
78
+ * @returns {CfAppRouterDeployConfigQuestions} - The prompt configuration object for selecting the router type.
79
+ */
80
+ function getRouterTypePrompt() {
81
+ return {
82
+ type: 'list',
83
+ name: types_1.appRouterPromptNames.routerType,
84
+ guiOptions: {
85
+ mandatory: true,
86
+ breadcrumb: true
87
+ },
88
+ default: () => types_1.RouterModuleType.Standard,
89
+ message: (0, i18n_1.t)('prompts.routerTypeMessage'),
90
+ choices: [
91
+ { name: (0, i18n_1.t)('routerType.standaloneAppRouter'), value: types_1.RouterModuleType.Standard },
92
+ { name: (0, i18n_1.t)('routerType.managedAppRouter'), value: types_1.RouterModuleType.Managed }
93
+ ]
94
+ };
95
+ }
96
+ /**
97
+ * Generates a prompt for adding a connectivity service.
98
+ *
99
+ * This prompt is shown if the user selects a standalone app router. It asks if the user wants to add a connectivity service,
100
+ * with a default answer of 'false'.
101
+ *
102
+ * @returns {CfAppRouterDeployConfigQuestions} - The prompt configuration object for adding a connectivity service.
103
+ */
104
+ function getConnectivityServicePrompt() {
105
+ return {
106
+ when: (previousAnswers) => previousAnswers.routerType !== types_1.RouterModuleType.Managed,
107
+ type: 'confirm',
108
+ name: types_1.appRouterPromptNames.addConnectivityService,
109
+ guiOptions: {
110
+ breadcrumb: (0, i18n_1.t)('prompts.addConnectivityServiceBreadcrumbMessage')
111
+ },
112
+ message: (0, i18n_1.t)('prompts.addConnectivityMessage'),
113
+ default: () => {
114
+ return false;
115
+ }
116
+ };
117
+ }
118
+ /**
119
+ * Generates a prompt for adding abap service binding
120
+ *
121
+ * This prompt is shown if the user selects a standalone app router. It asks if the user wants to add a destination service,
122
+ * with a default answer of 'false'.
123
+ *
124
+ * @returns {CfAppRouterDeployConfigQuestions} - The prompt configuration object for adding a destination service.
125
+ */
126
+ function getDestinationService() {
127
+ return {
128
+ when: (previousAnswers) => previousAnswers.routerType !== types_1.RouterModuleType.Managed,
129
+ type: 'confirm',
130
+ name: types_1.appRouterPromptNames.addABAPServiceBinding,
131
+ message: (0, i18n_1.t)('prompts.serviceAdvancedOptionMessage'),
132
+ default: () => {
133
+ return false;
134
+ }
135
+ };
136
+ }
137
+ /**
138
+ * Generates a prompt for selecting a service provider from available services.
139
+ *
140
+ * This prompt will be shown if the user chooses to add a destination service and the router type standalone.
141
+ *
142
+ * @returns {CfAppRouterDeployConfigQuestions} - The prompt configuration object for selecting for selecting an ABAP environment service.
143
+ */
144
+ function getServiceProvider() {
145
+ const errorHandler = new inquirer_common_1.ErrorHandler();
146
+ return {
147
+ when: (previousAnswers) => {
148
+ return !!previousAnswers.addABAPServiceBinding && previousAnswers.routerType !== types_1.RouterModuleType.Managed;
149
+ },
150
+ type: 'list',
151
+ name: types_1.appRouterPromptNames.abapServiceProvider,
152
+ guiOptions: {
153
+ breadcrumb: (0, i18n_1.t)('prompts.abapEnvBindingBreadcrumbMessage')
154
+ },
155
+ choices: () => (0, inquirer_common_1.getCFAbapInstanceChoices)(errorHandler),
156
+ message: (0, i18n_1.t)('prompts.selectServiceMessage'),
157
+ default: () => (0, i18n_1.t)('errors.abapEnvsUnavailable'),
158
+ validate: (choice) => (0, validators_1.validateAbapService)(choice, errorHandler)
159
+ };
160
+ }
161
+ /**
162
+ * Retrieves a list of deployment questions based on the application root and prompt options.
163
+ *
164
+ * @param {CfAppRouterDeployConfigPromptOptions} promptOptions - The configuration options for prompting during cf target deployment.
165
+ * @param {Logger} [log] - The logger instance to use for logging.
166
+ * @returns {CfAppRouterDeployConfigQuestions[]} Returns an array of questions related to cf deployment configuration.
167
+ */
168
+ async function getAppRouterQuestions(promptOptions, log) {
169
+ const mtaPath = promptOptions[types_1.appRouterPromptNames.mtaPath];
170
+ // add mta path prompt to question array
171
+ const questions = [];
172
+ questions.push(getMtaPathPrompt(mtaPath));
173
+ // Mapping of options
174
+ const questionMapping = [
175
+ { key: types_1.appRouterPromptNames.mtaId, getQuestion: getMtaIdPrompt },
176
+ { key: types_1.appRouterPromptNames.mtaDescription, getQuestion: getMtaDescriptionPrompt },
177
+ { key: types_1.appRouterPromptNames.mtaVersion, getQuestion: getMtaVersionPrompt },
178
+ { key: types_1.appRouterPromptNames.routerType, getQuestion: getRouterTypePrompt },
179
+ {
180
+ key: types_1.appRouterPromptNames.addConnectivityService,
181
+ getQuestion: getConnectivityServicePrompt,
182
+ logMessage: (0, i18n_1.t)('info.addConnectivityService')
183
+ },
184
+ {
185
+ key: types_1.appRouterPromptNames.addABAPServiceBinding,
186
+ getQuestion: getDestinationService,
187
+ logMessage: (0, i18n_1.t)('info.addABAPServiceBinding')
188
+ }
189
+ ];
190
+ // Iterate over the mapping to add questions
191
+ for (const { key, logMessage, getQuestion } of questionMapping) {
192
+ const shouldAddQuestion = promptOptions[key] ?? false;
193
+ if (shouldAddQuestion) {
194
+ if (logMessage) {
195
+ log?.info((0, i18n_1.t)(logMessage));
196
+ }
197
+ questions.push(getQuestion());
198
+ }
199
+ }
200
+ // Add prompts for selecting abap environment if addABAPServiceBinding is true
201
+ if (promptOptions[types_1.appRouterPromptNames.addABAPServiceBinding]) {
202
+ questions.push(getServiceProvider());
203
+ }
204
+ return questions;
205
+ }
206
+ //# sourceMappingURL=app-router-prompts.js.map
@@ -1,2 +1,3 @@
1
1
  export * from './prompts';
2
+ export * from './app-router-prompts';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./prompts"), exports);
18
+ __exportStar(require("./app-router-prompts"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,5 @@
1
- import type { CfSystemChoice } from '../types';
1
+ import type { CfSystemChoice, CfAppRouterDeployConfigAnswers } from '../types';
2
+ import type { ErrorHandler } from '@sap-ux/inquirer-common';
2
3
  /**
3
4
  * Validates the destination name or input string. If `allowEmptyChoice` is true,
4
5
  * the validation will pass immediately. Otherwise, the input will be validated
@@ -9,4 +10,32 @@ import type { CfSystemChoice } from '../types';
9
10
  * @returns {boolean|string} `true` if the input is valid or empty choices are allowed, otherwise an error message.
10
11
  */
11
12
  export declare function validateDestinationQuestion(input: string | CfSystemChoice, allowEmptyChoice?: boolean): boolean | string;
13
+ /**
14
+ * Validates the provided MTA path.
15
+ *
16
+ * @param {string} input - The input string representing the MTA path to validate.
17
+ * @returns {boolean|string} - Returns `true` if the path is valid, or an error message if the path is invalid or does not exist.
18
+ */
19
+ export declare function validateMtaPath(input: string): boolean | string;
20
+ /**
21
+ * Validates the provided MTA ID.
22
+ *
23
+ * This function performs the following checks:
24
+ * - Ensures the input is a non-empty string.
25
+ * - Validates the input against a regex pattern.
26
+ * - Checks if the MTA ID already exists in the specified path.
27
+ *
28
+ * @param {string} input - The MTA ID to validate.
29
+ * @param {CfAppRouterDeployConfigAnswers} previousAnswers - The previous answers, containing the MTA path.
30
+ * @returns {boolean|string} - Returns true if the MTA ID is valid, or an error message if validation fails.
31
+ */
32
+ export declare function validateMtaId(input: string, previousAnswers: CfAppRouterDeployConfigAnswers): boolean | string;
33
+ /**
34
+ * Validates the ABAP service choice and provides error handling.
35
+ *
36
+ * @param {string} choice - The selected choice for the ABAP service.
37
+ * @param {ErrorHandler} errorHandler - An instance of an error handler.
38
+ * @returns {string | boolean} - Returns `true` if the choice is valid.
39
+ */
40
+ export declare function validateAbapService(choice: string, errorHandler: ErrorHandler): string | boolean;
12
41
  //# sourceMappingURL=validators.d.ts.map
@@ -1,7 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateDestinationQuestion = validateDestinationQuestion;
4
+ exports.validateMtaPath = validateMtaPath;
5
+ exports.validateMtaId = validateMtaId;
6
+ exports.validateAbapService = validateAbapService;
4
7
  const i18n_1 = require("../i18n");
8
+ const fs_1 = require("fs");
9
+ const path_1 = require("path");
5
10
  /**
6
11
  *
7
12
  * @param input The input string to check for emptiness.
@@ -47,4 +52,58 @@ function validateDestinationQuestion(input, allowEmptyChoice = false) {
47
52
  }
48
53
  return typeof input === 'string' ? validateInput(input) : true;
49
54
  }
55
+ /**
56
+ * Validates the provided MTA path.
57
+ *
58
+ * @param {string} input - The input string representing the MTA path to validate.
59
+ * @returns {boolean|string} - Returns `true` if the path is valid, or an error message if the path is invalid or does not exist.
60
+ */
61
+ function validateMtaPath(input) {
62
+ const filePath = input?.trim();
63
+ return (filePath && (0, fs_1.existsSync)(filePath)) || (0, i18n_1.t)('errors.folderDoesNotExistError', { filePath: filePath });
64
+ }
65
+ /**
66
+ * Validates the provided MTA ID.
67
+ *
68
+ * This function performs the following checks:
69
+ * - Ensures the input is a non-empty string.
70
+ * - Validates the input against a regex pattern.
71
+ * - Checks if the MTA ID already exists in the specified path.
72
+ *
73
+ * @param {string} input - The MTA ID to validate.
74
+ * @param {CfAppRouterDeployConfigAnswers} previousAnswers - The previous answers, containing the MTA path.
75
+ * @returns {boolean|string} - Returns true if the MTA ID is valid, or an error message if validation fails.
76
+ */
77
+ function validateMtaId(input, previousAnswers) {
78
+ if (typeof input !== 'string' || !input.trim()) {
79
+ return (0, i18n_1.t)('errors.noMtaIdError');
80
+ }
81
+ if (input.length > 100) {
82
+ return (0, i18n_1.t)('errors.invalidMtaIdError');
83
+ }
84
+ const idPattern = /^[a-zA-Z_][a-zA-Z0-9_-]{0,98}[a-zA-Z0-9]$/;
85
+ if (!idPattern.exec(input)) {
86
+ return (0, i18n_1.t)('errors.invalidMtaIdError');
87
+ }
88
+ if ((0, fs_1.existsSync)((0, path_1.join)(previousAnswers.mtaPath, input.trim()))) {
89
+ return (0, i18n_1.t)('errors.mtaIdAlreadyExistError', { mtaPath: previousAnswers.mtaPath });
90
+ }
91
+ // All checks passed
92
+ return true;
93
+ }
94
+ /**
95
+ * Validates the ABAP service choice and provides error handling.
96
+ *
97
+ * @param {string} choice - The selected choice for the ABAP service.
98
+ * @param {ErrorHandler} errorHandler - An instance of an error handler.
99
+ * @returns {string | boolean} - Returns `true` if the choice is valid.
100
+ */
101
+ function validateAbapService(choice, errorHandler) {
102
+ if (!choice) {
103
+ const userMsg = errorHandler.getErrorMsg('', true);
104
+ const checkConsoleMsg = (0, i18n_1.t)('errors.errorScpAbapSourceDiscoveryCheckLog');
105
+ return userMsg ? `${userMsg} ${checkConsoleMsg}` : false;
106
+ }
107
+ return true;
108
+ }
50
109
  //# sourceMappingURL=validators.js.map
@@ -5,18 +5,40 @@
5
5
  "generateManagedApplicationToRouterMessage": "Add application to managed application router?",
6
6
  "directBindingDestinationHint": "Destination name - The app router is configured to use direct service binding",
7
7
  "overwriteMessage": "Editing the deployment configuration will overwrite existing configuration, are you sure you want to continue?",
8
- "overwriteHintMessage": "Deployment config will abort if you choose no. Click Finish to abort."
8
+ "overwriteHintMessage": "Deployment configuration will abort if you choose no. Click Finish to abort.",
9
+ "mtaPathBreadcrumbMessage": "Application Router Path",
10
+ "mtaPathMessage": "Application router project path",
11
+ "mtaIdMessage": "MTA ID",
12
+ "mtaDescriptionMessage": "MTA description",
13
+ "addConnectivityServiceBreadcrumbMessage": "Add Connectivity Service",
14
+ "addConnectivityMessage": "Add connectivity service (required for connections to on-prem systems)?",
15
+ "serviceAdvancedOptionMessage": "Configure advanced options",
16
+ "abapEnvBindingBreadcrumbMessage": "ABAP Env. Binding",
17
+ "selectServiceMessage": "ABAP Environment for direct service binding",
18
+ "routerTypeMessage": "Add router module"
19
+ },
20
+ "routerType": {
21
+ "standaloneAppRouter": "Standalone Approuter",
22
+ "managedAppRouter": "Managed Approuter"
9
23
  },
10
24
  "errors": {
11
25
  "emptyDestinationNameError": "You must provide a destination name in order to continue.",
12
26
  "destinationNameError": "The destination name must only contain letters, digits, dashes and underscores.",
13
- "destinationNameLengthError": "Destination name cannot contain more than 200 characters"
27
+ "destinationNameLengthError": "Destination name cannot contain more than 200 characters",
28
+ "folderDoesNotExistError": "Folder path does not exist: {{filePath}}",
29
+ "noMtaIdError": "MTA ID cannot be empty",
30
+ "invalidMtaIdError": "The ID can only contain letters, numbers, dashes, periods and underscores (but no spaces).",
31
+ "mtaIdAlreadyExistError": "A folder with same name already exist at {{mtaPath}}",
32
+ "abapEnvsUnavailable": "ABAP environments unavailable",
33
+ "errorScpAbapSourceDiscoveryCheckLog": "Check the Application Wizard console output view for details."
14
34
  },
15
35
  "warning": {
16
36
  "btpDestinationListWarning": "BTP destinations are only retrieved on BAS"
17
37
  },
18
38
  "info": {
19
39
  "addManagedAppRouter": "Add managed application router is enabled",
20
- "overwriteDestination": "Overwriting destination is enabled"
40
+ "overwriteDestination": "Overwriting destination is enabled",
41
+ "addConnectivityService": "Add connectivity service is enabled in cf application router",
42
+ "addABAPServiceBinding": "Abap service binding is enabled in cf application router"
21
43
  }
22
44
  }
package/dist/types.d.ts CHANGED
@@ -11,6 +11,19 @@ export declare enum promptNames {
11
11
  /** The prompt for confirming destination overwrite. */
12
12
  overwrite = "overwriteDestinationName"
13
13
  }
14
+ /**
15
+ * Enum defining prompt names for Application Router configuration.
16
+ */
17
+ export declare enum appRouterPromptNames {
18
+ mtaPath = "mtaPath",
19
+ mtaId = "mtaId",
20
+ mtaDescription = "mtaDescription",
21
+ mtaVersion = "mtaVersion",
22
+ routerType = "routerType",
23
+ addConnectivityService = "addConnectivityService",
24
+ addABAPServiceBinding = "addABAPServiceBinding",
25
+ abapServiceProvider = "abapServiceProvider"
26
+ }
14
27
  /**
15
28
  * Configuration options for the 'destinationName' prompt used in deployment settings.
16
29
  */
@@ -40,20 +53,25 @@ export type DestinationNamePromptOptions = {
40
53
  /**
41
54
  * Defines options for boolean-type prompts in CF deployment configuration.
42
55
  */
43
- type booleanValuePromptOptions = Record<promptNames.overwrite, boolean> & Record<promptNames.addManagedAppRouter, boolean>;
56
+ export type booleanPromptOptions = Partial<Record<promptNames.overwrite | promptNames.addManagedAppRouter | appRouterPromptNames.mtaId | appRouterPromptNames.mtaDescription | appRouterPromptNames.mtaVersion | appRouterPromptNames.routerType | appRouterPromptNames.addABAPServiceBinding | appRouterPromptNames.addConnectivityService, boolean>>;
44
57
  /**
45
58
  * Defines options for string-type prompts in CF deployment configuration.
46
59
  */
47
- type stringValuePromptOptions = Record<promptNames.destinationName, DestinationNamePromptOptions>;
60
+ type stringPromptOptions = Partial<Record<promptNames.destinationName, DestinationNamePromptOptions>>;
48
61
  /**
49
62
  * Configuration options for CF deployment prompts.
50
63
  */
51
- export type CfDeployConfigPromptOptions = Partial<stringValuePromptOptions & booleanValuePromptOptions>;
64
+ export type CfDeployConfigPromptOptions = Partial<stringPromptOptions & booleanPromptOptions>;
65
+ /**
66
+ * Configuration options for CF App Router deployment prompts.
67
+ */
68
+ export type CfAppRouterDeployConfigPromptOptions = Partial<stringPromptOptions & booleanPromptOptions> & Record<appRouterPromptNames.mtaPath, string>;
52
69
  /**
53
70
  * Represents a question in the CF deployment configuration.
54
71
  * Extends `YUIQuestion` with optional autocomplete functionality.
55
72
  */
56
73
  export type CfDeployConfigQuestions = YUIQuestion<CfDeployConfigAnswers> & Partial<Pick<AutocompleteQuestionOptions, 'source'>>;
74
+ export type CfAppRouterDeployConfigQuestions = YUIQuestion<CfAppRouterDeployConfigAnswers>;
57
75
  /**
58
76
  * User responses for CF deployment configuration.
59
77
  */
@@ -62,8 +80,36 @@ export interface CfDeployConfigAnswers {
62
80
  destinationName?: string;
63
81
  /** Indicates whether the user opted to include a managed application router. */
64
82
  addManagedRouter?: boolean;
83
+ /** Indicates whether the user opted to overwrite the destination. */
65
84
  overwrite?: boolean;
66
85
  }
86
+ /**
87
+ * Defines the types of router modules for the Application Router configuration.
88
+ */
89
+ export declare const RouterModuleType: {
90
+ readonly Standard: "standard";
91
+ readonly Managed: "managed";
92
+ };
93
+ export type RouterModuleType = (typeof RouterModuleType)[keyof typeof RouterModuleType];
94
+ /**
95
+ * Interface representing the configuration for MTA.
96
+ * Includes properties for identifying and describing the MTA.
97
+ */
98
+ export interface MtaConfig {
99
+ mtaId: string;
100
+ mtaPath: string;
101
+ mtaDescription?: string;
102
+ mtaVersion?: string;
103
+ }
104
+ export interface CfAppRouterDeployConfigAnswers extends MtaConfig {
105
+ routerType: RouterModuleType;
106
+ addConnectivityService?: boolean;
107
+ addABAPServiceBinding?: boolean;
108
+ abapServiceProvider?: {
109
+ label?: string;
110
+ service?: string;
111
+ };
112
+ }
67
113
  /**
68
114
  * Interface for selectable system choices within prompts.
69
115
  */
@@ -72,7 +118,7 @@ export interface CfSystemChoice {
72
118
  name: string;
73
119
  /** Value associated with the system choice. */
74
120
  value: string;
75
- /** Flag indicating if the system choice is an scp destination. */
121
+ /** Flag indicating if the system choice is an SCP destination. */
76
122
  scp: boolean;
77
123
  /** URL associated with the system choice. */
78
124
  url: string;
package/dist/types.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.promptNames = void 0;
3
+ exports.RouterModuleType = exports.appRouterPromptNames = exports.promptNames = void 0;
4
4
  /**
5
5
  * Enum defining prompt names for Cloud Foundry (CF) deployment configuration.
6
6
  */
@@ -13,4 +13,33 @@ var promptNames;
13
13
  /** The prompt for confirming destination overwrite. */
14
14
  promptNames["overwrite"] = "overwriteDestinationName";
15
15
  })(promptNames || (exports.promptNames = promptNames = {}));
16
+ /**
17
+ * Enum defining prompt names for Application Router configuration.
18
+ */
19
+ var appRouterPromptNames;
20
+ (function (appRouterPromptNames) {
21
+ /* The prompt to specify the MTA path to the MTA folder. */
22
+ appRouterPromptNames["mtaPath"] = "mtaPath";
23
+ /* The prompt to specify the MTA ID. */
24
+ appRouterPromptNames["mtaId"] = "mtaId";
25
+ /* The prompt to specify the MTA description. */
26
+ appRouterPromptNames["mtaDescription"] = "mtaDescription";
27
+ /* The prompt to specify the MTA version. */
28
+ appRouterPromptNames["mtaVersion"] = "mtaVersion";
29
+ /* Prompt for selecting the type of Application Router (standard or managed) */
30
+ appRouterPromptNames["routerType"] = "routerType";
31
+ /* Prompt for selecting the Connectivity service */
32
+ appRouterPromptNames["addConnectivityService"] = "addConnectivityService";
33
+ /* Prompt for selecting abap service binding*/
34
+ appRouterPromptNames["addABAPServiceBinding"] = "addABAPServiceBinding";
35
+ /* Prompt for selecting the ABAP environments */
36
+ appRouterPromptNames["abapServiceProvider"] = "abapServiceProvider";
37
+ })(appRouterPromptNames || (exports.appRouterPromptNames = appRouterPromptNames = {}));
38
+ /**
39
+ * Defines the types of router modules for the Application Router configuration.
40
+ */
41
+ exports.RouterModuleType = {
42
+ Standard: 'standard',
43
+ Managed: 'managed'
44
+ };
16
45
  //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/cf-deploy-config-inquirer",
3
3
  "description": "Prompts module that can provide prompts for cf deployment config writer",
4
- "version": "0.0.11",
4
+ "version": "0.1.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",