cnj-validate
Version:
Biblioteca TypeScript para validação e análise de números de processos em conformidade com o CNJ (Conselho Nacional de Justiça) do Brasil
150 lines • 10.9 kB
JavaScript
;
/**
* CNJ Validate - Biblioteca TypeScript para validação e análise de números CNJ
* Versão Next.js 15 compatível
*
* @description
* Esta biblioteca fornece funcionalidades completas para:
* - Validação de números CNJ
* - Decomposição e análise detalhada
* - Processamento em lote via CSV
* - Formatação e utilitários
*
* @example
* ```typescript
* import { validateCNJ, analyzeCNJ } from 'cnj-validate';
*
* const result = validateCNJ('0001327-64.2018.8.26.0158');
* console.log(result.isValid); // true
*
* const analysis = analyzeCNJ('0001327-64.2018.8.26.0158');
* console.log(analysis.segmentName); // "Justiça dos Estados..."
* ```
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.MAX_COURT_BY_SEGMENT = exports.SOURCE_UNIT_CONFIG = exports.SEGMENT_SHORTS = exports.SEGMENT_NAMES = exports.CNJValidationError = exports.CNJErrorType = exports.removeCNJMask = exports.formatTimestamp = exports.formatProtocolYear = exports.formatPercentage = exports.formatLawsuitNumber = exports.formatFileSize = exports.formatDuration = exports.formatCNJWithMask = exports.formatBrazilianDate = exports.capitalizeWords = exports.hasDistrict = exports.getDistrictsByUF = exports.getDistrictsBySegment = exports.getDistrictInfo = exports.generateDistrictKey = exports.DISTRICTS = exports.addDistrict = exports.SEGMENTS = exports.isValidSegmentCode = exports.getSegment = exports.getAllSegments = exports.validateCSVFormat = exports.processCSV = exports.processCNJBatch = exports.generateCSV = exports.getOriginCourt = exports.getMaxCourtBySegment = exports.isValidSourceUnit = exports.getSourceUnitTypeBySegment = exports.getSourceUnit = exports.writeCNJ = exports.isValidCNJComplete = exports.getBatchStatistics = exports.analyzeCNJBatch = exports.analyzeCNJ = exports.validateCNJComponents = exports.decomposeCNJ = exports.validateCNJFormat = exports.validateCNJ = exports.normalizeCNJ = exports.isValidCNJ = exports.formatCNJ = exports.detectCNJFormat = exports.calculateVerifyingDigit = void 0;
exports.DEFAULT_CONFIG = exports.LIBRARY_INFO = exports.VERSION = void 0;
exports.isValid = isValid;
exports.analyze = analyze;
const analyzer_1 = require("./core/analyzer");
const validator_1 = require("./core/validator");
// Core functions - Funções principais
var validator_2 = require("./core/validator");
Object.defineProperty(exports, "calculateVerifyingDigit", { enumerable: true, get: function () { return validator_2.calculateVerifyingDigit; } });
Object.defineProperty(exports, "detectCNJFormat", { enumerable: true, get: function () { return validator_2.detectCNJFormat; } });
Object.defineProperty(exports, "formatCNJ", { enumerable: true, get: function () { return validator_2.formatCNJ; } });
Object.defineProperty(exports, "isValidCNJ", { enumerable: true, get: function () { return validator_2.isValidCNJ; } });
Object.defineProperty(exports, "normalizeCNJ", { enumerable: true, get: function () { return validator_2.normalizeCNJ; } });
Object.defineProperty(exports, "validateCNJ", { enumerable: true, get: function () { return validator_2.validateCNJ; } });
Object.defineProperty(exports, "validateCNJFormat", { enumerable: true, get: function () { return validator_2.validateCNJFormat; } });
var decomposer_1 = require("./core/decomposer");
Object.defineProperty(exports, "decomposeCNJ", { enumerable: true, get: function () { return decomposer_1.decomposeCNJ; } });
Object.defineProperty(exports, "validateCNJComponents", { enumerable: true, get: function () { return decomposer_1.validateCNJComponents; } });
var analyzer_2 = require("./core/analyzer");
Object.defineProperty(exports, "analyzeCNJ", { enumerable: true, get: function () { return analyzer_2.analyzeCNJ; } });
Object.defineProperty(exports, "analyzeCNJBatch", { enumerable: true, get: function () { return analyzer_2.analyzeCNJBatch; } });
Object.defineProperty(exports, "getBatchStatistics", { enumerable: true, get: function () { return analyzer_2.getBatchStatistics; } });
Object.defineProperty(exports, "isValidCNJComplete", { enumerable: true, get: function () { return analyzer_2.isValidCNJComplete; } });
Object.defineProperty(exports, "writeCNJ", { enumerable: true, get: function () { return analyzer_2.writeCNJ; } });
var source_unit_analyzer_1 = require("./core/source-unit-analyzer");
Object.defineProperty(exports, "getSourceUnit", { enumerable: true, get: function () { return source_unit_analyzer_1.getSourceUnit; } });
Object.defineProperty(exports, "getSourceUnitTypeBySegment", { enumerable: true, get: function () { return source_unit_analyzer_1.getSourceUnitTypeBySegment; } });
Object.defineProperty(exports, "isValidSourceUnit", { enumerable: true, get: function () { return source_unit_analyzer_1.isValidSourceUnit; } });
var court_analyzer_1 = require("./core/court-analyzer");
Object.defineProperty(exports, "getMaxCourtBySegment", { enumerable: true, get: function () { return court_analyzer_1.getMaxCourtBySegment; } });
Object.defineProperty(exports, "getOriginCourt", { enumerable: true, get: function () { return court_analyzer_1.getOriginCourt; } });
// CSV Processing - Processamento CSV (Browser-safe)
var processor_1 = require("./csv/processor");
Object.defineProperty(exports, "generateCSV", { enumerable: true, get: function () { return processor_1.generateCSV; } });
Object.defineProperty(exports, "processCNJBatch", { enumerable: true, get: function () { return processor_1.processCNJBatch; } });
Object.defineProperty(exports, "processCSV", { enumerable: true, get: function () { return processor_1.processCSV; } });
Object.defineProperty(exports, "validateCSVFormat", { enumerable: true, get: function () { return processor_1.validateCSVFormat; } });
// Data functions - Funções de dados
var segments_1 = require("./data/segments");
Object.defineProperty(exports, "getAllSegments", { enumerable: true, get: function () { return segments_1.getAllSegments; } });
Object.defineProperty(exports, "getSegment", { enumerable: true, get: function () { return segments_1.getSegment; } });
Object.defineProperty(exports, "isValidSegmentCode", { enumerable: true, get: function () { return segments_1.isValidSegmentCode; } });
Object.defineProperty(exports, "SEGMENTS", { enumerable: true, get: function () { return segments_1.SEGMENTS; } });
var districts_1 = require("./data/districts");
Object.defineProperty(exports, "addDistrict", { enumerable: true, get: function () { return districts_1.addDistrict; } });
Object.defineProperty(exports, "DISTRICTS", { enumerable: true, get: function () { return districts_1.DISTRICTS; } });
Object.defineProperty(exports, "generateDistrictKey", { enumerable: true, get: function () { return districts_1.generateDistrictKey; } });
Object.defineProperty(exports, "getDistrictInfo", { enumerable: true, get: function () { return districts_1.getDistrictInfo; } });
Object.defineProperty(exports, "getDistrictsBySegment", { enumerable: true, get: function () { return districts_1.getDistrictsBySegment; } });
Object.defineProperty(exports, "getDistrictsByUF", { enumerable: true, get: function () { return districts_1.getDistrictsByUF; } });
Object.defineProperty(exports, "hasDistrict", { enumerable: true, get: function () { return districts_1.hasDistrict; } });
// Utilities - Utilitários
var formatters_1 = require("./utils/formatters");
Object.defineProperty(exports, "capitalizeWords", { enumerable: true, get: function () { return formatters_1.capitalizeWords; } });
Object.defineProperty(exports, "formatBrazilianDate", { enumerable: true, get: function () { return formatters_1.formatBrazilianDate; } });
Object.defineProperty(exports, "formatCNJWithMask", { enumerable: true, get: function () { return formatters_1.formatCNJWithMask; } });
Object.defineProperty(exports, "formatDuration", { enumerable: true, get: function () { return formatters_1.formatDuration; } });
Object.defineProperty(exports, "formatFileSize", { enumerable: true, get: function () { return formatters_1.formatFileSize; } });
Object.defineProperty(exports, "formatLawsuitNumber", { enumerable: true, get: function () { return formatters_1.formatLawsuitNumber; } });
Object.defineProperty(exports, "formatPercentage", { enumerable: true, get: function () { return formatters_1.formatPercentage; } });
Object.defineProperty(exports, "formatProtocolYear", { enumerable: true, get: function () { return formatters_1.formatProtocolYear; } });
Object.defineProperty(exports, "formatTimestamp", { enumerable: true, get: function () { return formatters_1.formatTimestamp; } });
Object.defineProperty(exports, "removeCNJMask", { enumerable: true, get: function () { return formatters_1.removeCNJMask; } });
var errors_1 = require("./types/errors");
Object.defineProperty(exports, "CNJErrorType", { enumerable: true, get: function () { return errors_1.CNJErrorType; } });
Object.defineProperty(exports, "CNJValidationError", { enumerable: true, get: function () { return errors_1.CNJValidationError; } });
// Constants - Constantes
var segment_1 = require("./types/segment");
Object.defineProperty(exports, "SEGMENT_NAMES", { enumerable: true, get: function () { return segment_1.SEGMENT_NAMES; } });
Object.defineProperty(exports, "SEGMENT_SHORTS", { enumerable: true, get: function () { return segment_1.SEGMENT_SHORTS; } });
var source_unit_1 = require("./types/source-unit");
Object.defineProperty(exports, "SOURCE_UNIT_CONFIG", { enumerable: true, get: function () { return source_unit_1.SOURCE_UNIT_CONFIG; } });
var court_1 = require("./types/court");
Object.defineProperty(exports, "MAX_COURT_BY_SEGMENT", { enumerable: true, get: function () { return court_1.MAX_COURT_BY_SEGMENT; } });
/**
* Versão da biblioteca
*/
exports.VERSION = '1.0.0';
/**
* Informações sobre a biblioteca
*/
exports.LIBRARY_INFO = {
name: 'CNJ Validate',
version: exports.VERSION,
description: 'Validação e análise de números CNJ',
author: 'Sua Equipe',
license: 'MIT',
repository: 'https://github.com/paulorcvieira/cnj-validate',
};
/**
* Configurações padrão
*/
exports.DEFAULT_CONFIG = {
csv: {
separator: ',',
includeHeader: true,
encoding: 'utf8',
},
validation: {
strictMode: true,
allowFormattedInput: true,
allowUnformattedInput: true,
},
};
/**
* Função de conveniência para validação rápida
* @param cnj Número CNJ a ser validado
* @returns true se válido, false se inválido
*/
function isValid(cnj) {
return (0, validator_1.isValidCNJ)(cnj);
}
/**
* Função de conveniência para análise rápida
* @param cnj Número CNJ a ser analisado
* @returns Análise completa ou null se inválido
*/
function analyze(cnj) {
try {
return (0, analyzer_1.analyzeCNJ)(cnj);
}
catch {
return null;
}
}
//# sourceMappingURL=index.js.map