@sap-ux/cf-deploy-config-inquirer 0.2.21 → 0.2.23

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,4 +1,4 @@
1
- import type { CfDeployConfigPromptOptions, CfDeployConfigQuestions, CfSystemChoice, CfDeployConfigAnswers, CfAppRouterDeployConfigPromptOptions, CfAppRouterDeployConfigQuestions, CfAppRouterDeployConfigAnswers } from './types';
1
+ import type { CfDeployConfigPromptOptions, CfDeployConfigQuestions, CfSystemChoice, CfDeployConfigAnswers, CfAppRouterDeployConfigPromptOptions, CfAppRouterDeployConfigQuestions, CfAppRouterDeployConfigAnswers, CfDeployConfigRouterAnswers, CfDeployConfigRouterQuestions } from './types';
2
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';
@@ -30,5 +30,5 @@ declare function getAppRouterPrompts(promptOptions: CfAppRouterDeployConfigPromp
30
30
  * @returns the prompt answers
31
31
  */
32
32
  declare function prompt(adapter: InquirerAdapter, promptOptions: CfDeployConfigPromptOptions, logger?: Logger): Promise<CfDeployConfigAnswers>;
33
- export { getPrompts, type CfDeployConfigPromptOptions, type CfSystemChoice, promptNames, prompt, appRouterPromptNames, getAppRouterPrompts, type CfAppRouterDeployConfigPromptOptions, RouterModuleType, type CfDeployConfigQuestions, type CfDeployConfigAnswers, type CfAppRouterDeployConfigAnswers, type CfAppRouterDeployConfigQuestions };
33
+ export { getPrompts, type CfDeployConfigPromptOptions, type CfSystemChoice, promptNames, prompt, appRouterPromptNames, getAppRouterPrompts, type CfAppRouterDeployConfigPromptOptions, RouterModuleType, type CfDeployConfigQuestions, type CfDeployConfigAnswers, type CfAppRouterDeployConfigAnswers, type CfAppRouterDeployConfigQuestions, type CfDeployConfigRouterAnswers, type CfDeployConfigRouterQuestions };
34
34
  //# sourceMappingURL=index.d.ts.map
@@ -72,8 +72,8 @@ function getMtaVersionPrompt() {
72
72
  /**
73
73
  * Generates a prompt for selecting the router type.
74
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.
75
+ * This prompt allows users to choose between a standalone | managed | app frontend router for deployment.
76
+ * The prompt is mandatory, with a default selection of the "managed" router type.
77
77
  *
78
78
  * @returns {CfAppRouterDeployConfigQuestions} - The prompt configuration object for selecting the router type.
79
79
  */
@@ -89,6 +89,7 @@ function getRouterTypePrompt() {
89
89
  message: (0, i18n_1.t)('prompts.routerTypeMessage'),
90
90
  choices: [
91
91
  { name: (0, i18n_1.t)('routerType.managedAppRouter'), value: types_1.RouterModuleType.Managed },
92
+ { name: (0, i18n_1.t)('routerType.appFrontAppService'), value: types_1.RouterModuleType.AppFront },
92
93
  { name: (0, i18n_1.t)('routerType.standaloneAppRouter'), value: types_1.RouterModuleType.Standard }
93
94
  ]
94
95
  };
@@ -103,7 +104,7 @@ function getRouterTypePrompt() {
103
104
  */
104
105
  function getConnectivityServicePrompt() {
105
106
  return {
106
- when: (previousAnswers) => previousAnswers.routerType !== types_1.RouterModuleType.Managed,
107
+ when: (previousAnswers) => previousAnswers.routerType === types_1.RouterModuleType.Standard,
107
108
  type: 'confirm',
108
109
  name: types_1.appRouterPromptNames.addConnectivityService,
109
110
  guiOptions: {
@@ -125,7 +126,7 @@ function getConnectivityServicePrompt() {
125
126
  */
126
127
  function getDestinationService() {
127
128
  return {
128
- when: (previousAnswers) => previousAnswers.routerType !== types_1.RouterModuleType.Managed,
129
+ when: (previousAnswers) => previousAnswers.routerType === types_1.RouterModuleType.Standard,
129
130
  type: 'confirm',
130
131
  name: types_1.appRouterPromptNames.addABAPServiceBinding,
131
132
  message: (0, i18n_1.t)('prompts.serviceAdvancedOptionMessage'),
@@ -145,7 +146,7 @@ function getServiceProvider() {
145
146
  const errorHandler = new inquirer_common_1.ErrorHandler();
146
147
  return {
147
148
  when: (previousAnswers) => {
148
- return !!previousAnswers.addABAPServiceBinding && previousAnswers.routerType !== types_1.RouterModuleType.Managed;
149
+ return !!previousAnswers.addABAPServiceBinding && previousAnswers.routerType === types_1.RouterModuleType.Standard;
149
150
  },
150
151
  type: 'list',
151
152
  name: types_1.appRouterPromptNames.abapServiceProvider,
@@ -1,4 +1,4 @@
1
- import type { CfDeployConfigPromptOptions, CfDeployConfigQuestions } from '../types';
1
+ import { type CfDeployConfigPromptOptions, type CfDeployConfigQuestions } from '../types';
2
2
  import type { Logger } from '@sap-ux/logger';
3
3
  /**
4
4
  * Retrieves a list of deployment questions based on the application root and prompt options.
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.getQuestions = getQuestions;
27
37
  const inquirer_common_1 = require("@sap-ux/inquirer-common");
@@ -30,6 +40,7 @@ const types_1 = require("../types");
30
40
  const validators = __importStar(require("./validators"));
31
41
  const btp_utils_1 = require("@sap-ux/btp-utils");
32
42
  const prompt_helpers_1 = require("./prompt-helpers");
43
+ const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
33
44
  /**
34
45
  * Retrieves the prompt configuration for selecting a Cloud Foundry destination name.
35
46
  *
@@ -118,6 +129,37 @@ function getOverwritePrompt() {
118
129
  message: () => (0, i18n_1.t)('prompts.overwriteMessage')
119
130
  };
120
131
  }
132
+ /**
133
+ *
134
+ * @returns A list question object with the available router options, defaulting to `None`.
135
+ */
136
+ function getRouterOptionsPrompt() {
137
+ return {
138
+ type: 'list',
139
+ name: types_1.promptNames.routerType,
140
+ guiOptions: {
141
+ mandatory: true,
142
+ breadcrumb: (0, i18n_1.t)('prompts.generateDeploymentRouterOptionsMessage')
143
+ },
144
+ default: () => types_1.RouterModuleType.None, // Should always be the preferred choice
145
+ message: () => (0, i18n_1.t)('prompts.generateDeploymentRouterOptionsMessage'),
146
+ additionalMessages: (selectedRouter) => {
147
+ let additionalMessage;
148
+ if (selectedRouter && selectedRouter === types_1.RouterModuleType.AppFront) {
149
+ additionalMessage = {
150
+ message: (0, i18n_1.t)('warnings.appFrontendServiceRouterChoice'),
151
+ severity: yeoman_ui_types_1.Severity.warning
152
+ };
153
+ }
154
+ return additionalMessage;
155
+ },
156
+ choices: [
157
+ { name: (0, i18n_1.t)('prompts.routerType.none'), value: types_1.RouterModuleType.None },
158
+ { name: (0, i18n_1.t)('prompts.routerType.managedAppRouter'), value: types_1.RouterModuleType.Managed },
159
+ { name: (0, i18n_1.t)('prompts.routerType.appFrontAppService'), value: types_1.RouterModuleType.AppFront }
160
+ ]
161
+ };
162
+ }
121
163
  /**
122
164
  * Retrieves a list of deployment questions based on the application root and prompt options.
123
165
  *
@@ -129,6 +171,7 @@ async function getQuestions(promptOptions, log) {
129
171
  const destinationOptions = promptOptions[types_1.promptNames.destinationName];
130
172
  const addOverwriteQuestion = promptOptions[types_1.promptNames.overwrite] ?? false;
131
173
  const addManagedAppRouter = promptOptions[types_1.promptNames.addManagedAppRouter] ?? false;
174
+ const showRouterOptions = promptOptions[types_1.promptNames.showRouterOptions] ?? false;
132
175
  const questions = [];
133
176
  // Collect questions into an array
134
177
  questions.push(await getDestinationNamePrompt(destinationOptions));
@@ -140,6 +183,10 @@ async function getQuestions(promptOptions, log) {
140
183
  log?.info((0, i18n_1.t)('info.overwriteDestination'));
141
184
  questions.push(getOverwritePrompt());
142
185
  }
186
+ if (showRouterOptions) {
187
+ log?.info((0, i18n_1.t)('info.routerOptions'));
188
+ questions.push(getRouterOptionsPrompt());
189
+ }
143
190
  return questions;
144
191
  }
145
192
  //# sourceMappingURL=prompts.js.map
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "prompts": {
3
- "destinationNameMessage": "Destination name",
3
+ "destinationNameMessage": "Destination Name",
4
4
  "addApplicationRouterBreadcrumbMessage": "Add to Router",
5
5
  "generateManagedApplicationToRouterMessage": "Add application to managed application router?",
6
+ "generateDeploymentRouterOptionsMessage": "Add Router Module",
6
7
  "directBindingDestinationHint": "Destination name - The app router is configured to use direct service binding",
7
8
  "overwriteMessage": "Editing the deployment configuration will overwrite existing configuration, are you sure you want to continue?",
8
9
  "overwriteHintMessage": "Deployment configuration will abort if you choose no. Click Finish to abort.",
@@ -15,11 +16,17 @@
15
16
  "serviceAdvancedOptionMessage": "Configure advanced options",
16
17
  "abapEnvBindingBreadcrumbMessage": "ABAP Env. Binding",
17
18
  "selectServiceMessage": "ABAP Environment for direct service binding",
18
- "routerTypeMessage": "Add router module"
19
+ "routerTypeMessage": "Add Router Module",
20
+ "routerType": {
21
+ "managedAppRouter": "Add application to managed application router",
22
+ "appFrontAppService": "Add application to application front-end service",
23
+ "none": "None"
24
+ }
19
25
  },
20
26
  "routerType": {
21
27
  "standaloneAppRouter": "Standalone Approuter",
22
- "managedAppRouter": "Managed Approuter"
28
+ "managedAppRouter": "Managed Approuter",
29
+ "appFrontAppService": "Application Front-End Service"
23
30
  },
24
31
  "errors": {
25
32
  "emptyDestinationNameError": "You must provide a destination name in order to continue.",
@@ -33,12 +40,14 @@
33
40
  "errorScpAbapSourceDiscoveryCheckLog": "Check the Application Wizard console output view for details."
34
41
  },
35
42
  "warning": {
36
- "btpDestinationListWarning": "BTP destinations are only retrieved on BAS"
43
+ "btpDestinationListWarning": "BTP destinations are only retrieved on BAS.",
44
+ "appFrontendServiceRouterChoice": "You need to have the Application Front-End service enabled for your subaccount."
37
45
  },
38
46
  "info": {
39
47
  "addManagedAppRouter": "Add managed application router is enabled",
40
48
  "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"
49
+ "routerOptions": "Router options is enabled",
50
+ "addConnectivityService": "Add connectivity service is enabled in CF application router",
51
+ "addABAPServiceBinding": "Abap service binding is enabled in CF application router"
43
52
  }
44
53
  }
package/dist/types.d.ts CHANGED
@@ -9,7 +9,11 @@ export declare enum promptNames {
9
9
  /** The prompt to specify if a managed app router should be added to the deployment. */
10
10
  addManagedAppRouter = "addManagedAppRouter",
11
11
  /** The prompt for confirming destination overwrite. */
12
- overwrite = "overwriteDestinationName"
12
+ overwrite = "overwriteDestinationName",
13
+ /** The prompt for confirming the router type. */
14
+ routerType = "routerType",
15
+ /** The prompt for confirming if the router options should be displayed */
16
+ showRouterOptions = "showRouterOptions"
13
17
  }
14
18
  /**
15
19
  * Enum defining prompt names for Application Router configuration.
@@ -22,7 +26,9 @@ export declare enum appRouterPromptNames {
22
26
  routerType = "routerType",
23
27
  addConnectivityService = "addConnectivityService",
24
28
  addABAPServiceBinding = "addABAPServiceBinding",
25
- abapServiceProvider = "abapServiceProvider"
29
+ abapServiceProvider = "abapServiceProvider",
30
+ /** The prompt for confirming if the router options should be displayed */
31
+ showRouterOptions = "showRouterOptions"
26
32
  }
27
33
  /**
28
34
  * Configuration options for the 'destinationName' prompt used in deployment settings.
@@ -50,27 +56,42 @@ export type DestinationNamePromptOptions = {
50
56
  */
51
57
  useAutocomplete?: boolean;
52
58
  };
59
+ /**
60
+ * Configuration options for the 'destinationName' prompt used in deployment settings.
61
+ */
62
+ export type DestinationRouterPromptOptions = {
63
+ /** Default value */
64
+ defaultValue: string;
65
+ /** Flag to indicate if a hint message should be shown to indicate the app router is configured.*/
66
+ hint?: boolean;
67
+ routerType?: RouterModuleType[];
68
+ };
53
69
  /**
54
70
  * Defines options for boolean-type prompts in CF deployment configuration.
55
71
  */
56
- export type booleanPromptOptions = Partial<Record<promptNames.overwrite | promptNames.addManagedAppRouter | appRouterPromptNames.mtaId | appRouterPromptNames.mtaDescription | appRouterPromptNames.mtaVersion | appRouterPromptNames.routerType | appRouterPromptNames.addABAPServiceBinding | appRouterPromptNames.addConnectivityService, boolean>>;
72
+ export type booleanPromptOptions = Partial<Record<promptNames.overwrite | promptNames.addManagedAppRouter | appRouterPromptNames.mtaId | appRouterPromptNames.mtaDescription | appRouterPromptNames.mtaVersion | appRouterPromptNames.routerType | appRouterPromptNames.addABAPServiceBinding | appRouterPromptNames.addConnectivityService | appRouterPromptNames.showRouterOptions, boolean>>;
57
73
  /**
58
74
  * Defines options for string-type prompts in CF deployment configuration.
59
75
  */
60
- type stringPromptOptions = Partial<Record<promptNames.destinationName, DestinationNamePromptOptions>>;
76
+ type destinationNamePromptOptions = Partial<Record<promptNames.destinationName, DestinationNamePromptOptions>>;
61
77
  /**
62
78
  * Configuration options for CF deployment prompts.
63
79
  */
64
- export type CfDeployConfigPromptOptions = Partial<stringPromptOptions & booleanPromptOptions>;
80
+ export type CfDeployConfigPromptOptions = Partial<destinationNamePromptOptions & booleanPromptOptions>;
65
81
  /**
66
82
  * Configuration options for CF App Router deployment prompts.
67
83
  */
68
- export type CfAppRouterDeployConfigPromptOptions = Partial<stringPromptOptions & booleanPromptOptions> & Record<appRouterPromptNames.mtaPath, string>;
84
+ export type CfAppRouterDeployConfigPromptOptions = Partial<destinationNamePromptOptions & booleanPromptOptions> & Record<appRouterPromptNames.mtaPath, string>;
69
85
  /**
70
86
  * Represents a question in the CF deployment configuration.
71
87
  * Extends `YUIQuestion` with optional autocomplete functionality.
72
88
  */
73
89
  export type CfDeployConfigQuestions = YUIQuestion<CfDeployConfigAnswers> & Partial<Pick<AutocompleteQuestionOptions, 'source'>>;
90
+ /**
91
+ * Represents a question in the CF deployment configuration.
92
+ * Extends `YUIQuestion` with optional autocomplete functionality.
93
+ */
94
+ export type CfDeployConfigRouterQuestions = YUIQuestion<CfDeployConfigRouterAnswers> & Partial<Pick<AutocompleteQuestionOptions, 'source'>>;
74
95
  export type CfAppRouterDeployConfigQuestions = YUIQuestion<CfAppRouterDeployConfigAnswers>;
75
96
  /**
76
97
  * User responses for CF deployment configuration.
@@ -83,12 +104,20 @@ export interface CfDeployConfigAnswers {
83
104
  /** Indicates whether the user opted to overwrite the destination. */
84
105
  overwrite?: boolean;
85
106
  }
107
+ /**
108
+ * User responses for CF deployment configuration with Router type.
109
+ */
110
+ export interface CfDeployConfigRouterAnswers extends Omit<CfDeployConfigAnswers, 'addManagedAppRouter'> {
111
+ routerType?: RouterModuleType;
112
+ }
86
113
  /**
87
114
  * Defines the types of router modules for the Application Router configuration.
88
115
  */
89
116
  export declare const RouterModuleType: {
90
117
  readonly Standard: "standard";
91
118
  readonly Managed: "managed";
119
+ readonly AppFront: "appFront";
120
+ readonly None: "none";
92
121
  };
93
122
  export type RouterModuleType = (typeof RouterModuleType)[keyof typeof RouterModuleType];
94
123
  /**
package/dist/types.js CHANGED
@@ -12,6 +12,10 @@ var promptNames;
12
12
  promptNames["addManagedAppRouter"] = "addManagedAppRouter";
13
13
  /** The prompt for confirming destination overwrite. */
14
14
  promptNames["overwrite"] = "overwriteDestinationName";
15
+ /** The prompt for confirming the router type. */
16
+ promptNames["routerType"] = "routerType";
17
+ /** The prompt for confirming if the router options should be displayed */
18
+ promptNames["showRouterOptions"] = "showRouterOptions";
15
19
  })(promptNames || (exports.promptNames = promptNames = {}));
16
20
  /**
17
21
  * Enum defining prompt names for Application Router configuration.
@@ -34,12 +38,16 @@ var appRouterPromptNames;
34
38
  appRouterPromptNames["addABAPServiceBinding"] = "addABAPServiceBinding";
35
39
  /* Prompt for selecting the ABAP environments */
36
40
  appRouterPromptNames["abapServiceProvider"] = "abapServiceProvider";
41
+ /** The prompt for confirming if the router options should be displayed */
42
+ appRouterPromptNames["showRouterOptions"] = "showRouterOptions";
37
43
  })(appRouterPromptNames || (exports.appRouterPromptNames = appRouterPromptNames = {}));
38
44
  /**
39
45
  * Defines the types of router modules for the Application Router configuration.
40
46
  */
41
47
  exports.RouterModuleType = {
42
48
  Standard: 'standard',
43
- Managed: 'managed'
49
+ Managed: 'managed',
50
+ AppFront: 'appFront',
51
+ None: 'none'
44
52
  };
45
53
  //# 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.2.21",
4
+ "version": "0.2.23",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "i18next": "23.5.1",
23
23
  "inquirer-autocomplete-prompt": "2.0.1",
24
- "@sap-ux/inquirer-common": "0.6.31",
24
+ "@sap-ux/inquirer-common": "0.6.32",
25
25
  "@sap-ux/btp-utils": "1.0.2",
26
26
  "@sap-ux/logger": "0.6.0"
27
27
  },