tipagem audioria

This commit is contained in:
MarcioJRGodoi 2026-04-13 15:55:48 -03:00
parent bf5be3fc5c
commit b60bd3eef6
7 changed files with 70 additions and 2 deletions

16
dist-back/auditoria.js Normal file
View file

@ -0,0 +1,16 @@
"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

@ -16,6 +16,7 @@ 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);
@ -38,6 +39,7 @@ __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

@ -5,6 +5,27 @@ import { v4 } from 'uuid';
declare const aleatorio: (tamanho?: number) => string;
type TipoPayloadAuditoria = {
/** 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: () => {
@ -312,4 +333,4 @@ declare const nomeVariavel: (v: {
[key: string]: any;
}) => string;
export { Produtos, TipagemRotas, type TipoLoggerSessao, aleatorio, cacheM, cacheMFixo, cacheMemoria, camposComuns, dayjsbr, defineCwd, erUuid, esperar, extensoes, type interfaceConsulta, link_paiol, localValor, logger, nomeVariavel, objetoPg, operadores, paraObjetoRegistroPg, pgObjeto, postLogger, siglas_unidades_medida, texto_busca, tipoArquivo, type tipoFiltro, type tipoLogger, type tipoLoggerLog, type tipoLokiObjeto, tipoUsuarioResiduos, tx, umaFuncao, umaVariavel, unidades_medida, uuid, uuidV3, uuidV4, uuid_null, validarUuid, verCacheM, zFiltro, zOperadores };
export { Produtos, TipagemRotas, type TipoLoggerSessao, type TipoPayloadAuditoria, aleatorio, cacheM, cacheMFixo, cacheMemoria, camposComuns, dayjsbr, defineCwd, erUuid, esperar, extensoes, type interfaceConsulta, link_paiol, localValor, logger, nomeVariavel, objetoPg, operadores, paraObjetoRegistroPg, pgObjeto, postLogger, siglas_unidades_medida, texto_busca, tipoArquivo, type tipoFiltro, type tipoLogger, type tipoLoggerLog, type tipoLokiObjeto, tipoUsuarioResiduos, tx, umaFuncao, umaVariavel, unidades_medida, uuid, uuidV3, uuidV4, uuid_null, validarUuid, verCacheM, zFiltro, zOperadores };

View file

@ -1,6 +1,6 @@
{
"name": "p-comuns",
"version": "0.297.0",
"version": "0.298.0",
"description": "",
"main": "./dist-front/index.mjs",
"module": "./dist-front/index.mjs",

Binary file not shown.

28
src/auditoria.ts Normal file
View file

@ -0,0 +1,28 @@
export type TipoPayloadAuditoria = {
/** 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,4 +1,5 @@
export * from "./aleatorio"
export * from "./auditoria"
export * from "./cacheMemoria"
export * from "./constantes"
export * from "./consulta"