/** * Annotation Exporter * * Flexible annotation export system with pluggable format converters. * Supports custom export formats for different use cases. */ export interface LabelStudioAnnotation { id: number; task: number; project: number; completed_by: { id: number; email: string; first_name: string; last_name: string; }; result: Array<{ from_name: string; to_name: string; type: string; value: any; }>; created_at: string; updated_at: string; lead_time?: number; } export interface ExportContext { projectId: number; projectTitle?: string; exportedAt: string; metadata?: any; } /** * Export format converter function type * Converts Label Studio annotations to custom format */ export type FormatConverter = (annotations: LabelStudioAnnotation[], context: ExportContext) => T | Promise; /** * Register a custom export format converter * * @param formatName - Unique format identifier (e.g., "csv", "coco", "yolo") * @param converter - Converter function * * @example * registerExportFormat('csv', (annotations, context) => { * const rows = annotations.map(a => ({ * id: a.id, * task: a.task, * result: JSON.stringify(a.result) * })) * return Papa.unparse(rows) * }) */ export declare function registerExportFormat(formatName: string, converter: FormatConverter): void; /** * Unregister an export format */ export declare function unregisterExportFormat(formatName: string): void; /** * Get all registered format names */ export declare function getRegisteredFormats(): string[]; /** * Export annotations to specified format * * @param annotations - Label Studio annotations * @param format - Export format name * @param context - Export context * @returns Converted data in requested format */ export declare function exportAnnotations(annotations: LabelStudioAnnotation[], format: string, context: ExportContext): Promise; /** * Pre-built export formats */ export declare class ExportFormats { /** * Export as JSON (default Label Studio format) */ static json(): FormatConverter; /** * Export as JSON Lines (one annotation per line) */ static jsonl(): FormatConverter; /** * Export image classification results as CSV */ static imageClassificationCSV(): FormatConverter; /** * Export Rank N classification results */ static rankNClassificationCSV(ranks?: number): FormatConverter; /** * Export object detection results as COCO format */ static coco(): FormatConverter; /** * Export object detection results as YOLO format */ static yolo(): FormatConverter>; /** * Export NER (Named Entity Recognition) results */ static nerJSON(): FormatConverter; }