UNPKG

n8n

Version:

n8n Workflow Automation Tool

74 lines (73 loc) 3.43 kB
import { type WorkspaceFiles } from './file-references'; import type { CsvAggregateInput, CsvFilter } from './schemas'; export declare const CSV_SAMPLE_VALUE_LIMIT = 5; export declare const CSV_PROFILE_DISTINCT_LIMIT = 100; export declare const CSV_DISTINCT_TRACK_LIMIT = 10000; export declare const CSV_MAX_AGGREGATE_GROUPS = 50000; export declare function resolveCsvFile(files: WorkspaceFiles, reference: string): import("../../agent-knowledge.service").KnowledgeWorkspaceFile; export declare function streamCsvRecords(workspaceRoot: string, file: WorkspaceFiles[number], handlers: { onHeaders?: (headers: string[]) => void; onRecord: (record: { record: Record<string, unknown>; fileLineNumber: number; }) => void; }): Promise<void>; export declare function validateCsvColumns(headers: string[], fileName: string, columns: string[]): void; export declare function matchesFilters(record: Record<string, unknown>, filters: CsvFilter[]): boolean; export declare function normaliseCsvValue(value: unknown): string; export declare function toCsvRecordValues(record: Record<string, unknown>, columns: string[]): { [k: string]: string; }; export type CsvDistinctTracker = ReturnType<typeof createCsvDistinctTracker>; export declare function createCsvDistinctTracker(columns: string[], limit: number): { add(record: Record<string, unknown>): void; toOutput(): { [k: string]: string[]; }; columns: string[]; }; export declare function buildCsvAmbiguity(matchedRows: number, limit: number, tracker: CsvDistinctTracker | undefined): { matchedRows: number; message: string; suggestedColumns: string[]; sampleDistinctValues: { [k: string]: string[]; } | undefined; }; export declare function getSuggestedDisambiguatingColumns(headers: string[], filters: CsvFilter[], selectedColumns: string[]): string[]; type CsvColumnType = 'empty' | 'integer' | 'number' | 'boolean' | 'date' | 'string'; export declare function createCsvColumnProfileState(distinctLimit: number): { add(value: string): void; toOutput(name: string): { name: string; inferredType: CsvColumnType; emptyCount: number; distinctCount: number; distinctCountTruncated: boolean; sampleValues: string[]; }; }; export type CsvColumnProfileState = ReturnType<typeof createCsvColumnProfileState>; export declare function getLikelyDisambiguatingColumns(columnProfiles: Array<{ name: string; distinctCount?: number; distinctCountTruncated?: boolean; }>, rowCount: number): string[]; export declare function createCsvAggregateGroup(groupValues: Record<string, string>, metrics: string[]): { groupValues: Record<string, string>; count: number; metrics: { [k: string]: { count: number; sum: number; min: number | undefined; max: number | undefined; skipped: number; add(value: string): void; }; }; }; export type CsvAggregateGroup = ReturnType<typeof createCsvAggregateGroup>; export declare function formatCsvAggregateGroup(group: CsvAggregateGroup, functions: Array<'count' | 'min' | 'max' | 'sum' | 'avg'>, metrics: string[]): Record<string, string | number | null>; export declare function sortCsvAggregateResults(results: Array<Record<string, string | number | null>>, orderBy: CsvAggregateInput['orderBy']): void; export {};