adpa-enterprise-framework-automation
Version:
Modular, standards-compliant Node.js/TypeScript automation framework for enterprise requirements, project, and data management. Provides CLI and API for BABOK v3, PMBOK 7th Edition, and DMBOK 2.0 (in progress). Production-ready Express.js API with TypeSpe
95 lines • 2.87 kB
TypeScript
/**
* Enhanced Prompt Service with Input Validation and Error Handling
* Provides robust user input handling with validation, sanitization, and error recovery
*/
import * as readline from 'readline';
import { ValidationResult } from './InputValidationService.js';
export interface PromptOptions {
message: string;
validator?: (input: string) => ValidationResult;
required?: boolean;
defaultValue?: string;
maxRetries?: number;
timeout?: number;
mask?: boolean;
multiline?: boolean;
suggestions?: string[];
helpText?: string;
}
export interface PromptResult<T = string> {
success: boolean;
value?: T;
error?: string;
attempts: number;
cancelled: boolean;
}
export declare class EnhancedPromptService {
private rl;
private isActive;
constructor(rl?: readline.Interface);
/**
* Enhanced prompt with validation and error handling
*/
prompt<T = string>(options: PromptOptions): Promise<PromptResult<T>>;
/**
* Prompt for menu choice with enhanced validation
*/
promptMenuChoice(message: string, validChoices: string[]): Promise<PromptResult<string>>;
/**
* Prompt for project name with validation
*/
promptProjectName(message?: string): Promise<PromptResult<string>>;
/**
* Prompt for file path with security validation
*/
promptFilePath(message?: string): Promise<PromptResult<string>>;
/**
* Prompt for numeric input with range validation
*/
promptNumber(message: string, min?: number, max?: number): Promise<PromptResult<number>>;
/**
* Prompt for yes/no confirmation
*/
promptConfirm(message: string, defaultValue?: boolean): Promise<PromptResult<boolean>>;
/**
* Prompt for password with masking
*/
promptPassword(message?: string): Promise<PromptResult<string>>;
/**
* Prompt for email with validation
*/
promptEmail(message?: string): Promise<PromptResult<string>>;
/**
* Prompt for URL with validation
*/
promptUrl(message?: string): Promise<PromptResult<string>>;
/**
* Prompt for API key with validation
*/
promptApiKey(provider: string, message?: string): Promise<PromptResult<string>>;
/**
* Prompt for multiple choice selection
*/
promptChoice(message: string, choices: string[], allowMultiple?: boolean): Promise<PromptResult<string | string[]>>;
/**
* Get raw input with timeout and cancellation support
*/
private getInput;
/**
* Get masked input for passwords
*/
private getMaskedInput;
/**
* Get multiline input
*/
private getMultilineInput;
/**
* Cancel active prompt
*/
cancel(): void;
/**
* Close the prompt service
*/
close(): void;
}
//# sourceMappingURL=EnhancedPromptService.d.ts.map