merge
This commit is contained in:
commit
7df1b4fc3d
81 changed files with 2754 additions and 1800 deletions
56
dist-import/pilao-de-dados/Pilao/index.d.ts
vendored
Normal file
56
dist-import/pilao-de-dados/Pilao/index.d.ts
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
/** Drive completo do piilão de dados */
|
||||||
|
import { type tipoResposta } from "p-respostas";
|
||||||
|
import type { z } from "zod";
|
||||||
|
import type { zp_enviar_registros } from "../_enviar_registros";
|
||||||
|
import { type zp_deletar_registros } from "../variaveis";
|
||||||
|
import type { visoes_pilao } from "../visoes/listaDeVisoes";
|
||||||
|
import type { tipo_pilao_api } from "./pilao-api.ts";
|
||||||
|
import type { tipoConstrutorPilao, tipoRetornoSerieconsulta } from "./tipagem";
|
||||||
|
declare class ClassPilao {
|
||||||
|
#private;
|
||||||
|
constructor({ conta, produto, emDesenvolvimento, ver_log, }: tipoConstrutorPilao & {
|
||||||
|
ver_log?: boolean;
|
||||||
|
emDesenvolvimento?: boolean;
|
||||||
|
});
|
||||||
|
rotaEnviarRegistros(): {
|
||||||
|
rota: string;
|
||||||
|
url: string;
|
||||||
|
};
|
||||||
|
rotaDeletarRegistro(): {
|
||||||
|
rota: string;
|
||||||
|
url: string;
|
||||||
|
};
|
||||||
|
rotaConsultarSerie(tipoVisao: keyof typeof visoes_pilao | ":tipoVisao"): {
|
||||||
|
rota: string;
|
||||||
|
url: string;
|
||||||
|
};
|
||||||
|
rotaIframeSerie(tipoVisao: keyof typeof visoes_pilao | ":tipoVisao"): {
|
||||||
|
rota: string;
|
||||||
|
url: string;
|
||||||
|
};
|
||||||
|
rotaFuncaoApi(funcao: keyof tipo_pilao_api | ":funcao"): {
|
||||||
|
rota: string;
|
||||||
|
url: string;
|
||||||
|
};
|
||||||
|
consultarApi<T extends keyof tipo_pilao_api>(funcao: T, parametros: tipo_pilao_api[T]["pr"]): Promise<tipoResposta<tipo_pilao_api[T]["rs"]>>;
|
||||||
|
get baseUrlApi(): "https://carro-de-boi.idz.one" | "http://localhost:5080";
|
||||||
|
get baseUrlSite(): "https://carro-de-boi.idz.one" | "http://localhost:5081";
|
||||||
|
validarCliente(_: any): tipoResposta<tipoConstrutorPilao>;
|
||||||
|
adicionarRegistroParaEnviar(tabela: string, ...registros: z.infer<typeof zp_enviar_registros>["registros"]): this;
|
||||||
|
adicionarCodigoParaDeletar(tabela: string, ...codigos: z.infer<typeof zp_deletar_registros>["codigos"]): this;
|
||||||
|
private processarRegistros;
|
||||||
|
salvarRegistros(): Promise<tipoResposta<true>>;
|
||||||
|
serieConsultar<T extends keyof typeof visoes_pilao>(tipoVisao: T, parametros: z.infer<(typeof visoes_pilao)[T]>): {
|
||||||
|
dados: () => Promise<tipoResposta<tipoRetornoSerieconsulta<T>>>;
|
||||||
|
url: () => string;
|
||||||
|
};
|
||||||
|
urlLaboratorio(): {
|
||||||
|
rota: string;
|
||||||
|
url: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
export declare const Pilao: (_: tipoConstrutorPilao & {
|
||||||
|
ver_log?: boolean;
|
||||||
|
emDesenvolvimento?: boolean;
|
||||||
|
}) => ClassPilao;
|
||||||
|
export {};
|
||||||
211
dist-import/pilao-de-dados/Pilao/index.js
Normal file
211
dist-import/pilao-de-dados/Pilao/index.js
Normal file
|
|
@ -0,0 +1,211 @@
|
||||||
|
/** Drive completo do piilão de dados */
|
||||||
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
||||||
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
||||||
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
||||||
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
||||||
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
||||||
|
};
|
||||||
|
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
||||||
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
||||||
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
||||||
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
||||||
|
};
|
||||||
|
var _ClassPilao_instances, _ClassPilao_produto, _ClassPilao_conta, _ClassPilao_emDesenvolvimento, _ClassPilao_ver_log, _ClassPilao_registrosParaEnvio, _ClassPilao_codigosParaDeletar, _ClassPilao_gerarUrl, _ClassPilao_salvarEnviarRegistros, _ClassPilao_salvarDeletarRegistros;
|
||||||
|
import crossFetch from "cross-fetch";
|
||||||
|
import { nomeVariavel } from "p-comuns";
|
||||||
|
import { respostaComuns } from "p-respostas";
|
||||||
|
import { PREFIXO_PILAO } from "../variaveis";
|
||||||
|
class ClassPilao {
|
||||||
|
constructor({ conta, produto, emDesenvolvimento = false, ver_log = false, }) {
|
||||||
|
_ClassPilao_instances.add(this);
|
||||||
|
_ClassPilao_produto.set(this, void 0);
|
||||||
|
_ClassPilao_conta.set(this, void 0);
|
||||||
|
_ClassPilao_emDesenvolvimento.set(this, void 0);
|
||||||
|
_ClassPilao_ver_log.set(this, void 0);
|
||||||
|
_ClassPilao_registrosParaEnvio.set(this, {});
|
||||||
|
_ClassPilao_codigosParaDeletar.set(this, {});
|
||||||
|
__classPrivateFieldSet(this, _ClassPilao_produto, produto, "f");
|
||||||
|
__classPrivateFieldSet(this, _ClassPilao_conta, conta, "f");
|
||||||
|
__classPrivateFieldSet(this, _ClassPilao_emDesenvolvimento, emDesenvolvimento, "f");
|
||||||
|
__classPrivateFieldSet(this, _ClassPilao_ver_log, ver_log, "f");
|
||||||
|
}
|
||||||
|
rotaEnviarRegistros() {
|
||||||
|
return __classPrivateFieldGet(this, _ClassPilao_instances, "m", _ClassPilao_gerarUrl).call(this, "enviar-registros");
|
||||||
|
}
|
||||||
|
rotaDeletarRegistro() {
|
||||||
|
return __classPrivateFieldGet(this, _ClassPilao_instances, "m", _ClassPilao_gerarUrl).call(this, "deletar-registros");
|
||||||
|
}
|
||||||
|
rotaConsultarSerie(tipoVisao) {
|
||||||
|
return __classPrivateFieldGet(this, _ClassPilao_instances, "m", _ClassPilao_gerarUrl).call(this, "consultar-serie", tipoVisao);
|
||||||
|
}
|
||||||
|
rotaIframeSerie(tipoVisao) {
|
||||||
|
const rota = `${PREFIXO_PILAO}/consultar-serie/${__classPrivateFieldGet(this, _ClassPilao_produto, "f")}/${__classPrivateFieldGet(this, _ClassPilao_conta, "f")}/${tipoVisao}`;
|
||||||
|
const url = `${this.baseUrlSite}${rota}`;
|
||||||
|
return { rota, url };
|
||||||
|
}
|
||||||
|
rotaFuncaoApi(funcao) {
|
||||||
|
return __classPrivateFieldGet(this, _ClassPilao_instances, "m", _ClassPilao_gerarUrl).call(this, "API", funcao);
|
||||||
|
}
|
||||||
|
async consultarApi(funcao, parametros) {
|
||||||
|
try {
|
||||||
|
const response = await crossFetch(this.rotaFuncaoApi(funcao).url, {
|
||||||
|
body: JSON.stringify(parametros),
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
});
|
||||||
|
const texto = await response.text();
|
||||||
|
try {
|
||||||
|
const json = JSON.parse(texto);
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
return respostaComuns.erro("Consulta não retornou json válido", [texto]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (erro) {
|
||||||
|
console.error(erro);
|
||||||
|
return respostaComuns.erroInterno({
|
||||||
|
erro,
|
||||||
|
local: nomeVariavel({ ClassPilao }),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
get baseUrlApi() {
|
||||||
|
return __classPrivateFieldGet(this, _ClassPilao_emDesenvolvimento, "f")
|
||||||
|
? "http://localhost:5080"
|
||||||
|
: "https://carro-de-boi.idz.one";
|
||||||
|
}
|
||||||
|
get baseUrlSite() {
|
||||||
|
return __classPrivateFieldGet(this, _ClassPilao_emDesenvolvimento, "f")
|
||||||
|
? "http://localhost:5081"
|
||||||
|
: "https://carro-de-boi.idz.one";
|
||||||
|
}
|
||||||
|
validarCliente(_) {
|
||||||
|
if (!_?.conta)
|
||||||
|
return respostaComuns.erro("Conta não informada");
|
||||||
|
if (!_?.produto)
|
||||||
|
return respostaComuns.erro("Produto não informado");
|
||||||
|
return respostaComuns.valor(_);
|
||||||
|
}
|
||||||
|
adicionarRegistroParaEnviar(tabela, ...registros) {
|
||||||
|
__classPrivateFieldGet(this, _ClassPilao_registrosParaEnvio, "f")[tabela] = [
|
||||||
|
...(__classPrivateFieldGet(this, _ClassPilao_registrosParaEnvio, "f")[tabela] || []),
|
||||||
|
...registros,
|
||||||
|
];
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
adicionarCodigoParaDeletar(tabela, ...codigos) {
|
||||||
|
__classPrivateFieldGet(this, _ClassPilao_codigosParaDeletar, "f")[tabela] = [
|
||||||
|
...(__classPrivateFieldGet(this, _ClassPilao_codigosParaDeletar, "f")[tabela] || []),
|
||||||
|
...codigos,
|
||||||
|
];
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
async processarRegistros(url, registros, tabela, acao) {
|
||||||
|
const tamanhoBlocos = 1000;
|
||||||
|
while (registros.length > 0) {
|
||||||
|
const bloco = registros
|
||||||
|
.splice(0, tamanhoBlocos)
|
||||||
|
.map((r) => Object.fromEntries(Object.entries(r).map(([k, v]) => [k, v === undefined ? null : v])));
|
||||||
|
const resp = await crossFetch(url, {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify({ tabela, registros: bloco }),
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
})
|
||||||
|
.then(async (r) => {
|
||||||
|
const texto = await r.text();
|
||||||
|
try {
|
||||||
|
const json = JSON.parse(texto);
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
return respostaComuns.erro("Consulta não retornou json válido", [
|
||||||
|
texto,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => respostaComuns.erro(`Erro ao ${acao} registros`, [e.message]));
|
||||||
|
if (resp.eErro)
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
return respostaComuns.valor(true);
|
||||||
|
}
|
||||||
|
async salvarRegistros() {
|
||||||
|
const re = await __classPrivateFieldGet(this, _ClassPilao_instances, "m", _ClassPilao_salvarEnviarRegistros).call(this);
|
||||||
|
if (re.eErro)
|
||||||
|
return re;
|
||||||
|
const rd = await __classPrivateFieldGet(this, _ClassPilao_instances, "m", _ClassPilao_salvarDeletarRegistros).call(this);
|
||||||
|
if (rd.eErro)
|
||||||
|
return rd;
|
||||||
|
return respostaComuns.valor(true);
|
||||||
|
}
|
||||||
|
serieConsultar(tipoVisao, parametros) {
|
||||||
|
const dados = async () => {
|
||||||
|
const url = this.rotaConsultarSerie(tipoVisao).url;
|
||||||
|
const resp = await crossFetch(url.toString(), {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(parametros),
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
})
|
||||||
|
.then(async (r) => {
|
||||||
|
const texto = await r.text();
|
||||||
|
try {
|
||||||
|
const json = JSON.parse(texto);
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
return respostaComuns.erro("Consulta não retornou json válido", [
|
||||||
|
texto,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => respostaComuns.erro("Erro ao enviar registros", [e.message]));
|
||||||
|
if (__classPrivateFieldGet(this, _ClassPilao_ver_log, "f"))
|
||||||
|
console.log(`[PILÃO]: buscar dados de "${JSON.stringify(parametros)}" para "${url}".`);
|
||||||
|
return resp;
|
||||||
|
};
|
||||||
|
const url = () => {
|
||||||
|
const vUrl = this.rotaIframeSerie(tipoVisao).url;
|
||||||
|
const serie = encodeURIComponent(JSON.stringify(parametros, null, 2));
|
||||||
|
if (__classPrivateFieldGet(this, _ClassPilao_ver_log, "f"))
|
||||||
|
console.log(`[PILÃO]: Serie Consultar url de "${JSON.stringify(serie)}" para "${vUrl}".`);
|
||||||
|
return `${vUrl}?serie=${serie}`;
|
||||||
|
};
|
||||||
|
return {
|
||||||
|
dados,
|
||||||
|
url,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
urlLaboratorio() {
|
||||||
|
const rota = `${PREFIXO_PILAO}/laboratório/${__classPrivateFieldGet(this, _ClassPilao_produto, "f")}/${__classPrivateFieldGet(this, _ClassPilao_conta, "f")}`;
|
||||||
|
const url = `${this.baseUrlSite}${rota}`;
|
||||||
|
return { rota, url };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ClassPilao_produto = new WeakMap(), _ClassPilao_conta = new WeakMap(), _ClassPilao_emDesenvolvimento = new WeakMap(), _ClassPilao_ver_log = new WeakMap(), _ClassPilao_registrosParaEnvio = new WeakMap(), _ClassPilao_codigosParaDeletar = new WeakMap(), _ClassPilao_instances = new WeakSet(), _ClassPilao_gerarUrl = function _ClassPilao_gerarUrl(acao, extraPath) {
|
||||||
|
const rota = `${PREFIXO_PILAO}/api/${acao}/${__classPrivateFieldGet(this, _ClassPilao_produto, "f")}/${__classPrivateFieldGet(this, _ClassPilao_conta, "f")}${extraPath ? `/${extraPath}` : ""}`;
|
||||||
|
const url = `${this.baseUrlApi}${rota}`;
|
||||||
|
return { rota, url };
|
||||||
|
}, _ClassPilao_salvarEnviarRegistros = async function _ClassPilao_salvarEnviarRegistros() {
|
||||||
|
for (const tabela of Object.keys(__classPrivateFieldGet(this, _ClassPilao_registrosParaEnvio, "f"))) {
|
||||||
|
const registros = __classPrivateFieldGet(this, _ClassPilao_registrosParaEnvio, "f")[tabela] || [];
|
||||||
|
const url = this.rotaEnviarRegistros().url;
|
||||||
|
if (__classPrivateFieldGet(this, _ClassPilao_ver_log, "f"))
|
||||||
|
console.log(`[PILÃO]: Enviando ${registros.length} registros na tabela "${tabela}" para "${url}".`);
|
||||||
|
const resp = await this.processarRegistros(url, registros, tabela, "enviar");
|
||||||
|
if (resp.eErro)
|
||||||
|
return resp;
|
||||||
|
__classPrivateFieldGet(this, _ClassPilao_registrosParaEnvio, "f")[tabela] = [];
|
||||||
|
}
|
||||||
|
return respostaComuns.valor(true);
|
||||||
|
}, _ClassPilao_salvarDeletarRegistros = async function _ClassPilao_salvarDeletarRegistros() {
|
||||||
|
for (const tabela of Object.keys(__classPrivateFieldGet(this, _ClassPilao_codigosParaDeletar, "f"))) {
|
||||||
|
const codigos = [...(__classPrivateFieldGet(this, _ClassPilao_codigosParaDeletar, "f")[tabela] || [])];
|
||||||
|
const url = this.rotaDeletarRegistro().url;
|
||||||
|
const resp = await this.processarRegistros(url, codigos, tabela, "deletar");
|
||||||
|
if (resp.eErro)
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
return respostaComuns.valor(true);
|
||||||
|
};
|
||||||
|
export const Pilao = (_) => new ClassPilao(_);
|
||||||
30
dist-import/pilao-de-dados/Pilao/pilao-api.d.ts
vendored
Normal file
30
dist-import/pilao-de-dados/Pilao/pilao-api.d.ts
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
import type { z } from "zod";
|
||||||
|
import type { zp_registrar_base_dados } from "../_enviar_registros";
|
||||||
|
/**
|
||||||
|
* {
|
||||||
|
* 'rota':{
|
||||||
|
* pr:{}// paramentros de entrada
|
||||||
|
* rs:{}// resposta
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
export type tipo_pilao_api = {
|
||||||
|
/** retorna da data e hora do servido em formato iso */
|
||||||
|
estado_servidor: {
|
||||||
|
pr: {};
|
||||||
|
rs: {
|
||||||
|
data_hora: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
tabelas: {
|
||||||
|
pr: {};
|
||||||
|
rs: z.infer<typeof zp_registrar_base_dados>[];
|
||||||
|
};
|
||||||
|
unicos: {
|
||||||
|
pr: {
|
||||||
|
tabela: string;
|
||||||
|
coluna: string;
|
||||||
|
};
|
||||||
|
rs: any[];
|
||||||
|
};
|
||||||
|
};
|
||||||
1
dist-import/pilao-de-dados/Pilao/pilao-api.js
Normal file
1
dist-import/pilao-de-dados/Pilao/pilao-api.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
||||||
11
dist-import/pilao-de-dados/Pilao/tipagem.d.ts
vendored
Normal file
11
dist-import/pilao-de-dados/Pilao/tipagem.d.ts
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
import type { z } from "zod";
|
||||||
|
import type { visoes_pilao } from "../visoes/listaDeVisoes";
|
||||||
|
export type tipoConstrutorPilao = {
|
||||||
|
produto: string;
|
||||||
|
conta: string;
|
||||||
|
};
|
||||||
|
export type tipoRetornoSerieconsulta<T extends keyof typeof visoes_pilao> = {
|
||||||
|
registros: any[];
|
||||||
|
legenda: string;
|
||||||
|
serie: z.infer<(typeof visoes_pilao)[T]>;
|
||||||
|
};
|
||||||
1
dist-import/pilao-de-dados/Pilao/tipagem.js
Normal file
1
dist-import/pilao-de-dados/Pilao/tipagem.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
import type { tipoResposta } from "p-respostas";
|
|
||||||
import { z } from "zod";
|
|
||||||
import { type zp_produto_conta } from "./variaveis";
|
|
||||||
export declare const zp_deletar_registros: z.ZodObject<{
|
|
||||||
tabela: z.ZodString;
|
|
||||||
codigos: z.ZodArray<z.ZodString, "many">;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
tabela: string;
|
|
||||||
codigos: string[];
|
|
||||||
}, {
|
|
||||||
tabela: string;
|
|
||||||
codigos: string[];
|
|
||||||
}>;
|
|
||||||
export declare const deletar_registros: ({ conta, produto, emDesenvolvimento }: z.infer<typeof zp_produto_conta>) => ({ codigos: codigos_entrada, tabela, }: z.infer<typeof zp_deletar_registros>) => Promise<tipoResposta<true>>;
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
import node_fetch from "cross-fetch";
|
|
||||||
import { respostaComuns } from "p-respostas";
|
|
||||||
import { z } from "zod";
|
|
||||||
import { urlPilao } from "./variaveis";
|
|
||||||
//enviar registros para base de dados
|
|
||||||
export const zp_deletar_registros = z.object({
|
|
||||||
tabela: z.string(),
|
|
||||||
codigos: z.array(z.string()),
|
|
||||||
});
|
|
||||||
export const deletar_registros = ({ conta, produto, emDesenvolvimento }) => async ({ codigos: codigos_entrada, tabela, }) => {
|
|
||||||
const codigos = [...codigos_entrada];
|
|
||||||
const url = new URL(`${urlPilao(emDesenvolvimento).api}/${Object.keys({ deletar_registros })[0]}/${produto}/${conta}`);
|
|
||||||
const tamanhoBlocos = 1000;
|
|
||||||
while (codigos.length > 0) {
|
|
||||||
const bloco = codigos.splice(0, tamanhoBlocos);
|
|
||||||
const resp = await node_fetch(url.toString(), {
|
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify({ tabela, codigos: bloco }),
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
})
|
|
||||||
.then((r) => r.json())
|
|
||||||
.catch((e) => respostaComuns.erro("Erro ao enviar registros", [e.message]))
|
|
||||||
.then((r) => r);
|
|
||||||
if (resp.eErro) {
|
|
||||||
return resp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return respostaComuns.valor(true);
|
|
||||||
};
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
import type { tipoResposta } from "p-respostas";
|
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { type zp_produto_conta } from "./variaveis";
|
|
||||||
export declare const zp_registrar_base_dados: z.ZodObject<{
|
export declare const zp_registrar_base_dados: z.ZodObject<{
|
||||||
tabela: z.ZodString;
|
tabela: z.ZodString;
|
||||||
colunas: z.ZodArray<z.ZodObject<{
|
colunas: z.ZodArray<z.ZodObject<{
|
||||||
|
|
@ -51,4 +49,3 @@ export declare const zp_enviar_registros: z.ZodObject<{
|
||||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "lista_mes" | "lista_data" | "mes" | "data" | null | undefined;
|
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "lista_mes" | "lista_data" | "mes" | "data" | null | undefined;
|
||||||
}>[];
|
}>[];
|
||||||
}>;
|
}>;
|
||||||
export declare const enviar_registros: ({ conta, produto, emDesenvolvimento, ver_log, }: z.infer<typeof zp_produto_conta>) => ({ registros: registros_entrada, tabela, }: z.infer<typeof zp_enviar_registros>) => Promise<tipoResposta<true>>;
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
import node_fetch from "cross-fetch";
|
|
||||||
import { respostaComuns } from "p-respostas";
|
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { urlPilao, z_tipo_coluna_base_dados, } from "./variaveis";
|
import { z_tipos_dados_registro } from "./variaveis";
|
||||||
export const zp_registrar_base_dados = z.object({
|
export const zp_registrar_base_dados = z.object({
|
||||||
tabela: z.string(),
|
tabela: z.string(),
|
||||||
colunas: z.array(z.object({
|
colunas: z.array(z.object({
|
||||||
coluna: z.string(),
|
coluna: z.string(),
|
||||||
tipo: z_tipo_coluna_base_dados,
|
tipo: z_tipos_dados_registro,
|
||||||
})),
|
})),
|
||||||
});
|
});
|
||||||
//enviar registros para base de dados
|
//enviar registros para base de dados
|
||||||
|
|
@ -14,30 +12,6 @@ export const zp_enviar_registros = z.object({
|
||||||
tabela: z.string(),
|
tabela: z.string(),
|
||||||
registros: z.array(z.record(z.string(), z.object({
|
registros: z.array(z.record(z.string(), z.object({
|
||||||
valor: z.any(),
|
valor: z.any(),
|
||||||
tipo: z_tipo_coluna_base_dados.optional().nullable(),
|
tipo: z_tipos_dados_registro.optional().nullable(),
|
||||||
}))),
|
}))),
|
||||||
});
|
});
|
||||||
export const enviar_registros = ({ conta, produto, emDesenvolvimento, ver_log, }) => async ({ registros: registros_entrada, tabela, }) => {
|
|
||||||
const registros = [...registros_entrada];
|
|
||||||
const url = new URL(`${urlPilao(emDesenvolvimento).api}/${Object.keys({ enviar_registros })[0]}/${produto}/${conta}`);
|
|
||||||
if (ver_log)
|
|
||||||
console.log(`[PILÃO]: Enviando "${registros.length}" registros na tabela "${tabela}" para "${url}".`);
|
|
||||||
const tamanhoBlocos = 1000;
|
|
||||||
while (registros.length > 0) {
|
|
||||||
const bloco = registros
|
|
||||||
.splice(0, tamanhoBlocos)
|
|
||||||
.map((r) => Object.fromEntries(Object.entries(r).map(([k, v]) => [k, v === undefined ? null : v])));
|
|
||||||
const resp = await node_fetch(url.toString(), {
|
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify({ tabela, registros: bloco }),
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
})
|
|
||||||
.then((r) => r.json())
|
|
||||||
.catch((e) => respostaComuns.erro("Erro ao enviar registros", [e.message]))
|
|
||||||
.then((r) => r);
|
|
||||||
if (resp.eErro) {
|
|
||||||
return resp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return respostaComuns.valor(true);
|
|
||||||
};
|
|
||||||
|
|
|
||||||
11
dist-import/pilao-de-dados/_serie_consultar.d.ts
vendored
11
dist-import/pilao-de-dados/_serie_consultar.d.ts
vendored
|
|
@ -1,7 +1,4 @@
|
||||||
import type { tipoResposta } from "p-respostas";
|
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { type zp_produto_conta } from "./variaveis";
|
|
||||||
import type { visoes } from "./visoes";
|
|
||||||
export declare const z_filtro: z.ZodObject<{
|
export declare const z_filtro: z.ZodObject<{
|
||||||
coluna: z.ZodString;
|
coluna: z.ZodString;
|
||||||
valor: z.ZodAny;
|
valor: z.ZodAny;
|
||||||
|
|
@ -15,11 +12,3 @@ export declare const z_filtro: z.ZodObject<{
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
valor?: any;
|
valor?: any;
|
||||||
}>;
|
}>;
|
||||||
export declare const serie_consultar: (cliente: z.infer<typeof zp_produto_conta>) => <T extends keyof typeof visoes>(tipoVisao: T, parametros: z.infer<(typeof visoes)[T]>) => {
|
|
||||||
dados: () => Promise<tipoResposta<{
|
|
||||||
registros: any[];
|
|
||||||
legenda: string;
|
|
||||||
serie: z.infer<(typeof visoes)[T]>;
|
|
||||||
}>>;
|
|
||||||
url: () => string;
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -1,36 +1,7 @@
|
||||||
import node_fetch from "cross-fetch";
|
|
||||||
import { respostaComuns } from "p-respostas";
|
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { operadores_pilao, urlPilao } from "./variaveis";
|
import { operadores_pilao } from "./variaveis";
|
||||||
export const z_filtro = z.object({
|
export const z_filtro = z.object({
|
||||||
coluna: z.string(),
|
coluna: z.string(),
|
||||||
valor: z.any(),
|
valor: z.any(),
|
||||||
operador: operadores_pilao,
|
operador: operadores_pilao,
|
||||||
});
|
});
|
||||||
export const serie_consultar = (cliente) => (tipoVisao, parametros) => {
|
|
||||||
const dados = async () => {
|
|
||||||
const url = new URL(`${urlPilao(cliente.emDesenvolvimento).api}/${tipoVisao}/${cliente.produto}/${cliente.conta}`);
|
|
||||||
const resp = await node_fetch(url.toString(), {
|
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify(parametros),
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
})
|
|
||||||
.then((r) => r.json())
|
|
||||||
.catch((e) => respostaComuns.erro("Erro ao enviar registros", [e.message]))
|
|
||||||
.then((r) => r);
|
|
||||||
if (cliente.ver_log)
|
|
||||||
console.log(`[PILÃO]: buscar dados de "${JSON.stringify(parametros)}" para "${url.href}".`);
|
|
||||||
return resp;
|
|
||||||
};
|
|
||||||
const url = () => {
|
|
||||||
const vUrl = new URL(`${urlPilao(cliente.emDesenvolvimento).site}/${tipoVisao}/${cliente.produto}/${cliente.conta}`);
|
|
||||||
const serie = encodeURIComponent(JSON.stringify(parametros, null, 2));
|
|
||||||
if (cliente.ver_log)
|
|
||||||
console.log(`[PILÃO]: Serie Consultar url de "${JSON.stringify(serie)}" para "${vUrl.href}".`);
|
|
||||||
return `${vUrl.href}?serie=${serie}`;
|
|
||||||
};
|
|
||||||
return {
|
|
||||||
dados,
|
|
||||||
url,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
|
||||||
293
dist-import/pilao-de-dados/index.d.ts
vendored
293
dist-import/pilao-de-dados/index.d.ts
vendored
|
|
@ -1,169 +1,13 @@
|
||||||
import { zp_deletar_registros } from "./_deletar_registros";
|
|
||||||
export { PREFIXO_PILAO, urlPilao } from "./variaveis";
|
export { PREFIXO_PILAO, urlPilao } from "./variaveis";
|
||||||
import { zp_enviar_registros } from "./_enviar_registros";
|
export * from "./Pilao";
|
||||||
import { zp_produto_conta } from "./variaveis";
|
export * from "./Pilao/pilao-api";
|
||||||
import { visoes } from "./visoes";
|
export * from "./Pilao/tipagem";
|
||||||
export declare const pPilao: {
|
export declare const pPilao: {
|
||||||
extruturas_de_campos: {
|
extruturas_de_campos: {
|
||||||
z_contagem_em_barra_vertical: {
|
z_contagem_em_barra_vertical: import("./visoes/tipagem").tipo_estrutura_visao_grafico<"z_contagem_em_barra_vertical">;
|
||||||
visao: "z_contagem_em_barra_vertical";
|
z_contagem_em_pizza: import("./visoes/tipagem").tipo_estrutura_visao_grafico<"z_contagem_em_pizza">;
|
||||||
rotulo: string;
|
z_tabela: import("./visoes/tipagem").tipo_estrutura_visao_grafico<"z_tabela">;
|
||||||
tabela: (_: {
|
z_soma_em_barra_vertical: import("./visoes/tipagem").tipo_estrutura_visao_grafico<"z_soma_em_barra_vertical">;
|
||||||
tabela: string;
|
|
||||||
colanuEixoX: string;
|
|
||||||
colunaAgrupamento?: string[] | undefined;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}) => string;
|
|
||||||
descricao: (_: {
|
|
||||||
tabela: string;
|
|
||||||
colanuEixoX: string;
|
|
||||||
colunaAgrupamento?: string[] | undefined;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}) => string;
|
|
||||||
campos: {
|
|
||||||
tabela: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
colanuEixoX: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
colunaAgrupamento: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
filtros: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
descricao_pelo_usuario: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
z_contagem_em_pizza: {
|
|
||||||
visao: "z_contagem_em_pizza";
|
|
||||||
rotulo: string;
|
|
||||||
tabela: (_: {
|
|
||||||
tabela: string;
|
|
||||||
classes: string;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}) => string;
|
|
||||||
descricao: (_: {
|
|
||||||
tabela: string;
|
|
||||||
classes: string;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}) => string;
|
|
||||||
campos: {
|
|
||||||
tabela: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
classes: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
filtros: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
descricao_pelo_usuario: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
z_tabela: {
|
|
||||||
visao: "z_tabela";
|
|
||||||
rotulo: string;
|
|
||||||
tabela: (_: {
|
|
||||||
tabela: string;
|
|
||||||
colunas: string[];
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
coluna_ordem?: string | undefined;
|
|
||||||
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
|
||||||
}) => string;
|
|
||||||
descricao: (_: {
|
|
||||||
tabela: string;
|
|
||||||
colunas: string[];
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
coluna_ordem?: string | undefined;
|
|
||||||
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
|
||||||
}) => string;
|
|
||||||
campos: {
|
|
||||||
tabela: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
colunas: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
filtros: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
descricao_pelo_usuario: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
coluna_ordem: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
direcao_ordem: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
z_contagem_em_barra_vertical: import("zod").ZodObject<{
|
z_contagem_em_barra_vertical: import("zod").ZodObject<{
|
||||||
tabela: import("zod").ZodString;
|
tabela: import("zod").ZodString;
|
||||||
|
|
@ -282,6 +126,61 @@ export declare const pPilao: {
|
||||||
coluna_ordem?: string | undefined;
|
coluna_ordem?: string | undefined;
|
||||||
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
||||||
}>;
|
}>;
|
||||||
|
z_soma_em_barra_vertical: import("zod").ZodObject<{
|
||||||
|
tabela: import("zod").ZodString;
|
||||||
|
colanuEixoX: import("zod").ZodString;
|
||||||
|
colunaSoma: import("zod").ZodString;
|
||||||
|
unidadeSoma: import("zod").ZodOptional<import("zod").ZodString>;
|
||||||
|
colunaAgrupamento: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
||||||
|
filtros: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
||||||
|
coluna: import("zod").ZodString;
|
||||||
|
valor: import("zod").ZodAny;
|
||||||
|
operador: import("zod").ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
|
}, "strip", import("zod").ZodTypeAny, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}>, "many">>;
|
||||||
|
descricao_pelo_usuario: import("zod").ZodOptional<import("zod").ZodString>;
|
||||||
|
}, "strip", import("zod").ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaSoma: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
unidadeSoma?: string | undefined;
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaSoma: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
unidadeSoma?: string | undefined;
|
||||||
|
}>;
|
||||||
|
zp_deletar_registros: import("zod").ZodObject<{
|
||||||
|
tabela: import("zod").ZodString;
|
||||||
|
codigos: import("zod").ZodArray<import("zod").ZodString, "many">;
|
||||||
|
}, "strip", import("zod").ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
codigos: string[];
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
codigos: string[];
|
||||||
|
}>;
|
||||||
zp_registrar_base_dados: import("zod").ZodObject<{
|
zp_registrar_base_dados: import("zod").ZodObject<{
|
||||||
tabela: import("zod").ZodString;
|
tabela: import("zod").ZodString;
|
||||||
colunas: import("zod").ZodArray<import("zod").ZodObject<{
|
colunas: import("zod").ZodArray<import("zod").ZodObject<{
|
||||||
|
|
@ -307,7 +206,7 @@ export declare const pPilao: {
|
||||||
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "lista_mes" | "lista_data" | "mes" | "data";
|
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "lista_mes" | "lista_data" | "mes" | "data";
|
||||||
}[];
|
}[];
|
||||||
}>;
|
}>;
|
||||||
enviar_registros: ({ conta, produto, emDesenvolvimento, ver_log, }: import("zod").TypeOf<typeof zp_produto_conta>) => ({ registros: registros_entrada, tabela, }: import("zod").TypeOf<typeof zp_enviar_registros>) => Promise<import("p-respostas").tipoResposta<true>>;
|
z_tipos_dados_registro: import("zod").ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "lista_mes", "lista_data", "mes", "data"]>;
|
||||||
zp_enviar_registros: import("zod").ZodObject<{
|
zp_enviar_registros: import("zod").ZodObject<{
|
||||||
tabela: import("zod").ZodString;
|
tabela: import("zod").ZodString;
|
||||||
registros: import("zod").ZodArray<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
registros: import("zod").ZodArray<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
||||||
|
|
@ -333,14 +232,6 @@ export declare const pPilao: {
|
||||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "lista_mes" | "lista_data" | "mes" | "data" | null | undefined;
|
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "lista_mes" | "lista_data" | "mes" | "data" | null | undefined;
|
||||||
}>[];
|
}>[];
|
||||||
}>;
|
}>;
|
||||||
serie_consultar: (cliente: import("zod").TypeOf<typeof zp_produto_conta>) => <T extends keyof typeof visoes>(tipoVisao: T, parametros: import("zod").TypeOf<(typeof visoes)[T]>) => {
|
|
||||||
dados: () => Promise<import("p-respostas").tipoResposta<{
|
|
||||||
registros: any[];
|
|
||||||
legenda: string;
|
|
||||||
serie: import("zod").TypeOf<(typeof visoes)[T]>;
|
|
||||||
}>>;
|
|
||||||
url: () => string;
|
|
||||||
};
|
|
||||||
zp_produto_conta: import("zod").ZodObject<{
|
zp_produto_conta: import("zod").ZodObject<{
|
||||||
produto: import("zod").ZodString;
|
produto: import("zod").ZodString;
|
||||||
conta: import("zod").ZodString;
|
conta: import("zod").ZodString;
|
||||||
|
|
@ -358,17 +249,6 @@ export declare const pPilao: {
|
||||||
ver_log?: boolean | undefined;
|
ver_log?: boolean | undefined;
|
||||||
}>;
|
}>;
|
||||||
validarZ: <T>(zodType: import("zod").ZodType<T, any>, objeto: any, mensagem: string) => import("p-respostas").tipoRespostaErro | import("p-respostas").tipoRespostaSucesso<T>;
|
validarZ: <T>(zodType: import("zod").ZodType<T, any>, objeto: any, mensagem: string) => import("p-respostas").tipoRespostaErro | import("p-respostas").tipoRespostaSucesso<T>;
|
||||||
deletar_registros: ({ conta, produto, emDesenvolvimento }: import("zod").TypeOf<typeof zp_produto_conta>) => ({ codigos: codigos_entrada, tabela, }: import("zod").TypeOf<typeof zp_deletar_registros>) => Promise<import("p-respostas").tipoResposta<true>>;
|
|
||||||
zp_deletar_registros: import("zod").ZodObject<{
|
|
||||||
tabela: import("zod").ZodString;
|
|
||||||
codigos: import("zod").ZodArray<import("zod").ZodString, "many">;
|
|
||||||
}, "strip", import("zod").ZodTypeAny, {
|
|
||||||
tabela: string;
|
|
||||||
codigos: string[];
|
|
||||||
}, {
|
|
||||||
tabela: string;
|
|
||||||
codigos: string[];
|
|
||||||
}>;
|
|
||||||
operadores_pilao: import("zod").ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
operadores_pilao: import("zod").ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
operadores_permitidos_por_tipo: {
|
operadores_permitidos_por_tipo: {
|
||||||
texto: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
|
texto: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
|
||||||
|
|
@ -394,7 +274,7 @@ export declare const pPilao: {
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
valor?: any;
|
valor?: any;
|
||||||
}>;
|
}>;
|
||||||
visoes: {
|
visoes_pilao: {
|
||||||
z_contagem_em_barra_vertical: import("zod").ZodObject<{
|
z_contagem_em_barra_vertical: import("zod").ZodObject<{
|
||||||
tabela: import("zod").ZodString;
|
tabela: import("zod").ZodString;
|
||||||
colanuEixoX: import("zod").ZodString;
|
colanuEixoX: import("zod").ZodString;
|
||||||
|
|
@ -512,5 +392,50 @@ export declare const pPilao: {
|
||||||
coluna_ordem?: string | undefined;
|
coluna_ordem?: string | undefined;
|
||||||
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
||||||
}>;
|
}>;
|
||||||
|
z_soma_em_barra_vertical: import("zod").ZodObject<{
|
||||||
|
tabela: import("zod").ZodString;
|
||||||
|
colanuEixoX: import("zod").ZodString;
|
||||||
|
colunaSoma: import("zod").ZodString;
|
||||||
|
unidadeSoma: import("zod").ZodOptional<import("zod").ZodString>;
|
||||||
|
colunaAgrupamento: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
||||||
|
filtros: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
||||||
|
coluna: import("zod").ZodString;
|
||||||
|
valor: import("zod").ZodAny;
|
||||||
|
operador: import("zod").ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
|
}, "strip", import("zod").ZodTypeAny, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}>, "many">>;
|
||||||
|
descricao_pelo_usuario: import("zod").ZodOptional<import("zod").ZodString>;
|
||||||
|
}, "strip", import("zod").ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaSoma: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
unidadeSoma?: string | undefined;
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaSoma: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
unidadeSoma?: string | undefined;
|
||||||
|
}>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,23 @@
|
||||||
import { deletar_registros, zp_deletar_registros } from "./_deletar_registros";
|
|
||||||
export { PREFIXO_PILAO, urlPilao } from "./variaveis";
|
export { PREFIXO_PILAO, urlPilao } from "./variaveis";
|
||||||
import { enviar_registros, zp_enviar_registros, zp_registrar_base_dados, } from "./_enviar_registros";
|
import { zp_enviar_registros, zp_registrar_base_dados, } from "./_enviar_registros";
|
||||||
import { operadores_permitidos_por_tipo, operadores_pilao, validarZ, zp_produto_conta, } from "./variaveis";
|
import { operadores_permitidos_por_tipo, operadores_pilao, validarZ, z_tipos_dados_registro, zp_deletar_registros, zp_produto_conta, } from "./variaveis";
|
||||||
import { serie_consultar, z_filtro } from "./_serie_consultar";
|
export * from "./Pilao";
|
||||||
import { extruturas_de_campos, visoes } from "./visoes";
|
export * from "./Pilao/pilao-api";
|
||||||
|
export * from "./Pilao/tipagem";
|
||||||
|
import { z_filtro } from "./_serie_consultar";
|
||||||
|
import { extruturas_de_campos } from "./visoes";
|
||||||
|
import { visoes_pilao } from "./visoes/listaDeVisoes";
|
||||||
export const pPilao = {
|
export const pPilao = {
|
||||||
|
zp_deletar_registros,
|
||||||
zp_registrar_base_dados,
|
zp_registrar_base_dados,
|
||||||
enviar_registros,
|
z_tipos_dados_registro,
|
||||||
zp_enviar_registros,
|
zp_enviar_registros,
|
||||||
serie_consultar,
|
|
||||||
zp_produto_conta,
|
zp_produto_conta,
|
||||||
validarZ,
|
validarZ,
|
||||||
deletar_registros,
|
|
||||||
zp_deletar_registros,
|
|
||||||
operadores_pilao,
|
operadores_pilao,
|
||||||
operadores_permitidos_por_tipo,
|
operadores_permitidos_por_tipo,
|
||||||
z_filtro,
|
z_filtro,
|
||||||
visoes,
|
visoes_pilao,
|
||||||
...visoes,
|
...visoes_pilao,
|
||||||
extruturas_de_campos,
|
extruturas_de_campos,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
14
dist-import/pilao-de-dados/variaveis.d.ts
vendored
14
dist-import/pilao-de-dados/variaveis.d.ts
vendored
|
|
@ -1,4 +1,14 @@
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
export declare const zp_deletar_registros: z.ZodObject<{
|
||||||
|
tabela: z.ZodString;
|
||||||
|
codigos: z.ZodArray<z.ZodString, "many">;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
codigos: string[];
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
codigos: string[];
|
||||||
|
}>;
|
||||||
export declare const zAmbiente: z.ZodEnum<["desenvolvimento", "producao"]>;
|
export declare const zAmbiente: z.ZodEnum<["desenvolvimento", "producao"]>;
|
||||||
export declare const PREFIXO_PILAO = "/pilao-de-dados";
|
export declare const PREFIXO_PILAO = "/pilao-de-dados";
|
||||||
export declare const validarZ: <T>(zodType: z.ZodType<T, any>, objeto: any, mensagem: string) => import("p-respostas").tipoRespostaErro | import("p-respostas").tipoRespostaSucesso<T>;
|
export declare const validarZ: <T>(zodType: z.ZodType<T, any>, objeto: any, mensagem: string) => import("p-respostas").tipoRespostaErro | import("p-respostas").tipoRespostaSucesso<T>;
|
||||||
|
|
@ -18,10 +28,10 @@ export declare const zp_produto_conta: z.ZodObject<{
|
||||||
emDesenvolvimento?: boolean | undefined;
|
emDesenvolvimento?: boolean | undefined;
|
||||||
ver_log?: boolean | undefined;
|
ver_log?: boolean | undefined;
|
||||||
}>;
|
}>;
|
||||||
export declare const z_tipo_coluna_base_dados: z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "lista_mes", "lista_data", "mes", "data"]>;
|
export declare const z_tipos_dados_registro: z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "lista_mes", "lista_data", "mes", "data"]>;
|
||||||
export declare const operadores_pilao: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
export declare const operadores_pilao: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
export declare const operadores_permitidos_por_tipo: {
|
export declare const operadores_permitidos_por_tipo: {
|
||||||
[key in z.infer<typeof z_tipo_coluna_base_dados>]: z.infer<typeof operadores_pilao>[];
|
[key in z.infer<typeof z_tipos_dados_registro>]: z.infer<typeof operadores_pilao>[];
|
||||||
};
|
};
|
||||||
export declare const z_validar_colunna_base_dados: {
|
export declare const z_validar_colunna_base_dados: {
|
||||||
texto: z.ZodNullable<z.ZodString>;
|
texto: z.ZodNullable<z.ZodString>;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
import { respostaComuns } from "p-respostas";
|
import { respostaComuns } from "p-respostas";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
export const zp_deletar_registros = z.object({
|
||||||
|
tabela: z.string(),
|
||||||
|
codigos: z.array(z.string()),
|
||||||
|
});
|
||||||
export const zAmbiente = z.enum(["desenvolvimento", "producao"]);
|
export const zAmbiente = z.enum(["desenvolvimento", "producao"]);
|
||||||
export const PREFIXO_PILAO = "/pilao-de-dados";
|
export const PREFIXO_PILAO = "/pilao-de-dados";
|
||||||
export const validarZ = (zodType, objeto, mensagem) => {
|
export const validarZ = (zodType, objeto, mensagem) => {
|
||||||
|
|
@ -15,7 +19,7 @@ export const zp_produto_conta = z.object({
|
||||||
emDesenvolvimento: z.boolean().optional(),
|
emDesenvolvimento: z.boolean().optional(),
|
||||||
ver_log: z.boolean().optional(),
|
ver_log: z.boolean().optional(),
|
||||||
});
|
});
|
||||||
export const z_tipo_coluna_base_dados = z.enum([
|
export const z_tipos_dados_registro = z.enum([
|
||||||
"texto",
|
"texto",
|
||||||
"numero",
|
"numero",
|
||||||
"confirmacao",
|
"confirmacao",
|
||||||
|
|
|
||||||
6
dist-import/pilao-de-dados/visoes/estrutura_de_campos/index.d.ts
vendored
Normal file
6
dist-import/pilao-de-dados/visoes/estrutura_de_campos/index.d.ts
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
import type { visoes_pilao } from "../listaDeVisoes";
|
||||||
|
import type { tipo_estrutura_visao_grafico } from "../tipagem";
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
export declare const extruturas_de_campos: {
|
||||||
|
[T in keyof typeof visoes_pilao]: tipo_estrutura_visao_grafico<T>;
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { z_contagem_em_barra_vertical } from "./z_contagem_em_barra_vertical";
|
||||||
|
import { z_contagem_em_pizza } from "./z_contagem_em_pizza";
|
||||||
|
import { z_soma_em_barra_vertical } from "./z_soma_em_barra_vertical";
|
||||||
|
import { z_tabela } from "./z_tabela";
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
export const extruturas_de_campos = {
|
||||||
|
z_contagem_em_barra_vertical,
|
||||||
|
z_contagem_em_pizza,
|
||||||
|
z_soma_em_barra_vertical,
|
||||||
|
z_tabela,
|
||||||
|
};
|
||||||
3
dist-import/pilao-de-dados/visoes/estrutura_de_campos/z_contagem_em_barra_vertical.d.ts
vendored
Normal file
3
dist-import/pilao-de-dados/visoes/estrutura_de_campos/z_contagem_em_barra_vertical.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
import type { tipo_estrutura_visao_grafico } from "../tipagem";
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
export declare const z_contagem_em_barra_vertical: tipo_estrutura_visao_grafico<"z_contagem_em_barra_vertical">;
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
// usar describe para definir o tipo de campo para render do componente
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
export const z_contagem_em_barra_vertical = {
|
||||||
|
visao: "z_contagem_em_barra_vertical",
|
||||||
|
rotulo: "Contagem em Barra Vertical",
|
||||||
|
tabela: ({ tabela }) => tabela,
|
||||||
|
descricao: ({ tabela, descricao_pelo_usuario, colanuEixoX, filtros, colunaAgrupamento, }) => {
|
||||||
|
if (String(descricao_pelo_usuario || "").trim())
|
||||||
|
return String(descricao_pelo_usuario || "").trim();
|
||||||
|
return `Contagem de ${tabela} por ${colanuEixoX}${!filtros?.length
|
||||||
|
? ""
|
||||||
|
: `, quando ${filtros
|
||||||
|
.map(({ coluna, operador, valor }) => `${coluna} ${operador} ${valor}`)
|
||||||
|
.join(", ")}`}${!colunaAgrupamento?.length
|
||||||
|
? ""
|
||||||
|
: `, agrupado por ${colunaAgrupamento.join(", ")}`}.`;
|
||||||
|
},
|
||||||
|
campos: {
|
||||||
|
tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 },
|
||||||
|
colanuEixoX: {
|
||||||
|
rotulo: "Coluna do Eixo X",
|
||||||
|
tipo_campo: "coluna",
|
||||||
|
order: 2,
|
||||||
|
},
|
||||||
|
colunaAgrupamento: {
|
||||||
|
rotulo: "Colunas de Agrupamento",
|
||||||
|
tipo_campo: "lista_colunas",
|
||||||
|
order: 3,
|
||||||
|
},
|
||||||
|
descricao_pelo_usuario: {
|
||||||
|
rotulo: "Descrição (opcional)",
|
||||||
|
tipo_campo: "texto",
|
||||||
|
order: 4,
|
||||||
|
},
|
||||||
|
filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 5 },
|
||||||
|
},
|
||||||
|
};
|
||||||
3
dist-import/pilao-de-dados/visoes/estrutura_de_campos/z_contagem_em_pizza.d.ts
vendored
Normal file
3
dist-import/pilao-de-dados/visoes/estrutura_de_campos/z_contagem_em_pizza.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
import type { tipo_estrutura_visao_grafico } from "../tipagem";
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
export declare const z_contagem_em_pizza: tipo_estrutura_visao_grafico<"z_contagem_em_pizza">;
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
// usar describe para definir o tipo de campo para render do componente
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
export const z_contagem_em_pizza = {
|
||||||
|
visao: "z_contagem_em_pizza",
|
||||||
|
rotulo: "Contagem em Pizza",
|
||||||
|
tabela: ({ tabela }) => tabela,
|
||||||
|
descricao: ({ tabela, descricao_pelo_usuario, classes, filtros }) => {
|
||||||
|
if (String(descricao_pelo_usuario || "").trim())
|
||||||
|
return String(descricao_pelo_usuario || "").trim();
|
||||||
|
return `Contagem de ${tabela} por ${classes}${!filtros?.length
|
||||||
|
? ""
|
||||||
|
: `, quando ${filtros
|
||||||
|
.map(({ coluna, operador, valor }) => `${coluna} ${operador} ${valor}`)
|
||||||
|
.join(", ")}`}.`;
|
||||||
|
},
|
||||||
|
campos: {
|
||||||
|
tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 },
|
||||||
|
classes: { rotulo: "Classes", tipo_campo: "coluna", order: 2 },
|
||||||
|
descricao_pelo_usuario: {
|
||||||
|
rotulo: "Descrição (opcional)",
|
||||||
|
tipo_campo: "texto",
|
||||||
|
order: 3,
|
||||||
|
},
|
||||||
|
filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 4 },
|
||||||
|
},
|
||||||
|
};
|
||||||
3
dist-import/pilao-de-dados/visoes/estrutura_de_campos/z_soma_em_barra_vertical.d.ts
vendored
Normal file
3
dist-import/pilao-de-dados/visoes/estrutura_de_campos/z_soma_em_barra_vertical.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
import type { tipo_estrutura_visao_grafico } from "../tipagem";
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
export declare const z_soma_em_barra_vertical: tipo_estrutura_visao_grafico<"z_soma_em_barra_vertical">;
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
// usar describe para definir o tipo de campo para render do componente
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
export const z_soma_em_barra_vertical = {
|
||||||
|
visao: "z_soma_em_barra_vertical",
|
||||||
|
rotulo: "Soma em Barra Vertical",
|
||||||
|
tabela: ({ tabela }) => tabela,
|
||||||
|
descricao: ({ descricao_pelo_usuario, colanuEixoX, filtros, colunaAgrupamento, colunaSoma, }) => {
|
||||||
|
if (String(descricao_pelo_usuario || "").trim())
|
||||||
|
return String(descricao_pelo_usuario || "").trim();
|
||||||
|
return `Soma de ${colunaSoma} por ${colanuEixoX}${!filtros?.length
|
||||||
|
? ""
|
||||||
|
: `, quando ${filtros
|
||||||
|
.map(({ coluna, operador, valor }) => `${coluna} ${operador} ${valor}`)
|
||||||
|
.join(", ")}`}${!colunaAgrupamento?.length
|
||||||
|
? ""
|
||||||
|
: `, agrupado por ${colunaAgrupamento.join(", ")}`}.`;
|
||||||
|
},
|
||||||
|
campos: {
|
||||||
|
tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 },
|
||||||
|
colunaSoma: {
|
||||||
|
rotulo: "Coluna de Somatória",
|
||||||
|
tipo_campo: "coluna",
|
||||||
|
order: 2,
|
||||||
|
},
|
||||||
|
unidadeSoma: {
|
||||||
|
rotulo: "Unidade de Somatória",
|
||||||
|
tipo_campo: "texto",
|
||||||
|
order: 3,
|
||||||
|
},
|
||||||
|
colanuEixoX: {
|
||||||
|
rotulo: "Coluna do Eixo X",
|
||||||
|
tipo_campo: "coluna",
|
||||||
|
order: 4,
|
||||||
|
},
|
||||||
|
colunaAgrupamento: {
|
||||||
|
rotulo: "Colunas de Agrupamento",
|
||||||
|
tipo_campo: "lista_colunas",
|
||||||
|
order: 5,
|
||||||
|
},
|
||||||
|
descricao_pelo_usuario: {
|
||||||
|
rotulo: "Descrição (opcional)",
|
||||||
|
tipo_campo: "texto",
|
||||||
|
order: 6,
|
||||||
|
},
|
||||||
|
filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 5 },
|
||||||
|
},
|
||||||
|
};
|
||||||
3
dist-import/pilao-de-dados/visoes/estrutura_de_campos/z_tabela.d.ts
vendored
Normal file
3
dist-import/pilao-de-dados/visoes/estrutura_de_campos/z_tabela.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
import type { tipo_estrutura_visao_grafico } from "../tipagem";
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
export declare const z_tabela: tipo_estrutura_visao_grafico<"z_tabela">;
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
// usar describe para definir o tipo de campo para render do componente
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
export const z_tabela = {
|
||||||
|
visao: "z_tabela",
|
||||||
|
rotulo: "Tabela",
|
||||||
|
tabela: ({ tabela }) => tabela,
|
||||||
|
descricao: ({ tabela, descricao_pelo_usuario, filtros }) => {
|
||||||
|
if (String(descricao_pelo_usuario || "").trim())
|
||||||
|
return String(descricao_pelo_usuario || "").trim();
|
||||||
|
return `Consulta na ${tabela} ${!filtros?.length
|
||||||
|
? ""
|
||||||
|
: `, quando ${filtros
|
||||||
|
.map(({ coluna, operador, valor }) => `${coluna} ${operador} ${valor}`)
|
||||||
|
.join(", ")}`}.`;
|
||||||
|
},
|
||||||
|
campos: {
|
||||||
|
tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 },
|
||||||
|
colunas: { rotulo: "Colunas", tipo_campo: "lista_colunas", order: 2 },
|
||||||
|
descricao_pelo_usuario: {
|
||||||
|
rotulo: "Descrição (opcional)",
|
||||||
|
tipo_campo: "texto",
|
||||||
|
order: 3,
|
||||||
|
},
|
||||||
|
coluna_ordem: {
|
||||||
|
rotulo: "Coluna de Ordem",
|
||||||
|
tipo_campo: "coluna",
|
||||||
|
order: 4,
|
||||||
|
},
|
||||||
|
direcao_ordem: {
|
||||||
|
rotulo: "Direção de Ordem",
|
||||||
|
tipo_campo: "ordem",
|
||||||
|
order: 5,
|
||||||
|
},
|
||||||
|
filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 6 },
|
||||||
|
},
|
||||||
|
};
|
||||||
261
dist-import/pilao-de-dados/visoes/index.d.ts
vendored
261
dist-import/pilao-de-dados/visoes/index.d.ts
vendored
|
|
@ -1,260 +1 @@
|
||||||
import { z } from "zod";
|
export * from "./estrutura_de_campos";
|
||||||
declare const z_tipos_campos: z.ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>;
|
|
||||||
export declare const z_contagem_em_barra_vertical: z.ZodObject<{
|
|
||||||
tabela: z.ZodString;
|
|
||||||
colanuEixoX: z.ZodString;
|
|
||||||
colunaAgrupamento: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
||||||
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
||||||
coluna: z.ZodString;
|
|
||||||
valor: z.ZodAny;
|
|
||||||
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}>, "many">>;
|
|
||||||
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
tabela: string;
|
|
||||||
colanuEixoX: string;
|
|
||||||
colunaAgrupamento?: string[] | undefined;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}, {
|
|
||||||
tabela: string;
|
|
||||||
colanuEixoX: string;
|
|
||||||
colunaAgrupamento?: string[] | undefined;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}>;
|
|
||||||
export declare const z_contagem_em_pizza: z.ZodObject<{
|
|
||||||
tabela: z.ZodString;
|
|
||||||
classes: z.ZodString;
|
|
||||||
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
||||||
coluna: z.ZodString;
|
|
||||||
valor: z.ZodAny;
|
|
||||||
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}>, "many">>;
|
|
||||||
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
tabela: string;
|
|
||||||
classes: string;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}, {
|
|
||||||
tabela: string;
|
|
||||||
classes: string;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}>;
|
|
||||||
export declare const z_tabela: z.ZodObject<{
|
|
||||||
tabela: z.ZodString;
|
|
||||||
colunas: z.ZodArray<z.ZodString, "many">;
|
|
||||||
coluna_ordem: z.ZodOptional<z.ZodString>;
|
|
||||||
direcao_ordem: z.ZodOptional<z.ZodEnum<["asc", "desc", "1", "-1"]>>;
|
|
||||||
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
||||||
coluna: z.ZodString;
|
|
||||||
valor: z.ZodAny;
|
|
||||||
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}>, "many">>;
|
|
||||||
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
tabela: string;
|
|
||||||
colunas: string[];
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
coluna_ordem?: string | undefined;
|
|
||||||
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
|
||||||
}, {
|
|
||||||
tabela: string;
|
|
||||||
colunas: string[];
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
coluna_ordem?: string | undefined;
|
|
||||||
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
|
||||||
}>;
|
|
||||||
export declare const visoes: {
|
|
||||||
z_contagem_em_barra_vertical: z.ZodObject<{
|
|
||||||
tabela: z.ZodString;
|
|
||||||
colanuEixoX: z.ZodString;
|
|
||||||
colunaAgrupamento: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
||||||
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
||||||
coluna: z.ZodString;
|
|
||||||
valor: z.ZodAny;
|
|
||||||
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}>, "many">>;
|
|
||||||
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
tabela: string;
|
|
||||||
colanuEixoX: string;
|
|
||||||
colunaAgrupamento?: string[] | undefined;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}, {
|
|
||||||
tabela: string;
|
|
||||||
colanuEixoX: string;
|
|
||||||
colunaAgrupamento?: string[] | undefined;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}>;
|
|
||||||
z_contagem_em_pizza: z.ZodObject<{
|
|
||||||
tabela: z.ZodString;
|
|
||||||
classes: z.ZodString;
|
|
||||||
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
||||||
coluna: z.ZodString;
|
|
||||||
valor: z.ZodAny;
|
|
||||||
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}>, "many">>;
|
|
||||||
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
tabela: string;
|
|
||||||
classes: string;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}, {
|
|
||||||
tabela: string;
|
|
||||||
classes: string;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}>;
|
|
||||||
z_tabela: z.ZodObject<{
|
|
||||||
tabela: z.ZodString;
|
|
||||||
colunas: z.ZodArray<z.ZodString, "many">;
|
|
||||||
coluna_ordem: z.ZodOptional<z.ZodString>;
|
|
||||||
direcao_ordem: z.ZodOptional<z.ZodEnum<["asc", "desc", "1", "-1"]>>;
|
|
||||||
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
||||||
coluna: z.ZodString;
|
|
||||||
valor: z.ZodAny;
|
|
||||||
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}>, "many">>;
|
|
||||||
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
tabela: string;
|
|
||||||
colunas: string[];
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
coluna_ordem?: string | undefined;
|
|
||||||
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
|
||||||
}, {
|
|
||||||
tabela: string;
|
|
||||||
colunas: string[];
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
coluna_ordem?: string | undefined;
|
|
||||||
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
|
||||||
}>;
|
|
||||||
};
|
|
||||||
/** Cria a estrutura de campos para insersão de dados */
|
|
||||||
export declare const extruturas_de_campos: {
|
|
||||||
[z in keyof typeof visoes]: {
|
|
||||||
/** Nome da Visão */
|
|
||||||
visao: z;
|
|
||||||
/** Rotulo */
|
|
||||||
rotulo: string;
|
|
||||||
/** Retorna a tabela Referente ao Registro */
|
|
||||||
tabela: (_: z.infer<(typeof visoes)[z]>) => string;
|
|
||||||
/** Descrição */
|
|
||||||
descricao: (_: z.infer<(typeof visoes)[z]>) => string;
|
|
||||||
/** Lista os campos e suas configurações */
|
|
||||||
campos: {
|
|
||||||
[c in keyof Required<z.infer<(typeof visoes)[z]>>]: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: z.infer<typeof z_tipos_campos>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
export {};
|
|
||||||
|
|
|
||||||
|
|
@ -1,133 +1 @@
|
||||||
import { z } from "zod";
|
export * from "./estrutura_de_campos";
|
||||||
import { z_filtro } from "../_serie_consultar";
|
|
||||||
// usar describe para definir o tipo de campo para render do componente
|
|
||||||
const z_tipos_campos = z.enum([
|
|
||||||
"tabela",
|
|
||||||
"coluna",
|
|
||||||
"texto",
|
|
||||||
"lista_colunas",
|
|
||||||
"lista_filtros",
|
|
||||||
"ordem",
|
|
||||||
]);
|
|
||||||
export const z_contagem_em_barra_vertical = z.object({
|
|
||||||
tabela: z.string(),
|
|
||||||
colanuEixoX: z.string(),
|
|
||||||
colunaAgrupamento: z.string().array().optional(),
|
|
||||||
filtros: z_filtro.array().optional(),
|
|
||||||
descricao_pelo_usuario: z.string().optional(),
|
|
||||||
});
|
|
||||||
export const z_contagem_em_pizza = z.object({
|
|
||||||
tabela: z.string(),
|
|
||||||
classes: z.string(),
|
|
||||||
filtros: z_filtro.array().optional(),
|
|
||||||
descricao_pelo_usuario: z.string().optional(),
|
|
||||||
});
|
|
||||||
export const z_tabela = z.object({
|
|
||||||
tabela: z.string(),
|
|
||||||
colunas: z.string().array(),
|
|
||||||
coluna_ordem: z.string().optional(),
|
|
||||||
direcao_ordem: z.enum(["asc", "desc", "1", "-1"]).optional(),
|
|
||||||
filtros: z_filtro.array().optional(),
|
|
||||||
descricao_pelo_usuario: z.string().optional(),
|
|
||||||
});
|
|
||||||
export const visoes = {
|
|
||||||
z_contagem_em_barra_vertical,
|
|
||||||
z_contagem_em_pizza,
|
|
||||||
z_tabela,
|
|
||||||
};
|
|
||||||
/** Cria a estrutura de campos para insersão de dados */
|
|
||||||
export const extruturas_de_campos = {
|
|
||||||
z_contagem_em_barra_vertical: {
|
|
||||||
visao: "z_contagem_em_barra_vertical",
|
|
||||||
rotulo: "Contagem em Barra Vertical",
|
|
||||||
tabela: ({ tabela }) => tabela,
|
|
||||||
descricao: ({ tabela, descricao_pelo_usuario, colanuEixoX, filtros, colunaAgrupamento, }) => {
|
|
||||||
if (String(descricao_pelo_usuario || "").trim())
|
|
||||||
return String(descricao_pelo_usuario || "").trim();
|
|
||||||
return `Contagem de ${tabela} por ${colanuEixoX}${!filtros?.length
|
|
||||||
? ""
|
|
||||||
: `, quando ${filtros
|
|
||||||
.map(({ coluna, operador, valor }) => `${coluna} ${operador} ${valor}`)
|
|
||||||
.join(", ")}`}${!colunaAgrupamento?.length
|
|
||||||
? ""
|
|
||||||
: `, agrupado por ${colunaAgrupamento.join(", ")}`}.`;
|
|
||||||
},
|
|
||||||
campos: {
|
|
||||||
tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 },
|
|
||||||
colanuEixoX: {
|
|
||||||
rotulo: "Coluna do Eixo X",
|
|
||||||
tipo_campo: "coluna",
|
|
||||||
order: 2,
|
|
||||||
},
|
|
||||||
colunaAgrupamento: {
|
|
||||||
rotulo: "Colunas de Agrupamento",
|
|
||||||
tipo_campo: "lista_colunas",
|
|
||||||
order: 3,
|
|
||||||
},
|
|
||||||
descricao_pelo_usuario: {
|
|
||||||
rotulo: "Descrição (opcional)",
|
|
||||||
tipo_campo: "texto",
|
|
||||||
order: 4,
|
|
||||||
},
|
|
||||||
filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 5 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
z_contagem_em_pizza: {
|
|
||||||
visao: "z_contagem_em_pizza",
|
|
||||||
rotulo: "Contagem em Pizza",
|
|
||||||
tabela: ({ tabela }) => tabela,
|
|
||||||
descricao: ({ tabela, descricao_pelo_usuario, classes, filtros }) => {
|
|
||||||
if (String(descricao_pelo_usuario || "").trim())
|
|
||||||
return String(descricao_pelo_usuario || "").trim();
|
|
||||||
return `Contagem de ${tabela} por ${classes}${!filtros?.length
|
|
||||||
? ""
|
|
||||||
: `, quando ${filtros
|
|
||||||
.map(({ coluna, operador, valor }) => `${coluna} ${operador} ${valor}`)
|
|
||||||
.join(", ")}`}.`;
|
|
||||||
},
|
|
||||||
campos: {
|
|
||||||
tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 },
|
|
||||||
classes: { rotulo: "Classes", tipo_campo: "coluna", order: 2 },
|
|
||||||
descricao_pelo_usuario: {
|
|
||||||
rotulo: "Descrição (opcional)",
|
|
||||||
tipo_campo: "texto",
|
|
||||||
order: 3,
|
|
||||||
},
|
|
||||||
filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 4 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
z_tabela: {
|
|
||||||
visao: "z_tabela",
|
|
||||||
rotulo: "Tabela",
|
|
||||||
tabela: ({ tabela }) => tabela,
|
|
||||||
descricao: ({ tabela, descricao_pelo_usuario, filtros }) => {
|
|
||||||
if (String(descricao_pelo_usuario || "").trim())
|
|
||||||
return String(descricao_pelo_usuario || "").trim();
|
|
||||||
return `Consulta na ${tabela} ${!filtros?.length
|
|
||||||
? ""
|
|
||||||
: `, quando ${filtros
|
|
||||||
.map(({ coluna, operador, valor }) => `${coluna} ${operador} ${valor}`)
|
|
||||||
.join(", ")}`}.`;
|
|
||||||
},
|
|
||||||
campos: {
|
|
||||||
tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 },
|
|
||||||
colunas: { rotulo: "Colunas", tipo_campo: "lista_colunas", order: 2 },
|
|
||||||
descricao_pelo_usuario: {
|
|
||||||
rotulo: "Descrição (opcional)",
|
|
||||||
tipo_campo: "texto",
|
|
||||||
order: 3,
|
|
||||||
},
|
|
||||||
coluna_ordem: {
|
|
||||||
rotulo: "Coluna de Ordem",
|
|
||||||
tipo_campo: "coluna",
|
|
||||||
order: 4,
|
|
||||||
},
|
|
||||||
direcao_ordem: {
|
|
||||||
rotulo: "Direção de Ordem",
|
|
||||||
tipo_campo: "ordem",
|
|
||||||
order: 5,
|
|
||||||
},
|
|
||||||
filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 6 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
||||||
327
dist-import/pilao-de-dados/visoes/listaDeVisoes.d.ts
vendored
Normal file
327
dist-import/pilao-de-dados/visoes/listaDeVisoes.d.ts
vendored
Normal file
|
|
@ -0,0 +1,327 @@
|
||||||
|
import { z } from "zod";
|
||||||
|
export declare const z_contagem_em_barra_vertical: z.ZodObject<{
|
||||||
|
tabela: z.ZodString;
|
||||||
|
colanuEixoX: z.ZodString;
|
||||||
|
colunaAgrupamento: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||||
|
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||||
|
coluna: z.ZodString;
|
||||||
|
valor: z.ZodAny;
|
||||||
|
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}>, "many">>;
|
||||||
|
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
}>;
|
||||||
|
export declare const z_soma_em_barra_vertical: z.ZodObject<{
|
||||||
|
tabela: z.ZodString;
|
||||||
|
colanuEixoX: z.ZodString;
|
||||||
|
colunaSoma: z.ZodString;
|
||||||
|
unidadeSoma: z.ZodOptional<z.ZodString>;
|
||||||
|
colunaAgrupamento: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||||
|
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||||
|
coluna: z.ZodString;
|
||||||
|
valor: z.ZodAny;
|
||||||
|
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}>, "many">>;
|
||||||
|
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaSoma: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
unidadeSoma?: string | undefined;
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaSoma: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
unidadeSoma?: string | undefined;
|
||||||
|
}>;
|
||||||
|
export declare const z_contagem_em_pizza: z.ZodObject<{
|
||||||
|
tabela: z.ZodString;
|
||||||
|
classes: z.ZodString;
|
||||||
|
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||||
|
coluna: z.ZodString;
|
||||||
|
valor: z.ZodAny;
|
||||||
|
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}>, "many">>;
|
||||||
|
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
classes: string;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
classes: string;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
}>;
|
||||||
|
export declare const z_tabela: z.ZodObject<{
|
||||||
|
tabela: z.ZodString;
|
||||||
|
colunas: z.ZodArray<z.ZodString, "many">;
|
||||||
|
coluna_ordem: z.ZodOptional<z.ZodString>;
|
||||||
|
direcao_ordem: z.ZodOptional<z.ZodEnum<["asc", "desc", "1", "-1"]>>;
|
||||||
|
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||||
|
coluna: z.ZodString;
|
||||||
|
valor: z.ZodAny;
|
||||||
|
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}>, "many">>;
|
||||||
|
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
colunas: string[];
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
coluna_ordem?: string | undefined;
|
||||||
|
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
colunas: string[];
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
coluna_ordem?: string | undefined;
|
||||||
|
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
||||||
|
}>;
|
||||||
|
export declare const visoes_pilao: {
|
||||||
|
z_contagem_em_barra_vertical: z.ZodObject<{
|
||||||
|
tabela: z.ZodString;
|
||||||
|
colanuEixoX: z.ZodString;
|
||||||
|
colunaAgrupamento: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||||
|
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||||
|
coluna: z.ZodString;
|
||||||
|
valor: z.ZodAny;
|
||||||
|
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}>, "many">>;
|
||||||
|
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
}>;
|
||||||
|
z_contagem_em_pizza: z.ZodObject<{
|
||||||
|
tabela: z.ZodString;
|
||||||
|
classes: z.ZodString;
|
||||||
|
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||||
|
coluna: z.ZodString;
|
||||||
|
valor: z.ZodAny;
|
||||||
|
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}>, "many">>;
|
||||||
|
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
classes: string;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
classes: string;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
}>;
|
||||||
|
z_tabela: z.ZodObject<{
|
||||||
|
tabela: z.ZodString;
|
||||||
|
colunas: z.ZodArray<z.ZodString, "many">;
|
||||||
|
coluna_ordem: z.ZodOptional<z.ZodString>;
|
||||||
|
direcao_ordem: z.ZodOptional<z.ZodEnum<["asc", "desc", "1", "-1"]>>;
|
||||||
|
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||||
|
coluna: z.ZodString;
|
||||||
|
valor: z.ZodAny;
|
||||||
|
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}>, "many">>;
|
||||||
|
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
colunas: string[];
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
coluna_ordem?: string | undefined;
|
||||||
|
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
colunas: string[];
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
coluna_ordem?: string | undefined;
|
||||||
|
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
||||||
|
}>;
|
||||||
|
z_soma_em_barra_vertical: z.ZodObject<{
|
||||||
|
tabela: z.ZodString;
|
||||||
|
colanuEixoX: z.ZodString;
|
||||||
|
colunaSoma: z.ZodString;
|
||||||
|
unidadeSoma: z.ZodOptional<z.ZodString>;
|
||||||
|
colunaAgrupamento: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||||
|
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||||
|
coluna: z.ZodString;
|
||||||
|
valor: z.ZodAny;
|
||||||
|
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}>, "many">>;
|
||||||
|
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaSoma: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
unidadeSoma?: string | undefined;
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaSoma: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
unidadeSoma?: string | undefined;
|
||||||
|
}>;
|
||||||
|
};
|
||||||
38
dist-import/pilao-de-dados/visoes/listaDeVisoes.js
Normal file
38
dist-import/pilao-de-dados/visoes/listaDeVisoes.js
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
import { z } from "zod";
|
||||||
|
import { z_filtro } from "../_serie_consultar";
|
||||||
|
export const z_contagem_em_barra_vertical = z.object({
|
||||||
|
tabela: z.string(),
|
||||||
|
colanuEixoX: z.string(),
|
||||||
|
colunaAgrupamento: z.string().array().optional(),
|
||||||
|
filtros: z_filtro.array().optional(),
|
||||||
|
descricao_pelo_usuario: z.string().optional(),
|
||||||
|
});
|
||||||
|
export const z_soma_em_barra_vertical = z.object({
|
||||||
|
tabela: z.string(),
|
||||||
|
colanuEixoX: z.string(),
|
||||||
|
colunaSoma: z.string(),
|
||||||
|
unidadeSoma: z.string().optional(),
|
||||||
|
colunaAgrupamento: z.string().array().optional(),
|
||||||
|
filtros: z_filtro.array().optional(),
|
||||||
|
descricao_pelo_usuario: z.string().optional(),
|
||||||
|
});
|
||||||
|
export const z_contagem_em_pizza = z.object({
|
||||||
|
tabela: z.string(),
|
||||||
|
classes: z.string(),
|
||||||
|
filtros: z_filtro.array().optional(),
|
||||||
|
descricao_pelo_usuario: z.string().optional(),
|
||||||
|
});
|
||||||
|
export const z_tabela = z.object({
|
||||||
|
tabela: z.string(),
|
||||||
|
colunas: z.string().array(),
|
||||||
|
coluna_ordem: z.string().optional(),
|
||||||
|
direcao_ordem: z.enum(["asc", "desc", "1", "-1"]).optional(),
|
||||||
|
filtros: z_filtro.array().optional(),
|
||||||
|
descricao_pelo_usuario: z.string().optional(),
|
||||||
|
});
|
||||||
|
export const visoes_pilao = {
|
||||||
|
z_contagem_em_barra_vertical,
|
||||||
|
z_contagem_em_pizza,
|
||||||
|
z_tabela,
|
||||||
|
z_soma_em_barra_vertical,
|
||||||
|
};
|
||||||
21
dist-import/pilao-de-dados/visoes/tipagem.d.ts
vendored
Normal file
21
dist-import/pilao-de-dados/visoes/tipagem.d.ts
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
import { z } from "zod";
|
||||||
|
import type { visoes_pilao } from "./listaDeVisoes";
|
||||||
|
export declare const z_tipos_campos_reg_grafico: z.ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>;
|
||||||
|
export type tipo_estrutura_visao_grafico<T extends keyof typeof visoes_pilao> = {
|
||||||
|
/** Nome da Visão */
|
||||||
|
visao: T;
|
||||||
|
/** Rotulo */
|
||||||
|
rotulo: string;
|
||||||
|
/** Retorna a tabela Referente ao Registro */
|
||||||
|
tabela: (_: z.infer<(typeof visoes_pilao)[T]>) => string;
|
||||||
|
/** Descrição */
|
||||||
|
descricao: (_: z.infer<(typeof visoes_pilao)[T]>) => string;
|
||||||
|
/** Lista os campos e suas configurações */
|
||||||
|
campos: {
|
||||||
|
[c in keyof Required<z.infer<(typeof visoes_pilao)[T]>>]: {
|
||||||
|
rotulo: string;
|
||||||
|
tipo_campo: z.infer<typeof z_tipos_campos_reg_grafico>;
|
||||||
|
order: number;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
9
dist-import/pilao-de-dados/visoes/tipagem.js
Normal file
9
dist-import/pilao-de-dados/visoes/tipagem.js
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
import { z } from "zod";
|
||||||
|
export const z_tipos_campos_reg_grafico = z.enum([
|
||||||
|
"tabela",
|
||||||
|
"coluna",
|
||||||
|
"texto",
|
||||||
|
"lista_colunas",
|
||||||
|
"lista_filtros",
|
||||||
|
"ordem",
|
||||||
|
]);
|
||||||
56
dist-require/pilao-de-dados/Pilao/index.d.ts
vendored
Normal file
56
dist-require/pilao-de-dados/Pilao/index.d.ts
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
/** Drive completo do piilão de dados */
|
||||||
|
import { type tipoResposta } from "p-respostas";
|
||||||
|
import type { z } from "zod";
|
||||||
|
import type { zp_enviar_registros } from "../_enviar_registros";
|
||||||
|
import { type zp_deletar_registros } from "../variaveis";
|
||||||
|
import type { visoes_pilao } from "../visoes/listaDeVisoes";
|
||||||
|
import type { tipo_pilao_api } from "./pilao-api.ts";
|
||||||
|
import type { tipoConstrutorPilao, tipoRetornoSerieconsulta } from "./tipagem";
|
||||||
|
declare class ClassPilao {
|
||||||
|
#private;
|
||||||
|
constructor({ conta, produto, emDesenvolvimento, ver_log, }: tipoConstrutorPilao & {
|
||||||
|
ver_log?: boolean;
|
||||||
|
emDesenvolvimento?: boolean;
|
||||||
|
});
|
||||||
|
rotaEnviarRegistros(): {
|
||||||
|
rota: string;
|
||||||
|
url: string;
|
||||||
|
};
|
||||||
|
rotaDeletarRegistro(): {
|
||||||
|
rota: string;
|
||||||
|
url: string;
|
||||||
|
};
|
||||||
|
rotaConsultarSerie(tipoVisao: keyof typeof visoes_pilao | ":tipoVisao"): {
|
||||||
|
rota: string;
|
||||||
|
url: string;
|
||||||
|
};
|
||||||
|
rotaIframeSerie(tipoVisao: keyof typeof visoes_pilao | ":tipoVisao"): {
|
||||||
|
rota: string;
|
||||||
|
url: string;
|
||||||
|
};
|
||||||
|
rotaFuncaoApi(funcao: keyof tipo_pilao_api | ":funcao"): {
|
||||||
|
rota: string;
|
||||||
|
url: string;
|
||||||
|
};
|
||||||
|
consultarApi<T extends keyof tipo_pilao_api>(funcao: T, parametros: tipo_pilao_api[T]["pr"]): Promise<tipoResposta<tipo_pilao_api[T]["rs"]>>;
|
||||||
|
get baseUrlApi(): "https://carro-de-boi.idz.one" | "http://localhost:5080";
|
||||||
|
get baseUrlSite(): "https://carro-de-boi.idz.one" | "http://localhost:5081";
|
||||||
|
validarCliente(_: any): tipoResposta<tipoConstrutorPilao>;
|
||||||
|
adicionarRegistroParaEnviar(tabela: string, ...registros: z.infer<typeof zp_enviar_registros>["registros"]): this;
|
||||||
|
adicionarCodigoParaDeletar(tabela: string, ...codigos: z.infer<typeof zp_deletar_registros>["codigos"]): this;
|
||||||
|
private processarRegistros;
|
||||||
|
salvarRegistros(): Promise<tipoResposta<true>>;
|
||||||
|
serieConsultar<T extends keyof typeof visoes_pilao>(tipoVisao: T, parametros: z.infer<(typeof visoes_pilao)[T]>): {
|
||||||
|
dados: () => Promise<tipoResposta<tipoRetornoSerieconsulta<T>>>;
|
||||||
|
url: () => string;
|
||||||
|
};
|
||||||
|
urlLaboratorio(): {
|
||||||
|
rota: string;
|
||||||
|
url: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
export declare const Pilao: (_: tipoConstrutorPilao & {
|
||||||
|
ver_log?: boolean;
|
||||||
|
emDesenvolvimento?: boolean;
|
||||||
|
}) => ClassPilao;
|
||||||
|
export {};
|
||||||
218
dist-require/pilao-de-dados/Pilao/index.js
Normal file
218
dist-require/pilao-de-dados/Pilao/index.js
Normal file
|
|
@ -0,0 +1,218 @@
|
||||||
|
"use strict";
|
||||||
|
/** Drive completo do piilão de dados */
|
||||||
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
||||||
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
||||||
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
||||||
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
||||||
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
||||||
|
};
|
||||||
|
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
||||||
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
||||||
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
||||||
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
||||||
|
};
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
|
var _ClassPilao_instances, _ClassPilao_produto, _ClassPilao_conta, _ClassPilao_emDesenvolvimento, _ClassPilao_ver_log, _ClassPilao_registrosParaEnvio, _ClassPilao_codigosParaDeletar, _ClassPilao_gerarUrl, _ClassPilao_salvarEnviarRegistros, _ClassPilao_salvarDeletarRegistros;
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.Pilao = void 0;
|
||||||
|
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
||||||
|
const p_comuns_1 = require("p-comuns");
|
||||||
|
const p_respostas_1 = require("p-respostas");
|
||||||
|
const variaveis_1 = require("../variaveis");
|
||||||
|
class ClassPilao {
|
||||||
|
constructor({ conta, produto, emDesenvolvimento = false, ver_log = false, }) {
|
||||||
|
_ClassPilao_instances.add(this);
|
||||||
|
_ClassPilao_produto.set(this, void 0);
|
||||||
|
_ClassPilao_conta.set(this, void 0);
|
||||||
|
_ClassPilao_emDesenvolvimento.set(this, void 0);
|
||||||
|
_ClassPilao_ver_log.set(this, void 0);
|
||||||
|
_ClassPilao_registrosParaEnvio.set(this, {});
|
||||||
|
_ClassPilao_codigosParaDeletar.set(this, {});
|
||||||
|
__classPrivateFieldSet(this, _ClassPilao_produto, produto, "f");
|
||||||
|
__classPrivateFieldSet(this, _ClassPilao_conta, conta, "f");
|
||||||
|
__classPrivateFieldSet(this, _ClassPilao_emDesenvolvimento, emDesenvolvimento, "f");
|
||||||
|
__classPrivateFieldSet(this, _ClassPilao_ver_log, ver_log, "f");
|
||||||
|
}
|
||||||
|
rotaEnviarRegistros() {
|
||||||
|
return __classPrivateFieldGet(this, _ClassPilao_instances, "m", _ClassPilao_gerarUrl).call(this, "enviar-registros");
|
||||||
|
}
|
||||||
|
rotaDeletarRegistro() {
|
||||||
|
return __classPrivateFieldGet(this, _ClassPilao_instances, "m", _ClassPilao_gerarUrl).call(this, "deletar-registros");
|
||||||
|
}
|
||||||
|
rotaConsultarSerie(tipoVisao) {
|
||||||
|
return __classPrivateFieldGet(this, _ClassPilao_instances, "m", _ClassPilao_gerarUrl).call(this, "consultar-serie", tipoVisao);
|
||||||
|
}
|
||||||
|
rotaIframeSerie(tipoVisao) {
|
||||||
|
const rota = `${variaveis_1.PREFIXO_PILAO}/consultar-serie/${__classPrivateFieldGet(this, _ClassPilao_produto, "f")}/${__classPrivateFieldGet(this, _ClassPilao_conta, "f")}/${tipoVisao}`;
|
||||||
|
const url = `${this.baseUrlSite}${rota}`;
|
||||||
|
return { rota, url };
|
||||||
|
}
|
||||||
|
rotaFuncaoApi(funcao) {
|
||||||
|
return __classPrivateFieldGet(this, _ClassPilao_instances, "m", _ClassPilao_gerarUrl).call(this, "API", funcao);
|
||||||
|
}
|
||||||
|
async consultarApi(funcao, parametros) {
|
||||||
|
try {
|
||||||
|
const response = await (0, cross_fetch_1.default)(this.rotaFuncaoApi(funcao).url, {
|
||||||
|
body: JSON.stringify(parametros),
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
});
|
||||||
|
const texto = await response.text();
|
||||||
|
try {
|
||||||
|
const json = JSON.parse(texto);
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
return p_respostas_1.respostaComuns.erro("Consulta não retornou json válido", [texto]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (erro) {
|
||||||
|
console.error(erro);
|
||||||
|
return p_respostas_1.respostaComuns.erroInterno({
|
||||||
|
erro,
|
||||||
|
local: (0, p_comuns_1.nomeVariavel)({ ClassPilao }),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
get baseUrlApi() {
|
||||||
|
return __classPrivateFieldGet(this, _ClassPilao_emDesenvolvimento, "f")
|
||||||
|
? "http://localhost:5080"
|
||||||
|
: "https://carro-de-boi.idz.one";
|
||||||
|
}
|
||||||
|
get baseUrlSite() {
|
||||||
|
return __classPrivateFieldGet(this, _ClassPilao_emDesenvolvimento, "f")
|
||||||
|
? "http://localhost:5081"
|
||||||
|
: "https://carro-de-boi.idz.one";
|
||||||
|
}
|
||||||
|
validarCliente(_) {
|
||||||
|
if (!_?.conta)
|
||||||
|
return p_respostas_1.respostaComuns.erro("Conta não informada");
|
||||||
|
if (!_?.produto)
|
||||||
|
return p_respostas_1.respostaComuns.erro("Produto não informado");
|
||||||
|
return p_respostas_1.respostaComuns.valor(_);
|
||||||
|
}
|
||||||
|
adicionarRegistroParaEnviar(tabela, ...registros) {
|
||||||
|
__classPrivateFieldGet(this, _ClassPilao_registrosParaEnvio, "f")[tabela] = [
|
||||||
|
...(__classPrivateFieldGet(this, _ClassPilao_registrosParaEnvio, "f")[tabela] || []),
|
||||||
|
...registros,
|
||||||
|
];
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
adicionarCodigoParaDeletar(tabela, ...codigos) {
|
||||||
|
__classPrivateFieldGet(this, _ClassPilao_codigosParaDeletar, "f")[tabela] = [
|
||||||
|
...(__classPrivateFieldGet(this, _ClassPilao_codigosParaDeletar, "f")[tabela] || []),
|
||||||
|
...codigos,
|
||||||
|
];
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
async processarRegistros(url, registros, tabela, acao) {
|
||||||
|
const tamanhoBlocos = 1000;
|
||||||
|
while (registros.length > 0) {
|
||||||
|
const bloco = registros
|
||||||
|
.splice(0, tamanhoBlocos)
|
||||||
|
.map((r) => Object.fromEntries(Object.entries(r).map(([k, v]) => [k, v === undefined ? null : v])));
|
||||||
|
const resp = await (0, cross_fetch_1.default)(url, {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify({ tabela, registros: bloco }),
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
})
|
||||||
|
.then(async (r) => {
|
||||||
|
const texto = await r.text();
|
||||||
|
try {
|
||||||
|
const json = JSON.parse(texto);
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
return p_respostas_1.respostaComuns.erro("Consulta não retornou json válido", [
|
||||||
|
texto,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => p_respostas_1.respostaComuns.erro(`Erro ao ${acao} registros`, [e.message]));
|
||||||
|
if (resp.eErro)
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
return p_respostas_1.respostaComuns.valor(true);
|
||||||
|
}
|
||||||
|
async salvarRegistros() {
|
||||||
|
const re = await __classPrivateFieldGet(this, _ClassPilao_instances, "m", _ClassPilao_salvarEnviarRegistros).call(this);
|
||||||
|
if (re.eErro)
|
||||||
|
return re;
|
||||||
|
const rd = await __classPrivateFieldGet(this, _ClassPilao_instances, "m", _ClassPilao_salvarDeletarRegistros).call(this);
|
||||||
|
if (rd.eErro)
|
||||||
|
return rd;
|
||||||
|
return p_respostas_1.respostaComuns.valor(true);
|
||||||
|
}
|
||||||
|
serieConsultar(tipoVisao, parametros) {
|
||||||
|
const dados = async () => {
|
||||||
|
const url = this.rotaConsultarSerie(tipoVisao).url;
|
||||||
|
const resp = await (0, cross_fetch_1.default)(url.toString(), {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(parametros),
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
})
|
||||||
|
.then(async (r) => {
|
||||||
|
const texto = await r.text();
|
||||||
|
try {
|
||||||
|
const json = JSON.parse(texto);
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
return p_respostas_1.respostaComuns.erro("Consulta não retornou json válido", [
|
||||||
|
texto,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => p_respostas_1.respostaComuns.erro("Erro ao enviar registros", [e.message]));
|
||||||
|
if (__classPrivateFieldGet(this, _ClassPilao_ver_log, "f"))
|
||||||
|
console.log(`[PILÃO]: buscar dados de "${JSON.stringify(parametros)}" para "${url}".`);
|
||||||
|
return resp;
|
||||||
|
};
|
||||||
|
const url = () => {
|
||||||
|
const vUrl = this.rotaIframeSerie(tipoVisao).url;
|
||||||
|
const serie = encodeURIComponent(JSON.stringify(parametros, null, 2));
|
||||||
|
if (__classPrivateFieldGet(this, _ClassPilao_ver_log, "f"))
|
||||||
|
console.log(`[PILÃO]: Serie Consultar url de "${JSON.stringify(serie)}" para "${vUrl}".`);
|
||||||
|
return `${vUrl}?serie=${serie}`;
|
||||||
|
};
|
||||||
|
return {
|
||||||
|
dados,
|
||||||
|
url,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
urlLaboratorio() {
|
||||||
|
const rota = `${variaveis_1.PREFIXO_PILAO}/laboratório/${__classPrivateFieldGet(this, _ClassPilao_produto, "f")}/${__classPrivateFieldGet(this, _ClassPilao_conta, "f")}`;
|
||||||
|
const url = `${this.baseUrlSite}${rota}`;
|
||||||
|
return { rota, url };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ClassPilao_produto = new WeakMap(), _ClassPilao_conta = new WeakMap(), _ClassPilao_emDesenvolvimento = new WeakMap(), _ClassPilao_ver_log = new WeakMap(), _ClassPilao_registrosParaEnvio = new WeakMap(), _ClassPilao_codigosParaDeletar = new WeakMap(), _ClassPilao_instances = new WeakSet(), _ClassPilao_gerarUrl = function _ClassPilao_gerarUrl(acao, extraPath) {
|
||||||
|
const rota = `${variaveis_1.PREFIXO_PILAO}/api/${acao}/${__classPrivateFieldGet(this, _ClassPilao_produto, "f")}/${__classPrivateFieldGet(this, _ClassPilao_conta, "f")}${extraPath ? `/${extraPath}` : ""}`;
|
||||||
|
const url = `${this.baseUrlApi}${rota}`;
|
||||||
|
return { rota, url };
|
||||||
|
}, _ClassPilao_salvarEnviarRegistros = async function _ClassPilao_salvarEnviarRegistros() {
|
||||||
|
for (const tabela of Object.keys(__classPrivateFieldGet(this, _ClassPilao_registrosParaEnvio, "f"))) {
|
||||||
|
const registros = __classPrivateFieldGet(this, _ClassPilao_registrosParaEnvio, "f")[tabela] || [];
|
||||||
|
const url = this.rotaEnviarRegistros().url;
|
||||||
|
if (__classPrivateFieldGet(this, _ClassPilao_ver_log, "f"))
|
||||||
|
console.log(`[PILÃO]: Enviando ${registros.length} registros na tabela "${tabela}" para "${url}".`);
|
||||||
|
const resp = await this.processarRegistros(url, registros, tabela, "enviar");
|
||||||
|
if (resp.eErro)
|
||||||
|
return resp;
|
||||||
|
__classPrivateFieldGet(this, _ClassPilao_registrosParaEnvio, "f")[tabela] = [];
|
||||||
|
}
|
||||||
|
return p_respostas_1.respostaComuns.valor(true);
|
||||||
|
}, _ClassPilao_salvarDeletarRegistros = async function _ClassPilao_salvarDeletarRegistros() {
|
||||||
|
for (const tabela of Object.keys(__classPrivateFieldGet(this, _ClassPilao_codigosParaDeletar, "f"))) {
|
||||||
|
const codigos = [...(__classPrivateFieldGet(this, _ClassPilao_codigosParaDeletar, "f")[tabela] || [])];
|
||||||
|
const url = this.rotaDeletarRegistro().url;
|
||||||
|
const resp = await this.processarRegistros(url, codigos, tabela, "deletar");
|
||||||
|
if (resp.eErro)
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
return p_respostas_1.respostaComuns.valor(true);
|
||||||
|
};
|
||||||
|
const Pilao = (_) => new ClassPilao(_);
|
||||||
|
exports.Pilao = Pilao;
|
||||||
30
dist-require/pilao-de-dados/Pilao/pilao-api.d.ts
vendored
Normal file
30
dist-require/pilao-de-dados/Pilao/pilao-api.d.ts
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
import type { z } from "zod";
|
||||||
|
import type { zp_registrar_base_dados } from "../_enviar_registros";
|
||||||
|
/**
|
||||||
|
* {
|
||||||
|
* 'rota':{
|
||||||
|
* pr:{}// paramentros de entrada
|
||||||
|
* rs:{}// resposta
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
export type tipo_pilao_api = {
|
||||||
|
/** retorna da data e hora do servido em formato iso */
|
||||||
|
estado_servidor: {
|
||||||
|
pr: {};
|
||||||
|
rs: {
|
||||||
|
data_hora: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
tabelas: {
|
||||||
|
pr: {};
|
||||||
|
rs: z.infer<typeof zp_registrar_base_dados>[];
|
||||||
|
};
|
||||||
|
unicos: {
|
||||||
|
pr: {
|
||||||
|
tabela: string;
|
||||||
|
coluna: string;
|
||||||
|
};
|
||||||
|
rs: any[];
|
||||||
|
};
|
||||||
|
};
|
||||||
2
dist-require/pilao-de-dados/Pilao/pilao-api.js
Normal file
2
dist-require/pilao-de-dados/Pilao/pilao-api.js
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
11
dist-require/pilao-de-dados/Pilao/tipagem.d.ts
vendored
Normal file
11
dist-require/pilao-de-dados/Pilao/tipagem.d.ts
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
import type { z } from "zod";
|
||||||
|
import type { visoes_pilao } from "../visoes/listaDeVisoes";
|
||||||
|
export type tipoConstrutorPilao = {
|
||||||
|
produto: string;
|
||||||
|
conta: string;
|
||||||
|
};
|
||||||
|
export type tipoRetornoSerieconsulta<T extends keyof typeof visoes_pilao> = {
|
||||||
|
registros: any[];
|
||||||
|
legenda: string;
|
||||||
|
serie: z.infer<(typeof visoes_pilao)[T]>;
|
||||||
|
};
|
||||||
2
dist-require/pilao-de-dados/Pilao/tipagem.js
Normal file
2
dist-require/pilao-de-dados/Pilao/tipagem.js
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
import type { tipoResposta } from "p-respostas";
|
|
||||||
import { z } from "zod";
|
|
||||||
import { type zp_produto_conta } from "./variaveis";
|
|
||||||
export declare const zp_deletar_registros: z.ZodObject<{
|
|
||||||
tabela: z.ZodString;
|
|
||||||
codigos: z.ZodArray<z.ZodString, "many">;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
tabela: string;
|
|
||||||
codigos: string[];
|
|
||||||
}, {
|
|
||||||
tabela: string;
|
|
||||||
codigos: string[];
|
|
||||||
}>;
|
|
||||||
export declare const deletar_registros: ({ conta, produto, emDesenvolvimento }: z.infer<typeof zp_produto_conta>) => ({ codigos: codigos_entrada, tabela, }: z.infer<typeof zp_deletar_registros>) => Promise<tipoResposta<true>>;
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
"use strict";
|
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.deletar_registros = exports.zp_deletar_registros = void 0;
|
|
||||||
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
||||||
const p_respostas_1 = require("p-respostas");
|
|
||||||
const zod_1 = require("zod");
|
|
||||||
const variaveis_1 = require("./variaveis");
|
|
||||||
//enviar registros para base de dados
|
|
||||||
exports.zp_deletar_registros = zod_1.z.object({
|
|
||||||
tabela: zod_1.z.string(),
|
|
||||||
codigos: zod_1.z.array(zod_1.z.string()),
|
|
||||||
});
|
|
||||||
const deletar_registros = ({ conta, produto, emDesenvolvimento }) => async ({ codigos: codigos_entrada, tabela, }) => {
|
|
||||||
const codigos = [...codigos_entrada];
|
|
||||||
const url = new URL(`${(0, variaveis_1.urlPilao)(emDesenvolvimento).api}/${Object.keys({ deletar_registros: exports.deletar_registros })[0]}/${produto}/${conta}`);
|
|
||||||
const tamanhoBlocos = 1000;
|
|
||||||
while (codigos.length > 0) {
|
|
||||||
const bloco = codigos.splice(0, tamanhoBlocos);
|
|
||||||
const resp = await (0, cross_fetch_1.default)(url.toString(), {
|
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify({ tabela, codigos: bloco }),
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
})
|
|
||||||
.then((r) => r.json())
|
|
||||||
.catch((e) => p_respostas_1.respostaComuns.erro("Erro ao enviar registros", [e.message]))
|
|
||||||
.then((r) => r);
|
|
||||||
if (resp.eErro) {
|
|
||||||
return resp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return p_respostas_1.respostaComuns.valor(true);
|
|
||||||
};
|
|
||||||
exports.deletar_registros = deletar_registros;
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
import type { tipoResposta } from "p-respostas";
|
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { type zp_produto_conta } from "./variaveis";
|
|
||||||
export declare const zp_registrar_base_dados: z.ZodObject<{
|
export declare const zp_registrar_base_dados: z.ZodObject<{
|
||||||
tabela: z.ZodString;
|
tabela: z.ZodString;
|
||||||
colunas: z.ZodArray<z.ZodObject<{
|
colunas: z.ZodArray<z.ZodObject<{
|
||||||
|
|
@ -51,4 +49,3 @@ export declare const zp_enviar_registros: z.ZodObject<{
|
||||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "lista_mes" | "lista_data" | "mes" | "data" | null | undefined;
|
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "lista_mes" | "lista_data" | "mes" | "data" | null | undefined;
|
||||||
}>[];
|
}>[];
|
||||||
}>;
|
}>;
|
||||||
export declare const enviar_registros: ({ conta, produto, emDesenvolvimento, ver_log, }: z.infer<typeof zp_produto_conta>) => ({ registros: registros_entrada, tabela, }: z.infer<typeof zp_enviar_registros>) => Promise<tipoResposta<true>>;
|
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,13 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.enviar_registros = exports.zp_enviar_registros = exports.zp_registrar_base_dados = void 0;
|
exports.zp_enviar_registros = exports.zp_registrar_base_dados = void 0;
|
||||||
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
||||||
const p_respostas_1 = require("p-respostas");
|
|
||||||
const zod_1 = require("zod");
|
const zod_1 = require("zod");
|
||||||
const variaveis_1 = require("./variaveis");
|
const variaveis_1 = require("./variaveis");
|
||||||
exports.zp_registrar_base_dados = zod_1.z.object({
|
exports.zp_registrar_base_dados = zod_1.z.object({
|
||||||
tabela: zod_1.z.string(),
|
tabela: zod_1.z.string(),
|
||||||
colunas: zod_1.z.array(zod_1.z.object({
|
colunas: zod_1.z.array(zod_1.z.object({
|
||||||
coluna: zod_1.z.string(),
|
coluna: zod_1.z.string(),
|
||||||
tipo: variaveis_1.z_tipo_coluna_base_dados,
|
tipo: variaveis_1.z_tipos_dados_registro,
|
||||||
})),
|
})),
|
||||||
});
|
});
|
||||||
//enviar registros para base de dados
|
//enviar registros para base de dados
|
||||||
|
|
@ -20,31 +15,6 @@ exports.zp_enviar_registros = zod_1.z.object({
|
||||||
tabela: zod_1.z.string(),
|
tabela: zod_1.z.string(),
|
||||||
registros: zod_1.z.array(zod_1.z.record(zod_1.z.string(), zod_1.z.object({
|
registros: zod_1.z.array(zod_1.z.record(zod_1.z.string(), zod_1.z.object({
|
||||||
valor: zod_1.z.any(),
|
valor: zod_1.z.any(),
|
||||||
tipo: variaveis_1.z_tipo_coluna_base_dados.optional().nullable(),
|
tipo: variaveis_1.z_tipos_dados_registro.optional().nullable(),
|
||||||
}))),
|
}))),
|
||||||
});
|
});
|
||||||
const enviar_registros = ({ conta, produto, emDesenvolvimento, ver_log, }) => async ({ registros: registros_entrada, tabela, }) => {
|
|
||||||
const registros = [...registros_entrada];
|
|
||||||
const url = new URL(`${(0, variaveis_1.urlPilao)(emDesenvolvimento).api}/${Object.keys({ enviar_registros: exports.enviar_registros })[0]}/${produto}/${conta}`);
|
|
||||||
if (ver_log)
|
|
||||||
console.log(`[PILÃO]: Enviando "${registros.length}" registros na tabela "${tabela}" para "${url}".`);
|
|
||||||
const tamanhoBlocos = 1000;
|
|
||||||
while (registros.length > 0) {
|
|
||||||
const bloco = registros
|
|
||||||
.splice(0, tamanhoBlocos)
|
|
||||||
.map((r) => Object.fromEntries(Object.entries(r).map(([k, v]) => [k, v === undefined ? null : v])));
|
|
||||||
const resp = await (0, cross_fetch_1.default)(url.toString(), {
|
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify({ tabela, registros: bloco }),
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
})
|
|
||||||
.then((r) => r.json())
|
|
||||||
.catch((e) => p_respostas_1.respostaComuns.erro("Erro ao enviar registros", [e.message]))
|
|
||||||
.then((r) => r);
|
|
||||||
if (resp.eErro) {
|
|
||||||
return resp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return p_respostas_1.respostaComuns.valor(true);
|
|
||||||
};
|
|
||||||
exports.enviar_registros = enviar_registros;
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
import type { tipoResposta } from "p-respostas";
|
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { type zp_produto_conta } from "./variaveis";
|
|
||||||
import type { visoes } from "./visoes";
|
|
||||||
export declare const z_filtro: z.ZodObject<{
|
export declare const z_filtro: z.ZodObject<{
|
||||||
coluna: z.ZodString;
|
coluna: z.ZodString;
|
||||||
valor: z.ZodAny;
|
valor: z.ZodAny;
|
||||||
|
|
@ -15,11 +12,3 @@ export declare const z_filtro: z.ZodObject<{
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
valor?: any;
|
valor?: any;
|
||||||
}>;
|
}>;
|
||||||
export declare const serie_consultar: (cliente: z.infer<typeof zp_produto_conta>) => <T extends keyof typeof visoes>(tipoVisao: T, parametros: z.infer<(typeof visoes)[T]>) => {
|
|
||||||
dados: () => Promise<tipoResposta<{
|
|
||||||
registros: any[];
|
|
||||||
legenda: string;
|
|
||||||
serie: z.infer<(typeof visoes)[T]>;
|
|
||||||
}>>;
|
|
||||||
url: () => string;
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.serie_consultar = exports.z_filtro = void 0;
|
exports.z_filtro = void 0;
|
||||||
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
||||||
const p_respostas_1 = require("p-respostas");
|
|
||||||
const zod_1 = require("zod");
|
const zod_1 = require("zod");
|
||||||
const variaveis_1 = require("./variaveis");
|
const variaveis_1 = require("./variaveis");
|
||||||
exports.z_filtro = zod_1.z.object({
|
exports.z_filtro = zod_1.z.object({
|
||||||
|
|
@ -13,31 +8,3 @@ exports.z_filtro = zod_1.z.object({
|
||||||
valor: zod_1.z.any(),
|
valor: zod_1.z.any(),
|
||||||
operador: variaveis_1.operadores_pilao,
|
operador: variaveis_1.operadores_pilao,
|
||||||
});
|
});
|
||||||
const serie_consultar = (cliente) => (tipoVisao, parametros) => {
|
|
||||||
const dados = async () => {
|
|
||||||
const url = new URL(`${(0, variaveis_1.urlPilao)(cliente.emDesenvolvimento).api}/${tipoVisao}/${cliente.produto}/${cliente.conta}`);
|
|
||||||
const resp = await (0, cross_fetch_1.default)(url.toString(), {
|
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify(parametros),
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
})
|
|
||||||
.then((r) => r.json())
|
|
||||||
.catch((e) => p_respostas_1.respostaComuns.erro("Erro ao enviar registros", [e.message]))
|
|
||||||
.then((r) => r);
|
|
||||||
if (cliente.ver_log)
|
|
||||||
console.log(`[PILÃO]: buscar dados de "${JSON.stringify(parametros)}" para "${url.href}".`);
|
|
||||||
return resp;
|
|
||||||
};
|
|
||||||
const url = () => {
|
|
||||||
const vUrl = new URL(`${(0, variaveis_1.urlPilao)(cliente.emDesenvolvimento).site}/${tipoVisao}/${cliente.produto}/${cliente.conta}`);
|
|
||||||
const serie = encodeURIComponent(JSON.stringify(parametros, null, 2));
|
|
||||||
if (cliente.ver_log)
|
|
||||||
console.log(`[PILÃO]: Serie Consultar url de "${JSON.stringify(serie)}" para "${vUrl.href}".`);
|
|
||||||
return `${vUrl.href}?serie=${serie}`;
|
|
||||||
};
|
|
||||||
return {
|
|
||||||
dados,
|
|
||||||
url,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
exports.serie_consultar = serie_consultar;
|
|
||||||
|
|
|
||||||
293
dist-require/pilao-de-dados/index.d.ts
vendored
293
dist-require/pilao-de-dados/index.d.ts
vendored
|
|
@ -1,169 +1,13 @@
|
||||||
import { zp_deletar_registros } from "./_deletar_registros";
|
|
||||||
export { PREFIXO_PILAO, urlPilao } from "./variaveis";
|
export { PREFIXO_PILAO, urlPilao } from "./variaveis";
|
||||||
import { zp_enviar_registros } from "./_enviar_registros";
|
export * from "./Pilao";
|
||||||
import { zp_produto_conta } from "./variaveis";
|
export * from "./Pilao/pilao-api";
|
||||||
import { visoes } from "./visoes";
|
export * from "./Pilao/tipagem";
|
||||||
export declare const pPilao: {
|
export declare const pPilao: {
|
||||||
extruturas_de_campos: {
|
extruturas_de_campos: {
|
||||||
z_contagem_em_barra_vertical: {
|
z_contagem_em_barra_vertical: import("./visoes/tipagem").tipo_estrutura_visao_grafico<"z_contagem_em_barra_vertical">;
|
||||||
visao: "z_contagem_em_barra_vertical";
|
z_contagem_em_pizza: import("./visoes/tipagem").tipo_estrutura_visao_grafico<"z_contagem_em_pizza">;
|
||||||
rotulo: string;
|
z_tabela: import("./visoes/tipagem").tipo_estrutura_visao_grafico<"z_tabela">;
|
||||||
tabela: (_: {
|
z_soma_em_barra_vertical: import("./visoes/tipagem").tipo_estrutura_visao_grafico<"z_soma_em_barra_vertical">;
|
||||||
tabela: string;
|
|
||||||
colanuEixoX: string;
|
|
||||||
colunaAgrupamento?: string[] | undefined;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}) => string;
|
|
||||||
descricao: (_: {
|
|
||||||
tabela: string;
|
|
||||||
colanuEixoX: string;
|
|
||||||
colunaAgrupamento?: string[] | undefined;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}) => string;
|
|
||||||
campos: {
|
|
||||||
tabela: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
colanuEixoX: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
colunaAgrupamento: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
filtros: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
descricao_pelo_usuario: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
z_contagem_em_pizza: {
|
|
||||||
visao: "z_contagem_em_pizza";
|
|
||||||
rotulo: string;
|
|
||||||
tabela: (_: {
|
|
||||||
tabela: string;
|
|
||||||
classes: string;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}) => string;
|
|
||||||
descricao: (_: {
|
|
||||||
tabela: string;
|
|
||||||
classes: string;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}) => string;
|
|
||||||
campos: {
|
|
||||||
tabela: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
classes: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
filtros: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
descricao_pelo_usuario: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
z_tabela: {
|
|
||||||
visao: "z_tabela";
|
|
||||||
rotulo: string;
|
|
||||||
tabela: (_: {
|
|
||||||
tabela: string;
|
|
||||||
colunas: string[];
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
coluna_ordem?: string | undefined;
|
|
||||||
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
|
||||||
}) => string;
|
|
||||||
descricao: (_: {
|
|
||||||
tabela: string;
|
|
||||||
colunas: string[];
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
coluna_ordem?: string | undefined;
|
|
||||||
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
|
||||||
}) => string;
|
|
||||||
campos: {
|
|
||||||
tabela: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
colunas: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
filtros: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
descricao_pelo_usuario: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
coluna_ordem: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
direcao_ordem: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: import("zod").TypeOf<import("zod").ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
z_contagem_em_barra_vertical: import("zod").ZodObject<{
|
z_contagem_em_barra_vertical: import("zod").ZodObject<{
|
||||||
tabela: import("zod").ZodString;
|
tabela: import("zod").ZodString;
|
||||||
|
|
@ -282,6 +126,61 @@ export declare const pPilao: {
|
||||||
coluna_ordem?: string | undefined;
|
coluna_ordem?: string | undefined;
|
||||||
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
||||||
}>;
|
}>;
|
||||||
|
z_soma_em_barra_vertical: import("zod").ZodObject<{
|
||||||
|
tabela: import("zod").ZodString;
|
||||||
|
colanuEixoX: import("zod").ZodString;
|
||||||
|
colunaSoma: import("zod").ZodString;
|
||||||
|
unidadeSoma: import("zod").ZodOptional<import("zod").ZodString>;
|
||||||
|
colunaAgrupamento: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
||||||
|
filtros: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
||||||
|
coluna: import("zod").ZodString;
|
||||||
|
valor: import("zod").ZodAny;
|
||||||
|
operador: import("zod").ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
|
}, "strip", import("zod").ZodTypeAny, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}>, "many">>;
|
||||||
|
descricao_pelo_usuario: import("zod").ZodOptional<import("zod").ZodString>;
|
||||||
|
}, "strip", import("zod").ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaSoma: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
unidadeSoma?: string | undefined;
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaSoma: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
unidadeSoma?: string | undefined;
|
||||||
|
}>;
|
||||||
|
zp_deletar_registros: import("zod").ZodObject<{
|
||||||
|
tabela: import("zod").ZodString;
|
||||||
|
codigos: import("zod").ZodArray<import("zod").ZodString, "many">;
|
||||||
|
}, "strip", import("zod").ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
codigos: string[];
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
codigos: string[];
|
||||||
|
}>;
|
||||||
zp_registrar_base_dados: import("zod").ZodObject<{
|
zp_registrar_base_dados: import("zod").ZodObject<{
|
||||||
tabela: import("zod").ZodString;
|
tabela: import("zod").ZodString;
|
||||||
colunas: import("zod").ZodArray<import("zod").ZodObject<{
|
colunas: import("zod").ZodArray<import("zod").ZodObject<{
|
||||||
|
|
@ -307,7 +206,7 @@ export declare const pPilao: {
|
||||||
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "lista_mes" | "lista_data" | "mes" | "data";
|
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "lista_mes" | "lista_data" | "mes" | "data";
|
||||||
}[];
|
}[];
|
||||||
}>;
|
}>;
|
||||||
enviar_registros: ({ conta, produto, emDesenvolvimento, ver_log, }: import("zod").TypeOf<typeof zp_produto_conta>) => ({ registros: registros_entrada, tabela, }: import("zod").TypeOf<typeof zp_enviar_registros>) => Promise<import("p-respostas").tipoResposta<true>>;
|
z_tipos_dados_registro: import("zod").ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "lista_mes", "lista_data", "mes", "data"]>;
|
||||||
zp_enviar_registros: import("zod").ZodObject<{
|
zp_enviar_registros: import("zod").ZodObject<{
|
||||||
tabela: import("zod").ZodString;
|
tabela: import("zod").ZodString;
|
||||||
registros: import("zod").ZodArray<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
registros: import("zod").ZodArray<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
||||||
|
|
@ -333,14 +232,6 @@ export declare const pPilao: {
|
||||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "lista_mes" | "lista_data" | "mes" | "data" | null | undefined;
|
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "lista_mes" | "lista_data" | "mes" | "data" | null | undefined;
|
||||||
}>[];
|
}>[];
|
||||||
}>;
|
}>;
|
||||||
serie_consultar: (cliente: import("zod").TypeOf<typeof zp_produto_conta>) => <T extends keyof typeof visoes>(tipoVisao: T, parametros: import("zod").TypeOf<(typeof visoes)[T]>) => {
|
|
||||||
dados: () => Promise<import("p-respostas").tipoResposta<{
|
|
||||||
registros: any[];
|
|
||||||
legenda: string;
|
|
||||||
serie: import("zod").TypeOf<(typeof visoes)[T]>;
|
|
||||||
}>>;
|
|
||||||
url: () => string;
|
|
||||||
};
|
|
||||||
zp_produto_conta: import("zod").ZodObject<{
|
zp_produto_conta: import("zod").ZodObject<{
|
||||||
produto: import("zod").ZodString;
|
produto: import("zod").ZodString;
|
||||||
conta: import("zod").ZodString;
|
conta: import("zod").ZodString;
|
||||||
|
|
@ -358,17 +249,6 @@ export declare const pPilao: {
|
||||||
ver_log?: boolean | undefined;
|
ver_log?: boolean | undefined;
|
||||||
}>;
|
}>;
|
||||||
validarZ: <T>(zodType: import("zod").ZodType<T, any>, objeto: any, mensagem: string) => import("p-respostas").tipoRespostaErro | import("p-respostas").tipoRespostaSucesso<T>;
|
validarZ: <T>(zodType: import("zod").ZodType<T, any>, objeto: any, mensagem: string) => import("p-respostas").tipoRespostaErro | import("p-respostas").tipoRespostaSucesso<T>;
|
||||||
deletar_registros: ({ conta, produto, emDesenvolvimento }: import("zod").TypeOf<typeof zp_produto_conta>) => ({ codigos: codigos_entrada, tabela, }: import("zod").TypeOf<typeof zp_deletar_registros>) => Promise<import("p-respostas").tipoResposta<true>>;
|
|
||||||
zp_deletar_registros: import("zod").ZodObject<{
|
|
||||||
tabela: import("zod").ZodString;
|
|
||||||
codigos: import("zod").ZodArray<import("zod").ZodString, "many">;
|
|
||||||
}, "strip", import("zod").ZodTypeAny, {
|
|
||||||
tabela: string;
|
|
||||||
codigos: string[];
|
|
||||||
}, {
|
|
||||||
tabela: string;
|
|
||||||
codigos: string[];
|
|
||||||
}>;
|
|
||||||
operadores_pilao: import("zod").ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
operadores_pilao: import("zod").ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
operadores_permitidos_por_tipo: {
|
operadores_permitidos_por_tipo: {
|
||||||
texto: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
|
texto: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
|
||||||
|
|
@ -394,7 +274,7 @@ export declare const pPilao: {
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
valor?: any;
|
valor?: any;
|
||||||
}>;
|
}>;
|
||||||
visoes: {
|
visoes_pilao: {
|
||||||
z_contagem_em_barra_vertical: import("zod").ZodObject<{
|
z_contagem_em_barra_vertical: import("zod").ZodObject<{
|
||||||
tabela: import("zod").ZodString;
|
tabela: import("zod").ZodString;
|
||||||
colanuEixoX: import("zod").ZodString;
|
colanuEixoX: import("zod").ZodString;
|
||||||
|
|
@ -512,5 +392,50 @@ export declare const pPilao: {
|
||||||
coluna_ordem?: string | undefined;
|
coluna_ordem?: string | undefined;
|
||||||
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
||||||
}>;
|
}>;
|
||||||
|
z_soma_em_barra_vertical: import("zod").ZodObject<{
|
||||||
|
tabela: import("zod").ZodString;
|
||||||
|
colanuEixoX: import("zod").ZodString;
|
||||||
|
colunaSoma: import("zod").ZodString;
|
||||||
|
unidadeSoma: import("zod").ZodOptional<import("zod").ZodString>;
|
||||||
|
colunaAgrupamento: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
||||||
|
filtros: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
||||||
|
coluna: import("zod").ZodString;
|
||||||
|
valor: import("zod").ZodAny;
|
||||||
|
operador: import("zod").ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
|
}, "strip", import("zod").ZodTypeAny, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}>, "many">>;
|
||||||
|
descricao_pelo_usuario: import("zod").ZodOptional<import("zod").ZodString>;
|
||||||
|
}, "strip", import("zod").ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaSoma: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
unidadeSoma?: string | undefined;
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaSoma: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
unidadeSoma?: string | undefined;
|
||||||
|
}>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,42 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||||
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.pPilao = exports.urlPilao = exports.PREFIXO_PILAO = void 0;
|
exports.pPilao = exports.urlPilao = exports.PREFIXO_PILAO = void 0;
|
||||||
const _deletar_registros_1 = require("./_deletar_registros");
|
|
||||||
var variaveis_1 = require("./variaveis");
|
var variaveis_1 = require("./variaveis");
|
||||||
Object.defineProperty(exports, "PREFIXO_PILAO", { enumerable: true, get: function () { return variaveis_1.PREFIXO_PILAO; } });
|
Object.defineProperty(exports, "PREFIXO_PILAO", { enumerable: true, get: function () { return variaveis_1.PREFIXO_PILAO; } });
|
||||||
Object.defineProperty(exports, "urlPilao", { enumerable: true, get: function () { return variaveis_1.urlPilao; } });
|
Object.defineProperty(exports, "urlPilao", { enumerable: true, get: function () { return variaveis_1.urlPilao; } });
|
||||||
const _enviar_registros_1 = require("./_enviar_registros");
|
const _enviar_registros_1 = require("./_enviar_registros");
|
||||||
const variaveis_2 = require("./variaveis");
|
const variaveis_2 = require("./variaveis");
|
||||||
|
__exportStar(require("./Pilao"), exports);
|
||||||
|
__exportStar(require("./Pilao/pilao-api"), exports);
|
||||||
|
__exportStar(require("./Pilao/tipagem"), exports);
|
||||||
const _serie_consultar_1 = require("./_serie_consultar");
|
const _serie_consultar_1 = require("./_serie_consultar");
|
||||||
const visoes_1 = require("./visoes");
|
const visoes_1 = require("./visoes");
|
||||||
|
const listaDeVisoes_1 = require("./visoes/listaDeVisoes");
|
||||||
exports.pPilao = {
|
exports.pPilao = {
|
||||||
|
zp_deletar_registros: variaveis_2.zp_deletar_registros,
|
||||||
zp_registrar_base_dados: _enviar_registros_1.zp_registrar_base_dados,
|
zp_registrar_base_dados: _enviar_registros_1.zp_registrar_base_dados,
|
||||||
enviar_registros: _enviar_registros_1.enviar_registros,
|
z_tipos_dados_registro: variaveis_2.z_tipos_dados_registro,
|
||||||
zp_enviar_registros: _enviar_registros_1.zp_enviar_registros,
|
zp_enviar_registros: _enviar_registros_1.zp_enviar_registros,
|
||||||
serie_consultar: _serie_consultar_1.serie_consultar,
|
|
||||||
zp_produto_conta: variaveis_2.zp_produto_conta,
|
zp_produto_conta: variaveis_2.zp_produto_conta,
|
||||||
validarZ: variaveis_2.validarZ,
|
validarZ: variaveis_2.validarZ,
|
||||||
deletar_registros: _deletar_registros_1.deletar_registros,
|
|
||||||
zp_deletar_registros: _deletar_registros_1.zp_deletar_registros,
|
|
||||||
operadores_pilao: variaveis_2.operadores_pilao,
|
operadores_pilao: variaveis_2.operadores_pilao,
|
||||||
operadores_permitidos_por_tipo: variaveis_2.operadores_permitidos_por_tipo,
|
operadores_permitidos_por_tipo: variaveis_2.operadores_permitidos_por_tipo,
|
||||||
z_filtro: _serie_consultar_1.z_filtro,
|
z_filtro: _serie_consultar_1.z_filtro,
|
||||||
visoes: visoes_1.visoes,
|
visoes_pilao: listaDeVisoes_1.visoes_pilao,
|
||||||
...visoes_1.visoes,
|
...listaDeVisoes_1.visoes_pilao,
|
||||||
extruturas_de_campos: visoes_1.extruturas_de_campos,
|
extruturas_de_campos: visoes_1.extruturas_de_campos,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
14
dist-require/pilao-de-dados/variaveis.d.ts
vendored
14
dist-require/pilao-de-dados/variaveis.d.ts
vendored
|
|
@ -1,4 +1,14 @@
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
export declare const zp_deletar_registros: z.ZodObject<{
|
||||||
|
tabela: z.ZodString;
|
||||||
|
codigos: z.ZodArray<z.ZodString, "many">;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
codigos: string[];
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
codigos: string[];
|
||||||
|
}>;
|
||||||
export declare const zAmbiente: z.ZodEnum<["desenvolvimento", "producao"]>;
|
export declare const zAmbiente: z.ZodEnum<["desenvolvimento", "producao"]>;
|
||||||
export declare const PREFIXO_PILAO = "/pilao-de-dados";
|
export declare const PREFIXO_PILAO = "/pilao-de-dados";
|
||||||
export declare const validarZ: <T>(zodType: z.ZodType<T, any>, objeto: any, mensagem: string) => import("p-respostas").tipoRespostaErro | import("p-respostas").tipoRespostaSucesso<T>;
|
export declare const validarZ: <T>(zodType: z.ZodType<T, any>, objeto: any, mensagem: string) => import("p-respostas").tipoRespostaErro | import("p-respostas").tipoRespostaSucesso<T>;
|
||||||
|
|
@ -18,10 +28,10 @@ export declare const zp_produto_conta: z.ZodObject<{
|
||||||
emDesenvolvimento?: boolean | undefined;
|
emDesenvolvimento?: boolean | undefined;
|
||||||
ver_log?: boolean | undefined;
|
ver_log?: boolean | undefined;
|
||||||
}>;
|
}>;
|
||||||
export declare const z_tipo_coluna_base_dados: z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "lista_mes", "lista_data", "mes", "data"]>;
|
export declare const z_tipos_dados_registro: z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "lista_mes", "lista_data", "mes", "data"]>;
|
||||||
export declare const operadores_pilao: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
export declare const operadores_pilao: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
export declare const operadores_permitidos_por_tipo: {
|
export declare const operadores_permitidos_por_tipo: {
|
||||||
[key in z.infer<typeof z_tipo_coluna_base_dados>]: z.infer<typeof operadores_pilao>[];
|
[key in z.infer<typeof z_tipos_dados_registro>]: z.infer<typeof operadores_pilao>[];
|
||||||
};
|
};
|
||||||
export declare const z_validar_colunna_base_dados: {
|
export declare const z_validar_colunna_base_dados: {
|
||||||
texto: z.ZodNullable<z.ZodString>;
|
texto: z.ZodNullable<z.ZodString>;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,12 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.urlPilao = exports.z_validar_colunna_base_dados = exports.operadores_permitidos_por_tipo = exports.operadores_pilao = exports.z_tipo_coluna_base_dados = exports.zp_produto_conta = exports.validarZ = exports.PREFIXO_PILAO = exports.zAmbiente = void 0;
|
exports.urlPilao = exports.z_validar_colunna_base_dados = exports.operadores_permitidos_por_tipo = exports.operadores_pilao = exports.z_tipos_dados_registro = exports.zp_produto_conta = exports.validarZ = exports.PREFIXO_PILAO = exports.zAmbiente = exports.zp_deletar_registros = void 0;
|
||||||
const p_respostas_1 = require("p-respostas");
|
const p_respostas_1 = require("p-respostas");
|
||||||
const zod_1 = require("zod");
|
const zod_1 = require("zod");
|
||||||
|
exports.zp_deletar_registros = zod_1.z.object({
|
||||||
|
tabela: zod_1.z.string(),
|
||||||
|
codigos: zod_1.z.array(zod_1.z.string()),
|
||||||
|
});
|
||||||
exports.zAmbiente = zod_1.z.enum(["desenvolvimento", "producao"]);
|
exports.zAmbiente = zod_1.z.enum(["desenvolvimento", "producao"]);
|
||||||
exports.PREFIXO_PILAO = "/pilao-de-dados";
|
exports.PREFIXO_PILAO = "/pilao-de-dados";
|
||||||
const validarZ = (zodType, objeto, mensagem) => {
|
const validarZ = (zodType, objeto, mensagem) => {
|
||||||
|
|
@ -19,7 +23,7 @@ exports.zp_produto_conta = zod_1.z.object({
|
||||||
emDesenvolvimento: zod_1.z.boolean().optional(),
|
emDesenvolvimento: zod_1.z.boolean().optional(),
|
||||||
ver_log: zod_1.z.boolean().optional(),
|
ver_log: zod_1.z.boolean().optional(),
|
||||||
});
|
});
|
||||||
exports.z_tipo_coluna_base_dados = zod_1.z.enum([
|
exports.z_tipos_dados_registro = zod_1.z.enum([
|
||||||
"texto",
|
"texto",
|
||||||
"numero",
|
"numero",
|
||||||
"confirmacao",
|
"confirmacao",
|
||||||
|
|
|
||||||
6
dist-require/pilao-de-dados/visoes/estrutura_de_campos/index.d.ts
vendored
Normal file
6
dist-require/pilao-de-dados/visoes/estrutura_de_campos/index.d.ts
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
import type { visoes_pilao } from "../listaDeVisoes";
|
||||||
|
import type { tipo_estrutura_visao_grafico } from "../tipagem";
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
export declare const extruturas_de_campos: {
|
||||||
|
[T in keyof typeof visoes_pilao]: tipo_estrutura_visao_grafico<T>;
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.extruturas_de_campos = void 0;
|
||||||
|
const z_contagem_em_barra_vertical_1 = require("./z_contagem_em_barra_vertical");
|
||||||
|
const z_contagem_em_pizza_1 = require("./z_contagem_em_pizza");
|
||||||
|
const z_soma_em_barra_vertical_1 = require("./z_soma_em_barra_vertical");
|
||||||
|
const z_tabela_1 = require("./z_tabela");
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
exports.extruturas_de_campos = {
|
||||||
|
z_contagem_em_barra_vertical: z_contagem_em_barra_vertical_1.z_contagem_em_barra_vertical,
|
||||||
|
z_contagem_em_pizza: z_contagem_em_pizza_1.z_contagem_em_pizza,
|
||||||
|
z_soma_em_barra_vertical: z_soma_em_barra_vertical_1.z_soma_em_barra_vertical,
|
||||||
|
z_tabela: z_tabela_1.z_tabela,
|
||||||
|
};
|
||||||
3
dist-require/pilao-de-dados/visoes/estrutura_de_campos/z_contagem_em_barra_vertical.d.ts
vendored
Normal file
3
dist-require/pilao-de-dados/visoes/estrutura_de_campos/z_contagem_em_barra_vertical.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
import type { tipo_estrutura_visao_grafico } from "../tipagem";
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
export declare const z_contagem_em_barra_vertical: tipo_estrutura_visao_grafico<"z_contagem_em_barra_vertical">;
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
"use strict";
|
||||||
|
// usar describe para definir o tipo de campo para render do componente
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.z_contagem_em_barra_vertical = void 0;
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
exports.z_contagem_em_barra_vertical = {
|
||||||
|
visao: "z_contagem_em_barra_vertical",
|
||||||
|
rotulo: "Contagem em Barra Vertical",
|
||||||
|
tabela: ({ tabela }) => tabela,
|
||||||
|
descricao: ({ tabela, descricao_pelo_usuario, colanuEixoX, filtros, colunaAgrupamento, }) => {
|
||||||
|
if (String(descricao_pelo_usuario || "").trim())
|
||||||
|
return String(descricao_pelo_usuario || "").trim();
|
||||||
|
return `Contagem de ${tabela} por ${colanuEixoX}${!filtros?.length
|
||||||
|
? ""
|
||||||
|
: `, quando ${filtros
|
||||||
|
.map(({ coluna, operador, valor }) => `${coluna} ${operador} ${valor}`)
|
||||||
|
.join(", ")}`}${!colunaAgrupamento?.length
|
||||||
|
? ""
|
||||||
|
: `, agrupado por ${colunaAgrupamento.join(", ")}`}.`;
|
||||||
|
},
|
||||||
|
campos: {
|
||||||
|
tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 },
|
||||||
|
colanuEixoX: {
|
||||||
|
rotulo: "Coluna do Eixo X",
|
||||||
|
tipo_campo: "coluna",
|
||||||
|
order: 2,
|
||||||
|
},
|
||||||
|
colunaAgrupamento: {
|
||||||
|
rotulo: "Colunas de Agrupamento",
|
||||||
|
tipo_campo: "lista_colunas",
|
||||||
|
order: 3,
|
||||||
|
},
|
||||||
|
descricao_pelo_usuario: {
|
||||||
|
rotulo: "Descrição (opcional)",
|
||||||
|
tipo_campo: "texto",
|
||||||
|
order: 4,
|
||||||
|
},
|
||||||
|
filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 5 },
|
||||||
|
},
|
||||||
|
};
|
||||||
3
dist-require/pilao-de-dados/visoes/estrutura_de_campos/z_contagem_em_pizza.d.ts
vendored
Normal file
3
dist-require/pilao-de-dados/visoes/estrutura_de_campos/z_contagem_em_pizza.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
import type { tipo_estrutura_visao_grafico } from "../tipagem";
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
export declare const z_contagem_em_pizza: tipo_estrutura_visao_grafico<"z_contagem_em_pizza">;
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
"use strict";
|
||||||
|
// usar describe para definir o tipo de campo para render do componente
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.z_contagem_em_pizza = void 0;
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
exports.z_contagem_em_pizza = {
|
||||||
|
visao: "z_contagem_em_pizza",
|
||||||
|
rotulo: "Contagem em Pizza",
|
||||||
|
tabela: ({ tabela }) => tabela,
|
||||||
|
descricao: ({ tabela, descricao_pelo_usuario, classes, filtros }) => {
|
||||||
|
if (String(descricao_pelo_usuario || "").trim())
|
||||||
|
return String(descricao_pelo_usuario || "").trim();
|
||||||
|
return `Contagem de ${tabela} por ${classes}${!filtros?.length
|
||||||
|
? ""
|
||||||
|
: `, quando ${filtros
|
||||||
|
.map(({ coluna, operador, valor }) => `${coluna} ${operador} ${valor}`)
|
||||||
|
.join(", ")}`}.`;
|
||||||
|
},
|
||||||
|
campos: {
|
||||||
|
tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 },
|
||||||
|
classes: { rotulo: "Classes", tipo_campo: "coluna", order: 2 },
|
||||||
|
descricao_pelo_usuario: {
|
||||||
|
rotulo: "Descrição (opcional)",
|
||||||
|
tipo_campo: "texto",
|
||||||
|
order: 3,
|
||||||
|
},
|
||||||
|
filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 4 },
|
||||||
|
},
|
||||||
|
};
|
||||||
3
dist-require/pilao-de-dados/visoes/estrutura_de_campos/z_soma_em_barra_vertical.d.ts
vendored
Normal file
3
dist-require/pilao-de-dados/visoes/estrutura_de_campos/z_soma_em_barra_vertical.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
import type { tipo_estrutura_visao_grafico } from "../tipagem";
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
export declare const z_soma_em_barra_vertical: tipo_estrutura_visao_grafico<"z_soma_em_barra_vertical">;
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
"use strict";
|
||||||
|
// usar describe para definir o tipo de campo para render do componente
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.z_soma_em_barra_vertical = void 0;
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
exports.z_soma_em_barra_vertical = {
|
||||||
|
visao: "z_soma_em_barra_vertical",
|
||||||
|
rotulo: "Soma em Barra Vertical",
|
||||||
|
tabela: ({ tabela }) => tabela,
|
||||||
|
descricao: ({ descricao_pelo_usuario, colanuEixoX, filtros, colunaAgrupamento, colunaSoma, }) => {
|
||||||
|
if (String(descricao_pelo_usuario || "").trim())
|
||||||
|
return String(descricao_pelo_usuario || "").trim();
|
||||||
|
return `Soma de ${colunaSoma} por ${colanuEixoX}${!filtros?.length
|
||||||
|
? ""
|
||||||
|
: `, quando ${filtros
|
||||||
|
.map(({ coluna, operador, valor }) => `${coluna} ${operador} ${valor}`)
|
||||||
|
.join(", ")}`}${!colunaAgrupamento?.length
|
||||||
|
? ""
|
||||||
|
: `, agrupado por ${colunaAgrupamento.join(", ")}`}.`;
|
||||||
|
},
|
||||||
|
campos: {
|
||||||
|
tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 },
|
||||||
|
colunaSoma: {
|
||||||
|
rotulo: "Coluna de Somatória",
|
||||||
|
tipo_campo: "coluna",
|
||||||
|
order: 2,
|
||||||
|
},
|
||||||
|
unidadeSoma: {
|
||||||
|
rotulo: "Unidade de Somatória",
|
||||||
|
tipo_campo: "texto",
|
||||||
|
order: 3,
|
||||||
|
},
|
||||||
|
colanuEixoX: {
|
||||||
|
rotulo: "Coluna do Eixo X",
|
||||||
|
tipo_campo: "coluna",
|
||||||
|
order: 4,
|
||||||
|
},
|
||||||
|
colunaAgrupamento: {
|
||||||
|
rotulo: "Colunas de Agrupamento",
|
||||||
|
tipo_campo: "lista_colunas",
|
||||||
|
order: 5,
|
||||||
|
},
|
||||||
|
descricao_pelo_usuario: {
|
||||||
|
rotulo: "Descrição (opcional)",
|
||||||
|
tipo_campo: "texto",
|
||||||
|
order: 6,
|
||||||
|
},
|
||||||
|
filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 5 },
|
||||||
|
},
|
||||||
|
};
|
||||||
3
dist-require/pilao-de-dados/visoes/estrutura_de_campos/z_tabela.d.ts
vendored
Normal file
3
dist-require/pilao-de-dados/visoes/estrutura_de_campos/z_tabela.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
import type { tipo_estrutura_visao_grafico } from "../tipagem";
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
export declare const z_tabela: tipo_estrutura_visao_grafico<"z_tabela">;
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
"use strict";
|
||||||
|
// usar describe para definir o tipo de campo para render do componente
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.z_tabela = void 0;
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
exports.z_tabela = {
|
||||||
|
visao: "z_tabela",
|
||||||
|
rotulo: "Tabela",
|
||||||
|
tabela: ({ tabela }) => tabela,
|
||||||
|
descricao: ({ tabela, descricao_pelo_usuario, filtros }) => {
|
||||||
|
if (String(descricao_pelo_usuario || "").trim())
|
||||||
|
return String(descricao_pelo_usuario || "").trim();
|
||||||
|
return `Consulta na ${tabela} ${!filtros?.length
|
||||||
|
? ""
|
||||||
|
: `, quando ${filtros
|
||||||
|
.map(({ coluna, operador, valor }) => `${coluna} ${operador} ${valor}`)
|
||||||
|
.join(", ")}`}.`;
|
||||||
|
},
|
||||||
|
campos: {
|
||||||
|
tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 },
|
||||||
|
colunas: { rotulo: "Colunas", tipo_campo: "lista_colunas", order: 2 },
|
||||||
|
descricao_pelo_usuario: {
|
||||||
|
rotulo: "Descrição (opcional)",
|
||||||
|
tipo_campo: "texto",
|
||||||
|
order: 3,
|
||||||
|
},
|
||||||
|
coluna_ordem: {
|
||||||
|
rotulo: "Coluna de Ordem",
|
||||||
|
tipo_campo: "coluna",
|
||||||
|
order: 4,
|
||||||
|
},
|
||||||
|
direcao_ordem: {
|
||||||
|
rotulo: "Direção de Ordem",
|
||||||
|
tipo_campo: "ordem",
|
||||||
|
order: 5,
|
||||||
|
},
|
||||||
|
filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 6 },
|
||||||
|
},
|
||||||
|
};
|
||||||
261
dist-require/pilao-de-dados/visoes/index.d.ts
vendored
261
dist-require/pilao-de-dados/visoes/index.d.ts
vendored
|
|
@ -1,260 +1 @@
|
||||||
import { z } from "zod";
|
export * from "./estrutura_de_campos";
|
||||||
declare const z_tipos_campos: z.ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>;
|
|
||||||
export declare const z_contagem_em_barra_vertical: z.ZodObject<{
|
|
||||||
tabela: z.ZodString;
|
|
||||||
colanuEixoX: z.ZodString;
|
|
||||||
colunaAgrupamento: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
||||||
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
||||||
coluna: z.ZodString;
|
|
||||||
valor: z.ZodAny;
|
|
||||||
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}>, "many">>;
|
|
||||||
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
tabela: string;
|
|
||||||
colanuEixoX: string;
|
|
||||||
colunaAgrupamento?: string[] | undefined;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}, {
|
|
||||||
tabela: string;
|
|
||||||
colanuEixoX: string;
|
|
||||||
colunaAgrupamento?: string[] | undefined;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}>;
|
|
||||||
export declare const z_contagem_em_pizza: z.ZodObject<{
|
|
||||||
tabela: z.ZodString;
|
|
||||||
classes: z.ZodString;
|
|
||||||
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
||||||
coluna: z.ZodString;
|
|
||||||
valor: z.ZodAny;
|
|
||||||
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}>, "many">>;
|
|
||||||
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
tabela: string;
|
|
||||||
classes: string;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}, {
|
|
||||||
tabela: string;
|
|
||||||
classes: string;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}>;
|
|
||||||
export declare const z_tabela: z.ZodObject<{
|
|
||||||
tabela: z.ZodString;
|
|
||||||
colunas: z.ZodArray<z.ZodString, "many">;
|
|
||||||
coluna_ordem: z.ZodOptional<z.ZodString>;
|
|
||||||
direcao_ordem: z.ZodOptional<z.ZodEnum<["asc", "desc", "1", "-1"]>>;
|
|
||||||
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
||||||
coluna: z.ZodString;
|
|
||||||
valor: z.ZodAny;
|
|
||||||
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}>, "many">>;
|
|
||||||
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
tabela: string;
|
|
||||||
colunas: string[];
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
coluna_ordem?: string | undefined;
|
|
||||||
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
|
||||||
}, {
|
|
||||||
tabela: string;
|
|
||||||
colunas: string[];
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
coluna_ordem?: string | undefined;
|
|
||||||
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
|
||||||
}>;
|
|
||||||
export declare const visoes: {
|
|
||||||
z_contagem_em_barra_vertical: z.ZodObject<{
|
|
||||||
tabela: z.ZodString;
|
|
||||||
colanuEixoX: z.ZodString;
|
|
||||||
colunaAgrupamento: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
||||||
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
||||||
coluna: z.ZodString;
|
|
||||||
valor: z.ZodAny;
|
|
||||||
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}>, "many">>;
|
|
||||||
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
tabela: string;
|
|
||||||
colanuEixoX: string;
|
|
||||||
colunaAgrupamento?: string[] | undefined;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}, {
|
|
||||||
tabela: string;
|
|
||||||
colanuEixoX: string;
|
|
||||||
colunaAgrupamento?: string[] | undefined;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}>;
|
|
||||||
z_contagem_em_pizza: z.ZodObject<{
|
|
||||||
tabela: z.ZodString;
|
|
||||||
classes: z.ZodString;
|
|
||||||
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
||||||
coluna: z.ZodString;
|
|
||||||
valor: z.ZodAny;
|
|
||||||
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}>, "many">>;
|
|
||||||
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
tabela: string;
|
|
||||||
classes: string;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}, {
|
|
||||||
tabela: string;
|
|
||||||
classes: string;
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
}>;
|
|
||||||
z_tabela: z.ZodObject<{
|
|
||||||
tabela: z.ZodString;
|
|
||||||
colunas: z.ZodArray<z.ZodString, "many">;
|
|
||||||
coluna_ordem: z.ZodOptional<z.ZodString>;
|
|
||||||
direcao_ordem: z.ZodOptional<z.ZodEnum<["asc", "desc", "1", "-1"]>>;
|
|
||||||
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
||||||
coluna: z.ZodString;
|
|
||||||
valor: z.ZodAny;
|
|
||||||
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}, {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}>, "many">>;
|
|
||||||
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
tabela: string;
|
|
||||||
colunas: string[];
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
coluna_ordem?: string | undefined;
|
|
||||||
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
|
||||||
}, {
|
|
||||||
tabela: string;
|
|
||||||
colunas: string[];
|
|
||||||
filtros?: {
|
|
||||||
coluna: string;
|
|
||||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
|
||||||
valor?: any;
|
|
||||||
}[] | undefined;
|
|
||||||
descricao_pelo_usuario?: string | undefined;
|
|
||||||
coluna_ordem?: string | undefined;
|
|
||||||
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
|
||||||
}>;
|
|
||||||
};
|
|
||||||
/** Cria a estrutura de campos para insersão de dados */
|
|
||||||
export declare const extruturas_de_campos: {
|
|
||||||
[z in keyof typeof visoes]: {
|
|
||||||
/** Nome da Visão */
|
|
||||||
visao: z;
|
|
||||||
/** Rotulo */
|
|
||||||
rotulo: string;
|
|
||||||
/** Retorna a tabela Referente ao Registro */
|
|
||||||
tabela: (_: z.infer<(typeof visoes)[z]>) => string;
|
|
||||||
/** Descrição */
|
|
||||||
descricao: (_: z.infer<(typeof visoes)[z]>) => string;
|
|
||||||
/** Lista os campos e suas configurações */
|
|
||||||
campos: {
|
|
||||||
[c in keyof Required<z.infer<(typeof visoes)[z]>>]: {
|
|
||||||
rotulo: string;
|
|
||||||
tipo_campo: z.infer<typeof z_tipos_campos>;
|
|
||||||
order: number;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
export {};
|
|
||||||
|
|
|
||||||
|
|
@ -1,136 +1,17 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||||
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.extruturas_de_campos = exports.visoes = exports.z_tabela = exports.z_contagem_em_pizza = exports.z_contagem_em_barra_vertical = void 0;
|
__exportStar(require("./estrutura_de_campos"), exports);
|
||||||
const zod_1 = require("zod");
|
|
||||||
const _serie_consultar_1 = require("../_serie_consultar");
|
|
||||||
// usar describe para definir o tipo de campo para render do componente
|
|
||||||
const z_tipos_campos = zod_1.z.enum([
|
|
||||||
"tabela",
|
|
||||||
"coluna",
|
|
||||||
"texto",
|
|
||||||
"lista_colunas",
|
|
||||||
"lista_filtros",
|
|
||||||
"ordem",
|
|
||||||
]);
|
|
||||||
exports.z_contagem_em_barra_vertical = zod_1.z.object({
|
|
||||||
tabela: zod_1.z.string(),
|
|
||||||
colanuEixoX: zod_1.z.string(),
|
|
||||||
colunaAgrupamento: zod_1.z.string().array().optional(),
|
|
||||||
filtros: _serie_consultar_1.z_filtro.array().optional(),
|
|
||||||
descricao_pelo_usuario: zod_1.z.string().optional(),
|
|
||||||
});
|
|
||||||
exports.z_contagem_em_pizza = zod_1.z.object({
|
|
||||||
tabela: zod_1.z.string(),
|
|
||||||
classes: zod_1.z.string(),
|
|
||||||
filtros: _serie_consultar_1.z_filtro.array().optional(),
|
|
||||||
descricao_pelo_usuario: zod_1.z.string().optional(),
|
|
||||||
});
|
|
||||||
exports.z_tabela = zod_1.z.object({
|
|
||||||
tabela: zod_1.z.string(),
|
|
||||||
colunas: zod_1.z.string().array(),
|
|
||||||
coluna_ordem: zod_1.z.string().optional(),
|
|
||||||
direcao_ordem: zod_1.z.enum(["asc", "desc", "1", "-1"]).optional(),
|
|
||||||
filtros: _serie_consultar_1.z_filtro.array().optional(),
|
|
||||||
descricao_pelo_usuario: zod_1.z.string().optional(),
|
|
||||||
});
|
|
||||||
exports.visoes = {
|
|
||||||
z_contagem_em_barra_vertical: exports.z_contagem_em_barra_vertical,
|
|
||||||
z_contagem_em_pizza: exports.z_contagem_em_pizza,
|
|
||||||
z_tabela: exports.z_tabela,
|
|
||||||
};
|
|
||||||
/** Cria a estrutura de campos para insersão de dados */
|
|
||||||
exports.extruturas_de_campos = {
|
|
||||||
z_contagem_em_barra_vertical: {
|
|
||||||
visao: "z_contagem_em_barra_vertical",
|
|
||||||
rotulo: "Contagem em Barra Vertical",
|
|
||||||
tabela: ({ tabela }) => tabela,
|
|
||||||
descricao: ({ tabela, descricao_pelo_usuario, colanuEixoX, filtros, colunaAgrupamento, }) => {
|
|
||||||
if (String(descricao_pelo_usuario || "").trim())
|
|
||||||
return String(descricao_pelo_usuario || "").trim();
|
|
||||||
return `Contagem de ${tabela} por ${colanuEixoX}${!filtros?.length
|
|
||||||
? ""
|
|
||||||
: `, quando ${filtros
|
|
||||||
.map(({ coluna, operador, valor }) => `${coluna} ${operador} ${valor}`)
|
|
||||||
.join(", ")}`}${!colunaAgrupamento?.length
|
|
||||||
? ""
|
|
||||||
: `, agrupado por ${colunaAgrupamento.join(", ")}`}.`;
|
|
||||||
},
|
|
||||||
campos: {
|
|
||||||
tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 },
|
|
||||||
colanuEixoX: {
|
|
||||||
rotulo: "Coluna do Eixo X",
|
|
||||||
tipo_campo: "coluna",
|
|
||||||
order: 2,
|
|
||||||
},
|
|
||||||
colunaAgrupamento: {
|
|
||||||
rotulo: "Colunas de Agrupamento",
|
|
||||||
tipo_campo: "lista_colunas",
|
|
||||||
order: 3,
|
|
||||||
},
|
|
||||||
descricao_pelo_usuario: {
|
|
||||||
rotulo: "Descrição (opcional)",
|
|
||||||
tipo_campo: "texto",
|
|
||||||
order: 4,
|
|
||||||
},
|
|
||||||
filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 5 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
z_contagem_em_pizza: {
|
|
||||||
visao: "z_contagem_em_pizza",
|
|
||||||
rotulo: "Contagem em Pizza",
|
|
||||||
tabela: ({ tabela }) => tabela,
|
|
||||||
descricao: ({ tabela, descricao_pelo_usuario, classes, filtros }) => {
|
|
||||||
if (String(descricao_pelo_usuario || "").trim())
|
|
||||||
return String(descricao_pelo_usuario || "").trim();
|
|
||||||
return `Contagem de ${tabela} por ${classes}${!filtros?.length
|
|
||||||
? ""
|
|
||||||
: `, quando ${filtros
|
|
||||||
.map(({ coluna, operador, valor }) => `${coluna} ${operador} ${valor}`)
|
|
||||||
.join(", ")}`}.`;
|
|
||||||
},
|
|
||||||
campos: {
|
|
||||||
tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 },
|
|
||||||
classes: { rotulo: "Classes", tipo_campo: "coluna", order: 2 },
|
|
||||||
descricao_pelo_usuario: {
|
|
||||||
rotulo: "Descrição (opcional)",
|
|
||||||
tipo_campo: "texto",
|
|
||||||
order: 3,
|
|
||||||
},
|
|
||||||
filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 4 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
z_tabela: {
|
|
||||||
visao: "z_tabela",
|
|
||||||
rotulo: "Tabela",
|
|
||||||
tabela: ({ tabela }) => tabela,
|
|
||||||
descricao: ({ tabela, descricao_pelo_usuario, filtros }) => {
|
|
||||||
if (String(descricao_pelo_usuario || "").trim())
|
|
||||||
return String(descricao_pelo_usuario || "").trim();
|
|
||||||
return `Consulta na ${tabela} ${!filtros?.length
|
|
||||||
? ""
|
|
||||||
: `, quando ${filtros
|
|
||||||
.map(({ coluna, operador, valor }) => `${coluna} ${operador} ${valor}`)
|
|
||||||
.join(", ")}`}.`;
|
|
||||||
},
|
|
||||||
campos: {
|
|
||||||
tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 },
|
|
||||||
colunas: { rotulo: "Colunas", tipo_campo: "lista_colunas", order: 2 },
|
|
||||||
descricao_pelo_usuario: {
|
|
||||||
rotulo: "Descrição (opcional)",
|
|
||||||
tipo_campo: "texto",
|
|
||||||
order: 3,
|
|
||||||
},
|
|
||||||
coluna_ordem: {
|
|
||||||
rotulo: "Coluna de Ordem",
|
|
||||||
tipo_campo: "coluna",
|
|
||||||
order: 4,
|
|
||||||
},
|
|
||||||
direcao_ordem: {
|
|
||||||
rotulo: "Direção de Ordem",
|
|
||||||
tipo_campo: "ordem",
|
|
||||||
order: 5,
|
|
||||||
},
|
|
||||||
filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 6 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
||||||
327
dist-require/pilao-de-dados/visoes/listaDeVisoes.d.ts
vendored
Normal file
327
dist-require/pilao-de-dados/visoes/listaDeVisoes.d.ts
vendored
Normal file
|
|
@ -0,0 +1,327 @@
|
||||||
|
import { z } from "zod";
|
||||||
|
export declare const z_contagem_em_barra_vertical: z.ZodObject<{
|
||||||
|
tabela: z.ZodString;
|
||||||
|
colanuEixoX: z.ZodString;
|
||||||
|
colunaAgrupamento: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||||
|
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||||
|
coluna: z.ZodString;
|
||||||
|
valor: z.ZodAny;
|
||||||
|
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}>, "many">>;
|
||||||
|
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
}>;
|
||||||
|
export declare const z_soma_em_barra_vertical: z.ZodObject<{
|
||||||
|
tabela: z.ZodString;
|
||||||
|
colanuEixoX: z.ZodString;
|
||||||
|
colunaSoma: z.ZodString;
|
||||||
|
unidadeSoma: z.ZodOptional<z.ZodString>;
|
||||||
|
colunaAgrupamento: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||||
|
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||||
|
coluna: z.ZodString;
|
||||||
|
valor: z.ZodAny;
|
||||||
|
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}>, "many">>;
|
||||||
|
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaSoma: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
unidadeSoma?: string | undefined;
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaSoma: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
unidadeSoma?: string | undefined;
|
||||||
|
}>;
|
||||||
|
export declare const z_contagem_em_pizza: z.ZodObject<{
|
||||||
|
tabela: z.ZodString;
|
||||||
|
classes: z.ZodString;
|
||||||
|
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||||
|
coluna: z.ZodString;
|
||||||
|
valor: z.ZodAny;
|
||||||
|
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}>, "many">>;
|
||||||
|
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
classes: string;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
classes: string;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
}>;
|
||||||
|
export declare const z_tabela: z.ZodObject<{
|
||||||
|
tabela: z.ZodString;
|
||||||
|
colunas: z.ZodArray<z.ZodString, "many">;
|
||||||
|
coluna_ordem: z.ZodOptional<z.ZodString>;
|
||||||
|
direcao_ordem: z.ZodOptional<z.ZodEnum<["asc", "desc", "1", "-1"]>>;
|
||||||
|
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||||
|
coluna: z.ZodString;
|
||||||
|
valor: z.ZodAny;
|
||||||
|
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}>, "many">>;
|
||||||
|
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
colunas: string[];
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
coluna_ordem?: string | undefined;
|
||||||
|
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
colunas: string[];
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
coluna_ordem?: string | undefined;
|
||||||
|
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
||||||
|
}>;
|
||||||
|
export declare const visoes_pilao: {
|
||||||
|
z_contagem_em_barra_vertical: z.ZodObject<{
|
||||||
|
tabela: z.ZodString;
|
||||||
|
colanuEixoX: z.ZodString;
|
||||||
|
colunaAgrupamento: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||||
|
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||||
|
coluna: z.ZodString;
|
||||||
|
valor: z.ZodAny;
|
||||||
|
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}>, "many">>;
|
||||||
|
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
}>;
|
||||||
|
z_contagem_em_pizza: z.ZodObject<{
|
||||||
|
tabela: z.ZodString;
|
||||||
|
classes: z.ZodString;
|
||||||
|
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||||
|
coluna: z.ZodString;
|
||||||
|
valor: z.ZodAny;
|
||||||
|
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}>, "many">>;
|
||||||
|
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
classes: string;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
classes: string;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
}>;
|
||||||
|
z_tabela: z.ZodObject<{
|
||||||
|
tabela: z.ZodString;
|
||||||
|
colunas: z.ZodArray<z.ZodString, "many">;
|
||||||
|
coluna_ordem: z.ZodOptional<z.ZodString>;
|
||||||
|
direcao_ordem: z.ZodOptional<z.ZodEnum<["asc", "desc", "1", "-1"]>>;
|
||||||
|
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||||
|
coluna: z.ZodString;
|
||||||
|
valor: z.ZodAny;
|
||||||
|
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}>, "many">>;
|
||||||
|
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
colunas: string[];
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
coluna_ordem?: string | undefined;
|
||||||
|
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
colunas: string[];
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
coluna_ordem?: string | undefined;
|
||||||
|
direcao_ordem?: "1" | "asc" | "desc" | "-1" | undefined;
|
||||||
|
}>;
|
||||||
|
z_soma_em_barra_vertical: z.ZodObject<{
|
||||||
|
tabela: z.ZodString;
|
||||||
|
colanuEixoX: z.ZodString;
|
||||||
|
colunaSoma: z.ZodString;
|
||||||
|
unidadeSoma: z.ZodOptional<z.ZodString>;
|
||||||
|
colunaAgrupamento: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||||
|
filtros: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||||
|
coluna: z.ZodString;
|
||||||
|
valor: z.ZodAny;
|
||||||
|
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}, {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}>, "many">>;
|
||||||
|
descricao_pelo_usuario: z.ZodOptional<z.ZodString>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaSoma: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
unidadeSoma?: string | undefined;
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaSoma: string;
|
||||||
|
colunaAgrupamento?: string[] | undefined;
|
||||||
|
filtros?: {
|
||||||
|
coluna: string;
|
||||||
|
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||||
|
valor?: any;
|
||||||
|
}[] | undefined;
|
||||||
|
descricao_pelo_usuario?: string | undefined;
|
||||||
|
unidadeSoma?: string | undefined;
|
||||||
|
}>;
|
||||||
|
};
|
||||||
41
dist-require/pilao-de-dados/visoes/listaDeVisoes.js
Normal file
41
dist-require/pilao-de-dados/visoes/listaDeVisoes.js
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.visoes_pilao = exports.z_tabela = exports.z_contagem_em_pizza = exports.z_soma_em_barra_vertical = exports.z_contagem_em_barra_vertical = void 0;
|
||||||
|
const zod_1 = require("zod");
|
||||||
|
const _serie_consultar_1 = require("../_serie_consultar");
|
||||||
|
exports.z_contagem_em_barra_vertical = zod_1.z.object({
|
||||||
|
tabela: zod_1.z.string(),
|
||||||
|
colanuEixoX: zod_1.z.string(),
|
||||||
|
colunaAgrupamento: zod_1.z.string().array().optional(),
|
||||||
|
filtros: _serie_consultar_1.z_filtro.array().optional(),
|
||||||
|
descricao_pelo_usuario: zod_1.z.string().optional(),
|
||||||
|
});
|
||||||
|
exports.z_soma_em_barra_vertical = zod_1.z.object({
|
||||||
|
tabela: zod_1.z.string(),
|
||||||
|
colanuEixoX: zod_1.z.string(),
|
||||||
|
colunaSoma: zod_1.z.string(),
|
||||||
|
unidadeSoma: zod_1.z.string().optional(),
|
||||||
|
colunaAgrupamento: zod_1.z.string().array().optional(),
|
||||||
|
filtros: _serie_consultar_1.z_filtro.array().optional(),
|
||||||
|
descricao_pelo_usuario: zod_1.z.string().optional(),
|
||||||
|
});
|
||||||
|
exports.z_contagem_em_pizza = zod_1.z.object({
|
||||||
|
tabela: zod_1.z.string(),
|
||||||
|
classes: zod_1.z.string(),
|
||||||
|
filtros: _serie_consultar_1.z_filtro.array().optional(),
|
||||||
|
descricao_pelo_usuario: zod_1.z.string().optional(),
|
||||||
|
});
|
||||||
|
exports.z_tabela = zod_1.z.object({
|
||||||
|
tabela: zod_1.z.string(),
|
||||||
|
colunas: zod_1.z.string().array(),
|
||||||
|
coluna_ordem: zod_1.z.string().optional(),
|
||||||
|
direcao_ordem: zod_1.z.enum(["asc", "desc", "1", "-1"]).optional(),
|
||||||
|
filtros: _serie_consultar_1.z_filtro.array().optional(),
|
||||||
|
descricao_pelo_usuario: zod_1.z.string().optional(),
|
||||||
|
});
|
||||||
|
exports.visoes_pilao = {
|
||||||
|
z_contagem_em_barra_vertical: exports.z_contagem_em_barra_vertical,
|
||||||
|
z_contagem_em_pizza: exports.z_contagem_em_pizza,
|
||||||
|
z_tabela: exports.z_tabela,
|
||||||
|
z_soma_em_barra_vertical: exports.z_soma_em_barra_vertical,
|
||||||
|
};
|
||||||
21
dist-require/pilao-de-dados/visoes/tipagem.d.ts
vendored
Normal file
21
dist-require/pilao-de-dados/visoes/tipagem.d.ts
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
import { z } from "zod";
|
||||||
|
import type { visoes_pilao } from "./listaDeVisoes";
|
||||||
|
export declare const z_tipos_campos_reg_grafico: z.ZodEnum<["tabela", "coluna", "texto", "lista_colunas", "lista_filtros", "ordem"]>;
|
||||||
|
export type tipo_estrutura_visao_grafico<T extends keyof typeof visoes_pilao> = {
|
||||||
|
/** Nome da Visão */
|
||||||
|
visao: T;
|
||||||
|
/** Rotulo */
|
||||||
|
rotulo: string;
|
||||||
|
/** Retorna a tabela Referente ao Registro */
|
||||||
|
tabela: (_: z.infer<(typeof visoes_pilao)[T]>) => string;
|
||||||
|
/** Descrição */
|
||||||
|
descricao: (_: z.infer<(typeof visoes_pilao)[T]>) => string;
|
||||||
|
/** Lista os campos e suas configurações */
|
||||||
|
campos: {
|
||||||
|
[c in keyof Required<z.infer<(typeof visoes_pilao)[T]>>]: {
|
||||||
|
rotulo: string;
|
||||||
|
tipo_campo: z.infer<typeof z_tipos_campos_reg_grafico>;
|
||||||
|
order: number;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
12
dist-require/pilao-de-dados/visoes/tipagem.js
Normal file
12
dist-require/pilao-de-dados/visoes/tipagem.js
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.z_tipos_campos_reg_grafico = void 0;
|
||||||
|
const zod_1 = require("zod");
|
||||||
|
exports.z_tipos_campos_reg_grafico = zod_1.z.enum([
|
||||||
|
"tabela",
|
||||||
|
"coluna",
|
||||||
|
"texto",
|
||||||
|
"lista_colunas",
|
||||||
|
"lista_filtros",
|
||||||
|
"ordem",
|
||||||
|
]);
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "p-drives",
|
"name": "p-drives",
|
||||||
"version": "0.150.0",
|
"version": "0.180.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "pnpm up p-*",
|
"at": "pnpm up p-*",
|
||||||
"build-back": "rm -fr dist-require && tsc -p ./tsconfig-require.json",
|
"build-back": "rm -fr dist-require && tsc -p ./tsconfig-require.json",
|
||||||
"build-front": "rm -fr dist-import && tsc -p ./tsconfig-import.json",
|
"build-front": "rm -fr dist-import && tsc -p ./tsconfig-import.json",
|
||||||
"build": "pnpm run biome && npm --no-git-tag-version version minor && pnpm run build-back && pnpm run build-front",
|
"build": "pnpm run biome && npm --no-git-tag-version version minor && pnpm run build-back && pnpm run build-front",
|
||||||
|
|
|
||||||
284
src/pilao-de-dados/Pilao/index.ts
Normal file
284
src/pilao-de-dados/Pilao/index.ts
Normal file
|
|
@ -0,0 +1,284 @@
|
||||||
|
/** Drive completo do piilão de dados */
|
||||||
|
|
||||||
|
import crossFetch from "cross-fetch"
|
||||||
|
import { nomeVariavel } from "p-comuns"
|
||||||
|
|
||||||
|
import { respostaComuns, type tipoResposta } from "p-respostas"
|
||||||
|
import type { z } from "zod"
|
||||||
|
|
||||||
|
import type { zp_enviar_registros } from "../_enviar_registros"
|
||||||
|
import { PREFIXO_PILAO, type zp_deletar_registros } from "../variaveis"
|
||||||
|
|
||||||
|
import type { visoes_pilao } from "../visoes/listaDeVisoes"
|
||||||
|
import type { tipo_pilao_api } from "./pilao-api.ts"
|
||||||
|
import type { tipoConstrutorPilao, tipoRetornoSerieconsulta } from "./tipagem"
|
||||||
|
|
||||||
|
class ClassPilao {
|
||||||
|
#produto: string
|
||||||
|
#conta: string
|
||||||
|
#emDesenvolvimento: boolean
|
||||||
|
#ver_log: boolean
|
||||||
|
#registrosParaEnvio: Record<
|
||||||
|
string,
|
||||||
|
z.infer<typeof zp_enviar_registros>["registros"]
|
||||||
|
> = {}
|
||||||
|
#codigosParaDeletar: Record<
|
||||||
|
string,
|
||||||
|
z.infer<typeof zp_deletar_registros>["codigos"]
|
||||||
|
> = {}
|
||||||
|
|
||||||
|
constructor({
|
||||||
|
conta,
|
||||||
|
produto,
|
||||||
|
emDesenvolvimento = false,
|
||||||
|
ver_log = false,
|
||||||
|
}: tipoConstrutorPilao & { ver_log?: boolean; emDesenvolvimento?: boolean }) {
|
||||||
|
this.#produto = produto
|
||||||
|
this.#conta = conta
|
||||||
|
this.#emDesenvolvimento = emDesenvolvimento
|
||||||
|
this.#ver_log = ver_log
|
||||||
|
}
|
||||||
|
|
||||||
|
#gerarUrl(acao: string, extraPath?: string): { rota: string; url: string } {
|
||||||
|
const rota = `${PREFIXO_PILAO}/api/${acao}/${this.#produto}/${this.#conta}${
|
||||||
|
extraPath ? `/${extraPath}` : ""
|
||||||
|
}`
|
||||||
|
const url = `${this.baseUrlApi}${rota}`
|
||||||
|
return { rota, url }
|
||||||
|
}
|
||||||
|
|
||||||
|
rotaEnviarRegistros() {
|
||||||
|
return this.#gerarUrl("enviar-registros")
|
||||||
|
}
|
||||||
|
|
||||||
|
rotaDeletarRegistro() {
|
||||||
|
return this.#gerarUrl("deletar-registros")
|
||||||
|
}
|
||||||
|
|
||||||
|
rotaConsultarSerie(tipoVisao: keyof typeof visoes_pilao | ":tipoVisao") {
|
||||||
|
return this.#gerarUrl("consultar-serie", tipoVisao)
|
||||||
|
}
|
||||||
|
|
||||||
|
rotaIframeSerie(tipoVisao: keyof typeof visoes_pilao | ":tipoVisao") {
|
||||||
|
const rota = `${PREFIXO_PILAO}/consultar-serie/${this.#produto}/${this.#conta}/${tipoVisao}`
|
||||||
|
const url = `${this.baseUrlSite}${rota}`
|
||||||
|
return { rota, url }
|
||||||
|
}
|
||||||
|
|
||||||
|
rotaFuncaoApi(funcao: keyof tipo_pilao_api | ":funcao") {
|
||||||
|
return this.#gerarUrl("API", funcao)
|
||||||
|
}
|
||||||
|
|
||||||
|
async consultarApi<T extends keyof tipo_pilao_api>(
|
||||||
|
funcao: T,
|
||||||
|
parametros: tipo_pilao_api[T]["pr"],
|
||||||
|
): Promise<tipoResposta<tipo_pilao_api[T]["rs"]>> {
|
||||||
|
try {
|
||||||
|
const response = await crossFetch(this.rotaFuncaoApi(funcao).url, {
|
||||||
|
body: JSON.stringify(parametros),
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
})
|
||||||
|
|
||||||
|
const texto = await response.text()
|
||||||
|
|
||||||
|
try {
|
||||||
|
const json = JSON.parse(texto)
|
||||||
|
return json
|
||||||
|
} catch {
|
||||||
|
return respostaComuns.erro("Consulta não retornou json válido", [texto])
|
||||||
|
}
|
||||||
|
} catch (erro) {
|
||||||
|
console.error(erro)
|
||||||
|
return respostaComuns.erroInterno({
|
||||||
|
erro,
|
||||||
|
local: nomeVariavel({ ClassPilao }),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
get baseUrlApi() {
|
||||||
|
return this.#emDesenvolvimento
|
||||||
|
? "http://localhost:5080"
|
||||||
|
: "https://carro-de-boi.idz.one"
|
||||||
|
}
|
||||||
|
|
||||||
|
get baseUrlSite() {
|
||||||
|
return this.#emDesenvolvimento
|
||||||
|
? "http://localhost:5081"
|
||||||
|
: "https://carro-de-boi.idz.one"
|
||||||
|
}
|
||||||
|
|
||||||
|
validarCliente(_: any): tipoResposta<tipoConstrutorPilao> {
|
||||||
|
if (!_?.conta) return respostaComuns.erro("Conta não informada")
|
||||||
|
if (!_?.produto) return respostaComuns.erro("Produto não informado")
|
||||||
|
return respostaComuns.valor(_)
|
||||||
|
}
|
||||||
|
|
||||||
|
adicionarRegistroParaEnviar(
|
||||||
|
tabela: string,
|
||||||
|
...registros: z.infer<typeof zp_enviar_registros>["registros"]
|
||||||
|
) {
|
||||||
|
this.#registrosParaEnvio[tabela] = [
|
||||||
|
...(this.#registrosParaEnvio[tabela] || []),
|
||||||
|
...registros,
|
||||||
|
]
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
adicionarCodigoParaDeletar(
|
||||||
|
tabela: string,
|
||||||
|
...codigos: z.infer<typeof zp_deletar_registros>["codigos"]
|
||||||
|
) {
|
||||||
|
this.#codigosParaDeletar[tabela] = [
|
||||||
|
...(this.#codigosParaDeletar[tabela] || []),
|
||||||
|
...codigos,
|
||||||
|
]
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
private async processarRegistros(
|
||||||
|
url: string,
|
||||||
|
registros: any[],
|
||||||
|
tabela: string,
|
||||||
|
acao: string,
|
||||||
|
): Promise<tipoResposta<true>> {
|
||||||
|
const tamanhoBlocos = 1000
|
||||||
|
while (registros.length > 0) {
|
||||||
|
const bloco = registros
|
||||||
|
.splice(0, tamanhoBlocos)
|
||||||
|
.map((r) =>
|
||||||
|
Object.fromEntries(
|
||||||
|
Object.entries(r).map(([k, v]) => [k, v === undefined ? null : v]),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
const resp = await crossFetch(url, {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify({ tabela, registros: bloco }),
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
})
|
||||||
|
.then(async (r) => {
|
||||||
|
const texto = await r.text()
|
||||||
|
try {
|
||||||
|
const json = JSON.parse(texto)
|
||||||
|
return json
|
||||||
|
} catch {
|
||||||
|
return respostaComuns.erro("Consulta não retornou json válido", [
|
||||||
|
texto,
|
||||||
|
])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) =>
|
||||||
|
respostaComuns.erro(`Erro ao ${acao} registros`, [e.message]),
|
||||||
|
)
|
||||||
|
|
||||||
|
if (resp.eErro) return resp
|
||||||
|
}
|
||||||
|
return respostaComuns.valor(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
async #salvarEnviarRegistros(): Promise<tipoResposta<true>> {
|
||||||
|
for (const tabela of Object.keys(this.#registrosParaEnvio)) {
|
||||||
|
const registros = this.#registrosParaEnvio[tabela] || []
|
||||||
|
const url = this.rotaEnviarRegistros().url
|
||||||
|
if (this.#ver_log)
|
||||||
|
console.log(
|
||||||
|
`[PILÃO]: Enviando ${registros.length} registros na tabela "${tabela}" para "${url}".`,
|
||||||
|
)
|
||||||
|
const resp = await this.processarRegistros(
|
||||||
|
url,
|
||||||
|
registros,
|
||||||
|
tabela,
|
||||||
|
"enviar",
|
||||||
|
)
|
||||||
|
if (resp.eErro) return resp
|
||||||
|
this.#registrosParaEnvio[tabela] = []
|
||||||
|
}
|
||||||
|
return respostaComuns.valor(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
async #salvarDeletarRegistros(): Promise<tipoResposta<true>> {
|
||||||
|
for (const tabela of Object.keys(this.#codigosParaDeletar)) {
|
||||||
|
const codigos = [...(this.#codigosParaDeletar[tabela] || [])]
|
||||||
|
const url = this.rotaDeletarRegistro().url
|
||||||
|
const resp = await this.processarRegistros(
|
||||||
|
url,
|
||||||
|
codigos,
|
||||||
|
tabela,
|
||||||
|
"deletar",
|
||||||
|
)
|
||||||
|
if (resp.eErro) return resp
|
||||||
|
}
|
||||||
|
return respostaComuns.valor(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
async salvarRegistros(): Promise<tipoResposta<true>> {
|
||||||
|
const re = await this.#salvarEnviarRegistros()
|
||||||
|
if (re.eErro) return re
|
||||||
|
const rd = await this.#salvarDeletarRegistros()
|
||||||
|
if (rd.eErro) return rd
|
||||||
|
return respostaComuns.valor(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
serieConsultar<T extends keyof typeof visoes_pilao>(
|
||||||
|
tipoVisao: T,
|
||||||
|
parametros: z.infer<(typeof visoes_pilao)[T]>,
|
||||||
|
) {
|
||||||
|
const dados = async (): Promise<
|
||||||
|
tipoResposta<tipoRetornoSerieconsulta<T>>
|
||||||
|
> => {
|
||||||
|
const url = this.rotaConsultarSerie(tipoVisao).url
|
||||||
|
const resp = await crossFetch(url.toString(), {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(parametros),
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
})
|
||||||
|
.then(async (r) => {
|
||||||
|
const texto = await r.text()
|
||||||
|
|
||||||
|
try {
|
||||||
|
const json = JSON.parse(texto)
|
||||||
|
return json
|
||||||
|
} catch {
|
||||||
|
return respostaComuns.erro("Consulta não retornou json válido", [
|
||||||
|
texto,
|
||||||
|
])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) =>
|
||||||
|
respostaComuns.erro("Erro ao enviar registros", [e.message]),
|
||||||
|
)
|
||||||
|
|
||||||
|
if (this.#ver_log)
|
||||||
|
console.log(
|
||||||
|
`[PILÃO]: buscar dados de "${JSON.stringify(parametros)}" para "${url}".`,
|
||||||
|
)
|
||||||
|
return resp
|
||||||
|
}
|
||||||
|
|
||||||
|
const url = (): string => {
|
||||||
|
const vUrl = this.rotaIframeSerie(tipoVisao).url
|
||||||
|
const serie = encodeURIComponent(JSON.stringify(parametros, null, 2))
|
||||||
|
if (this.#ver_log)
|
||||||
|
console.log(
|
||||||
|
`[PILÃO]: Serie Consultar url de "${JSON.stringify(serie)}" para "${vUrl}".`,
|
||||||
|
)
|
||||||
|
return `${vUrl}?serie=${serie}`
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
dados,
|
||||||
|
url,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
urlLaboratorio() {
|
||||||
|
const rota = `${PREFIXO_PILAO}/laboratório/${this.#produto}/${this.#conta}`
|
||||||
|
const url = `${this.baseUrlSite}${rota}`
|
||||||
|
return { rota, url }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Pilao = (
|
||||||
|
_: tipoConstrutorPilao & { ver_log?: boolean; emDesenvolvimento?: boolean },
|
||||||
|
) => new ClassPilao(_)
|
||||||
32
src/pilao-de-dados/Pilao/pilao-api.ts
Executable file
32
src/pilao-de-dados/Pilao/pilao-api.ts
Executable file
|
|
@ -0,0 +1,32 @@
|
||||||
|
import type { z } from "zod"
|
||||||
|
import type { zp_registrar_base_dados } from "../_enviar_registros"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {
|
||||||
|
* 'rota':{
|
||||||
|
* pr:{}// paramentros de entrada
|
||||||
|
* rs:{}// resposta
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
export type tipo_pilao_api = {
|
||||||
|
/** retorna da data e hora do servido em formato iso */
|
||||||
|
estado_servidor: {
|
||||||
|
pr: {}
|
||||||
|
rs: {
|
||||||
|
data_hora: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tabelas: {
|
||||||
|
pr: {}
|
||||||
|
rs: z.infer<typeof zp_registrar_base_dados>[]
|
||||||
|
}
|
||||||
|
|
||||||
|
unicos: {
|
||||||
|
pr: {
|
||||||
|
tabela: string
|
||||||
|
coluna: string
|
||||||
|
}
|
||||||
|
rs: any[]
|
||||||
|
}
|
||||||
|
}
|
||||||
10
src/pilao-de-dados/Pilao/tipagem.ts
Normal file
10
src/pilao-de-dados/Pilao/tipagem.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
import type { z } from "zod"
|
||||||
|
import type { visoes_pilao } from "../visoes/listaDeVisoes"
|
||||||
|
|
||||||
|
export type tipoConstrutorPilao = { produto: string; conta: string }
|
||||||
|
|
||||||
|
export type tipoRetornoSerieconsulta<T extends keyof typeof visoes_pilao> = {
|
||||||
|
registros: any[]
|
||||||
|
legenda: string
|
||||||
|
serie: z.infer<(typeof visoes_pilao)[T]>
|
||||||
|
}
|
||||||
|
|
@ -1,47 +0,0 @@
|
||||||
import node_fetch from "cross-fetch"
|
|
||||||
import type { tipoResposta } from "p-respostas"
|
|
||||||
import { respostaComuns } from "p-respostas"
|
|
||||||
import { z } from "zod"
|
|
||||||
import { urlPilao, type zp_produto_conta } from "./variaveis"
|
|
||||||
//enviar registros para base de dados
|
|
||||||
export const zp_deletar_registros = z.object({
|
|
||||||
tabela: z.string(),
|
|
||||||
codigos: z.array(z.string()),
|
|
||||||
})
|
|
||||||
|
|
||||||
export const deletar_registros =
|
|
||||||
({ conta, produto, emDesenvolvimento }: z.infer<typeof zp_produto_conta>) =>
|
|
||||||
async ({
|
|
||||||
codigos: codigos_entrada,
|
|
||||||
tabela,
|
|
||||||
}: z.infer<typeof zp_deletar_registros>): Promise<tipoResposta<true>> => {
|
|
||||||
const codigos = [...codigos_entrada]
|
|
||||||
|
|
||||||
const url = new URL(
|
|
||||||
`${
|
|
||||||
urlPilao(emDesenvolvimento).api
|
|
||||||
}/${Object.keys({ deletar_registros })[0]}/${produto}/${conta}`,
|
|
||||||
)
|
|
||||||
|
|
||||||
const tamanhoBlocos = 1000
|
|
||||||
|
|
||||||
while (codigos.length > 0) {
|
|
||||||
const bloco = codigos.splice(0, tamanhoBlocos)
|
|
||||||
const resp = await node_fetch(url.toString(), {
|
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify({ tabela, codigos: bloco }),
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
})
|
|
||||||
.then((r) => r.json())
|
|
||||||
.catch((e) =>
|
|
||||||
respostaComuns.erro("Erro ao enviar registros", [e.message]),
|
|
||||||
)
|
|
||||||
.then((r) => r as tipoResposta<true>)
|
|
||||||
|
|
||||||
if (resp.eErro) {
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return respostaComuns.valor(true)
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +1,12 @@
|
||||||
import node_fetch from "cross-fetch"
|
|
||||||
import type { tipoResposta } from "p-respostas"
|
|
||||||
import { respostaComuns } from "p-respostas"
|
|
||||||
import { z } from "zod"
|
import { z } from "zod"
|
||||||
import {
|
import { z_tipos_dados_registro } from "./variaveis"
|
||||||
urlPilao,
|
|
||||||
z_tipo_coluna_base_dados,
|
|
||||||
type zp_produto_conta,
|
|
||||||
} from "./variaveis"
|
|
||||||
|
|
||||||
export const zp_registrar_base_dados = z.object({
|
export const zp_registrar_base_dados = z.object({
|
||||||
tabela: z.string(),
|
tabela: z.string(),
|
||||||
colunas: z.array(
|
colunas: z.array(
|
||||||
z.object({
|
z.object({
|
||||||
coluna: z.string(),
|
coluna: z.string(),
|
||||||
tipo: z_tipo_coluna_base_dados,
|
tipo: z_tipos_dados_registro,
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
@ -26,62 +19,8 @@ export const zp_enviar_registros = z.object({
|
||||||
z.string(),
|
z.string(),
|
||||||
z.object({
|
z.object({
|
||||||
valor: z.any(),
|
valor: z.any(),
|
||||||
tipo: z_tipo_coluna_base_dados.optional().nullable(),
|
tipo: z_tipos_dados_registro.optional().nullable(),
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
export const enviar_registros =
|
|
||||||
({
|
|
||||||
conta,
|
|
||||||
produto,
|
|
||||||
emDesenvolvimento,
|
|
||||||
ver_log,
|
|
||||||
}: z.infer<typeof zp_produto_conta>) =>
|
|
||||||
async ({
|
|
||||||
registros: registros_entrada,
|
|
||||||
tabela,
|
|
||||||
}: z.infer<typeof zp_enviar_registros>): Promise<tipoResposta<true>> => {
|
|
||||||
const registros = [...registros_entrada]
|
|
||||||
|
|
||||||
const url = new URL(
|
|
||||||
`${
|
|
||||||
urlPilao(emDesenvolvimento).api
|
|
||||||
}/${Object.keys({ enviar_registros })[0]}/${produto}/${conta}`,
|
|
||||||
)
|
|
||||||
|
|
||||||
if (ver_log)
|
|
||||||
console.log(
|
|
||||||
`[PILÃO]: Enviando "${registros.length}" registros na tabela "${tabela}" para "${url}".`,
|
|
||||||
)
|
|
||||||
|
|
||||||
const tamanhoBlocos = 1000
|
|
||||||
|
|
||||||
while (registros.length > 0) {
|
|
||||||
const bloco = registros
|
|
||||||
.splice(0, tamanhoBlocos)
|
|
||||||
.map((r) =>
|
|
||||||
Object.fromEntries(
|
|
||||||
Object.entries(r).map(([k, v]) => [k, v === undefined ? null : v]),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
const resp = await node_fetch(url.toString(), {
|
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify({ tabela, registros: bloco }),
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
})
|
|
||||||
.then((r) => r.json())
|
|
||||||
.catch((e) =>
|
|
||||||
respostaComuns.erro("Erro ao enviar registros", [e.message]),
|
|
||||||
)
|
|
||||||
.then((r) => r as tipoResposta<true>)
|
|
||||||
|
|
||||||
if (resp.eErro) {
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return respostaComuns.valor(true)
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,67 +1,8 @@
|
||||||
import node_fetch from "cross-fetch"
|
|
||||||
import type { tipoResposta } from "p-respostas"
|
|
||||||
import { respostaComuns } from "p-respostas"
|
|
||||||
import { z } from "zod"
|
import { z } from "zod"
|
||||||
import { operadores_pilao, urlPilao, type zp_produto_conta } from "./variaveis"
|
import { operadores_pilao } from "./variaveis"
|
||||||
import type { visoes } from "./visoes"
|
|
||||||
|
|
||||||
export const z_filtro = z.object({
|
export const z_filtro = z.object({
|
||||||
coluna: z.string(),
|
coluna: z.string(),
|
||||||
valor: z.any(),
|
valor: z.any(),
|
||||||
operador: operadores_pilao,
|
operador: operadores_pilao,
|
||||||
})
|
})
|
||||||
|
|
||||||
export const serie_consultar =
|
|
||||||
(cliente: z.infer<typeof zp_produto_conta>) =>
|
|
||||||
<T extends keyof typeof visoes>(
|
|
||||||
tipoVisao: T,
|
|
||||||
parametros: z.infer<(typeof visoes)[T]>,
|
|
||||||
) => {
|
|
||||||
const dados = async (): Promise<
|
|
||||||
tipoResposta<{
|
|
||||||
registros: any[]
|
|
||||||
legenda: string
|
|
||||||
serie: z.infer<(typeof visoes)[T]>
|
|
||||||
}>
|
|
||||||
> => {
|
|
||||||
const url = new URL(
|
|
||||||
`${urlPilao(cliente.emDesenvolvimento).api}/${
|
|
||||||
tipoVisao
|
|
||||||
}/${cliente.produto}/${cliente.conta}`,
|
|
||||||
)
|
|
||||||
|
|
||||||
const resp = await node_fetch(url.toString(), {
|
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify(parametros),
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
})
|
|
||||||
.then((r) => r.json())
|
|
||||||
.catch((e) =>
|
|
||||||
respostaComuns.erro("Erro ao enviar registros", [e.message]),
|
|
||||||
)
|
|
||||||
.then((r) => r as tipoResposta<any>)
|
|
||||||
|
|
||||||
if (cliente.ver_log)
|
|
||||||
console.log(
|
|
||||||
`[PILÃO]: buscar dados de "${JSON.stringify(parametros)}" para "${url.href}".`,
|
|
||||||
)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
|
|
||||||
const url = (): string => {
|
|
||||||
const vUrl = new URL(
|
|
||||||
`${urlPilao(cliente.emDesenvolvimento).site}/${tipoVisao}/${cliente.produto}/${cliente.conta}`,
|
|
||||||
)
|
|
||||||
const serie = encodeURIComponent(JSON.stringify(parametros, null, 2))
|
|
||||||
if (cliente.ver_log)
|
|
||||||
console.log(
|
|
||||||
`[PILÃO]: Serie Consultar url de "${JSON.stringify(serie)}" para "${vUrl.href}".`,
|
|
||||||
)
|
|
||||||
return `${vUrl.href}?serie=${serie}`
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
dados,
|
|
||||||
url,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
import { deletar_registros, zp_deletar_registros } from "./_deletar_registros"
|
|
||||||
export { PREFIXO_PILAO, urlPilao } from "./variaveis"
|
export { PREFIXO_PILAO, urlPilao } from "./variaveis"
|
||||||
import {
|
import {
|
||||||
enviar_registros,
|
|
||||||
zp_enviar_registros,
|
zp_enviar_registros,
|
||||||
zp_registrar_base_dados,
|
zp_registrar_base_dados,
|
||||||
} from "./_enviar_registros"
|
} from "./_enviar_registros"
|
||||||
|
|
@ -9,25 +7,32 @@ import {
|
||||||
operadores_permitidos_por_tipo,
|
operadores_permitidos_por_tipo,
|
||||||
operadores_pilao,
|
operadores_pilao,
|
||||||
validarZ,
|
validarZ,
|
||||||
|
z_tipos_dados_registro,
|
||||||
|
zp_deletar_registros,
|
||||||
zp_produto_conta,
|
zp_produto_conta,
|
||||||
} from "./variaveis"
|
} from "./variaveis"
|
||||||
|
|
||||||
import { serie_consultar, z_filtro } from "./_serie_consultar"
|
export * from "./Pilao"
|
||||||
import { extruturas_de_campos, visoes } from "./visoes"
|
export * from "./Pilao/pilao-api"
|
||||||
|
export * from "./Pilao/tipagem"
|
||||||
|
|
||||||
|
import { z_filtro } from "./_serie_consultar"
|
||||||
|
import { extruturas_de_campos } from "./visoes"
|
||||||
|
import { visoes_pilao } from "./visoes/listaDeVisoes"
|
||||||
|
|
||||||
export const pPilao = {
|
export const pPilao = {
|
||||||
|
zp_deletar_registros,
|
||||||
zp_registrar_base_dados,
|
zp_registrar_base_dados,
|
||||||
enviar_registros,
|
z_tipos_dados_registro,
|
||||||
zp_enviar_registros,
|
zp_enviar_registros,
|
||||||
serie_consultar,
|
|
||||||
zp_produto_conta,
|
zp_produto_conta,
|
||||||
validarZ,
|
validarZ,
|
||||||
deletar_registros,
|
|
||||||
zp_deletar_registros,
|
|
||||||
operadores_pilao,
|
operadores_pilao,
|
||||||
operadores_permitidos_por_tipo,
|
operadores_permitidos_por_tipo,
|
||||||
z_filtro,
|
z_filtro,
|
||||||
visoes,
|
visoes_pilao,
|
||||||
...visoes,
|
...visoes_pilao,
|
||||||
extruturas_de_campos,
|
extruturas_de_campos,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
import { respostaComuns } from "p-respostas"
|
import { respostaComuns } from "p-respostas"
|
||||||
import { z } from "zod"
|
import { z } from "zod"
|
||||||
|
|
||||||
|
export const zp_deletar_registros = z.object({
|
||||||
|
tabela: z.string(),
|
||||||
|
codigos: z.array(z.string()),
|
||||||
|
})
|
||||||
|
|
||||||
export const zAmbiente = z.enum(["desenvolvimento", "producao"])
|
export const zAmbiente = z.enum(["desenvolvimento", "producao"])
|
||||||
|
|
||||||
export const PREFIXO_PILAO = "/pilao-de-dados"
|
export const PREFIXO_PILAO = "/pilao-de-dados"
|
||||||
|
|
@ -27,7 +32,7 @@ export const zp_produto_conta = z.object({
|
||||||
ver_log: z.boolean().optional(),
|
ver_log: z.boolean().optional(),
|
||||||
})
|
})
|
||||||
|
|
||||||
export const z_tipo_coluna_base_dados = z.enum([
|
export const z_tipos_dados_registro = z.enum([
|
||||||
"texto",
|
"texto",
|
||||||
"numero",
|
"numero",
|
||||||
"confirmacao",
|
"confirmacao",
|
||||||
|
|
@ -42,7 +47,7 @@ export const z_tipo_coluna_base_dados = z.enum([
|
||||||
export const operadores_pilao = z.enum(["=", "!=", ">", "<", ">=", "<=", "∩"])
|
export const operadores_pilao = z.enum(["=", "!=", ">", "<", ">=", "<=", "∩"])
|
||||||
|
|
||||||
export const operadores_permitidos_por_tipo: {
|
export const operadores_permitidos_por_tipo: {
|
||||||
[key in z.infer<typeof z_tipo_coluna_base_dados>]: z.infer<
|
[key in z.infer<typeof z_tipos_dados_registro>]: z.infer<
|
||||||
typeof operadores_pilao
|
typeof operadores_pilao
|
||||||
>[]
|
>[]
|
||||||
} = {
|
} = {
|
||||||
|
|
|
||||||
16
src/pilao-de-dados/visoes/estrutura_de_campos/index.ts
Normal file
16
src/pilao-de-dados/visoes/estrutura_de_campos/index.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
import type { visoes_pilao } from "../listaDeVisoes"
|
||||||
|
import type { tipo_estrutura_visao_grafico } from "../tipagem"
|
||||||
|
import { z_contagem_em_barra_vertical } from "./z_contagem_em_barra_vertical"
|
||||||
|
import { z_contagem_em_pizza } from "./z_contagem_em_pizza"
|
||||||
|
import { z_soma_em_barra_vertical } from "./z_soma_em_barra_vertical"
|
||||||
|
import { z_tabela } from "./z_tabela"
|
||||||
|
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
export const extruturas_de_campos: {
|
||||||
|
[T in keyof typeof visoes_pilao]: tipo_estrutura_visao_grafico<T>
|
||||||
|
} = {
|
||||||
|
z_contagem_em_barra_vertical,
|
||||||
|
z_contagem_em_pizza,
|
||||||
|
z_soma_em_barra_vertical,
|
||||||
|
z_tabela,
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
// usar describe para definir o tipo de campo para render do componente
|
||||||
|
|
||||||
|
import type { tipo_estrutura_visao_grafico } from "../tipagem"
|
||||||
|
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
export const z_contagem_em_barra_vertical: tipo_estrutura_visao_grafico<"z_contagem_em_barra_vertical"> =
|
||||||
|
{
|
||||||
|
visao: "z_contagem_em_barra_vertical",
|
||||||
|
rotulo: "Contagem em Barra Vertical",
|
||||||
|
tabela: ({ tabela }) => tabela,
|
||||||
|
descricao: ({
|
||||||
|
tabela,
|
||||||
|
descricao_pelo_usuario,
|
||||||
|
colanuEixoX,
|
||||||
|
filtros,
|
||||||
|
colunaAgrupamento,
|
||||||
|
}) => {
|
||||||
|
if (String(descricao_pelo_usuario || "").trim())
|
||||||
|
return String(descricao_pelo_usuario || "").trim()
|
||||||
|
|
||||||
|
return `Contagem de ${tabela} por ${colanuEixoX}${
|
||||||
|
!filtros?.length
|
||||||
|
? ""
|
||||||
|
: `, quando ${filtros
|
||||||
|
.map(
|
||||||
|
({ coluna, operador, valor }) =>
|
||||||
|
`${coluna} ${operador} ${valor}`,
|
||||||
|
)
|
||||||
|
.join(", ")}`
|
||||||
|
}${
|
||||||
|
!colunaAgrupamento?.length
|
||||||
|
? ""
|
||||||
|
: `, agrupado por ${colunaAgrupamento.join(", ")}`
|
||||||
|
}.`
|
||||||
|
},
|
||||||
|
campos: {
|
||||||
|
tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 },
|
||||||
|
|
||||||
|
colanuEixoX: {
|
||||||
|
rotulo: "Coluna do Eixo X",
|
||||||
|
tipo_campo: "coluna",
|
||||||
|
order: 2,
|
||||||
|
},
|
||||||
|
colunaAgrupamento: {
|
||||||
|
rotulo: "Colunas de Agrupamento",
|
||||||
|
tipo_campo: "lista_colunas",
|
||||||
|
order: 3,
|
||||||
|
},
|
||||||
|
descricao_pelo_usuario: {
|
||||||
|
rotulo: "Descrição (opcional)",
|
||||||
|
tipo_campo: "texto",
|
||||||
|
order: 4,
|
||||||
|
},
|
||||||
|
filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 5 },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
// usar describe para definir o tipo de campo para render do componente
|
||||||
|
|
||||||
|
import type { tipo_estrutura_visao_grafico } from "../tipagem"
|
||||||
|
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
export const z_contagem_em_pizza: tipo_estrutura_visao_grafico<"z_contagem_em_pizza"> =
|
||||||
|
{
|
||||||
|
visao: "z_contagem_em_pizza",
|
||||||
|
rotulo: "Contagem em Pizza",
|
||||||
|
tabela: ({ tabela }) => tabela,
|
||||||
|
descricao: ({ tabela, descricao_pelo_usuario, classes, filtros }) => {
|
||||||
|
if (String(descricao_pelo_usuario || "").trim())
|
||||||
|
return String(descricao_pelo_usuario || "").trim()
|
||||||
|
|
||||||
|
return `Contagem de ${tabela} por ${classes}${
|
||||||
|
!filtros?.length
|
||||||
|
? ""
|
||||||
|
: `, quando ${filtros
|
||||||
|
.map(
|
||||||
|
({ coluna, operador, valor }) =>
|
||||||
|
`${coluna} ${operador} ${valor}`,
|
||||||
|
)
|
||||||
|
.join(", ")}`
|
||||||
|
}.`
|
||||||
|
},
|
||||||
|
campos: {
|
||||||
|
tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 },
|
||||||
|
classes: { rotulo: "Classes", tipo_campo: "coluna", order: 2 },
|
||||||
|
descricao_pelo_usuario: {
|
||||||
|
rotulo: "Descrição (opcional)",
|
||||||
|
tipo_campo: "texto",
|
||||||
|
order: 3,
|
||||||
|
},
|
||||||
|
filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 4 },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
// usar describe para definir o tipo de campo para render do componente
|
||||||
|
|
||||||
|
import type { tipo_estrutura_visao_grafico } from "../tipagem"
|
||||||
|
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
export const z_soma_em_barra_vertical: tipo_estrutura_visao_grafico<"z_soma_em_barra_vertical"> =
|
||||||
|
{
|
||||||
|
visao: "z_soma_em_barra_vertical",
|
||||||
|
rotulo: "Soma em Barra Vertical",
|
||||||
|
tabela: ({ tabela }) => tabela,
|
||||||
|
descricao: ({
|
||||||
|
descricao_pelo_usuario,
|
||||||
|
colanuEixoX,
|
||||||
|
filtros,
|
||||||
|
colunaAgrupamento,
|
||||||
|
colunaSoma,
|
||||||
|
}) => {
|
||||||
|
if (String(descricao_pelo_usuario || "").trim())
|
||||||
|
return String(descricao_pelo_usuario || "").trim()
|
||||||
|
|
||||||
|
return `Soma de ${colunaSoma} por ${colanuEixoX}${
|
||||||
|
!filtros?.length
|
||||||
|
? ""
|
||||||
|
: `, quando ${filtros
|
||||||
|
.map(
|
||||||
|
({ coluna, operador, valor }) =>
|
||||||
|
`${coluna} ${operador} ${valor}`,
|
||||||
|
)
|
||||||
|
.join(", ")}`
|
||||||
|
}${
|
||||||
|
!colunaAgrupamento?.length
|
||||||
|
? ""
|
||||||
|
: `, agrupado por ${colunaAgrupamento.join(", ")}`
|
||||||
|
}.`
|
||||||
|
},
|
||||||
|
campos: {
|
||||||
|
tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 },
|
||||||
|
|
||||||
|
colunaSoma: {
|
||||||
|
rotulo: "Coluna de Somatória",
|
||||||
|
tipo_campo: "coluna",
|
||||||
|
order: 2,
|
||||||
|
},
|
||||||
|
|
||||||
|
unidadeSoma: {
|
||||||
|
rotulo: "Unidade de Somatória",
|
||||||
|
tipo_campo: "texto",
|
||||||
|
order: 3,
|
||||||
|
},
|
||||||
|
|
||||||
|
colanuEixoX: {
|
||||||
|
rotulo: "Coluna do Eixo X",
|
||||||
|
tipo_campo: "coluna",
|
||||||
|
order: 4,
|
||||||
|
},
|
||||||
|
colunaAgrupamento: {
|
||||||
|
rotulo: "Colunas de Agrupamento",
|
||||||
|
tipo_campo: "lista_colunas",
|
||||||
|
order: 5,
|
||||||
|
},
|
||||||
|
descricao_pelo_usuario: {
|
||||||
|
rotulo: "Descrição (opcional)",
|
||||||
|
tipo_campo: "texto",
|
||||||
|
order: 6,
|
||||||
|
},
|
||||||
|
filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 5 },
|
||||||
|
},
|
||||||
|
}
|
||||||
45
src/pilao-de-dados/visoes/estrutura_de_campos/z_tabela.ts
Normal file
45
src/pilao-de-dados/visoes/estrutura_de_campos/z_tabela.ts
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
// usar describe para definir o tipo de campo para render do componente
|
||||||
|
|
||||||
|
import type { tipo_estrutura_visao_grafico } from "../tipagem"
|
||||||
|
|
||||||
|
/** Cria a estrutura de campos para insersão de dados */
|
||||||
|
export const z_tabela: tipo_estrutura_visao_grafico<"z_tabela"> = {
|
||||||
|
visao: "z_tabela",
|
||||||
|
rotulo: "Tabela",
|
||||||
|
tabela: ({ tabela }) => tabela,
|
||||||
|
descricao: ({ tabela, descricao_pelo_usuario, filtros }) => {
|
||||||
|
if (String(descricao_pelo_usuario || "").trim())
|
||||||
|
return String(descricao_pelo_usuario || "").trim()
|
||||||
|
|
||||||
|
return `Consulta na ${tabela} ${
|
||||||
|
!filtros?.length
|
||||||
|
? ""
|
||||||
|
: `, quando ${filtros
|
||||||
|
.map(
|
||||||
|
({ coluna, operador, valor }) => `${coluna} ${operador} ${valor}`,
|
||||||
|
)
|
||||||
|
.join(", ")}`
|
||||||
|
}.`
|
||||||
|
},
|
||||||
|
campos: {
|
||||||
|
tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 },
|
||||||
|
colunas: { rotulo: "Colunas", tipo_campo: "lista_colunas", order: 2 },
|
||||||
|
descricao_pelo_usuario: {
|
||||||
|
rotulo: "Descrição (opcional)",
|
||||||
|
tipo_campo: "texto",
|
||||||
|
order: 3,
|
||||||
|
},
|
||||||
|
coluna_ordem: {
|
||||||
|
rotulo: "Coluna de Ordem",
|
||||||
|
tipo_campo: "coluna",
|
||||||
|
order: 4,
|
||||||
|
},
|
||||||
|
direcao_ordem: {
|
||||||
|
rotulo: "Direção de Ordem",
|
||||||
|
tipo_campo: "ordem",
|
||||||
|
order: 5,
|
||||||
|
},
|
||||||
|
|
||||||
|
filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 6 },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -1,187 +1 @@
|
||||||
import { z } from "zod"
|
export * from "./estrutura_de_campos"
|
||||||
import { z_filtro } from "../_serie_consultar"
|
|
||||||
// usar describe para definir o tipo de campo para render do componente
|
|
||||||
|
|
||||||
const z_tipos_campos = z.enum([
|
|
||||||
"tabela",
|
|
||||||
"coluna",
|
|
||||||
"texto",
|
|
||||||
"lista_colunas",
|
|
||||||
"lista_filtros",
|
|
||||||
"ordem",
|
|
||||||
])
|
|
||||||
|
|
||||||
export const z_contagem_em_barra_vertical = z.object({
|
|
||||||
tabela: z.string(),
|
|
||||||
colanuEixoX: z.string(),
|
|
||||||
colunaAgrupamento: z.string().array().optional(),
|
|
||||||
filtros: z_filtro.array().optional(),
|
|
||||||
descricao_pelo_usuario: z.string().optional(),
|
|
||||||
})
|
|
||||||
|
|
||||||
export const z_contagem_em_pizza = z.object({
|
|
||||||
tabela: z.string(),
|
|
||||||
classes: z.string(),
|
|
||||||
filtros: z_filtro.array().optional(),
|
|
||||||
descricao_pelo_usuario: z.string().optional(),
|
|
||||||
})
|
|
||||||
|
|
||||||
export const z_tabela = z.object({
|
|
||||||
tabela: z.string(),
|
|
||||||
colunas: z.string().array(),
|
|
||||||
coluna_ordem: z.string().optional(),
|
|
||||||
direcao_ordem: z.enum(["asc", "desc", "1", "-1"]).optional(),
|
|
||||||
filtros: z_filtro.array().optional(),
|
|
||||||
descricao_pelo_usuario: z.string().optional(),
|
|
||||||
})
|
|
||||||
|
|
||||||
export const visoes = {
|
|
||||||
z_contagem_em_barra_vertical,
|
|
||||||
z_contagem_em_pizza,
|
|
||||||
z_tabela,
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Cria a estrutura de campos para insersão de dados */
|
|
||||||
export const extruturas_de_campos: {
|
|
||||||
[z in keyof typeof visoes]: {
|
|
||||||
/** Nome da Visão */
|
|
||||||
visao: z
|
|
||||||
/** Rotulo */
|
|
||||||
rotulo: string
|
|
||||||
/** Retorna a tabela Referente ao Registro */
|
|
||||||
tabela: (_: z.infer<(typeof visoes)[z]>) => string
|
|
||||||
/** Descrição */
|
|
||||||
descricao: (_: z.infer<(typeof visoes)[z]>) => string
|
|
||||||
/** Lista os campos e suas configurações */
|
|
||||||
campos: {
|
|
||||||
[c in keyof Required<z.infer<(typeof visoes)[z]>>]: {
|
|
||||||
rotulo: string
|
|
||||||
tipo_campo: z.infer<typeof z_tipos_campos>
|
|
||||||
order: number
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} = {
|
|
||||||
z_contagem_em_barra_vertical: {
|
|
||||||
visao: "z_contagem_em_barra_vertical",
|
|
||||||
rotulo: "Contagem em Barra Vertical",
|
|
||||||
tabela: ({ tabela }) => tabela,
|
|
||||||
descricao: ({
|
|
||||||
tabela,
|
|
||||||
descricao_pelo_usuario,
|
|
||||||
colanuEixoX,
|
|
||||||
filtros,
|
|
||||||
colunaAgrupamento,
|
|
||||||
}) => {
|
|
||||||
if (String(descricao_pelo_usuario || "").trim())
|
|
||||||
return String(descricao_pelo_usuario || "").trim()
|
|
||||||
|
|
||||||
return `Contagem de ${tabela} por ${colanuEixoX}${
|
|
||||||
!filtros?.length
|
|
||||||
? ""
|
|
||||||
: `, quando ${filtros
|
|
||||||
.map(
|
|
||||||
({ coluna, operador, valor }) =>
|
|
||||||
`${coluna} ${operador} ${valor}`,
|
|
||||||
)
|
|
||||||
.join(", ")}`
|
|
||||||
}${
|
|
||||||
!colunaAgrupamento?.length
|
|
||||||
? ""
|
|
||||||
: `, agrupado por ${colunaAgrupamento.join(", ")}`
|
|
||||||
}.`
|
|
||||||
},
|
|
||||||
campos: {
|
|
||||||
tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 },
|
|
||||||
|
|
||||||
colanuEixoX: {
|
|
||||||
rotulo: "Coluna do Eixo X",
|
|
||||||
tipo_campo: "coluna",
|
|
||||||
order: 2,
|
|
||||||
},
|
|
||||||
colunaAgrupamento: {
|
|
||||||
rotulo: "Colunas de Agrupamento",
|
|
||||||
tipo_campo: "lista_colunas",
|
|
||||||
order: 3,
|
|
||||||
},
|
|
||||||
descricao_pelo_usuario: {
|
|
||||||
rotulo: "Descrição (opcional)",
|
|
||||||
tipo_campo: "texto",
|
|
||||||
order: 4,
|
|
||||||
},
|
|
||||||
filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 5 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
z_contagem_em_pizza: {
|
|
||||||
visao: "z_contagem_em_pizza",
|
|
||||||
rotulo: "Contagem em Pizza",
|
|
||||||
tabela: ({ tabela }) => tabela,
|
|
||||||
descricao: ({ tabela, descricao_pelo_usuario, classes, filtros }) => {
|
|
||||||
if (String(descricao_pelo_usuario || "").trim())
|
|
||||||
return String(descricao_pelo_usuario || "").trim()
|
|
||||||
|
|
||||||
return `Contagem de ${tabela} por ${classes}${
|
|
||||||
!filtros?.length
|
|
||||||
? ""
|
|
||||||
: `, quando ${filtros
|
|
||||||
.map(
|
|
||||||
({ coluna, operador, valor }) =>
|
|
||||||
`${coluna} ${operador} ${valor}`,
|
|
||||||
)
|
|
||||||
.join(", ")}`
|
|
||||||
}.`
|
|
||||||
},
|
|
||||||
campos: {
|
|
||||||
tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 },
|
|
||||||
classes: { rotulo: "Classes", tipo_campo: "coluna", order: 2 },
|
|
||||||
descricao_pelo_usuario: {
|
|
||||||
rotulo: "Descrição (opcional)",
|
|
||||||
tipo_campo: "texto",
|
|
||||||
order: 3,
|
|
||||||
},
|
|
||||||
filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 4 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
z_tabela: {
|
|
||||||
visao: "z_tabela",
|
|
||||||
rotulo: "Tabela",
|
|
||||||
tabela: ({ tabela }) => tabela,
|
|
||||||
descricao: ({ tabela, descricao_pelo_usuario, filtros }) => {
|
|
||||||
if (String(descricao_pelo_usuario || "").trim())
|
|
||||||
return String(descricao_pelo_usuario || "").trim()
|
|
||||||
|
|
||||||
return `Consulta na ${tabela} ${
|
|
||||||
!filtros?.length
|
|
||||||
? ""
|
|
||||||
: `, quando ${filtros
|
|
||||||
.map(
|
|
||||||
({ coluna, operador, valor }) =>
|
|
||||||
`${coluna} ${operador} ${valor}`,
|
|
||||||
)
|
|
||||||
.join(", ")}`
|
|
||||||
}.`
|
|
||||||
},
|
|
||||||
campos: {
|
|
||||||
tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 },
|
|
||||||
colunas: { rotulo: "Colunas", tipo_campo: "lista_colunas", order: 2 },
|
|
||||||
descricao_pelo_usuario: {
|
|
||||||
rotulo: "Descrição (opcional)",
|
|
||||||
tipo_campo: "texto",
|
|
||||||
order: 3,
|
|
||||||
},
|
|
||||||
coluna_ordem: {
|
|
||||||
rotulo: "Coluna de Ordem",
|
|
||||||
tipo_campo: "coluna",
|
|
||||||
order: 4,
|
|
||||||
},
|
|
||||||
direcao_ordem: {
|
|
||||||
rotulo: "Direção de Ordem",
|
|
||||||
tipo_campo: "ordem",
|
|
||||||
order: 5,
|
|
||||||
},
|
|
||||||
|
|
||||||
filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 6 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
|
||||||
43
src/pilao-de-dados/visoes/listaDeVisoes.ts
Normal file
43
src/pilao-de-dados/visoes/listaDeVisoes.ts
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
import { z } from "zod"
|
||||||
|
import { z_filtro } from "../_serie_consultar"
|
||||||
|
|
||||||
|
export const z_contagem_em_barra_vertical = z.object({
|
||||||
|
tabela: z.string(),
|
||||||
|
colanuEixoX: z.string(),
|
||||||
|
colunaAgrupamento: z.string().array().optional(),
|
||||||
|
filtros: z_filtro.array().optional(),
|
||||||
|
descricao_pelo_usuario: z.string().optional(),
|
||||||
|
})
|
||||||
|
|
||||||
|
export const z_soma_em_barra_vertical = z.object({
|
||||||
|
tabela: z.string(),
|
||||||
|
colanuEixoX: z.string(),
|
||||||
|
colunaSoma: z.string(),
|
||||||
|
unidadeSoma: z.string().optional(),
|
||||||
|
colunaAgrupamento: z.string().array().optional(),
|
||||||
|
filtros: z_filtro.array().optional(),
|
||||||
|
descricao_pelo_usuario: z.string().optional(),
|
||||||
|
})
|
||||||
|
|
||||||
|
export const z_contagem_em_pizza = z.object({
|
||||||
|
tabela: z.string(),
|
||||||
|
classes: z.string(),
|
||||||
|
filtros: z_filtro.array().optional(),
|
||||||
|
descricao_pelo_usuario: z.string().optional(),
|
||||||
|
})
|
||||||
|
|
||||||
|
export const z_tabela = z.object({
|
||||||
|
tabela: z.string(),
|
||||||
|
colunas: z.string().array(),
|
||||||
|
coluna_ordem: z.string().optional(),
|
||||||
|
direcao_ordem: z.enum(["asc", "desc", "1", "-1"]).optional(),
|
||||||
|
filtros: z_filtro.array().optional(),
|
||||||
|
descricao_pelo_usuario: z.string().optional(),
|
||||||
|
})
|
||||||
|
|
||||||
|
export const visoes_pilao = {
|
||||||
|
z_contagem_em_barra_vertical,
|
||||||
|
z_contagem_em_pizza,
|
||||||
|
z_tabela,
|
||||||
|
z_soma_em_barra_vertical,
|
||||||
|
}
|
||||||
31
src/pilao-de-dados/visoes/tipagem.ts
Normal file
31
src/pilao-de-dados/visoes/tipagem.ts
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
import { z } from "zod"
|
||||||
|
import type { visoes_pilao } from "./listaDeVisoes"
|
||||||
|
|
||||||
|
export const z_tipos_campos_reg_grafico = z.enum([
|
||||||
|
"tabela",
|
||||||
|
"coluna",
|
||||||
|
"texto",
|
||||||
|
"lista_colunas",
|
||||||
|
"lista_filtros",
|
||||||
|
"ordem",
|
||||||
|
])
|
||||||
|
|
||||||
|
export type tipo_estrutura_visao_grafico<T extends keyof typeof visoes_pilao> =
|
||||||
|
{
|
||||||
|
/** Nome da Visão */
|
||||||
|
visao: T
|
||||||
|
/** Rotulo */
|
||||||
|
rotulo: string
|
||||||
|
/** Retorna a tabela Referente ao Registro */
|
||||||
|
tabela: (_: z.infer<(typeof visoes_pilao)[T]>) => string
|
||||||
|
/** Descrição */
|
||||||
|
descricao: (_: z.infer<(typeof visoes_pilao)[T]>) => string
|
||||||
|
/** Lista os campos e suas configurações */
|
||||||
|
campos: {
|
||||||
|
[c in keyof Required<z.infer<(typeof visoes_pilao)[T]>>]: {
|
||||||
|
rotulo: string
|
||||||
|
tipo_campo: z.infer<typeof z_tipos_campos_reg_grafico>
|
||||||
|
order: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue