diff --git a/dist-back/aleatorio.js b/dist-back/aleatorio.js new file mode 100644 index 0000000..1566283 --- /dev/null +++ b/dist-back/aleatorio.js @@ -0,0 +1,29 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var aleatorio_exports = {}; +__export(aleatorio_exports, { + aleatorio: () => aleatorio +}); +module.exports = __toCommonJS(aleatorio_exports); +const alfabeto = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""); +const aleatorio = (tamanho) => `eli-${Array.from({ length: tamanho || 8 }).map(() => alfabeto[(999 * Math.random() | 0) % alfabeto.length]).join("")}`; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + aleatorio +}); diff --git a/dist-back/cacheMemoria.js b/dist-back/cacheMemoria.js new file mode 100644 index 0000000..7c004f4 --- /dev/null +++ b/dist-back/cacheMemoria.js @@ -0,0 +1,53 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var cacheMemoria_exports = {}; +__export(cacheMemoria_exports, { + cacheM: () => cacheM, + cacheMFixo: () => cacheMFixo, + cacheMemoria: () => cacheMemoria, + verCacheM: () => verCacheM +}); +module.exports = __toCommonJS(cacheMemoria_exports); +const _cache = {}; +globalThis.cacheMemoria_cache = _cache; +const cacheM = (chave, valor, validadeSeg) => { + const txChave = typeof chave == "string" ? chave : typeof chave == "number" ? String(chave) : encodeURIComponent(JSON.stringify(chave)); + const validade = validadeSeg && (/* @__PURE__ */ new Date()).getTime() + validadeSeg * 1e3; + if (valor !== void 0) { + _cache[txChave] = { + valor, + validade + }; + } + const busca = _cache[txChave]; + if (busca?.validade && busca.validade < (/* @__PURE__ */ new Date()).getTime()) { + return void 0; + } + return busca?.valor; +}; +const verCacheM = () => _cache; +const cacheMemoria = cacheM; +const cacheMFixo = (chave) => (valor) => cacheM(chave, valor); +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + cacheM, + cacheMFixo, + cacheMemoria, + verCacheM +}); diff --git a/dist-back/constantes.js b/dist-back/constantes.js new file mode 100644 index 0000000..4671769 --- /dev/null +++ b/dist-back/constantes.js @@ -0,0 +1,53 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var constantes_exports = {}; +__export(constantes_exports, { + camposComuns: () => camposComuns, + tipoUsuarioResiduos: () => tipoUsuarioResiduos, + tx: () => tx, + uuid_null: () => uuid_null +}); +module.exports = __toCommonJS(constantes_exports); +const uuid_null = "00000000-0000-0000-0000-000000000000"; +var camposComuns = /* @__PURE__ */ ((camposComuns2) => { + camposComuns2["codigo"] = "codigo"; + camposComuns2["excluido"] = "excluido"; + camposComuns2["data_hora_criacao"] = "data_hora_criacao"; + camposComuns2["data_hora_atualizacao"] = "data_hora_atualizacao"; + camposComuns2["codigo_usuario_criacao"] = "codigo_usuario_criacao"; + camposComuns2["codigo_usuario_atualizacao"] = "codigo_usuario_atualizacao"; + camposComuns2["versao"] = "versao"; + return camposComuns2; +})(camposComuns || {}); +var tx = /* @__PURE__ */ ((tx2) => { + tx2["token"] = "token"; + return tx2; +})(tx || {}); +var tipoUsuarioResiduos = /* @__PURE__ */ ((tipoUsuarioResiduos2) => { + tipoUsuarioResiduos2["Usuario"] = "usuario"; + tipoUsuarioResiduos2["Fornecedor"] = "fornecedor"; + return tipoUsuarioResiduos2; +})(tipoUsuarioResiduos || {}); +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + camposComuns, + tipoUsuarioResiduos, + tx, + uuid_null +}); diff --git a/dist-back/consulta.js b/dist-back/consulta.js new file mode 100644 index 0000000..7d923ff --- /dev/null +++ b/dist-back/consulta.js @@ -0,0 +1,69 @@ +"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 consulta_exports = {}; +__export(consulta_exports, { + operadores: () => operadores, + zFiltro: () => zFiltro, + zOperadores: () => zOperadores +}); +module.exports = __toCommonJS(consulta_exports); +var import_zod = __toESM(require("zod"), 1); +var operadores = /* @__PURE__ */ ((operadores2) => { + operadores2["="] = "="; + operadores2["!="] = "!="; + operadores2[">"] = ">"; + operadores2[">="] = ">="; + operadores2["<"] = "<"; + operadores2["<="] = "<="; + operadores2["like"] = "like"; + operadores2["in"] = "in"; + return operadores2; +})(operadores || {}); +const zOperadores = import_zod.default.enum([ + "=", + "!=", + ">", + ">=", + "<", + "<=", + "like", + "in" +]); +const zFiltro = import_zod.default.object({ + coluna: import_zod.default.string(), + valor: import_zod.default.any(), + operador: zOperadores, + ou: import_zod.default.boolean().optional() +}); +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + operadores, + zFiltro, + zOperadores +}); diff --git a/dist-back/dayjs.js b/dist-back/dayjs.js new file mode 100644 index 0000000..5149cd1 --- /dev/null +++ b/dist-back/dayjs.js @@ -0,0 +1,57 @@ +"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, { + dayjsbr: () => dayjsbr +}); +module.exports = __toCommonJS(dayjs_exports); +var import_dayjs = __toESM(require("dayjs"), 1); +var import_duration = __toESM(require("dayjs/plugin/duration.js"), 1); +var import_isSameOrAfter = __toESM(require("dayjs/plugin/isSameOrAfter.js"), 1); +var import_isSameOrBefore = __toESM(require("dayjs/plugin/isSameOrBefore.js"), 1); +var import_minMax = __toESM(require("dayjs/plugin/minMax.js"), 1); +var import_relativeTime = __toESM(require("dayjs/plugin/relativeTime.js"), 1); +var import_timezone = __toESM(require("dayjs/plugin/timezone.js"), 1); +var import_utc = __toESM(require("dayjs/plugin/utc.js"), 1); +var import_weekOfYear = __toESM(require("dayjs/plugin/weekOfYear.js"), 1); +var import_pt_br = require("dayjs/locale/pt-br.js"); +import_dayjs.default.locale("pt-br"); +import_dayjs.default.extend(import_utc.default); +import_dayjs.default.extend(import_timezone.default); +import_dayjs.default.extend(import_weekOfYear.default); +import_dayjs.default.extend(import_isSameOrBefore.default); +import_dayjs.default.extend(import_isSameOrAfter.default); +import_dayjs.default.extend(import_minMax.default); +import_dayjs.default.extend(import_relativeTime.default); +import_dayjs.default.extend(import_duration.default); +const dayjsbr = import_dayjs.default; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + dayjsbr +}); diff --git a/dist-back/ecosistema/index.js b/dist-back/ecosistema/index.js new file mode 100644 index 0000000..fc9ce97 --- /dev/null +++ b/dist-back/ecosistema/index.js @@ -0,0 +1,22 @@ +"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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var ecosistema_exports = {}; +module.exports = __toCommonJS(ecosistema_exports); +__reExport(ecosistema_exports, require("./urls"), module.exports); +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + ...require("./urls") +}); diff --git a/dist-back/ecosistema/urls.js b/dist-back/ecosistema/urls.js new file mode 100644 index 0000000..e63a7bd --- /dev/null +++ b/dist-back/ecosistema/urls.js @@ -0,0 +1,28 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var urls_exports = {}; +__export(urls_exports, { + cdn_carro_de_boi: () => cdn_carro_de_boi +}); +module.exports = __toCommonJS(urls_exports); +const cdn_carro_de_boi = "https://carro-de-boi-idz-one.b-cdn.net"; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + cdn_carro_de_boi +}); diff --git a/dist-back/extensoes.js b/dist-back/extensoes.js new file mode 100644 index 0000000..3f49f81 --- /dev/null +++ b/dist-back/extensoes.js @@ -0,0 +1,186 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var extensoes_exports = {}; +__export(extensoes_exports, { + extensoes: () => extensoes, + tipoArquivo: () => tipoArquivo +}); +module.exports = __toCommonJS(extensoes_exports); +const extensoes = [ + { + ext: "gif", + tipo: "imagem", + mime: "image/gif" + }, + { + ext: "jpg", + tipo: "imagem", + mime: "image/jpeg" + }, + { + ext: "jpeg", + tipo: "imagem", + mime: "image/jpeg" + }, + { + ext: "png", + tipo: "imagem", + mime: "image/png" + }, + { + ext: "bmp", + tipo: "imagem", + mime: "image/bmp" + }, + { + ext: "webp", + tipo: "imagem", + mime: "image/webp" + }, + { + ext: "tiff", + tipo: "imagem", + mime: "image/tiff" + }, + { + ext: "svg", + tipo: "imagem", + mime: "image/svg+xml" + }, + { + ext: "ico", + tipo: "imagem", + mime: "image/x-icon" + }, + { + ext: "pdf", + tipo: "documento", + mime: "application/pdf" + }, + { + ext: "doc", + tipo: "documento", + mime: "application/msword" + }, + { + ext: "docx", + tipo: "documento", + mime: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" + }, + { + ext: "xls", + tipo: "documento", + mime: "application/vnd.ms-excel" + }, + { + ext: "xlsx", + tipo: "documento", + mime: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + }, + { + ext: "ppt", + tipo: "documento", + mime: "application/vnd.ms-powerpoint" + }, + { + ext: "pptx", + tipo: "documento", + mime: "application/vnd.openxmlformats-officedocument.presentationml.presentation" + }, + { + ext: "txt", + tipo: "documento", + mime: "text/plain" + }, + { + ext: "odt", + tipo: "documento", + mime: "application/vnd.oasis.opendocument.text" + }, + { + ext: "ods", + tipo: "documento", + mime: "application/vnd.oasis.opendocument.spreadsheet" + }, + { + ext: "rtf", + tipo: "documento", + mime: "application/rtf" + }, + { + ext: "csv", + tipo: "documento", + mime: "text/csv" + }, + { + ext: "mp4", + tipo: "v\xEDdeo", + mime: "video/mp4" + }, + { + ext: "avi", + tipo: "v\xEDdeo", + mime: "video/x-msvideo" + }, + { + ext: "mkv", + tipo: "v\xEDdeo", + mime: "video/x-matroska" + }, + { + ext: "mov", + tipo: "v\xEDdeo", + mime: "video/quicktime" + }, + { + ext: "wmv", + tipo: "v\xEDdeo", + mime: "video/x-ms-wmv" + }, + { + ext: "flv", + tipo: "v\xEDdeo", + mime: "video/x-flv" + }, + { + ext: "webm", + tipo: "v\xEDdeo", + mime: "video/webm" + }, + { + ext: "3gp", + tipo: "v\xEDdeo", + mime: "video/3gpp" + }, + { + ext: "mpeg", + tipo: "v\xEDdeo", + mime: "video/mpeg" + } +]; +const tipoArquivo = (nomeArquivo) => { + const extArquivo = String(nomeArquivo || "").toLocaleLowerCase().split(".").pop(); + const extensao = extensoes.find((extensao2) => extensao2.ext === extArquivo); + return extensao?.tipo || "outros"; +}; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + extensoes, + tipoArquivo +}); diff --git a/dist-back/graficosPilao.js b/dist-back/graficosPilao.js new file mode 100644 index 0000000..12ac7cb --- /dev/null +++ b/dist-back/graficosPilao.js @@ -0,0 +1,37 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var graficosPilao_exports = {}; +__export(graficosPilao_exports, { + graficos_pilao: () => graficos_pilao +}); +module.exports = __toCommonJS(graficosPilao_exports); +const graficos_pilao = { + Condicionantes: { + grafico: "condicionantes-criadas", + titulo: "Condicionantes Criadas" + }, + Licen\u00E7as: { + grafico: "licencas-criadas", + titulo: "Licen\xE7as Criadas" + } +}; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + graficos_pilao +}); diff --git a/dist-back/index.js b/dist-back/index.js new file mode 100644 index 0000000..0edcbbf --- /dev/null +++ b/dist-back/index.js @@ -0,0 +1,62 @@ +"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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var index_exports = {}; +module.exports = __toCommonJS(index_exports); +__reExport(index_exports, require("./aleatorio"), module.exports); +__reExport(index_exports, require("./cacheMemoria"), module.exports); +__reExport(index_exports, require("./constantes"), module.exports); +__reExport(index_exports, require("./consulta"), module.exports); +__reExport(index_exports, require("./dayjs"), module.exports); +__reExport(index_exports, require("./ecosistema"), module.exports); +__reExport(index_exports, require("./extensoes"), module.exports); +__reExport(index_exports, require("./extensoes"), module.exports); +__reExport(index_exports, require("./graficosPilao"), module.exports); +__reExport(index_exports, require("./local"), module.exports); +__reExport(index_exports, require("./logger"), module.exports); +__reExport(index_exports, require("./logger"), module.exports); +__reExport(index_exports, require("./postgres"), module.exports); +__reExport(index_exports, require("./situacoes"), module.exports); +__reExport(index_exports, require("./testes-de-variaveis"), module.exports); +__reExport(index_exports, require("./texto_busca"), module.exports); +__reExport(index_exports, require("./tipagemRotas"), module.exports); +__reExport(index_exports, require("./tipagemRotas"), module.exports); +__reExport(index_exports, require("./unidades_medida"), module.exports); +__reExport(index_exports, require("./uuid"), module.exports); +__reExport(index_exports, require("./variaveisComuns"), module.exports); +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + ...require("./aleatorio"), + ...require("./cacheMemoria"), + ...require("./constantes"), + ...require("./consulta"), + ...require("./dayjs"), + ...require("./ecosistema"), + ...require("./extensoes"), + ...require("./extensoes"), + ...require("./graficosPilao"), + ...require("./local"), + ...require("./logger"), + ...require("./logger"), + ...require("./postgres"), + ...require("./situacoes"), + ...require("./testes-de-variaveis"), + ...require("./texto_busca"), + ...require("./tipagemRotas"), + ...require("./tipagemRotas"), + ...require("./unidades_medida"), + ...require("./uuid"), + ...require("./variaveisComuns") +}); diff --git a/dist-back/instalarAmbiente.js b/dist-back/instalarAmbiente.js new file mode 100644 index 0000000..7772b1d --- /dev/null +++ b/dist-back/instalarAmbiente.js @@ -0,0 +1,63 @@ +"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 __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 import_node_fs = __toESM(require("node:fs"), 1); +var import_node_path = __toESM(require("node:path"), 1); +const mesclar = (entrada, novo) => { + const saida = { ...entrada || {} }; + for (const [k, v] of Object.entries(novo)) { + if (v && typeof v === "object" && !Array.isArray(v)) { + saida[k] = mesclar(saida[k], v); + } else { + saida[k] = v; + } + } + return saida; +}; +const abrirJson = (caminho) => { + try { + return JSON.parse(import_node_fs.default.readFileSync(caminho, "utf-8")); + } catch { + return {}; + } +}; +const settings_json = { + "editor.defaultFormatter": "biomejs.biome", + "[javascript]": { "editor.defaultFormatter": "biomejs.biome" }, + "[javascriptreact]": { "editor.defaultFormatter": "biomejs.biome" }, + "[typescript]": { "editor.defaultFormatter": "biomejs.biome" }, + "[typescriptreact]": { "editor.defaultFormatter": "biomejs.biome" }, + "[json]": { "editor.defaultFormatter": "biomejs.biome" }, + "[jsonc]": { "editor.defaultFormatter": "biomejs.biome" }, + "[vue]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, + "editor.codeActionsOnSave": { + "source.organizeImports.biome": "always", + "source.fixAll.biome": "always" + } +}; +const caminhoSeting = import_node_path.default.join(process.cwd(), ".vscode/settings.json"); +import_node_fs.default.mkdirSync(import_node_path.default.dirname(caminhoSeting), { recursive: true }); +const atual = abrirJson(caminhoSeting); +const final = mesclar(atual, settings_json); +import_node_fs.default.writeFileSync(caminhoSeting, JSON.stringify(final, null, 2), "utf8"); +console.log(`\u2705 Configura\xE7\xF5es salvas em ${caminhoSeting}`); diff --git a/dist-back/local/index.js b/dist-back/local/index.js new file mode 100644 index 0000000..4b0c95a --- /dev/null +++ b/dist-back/local/index.js @@ -0,0 +1,46 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var local_exports = {}; +__export(local_exports, { + localValor: () => localValor +}); +module.exports = __toCommonJS(local_exports); +const localValor = (chave_, valor) => { + const localStorage = globalThis.localStorage; + if (typeof localStorage == "undefined") return null; + const chave = typeof chave_ === "string" ? chave_ : encodeURIComponent(JSON.stringify(chave_)); + try { + if (valor !== void 0) { + localStorage.setItem(chave, JSON.stringify(valor)); + } + const v2 = localStorage.getItem(chave); + if (v2 === null) return null; + try { + return JSON.parse(v2); + } catch { + return v2; + } + } catch { + return null; + } +}; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + localValor +}); diff --git a/dist-back/logger.js b/dist-back/logger.js new file mode 100644 index 0000000..0283d3f --- /dev/null +++ b/dist-back/logger.js @@ -0,0 +1,106 @@ +"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 logger_exports = {}; +__export(logger_exports, { + defineCwd: () => defineCwd, + logger: () => logger, + postLogger: () => postLogger +}); +module.exports = __toCommonJS(logger_exports); +var import_cross_fetch = __toESM(require("cross-fetch"), 1); +var import_variaveisComuns = require("./variaveisComuns"); +const LOKI_BASE_URL = "https://log.idz.one"; +const LOKI_ENDPOINT = "/loki/api/v1/push"; +const postLogger = async ({ + objeto +}) => { + const response = await (0, import_cross_fetch.default)(`${LOKI_BASE_URL}${LOKI_ENDPOINT}`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(objeto) + }).catch((a) => a); + if (!response.ok) { + return [objeto, `Erro ${response.status}: ${await response?.text?.()}`]; + } + return [objeto]; +}; +let cwd = ""; +const defineCwd = (novoCwd) => { + cwd = novoCwd; +}; +const logger = ({ app: app_e, eProducao, parametros: parametrosAmbiente }) => ({ inquilino, usuario, parametros: parametrosSessao }) => async (level, mensagem, op_tipoLog) => { + let { + __filename, + detalhes, + local, + parametros: parametrosLog + } = op_tipoLog || {}; + const app = `${eProducao ? "" : "DEV-"}${app_e}`; + if (cwd && __filename) { + __filename = __filename.replace(cwd, ""); + } + if (local) { + detalhes = [`${(0, import_variaveisComuns.nomeVariavel)({ local })}="${local}"`, ...detalhes || []]; + } + if (__filename) { + detalhes = [ + `${(0, import_variaveisComuns.nomeVariavel)({ __filename })}="${__filename}"`, + ...detalhes || [] + ]; + } + const timestamp = `${Date.now()}000000`; + const mainLog = detalhes?.length ? `${mensagem} | ${detalhes.map((d) => JSON.stringify(d)).join(" | ")}` : mensagem; + const payload = { + stream: { + app, + inquilino, + usuario, + level, + ...parametrosAmbiente || {}, + ...parametrosSessao || {}, + ...parametrosLog || {} + }, + values: [ + [ + timestamp, + mainLog + // Linha de log direta + ] + ] + }; + const objeto = { streams: [payload] }; + const response = await postLogger({ objeto }); + return response; +}; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + defineCwd, + logger, + postLogger +}); diff --git a/dist-back/postgres.js b/dist-back/postgres.js new file mode 100644 index 0000000..62a7d6b --- /dev/null +++ b/dist-back/postgres.js @@ -0,0 +1,47 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var postgres_exports = {}; +__export(postgres_exports, { + objetoPg: () => objetoPg, + paraObjetoRegistroPg: () => paraObjetoRegistroPg, + pgObjeto: () => pgObjeto +}); +module.exports = __toCommonJS(postgres_exports); +const paraObjetoRegistroPg = (entrada) => { + try { + return Object.fromEntries( + Object.entries(entrada).map(([k, v]) => [ + k, + v === void 0 || v == null ? v : typeof v == "string" || typeof v == "number" || typeof v == "boolean" ? v : JSON.stringify(v, null, 2) + ]) + ); + } catch (error) { + throw new Error( + `Erro na fun\xE7\xE3o paraObjetoRegistroPg: ${error.message} ${error.stack}` + ); + } +}; +const pgObjeto = paraObjetoRegistroPg; +const objetoPg = paraObjetoRegistroPg; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + objetoPg, + paraObjetoRegistroPg, + pgObjeto +}); diff --git a/dist-back/situacoes/index.js b/dist-back/situacoes/index.js new file mode 100644 index 0000000..b7ebd74 --- /dev/null +++ b/dist-back/situacoes/index.js @@ -0,0 +1,22 @@ +"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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var situacoes_exports = {}; +module.exports = __toCommonJS(situacoes_exports); +__reExport(situacoes_exports, require("./situacoes"), module.exports); +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + ...require("./situacoes") +}); diff --git a/dist-back/situacoes/situacoes.js b/dist-back/situacoes/situacoes.js new file mode 100644 index 0000000..61b5e5f --- /dev/null +++ b/dist-back/situacoes/situacoes.js @@ -0,0 +1,84 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var situacoes_exports = {}; +__export(situacoes_exports, { + corSituacoes: () => corSituacoes, + tiposSituacoes: () => tiposSituacoes +}); +module.exports = __toCommonJS(situacoes_exports); +var tiposSituacoes = /* @__PURE__ */ ((tiposSituacoes2) => { + tiposSituacoes2["vencida"] = "100_vencida"; + tiposSituacoes2["expirado"] = "200_expirado"; + tiposSituacoes2["alerta"] = "300_alerta"; + tiposSituacoes2["protocoladafora"] = "350_protocoladafora"; + tiposSituacoes2["protocolada"] = "400_protocolada"; + tiposSituacoes2["protocoladaApenas"] = "430_protocolada"; + tiposSituacoes2["protocolada_alteracao"] = "450_protocolada"; + tiposSituacoes2["prazo"] = "500_prazo"; + tiposSituacoes2["emitida"] = "515_emitida"; + tiposSituacoes2["valida"] = "518_valida"; + tiposSituacoes2["novo"] = "520_novo"; + tiposSituacoes2["recebido"] = "521_recebido"; + tiposSituacoes2["em_andamento"] = "530_em_andamento"; + tiposSituacoes2["aguardando"] = "530_aguardando"; + tiposSituacoes2["aguardandoresposta"] = "540_aguardandoresposta"; + tiposSituacoes2["suspensaotemporaria"] = "540_suspensaotemporaria"; + tiposSituacoes2["cancelada"] = "550_cancelada"; + tiposSituacoes2["execucao"] = "560_execucao"; + tiposSituacoes2["pendente"] = "570_pendente"; + tiposSituacoes2["executadafora"] = "600_executadafora"; + tiposSituacoes2["executada"] = "700_executada"; + tiposSituacoes2["naoexecutada"] = "701_naoexecutada"; + tiposSituacoes2["concluida"] = "730_concluida"; + tiposSituacoes2["respondido_negado"] = "740_respondido_negado"; + tiposSituacoes2["respondido_aceito"] = "741_respondido_aceito"; + tiposSituacoes2["atendidoparcial"] = "742_atendidoparcial"; + tiposSituacoes2["naoatendido"] = "743_naoatendido"; + tiposSituacoes2["atendido"] = "744_atendido"; + tiposSituacoes2["renovada"] = "760_renovada"; + tiposSituacoes2["finalizada"] = "800_finalizada"; + tiposSituacoes2["emitirnota"] = "101_emitirnota"; + tiposSituacoes2["faturaatrasada"] = "301_faturaatrasada"; + tiposSituacoes2["pagarfatura"] = "302_pagarfatura"; + tiposSituacoes2["aguardandoconfirmacao"] = "531_aguardandoconfirmacao"; + tiposSituacoes2["agendado"] = "701_agendado"; + tiposSituacoes2["faturapaga"] = "801_faturapaga"; + tiposSituacoes2["excluida"] = "999_excluida"; + tiposSituacoes2["requerida"] = "401_requerida"; + tiposSituacoes2["vigente"] = "516_vigente"; + tiposSituacoes2["emrenovacao"] = "402_emrenovacao"; + tiposSituacoes2["arquivada"] = "801_arquivada"; + tiposSituacoes2["aguardando_sincronizacao"] = "999_aguardando_sincronizacao"; + tiposSituacoes2["nao_conforme"] = "710_nao_conforme"; + tiposSituacoes2["conforme"] = "720_conforme"; + tiposSituacoes2["nao_aplicavel"] = "730_nao_aplicavel"; + tiposSituacoes2["parcial"] = "715_parcial"; + return tiposSituacoes2; +})(tiposSituacoes || {}); +const corSituacoes = { + pendente: "#CCC353", + nao_conforme: "#dc3545", + conforme: "#28a745", + alerta: "#FFDE59" +}; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + corSituacoes, + tiposSituacoes +}); diff --git a/dist-back/teste.js b/dist-back/teste.js new file mode 100644 index 0000000..c2d0e9c --- /dev/null +++ b/dist-back/teste.js @@ -0,0 +1,6 @@ +"use strict"; +var import_cacheMemoria = require("./cacheMemoria"); +var import_texto_busca = require("./texto_busca"); +console.log("Vari\xE1veis funcionando", import_texto_busca.texto_busca); +(0, import_cacheMemoria.cacheM)(1, { Jaca: Promise.resolve() }); +console.log("cache:", (0, import_cacheMemoria.cacheM)(1)); diff --git a/dist-back/testes-de-variaveis/index.js b/dist-back/testes-de-variaveis/index.js new file mode 100644 index 0000000..6263622 --- /dev/null +++ b/dist-back/testes-de-variaveis/index.js @@ -0,0 +1,24 @@ +"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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var testes_de_variaveis_exports = {}; +module.exports = __toCommonJS(testes_de_variaveis_exports); +__reExport(testes_de_variaveis_exports, require("./umaFuncao"), module.exports); +__reExport(testes_de_variaveis_exports, require("./umaVariavel"), module.exports); +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + ...require("./umaFuncao"), + ...require("./umaVariavel") +}); diff --git a/dist-back/testes-de-variaveis/umaFuncao.js b/dist-back/testes-de-variaveis/umaFuncao.js new file mode 100644 index 0000000..c1d2b86 --- /dev/null +++ b/dist-back/testes-de-variaveis/umaFuncao.js @@ -0,0 +1,28 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var umaFuncao_exports = {}; +__export(umaFuncao_exports, { + umaFuncao: () => umaFuncao +}); +module.exports = __toCommonJS(umaFuncao_exports); +const umaFuncao = () => "Ol\xE1 Mundo! (fun\xE7\xE3o)"; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + umaFuncao +}); diff --git a/dist-back/testes-de-variaveis/umaVariavel.js b/dist-back/testes-de-variaveis/umaVariavel.js new file mode 100644 index 0000000..6560bb5 --- /dev/null +++ b/dist-back/testes-de-variaveis/umaVariavel.js @@ -0,0 +1,28 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var umaVariavel_exports = {}; +__export(umaVariavel_exports, { + umaVariavel: () => umaVariavel +}); +module.exports = __toCommonJS(umaVariavel_exports); +const umaVariavel = "Ol\xE1 Mundo! (vari\xE1vel)"; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + umaVariavel +}); diff --git a/dist-back/testes/TipagemRotas.test.js b/dist-back/testes/TipagemRotas.test.js new file mode 100644 index 0000000..49b4bbb --- /dev/null +++ b/dist-back/testes/TipagemRotas.test.js @@ -0,0 +1,22 @@ +"use strict"; +var import_vitest = require("vitest"); +var import_tipagemRotas = require("../tipagemRotas"); +(0, import_vitest.describe)("TipagemRotas", () => { + (0, import_vitest.it)("deve montar _partesCaminho a partir de string ou array, normalizando barras", () => { + const r1 = new import_tipagemRotas.TipagemRotas({ caminho: "aplicacao/func" }); + (0, import_vitest.expect)(r1.caminho).toBe("/aplicacao/func"); + const r2 = new import_tipagemRotas.TipagemRotas({ + caminho: ["aplicacao", "func"] + }); + (0, import_vitest.expect)(r2.caminho).toBe("/aplicacao/func"); + const r3 = new import_tipagemRotas.TipagemRotas({ caminho: "/a//b///c/" }); + (0, import_vitest.expect)(r3.caminho).toBe("/a/b/c"); + }); + (0, import_vitest.it)("Valores de entrada com mesmo valor dos valores de sa\xEDda", () => { + const r1 = new import_tipagemRotas.TipagemRotas({ caminho: "aplicacao/func" }); + const objetoEntrada = { idade: 21, nome: "Jo\xE3o" }; + const rota = r1.endereco(objetoEntrada); + const parametros = r1.parametros(rota); + (0, import_vitest.expect)(parametros.nome).toBe(objetoEntrada.nome); + }); +}); diff --git a/dist-back/texto_busca.js b/dist-back/texto_busca.js new file mode 100644 index 0000000..3d0ec36 --- /dev/null +++ b/dist-back/texto_busca.js @@ -0,0 +1,30 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var texto_busca_exports = {}; +__export(texto_busca_exports, { + texto_busca: () => texto_busca +}); +module.exports = __toCommonJS(texto_busca_exports); +const texto_busca = (...texto) => texto.map( + (txt) => txt === null || txt === void 0 ? "" : String(txt).normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/\s+/g, " ").toLowerCase() +).join(" "); +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + texto_busca +}); diff --git a/dist-back/tipagemRotas.js b/dist-back/tipagemRotas.js new file mode 100644 index 0000000..05c4f5b --- /dev/null +++ b/dist-back/tipagemRotas.js @@ -0,0 +1,118 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var tipagemRotas_exports = {}; +__export(tipagemRotas_exports, { + TipagemRotas: () => TipagemRotas +}); +module.exports = __toCommonJS(tipagemRotas_exports); +class TipagemRotas { + /** Ao criar novo obijeto de tipagem de rota é necessário passar o caminho parcial + ** export const mCaminho = new TipagemRotas<{q:string}>("aplicacao","funcionalidade") + */ + constructor({ + caminho, + acaoIr, + rotulo + }) { + this._partesCaminho = []; + this._acaoIr = acaoIr; + this._partesCaminho = (Array.isArray(caminho) ? caminho : [caminho]).filter(Boolean).map((a) => String(a)).flatMap((a) => a.split("/")).filter(Boolean); + this.rotulo = rotulo; + } + /** Retorna o caminho completo da rota + ** console.log(mCaminho.caminho) + ** "/caminho" + */ + get caminho() { + const ret = `/${this._partesCaminho.join("/")}`; + return ret; + } + /** Define o caminho completo da rota + ** mCaminho.caminho = "/novoCaminho" + ** console.log(mCaminho.caminho) + ** "/novoCaminho" + ** */ + set caminho(caminhoParcial) { + this._partesCaminho = caminhoParcial.split("/").filter((parte) => parte); + } + /** Retorna o caminho completo da rota com a query + ** console.log(mCaminho.resolve({q:"query"})) + ** "http://localhost:3000/caminho?q=query" + */ + endereco(query, usarComoHash) { + const url = new URL( + typeof window !== "undefined" ? window.location.href : "http://localhost" + ); + url.pathname = this.caminho; + url.search = ""; + const queryKeys = Object.entries(query); + for (const [key, value] of queryKeys) { + url.searchParams.set(String(key), JSON.stringify(value)); + } + url.hash = ""; + if (usarComoHash) { + url.hash = `#${url.search}`; + url.search = ""; + } + return url.href; + } + /** Vai para a url + ** mCaminho.ir({q:"query"}) + ** window.location.href = "http://localhost:3000/caminho?q=query" + */ + ir(query) { + if (this._acaoIr) { + this._acaoIr(this.endereco({ ...query })); + } else { + if (typeof window != "undefined") { + window.location.href = this.endereco({ ...query }); + } + } + } + /** Retorna os parametros da url + ** console.log(mCaminho.parametros()) + ** {q:"query"} + */ + parametros(urlEntrada) { + const url = urlEntrada ? new URL(urlEntrada) : new URL( + typeof window !== "undefined" ? window.location.href : "http://localhost" + ); + const query = url.searchParams; + let queryObj = Object.fromEntries(query.entries()); + const hash = url.hash; + if (hash) { + const hashObj = Object.fromEntries( + new URLSearchParams(hash.slice(1)).entries() + ); + queryObj = { ...queryObj, ...hashObj }; + } + for (const chave in queryObj) { + try { + queryObj[chave] = JSON.parse(queryObj[chave]); + } catch { + console.log(`[${chave}|${queryObj[chave]}] n\xE3o \xE9 um json v\xE1lido.`); + } + } + return queryObj; + } +} +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + TipagemRotas +}); diff --git a/dist-back/unidades_medida.js b/dist-back/unidades_medida.js new file mode 100644 index 0000000..1d9b95a --- /dev/null +++ b/dist-back/unidades_medida.js @@ -0,0 +1,82 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var unidades_medida_exports = {}; +__export(unidades_medida_exports, { + siglas_unidades_medida: () => siglas_unidades_medida, + unidades_medida: () => unidades_medida +}); +module.exports = __toCommonJS(unidades_medida_exports); +var siglas_unidades_medida = /* @__PURE__ */ ((siglas_unidades_medida2) => { + siglas_unidades_medida2["UN"] = "UN"; + siglas_unidades_medida2["KG"] = "KG"; + siglas_unidades_medida2["TON"] = "TON"; + siglas_unidades_medida2["g"] = "g"; + siglas_unidades_medida2["M\xB3"] = "M\xB3"; + siglas_unidades_medida2["Lt"] = "Lt"; + return siglas_unidades_medida2; +})(siglas_unidades_medida || {}); +const unidades_medida = [ + { + sigla_unidade: "KG", + nome: "Quilograma", + sigla_normalizada: "KG", + normalizar: (valor) => valor, + tipo: "massa" + }, + { + sigla_unidade: "g", + nome: "Grama", + sigla_normalizada: "KG", + normalizar: (valor) => valor / 1e3, + tipo: "massa" + }, + { + sigla_unidade: "TON", + nome: "Tonelada", + sigla_normalizada: "KG", + normalizar: (valor) => valor * 1e3, + tipo: "massa" + }, + { + sigla_unidade: "Lt", + nome: "Litro", + sigla_normalizada: "Lt", + normalizar: (valor) => valor, + tipo: "volume" + }, + { + sigla_unidade: "M\xB3", + nome: "Metro C\xFAbico", + sigla_normalizada: "Lt", + normalizar: (valor) => valor * 1e3, + tipo: "volume" + }, + { + sigla_unidade: "UN", + nome: "Unidade", + sigla_normalizada: "UN", + normalizar: (valor) => valor, + tipo: "unidade" + } +]; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + siglas_unidades_medida, + unidades_medida +}); diff --git a/dist-back/uuid.js b/dist-back/uuid.js new file mode 100644 index 0000000..6d8dfc0 --- /dev/null +++ b/dist-back/uuid.js @@ -0,0 +1,51 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var uuid_exports = {}; +__export(uuid_exports, { + erUuid: () => erUuid, + uuid: () => uuid, + uuidV3: () => uuidV3, + uuidV4: () => uuidV4, + validarUuid: () => validarUuid +}); +module.exports = __toCommonJS(uuid_exports); +var import_uuid = require("uuid"); +const erUuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i; +const validarUuid = (uuid2) => { + const retorno = erUuid.test(String(uuid2 || "")); + return retorno; +}; +const uuidV3 = (chave, grupo) => { + return (0, import_uuid.v3)( + // Converte a chave para string (de forma segura) + typeof chave === "string" ? chave : typeof chave === "number" ? String(chave) : JSON.stringify(chave), + // Se um grupo foi fornecido, gera um UUID v3 recursivamente com base nele, senão usa NIL + grupo ? uuidV3(grupo) : import_uuid.NIL + ); +}; +const uuidV4 = import_uuid.v4; +const uuid = uuidV4; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + erUuid, + uuid, + uuidV3, + uuidV4, + validarUuid +}); diff --git a/dist-back/variaveisComuns.js b/dist-back/variaveisComuns.js new file mode 100644 index 0000000..8f40e1d --- /dev/null +++ b/dist-back/variaveisComuns.js @@ -0,0 +1,33 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var variaveisComuns_exports = {}; +__export(variaveisComuns_exports, { + esperar: () => esperar, + nomeVariavel: () => nomeVariavel +}); +module.exports = __toCommonJS(variaveisComuns_exports); +const esperar = (ms) => new Promise( + (resolve) => setTimeout(() => resolve(true), ms) +); +const nomeVariavel = (v) => Object.keys(v).join("/"); +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + esperar, + nomeVariavel +}); diff --git a/dist-front/index.d.ts b/dist-front/index.d.ts new file mode 100644 index 0000000..daeea71 --- /dev/null +++ b/dist-front/index.d.ts @@ -0,0 +1,366 @@ +import z from 'zod'; +import dayjs from 'dayjs'; +export { ManipulateType } from 'dayjs'; +import { v4 } from 'uuid'; + +declare const aleatorio: (tamanho?: number) => string; + +/** gerar uma função de cache para uso em memoria */ +declare const cacheM: (chave: any, valor?: T, validadeSeg?: number) => T | undefined; +declare const verCacheM: () => { + [k: string]: { + /** new Date().getTime() */ + validade?: number | undefined; + valor: any; + } | undefined; +}; +declare const cacheMemoria: (chave: any, valor?: T, validadeSeg?: number) => T | undefined; +/** para uso fixo dentro de uma função, trava a chave */ +declare const cacheMFixo: (chave: any) => (valor?: T) => T | undefined; + +declare const uuid_null = "00000000-0000-0000-0000-000000000000"; +/** Colunas Presentes n maioria das tabelas */ +declare enum camposComuns { + codigo = "codigo", + excluido = "excluido", + data_hora_criacao = "data_hora_criacao", + data_hora_atualizacao = "data_hora_atualizacao", + codigo_usuario_criacao = "codigo_usuario_criacao", + codigo_usuario_atualizacao = "codigo_usuario_atualizacao", + versao = "versao" +} +/** Palavras comumente usadas */ +declare enum tx { + token = "token" +} +declare enum tipoUsuarioResiduos { + Usuario = "usuario", + Fornecedor = "fornecedor" +} + +declare enum operadores { + "=" = "=", + "!=" = "!=", + ">" = ">", + ">=" = ">=", + "<" = "<", + "<=" = "<=", + like = "like", + in = "in" +} +type tipoFiltro = { + coluna: string; + valor: any; + operador: keyof typeof operadores | operadores; + ou?: boolean; +}; +type interfaceConsulta = { + offset?: number; + limit?: number; + filtros?: tipoFiltro[]; + ordem?: string; + ordemTipo?: "asc" | "desc"; + colunas?: string[]; + apenasConsulta?: boolean; + apenasContagem?: boolean; +}; +declare const zOperadores: z.ZodEnum<{ + "=": "="; + "!=": "!="; + ">": ">"; + ">=": ">="; + "<": "<"; + "<=": "<="; + like: "like"; + in: "in"; +}>; +declare const zFiltro: z.ZodObject<{ + coluna: z.ZodString; + valor: z.ZodAny; + operador: z.ZodEnum<{ + "=": "="; + "!=": "!="; + ">": ">"; + ">=": ">="; + "<": "<"; + "<=": "<="; + like: "like"; + in: "in"; + }>; + ou: z.ZodOptional; +}, z.core.$strip>; + +declare const dayjsbr: typeof dayjs; + +declare const cdn_carro_de_boi = "https://carro-de-boi-idz-one.b-cdn.net"; + +type tiposArquivo = "imagem" | "documento" | "vídeo" | "outros"; +declare const extensoes: { + ext: string; + tipo: tiposArquivo; + mime: string; +}[]; +/** + * Função que retorna o tipo do arquivo + * @param nomeArquivo + * @returns + */ +declare const tipoArquivo: (nomeArquivo: string | null | undefined) => tiposArquivo; + +declare const graficos_pilao: { + [k: string]: { + grafico: string; + titulo: string; + }; +}; + +/** + * LocalStorage Tipado + * Lê ou grava um valor no localStorage, mantendo o tipo genérico . + */ +declare const localValor: (chave_: string | any, valor?: T | null) => T | null; + +type tipoLokiObjeto = { + streams: { + stream: { + [k: string]: string; + }; + values: [string, string][]; + }[]; +}; +declare const postLogger: ({ objeto, }: { + objeto: tipoLokiObjeto; +}) => Promise<[objeto: tipoLokiObjeto, erro?: string]>; +/** define a localização da pasta do projeto */ +declare const defineCwd: (novoCwd: string) => void; +type tipoLevel = "info" | "warn" | "error"; +type tipoOpSessao = { + inquilino: string; + usuario: string; + parametros?: { + [k: string]: string; + }; +}; +type tipoLog = { + detalhes?: unknown[]; + __filename?: string; + local?: string; + parametros?: { + [k: string]: string; + }; +}; +type tipoLoggerLog = (level: tipoLevel, mensagem: string, op_tipoLog?: tipoLog) => Promise<[objeto: tipoLokiObjeto, erro?: string]>; +type TipoLoggerSessao = (sess: tipoOpSessao) => tipoLoggerLog; +type tipoLogger = (amb: { + app: string; + eProducao: boolean; + parametros?: { + [k: string]: string; + }; +}) => TipoLoggerSessao; +declare const logger: tipoLogger; + +/** + * Trata um objeto para ser imput para postgres + * @param entrada + * @returns + */ +declare const paraObjetoRegistroPg: (entrada: { + [k: string]: any; +}) => { + [k: string]: string | boolean | null | undefined | number; +}; +declare const pgObjeto: (entrada: { + [k: string]: any; +}) => { + [k: string]: string | boolean | null | undefined | number; +}; +declare const objetoPg: (entrada: { + [k: string]: any; +}) => { + [k: string]: string | boolean | null | undefined | number; +}; + +declare enum tiposSituacoes { + vencida = "100_vencida", + expirado = "200_expirado", + alerta = "300_alerta", + protocoladafora = "350_protocoladafora", + protocolada = "400_protocolada", + protocoladaApenas = "430_protocolada", + protocolada_alteracao = "450_protocolada", + prazo = "500_prazo", + emitida = "515_emitida", + valida = "518_valida", + novo = "520_novo", + recebido = "521_recebido", + em_andamento = "530_em_andamento", + aguardando = "530_aguardando", + aguardandoresposta = "540_aguardandoresposta", + suspensaotemporaria = "540_suspensaotemporaria", + cancelada = "550_cancelada", + execucao = "560_execucao", + pendente = "570_pendente", + executadafora = "600_executadafora", + executada = "700_executada", + naoexecutada = "701_naoexecutada", + concluida = "730_concluida", + respondido_negado = "740_respondido_negado", + respondido_aceito = "741_respondido_aceito", + atendidoparcial = "742_atendidoparcial", + naoatendido = "743_naoatendido", + atendido = "744_atendido", + renovada = "760_renovada", + finalizada = "800_finalizada", + emitirnota = "101_emitirnota", + faturaatrasada = "301_faturaatrasada", + pagarfatura = "302_pagarfatura", + aguardandoconfirmacao = "531_aguardandoconfirmacao", + agendado = "701_agendado", + faturapaga = "801_faturapaga", + excluida = "999_excluida", + requerida = "401_requerida", + vigente = "516_vigente", + emrenovacao = "402_emrenovacao", + arquivada = "801_arquivada", + aguardando_sincronizacao = "999_aguardando_sincronizacao", + nao_conforme = "710_nao_conforme", + conforme = "720_conforme", + nao_aplicavel = "730_nao_aplicavel", + parcial = "715_parcial" +} +declare const corSituacoes: { + [K in keyof typeof tiposSituacoes]?: string; +}; + +declare const umaFuncao: () => string; + +declare const umaVariavel = "Ol\u00E1 Mundo! (vari\u00E1vel)"; + +/** gerar o texto de busca removendo caracteres especies e caixa alta */ +declare const texto_busca: (...texto: any[]) => string; + +/** Gerar uma classe que facilita a gestão de rotas com a tipagem das querys + * + * Definições: + * + * caminho = "/aplicacao/funcionalidade" + * + * endereco = "http://localhost:3000/aplicacao/funcionalidade" + * + * parametros = {nome:"José"} + */ +declare class TipagemRotas { + _partesCaminho: string[]; + _acaoIr?: (endereco: string) => undefined; + rotulo: string | undefined; + /** Ao criar novo obijeto de tipagem de rota é necessário passar o caminho parcial + ** export const mCaminho = new TipagemRotas<{q:string}>("aplicacao","funcionalidade") + */ + constructor({ caminho, acaoIr, rotulo, }: { + caminho: (string | null | undefined)[] | string; + acaoIr?: undefined | ((endereco: string) => undefined); + /** Rotulo da página + * Inicio | Controle + */ + rotulo?: string; + }); + /** Retorna o caminho completo da rota + ** console.log(mCaminho.caminho) + ** "/caminho" + */ + get caminho(): string; + /** Define o caminho completo da rota + ** mCaminho.caminho = "/novoCaminho" + ** console.log(mCaminho.caminho) + ** "/novoCaminho" + ** */ + set caminho(caminhoParcial: string); + /** Retorna o caminho completo da rota com a query + ** console.log(mCaminho.resolve({q:"query"})) + ** "http://localhost:3000/caminho?q=query" + */ + endereco(query: T, usarComoHash?: boolean): string; + /** Vai para a url + ** mCaminho.ir({q:"query"}) + ** window.location.href = "http://localhost:3000/caminho?q=query" + */ + ir(query: T): void; + /** Retorna os parametros da url + ** console.log(mCaminho.parametros()) + ** {q:"query"} + */ + parametros(urlEntrada?: string): Partial; +} + +/** + * Essa variável se conecta a tabela_lidades + * + * onde sigla se conecta com sigla + * + * Usuário terá mais opções de unidades, quando fazer o envio para o mtr, usar a opção fornecida pelo usuarios, caso não tenha + * usar a normalizada + */ +declare enum siglas_unidades_medida { + UN = "UN", + KG = "KG", + TON = "TON", + g = "g", + "M³" = "M\u00B3", + Lt = "Lt" +} +declare const unidades_medida: { + sigla_unidade: keyof typeof siglas_unidades_medida; + nome: string; + sigla_normalizada: keyof typeof siglas_unidades_medida; + normalizar: (valor: number) => number; + tipo: "massa" | "volume" | "comprimento" | "unidade"; +}[]; + +/** + * Valida se uma string é um UUID válido (qualquer versão). + * + * @param valor - A string que será validada. + * @returns booleano indicando se é um UUID válido. + */ +declare const erUuid: RegExp; +declare const validarUuid: (uuid: string | number | undefined | null) => boolean; +/** + * Gera um UUID determinístico (versão 3) com base em uma chave e um grupo (namespace). + * + * - Usa o algoritmo MD5 (RFC 4122). + * - Sempre retorna o mesmo UUID para a mesma combinação chave + grupo. + * - Caso o grupo não seja informado, usa o UUID "nil" como namespace. + * + * @param chave - Qualquer valor que será convertido em string para gerar o UUID (ex: número, string ou objeto). + * @param grupo - Opcional. Namespace para separar domínios diferentes de UUIDs. + * @returns UUID v3 (determinístico) + */ +declare const uuidV3: (chave: any, grupo?: any) => string; +/** + * Gera um UUID v4 (aleatório, não determinístico). + * + * - Usado quando unicidade é necessária, mas não se exige que seja previsível. + */ +declare const uuidV4: typeof v4; +/** + * @deprecated Esta variável será descontinuada em versões futuras. + * Use a função `uuidV4()` diretamente. + */ +declare const uuid: typeof v4; + +declare const esperar: (ms: number) => Promise; +/** + * Usado para retronat o no de uma variável, deve ser usado dentro de um objeto + * const nomex = {a: 1, b: 2} + * nomeVariavel({nomex}) // retorna "nomex" + * @param v + * @returns + */ +declare const nomeVariavel: (v: { + [key: string]: any; +}) => string; + +export { TipagemRotas, type TipoLoggerSessao, aleatorio, cacheM, cacheMFixo, cacheMemoria, camposComuns, cdn_carro_de_boi, corSituacoes, dayjsbr, defineCwd, erUuid, esperar, extensoes, graficos_pilao, type interfaceConsulta, localValor, logger, nomeVariavel, objetoPg, operadores, paraObjetoRegistroPg, pgObjeto, postLogger, siglas_unidades_medida, texto_busca, tipoArquivo, type tipoFiltro, type tipoLogger, type tipoLoggerLog, type tipoLokiObjeto, tipoUsuarioResiduos, tiposSituacoes, tx, umaFuncao, umaVariavel, unidades_medida, uuid, uuidV3, uuidV4, uuid_null, validarUuid, verCacheM, zFiltro, zOperadores }; diff --git a/dist-front/index.mjs b/dist-front/index.mjs new file mode 100644 index 0000000..aa167ae --- /dev/null +++ b/dist-front/index.mjs @@ -0,0 +1 @@ +var _="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),re=e=>`eli-${Array.from({length:e||8}).map(()=>_[(999*Math.random()|0)%_.length]).join("")}`;var g={};globalThis.cacheMemoria_cache=g;var v=(e,o,t)=>{let a=typeof e=="string"?e:typeof e=="number"?String(e):encodeURIComponent(JSON.stringify(e)),n=t&&new Date().getTime()+t*1e3;o!==void 0&&(g[a]={valor:o,validade:n});let i=g[a];if(!(i?.validade&&i.validadeg,ne=v,ie=e=>o=>v(e,o);var de="00000000-0000-0000-0000-000000000000",z=(d=>(d.codigo="codigo",d.excluido="excluido",d.data_hora_criacao="data_hora_criacao",d.data_hora_atualizacao="data_hora_atualizacao",d.codigo_usuario_criacao="codigo_usuario_criacao",d.codigo_usuario_atualizacao="codigo_usuario_atualizacao",d.versao="versao",d))(z||{}),N=(o=>(o.token="token",o))(N||{}),$=(t=>(t.Usuario="usuario",t.Fornecedor="fornecedor",t))($||{});import c from"zod";var C=(t=>(t["="]="=",t["!="]="!=",t[">"]=">",t[">="]=">=",t["<"]="<",t["<="]="<=",t.like="like",t.in="in",t))(C||{}),M=c.enum(["=","!=",">",">=","<","<=","like","in"]),le=c.object({coluna:c.string(),valor:c.any(),operador:M,ou:c.boolean().optional()});import p from"dayjs";import P from"dayjs/plugin/duration.js";import q from"dayjs/plugin/isSameOrAfter.js";import I from"dayjs/plugin/isSameOrBefore.js";import U from"dayjs/plugin/minMax.js";import A from"dayjs/plugin/relativeTime.js";import E from"dayjs/plugin/timezone.js";import F from"dayjs/plugin/utc.js";import J from"dayjs/plugin/weekOfYear.js";import"dayjs/locale/pt-br.js";p.locale("pt-br");p.extend(F);p.extend(E);p.extend(J);p.extend(I);p.extend(q);p.extend(U);p.extend(A);p.extend(P);var we=p;var je="https://carro-de-boi-idz-one.b-cdn.net";var K=[{ext:"gif",tipo:"imagem",mime:"image/gif"},{ext:"jpg",tipo:"imagem",mime:"image/jpeg"},{ext:"jpeg",tipo:"imagem",mime:"image/jpeg"},{ext:"png",tipo:"imagem",mime:"image/png"},{ext:"bmp",tipo:"imagem",mime:"image/bmp"},{ext:"webp",tipo:"imagem",mime:"image/webp"},{ext:"tiff",tipo:"imagem",mime:"image/tiff"},{ext:"svg",tipo:"imagem",mime:"image/svg+xml"},{ext:"ico",tipo:"imagem",mime:"image/x-icon"},{ext:"pdf",tipo:"documento",mime:"application/pdf"},{ext:"doc",tipo:"documento",mime:"application/msword"},{ext:"docx",tipo:"documento",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},{ext:"xls",tipo:"documento",mime:"application/vnd.ms-excel"},{ext:"xlsx",tipo:"documento",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},{ext:"ppt",tipo:"documento",mime:"application/vnd.ms-powerpoint"},{ext:"pptx",tipo:"documento",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"},{ext:"txt",tipo:"documento",mime:"text/plain"},{ext:"odt",tipo:"documento",mime:"application/vnd.oasis.opendocument.text"},{ext:"ods",tipo:"documento",mime:"application/vnd.oasis.opendocument.spreadsheet"},{ext:"rtf",tipo:"documento",mime:"application/rtf"},{ext:"csv",tipo:"documento",mime:"text/csv"},{ext:"mp4",tipo:"v\xEDdeo",mime:"video/mp4"},{ext:"avi",tipo:"v\xEDdeo",mime:"video/x-msvideo"},{ext:"mkv",tipo:"v\xEDdeo",mime:"video/x-matroska"},{ext:"mov",tipo:"v\xEDdeo",mime:"video/quicktime"},{ext:"wmv",tipo:"v\xEDdeo",mime:"video/x-ms-wmv"},{ext:"flv",tipo:"v\xEDdeo",mime:"video/x-flv"},{ext:"webm",tipo:"v\xEDdeo",mime:"video/webm"},{ext:"3gp",tipo:"v\xEDdeo",mime:"video/3gpp"},{ext:"mpeg",tipo:"v\xEDdeo",mime:"video/mpeg"}],Ne=e=>{let o=String(e||"").toLocaleLowerCase().split(".").pop();return K.find(a=>a.ext===o)?.tipo||"outros"};var Ce={Condicionantes:{grafico:"condicionantes-criadas",titulo:"Condicionantes Criadas"},Licen\u00E7as:{grafico:"licencas-criadas",titulo:"Licen\xE7as Criadas"}};var Pe=(e,o)=>{let t=globalThis.localStorage;if(typeof t>"u")return null;let a=typeof e=="string"?e:encodeURIComponent(JSON.stringify(e));try{o!==void 0&&t.setItem(a,JSON.stringify(o));let n=t.getItem(a);if(n===null)return null;try{return JSON.parse(n)}catch{return n}}catch{return null}};import D from"cross-fetch";var Ie=e=>new Promise(o=>setTimeout(()=>o(!0),e)),u=e=>Object.keys(e).join("/");var G="https://log.idz.one",V="/loki/api/v1/push",R=async({objeto:e})=>{let o=await D(`${G}${V}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).catch(t=>t);return o.ok?[e]:[e,`Erro ${o.status}: ${await o?.text?.()}`]},x="",Fe=e=>{x=e},Je=({app:e,eProducao:o,parametros:t})=>({inquilino:a,usuario:n,parametros:i})=>async(m,d,h)=>{let{__filename:s,detalhes:l,local:f,parametros:O}=h||{},w=`${o?"":"DEV-"}${e}`;x&&s&&(s=s.replace(x,"")),f&&(l=[`${u({local:f})}="${f}"`,...l||[]]),s&&(l=[`${u({__filename:s})}="${s}"`,...l||[]]);let L=`${Date.now()}000000`,j=l?.length?`${d} | ${l.map(T=>JSON.stringify(T)).join(" | ")}`:d,k={streams:[{stream:{app:w,inquilino:a,usuario:n,level:m,...t||{},...i||{},...O||{}},values:[[L,j]]}]};return await R({objeto:k})};var y=e=>{try{return Object.fromEntries(Object.entries(e).map(([o,t])=>[o,t===void 0||t==null||typeof t=="string"||typeof t=="number"||typeof t=="boolean"?t:JSON.stringify(t,null,2)]))}catch(o){throw new Error(`Erro na fun\xE7\xE3o paraObjetoRegistroPg: ${o.message} ${o.stack}`)}},De=y,Ge=y;var B=(r=>(r.vencida="100_vencida",r.expirado="200_expirado",r.alerta="300_alerta",r.protocoladafora="350_protocoladafora",r.protocolada="400_protocolada",r.protocoladaApenas="430_protocolada",r.protocolada_alteracao="450_protocolada",r.prazo="500_prazo",r.emitida="515_emitida",r.valida="518_valida",r.novo="520_novo",r.recebido="521_recebido",r.em_andamento="530_em_andamento",r.aguardando="530_aguardando",r.aguardandoresposta="540_aguardandoresposta",r.suspensaotemporaria="540_suspensaotemporaria",r.cancelada="550_cancelada",r.execucao="560_execucao",r.pendente="570_pendente",r.executadafora="600_executadafora",r.executada="700_executada",r.naoexecutada="701_naoexecutada",r.concluida="730_concluida",r.respondido_negado="740_respondido_negado",r.respondido_aceito="741_respondido_aceito",r.atendidoparcial="742_atendidoparcial",r.naoatendido="743_naoatendido",r.atendido="744_atendido",r.renovada="760_renovada",r.finalizada="800_finalizada",r.emitirnota="101_emitirnota",r.faturaatrasada="301_faturaatrasada",r.pagarfatura="302_pagarfatura",r.aguardandoconfirmacao="531_aguardandoconfirmacao",r.agendado="701_agendado",r.faturapaga="801_faturapaga",r.excluida="999_excluida",r.requerida="401_requerida",r.vigente="516_vigente",r.emrenovacao="402_emrenovacao",r.arquivada="801_arquivada",r.aguardando_sincronizacao="999_aguardando_sincronizacao",r.nao_conforme="710_nao_conforme",r.conforme="720_conforme",r.nao_aplicavel="730_nao_aplicavel",r.parcial="715_parcial",r))(B||{}),Re={pendente:"#CCC353",nao_conforme:"#dc3545",conforme:"#28a745",alerta:"#FFDE59"};var He=()=>"Ol\xE1 Mundo! (fun\xE7\xE3o)";var Xe="Ol\xE1 Mundo! (vari\xE1vel)";var ro=(...e)=>e.map(o=>o==null?"":String(o).normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g," ").toLowerCase()).join(" ");var b=class{constructor({caminho:o,acaoIr:t,rotulo:a}){this._partesCaminho=[];this._acaoIr=t,this._partesCaminho=(Array.isArray(o)?o:[o]).filter(Boolean).map(n=>String(n)).flatMap(n=>n.split("/")).filter(Boolean),this.rotulo=a}get caminho(){return`/${this._partesCaminho.join("/")}`}set caminho(o){this._partesCaminho=o.split("/").filter(t=>t)}endereco(o,t){let a=new URL(typeof window<"u"?window.location.href:"http://localhost");a.pathname=this.caminho,a.search="";let n=Object.entries(o);for(let[i,m]of n)a.searchParams.set(String(i),JSON.stringify(m));return a.hash="",t&&(a.hash=`#${a.search}`,a.search=""),a.href}ir(o){this._acaoIr?this._acaoIr(this.endereco({...o})):typeof window<"u"&&(window.location.href=this.endereco({...o}))}parametros(o){let t=o?new URL(o):new URL(typeof window<"u"?window.location.href:"http://localhost"),a=t.searchParams,n=Object.fromEntries(a.entries()),i=t.hash;if(i){let m=Object.fromEntries(new URLSearchParams(i.slice(1)).entries());n={...n,...m}}for(let m in n)try{n[m]=JSON.parse(n[m])}catch{console.log(`[${m}|${n[m]}] n\xE3o \xE9 um json v\xE1lido.`)}return n}};var Q=(i=>(i.UN="UN",i.KG="KG",i.TON="TON",i.g="g",i["M\xB3"]="M\xB3",i.Lt="Lt",i))(Q||{}),no=[{sigla_unidade:"KG",nome:"Quilograma",sigla_normalizada:"KG",normalizar:e=>e,tipo:"massa"},{sigla_unidade:"g",nome:"Grama",sigla_normalizada:"KG",normalizar:e=>e/1e3,tipo:"massa"},{sigla_unidade:"TON",nome:"Tonelada",sigla_normalizada:"KG",normalizar:e=>e*1e3,tipo:"massa"},{sigla_unidade:"Lt",nome:"Litro",sigla_normalizada:"Lt",normalizar:e=>e,tipo:"volume"},{sigla_unidade:"M\xB3",nome:"Metro C\xFAbico",sigla_normalizada:"Lt",normalizar:e=>e*1e3,tipo:"volume"},{sigla_unidade:"UN",nome:"Unidade",sigla_normalizada:"UN",normalizar:e=>e,tipo:"unidade"}];import{NIL as Y,v3 as H,v4 as W}from"uuid";var X=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,po=e=>X.test(String(e||"")),Z=(e,o)=>H(typeof e=="string"?e:typeof e=="number"?String(e):JSON.stringify(e),o?Z(o):Y),S=W,so=S;export{b as TipagemRotas,re as aleatorio,v as cacheM,ie as cacheMFixo,ne as cacheMemoria,z as camposComuns,je as cdn_carro_de_boi,Re as corSituacoes,we as dayjsbr,Fe as defineCwd,X as erUuid,Ie as esperar,K as extensoes,Ce as graficos_pilao,Pe as localValor,Je as logger,u as nomeVariavel,Ge as objetoPg,C as operadores,y as paraObjetoRegistroPg,De as pgObjeto,R as postLogger,Q as siglas_unidades_medida,ro as texto_busca,Ne as tipoArquivo,$ as tipoUsuarioResiduos,B as tiposSituacoes,N as tx,He as umaFuncao,Xe as umaVariavel,no as unidades_medida,so as uuid,Z as uuidV3,S as uuidV4,de as uuid_null,po as validarUuid,ae as verCacheM,le as zFiltro,M as zOperadores}; diff --git a/package.json b/package.json index ebcdb05..9b2c2d4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "p-comuns", - "version": "0.276.0", + "version": "0.278.0", "description": "", "main": "./dist/index.cjs", "module": "./dist/index.mjs", @@ -13,10 +13,6 @@ } }, "type": "module", - - - - "scripts": { "biome": "pnpm exec biome check --write", "check": "pnpm run biome && npx tsc --noEmit", @@ -50,4 +46,4 @@ "uuid": "^11.1.0", "zod": "4.1.4" } -} \ No newline at end of file +} diff --git a/pacote.tgz b/pacote.tgz index 73ce297..63c8d92 100644 Binary files a/pacote.tgz and b/pacote.tgz differ diff --git a/src/index.ts b/src/index.ts index 356beb8..be32116 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,17 +5,17 @@ export * from "./consulta" export * from "./dayjs" export * from "./ecosistema" export * from "./extensoes" +export * from "./extensoes" export * from "./graficosPilao" export * from "./local" export * from "./logger" +export * from "./logger" export * from "./postgres" +export * from "./situacoes" export * from "./testes-de-variaveis" export * from "./texto_busca" export * from "./tipagemRotas" +export * from "./tipagemRotas" export * from "./unidades_medida" export * from "./uuid" export * from "./variaveisComuns" -export * from "./tipagemRotas" -export * from "./extensoes" -export * from "./logger" -export * from "./situacoes" \ No newline at end of file