@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
68 lines (67 loc) • 2.42 kB
TypeScript
/**
* OpenDocument Processor
*
* Processes OpenDocument format files (.odt, .ods, .odp) by extracting
* text content from the internal XML structure.
*
* @module processors/document/OpenDocumentProcessor
*/
import { BaseFileProcessor } from "../base/BaseFileProcessor.js";
import type { FileInfo, ProcessorFileProcessingResult, ProcessOptions, ProcessedOpenDocument } from "../../types/index.js";
/**
* OpenDocument Processor - handles .odt, .ods, .odp files
*
* OpenDocument files are ZIP archives containing XML content.
* The main content is in content.xml within the archive.
*
* Priority: ~105 (between Word and Text)
*/
export declare class OpenDocumentProcessor extends BaseFileProcessor<ProcessedOpenDocument> {
constructor();
/**
* Validate that the file is a valid ZIP archive (OpenDocument format)
*/
protected validateDownloadedFile(buffer: Buffer, _fileInfo: FileInfo): Promise<string | null>;
/**
* Build the processed result by extracting content from the OpenDocument
*/
protected buildProcessedResult(buffer: Buffer, fileInfo: FileInfo): ProcessedOpenDocument;
/**
* Decode HTML entities in a single pass to prevent double-unescaping.
* Sequential replacement is vulnerable: "&lt;" → "<" → "<"
* Single-pass avoids this by replacing each entity exactly once.
*/
private decodeHtmlEntities;
/**
* Extract text content from OpenDocument XML
*/
private extractTextFromXml;
/**
* Detect the OpenDocument format from file extension
*/
private detectFormat;
/**
* Get file extension from filename
*/
private getExtension;
}
/**
* Singleton instance of OpenDocumentProcessor
*/
export declare const openDocumentProcessor: OpenDocumentProcessor;
/**
* Check if a file is an OpenDocument file by MIME type or extension
*/
export declare function isOpenDocumentFile(mimetype: string, filename: string): boolean;
/**
* Validate OpenDocument file size against limits
*/
export declare function validateOpenDocumentSize(sizeBytes: number): boolean;
/**
* Process an OpenDocument file
*/
export declare function processOpenDocument(fileInfo: FileInfo, options?: ProcessOptions): Promise<ProcessorFileProcessingResult<ProcessedOpenDocument>>;
/**
* Get the maximum allowed OpenDocument file size in MB
*/
export declare function getOpenDocumentMaxSizeMB(): number;