dnsweeper
Version:
Advanced CLI tool for DNS record risk analysis and cleanup. Features CSV import for Cloudflare/Route53, automated risk assessment, and parallel DNS validation.
88 lines • 2.91 kB
TypeScript
import Papa from 'papaparse';
import { type SupportedEncoding } from '../utils/encoding-detector.js';
import type { ICSVRecord } from '../types/index.js';
export interface ICSVParseOptions {
skipEmptyLines?: boolean;
trimValues?: boolean;
delimiter?: string;
encoding?: SupportedEncoding;
autoDetectEncoding?: boolean;
autoDetectDelimiter?: boolean;
}
export interface ICSVParseResult {
records: ICSVRecord[];
errors: Papa.ParseError[];
meta: Papa.ParseMeta;
totalRows: number;
validRows: number;
encodingInfo?: {
detectedEncoding: SupportedEncoding;
confidence: number;
reliability: 'high' | 'medium' | 'low';
bomPresent: boolean;
};
delimiters?: {
detected: string[];
used: string;
};
}
export declare class CSVProcessor {
private options;
private defaultOptions;
private batchProcessor;
constructor(options?: ICSVParseOptions);
/**
* Parse Cloudflare DNS export CSV format
* Format: Name,Type,Content,TTL,Priority
*/
parseCloudflare(filePath: string): Promise<ICSVParseResult>;
/**
* Parse Route53 CSV export format
* Format: Name,Type,Value,TTL,Weight,SetIdentifier
*/
parseRoute53(filePath: string): Promise<ICSVParseResult>;
/**
* Parse generic CSV format
* Format: domain,record_type,value,ttl,priority,weight,port
*/
parseGeneric(filePath: string): Promise<ICSVParseResult>;
/**
* Auto-detect CSV format and parse accordingly
*/
parseAuto(filePath: string): Promise<ICSVParseResult>;
/**
* Parse CSV with streaming for large files
*/
parseStreaming(filePath: string, onRecord: (record: ICSVRecord) => void, format?: 'cloudflare' | 'route53' | 'generic'): Promise<{
totalProcessed: number;
errors: Papa.ParseError[];
}>;
private processCloudflareResults;
private processRoute53Results;
private processGenericResults;
private convertRowToRecord;
private convertCloudflareRow;
private convertRoute53Row;
private convertGenericRow;
/**
* 大容量CSVファイルのストリーミング処理
*/
parseStreamingCloudflare(filePath: string, onProgress?: (processed: number) => void): Promise<ICSVParseResult>;
/**
* バッチ処理による大容量データの効率的変換
*/
processBatchRecords(records: ICSVRecord[], processor: (record: ICSVRecord) => ICSVRecord): Promise<ICSVRecord[]>;
/**
* ファイルの読み込みとエンコーディング・区切り文字の自動検出
*/
private readFileWithAutoDetection;
/**
* コンテンツ内の潜在的な区切り文字を検出
*/
private detectDelimitersInContent;
/**
* 最適な区切り文字を選択
*/
private selectBestDelimiter;
}
//# sourceMappingURL=csv-processor.d.ts.map