ci-validation
Version:
🇺🇾 Complete TypeScript/JavaScript library for validating Uruguayan CI (Cédula de Identidad) with official algorithm and government service integration
128 lines • 4.19 kB
TypeScript
export { LoteriaUyCiService } from "../services/CiService";
export { DependencyContainer } from "../utils/dependencyContainer";
export { UruguayanCiValidator } from "../validators/CiValidator";
export type { ApiResponse, CiValidationData, CiValidationRequest, ErrorResponse, HealthCheckResponse } from "../interfaces/ApiResponse";
export type { CiQueryResponse, ICiService } from "../interfaces/ICiService";
export type { ICiValidator } from "../interfaces/ICiValidator";
/**
* Validates a Uruguayan CI (Cédula de Identidad)
* @param ci - The CI number to validate (7-8 digits)
* @returns true if the CI is valid according to the official algorithm
*
* @example
* ```typescript
* import { validateCI } from 'ci-validation';
*
* const isValid = validateCI('19119365');
* console.log(isValid); // true or false
* ```
*/
export declare function validateCI(ci: string): boolean;
/**
* Normalizes a CI by adding leading zeros and removing non-numeric characters
* @param ci - The CI number to normalize
* @returns The normalized CI (8 digits)
*
* @example
* ```typescript
* import { normalizeCI } from 'ci-validation';
*
* const normalized = normalizeCI('1234567');
* console.log(normalized); // '01234567'
* ```
*/
export declare function normalizeCI(ci: string): string;
/**
* Validates the format of a CI (length and numeric characters)
* @param ci - The CI number to validate format
* @returns true if the format is valid
*
* @example
* ```typescript
* import { validateCIFormat } from 'ci-validation';
*
* const hasValidFormat = validateCIFormat('1234567');
* console.log(hasValidFormat); // true
* ```
*/
export declare function validateCIFormat(ci: string): boolean;
/**
* Queries information about a CI from the official Uruguayan service
* @param ci - The CI number to query
* @returns Promise with the query result
*
* @example
* ```typescript
* import { queryCIInfo } from 'ci-validation';
*
* const result = await queryCIInfo('19119365');
* if (result.success) {
* console.log(result.data);
* }
* ```
*/
export declare function queryCIInfo(ci: string): Promise<import("../interfaces/ICiService").CiQueryResponse>;
/**
* Complete CI validation with information query
* @param ci - The CI number to validate and query
* @returns Promise with validation result and information if available
*
* @example
* ```typescript
* import { validateCIAndQuery } from 'ci-validation';
*
* const result = await validateCIAndQuery('19119365');
* console.log(result);
* ```
*/
export declare function validateCIAndQuery(ci: string): Promise<{
success: boolean;
error: string;
code: string;
data?: undefined;
} | {
success: boolean;
data: {
ci: string;
isValid: boolean;
normalizedCi: string;
info: string | {
persona: {
nombre?: string;
apellido?: string;
fechaNacimiento?: string;
fechaNacimientoDate?: Date | null;
edad?: number | null;
cedula?: string;
genero?: {
genero: "masculino" | "femenino" | "desconocido";
confianza: "alta" | "media" | "baja";
primerNombre: string;
segundoNombre?: string;
};
iniciales?: string;
nombreCompleto?: string;
longitudNombre?: number;
tieneSegundoNombre?: boolean;
cantidadNombres?: number;
generacion?: "Gen Z" | "Millennial" | "Gen X" | "Baby Boomer" | "Silent Generation";
[key: string]: any;
};
message?: string;
status?: number;
} | undefined;
};
error?: undefined;
code?: undefined;
}>;
export declare const VERSION = "1.0.1";
declare const _default: {
validateCI: typeof validateCI;
normalizeCI: typeof normalizeCI;
validateCIFormat: typeof validateCIFormat;
queryCIInfo: typeof queryCIInfo;
validateCIAndQuery: typeof validateCIAndQuery;
VERSION: string;
};
export default _default;
//# sourceMappingURL=index.d.ts.map