import { z } from 'zod'; type SchemaPart = [header: string, value: any]; type Schema = Record; type Headers = { [key in keyof S]: key extends number ? S[key][0] : never; }; type RawRow = { [key in keyof S]: key extends number ? S[key][1] : never; }; type _Combine = T extends unknown ? T & Partial, never>> : never; type Combine = Required<{ [K in keyof _Combine]: _Combine[K]; }>; type PairToObject = { [key in T[0]]: T[1]; }; type SchemaGroups = { [key in keyof S]: key extends number ? PairToObject : never; }; type Row = Combine[keyof SchemaGroups]>; type NotFoundErrorData = { ctx: z.RefinementCtx; fieldName: string; message?: string; }; /** * @example * type S = { * 0: ['_id', E]; * 1: ['description', string]; * 2: ['value', number]; * }; * * const table = new Table( * 'test', * ['_id', 'description', 'value'],^ * [ * [0, 'description 0', 0], * [1, 'description 1', 1], * ], * ); */ export default class Table = RawRow, ID extends RR[0] = RR[0], R extends Row = Row> { readonly headers: Headers; readonly data: RR[]; idIndex: Map; constructor(headers: Headers, data: RR[]); private manageNotFoundError; normalizeRow(rawRow: RR): R; /**Retorna el resultado que coincide con el id especificado, o null si no se encuentra ninguna coincidencia.*/ findById(id: ID, _notFoundErrorData?: NotFoundErrorData): R | null; _findById(id: ID, _notFoundErrorData?: NotFoundErrorData): R; _findByIdIfExist(id: ID | undefined, _notFoundErrorData?: NotFoundErrorData): R | null; /**Retorna todos los resultados que cumplan con la condicion especificada.*/ findWhere(expected: Partial): R[]; /**Retorna el primer resultado que cumpla con la condicion especificada, o null si no se encuentra ninguna coincidencia.*/ findUniqueWhere(expected: Partial): R | null; } export {};