import type { SystemLookup, UI5Version } from '@sap-ux/adp-tooling'; import { FlexLayer } from '@sap-ux/adp-tooling'; import { AdaptationProjectType, type AbapServiceProvider } from '@sap-ux/axios-extension'; import type { ToolsLogger } from '@sap-ux/logger'; import type { Manifest, ManifestNamespace } from '@sap-ux/project-access'; import type { TelemetryCollector } from '../../telemetry/index.js'; import type { ConfigPromptOptions, ConfigQuestion } from '../types.js'; import { SystemType } from '../types.js'; /** * A stateful prompter class that creates configuration questions. * It exposes a single public method {@link getPrompts} to retrieve the configuration questions. */ export declare class ConfigPrompter { private readonly systemLookup; private readonly logger; private readonly telemetryCollector; private readonly CLOUD_DEV_ADP_STATUS_RELEASED; /** * Indicates if the current layer is based on a customer base. */ private readonly isCustomerBase; /** * Instance of AbapServiceProvider. */ private abapProvider; /** * Application manifest. */ private appManifest; /** * Loaded target applications for a system. */ private targetApps; /** * Flag indicating that system login is successful. */ private isLoginSuccessful; /** * Flag indicating that system requires authentication in BAS or it does not exist in VS Code. */ private isAuthRequired; /** * Cached UI flexibility information from the system. */ private flexUICapability?; /** * The supported project type for the system. */ private supportedProject?; /** * The selected project type by the user. For a mixed system only * the user may select from a cloudReady or an OnPremise project types. */ private selectedProjectType?; /** * The system type for the selected system. */ private selectedSystemType?; /** * Flag indicating whether the selected application is supported. */ private isApplicationSupported; /** * Error message to be shown in the confirm extension project prompt. */ private appValidationErrorMessage; /** * System additional message. */ private systemAdditionalMessage?; /** * Indicates whether views are loaded synchronously. */ private containsSyncViews; /** * Flag indicating if the application is an internal V4 application. */ private isV4AppInternalMode; /** * Flag indicating that full adaptation-over-adaptation is supported. */ private isSupported; /** * Flag indicating that only partial adaptation-over-adaptation is supported. */ private isPartiallySupported; /** * UI5 versions in string format. */ private ui5Versions; /** * Publicly available UI5 versions. */ private publicVersions; /** * System UI5 version. */ private systemVersion; /** * Base application inbounds, if the base application is an FLP app. */ private baseApplicationInbounds?; /** * Returns the needed ui5 properties from calling the CDN. * * @returns Object with properties related to ui5. */ get ui5(): { ui5Versions: string[]; systemVersion: string | undefined; publicVersions: UI5Version; }; /** * @returns {AdaptationProjectType | undefined} The project type. */ get projectType(): AdaptationProjectType | undefined; /** * @returns {SystemType | undefined} The system type. */ get systemType(): SystemType | undefined; /** * Returns the configured abap provider instance. * * @returns Configured instance of AbapServiceProvider. */ get provider(): AbapServiceProvider; /** * Returns the loaded application manifest. * * @returns Application manifest. */ get manifest(): Manifest | undefined; /** * Indicates whether the application loads views synchronously. * * @returns {boolean} True if views are sync-loaded. */ get hasSyncViews(): boolean; /** * Indicates whether the application is supported by Adaptation Project. * * @returns {boolean} True if the application is supported. */ get isAppSupported(): boolean; /** * Base application inbounds, if the base application is an FLP app. * * @returns {ManifestNamespace.Inbound|undefined} Returns the base application inbounds. */ get baseAppInbounds(): ManifestNamespace.Inbound | undefined; /** * Creates an instance of ConfigPrompter. * * @param {SystemLookup} systemLookup - The source system class to retrieve system endpoints. * @param {FlexLayer} layer - The FlexLayer used to determine the base (customer or otherwise). * @param {ToolsLogger} logger - Instance of the logger. * @param {TelemetryCollector} telemetryCollector - Instance of the telemetry collector. */ constructor(systemLookup: SystemLookup, layer: FlexLayer, logger: ToolsLogger, telemetryCollector: TelemetryCollector); /** * Retrieves an array of configuration questions based on provided options. * This is the only public method for retrieving prompts. * * @param {ConfigPromptOptions} promptOptions - Optional configuration to control prompt behavior and defaults. * @returns An array of configuration questions. */ getPrompts(promptOptions?: ConfigPromptOptions): ConfigQuestion[]; /** * Creates the system list prompt configuration. * * @param {SystemPromptOptions} _ - Optional configuration for the system prompt. * @returns The system list prompt as a {@link ConfigQuestion}. */ private getSystemListPrompt; /** * Only used in the CLI context when prompt is of type `list` because the validation does not run on CLI for the system list prompt. * * @returns Dummy prompt that runs in the CLI only. */ private getSystemValidationPromptForCli; /** * Creates the username prompt configuration. * * @param {UsernamePromptOptions} _ - Optional configuration for the username prompt. * @returns The username prompt as a {@link ConfigQuestion}. */ private getUsernamePrompt; /** * Creates the password prompt configuration. * * @param {PasswordPromptOptions} _ - Optional configuration for the password prompt. * @returns The password prompt as a {@link ConfigQuestion}. */ private getPasswordPrompt; /** * Creates the store credentials prompt configuration. * * @param {StoreCredentialsPromptOptions} _ - Optional configuration for the store credentials prompt. * @returns The store credentials prompt as a {@link ConfigQuestion}. */ private getStoreCredentialsPrompt; /** * Creates the project type prompt configuration. * * @param {ApplicationPromptOptions | undefined} options - The prompt options. * @returns {ListQuestion} The project type prompt configuration. */ private getProjectTypeListPrompt; /** * Prompt with `when` hook only, which runs the project type propmt validation in a CLI context only. * This overcomes yeoman limitation for prompts of type `list` for which the validation hook is not * triggered by design in a CLI context. * * @returns {YUIQuestion} The project type for cli prompt configuration. */ private getProjectTypeListPromptForCli; /** * Creates a label for the project type `classic`. * * @param {ProjectTypeClassicLabelPromptOptions} options - The project type `classic` label options. * @returns {InputQuestion} The project type `classic` label configurations. */ private getProjectTypeClassicLabelPrompt; /** * Creates the application list prompt configuration. * * @param {ApplicationPromptOptions} options - Optional configuration for the application prompt. * @returns The application list prompt as a {@link ConfigQuestion}. */ private getApplicationListPrompt; /** * Only used in the CLI context when prompt is of type `list` because the validation does not run on CLI for the application list prompt. * * @returns Dummy prompt that runs in the CLI only. */ private getApplicationValidationPromptForCli; /** * Creates an input prompt for entering the Fiori ID. * * @param {FioriIdPromptOptions} _ - Optional configuration for Fiori ID prompt. * @returns {InputQuestion} An input prompt for the Fiori ID. */ private getFioriIdPrompt; /** * Generates an input prompt for entering the Application Component Hierarchy code for a project. * * @param {AchPromptOptions} _ - Optional configuration for ACH prompt. * @returns {InputQuestion} An input prompt for Application Component Hierarchy code. */ private getAchPrompt; /** * Generates a confirmation prompt to decide whether to create an extension project based on the application's * sync capabilities and support status. * * @param {ShouldCreateExtProjectPromptOptions} options - Optional configuration for the confirm extension project prompt. * @returns The confirm extension project prompt as a {@link ConfigQuestion}. */ private getShouldCreateExtProjectPrompt; /** * Validates the selected application. * * Checks if the application is provided and then evaluates support based on its manifest. * * @param {SourceApplication} app - The selected application. * @returns A promise that resolves to true if valid, or an error message string if validation fails. */ private validateAppPrompt; /** * Validates the password by setting up the provider and, if necessary, * loading the available applications. * * @param {string} password - The inputted password. * @param {ConfigAnswers} answers - The configuration answers provided by the user. * @returns An error message if validation fails, or true if the system selection is valid. */ private validatePassword; /** * Validates the system selection by setting up the provider and, if necessary, * loading the available applications. * * @param {string} system - The selected system. * @param {ConfigAnswers} answers - The configuration answers provided by the user. * @returns An error message if validation fails, or true if the system selection is valid. */ private validateSystem; /** * Validates the selected application to ensure it is supported. * * @param {SourceApplication} app - The application to validate. * @returns {Promise} True if the application is valid, otherwise an error message. */ private validateAppData; /** * Evaluate if the application version supports certain features. * * @param {SourceApplication} application - The application data. */ private evaluateAppSupport; /** * Fetches the system type, supported project type and the UI flexibility information. * * @returns A promise that resolves when system data is fetched. */ private loadSystemData; /** * Fetches and processes SAPUI5 version data from the system and public sources. * * @returns {Promise} A promise that resolves once all version data is loaded and assigned. */ private loadUI5Versions; /** * Handles the fetching and validation of system data. * * @returns {Promise} True if successful, or an error message if an error occurs. */ private handleSystemDataValidation; /** * Handles errors that occur while fetching system information, setting default values and rethrowing if necessary. * * @param {Error} error - The error encountered during the system info fetch. */ private handleSystemError; /** * Validates the selected application for adaptation projects, checking for specific support flags * and validating the application manifest. * * @returns {void} Returns when validation is complete. */ private validateManifest; /** * Validates the project type prompt. * * @param {AdaptationProjectType} projectType - The selected project type. * @param {SourceApplication} application - The selected application. * @returns {Promise} A promise that resolves to true if valid, or an error message string if validation fails. */ private validateProjectTypePrompt; /** * Sets the support flags for given application. * * @param {SourceApplication} application - The application to validate. * @param {boolean} isFullSupport - Flag to check for full AdpOverAdp support. * @param {boolean} isPartialSupport - Flag to check for partial AdpOverAdp support. * @returns {void} Returns when flags are set. */ private setSupportFlags; /** * Checks if the application is a released app on a mixed system that requires * explicit project type selection by the user. * * @param {SourceApplication} application - The selected application. * @returns {boolean} True if the application is released on a mixed system. */ private isReleasedAppOnMixedSystem; /** * Checks if the application is a classic (non-released) app on a mixed system * that should default to on-premise project type. * * @param {SourceApplication} application - The selected application. * @returns {boolean} True if the application is classic on a mixed system. */ private isClassicAppOnMixedSystem; /** * Determines the project type prompt visibility. In case the user is external, * the selected application is released and the system is mixed the prompt need to be visible. * * @param {SourceApplication} application - The selected application. * @returns {boolean} True if the project type must be displayed. */ private shouldDisplayProjectTypePrompt; /** * Determines the project type classic label visibility. In case the user is external, * the selected application is NOT released and the system is mixed the label need to be visible. * * @param {SourceApplication} application - The selected application. * @returns {boolean} True if the project type classic label must be displayed. */ private shouldDisplayProjectTypeClassicLabel; } //# sourceMappingURL=configuration.d.ts.map