@sap-ux/generator-adp 0.4.13 → 0.5.1

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.
@@ -47,6 +47,10 @@ export default class extends Generator {
47
47
  * Instance of the configuration prompter class.
48
48
  */
49
49
  private prompter;
50
+ /**
51
+ * Instance of the CF services prompter class.
52
+ */
53
+ private cfPrompter;
50
54
  /**
51
55
  * JSON object representing the complete adaptation project configuration,
52
56
  * passed as a CLI argument.
@@ -68,6 +72,38 @@ export default class extends Generator {
68
72
  * Indicates if the current layer is based on a customer base.
69
73
  */
70
74
  private isCustomerBase;
75
+ /**
76
+ * Target environment.
77
+ */
78
+ private targetEnv;
79
+ /**
80
+ * Indicates if the current environment is a CF environment.
81
+ */
82
+ private isCfEnv;
83
+ /**
84
+ * Indicates if the user is logged in to CF.
85
+ */
86
+ private isCfLoggedIn;
87
+ /**
88
+ * CF config.
89
+ */
90
+ private cfConfig;
91
+ /**
92
+ * Indicates if the current project is an MTA project.
93
+ */
94
+ private readonly isMtaYamlFound;
95
+ /**
96
+ * CF services answers.
97
+ */
98
+ private cfServicesAnswers;
99
+ /**
100
+ * Indicates if the extension is installed.
101
+ */
102
+ private readonly isExtensionInstalled;
103
+ /**
104
+ * Indicates if CF is installed.
105
+ */
106
+ private cfInstalled;
71
107
  /**
72
108
  * Creates an instance of the generator.
73
109
  *
@@ -80,12 +116,33 @@ export default class extends Generator {
80
116
  writing(): Promise<void>;
81
117
  install(): Promise<void>;
82
118
  end(): Promise<void>;
119
+ /**
120
+ * Prompts the user for the CF project path.
121
+ */
122
+ private _promptForCfProjectPath;
123
+ /**
124
+ * Determines the target environment based on the current context.
125
+ * Sets the target environment and updates related state accordingly.
126
+ */
127
+ private _determineTargetEnv;
128
+ /**
129
+ * Prompts the user to select the target environment and updates related state.
130
+ */
131
+ private _promptForTargetEnvironment;
132
+ /**
133
+ * Prompts the user for the CF environment.
134
+ */
135
+ private _promptForCfEnvironment;
83
136
  /**
84
137
  * Retrieves the ConfigPrompter instance from cache if it exists, otherwise creates a new instance.
85
138
  *
86
139
  * @returns {ConfigPrompter} Cached config prompter if going back a page.
87
140
  */
88
141
  private _getOrCreatePrompter;
142
+ /**
143
+ * Generates the ADP project artifacts for the CF environment.
144
+ */
145
+ private _generateAdpProjectArtifactsCF;
89
146
  /**
90
147
  * Combines the target folder and project name.
91
148
  *
@@ -3,13 +3,14 @@ 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
- const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
6
+ const node_fs_1 = __importDefault(require("node:fs"));
7
7
  const node_path_1 = require("node:path");
8
8
  const yeoman_generator_1 = __importDefault(require("yeoman-generator"));
9
+ const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
9
10
  const adp_tooling_1 = require("@sap-ux/adp-tooling");
10
- const feature_toggle_1 = require("@sap-ux/feature-toggle");
11
11
  const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
12
12
  const logger_1 = require("@sap-ux/logger");
13
+ const feature_toggle_1 = require("@sap-ux/feature-toggle");
13
14
  const telemetryEvents_1 = require("../telemetryEvents");
14
15
  const appWizardCache_1 = require("../utils/appWizardCache");
15
16
  const deps_1 = require("../utils/deps");
@@ -23,9 +24,13 @@ const templates_1 = require("../utils/templates");
23
24
  const workspace_1 = require("../utils/workspace");
24
25
  const layer_1 = require("./layer");
25
26
  const attributes_1 = require("./questions/attributes");
27
+ const cf_services_1 = require("./questions/cf-services");
26
28
  const configuration_1 = require("./questions/configuration");
27
29
  const default_values_1 = require("./questions/helper/default-values");
28
30
  const validators_1 = require("./questions/helper/validators");
31
+ const types_1 = require("./types");
32
+ const btp_utils_1 = require("@sap-ux/btp-utils");
33
+ const target_env_1 = require("./questions/target-env");
29
34
  const generatorTitle = 'Adaptation Project';
30
35
  /**
31
36
  * Generator for creating an Adaptation Project.
@@ -74,6 +79,10 @@ class default_1 extends yeoman_generator_1.default {
74
79
  * Instance of the configuration prompter class.
75
80
  */
76
81
  prompter;
82
+ /**
83
+ * Instance of the CF services prompter class.
84
+ */
85
+ cfPrompter;
77
86
  /**
78
87
  * JSON object representing the complete adaptation project configuration,
79
88
  * passed as a CLI argument.
@@ -95,6 +104,38 @@ class default_1 extends yeoman_generator_1.default {
95
104
  * Indicates if the current layer is based on a customer base.
96
105
  */
97
106
  isCustomerBase;
107
+ /**
108
+ * Target environment.
109
+ */
110
+ targetEnv;
111
+ /**
112
+ * Indicates if the current environment is a CF environment.
113
+ */
114
+ isCfEnv = false;
115
+ /**
116
+ * Indicates if the user is logged in to CF.
117
+ */
118
+ isCfLoggedIn = false;
119
+ /**
120
+ * CF config.
121
+ */
122
+ cfConfig;
123
+ /**
124
+ * Indicates if the current project is an MTA project.
125
+ */
126
+ isMtaYamlFound;
127
+ /**
128
+ * CF services answers.
129
+ */
130
+ cfServicesAnswers;
131
+ /**
132
+ * Indicates if the extension is installed.
133
+ */
134
+ isExtensionInstalled;
135
+ /**
136
+ * Indicates if CF is installed.
137
+ */
138
+ cfInstalled;
98
139
  /**
99
140
  * Creates an instance of the generator.
100
141
  *
@@ -107,8 +148,10 @@ class default_1 extends yeoman_generator_1.default {
107
148
  this.shouldInstallDeps = opts.shouldInstallDeps ?? true;
108
149
  this.toolsLogger = new logger_1.ToolsLogger();
109
150
  this.vscode = opts.vscode;
110
- this.options = opts;
111
151
  this._setupLogging();
152
+ this.options = opts;
153
+ this.isMtaYamlFound = (0, adp_tooling_1.isMtaProject)(process.cwd());
154
+ this.isExtensionInstalled = (0, fiori_generator_shared_1.isExtensionInstalled)(opts.vscode, 'SAP.adp-ve-bas-ext');
112
155
  const jsonInputString = (0, parse_json_input_1.getFirstArgAsString)(args);
113
156
  this.jsonInput = (0, parse_json_input_1.parseJsonInput)(jsonInputString, this.logger);
114
157
  if (!this.jsonInput) {
@@ -131,16 +174,23 @@ class default_1 extends yeoman_generator_1.default {
131
174
  this.layer = (0, layer_1.getFlexLayer)();
132
175
  this.isCustomerBase = this.layer === "CUSTOMER_BASE" /* FlexLayer.CUSTOMER_BASE */;
133
176
  this.systemLookup = new adp_tooling_1.SystemLookup(this.logger);
177
+ this.cfInstalled = await (0, adp_tooling_1.isCfInstalled)(this.logger);
178
+ this.cfConfig = (0, adp_tooling_1.loadCfConfig)(this.logger);
179
+ this.isCfLoggedIn = await (0, adp_tooling_1.isLoggedInCf)(this.cfConfig, this.logger);
180
+ this.logger.info(`isCfInstalled: ${this.cfInstalled}`);
181
+ const isInternalUsage = (0, feature_toggle_1.isInternalFeaturesSettingEnabled)();
134
182
  if (!this.jsonInput) {
135
- this.prompts.splice(0, 0, (0, steps_1.getWizardPages)());
183
+ const shouldShowTargetEnv = (0, btp_utils_1.isAppStudio)() && this.cfInstalled && this.isExtensionInstalled;
184
+ this.prompts.splice(0, 0, (0, steps_1.getWizardPages)(shouldShowTargetEnv));
136
185
  this.prompter = this._getOrCreatePrompter();
186
+ this.cfPrompter = new cf_services_1.CFServicesPrompter(isInternalUsage, this.isCfLoggedIn, this.logger);
137
187
  }
138
188
  await fiori_generator_shared_1.TelemetryHelper.initTelemetrySettings({
139
189
  consumerModule: {
140
190
  name: '@sap/generator-fiori:generator-adp',
141
191
  version: this.rootGeneratorVersion()
142
192
  },
143
- internalFeature: (0, feature_toggle_1.isInternalFeaturesSettingEnabled)(),
193
+ internalFeature: isInternalUsage,
144
194
  watchTelemetrySettingStore: false
145
195
  });
146
196
  }
