nova lei de cnpj
This commit is contained in:
parent
4aa775266f
commit
1b22991cca
8 changed files with 115 additions and 4 deletions
|
|
@ -35,6 +35,7 @@ __reExport(index_exports, require("./tipagemRotas"), module.exports);
|
||||||
__reExport(index_exports, require("./unidades_medida"), module.exports);
|
__reExport(index_exports, require("./unidades_medida"), module.exports);
|
||||||
__reExport(index_exports, require("./uuid"), module.exports);
|
__reExport(index_exports, require("./uuid"), module.exports);
|
||||||
__reExport(index_exports, require("./variaveisComuns"), module.exports);
|
__reExport(index_exports, require("./variaveisComuns"), module.exports);
|
||||||
|
__reExport(index_exports, require("./zDocumento"), module.exports);
|
||||||
// Annotate the CommonJS export names for ESM import in node:
|
// Annotate the CommonJS export names for ESM import in node:
|
||||||
0 && (module.exports = {
|
0 && (module.exports = {
|
||||||
...require("./aleatorio"),
|
...require("./aleatorio"),
|
||||||
|
|
@ -56,5 +57,6 @@ __reExport(index_exports, require("./variaveisComuns"), module.exports);
|
||||||
...require("./tipagemRotas"),
|
...require("./tipagemRotas"),
|
||||||
...require("./unidades_medida"),
|
...require("./unidades_medida"),
|
||||||
...require("./uuid"),
|
...require("./uuid"),
|
||||||
...require("./variaveisComuns")
|
...require("./variaveisComuns"),
|
||||||
|
...require("./zDocumento")
|
||||||
});
|
});
|
||||||
|
|
|
||||||
48
dist-back/zDocumento.js
Normal file
48
dist-back/zDocumento.js
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
"use strict";
|
||||||
|
var __create = Object.create;
|
||||||
|
var __defProp = Object.defineProperty;
|
||||||
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||||
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||||
|
var __getProtoOf = Object.getPrototypeOf;
|
||||||
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||||
|
var __export = (target, all) => {
|
||||||
|
for (var name in all)
|
||||||
|
__defProp(target, name, { get: all[name], enumerable: true });
|
||||||
|
};
|
||||||
|
var __copyProps = (to, from, except, desc) => {
|
||||||
|
if (from && typeof from === "object" || typeof from === "function") {
|
||||||
|
for (let key of __getOwnPropNames(from))
|
||||||
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||||
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||||
|
}
|
||||||
|
return to;
|
||||||
|
};
|
||||||
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||||
|
// If the importer is in node compatibility mode or this is not an ESM
|
||||||
|
// file that has been converted to a CommonJS file using a Babel-
|
||||||
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||||
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||||
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||||
|
mod
|
||||||
|
));
|
||||||
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||||
|
var zDocumento_exports = {};
|
||||||
|
__export(zDocumento_exports, {
|
||||||
|
zDocCnpj: () => zDocCnpj,
|
||||||
|
zDocCpf: () => zDocCpf,
|
||||||
|
zDocumento: () => zDocumento
|
||||||
|
});
|
||||||
|
module.exports = __toCommonJS(zDocumento_exports);
|
||||||
|
var import_zod = __toESM(require("zod"));
|
||||||
|
const regexCnpjNumerico = /^\d{2}\.\d{3}\.\d{3}\/\d{4}-\d{2}$/;
|
||||||
|
const regexCnpjAlfanumerico = /^[A-Z0-9]{2}\.[A-Z0-9]{3}\.[A-Z0-9]{3}\/[A-Z0-9]{4}-\d{2}$/i;
|
||||||
|
const yyyymm = Number((/* @__PURE__ */ new Date()).toISOString().slice(0, 7).replace("-", ""));
|
||||||
|
const zDocCnpj = import_zod.default.string().regex(yyyymm < 202407 ? regexCnpjNumerico : regexCnpjAlfanumerico).describe("Documento (CNPJ) no formato XX.XXX.XXX/XXXX-XX");
|
||||||
|
const zDocCpf = import_zod.default.string().regex(/^\d{3}\.\d{3}\.\d{3}-\d{2}$/).describe("Documento (CPF) no formato XXX.XXX.XXX-XX");
|
||||||
|
const zDocumento = zDocCpf.or(zDocCnpj).describe("CPF ou CNPJ");
|
||||||
|
// Annotate the CommonJS export names for ESM import in node:
|
||||||
|
0 && (module.exports = {
|
||||||
|
zDocCnpj,
|
||||||
|
zDocCpf,
|
||||||
|
zDocumento
|
||||||
|
});
|
||||||
|
|
@ -474,4 +474,8 @@ declare const nomeVariavel: (v: {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}) => string;
|
}) => string;
|
||||||
|
|
||||||
export { Produtos, TipagemRotas, type TipoPayloadAuditoria, aleatorio, cacheM, cacheMFixo, cacheMemoria, camposComuns, erUuid, esperar, extensoes, iniciarFiltroDelta, type interfaceConsulta, link_paiol, localValor, nomeVariavel, objetoPg, operadorFiltroDeltaDetalhes, operadores, paraObjetoRegistroPg, pgObjeto, siglas_unidades_medida, texto_busca, tipoArquivo, type tipoColunaFiltroDelta, type tipoCondicaoFiltroDelta, type tipoFiltro, type tipoFiltroDelta, type tipoFiltroDeltaColunaTipada, type tipoOperadorFiltroDelta, tipoUsuarioResiduos, tiposSituacoesElicencie, tx, umaFuncao, umaVariavel, unidades_medida, uuid, uuidV3, uuidV4, uuid_null, validarUuid, verCacheM, zColunaFiltroDelta, zCondicaoFiltroDelta, zFiltro, zFiltroDelta, zOperadorFiltroDelta, zOperadores };
|
declare const zDocCnpj: z.ZodString;
|
||||||
|
declare const zDocCpf: z.ZodString;
|
||||||
|
declare const zDocumento: z.ZodUnion<[z.ZodString, z.ZodString]>;
|
||||||
|
|
||||||
|
export { Produtos, TipagemRotas, type TipoPayloadAuditoria, aleatorio, cacheM, cacheMFixo, cacheMemoria, camposComuns, erUuid, esperar, extensoes, iniciarFiltroDelta, type interfaceConsulta, link_paiol, localValor, nomeVariavel, objetoPg, operadorFiltroDeltaDetalhes, operadores, paraObjetoRegistroPg, pgObjeto, siglas_unidades_medida, texto_busca, tipoArquivo, type tipoColunaFiltroDelta, type tipoCondicaoFiltroDelta, type tipoFiltro, type tipoFiltroDelta, type tipoFiltroDeltaColunaTipada, type tipoOperadorFiltroDelta, tipoUsuarioResiduos, tiposSituacoesElicencie, tx, umaFuncao, umaVariavel, unidades_medida, uuid, uuidV3, uuidV4, uuid_null, validarUuid, verCacheM, zColunaFiltroDelta, zCondicaoFiltroDelta, zDocCnpj, zDocCpf, zDocumento, zFiltro, zFiltroDelta, zOperadorFiltroDelta, zOperadores };
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "p-comuns",
|
"name": "p-comuns",
|
||||||
"version": "0.342.0",
|
"version": "0.343.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "./dist-front/index.mjs",
|
"main": "./dist-front/index.mjs",
|
||||||
"module": "./dist-front/index.mjs",
|
"module": "./dist-front/index.mjs",
|
||||||
|
|
|
||||||
BIN
pacote.tgz
BIN
pacote.tgz
Binary file not shown.
|
|
@ -19,3 +19,4 @@ export * from "./tipagemRotas"
|
||||||
export * from "./unidades_medida"
|
export * from "./unidades_medida"
|
||||||
export * from "./uuid"
|
export * from "./uuid"
|
||||||
export * from "./variaveisComuns"
|
export * from "./variaveisComuns"
|
||||||
|
export * from "./zDocumento"
|
||||||
|
|
|
||||||
56
src/zDocumento.ts
Normal file
56
src/zDocumento.ts
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
import z from "zod"
|
||||||
|
|
||||||
|
/**
|
||||||
|
Resumo – CNPJ Alfanumérico (vigência a partir de julho de 2026)
|
||||||
|
|
||||||
|
A Receita Federal passará a emitir CNPJs alfanuméricos para novas empresas a partir de julho de 2026. O objetivo é ampliar a quantidade de combinações disponíveis e evitar o esgotamento dos números atuais.
|
||||||
|
|
||||||
|
O que muda?
|
||||||
|
O CNPJ continuará com 14 caracteres.
|
||||||
|
Os 12 primeiros caracteres poderão conter letras (A-Z) e números (0-9).
|
||||||
|
Os 2 dígitos verificadores finais continuarão sendo numéricos.
|
||||||
|
Exemplo ilustrativo:
|
||||||
|
Atual: 00.000.000/0001-00
|
||||||
|
Novo: A1.B2C.3D4/EF56-78
|
||||||
|
Quem será afetado?
|
||||||
|
Empresas já existentes não terão seus CNPJs alterados.
|
||||||
|
A mudança vale apenas para novas inscrições realizadas a partir de julho de 2026.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const regexCnpjNumerico = /^\d{2}\.\d{3}\.\d{3}\/\d{4}-\d{2}$/
|
||||||
|
|
||||||
|
/**
|
||||||
|
Como ler o novo CNPJ (estrutura)
|
||||||
|
|
||||||
|
Tomando como exemplo um CNPJ alfanumérico fictício:
|
||||||
|
|
||||||
|
12.ABC.345/0001-67
|
||||||
|
|
||||||
|
Como ler:
|
||||||
|
|
||||||
|
12.ABC.345 é a raiz (identificação da empresa)
|
||||||
|
0001 é o sufixo (estabelecimento, geralmente “0001” para matriz)
|
||||||
|
67 são os dígitos verificadores numéricos
|
||||||
|
|
||||||
|
Pontos de atenção:
|
||||||
|
|
||||||
|
Letras maiúsculas (não há diferenciação entre maiúscula e minúscula no sistema, mas convenção é maiúscula)
|
||||||
|
Não usar caracteres especiais: só letras de A a Z e números de 0 a 9
|
||||||
|
Pontos, barra e hífen mantidos como antes
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
const regexCnpjAlfanumerico = /^[A-Z0-9]{2}\.[A-Z0-9]{3}\.[A-Z0-9]{3}\/[A-Z0-9]{4}-\d{2}$/i
|
||||||
|
const yyyymm = Number(new Date().toISOString().slice(0, 7).replace("-", ""))
|
||||||
|
|
||||||
|
export const zDocCnpj = z
|
||||||
|
.string()
|
||||||
|
.regex(yyyymm < 202407 ? regexCnpjNumerico : regexCnpjAlfanumerico)
|
||||||
|
.describe("Documento (CNPJ) no formato XX.XXX.XXX/XXXX-XX")
|
||||||
|
|
||||||
|
export const zDocCpf = z
|
||||||
|
.string()
|
||||||
|
.regex(/^\d{3}\.\d{3}\.\d{3}-\d{2}$/)
|
||||||
|
.describe("Documento (CPF) no formato XXX.XXX.XXX-XX")
|
||||||
|
|
||||||
|
export const zDocumento = zDocCpf.or(zDocCnpj).describe("CPF ou CNPJ")
|
||||||
Loading…
Add table
Add a link
Reference in a new issue