import type { Answers, Question } from 'inquirer'; import { type Editor } from 'mem-fs-editor'; import { type Project } from '@sap-ux/project-access'; import type { Prompts, ValidationResults, PromptListChoices, PromptContext, PromptContextOptions, CodeSnippet, PromptsType } from './types.js'; import type { SupportedPrompts, NarrowPrompt } from './map.js'; /** * API class to request and handle prompts for fpm-writer features. */ export declare class PromptsAPI { context: PromptContext; private cache; /** * Constructor of prompt API. * * @param fs the file system object for reading files * @param project * @param appId app id in CAP project * @param options additional prompt context options. */ constructor(fs: Editor, project: Project | undefined, appId?: string, options?: PromptContextOptions); /** * Static method to initialize prompt api. * * @param projectPath project path * @param appId app id in CAP project * @param fs the file system object for reading files * @param options additional prompt context options. * @returns Instance of prompt api. */ static init(projectPath: string, appId?: string, fs?: Editor, options?: PromptContextOptions): Promise; /** * Returns a list of prompts for passed type. * * @param type Prompt type * @returns List of prompts for passed type. */ getPrompts(type: N): Promise['answers']>>; /** * Gets prompt choices. * * @param type - The prompt type * @param fieldName - The field name * @param answers - The answers object * @returns */ getChoices(type: PromptsType, fieldName: string, answers: T): Promise; /** * Validates answers: checks if required prompts have values and runs validate() if exists on prompt. * * @param type The prompt type * @param answers The answers object * @param questions Questions to validate - If param is not passed, then all question will be validated * @returns Object with question names and answer validation results */ validateAnswers(type: PromptsType, answers: Answers, questions?: Question[]): Promise; /** * Method submits answers by generating content in project for passed prompt type. * * @param type The prompt type * @param answers The answers object * @returns The updated memfs editor instance */ submitAnswers(type: N, answers: NarrowPrompt['answers']): Promise; /** * Method returns code snippet for passed answers and prompt type. * * @param type The prompt type * @param answers The answers object * @returns Code snippet content. */ getCodeSnippets(type: N, answers: NarrowPrompt['answers']): Promise<{ [questionName: string]: CodeSnippet; }>; /** * Method checks if passed type of prompt supports generation and code preview. * * @param config Prompt configuration * @param config.type * @param config.answers * @returns true if code generation is supported. */ private isGenerationSupported; } //# sourceMappingURL=api.d.ts.map