import { Flatfile } from '@flatfile/api'; import { FlatfileEvent } from '@flatfile/listener'; declare function getRecordsRaw(sheetId: string, options?: Flatfile.records.GetRecordsRequest): Promise>; declare function getSheetLength(sheetId: string): Promise; declare function processRecords(sheetId: string, callback: (records: Flatfile.RecordsWithLinks, pageNumber?: number, totalPageCount?: number) => R | void | Promise, options?: Omit): Promise; /** * Creates records in a sheet. Bypasses API SDK in order to suppress hooks */ declare function createRecords(sheetId: string, records: Flatfile.RecordData[]): Promise; /** * Updates records in a sheet. Bypasses API SDK in order to suppress hooks */ declare function updateRecords(sheetId: string, records: any): Promise; /** * Updates records in a sheet. Bypasses API SDK in order to suppress hooks */ declare function updateAllRecords(sheetId: string, records: Flatfile.Record_[], tick?: TickHelper): Promise; /** * Creates many records in a sheet. Bypasses API SDK in order to suppress hooks */ declare function createAllRecords(sheetId: string, records: Flatfile.RecordData[], tick?: TickHelper, options?: { pageSize?: number; }): Promise; type TickHelper = (progress: number, part: number, totalParts: number) => Promise; declare function asyncBatch(arr: T[], callback: (chunk: T[], event?: FlatfileEvent) => Promise, options?: { chunkSize?: number; parallel?: number; debug?: boolean; }, event?: FlatfileEvent): Promise; declare function chunkify(arr: T[], chunkSize: number): T[][]; declare function deleteRecords(sheetId: string, config: Omit): Promise; type LogType = 'log' | 'warn' | 'error'; declare const log: (packageName: string, msg: string, type?: LogType) => void; declare const logInfo: (packageName: string, msg: string) => void; declare const logWarn: (packageName: string, msg: string) => void; declare const logError: (packageName: string, msg: string) => void; interface NormalizeSheetConfigOptions { output?: 'validate' | 'transform'; } interface KeyConflict { originalKey: string; normalizedKey: string; finalKey: string; message: string; } interface ValidationResult { conflicts: KeyConflict[]; hasConflicts: boolean; } /** * Converts a string (in various formats) to snake_case. * - Consecutive uppercase letters remain a single chunk (e.g. "XYZ" => "xyz") * - But if there's a lowercase letter followed by uppercase letters ("ValueXYZ"), * we insert a space before the uppercase chunk => "Value XYZ" * - Hyphens, underscores, spaces become single spaces. * - % -> "percent"; $ -> "dollar" * - Fully uppercase words stay as one chunk ("FIRSTNAME" => "firstname"). * - Also, if the entire string is numeric, return it as a number. */ declare function normalizeKey(key: string | number): string; declare function truncate(key: string, maxLength?: number): string; /** * Normalizes the field keys in a Flatfile SheetConfig using snake_case convention. * Creates a new SheetConfig with normalized field keys while preserving all other properties. * If normalized keys create duplicates, adds _1, _2, etc. to make them unique. * * @param sheetConfig - The Flatfile SheetConfig to normalize * @param options - Configuration options for the normalization * @param options.output - 'validate' returns conflict info, 'transform' (default) returns normalized SheetConfig * @returns Either a normalized SheetConfig (transform mode) or validation results (validate mode) */ declare function normalizeSheetConfig(sheetConfig: Flatfile.SheetConfig, options: NormalizeSheetConfigOptions & { output: 'validate'; }): ValidationResult; declare function normalizeSheetConfig(sheetConfig: Flatfile.SheetConfig, options?: NormalizeSheetConfigOptions & { output?: 'transform'; }): Flatfile.SheetConfig; declare const slugify: (str: string) => string; declare class Simplified { /** * Return all records for a sheet * * @param sheetId * @param options * @param tick */ static getAllRecords(sheetId: string, options?: Flatfile.records.GetRecordsRequest, tick?: TickHelper): Promise; /** * Return all records for a sheet by iterating until there are empty pages. * This is most useful in scenarios where pages are generally small but you want * to safely handle edge cases. It avoids another count request. * * @param sheetId * @param options */ static getAllRecordsSeries(sheetId: string, options?: Flatfile.records.GetRecordsRequest): Promise; static findRecordsLimit(sheetId: string, options: Flatfile.records.GetRecordsRequest, limit?: number): Promise; /** * { foo: bar } => { foo : {value: bar}} * @param obj */ static toRecordValues(obj: SimpleRecord): Flatfile.RecordData; static toStandardRecord(obj: SimpleRecord): { id: string; metadata: any; values: Flatfile.RecordData; }; /** * * @param r */ static toSimpleRecord(r: Flatfile.Record_): SimpleRecord; static updateAllRecords(sheetId: string, records: SimpleRecord[], tick?: TickHelper): Promise; static createAllRecords(sheetId: string, records: SimpleValues[], tick?: TickHelper): Promise; } type Primitive = string | number | null | boolean; type SimpleRecord = { _id: string; _metadata?: Record; } & SimpleValues; type SimpleValues = { [key: string]: Primitive; }; export { type KeyConflict, type NormalizeSheetConfigOptions, type Primitive, type SimpleRecord, type SimpleValues, Simplified, type TickHelper, type ValidationResult, asyncBatch, chunkify, createAllRecords, createRecords, deleteRecords, getRecordsRaw, getSheetLength, log, logError, logInfo, logWarn, normalizeKey, normalizeSheetConfig, processRecords, slugify, truncate, updateAllRecords, updateRecords };