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

199 lines (198 loc) 7.2 kB
/** * Size Limit Constants * Centralized size limits for file processing and validation * * @module processors/config/sizeLimits */ /** * Maximum file sizes in megabytes for different file types */ export declare const SIZE_LIMITS_MB: { /** Maximum image file size (10MB) */ readonly IMAGE_MAX_MB: 10; /** Maximum PDF file size (100MB — enterprise reports, long research papers) */ readonly PDF_MAX_MB: 100; /** Maximum document file size (100MB — enterprise docs with embedded images) */ readonly DOCUMENT_MAX_MB: 100; /** Maximum Word document size (100MB — PRDs, specs with embedded media) */ readonly WORD_MAX_MB: 100; /** Maximum text file size (50MB — large log files, build output) */ readonly TEXT_MAX_MB: 50; /** Maximum CSV file size (50MB — large data exports) */ readonly CSV_MAX_MB: 50; /** Maximum Excel file size (100MB — enterprise spreadsheets, data exports) */ readonly EXCEL_MAX_MB: 100; /** Maximum source code file size (20MB — large codebases) */ readonly SOURCE_CODE_MAX_MB: 20; /** Maximum JSON file size (20MB — large API response dumps) */ readonly JSON_MAX_MB: 20; /** Maximum YAML file size (20MB — large config files) */ readonly YAML_MAX_MB: 20; /** Maximum XML file size (20MB — large config/data files) */ readonly XML_MAX_MB: 20; /** Maximum video file size (500MB — long meeting recordings, screen captures) */ readonly VIDEO_MAX_MB: 500; /** Maximum audio file size (500MB — long meeting recordings, call recordings) */ readonly AUDIO_MAX_MB: 500; /** Maximum archive file size (200MB — large project archives) */ readonly ARCHIVE_MAX_MB: 200; /** Maximum general file size (200MB — matches Curator's memory-safety cap) */ readonly GENERAL_MAX_MB: 200; }; /** * Maximum file sizes in bytes for different file types */ export declare const SIZE_LIMITS_BYTES: { /** Maximum image file size (10MB) */ readonly IMAGE_MAX: number; /** Maximum PDF file size (100MB) */ readonly PDF_MAX: number; /** Maximum document file size (100MB) */ readonly DOCUMENT_MAX: number; /** Maximum Word document size (100MB) */ readonly WORD_MAX: number; /** Maximum text file size (50MB) */ readonly TEXT_MAX: number; /** Maximum CSV file size (50MB) */ readonly CSV_MAX: number; /** Maximum Excel file size (100MB) */ readonly EXCEL_MAX: number; /** Maximum source code file size (20MB) */ readonly SOURCE_CODE_MAX: number; /** Maximum JSON file size (20MB) */ readonly JSON_MAX: number; /** Maximum YAML file size (20MB) */ readonly YAML_MAX: number; /** Maximum XML file size (20MB) */ readonly XML_MAX: number; /** Maximum video file size (500MB) */ readonly VIDEO_MAX: number; /** Maximum audio file size (500MB) */ readonly AUDIO_MAX: number; /** Maximum archive file size (200MB) */ readonly ARCHIVE_MAX: number; /** Maximum general file size (200MB) */ readonly GENERAL_MAX: number; }; /** * Processing limits for different content types */ export declare const PROCESSING_LIMITS: { /** Maximum lines for source code files */ readonly MAX_SOURCE_CODE_LINES: 10000; /** Maximum lines for text files */ readonly MAX_TEXT_LINES: 10000; /** Maximum characters for text extraction */ readonly MAX_TEXT_LENGTH: 1000000; /** Maximum rows for CSV files */ readonly MAX_CSV_ROWS: 10000; /** Maximum rows per Excel sheet */ readonly MAX_EXCEL_ROWS: 5000; /** Maximum sheets to process in Excel */ readonly MAX_EXCEL_SHEETS: 10; /** Maximum pages for PDF files */ readonly MAX_PDF_PAGES: 100; /** Maximum depth for JSON/YAML objects */ readonly MAX_OBJECT_DEPTH: 50; /** Maximum array length in JSON/YAML */ readonly MAX_ARRAY_LENGTH: 10000; }; /** * Security limits for archive processing (ZIP bomb protection) */ export declare const ARCHIVE_LIMITS: { /** Maximum decompressed size (100MB) */ readonly MAX_DECOMPRESSED_SIZE: number; /** Maximum compression ratio (100:1) */ readonly MAX_COMPRESSION_RATIO: 100; /** Maximum entries in archive */ readonly MAX_ENTRIES: 1000; /** Maximum nesting depth */ readonly MAX_NESTING_DEPTH: 5; }; /** * Security limits for YAML processing (billion laughs protection) */ export declare const YAML_LIMITS: { /** Maximum alias expansion count */ readonly MAX_ALIAS_COUNT: 100; /** Maximum document count in multi-doc YAML */ readonly MAX_DOCUMENTS: 10; /** Maximum anchor references */ readonly MAX_ANCHORS: 100; }; /** * All size limits combined for backward compatibility */ export declare const SIZE_LIMITS: { readonly IMAGE_MAX_MB: 10; readonly PDF_MAX_MB: 100; readonly DOCUMENT_MAX_MB: 100; readonly WORD_MAX_MB: 100; readonly TEXT_MAX_MB: 50; readonly CSV_MAX_MB: 50; readonly EXCEL_MAX_MB: 100; readonly SOURCE_CODE_MAX_MB: 20; readonly MAX_FILE_SIZE: number; readonly MAX_IMAGE_SIZE: number; readonly MAX_TEXT_SIZE: number; readonly MAX_SOURCE_CODE_LINES: 10000; readonly MAX_TEXT_LINES: 10000; readonly MAX_TEXT_LENGTH: 1000000; readonly MAX_CSV_ROWS: 10000; readonly EXCEL_MAX_ROWS: 5000; readonly EXCEL_MAX_SHEETS: 10; readonly MAX_PDF_PAGES: 100; readonly MAX_DECOMPRESSED_SIZE: number; readonly MAX_COMPRESSION_RATIO: 100; readonly MAX_ZIP_ENTRIES: 1000; readonly YAML_MAX_ALIAS_COUNT: 100; }; /** * Converts bytes to megabytes * * @param bytes - Size in bytes * @returns Size in megabytes */ export declare function bytesToMB(bytes: number): number; /** * Converts megabytes to bytes * * @param mb - Size in megabytes * @returns Size in bytes */ export declare function mbToBytes(mb: number): number; /** * Formats bytes to human-readable string * * @param bytes - Size in bytes * @param precision - Decimal places (default: 2) * @returns Formatted string like "1.5 MB" or "500 KB" */ export declare function formatBytes(bytes: number, precision?: number): string; /** * Checks if a file size is within the specified limit * * @param sizeInBytes - File size in bytes * @param limitKey - Key from SIZE_LIMITS_BYTES * @returns True if the file size is within the limit */ export declare function isWithinSizeLimit(sizeInBytes: number, limitKey: keyof typeof SIZE_LIMITS_BYTES): boolean; /** * Gets the appropriate size limit for a file type * * @param fileType - Type of file (image, pdf, document, etc.) * @returns Size limit in bytes */ export declare function getSizeLimitForType(fileType: "image" | "pdf" | "document" | "text" | "csv" | "excel" | "code" | "json" | "yaml" | "xml"): number; /** * Validates file size against the appropriate limit * * @param sizeInBytes - File size in bytes * @param fileType - Type of file * @returns Object with isValid flag and error message if invalid */ export declare function validateFileSize(sizeInBytes: number, fileType: "image" | "pdf" | "document" | "text" | "csv" | "excel" | "code" | "json" | "yaml" | "xml"): { isValid: boolean; error?: string; };