UNPKG

@juspay/neurolink

Version:

Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio

103 lines (102 loc) 3.54 kB
/** * PPT Utilities * * Contains provider utilities and helper functions for PPT generation. * * @module ppt/utils */ import type { PPTGenerationContext, AspectRatioOption, EffectivePPTProviderResult, ImageValidationResult, TextSegment, LogoConfig, GenerateOptions } from "../../types/index.js"; /** * Extract PPT generation context from GenerateOptions */ export declare function extractPPTContext(options: GenerateOptions): PPTGenerationContext; /** * Valid providers for PPT generation. * These providers support structured output capabilities required for content planning. */ export declare const PPT_VALID_PROVIDERS: readonly string[]; /** * Get an effective PPT provider - handles all orchestration logic */ export declare function getEffectivePPTProvider(currentProvider: unknown, currentProviderName: string, currentModelName: string, neurolink?: unknown): Promise<EffectivePPTProviderResult>; /** * Generate output file path for PPT */ export declare function generateOutputPath(context: PPTGenerationContext): string; /** * Ensure output directory exists */ export declare function ensureOutputDirectory(filePath: string): Promise<void>; /** * Check if value is a non-null object */ export declare function isObject(value: unknown): value is Record<string, unknown>; /** * Type guard for LogoConfig */ export declare function isLogoConfig(logo: unknown): logo is LogoConfig; /** * Convert LogoConfig or Buffer/string to normalized format */ export declare function normalizeLogoConfig(logo: Buffer | string | LogoConfig | null): LogoConfig | null; /** * Get pptxgenjs layout name from aspect ratio */ export declare function getLayoutName(aspectRatio: AspectRatioOption): "LAYOUT_16x9" | "LAYOUT_4x3"; /** * Convert unknown error to Error instance */ export declare function toError(error: unknown): Error; /** * Determine which stage failed based on orchestration state */ export declare function getFailureStage(state: { contentPlan: unknown; slides: unknown; outputPath: unknown; }): string; /** * Validate an image buffer and determine its MIME type */ export declare function validateImageBuffer(buffer: Buffer | undefined): ImageValidationResult; /** * Convert image buffer to data URL for pptxgenjs */ export declare function bufferToDataUrl(buffer: Buffer): string | null; /** * Parse markdown-style formatting in text and return formatted segments * Supports: **bold**, *italic*, ***bold italic*** * * @example * parseMarkdownText("Hello **world**") * // Returns: [{ text: "Hello " }, { text: "world", bold: true }] */ export declare function parseMarkdownText(text: string): TextSegment[]; /** * Check if text contains markdown formatting */ export declare function hasMarkdownFormatting(text: string): boolean; /** * Convert parsed text segments to pptxgenjs text runs array * This allows mixed formatting within a single bullet point */ export declare function createFormattedTextProps(segments: TextSegment[], baseOptions: { fontSize: number; fontFace: string; color: string; baseBold?: boolean; }): Array<{ text: string; options: Record<string, unknown>; }>; /** * Calculate font size based on bullet count * More bullets = smaller font to fit content * * Formula: * - 1-5 bullets: baseFontSize (18pt) * - 6-7 bullets: baseFontSize - 2 (16pt) * - 8-10 bullets: baseFontSize - 4 (14pt) * - 10+ bullets: cap at 12pt minimum */ export declare function calculateFontSize(bulletCount: number, baseFontSize?: number): number;