UNPKG

expo-edge-speech

Version:

Text-to-speech library for Expo using Microsoft Edge TTS service

62 lines 2.16 kB
/** * Common utility functions shared across the application. * Consolidated from duplicated implementations to maintain DRY principle. */ import { SpeechOptions, SpeechError } from "../types"; /** * Validation result interface */ export interface ValidationResult { isValid: boolean; errors: string[]; warnings: string[]; } /** * Generate unique connection ID using UUID v4 without dashes (32 character string) * Consolidated from duplicated implementations in connectionManager.ts, networkService.ts, and state.ts */ export declare function generateConnectionId(): string; /** * Generate RFC 3339 timestamp with microseconds * Used for message timestamps in Edge TTS protocol */ export declare function generateTimestamp(): string; /** * Clamp a numeric value between min and max bounds * @param value - The value to clamp * @param min - Minimum allowed value * @param max - Maximum allowed value * @returns Clamped value */ export declare function clampValue(value: number, min: number, max: number): number; /** * Generate a unique session ID * @returns A unique session identifier */ export declare function generateSessionId(): string; /** * Validate text input for speech synthesis * @param text - The text to validate * @returns Validation result */ export declare function validateText(text: string): ValidationResult; /** * Validate and normalize speech parameters * Consolidates validation logic from Speech.ts and ssmlUtils.ts * @param options - Speech options to validate * @param clampValues - Whether to clamp values to valid ranges (default: true) * @returns Validation result and normalized options */ export declare function validateSpeechParameters(options: SpeechOptions, clampValues?: boolean): { result: ValidationResult; normalizedOptions: SpeechOptions; }; /** * Create a standardized SpeechError * @param name - Error name * @param message - Error message * @param code - Error code (optional) * @returns SpeechError object */ export declare function createSpeechError(name: string, message: string, code?: string | number): SpeechError; //# sourceMappingURL=commonUtils.d.ts.map