buid
This commit is contained in:
parent
0cbe901499
commit
dbe0f66daf
51 changed files with 30 additions and 304 deletions
|
|
@ -25,8 +25,6 @@ __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("./testes-de-variaveis"), module.exports);
|
||||
__reExport(index_exports, require("./texto_busca"), module.exports);
|
||||
|
|
@ -47,8 +45,6 @@ __reExport(index_exports, require("./variaveisComuns"), module.exports);
|
|||
...require("./extensoes"),
|
||||
...require("./graficosPilao"),
|
||||
...require("./local"),
|
||||
...require("./logger"),
|
||||
...require("./logger"),
|
||||
...require("./postgres"),
|
||||
...require("./testes-de-variaveis"),
|
||||
...require("./texto_busca"),
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ __export(local_exports, {
|
|||
});
|
||||
module.exports = __toCommonJS(local_exports);
|
||||
const localValor = (chave_, valor) => {
|
||||
const localStorage = globalThis.localStorage;
|
||||
const localStorage = "localStorage" in globalThis ? globalThis.localStorage : void 0;
|
||||
if (typeof localStorage == "undefined") return null;
|
||||
const chave = typeof chave_ === "string" ? chave_ : encodeURIComponent(JSON.stringify(chave_));
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -1,106 +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 logger_exports = {};
|
||||
__export(logger_exports, {
|
||||
defineCwd: () => defineCwd,
|
||||
logger: () => logger,
|
||||
postLogger: () => postLogger
|
||||
});
|
||||
module.exports = __toCommonJS(logger_exports);
|
||||
var import_cross_fetch = __toESM(require("cross-fetch"));
|
||||
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
|
||||
});
|
||||
|
|
@ -56,9 +56,8 @@ class TipagemRotas {
|
|||
** "http://localhost:3000/caminho?q=query"
|
||||
*/
|
||||
endereco(query, usarComoHash) {
|
||||
const url = new URL(
|
||||
typeof window !== "undefined" ? window.location.href : "http://localhost"
|
||||
);
|
||||
const win = typeof globalThis !== "undefined" && globalThis.window || void 0;
|
||||
const url = new URL(win ? win.location.href : "http://localhost");
|
||||
url.pathname = this.caminho;
|
||||
url.search = "";
|
||||
const queryKeys = Object.entries(query);
|
||||
|
|
@ -80,8 +79,9 @@ class TipagemRotas {
|
|||
if (this._acaoIr) {
|
||||
this._acaoIr(this.endereco({ ...query }));
|
||||
} else {
|
||||
if (typeof window != "undefined") {
|
||||
window.location.href = this.endereco({ ...query });
|
||||
const win = typeof globalThis !== "undefined" && globalThis.window || void 0;
|
||||
if (win) {
|
||||
win.location.href = this.endereco({ ...query });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ class TipagemRotas {
|
|||
*/
|
||||
parametros(urlEntrada) {
|
||||
const url = urlEntrada ? new URL(urlEntrada) : new URL(
|
||||
typeof window !== "undefined" ? window.location.href : "http://localhost"
|
||||
typeof globalThis !== "undefined" && globalThis.window ? globalThis.window.location.href : "http://localhost"
|
||||
);
|
||||
const query = url.searchParams;
|
||||
let queryObj = Object.fromEntries(query.entries());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue