Compare commits

..

No commits in common. "master" and "master-biome-ia" have entirely different histories.

15 changed files with 1032 additions and 1104 deletions

View file

@ -45,7 +45,7 @@
"noExplicitAny": "off",
"noApproximativeNumericConstant": "off",
"noAsyncPromiseExecutor": "off",
"noEmptyBlockStatements": "off",
"noEmptyBlockStatements": "warn",
"noConsole": "off",
"noArrayIndexKey": "warn"
},
@ -62,7 +62,7 @@
"performance": {
"noAccumulatingSpread": "off",
"noDelete": "off"
"noDelete": "warn"
},
"a11y": {

View file

@ -1,16 +0,0 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var auditoria_exports = {};
module.exports = __toCommonJS(auditoria_exports);

View file

@ -1,58 +0,0 @@
"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 dayjs_exports = {};
__export(dayjs_exports, {
definirDayjsbr: () => definirDayjsbr
});
module.exports = __toCommonJS(dayjs_exports);
var import_duration = __toESM(require("dayjs/plugin/duration"));
var import_isSameOrAfter = __toESM(require("dayjs/plugin/isSameOrAfter"));
var import_isSameOrBefore = __toESM(require("dayjs/plugin/isSameOrBefore"));
var import_minMax = __toESM(require("dayjs/plugin/minMax"));
var import_relativeTime = __toESM(require("dayjs/plugin/relativeTime"));
var import_timezone = __toESM(require("dayjs/plugin/timezone"));
var import_utc = __toESM(require("dayjs/plugin/utc"));
var import_weekOfYear = __toESM(require("dayjs/plugin/weekOfYear"));
var import_pt_br = require("dayjs/locale/pt-br");
const definirDayjsbr = (dayjsEntrada) => {
dayjsEntrada.locale("pt-br");
dayjsEntrada.extend(import_utc.default);
dayjsEntrada.extend(import_timezone.default);
dayjsEntrada.extend(import_weekOfYear.default);
dayjsEntrada.extend(import_isSameOrBefore.default);
dayjsEntrada.extend(import_isSameOrAfter.default);
dayjsEntrada.extend(import_minMax.default);
dayjsEntrada.extend(import_relativeTime.default);
dayjsEntrada.extend(import_duration.default);
return dayjsEntrada;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
definirDayjsbr
});

View file

@ -16,7 +16,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
var index_exports = {};
module.exports = __toCommonJS(index_exports);
__reExport(index_exports, require("./aleatorio"), module.exports);
__reExport(index_exports, require("./auditoria"), module.exports);
__reExport(index_exports, require("./cacheMemoria"), module.exports);
__reExport(index_exports, require("./constantes"), module.exports);
__reExport(index_exports, require("./consulta"), module.exports);
@ -39,7 +38,6 @@ __reExport(index_exports, require("./variaveisComuns"), module.exports);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
...require("./aleatorio"),
...require("./auditoria"),
...require("./cacheMemoria"),
...require("./constantes"),
...require("./consulta"),

View file