@@ -148,57 +198,70 @@ class default_1 extends yeoman_generator_1.default {
148
198
  if (this.jsonInput) {
149
199
  return;
150
200
  }
151
- const isExtensibilityExtInstalled = (0, fiori_generator_shared_1.isExtensionInstalled)(this.vscode, 'SAP.vscode-bas-extensibility');
152
- const configQuestions = this.prompter.getPrompts({
153
- appValidationCli: { hide: !this.isCli },
154
- systemValidationCli: { hide: !this.isCli },
155
- shouldCreateExtProject: { isExtensibilityExtInstalled }
156
- });
157
- this.configAnswers = await this.prompt(configQuestions);
158
- this.shouldCreateExtProject = !!this.configAnswers.shouldCreateExtProject;
159
- this.logger.info(`System: ${this.configAnswers.system}`);
160
- this.logger.info(`Application: ${JSON.stringify(this.configAnswers.application, null, 2)}`);
161
- const { ui5Versions, systemVersion } = this.prompter.ui5;
162
- const promptConfig = {
163
- ui5Versions,
164
- isVersionDetected: !!systemVersion,
165
- isCloudProject: this.prompter.isCloud,
166
- layer: this.layer,
167
- prompts: this.prompts
168
- };
169
- const defaultFolder = (0, fiori_generator_shared_1.getDefaultTargetFolder)(this.options.vscode) ?? process.cwd();
170
- const options = {
171
- targetFolder: { default: defaultFolder, hide: this.shouldCreateExtProject },
172
- ui5ValidationCli: { hide: !this.isCli },
173
- enableTypeScript: { hide: this.shouldCreateExtProject },
174
- addFlpConfig: { hasBaseAppInbounds: !!this.prompter.baseAppInbounds, hide: this.shouldCreateExtProject },
175
- addDeployConfig: { hide: this.shouldCreateExtProject || !this.isCustomerBase }
176
- };
177
- const attributesQuestions = (0, attributes_1.getPrompts)(this.destinationPath(), promptConfig, options);
178
- this.attributeAnswers = await this.prompt(attributesQuestions);
179
- // Steps need to be updated here to be available after back navigation in Yeoman UI.
180
- this._updateWizardStepsAfterNavigation();
181
- this.logger.info(`Project Attributes: ${JSON.stringify(this.attributeAnswers, null, 2)}`);
182
- if (this.attributeAnswers.addDeployConfig) {
183
- const system = await this.systemLookup.getSystemByName(this.configAnswers.system);
184
- (0, subgenHelpers_1.addDeployGen)({
185
- projectName: this.attributeAnswers.projectName,
186
- projectPath: this.attributeAnswers.targetFolder,
187
- connectedSystem: this.configAnswers.system,
188
- system
189
- }, this.composeWith.bind(this), this.logger, this.appWizard);
201
+ await this._determineTargetEnv();
202
+ if (this.isCfEnv) {
203
+ await this._promptForCfEnvironment();
190
204
  }
191
- if (this.attributeAnswers?.addFlpConfig) {
192
- (0, subgenHelpers_1.addFlpGen)({
193
- vscode: this.vscode,
194
- projectRootPath: this._getProjectPath(),
195
- inbounds: this.prompter.baseAppInbounds,
196
- layer: this.layer
197
- }, this.composeWith.bind(this), this.logger, this.appWizard);
205
+ else {
206
+ const isExtensibilityExtInstalled = (0, fiori_generator_shared_1.isExtensionInstalled)(this.vscode, 'SAP.vscode-bas-extensibility');
207
+ const configQuestions = this.prompter.getPrompts({
208
+ appValidationCli: { hide: !this.isCli },
209
+ systemValidationCli: { hide: !this.isCli },
210
+ shouldCreateExtProject: { isExtensibilityExtInstalled }
211
+ });
212
+ this.configAnswers = await this.prompt(configQuestions);
213
+ this.shouldCreateExtProject = !!this.configAnswers.shouldCreateExtProject;
214
+ this.logger.info(`System: ${this.configAnswers.system}`);
215
+ this.logger.info(`Application: ${JSON.stringify(this.configAnswers.application, null, 2)}`);
216
+ const { ui5Versions, systemVersion } = this.prompter.ui5;
217
+ const promptConfig = {
218
+ ui5Versions,
219
+ isVersionDetected: !!systemVersion,
220
+ isCloudProject: this.prompter.isCloud,
221
+ layer: this.layer,
222
+ prompts: this.prompts
223
+ };
224
+ const defaultFolder = (0, fiori_generator_shared_1.getDefaultTargetFolder)(this.options.vscode) ?? process.cwd();
225
+ const options = {
226
+ targetFolder: { default: defaultFolder, hide: this.shouldCreateExtProject },
227
+ ui5ValidationCli: { hide: !this.isCli },
228
+ enableTypeScript: { hide: this.shouldCreateExtProject },
229
+ addFlpConfig: {
230
+ hasBaseAppInbounds: !!this.prompter.baseAppInbounds,
231
+ hide: this.shouldCreateExtProject
232
+ },
233
+ addDeployConfig: { hide: this.shouldCreateExtProject || !this.isCustomerBase }
234
+ };
235
+ const attributesQuestions = (0, attributes_1.getPrompts)(this.destinationPath(), promptConfig, options);
236
+ this.attributeAnswers = await this.prompt(attributesQuestions);
237
+ // Steps need to be updated here to be available after back navigation in Yeoman UI.
238
+ this._updateWizardStepsAfterNavigation();
239
+ this.logger.info(`Project Attributes: ${JSON.stringify(this.attributeAnswers, null, 2)}`);
240
+ if (this.attributeAnswers.addDeployConfig) {
241
+ const system = await this.systemLookup.getSystemByName(this.configAnswers.system);
242
+ (0, subgenHelpers_1.addDeployGen)({
243
+ projectName: this.attributeAnswers.projectName,
244
+ projectPath: this.attributeAnswers.targetFolder,
245
+ connectedSystem: this.configAnswers.system,
246
+ system
247
+ }, this.composeWith.bind(this), this.logger, this.appWizard);
248
+ }
249
+ if (this.attributeAnswers?.addFlpConfig) {
250
+ (0, subgenHelpers_1.addFlpGen)({
251
+ vscode: this.vscode,
252
+ projectRootPath: this._getProjectPath(),
253
+ inbounds: this.prompter.baseAppInbounds,
254
+ layer: this.layer
255
+ }, this.composeWith.bind(this), this.logger, this.appWizard);
256
+ }
198
257
  }
199
258
  }
200
259
  async writing() {
201
260
  try {
261
+ if (this.isCfEnv) {
262
+ await this._generateAdpProjectArtifactsCF();
263
+ return;
264
+ }
202
265
  if (this.jsonInput) {
203
266
  await this._initFromJson();
204
267
  }
@@ -239,7 +302,7 @@ class default_1 extends yeoman_generator_1.default {
239
302
  }
240
303
  }
241
304
  async install() {
242
- if (!this.shouldInstallDeps || this.shouldCreateExtProject) {
305
+ if (!this.shouldInstallDeps || this.shouldCreateExtProject || this.isCfEnv) {
243
306
  return;
244
307
  }
245
308
  try {
@@ -250,7 +313,7 @@ class default_1 extends yeoman_generator_1.default {
250
313
  }
251
314
  }
252
315
  async end() {
253
- if (this.shouldCreateExtProject) {
316
+ if (this.shouldCreateExtProject || this.isCfEnv) {
254
317
  return;
255
318
  }
256
319
  const telemetryData = fiori_generator_shared_1.TelemetryHelper.createTelemetryData({
@@ -263,7 +326,7 @@ class default_1 extends yeoman_generator_1.default {
263
326
  this.logger.error((0, i18n_1.t)('error.telemetry', { error }));
264
327
  });
265
328
  }
266
- if ((0, adp_tooling_1.isCFEnvironment)(projectPath) || this.isCli) {
329
+ if (this.isCli) {
267
330
  return;
268
331
  }
269
332
  try {
@@ -281,6 +344,77 @@ class default_1 extends yeoman_generator_1.default {
281
344
  this.appWizard.showError(e.message, yeoman_ui_types_1.MessageType.notification);
282
345
  }
283
346
  }
347
+ /**
348
+ * Prompts the user for the CF project path.
349
+ */
350
+ async _promptForCfProjectPath() {
351
+ if (this.isMtaYamlFound) {
352
+ const path = this.destinationRoot(process.cwd());
353
+ (0, adp_tooling_1.getYamlContent)((0, node_path_1.join)(path, 'mta.yaml'));
354
+ this.logger.log(`Project path information: ${path}`);
355
+ }
356
+ else {
357
+ const pathAnswers = await this.prompt([(0, target_env_1.getProjectPathPrompt)(this.logger, this.vscode)]);
358
+ const path = this.destinationRoot(node_fs_1.default.realpathSync(pathAnswers.projectLocation, 'utf-8'));
359
+ this.logger.log(`Project path information: ${path}`);
360
+ }
361
+ }
362
+ /**
363
+ * Determines the target environment based on the current context.
364
+ * Sets the target environment and updates related state accordingly.
365
+ */
366
+ async _determineTargetEnv() {
367
+ const hasRequiredExtensions = this.isExtensionInstalled && this.cfInstalled;
368
+ if ((0, btp_utils_1.isAppStudio)() && hasRequiredExtensions) {
369
+ await this._promptForTargetEnvironment();
370
+ }
371
+ else {
372
+ this.targetEnv = types_1.TargetEnv.ABAP;
373
+ }
374
+ }
375
+ /**
376
+ * Prompts the user to select the target environment and updates related state.
377
+ */
378
+ async _promptForTargetEnvironment() {
379
+ const targetEnvAnswers = await this.prompt([
380
+ (0, target_env_1.getTargetEnvPrompt)(this.appWizard, this.cfInstalled, this.isCfLoggedIn, this.cfConfig, this.vscode)
381
+ ]);
382
+ this.targetEnv = targetEnvAnswers.targetEnv;
383
+ this.isCfEnv = this.targetEnv === types_1.TargetEnv.CF;
384
+ this.logger.info(`Target environment: ${this.targetEnv}`);
385
+ (0, steps_1.updateCfWizardSteps)(this.isCfEnv, this.prompts);
386
+ this.logger.log(`Project organization information: ${JSON.stringify(this.cfConfig.org, null, 2)}`);
387
+ this.logger.log(`Project space information: ${JSON.stringify(this.cfConfig.space, null, 2)}`);
388
+ this.logger.log(`Project apiUrl information: ${JSON.stringify(this.cfConfig.url, null, 2)}`);
389
+ }
390
+ /**
391
+ * Prompts the user for the CF environment.
392
+ */
393
+ async _promptForCfEnvironment() {
394
+ await this._promptForCfProjectPath();
395
+ const options = {
396
+ targetFolder: { hide: true },
397
+ ui5Version: { hide: true },
398
+ ui5ValidationCli: { hide: true },
399
+ enableTypeScript: { hide: true },
400
+ addFlpConfig: { hide: true },
401
+ addDeployConfig: { hide: true }
402
+ };
403
+ const projectPath = this.destinationPath();
404
+ const attributesQuestions = (0, attributes_1.getPrompts)(projectPath, {
405
+ ui5Versions: [],
406
+ isVersionDetected: false,
407
+ isCloudProject: false,
408
+ layer: this.layer,
409
+ prompts: this.prompts,
410
+ isCfEnv: true
411
+ }, options);
412
+ this.attributeAnswers = await this.prompt(attributesQuestions);
413
+ this.logger.info(`Project Attributes: ${JSON.stringify(this.attributeAnswers, null, 2)}`);
414
+ const cfServicesQuestions = await this.cfPrompter.getPrompts(projectPath, this.cfConfig);
415
+ this.cfServicesAnswers = await this.prompt(cfServicesQuestions);
416
+ this.logger.info(`CF Services Answers: ${JSON.stringify(this.cfServicesAnswers, null, 2)}`);
417
+ }
284
418
  /**
285
419
  * Retrieves the ConfigPrompter instance from cache if it exists, otherwise creates a new instance.
286
420
  *
@@ -295,6 +429,32 @@ class default_1 extends yeoman_generator_1.default {
295
429
  (0, appWizardCache_1.cachePut)(this.appWizard, { prompter }, this.logger);
296
430
  return prompter;
297
431
  }
432
+ /**
433
+ * Generates the ADP project artifacts for the CF environment.
434
+ */
435
+ async _generateAdpProjectArtifactsCF() {
436
+ const projectPath = this.isMtaYamlFound ? process.cwd() : this.destinationPath();
437
+ const publicVersions = await (0, adp_tooling_1.fetchPublicVersions)(this.logger);
438
+ const manifest = this.cfPrompter.manifest;
439
+ if (!manifest) {
440
+ throw new Error('Manifest not found for base app.');
441
+ }
442
+ const html5RepoRuntimeGuid = this.cfPrompter.serviceInstanceGuid;
443
+ const config = (0, adp_tooling_1.getCfConfig)({
444
+ attributeAnswers: this.attributeAnswers,
445
+ cfServicesAnswers: this.cfServicesAnswers,
446
+ cfConfig: this.cfConfig,
447
+ layer: this.layer,
448
+ manifest,
449
+ html5RepoRuntimeGuid,
450
+ projectPath,
451
+ publicVersions
452
+ });
453
+ if (config.options) {
454
+ config.options.templatePathOverwrite = (0, templates_1.getTemplatesOverwritePath)();
455
+ }
456
+ await (0, adp_tooling_1.generateCf)(projectPath, config, this.logger, this.fs);
457
+ }
298
458
  /**
299
459
  * Combines the target folder and project name.
300
460
  *
@@ -7,6 +7,7 @@ interface Config {
7
7
  ui5Versions: string[];
8
8
  isVersionDetected: boolean;
9
9
  prompts: YeomanUiSteps;
10
+ isCfEnv?: boolean;
10
11
  }
11
12
  /**
12
13
  * Returns all project attribute prompts, filtering based on promptOptions.
@@ -20,10 +20,10 @@ const default_values_1 = require("./helper/default-values");
20
20
  * @returns {AttributesQuestion[]} An array of prompt objects for basic info input.
21
21
  */
22
22
  function getPrompts(path, config, promptOptions) {
23
- const { isVersionDetected, ui5Versions, isCloudProject, layer, prompts } = config;
23
+ const { isVersionDetected, ui5Versions, isCloudProject, layer, prompts, isCfEnv = false } = config;
24
24
  const isCustomerBase = layer === "CUSTOMER_BASE" /* FlexLayer.CUSTOMER_BASE */;
25
25
  const keyedPrompts = {
26
- [types_1.attributePromptNames.projectName]: getProjectNamePrompt(path, isCustomerBase, promptOptions?.[types_1.attributePromptNames.projectName]),
26
+ [types_1.attributePromptNames.projectName]: getProjectNamePrompt(path, isCustomerBase, isCfEnv, promptOptions?.[types_1.attributePromptNames.projectName]),
27
27
  [types_1.attributePromptNames.title]: getApplicationTitlePrompt(promptOptions?.[types_1.attributePromptNames.title]),
28
28
  [types_1.attributePromptNames.namespace]: getNamespacePrompt(isCustomerBase, promptOptions?.[types_1.attributePromptNames.namespace]),
29
29
  [types_1.attributePromptNames.targetFolder]: getTargetFolderPrompt(promptOptions?.[types_1.attributePromptNames.targetFolder]),
@@ -46,10 +46,11 @@ function getPrompts(path, config, promptOptions) {
46
46
  *
47
47
  * @param {string} path - The base project path.
48
48
  * @param {boolean} isCustomerBase - Whether the layer is CUSTOMER_BASE.
49
+ * @param {boolean} isCfEnv - Whether the project is in a CF environment.
49
50
  * @param {ProjectNamePromptOptions} [_] - Optional prompt options.
50
51
  * @returns {AttributesQuestion} The prompt configuration for project name.
51
52
  */
52
- function getProjectNamePrompt(path, isCustomerBase, _) {
53
+ function getProjectNamePrompt(path, isCustomerBase, isCfEnv, _) {
53
54
  return {
54
55
  type: 'input',
55
56
  name: types_1.attributePromptNames.projectName,
@@ -60,7 +61,7 @@ function getProjectNamePrompt(path, isCustomerBase, _) {
60
61
  breadcrumb: true,
61
62
  hint: (0, tooltip_1.getProjectNameTooltip)(isCustomerBase)
62
63
  },
63
- validate: (value, answers) => (0, project_input_validator_1.validateProjectName)(value, answers.targetFolder || path, isCustomerBase),
64
+ validate: (value, answers) => (0, project_input_validator_1.validateProjectName)(value, answers.targetFolder || path, isCustomerBase, isCfEnv),
64
65
  store: false
65
66
  };
66
67
  }
@@ -0,0 +1,100 @@
1
+ import type { CFServicesQuestion, CfServicesPromptOptions, CfConfig } from '@sap-ux/adp-tooling';
2
+ import type { ToolsLogger } from '@sap-ux/logger';
3
+ import type { Manifest } from '@sap-ux/project-access';
4
+ /**
5
+ * Prompter for CF services.
6
+ */
7
+ export declare class CFServicesPrompter {
8
+ private readonly isInternalUsage;
9
+ private readonly logger;
10
+ /**
11
+ * Whether the user is logged in to Cloud Foundry.
12
+ */
13
+ private isCfLoggedIn;
14
+ /**
15
+ * Whether to show the solution name prompt.
16
+ */
17
+ private showSolutionNamePrompt;
18
+ /**
19
+ * The type of approuter to use.
20
+ */
21
+ private approuter;
22
+ /**
23
+ * The business services available.
24
+ */
25
+ private businessServices;
26
+ /**
27
+ * The keys of the business service.
28
+ */
29
+ private businessServiceKeys;
30
+ /**
31
+ * The base apps available.
32
+ */
33
+ private apps;
34
+ /**
35
+ * The service instance GUID.
36
+ */
37
+ private html5RepoServiceInstanceGuid;
38
+ /**
39
+ * The manifest.
40
+ */
41
+ private appManifest;
42
+ /**
43
+ * Returns the loaded application manifest.
44
+ *
45
+ * @returns Application manifest.
46
+ */
47
+ get manifest(): Manifest | undefined;
48
+ /**
49
+ * Returns the service instance GUID.
50
+ *
51
+ * @returns Service instance GUID.
52
+ */
53
+ get serviceInstanceGuid(): string;
54
+ /**
55
+ * Constructor for CFServicesPrompter.
56
+ *
57
+ * @param {boolean} [isInternalUsage] - Internal usage flag.
58
+ * @param {boolean} isCfLoggedIn - Whether the user is logged in to Cloud Foundry.
59
+ * @param {ToolsLogger} logger - Logger instance.
60
+ */
61
+ constructor(isInternalUsage: boolean | undefined, isCfLoggedIn: boolean, logger: ToolsLogger);
62
+ /**
63
+ * Builds the CF services prompts, keyed and hide-filtered like attributes.ts.
64
+ *
65
+ * @param {string} mtaProjectPath - MTA project path
66
+ * @param {CfConfig} cfConfig - CF config service instance.
67
+ * @param {CfServicesPromptOptions} [promptOptions] - Optional per-prompt visibility controls
68
+ * @returns {Promise<CFServicesQuestion[]>} CF services questions
69
+ */
70
+ getPrompts(mtaProjectPath: string, cfConfig: CfConfig, promptOptions?: CfServicesPromptOptions): Promise<CFServicesQuestion[]>;
71
+ /**
72
+ * Prompt for business solution name.
73
+ *
74
+ * @returns {CFServicesQuestion} Prompt for business solution name.
75
+ */
76
+ private getBusinessSolutionNamePrompt;
77
+ /**
78
+ * Prompt for approuter.
79
+ *
80
+ * @param {string} mtaProjectPath - MTA project path.
81
+ * @param {CfConfig} cfConfig - CF config service instance.
82
+ * @returns {CFServicesQuestion} Prompt for approuter.
83
+ */
84
+ private getAppRouterPrompt;
85
+ /**
86
+ * Prompt for base application.
87
+ *
88
+ * @param {CfConfig} cfConfig - CF config service instance.
89
+ * @returns {CFServicesQuestion} Prompt for base application.
90
+ */
91
+ private getBaseAppPrompt;
92
+ /**
93
+ * Prompt for business services.
94
+ *
95
+ * @param {CfConfig} cfConfig - CF config service instance.
96
+ * @returns {CFServicesQuestion} Prompt for business services.
97
+ */
98
+ private getBusinessServicesPrompt;
99
+ }
100
+ //# sourceMappingURL=cf-services.d.ts.map