@ -13,29 +13,6 @@ import { v4 } from 'uuid';
declare const aleatorio: (tamanho?: number) => string;
type TipoPayloadAuditoria = {
/** UUID do registro de auditoria */
codigo?: string | null;
/** UUID do usuario da acao (pode ser null se for processo do sistema que não registrou) */
usuario_criacao: string | null;
/** Timestamp ou data de criacao / execucao */
data_criacao: string | Date;
/** Nome exato da tabela no banco que originou o registro */
tabela_origem: string;
/** Código único (UUID) do registro na tabela original */
codigo_origem: string;
/** JSON contendo o snapshot das colunas novas / editadas */
novo: Record<string, any>;
/** JSON contendo o snapshot das colunas antes da edição */
anterior: Record<string, any>;
/** Hash ou controle de versao do item, usualmente preenchido por new.ver_seg */
__versao: string;
/** Tipo de operação que gerou a auditoria */
acao: "criar" | "atualizar" | "deletar" | string;
/** Versão do sistema no momento em que a ação ocorreu */
versao_sistema: string;
};
/** gerar uma função de cache para uso em memoria */
declare const cacheM: <T>(chave: any, valor?: T, validadeSeg?: number) => T | undefined;
declare const verCacheM: () => {
@ -560,4 +537,4 @@ declare const nomeVariavel: (v: {
[key: string]: any;
}) => string;
export { Produtos, TipagemRotas, type TipoPayloadAuditoria, agrupadores26, aleatorio, cacheM, cacheMFixo, cacheMemoria, camposComuns, criarFiltro26, defineDayjsBr, erUuid, esperar, extensoes, type interfaceConsulta, link_paiol, localValor, nomeVariavel, objetoPg, operadores, operadores26, paraObjetoRegistroPg, pgObjeto, siglas_unidades_medida, texto_busca, tipoArquivo, type tipoFiltro, type tipoFiltro26, tipoUsuarioResiduos, tiposSituacoesElicencie, tx, umaFuncao, umaVariavel, unidades_medida, uuid, uuidV3, uuidV4, uuid_null, validarUuid, verCacheM, zFiltro, zFiltro26, zOperadores };
export { Produtos, TipagemRotas, agrupadores26, aleatorio, cacheM, cacheMFixo, cacheMemoria, camposComuns, criarFiltro26, defineDayjsBr, erUuid, esperar, extensoes, type interfaceConsulta, link_paiol, localValor, nomeVariavel, objetoPg, operadores, operadores26, paraObjetoRegistroPg, pgObjeto, siglas_unidades_medida, texto_busca, tipoArquivo, type tipoFiltro, type tipoFiltro26, tipoUsuarioResiduos, tiposSituacoesElicencie, tx, umaFuncao, umaVariavel, unidades_medida, uuid, uuidV3, uuidV4, uuid_null, validarUuid, verCacheM, zFiltro, zFiltro26, zOperadores };

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{
"name": "p-comuns",
"version": "0.335.0",
"version": "0.323.0",
"description": "",
"main": "./dist-front/index.mjs",
"module": "./dist-front/index.mjs",
@ -17,8 +17,7 @@
"check": "pnpm run biome && npx tsc --noEmit",
"build": "npm --no-git-tag-version version minor && pnpm run biome && tsup --config ./tsup/tsup.config.ts && pnpm run pacote",
"teste": "npx vitest run src/testes/TipagemRotas.test.ts",
"pacote": "npm pack && npm pack && mv $(npm pack --silent) pacote.tgz",
"postinstall": "node ./scripts/atualizar-biome.js"
"pacote": "npm pack && npm pack && mv $(npm pack --silent) pacote.tgz"
},
"author": {
"name": "AZTECA SOFTWARE LTDA",
@ -28,10 +27,11 @@
"license": "ISC",
"dependencies": {},
"devDependencies": {
"cross-fetch": "4.1.0",
"uuid": "^11.1.0",
"zod": "4.3.6",
"dayjs": "^1.11.18",
"@biomejs/biome": "2.4.12",
"@biomejs/biome": "2.4.0",
"@types/node": "^22",
"tsup": "8.5.1",
"typescript": "^6",
@ -39,6 +39,7 @@
"vitest": "^3.2.4"
},
"peerDependencies": {
"cross-fetch": "4.1.0",
"dayjs": "^1.11.18",
"uuid": "^11.1.0",
"zod": "4.3.6"

Binary file not shown.

1856
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

View file

@ -1,96 +0,0 @@
const fs = require('node:fs');
const path = require('node:path');
const initCwd = process.env.INIT_CWD;
// Se não tiver INIT_CWD, não foi chamado pelo npm/pnpm install
if (!initCwd) {
process.exit(0);
}
// O próprio p-comuns não precisa se atualizar na sua pasta interna
if (initCwd === process.cwd()) {
process.exit(0);
}
const me = require('../package.json');
const biomeVersion = me.devDependencies && me.devDependencies['@biomejs/biome'];
if (!biomeVersion) {
process.exit(0);
}
/**
* os arquivos do diretório em busca de package.json
*/
function findPackageJson(dir) {
let results = [];
try {
const list = fs.readdirSync(dir);
for (const file of list) {
const filePath = path.join(dir, file);
const stat = fs.statSync(filePath);
if (stat && stat.isDirectory()) {
// Ignora pastas que não devemos varrer
if (
![
'node_modules',
'.git',
'dist',
'build',
'.nuxt',
'.output',
'.vscode',
'.idea',
].includes(file)
) {
results = results.concat(findPackageJson(filePath));
}
} else if (file === 'package.json') {
results.push(filePath);
}
}
} catch (err) {
// ignora pastas sem acesso
}
return results;
}
const files = findPackageJson(initCwd);
let updated = 0;
for (const file of files) {
try {
const content = fs.readFileSync(file, 'utf8');
// Detecta se usa tab ou espaço
const indent = content.match(/^[ \t]+/m) ? content.match(/^[ \t]+/m)[0] : '\t';
const json = JSON.parse(content);
let changed = false;
const updateDeps = (tipo) => {
if (json[tipo] && json[tipo]['@biomejs/biome']) {
if (json[tipo]['@biomejs/biome'] !== biomeVersion) {
json[tipo]['@biomejs/biome'] = biomeVersion;
changed = true;
}
}
};
updateDeps('dependencies');
updateDeps('devDependencies');
updateDeps('peerDependencies');
if (changed) {
fs.writeFileSync(file, JSON.stringify(json, null, indent) + '\n', 'utf8');
updated++;
console.log(`[p-comuns] @biomejs/biome atualizado para ${biomeVersion} em: ${path.relative(initCwd, file)}`);
}
} catch (e) {
console.error(`[p-comuns] Erro ao atualizar ${file}: ${e.message}`);
}
}
if (updated > 0) {
console.log(`[p-comuns] Total de package.json atualizados: ${updated}`);
}

View file

@ -1,31 +0,0 @@
export type TipoPayloadAuditoria = {
/** UUID do registro de auditoria */
codigo?: string | null
/** UUID do usuario da acao (pode ser null se for processo do sistema que não registrou) */
usuario_criacao: string | null
/** Timestamp ou data de criacao / execucao */
data_criacao: string | Date
/** Nome exato da tabela no banco que originou o registro */
tabela_origem: string
/** Código único (UUID) do registro na tabela original */
codigo_origem: string
/** JSON contendo o snapshot das colunas novas / editadas */
novo: Record<string, any>
/** JSON contendo o snapshot das colunas antes da edição */
anterior: Record<string, any>
/** Hash ou controle de versao do item, usualmente preenchido por new.ver_seg */
__versao: string
/** Tipo de operação que gerou a auditoria */
acao: "criar" | "atualizar" | "deletar" | string
/** Versão do sistema no momento em que a ação ocorreu */
versao_sistema: string
}

View file

@ -1,29 +0,0 @@
import type dayjs from "dayjs"
import type { Dayjs } from "dayjs"
export type { ManipulateType } from "dayjs"
import duration from "dayjs/plugin/duration"
import isSameOrAfter from "dayjs/plugin/isSameOrAfter"
import isSameOrBefore from "dayjs/plugin/isSameOrBefore"
import minMax from "dayjs/plugin/minMax"
import relativeTime from "dayjs/plugin/relativeTime"
import timezone from "dayjs/plugin/timezone"
import utc from "dayjs/plugin/utc"
import weekOfYear from "dayjs/plugin/weekOfYear"
import "dayjs/locale/pt-br"
export const definirDayjsbr = (dayjsEntrada: typeof dayjs) => {
dayjsEntrada.locale("pt-br")
dayjsEntrada.extend(utc)
dayjsEntrada.extend(timezone)
dayjsEntrada.extend(weekOfYear)
dayjsEntrada.extend(isSameOrBefore)
dayjsEntrada.extend(isSameOrAfter)
dayjsEntrada.extend(minMax)
dayjsEntrada.extend(relativeTime)
dayjsEntrada.extend(duration)
return dayjsEntrada
}
export type { Dayjs }

View file

@ -102,5 +102,6 @@ const defineDayjsBr = ({
return dayjs
}
export type { Dayjs }
export { defineDayjsBr }
export type { Dayjs }

View file

@ -1,5 +1,4 @@
export * from "./aleatorio"
export * from "./auditoria"
export * from "./cacheMemoria"
export * from "./constantes"
export * from "./consulta"

View file

@ -15,6 +15,7 @@
/* Módulos */
"moduleResolution": "bundler" /* Define como o TypeScript resolve módulos. */,
"ignoreDeprecations": "6.0" /* Ignora avisos de depreciação do TS 6.0 */,
"rootDir": "./src" /* Define a pasta raiz para os arquivos de origem. */,
/* Emissão */
@ -25,8 +26,7 @@
/* Verificação de Tipos */
"strict": true /* Habilita todas as opções de verificação estrita de tipos. */,
"skipLibCheck": true /* Ignora a verificação de tipos em arquivos de declaração de bibliotecas. */,
"ignoreDeprecations": "6.0"
"skipLibCheck": true /* Ignora a verificação de tipos em arquivos de declaração de bibliotecas. */
},
"include": [
"src/**/*"