This commit is contained in:
Luiz H. R. Silva 2024-07-01 12:55:34 -03:00
parent f2562a37d1
commit 7032eb1329
39 changed files with 442 additions and 790 deletions

View file

@ -1,16 +1,7 @@
// npm run build produz um arquivo abrirNps.js que é copiado para a pasta public // npm run build produz um arquivo abrirNps.js que é copiado para a pasta public
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { respostaComuns } from "p-respostas"; import { respostaComuns } from "p-respostas";
// exibe o iframe em tela cheia // exibe o iframe em tela cheia
export const abrirNps = (emDesenvolvimento) => (parametros) => __awaiter(void 0, void 0, void 0, function* () { export const abrirNps = (emDesenvolvimento) => async (parametros) => {
const base_site = emDesenvolvimento const base_site = emDesenvolvimento
? "http://localhost:5040/nps" ? "http://localhost:5040/nps"
: "https://carro-de-boi.idz.one/nps"; : "https://carro-de-boi.idz.one/nps";
@ -23,7 +14,7 @@ export const abrirNps = (emDesenvolvimento) => (parametros) => __awaiter(void 0,
for (const [chave, valor] of Object.entries(parametros)) { for (const [chave, valor] of Object.entries(parametros)) {
url_proxima_avaliacao.searchParams.append(chave, valor); url_proxima_avaliacao.searchParams.append(chave, valor);
} }
const response = yield fetch(url_proxima_avaliacao.href) const response = await fetch(url_proxima_avaliacao.href)
.then((resposta) => resposta.json()) .then((resposta) => resposta.json())
.catch((error) => respostaComuns.erro(error.message)); .catch((error) => respostaComuns.erro(error.message));
const proxima_avaliacao = response.valor; const proxima_avaliacao = response.valor;
@ -56,4 +47,4 @@ export const abrirNps = (emDesenvolvimento) => (parametros) => __awaiter(void 0,
document.body.removeChild(iframe); document.body.removeChild(iframe);
} }
}); });
}); };

View file

@ -1,19 +1,10 @@
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { respostaComuns } from "p-respostas"; import { respostaComuns } from "p-respostas";
import { urlAutenticacao } from "./_urlAutenticacao"; import { urlAutenticacao } from "./_urlAutenticacao";
import node_fetch from "cross-fetch"; import node_fetch from "cross-fetch";
export const codigoContaSite = (_a) => __awaiter(void 0, [_a], void 0, function* ({ ambiente, post, }) { export const codigoContaSite = async ({ ambiente, post, }) => {
const url = `${urlAutenticacao(ambiente)}/api/codigo_prefeitura_site`; const url = `${urlAutenticacao(ambiente)}/api/codigo_prefeitura_site`;
try { try {
const resp = yield node_fetch(url, { const resp = await node_fetch(url, {
method: "POST", method: "POST",
body: JSON.stringify(post), body: JSON.stringify(post),
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
@ -26,4 +17,4 @@ export const codigoContaSite = (_a) => __awaiter(void 0, [_a], void 0, function*
catch (e) { catch (e) {
return respostaComuns.erro(`erro ao buscar código do site: ${e}`); return respostaComuns.erro(`erro ao buscar código do site: ${e}`);
} }
}); };

View file

@ -1,16 +1,7 @@
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import node_fetch from "cross-fetch"; import node_fetch from "cross-fetch";
import { respostaComuns } from "p-respostas"; import { respostaComuns } from "p-respostas";
import { urlAutenticacao } from "./_urlAutenticacao"; import { urlAutenticacao } from "./_urlAutenticacao";
export const usuarios_quipo_governo = (_a) => __awaiter(void 0, [_a], void 0, function* ({ token_produto, ambiente, }) { export const usuarios_quipo_governo = async ({ token_produto, ambiente, }) => {
const url = `${urlAutenticacao(ambiente)}/api/usuarios_quipo_governo`; const url = `${urlAutenticacao(ambiente)}/api/usuarios_quipo_governo`;
if (!token_produto) if (!token_produto)
return respostaComuns.erro("token_produto não informado"); return respostaComuns.erro("token_produto não informado");
@ -23,4 +14,4 @@ export const usuarios_quipo_governo = (_a) => __awaiter(void 0, [_a], void 0, fu
.then((r) => r.json()) .then((r) => r.json())
.catch((e) => respostaComuns.erro(`Erro ao buscar usuários quipo governo ${e.message}`)) .catch((e) => respostaComuns.erro(`Erro ao buscar usuários quipo governo ${e.message}`))
.then((r) => r); .then((r) => r);
}); };

View file

@ -1,16 +1,7 @@
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import node_fetch from "cross-fetch"; import node_fetch from "cross-fetch";
import { respostaComuns } from "p-respostas"; import { respostaComuns } from "p-respostas";
import { urlAutenticacao } from "./_urlAutenticacao"; import { urlAutenticacao } from "./_urlAutenticacao";
export const usuarios_quipo_vincular = (_a) => __awaiter(void 0, [_a], void 0, function* ({ token_produto, ambiente, conta, vinculo, codigo_usuario, email, }) { export const usuarios_quipo_vincular = async ({ token_produto, ambiente, conta, vinculo, codigo_usuario, email, }) => {
const url = `${urlAutenticacao(ambiente)}/api/vinculos__criar`; const url = `${urlAutenticacao(ambiente)}/api/vinculos__criar`;
if (!token_produto) if (!token_produto)
return respostaComuns.erro("token_produto não informado"); return respostaComuns.erro("token_produto não informado");
@ -22,11 +13,11 @@ export const usuarios_quipo_vincular = (_a) => __awaiter(void 0, [_a], void 0, f
vinculos: { codigo_conta: conta, codigo_usuario, vinculo }, vinculos: { codigo_conta: conta, codigo_usuario, vinculo },
email: email, email: email,
}; };
return yield node_fetch(url, { return await node_fetch(url, {
headers, headers,
body: JSON.stringify(parametros), body: JSON.stringify(parametros),
method: "POST", method: "POST",
}) })
.then((r) => __awaiter(void 0, void 0, void 0, function* () { return yield r.json(); })) .then(async (r) => await r.json())
.catch((e) => respostaComuns.erro(`Erro ao criar vinculo de usuario ${e.message}`)); .catch((e) => respostaComuns.erro(`Erro ao criar vinculo de usuario ${e.message}`));
}); };

View file

@ -1,19 +1,10 @@
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { urlAutenticacao } from "./_urlAutenticacao"; import { urlAutenticacao } from "./_urlAutenticacao";
import node_fetch from "cross-fetch"; import node_fetch from "cross-fetch";
/** faz a validação do token */ /** faz a validação do token */
export const validarToken = (_a) => __awaiter(void 0, [_a], void 0, function* ({ ambiente, post, }) { export const validarToken = async ({ ambiente, post, }) => {
const url = `${urlAutenticacao(ambiente)}/api/validar_token`; const url = `${urlAutenticacao(ambiente)}/api/validar_token`;
try { try {
const resposta = yield node_fetch(url, { const resposta = await node_fetch(url, {
method: "POST", method: "POST",
body: JSON.stringify(post), body: JSON.stringify(post),
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
@ -27,4 +18,4 @@ export const validarToken = (_a) => __awaiter(void 0, [_a], void 0, function* ({
catch (e) { catch (e) {
return "erro"; return "erro";
} }
}); };

View file

@ -1,12 +1,3 @@
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import node_fetch from "cross-fetch"; import node_fetch from "cross-fetch";
import { respostaComuns } from "p-respostas"; import { respostaComuns } from "p-respostas";
import { z } from "zod"; import { z } from "zod";
@ -16,12 +7,12 @@ export const zp_deletar_registros = z.object({
tabela: z.string(), tabela: z.string(),
codigos: z.array(z.string()), codigos: z.array(z.string()),
}); });
export const deletar_registros = ({ conta, produto, emDesenvolvimento }) => (_a) => __awaiter(void 0, [_a], void 0, function* ({ codigos, tabela, }) { export const deletar_registros = ({ conta, produto, emDesenvolvimento }) => async ({ codigos, tabela, }) => {
const url = new URL(`${urlPilao(emDesenvolvimento).api}/${Object.keys({ deletar_registros })[0]}/${produto}/${conta}`); const url = new URL(`${urlPilao(emDesenvolvimento).api}/${Object.keys({ deletar_registros })[0]}/${produto}/${conta}`);
const tamanhoBlocos = 1000; const tamanhoBlocos = 1000;
while (codigos.length > 0) { while (codigos.length > 0) {
const bloco = codigos.splice(0, tamanhoBlocos); const bloco = codigos.splice(0, tamanhoBlocos);
const resp = yield node_fetch(url.toString(), { const resp = await node_fetch(url.toString(), {
method: "POST", method: "POST",
body: JSON.stringify({ tabela, codigos: bloco }), body: JSON.stringify({ tabela, codigos: bloco }),
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
@ -34,4 +25,4 @@ export const deletar_registros = ({ conta, produto, emDesenvolvimento }) => (_a)
} }
} }
return respostaComuns.valor(true); return respostaComuns.valor(true);
}); };

View file

@ -1,12 +1,3 @@
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import node_fetch from "cross-fetch"; import node_fetch from "cross-fetch";
import { respostaComuns } from "p-respostas"; import { respostaComuns } from "p-respostas";
import { z } from "zod"; import { z } from "zod";
@ -26,14 +17,14 @@ export const zp_enviar_registros = z.object({
tipo: z_tipo_coluna_base_dados.optional().nullable(), tipo: z_tipo_coluna_base_dados.optional().nullable(),
}))), }))),
}); });
export const enviar_registros = ({ conta, produto, emDesenvolvimento }) => (_a) => __awaiter(void 0, [_a], void 0, function* ({ registros, tabela, }) { export const enviar_registros = ({ conta, produto, emDesenvolvimento }) => async ({ registros, tabela, }) => {
const url = new URL(`${urlPilao(emDesenvolvimento).api}/${Object.keys({ enviar_registros })[0]}/${produto}/${conta}`); const url = new URL(`${urlPilao(emDesenvolvimento).api}/${Object.keys({ enviar_registros })[0]}/${produto}/${conta}`);
const tamanhoBlocos = 1000; const tamanhoBlocos = 1000;
while (registros.length > 0) { while (registros.length > 0) {
const bloco = registros const bloco = registros
.splice(0, tamanhoBlocos) .splice(0, tamanhoBlocos)
.map((r) => Object.fromEntries(Object.entries(r).map(([k, v]) => [k, v === undefined ? null : v]))); .map((r) => Object.fromEntries(Object.entries(r).map(([k, v]) => [k, v === undefined ? null : v])));
const resp = yield node_fetch(url.toString(), { const resp = await node_fetch(url.toString(), {
method: "POST", method: "POST",
body: JSON.stringify({ tabela, registros: bloco }), body: JSON.stringify({ tabela, registros: bloco }),
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
@ -46,4 +37,4 @@ export const enviar_registros = ({ conta, produto, emDesenvolvimento }) => (_a)
} }
} }
return respostaComuns.valor(true); return respostaComuns.valor(true);
}); };

View file

@ -6,16 +6,39 @@ export declare const zp_serie_registrar: z.ZodObject<{
colanuEixoX: z.ZodString; colanuEixoX: z.ZodString;
colunaAgrupamento: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; colunaAgrupamento: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
agregacao: z.ZodEnum<["contagem", "somatoria"]>; agregacao: z.ZodEnum<["contagem", "somatoria"]>;
filtro: z.ZodOptional<z.ZodArray<z.ZodObject<{
coluna: z.ZodString;
valor: z.ZodString;
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
}, "strip", z.ZodTypeAny, {
valor: string;
coluna: string;
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
}, {
valor: string;
coluna: string;
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
}>, "many">>;
}, "strip", z.ZodTypeAny, { }, "strip", z.ZodTypeAny, {
tabela: string; tabela: string;
colanuEixoX: string; colanuEixoX: string;
agregacao: "contagem" | "somatoria"; agregacao: "contagem" | "somatoria";
colunaAgrupamento?: string[] | undefined; colunaAgrupamento?: string[] | undefined;
filtro?: {
valor: string;
coluna: string;
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
}[] | undefined;
}, { }, {
tabela: string; tabela: string;
colanuEixoX: string; colanuEixoX: string;
agregacao: "contagem" | "somatoria"; agregacao: "contagem" | "somatoria";
colunaAgrupamento?: string[] | undefined; colunaAgrupamento?: string[] | undefined;
filtro?: {
valor: string;
coluna: string;
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
}[] | undefined;
}>; }>;
export declare const serie_consultar: (cliente: z.infer<typeof zp_produto_conta>) => (parametros: z.infer<typeof zp_serie_registrar>) => { export declare const serie_consultar: (cliente: z.infer<typeof zp_produto_conta>) => (parametros: z.infer<typeof zp_serie_registrar>) => {
dados: () => Promise<tipoResposta<{ dados: () => Promise<tipoResposta<{

View file

@ -1,26 +1,23 @@
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import node_fetch from "cross-fetch"; import node_fetch from "cross-fetch";
import { respostaComuns } from "p-respostas"; import { respostaComuns } from "p-respostas";
import { z } from "zod"; import { z } from "zod";
import { tiposSeriesAgregacoes, urlPilao, } from "./variaveis"; import { operadores_pilao, tiposSeriesAgregacoes, urlPilao, } from "./variaveis";
const filtro = z.object({
coluna: z.string(),
valor: z.string(),
operador: operadores_pilao,
});
export const zp_serie_registrar = z.object({ export const zp_serie_registrar = z.object({
tabela: z.string(), tabela: z.string(),
colanuEixoX: z.string(), colanuEixoX: z.string(),
colunaAgrupamento: z.string().array().optional(), colunaAgrupamento: z.string().array().optional(),
agregacao: tiposSeriesAgregacoes, agregacao: tiposSeriesAgregacoes,
filtro: filtro.array().optional(),
}); });
export const serie_consultar = (cliente) => (parametros) => { export const serie_consultar = (cliente) => (parametros) => {
const dados = () => __awaiter(void 0, void 0, void 0, function* () { const dados = async () => {
const url = new URL(`${urlPilao(cliente.emDesenvolvimento).api}/${tiposSeriesAgregacoes.enum.contagem}/${cliente.produto}/${cliente.conta}`); const url = new URL(`${urlPilao(cliente.emDesenvolvimento).api}/${tiposSeriesAgregacoes.enum.contagem}/${cliente.produto}/${cliente.conta}`);
const resp = yield node_fetch(url.toString(), { const resp = await node_fetch(url.toString(), {
method: "POST", method: "POST",
body: JSON.stringify(parametros), body: JSON.stringify(parametros),
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
@ -29,7 +26,7 @@ export const serie_consultar = (cliente) => (parametros) => {
.catch((e) => respostaComuns.erro("Erro ao enviar registros", [e.message])) .catch((e) => respostaComuns.erro("Erro ao enviar registros", [e.message]))
.then((r) => r); .then((r) => r);
return resp; return resp;
}); };
const url = () => { const url = () => {
const vUrl = new URL(`${urlPilao(cliente.emDesenvolvimento).site}/${tiposSeriesAgregacoes.enum.contagem}/${cliente.produto}/${cliente.conta}`); const vUrl = new URL(`${urlPilao(cliente.emDesenvolvimento).site}/${tiposSeriesAgregacoes.enum.contagem}/${cliente.produto}/${cliente.conta}`);
const serie = encodeURIComponent(JSON.stringify(parametros, null, 2)); const serie = encodeURIComponent(JSON.stringify(parametros, null, 2));

View file

@ -61,16 +61,39 @@ export declare const pPilao: {
colanuEixoX: import("zod").ZodString; colanuEixoX: import("zod").ZodString;
colunaAgrupamento: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>; colunaAgrupamento: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
agregacao: import("zod").ZodEnum<["contagem", "somatoria"]>; agregacao: import("zod").ZodEnum<["contagem", "somatoria"]>;
filtro: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
coluna: import("zod").ZodString;
valor: import("zod").ZodString;
operador: import("zod").ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
}, "strip", import("zod").ZodTypeAny, {
valor: string;
coluna: string;
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
}, {
valor: string;
coluna: string;
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
}>, "many">>;
}, "strip", import("zod").ZodTypeAny, { }, "strip", import("zod").ZodTypeAny, {
tabela: string; tabela: string;
colanuEixoX: string; colanuEixoX: string;
agregacao: "contagem" | "somatoria"; agregacao: "contagem" | "somatoria";
colunaAgrupamento?: string[] | undefined; colunaAgrupamento?: string[] | undefined;
filtro?: {
valor: string;
coluna: string;
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
}[] | undefined;
}, { }, {
tabela: string; tabela: string;
colanuEixoX: string; colanuEixoX: string;
agregacao: "contagem" | "somatoria"; agregacao: "contagem" | "somatoria";
colunaAgrupamento?: string[] | undefined; colunaAgrupamento?: string[] | undefined;
filtro?: {
valor: string;
coluna: string;
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
}[] | undefined;
}>; }>;
serie_consultar: (cliente: import("zod").TypeOf<typeof zp_produto_conta>) => (parametros: import("zod").TypeOf<typeof zp_serie_registrar>) => { serie_consultar: (cliente: import("zod").TypeOf<typeof zp_produto_conta>) => (parametros: import("zod").TypeOf<typeof zp_serie_registrar>) => {
dados: () => Promise<import("p-respostas").tipoResposta<{ dados: () => Promise<import("p-respostas").tipoResposta<{
@ -105,4 +128,14 @@ export declare const pPilao: {
tabela: string; tabela: string;
codigos: string[]; codigos: string[];
}>; }>;
operadores_pilao: import("zod").ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
operadores_permitidos_por_tipo: {
texto: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
numero: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
confirmacao: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
lista_texto: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
lista_numero: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
data: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
mes: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
};
}; };

View file

@ -1,7 +1,7 @@
import { deletar_registros, zp_deletar_registros } from "./_deletar_registros"; 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 { enviar_registros, zp_enviar_registros, zp_registrar_base_dados, } from "./_enviar_registros";
import { tiposSeriesAgregacoes, validarZ, zp_produto_conta } from "./variaveis"; import { operadores_permitidos_por_tipo, operadores_pilao, tiposSeriesAgregacoes, validarZ, zp_produto_conta, } from "./variaveis";
import { serie_consultar, zp_serie_registrar } from "./_serie_consultar"; import { serie_consultar, zp_serie_registrar } from "./_serie_consultar";
export { tiposSeriesAgregacoes }; export { tiposSeriesAgregacoes };
export const pPilao = { export const pPilao = {
@ -14,4 +14,6 @@ export const pPilao = {
validarZ, validarZ,
deletar_registros, deletar_registros,
zp_deletar_registros, zp_deletar_registros,
operadores_pilao,
operadores_permitidos_por_tipo,
}; };

View file

@ -16,6 +16,10 @@ export declare const zp_produto_conta: z.ZodObject<{
emDesenvolvimento?: boolean | undefined; emDesenvolvimento?: boolean | undefined;
}>; }>;
export declare const z_tipo_coluna_base_dados: z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "data", "mes"]>; export declare const z_tipo_coluna_base_dados: z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "data", "mes"]>;
export declare const operadores_pilao: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
export declare const operadores_permitidos_por_tipo: {
[key in z.infer<typeof z_tipo_coluna_base_dados>]: z.infer<typeof operadores_pilao>[];
};
export declare const tiposSeriesAgregacoes: z.ZodEnum<["contagem", "somatoria"]>; export declare const tiposSeriesAgregacoes: z.ZodEnum<["contagem", "somatoria"]>;
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>;

View file

@ -23,6 +23,16 @@ export const z_tipo_coluna_base_dados = z.enum([
"data", "data",
"mes", "mes",
]); ]);
export const operadores_pilao = z.enum(["=", "!=", ">", "<", ">=", "<=", "∩"]);
export const operadores_permitidos_por_tipo = {
confirmacao: ["=", "!="],
data: ["=", "!=", ">", "<", ">=", "<="],
lista_numero: ["∩"],
lista_texto: ["∩"],
mes: ["=", "!=", ">", "<", ">=", "<="],
numero: ["=", "!=", ">", "<", ">=", "<="],
texto: ["=", "!="],
};
export const tiposSeriesAgregacoes = z.enum(["contagem", "somatoria"]); export const tiposSeriesAgregacoes = z.enum(["contagem", "somatoria"]);
export const z_validar_colunna_base_dados = { export const z_validar_colunna_base_dados = {
texto: z.string().nullable(), texto: z.string().nullable(),

View file

@ -1,152 +1,54 @@
"use strict"; "use strict";
// npm run build produz um arquivo abrirNps.js que é copiado para a pasta public // npm run build produz um arquivo abrirNps.js que é copiado para a pasta public
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.abrirNps = void 0; exports.abrirNps = void 0;
var p_respostas_1 = require("p-respostas"); const p_respostas_1 = require("p-respostas");
// exibe o iframe em tela cheia // exibe o iframe em tela cheia
var abrirNps = function (emDesenvolvimento) { const abrirNps = (emDesenvolvimento) => async (parametros) => {
return function (parametros) { return __awaiter(void 0, void 0, void 0, function () { const base_site = emDesenvolvimento
var base_site, base_api, sistema, codigo_organizacao, codigo_usuario, nome_local_storage_proxima, proxima_avaliacao, url_proxima_avaliacao, _a, _b, _c, chave, valor, response, proxima_avaliacao_1, abrir_modal, urlIfrma, _d, _e, _f, chave, valor, iframe; ? "http://localhost:5040/nps"
var e_1, _g, e_2, _h; : "https://carro-de-boi.idz.one/nps";
return __generator(this, function (_j) { const base_api = `${base_site}/api`;
switch (_j.label) { const { sistema, codigo_organizacao, codigo_usuario } = parametros;
case 0: const nome_local_storage_proxima = `nps_proxima_avaliacao_${sistema}_${codigo_usuario}_${codigo_organizacao}_0`;
base_site = emDesenvolvimento const proxima_avaliacao = localStorage.getItem(nome_local_storage_proxima);
? "http://localhost:5040/nps" if (!proxima_avaliacao) {
: "https://carro-de-boi.idz.one/nps"; const url_proxima_avaliacao = new URL(`${base_api}/${sistema}/proxima_avaliacao`);
base_api = "".concat(base_site, "/api"); for (const [chave, valor] of Object.entries(parametros)) {
sistema = parametros.sistema, codigo_organizacao = parametros.codigo_organizacao, codigo_usuario = parametros.codigo_usuario; url_proxima_avaliacao.searchParams.append(chave, valor);
nome_local_storage_proxima = "nps_proxima_avaliacao_".concat(sistema, "_").concat(codigo_usuario, "_").concat(codigo_organizacao, "_0"); }
proxima_avaliacao = localStorage.getItem(nome_local_storage_proxima); const response = await fetch(url_proxima_avaliacao.href)
if (!!proxima_avaliacao) return [3 /*break*/, 2]; .then((resposta) => resposta.json())
url_proxima_avaliacao = new URL("".concat(base_api, "/").concat(sistema, "/proxima_avaliacao")); .catch((error) => p_respostas_1.respostaComuns.erro(error.message));
try { const proxima_avaliacao = response.valor;
for (_a = __values(Object.entries(parametros)), _b = _a.next(); !_b.done; _b = _a.next()) { proxima_avaliacao &&
_c = __read(_b.value, 2), chave = _c[0], valor = _c[1]; localStorage.setItem(nome_local_storage_proxima, proxima_avaliacao);
url_proxima_avaliacao.searchParams.append(chave, valor); }
} const abrir_modal = proxima_avaliacao &&
} new Date().toISOString().slice(0, 10) >= proxima_avaliacao;
catch (e_1_1) { e_1 = { error: e_1_1 }; } if (!abrir_modal) {
finally { return;
try { }
if (_b && !_b.done && (_g = _a.return)) _g.call(_a); localStorage.removeItem(nome_local_storage_proxima);
} const urlIfrma = new URL(base_site);
finally { if (e_1) throw e_1.error; } for (const [chave, valor] of Object.entries(parametros)) {
} urlIfrma.searchParams.append(chave, valor);
return [4 /*yield*/, fetch(url_proxima_avaliacao.href) }
.then(function (resposta) { const iframe = document.createElement("iframe");
return resposta.json(); iframe.src = urlIfrma.href;
}) iframe.style.position = "fixed";
.catch(function (error) { return p_respostas_1.respostaComuns.erro(error.message); })]; iframe.style.top = "0";
case 1: iframe.style.left = "0";
response = _j.sent(); iframe.style.width = "100%";
proxima_avaliacao_1 = response.valor; iframe.style.height = "100%";
proxima_avaliacao_1 && iframe.style.border = "none";
localStorage.setItem(nome_local_storage_proxima, proxima_avaliacao_1); iframe.style.zIndex = "999999";
_j.label = 2; document.body.appendChild(iframe);
case 2: // receber mensagem do iframe
abrir_modal = proxima_avaliacao && window.addEventListener("message", (event) => {
new Date().toISOString().slice(0, 10) >= proxima_avaliacao; if (event.data === "fechar") {
if (!abrir_modal) { document.body.removeChild(iframe);
return [2 /*return*/]; }
} });
localStorage.removeItem(nome_local_storage_proxima);
urlIfrma = new URL(base_site);
try {
for (_d = __values(Object.entries(parametros)), _e = _d.next(); !_e.done; _e = _d.next()) {
_f = __read(_e.value, 2), chave = _f[0], valor = _f[1];
urlIfrma.searchParams.append(chave, valor);
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_e && !_e.done && (_h = _d.return)) _h.call(_d);
}
finally { if (e_2) throw e_2.error; }
}
iframe = document.createElement("iframe");
iframe.src = urlIfrma.href;
iframe.style.position = "fixed";
iframe.style.top = "0";
iframe.style.left = "0";
iframe.style.width = "100%";
iframe.style.height = "100%";
iframe.style.border = "none";
iframe.style.zIndex = "999999";
document.body.appendChild(iframe);
// receber mensagem do iframe
window.addEventListener("message", function (event) {
if (event.data === "fechar") {
document.body.removeChild(iframe);
}
});
return [2 /*return*/];
}
});
}); };
}; };
exports.abrirNps = abrirNps; exports.abrirNps = abrirNps;

View file

@ -1,76 +1,27 @@
"use strict"; "use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __importDefault = (this && this.__importDefault) || function (mod) { var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.codigoContaSite = void 0; exports.codigoContaSite = void 0;
var p_respostas_1 = require("p-respostas"); const p_respostas_1 = require("p-respostas");
var _urlAutenticacao_1 = require("./_urlAutenticacao"); const _urlAutenticacao_1 = require("./_urlAutenticacao");
var cross_fetch_1 = __importDefault(require("cross-fetch")); const cross_fetch_1 = __importDefault(require("cross-fetch"));
var codigoContaSite = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) { const codigoContaSite = async ({ ambiente, post, }) => {
var url, resp, e_1; const url = `${(0, _urlAutenticacao_1.urlAutenticacao)(ambiente)}/api/codigo_prefeitura_site`;
var ambiente = _b.ambiente, post = _b.post; try {
return __generator(this, function (_c) { const resp = await (0, cross_fetch_1.default)(url, {
switch (_c.label) { method: "POST",
case 0: body: JSON.stringify(post),
url = "".concat((0, _urlAutenticacao_1.urlAutenticacao)(ambiente), "/api/codigo_prefeitura_site"); headers: { "Content-Type": "application/json" },
_c.label = 1; })
case 1: .then((r) => r.json())
_c.trys.push([1, 3, , 4]); .catch((e) => p_respostas_1.respostaComuns.erro("Erro ao enviar registros", [e.message]))
return [4 /*yield*/, (0, cross_fetch_1.default)(url, { .then((r) => r);
method: "POST", return resp;
body: JSON.stringify(post), }
headers: { "Content-Type": "application/json" }, catch (e) {
}) return p_respostas_1.respostaComuns.erro(`erro ao buscar código do site: ${e}`);
.then(function (r) { return r.json(); }) }
.catch(function (e) { };
return p_respostas_1.respostaComuns.erro("Erro ao enviar registros", [e.message]);
})
.then(function (r) { return r; })];
case 2:
resp = _c.sent();
return [2 /*return*/, resp];
case 3:
e_1 = _c.sent();
return [2 /*return*/, p_respostas_1.respostaComuns.erro("erro ao buscar c\u00F3digo do site: ".concat(e_1))];
case 4: return [2 /*return*/];
}
});
}); };
exports.codigoContaSite = codigoContaSite; exports.codigoContaSite = codigoContaSite;

View file

@ -1,9 +1,7 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.urlAutenticacao = void 0; exports.urlAutenticacao = void 0;
var urlAutenticacao = function (ambiente) { const urlAutenticacao = (ambiente) => `${ambiente == "producao"
return "".concat(ambiente == "producao" ? "https://carro-de-boi.idz.one"
? "https://carro-de-boi.idz.one" : "http://localhost:5030"}/autenticacao`;
: "http://localhost:5030", "/autenticacao");
};
exports.urlAutenticacao = urlAutenticacao; exports.urlAutenticacao = urlAutenticacao;

View file

@ -1,66 +1,24 @@
"use strict"; "use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __importDefault = (this && this.__importDefault) || function (mod) { var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.usuarios_quipo_governo = void 0; exports.usuarios_quipo_governo = void 0;
var cross_fetch_1 = __importDefault(require("cross-fetch")); const cross_fetch_1 = __importDefault(require("cross-fetch"));
var p_respostas_1 = require("p-respostas"); const p_respostas_1 = require("p-respostas");
var _urlAutenticacao_1 = require("./_urlAutenticacao"); const _urlAutenticacao_1 = require("./_urlAutenticacao");
var usuarios_quipo_governo = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) { const usuarios_quipo_governo = async ({ token_produto, ambiente, }) => {
var url, headers; const url = `${(0, _urlAutenticacao_1.urlAutenticacao)(ambiente)}/api/usuarios_quipo_governo`;
var token_produto = _b.token_produto, ambiente = _b.ambiente; if (!token_produto)
return __generator(this, function (_c) { return p_respostas_1.respostaComuns.erro("token_produto não informado");
url = "".concat((0, _urlAutenticacao_1.urlAutenticacao)(ambiente), "/api/usuarios_quipo_governo"); const headers = {
if (!token_produto) token: token_produto,
return [2 /*return*/, p_respostas_1.respostaComuns.erro("token_produto não informado")]; };
headers = { return (0, cross_fetch_1.default)(url, {
token: token_produto, headers,
}; })
return [2 /*return*/, (0, cross_fetch_1.default)(url, { .then((r) => r.json())
headers: headers, .catch((e) => p_respostas_1.respostaComuns.erro(`Erro ao buscar usuários quipo governo ${e.message}`))
}) .then((r) => r);
.then(function (r) { return r.json(); }) };
.catch(function (e) {
return p_respostas_1.respostaComuns.erro("Erro ao buscar usu\u00E1rios quipo governo ".concat(e.message));
})
.then(function (r) { return r; })];
});
}); };
exports.usuarios_quipo_governo = usuarios_quipo_governo; exports.usuarios_quipo_governo = usuarios_quipo_governo;

View file

@ -1,81 +1,30 @@
"use strict"; "use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __importDefault = (this && this.__importDefault) || function (mod) { var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.usuarios_quipo_vincular = void 0; exports.usuarios_quipo_vincular = void 0;
var cross_fetch_1 = __importDefault(require("cross-fetch")); const cross_fetch_1 = __importDefault(require("cross-fetch"));
var p_respostas_1 = require("p-respostas"); const p_respostas_1 = require("p-respostas");
var _urlAutenticacao_1 = require("./_urlAutenticacao"); const _urlAutenticacao_1 = require("./_urlAutenticacao");
var usuarios_quipo_vincular = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) { const usuarios_quipo_vincular = async ({ token_produto, ambiente, conta, vinculo, codigo_usuario, email, }) => {
var url, headers, parametros; const url = `${(0, _urlAutenticacao_1.urlAutenticacao)(ambiente)}/api/vinculos__criar`;
var token_produto = _b.token_produto, ambiente = _b.ambiente, conta = _b.conta, vinculo = _b.vinculo, codigo_usuario = _b.codigo_usuario, email = _b.email; if (!token_produto)
return __generator(this, function (_c) { return p_respostas_1.respostaComuns.erro("token_produto não informado");
switch (_c.label) { const headers = {
case 0: token: token_produto,
url = "".concat((0, _urlAutenticacao_1.urlAutenticacao)(ambiente), "/api/vinculos__criar"); "Content-Type": "application/json",
if (!token_produto) };
return [2 /*return*/, p_respostas_1.respostaComuns.erro("token_produto não informado")]; const parametros = {
headers = { vinculos: { codigo_conta: conta, codigo_usuario, vinculo },
token: token_produto, email: email,
"Content-Type": "application/json", };
}; return await (0, cross_fetch_1.default)(url, {
parametros = { headers,
vinculos: { codigo_conta: conta, codigo_usuario: codigo_usuario, vinculo: vinculo }, body: JSON.stringify(parametros),
email: email, method: "POST",
}; })
return [4 /*yield*/, (0, cross_fetch_1.default)(url, { .then(async (r) => await r.json())
headers: headers, .catch((e) => p_respostas_1.respostaComuns.erro(`Erro ao criar vinculo de usuario ${e.message}`));
body: JSON.stringify(parametros), };
method: "POST",
})
.then(function (r) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, r.json()];
case 1: return [2 /*return*/, _a.sent()];
}
}); }); })
.catch(function (e) {
return p_respostas_1.respostaComuns.erro("Erro ao criar vinculo de usuario ".concat(e.message));
})];
case 1: return [2 /*return*/, _c.sent()];
}
});
}); };
exports.usuarios_quipo_vincular = usuarios_quipo_vincular; exports.usuarios_quipo_vincular = usuarios_quipo_vincular;

View file

@ -1,77 +1,28 @@
"use strict"; "use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __importDefault = (this && this.__importDefault) || function (mod) { var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.validarToken = void 0; exports.validarToken = void 0;
var _urlAutenticacao_1 = require("./_urlAutenticacao"); const _urlAutenticacao_1 = require("./_urlAutenticacao");
var cross_fetch_1 = __importDefault(require("cross-fetch")); const cross_fetch_1 = __importDefault(require("cross-fetch"));
/** faz a validação do token */ /** faz a validação do token */
var validarToken = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) { const validarToken = async ({ ambiente, post, }) => {
var url, resposta, e_1; const url = `${(0, _urlAutenticacao_1.urlAutenticacao)(ambiente)}/api/validar_token`;
var ambiente = _b.ambiente, post = _b.post; try {
return __generator(this, function (_c) { const resposta = await (0, cross_fetch_1.default)(url, {
switch (_c.label) { method: "POST",
case 0: body: JSON.stringify(post),
url = "".concat((0, _urlAutenticacao_1.urlAutenticacao)(ambiente), "/api/validar_token"); headers: { "Content-Type": "application/json" },
_c.label = 1; })
case 1: .then((r) => r.json())
_c.trys.push([1, 3, , 4]); .then((r) => r)
return [4 /*yield*/, (0, cross_fetch_1.default)(url, { .then((resposta) => resposta.eCerto ? "valido" : "erro")
method: "POST", .catch(() => "erro");
body: JSON.stringify(post), return resposta;
headers: { "Content-Type": "application/json" }, }
}) catch (e) {
.then(function (r) { return r.json(); }) return "erro";
.then(function (r) { return r; }) }
.then(function (resposta) { };
return resposta.eCerto ? "valido" : "erro";
})
.catch(function () { return "erro"; })];
case 2:
resposta = _c.sent();
return [2 /*return*/, resposta];
case 3:
e_1 = _c.sent();
return [2 /*return*/, "erro"];
case 4: return [2 /*return*/];
}
});
}); };
exports.validarToken = validarToken; exports.validarToken = validarToken;

View file

@ -1,11 +1,11 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.pAutenticacao = void 0; exports.pAutenticacao = void 0;
var _codigoContaSite_1 = require("./_codigoContaSite"); const _codigoContaSite_1 = require("./_codigoContaSite");
var _urlAutenticacao_1 = require("./_urlAutenticacao"); const _urlAutenticacao_1 = require("./_urlAutenticacao");
var _usuarios_quipo_governo_1 = require("./_usuarios_quipo_governo"); const _usuarios_quipo_governo_1 = require("./_usuarios_quipo_governo");
var _usuarios_quipo_vincular_1 = require("./_usuarios_quipo_vincular"); const _usuarios_quipo_vincular_1 = require("./_usuarios_quipo_vincular");
var _validarToken_1 = require("./_validarToken"); const _validarToken_1 = require("./_validarToken");
/** todas as rotas de comunicação com autenticador partem dessa variável */ /** todas as rotas de comunicação com autenticador partem dessa variável */
exports.pAutenticacao = { exports.pAutenticacao = {
validarToken: _validarToken_1.validarToken, validarToken: _validarToken_1.validarToken,

View file

@ -1,87 +1,35 @@
"use strict"; "use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __importDefault = (this && this.__importDefault) || function (mod) { var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.deletar_registros = exports.zp_deletar_registros = void 0; exports.deletar_registros = exports.zp_deletar_registros = void 0;
var cross_fetch_1 = __importDefault(require("cross-fetch")); const cross_fetch_1 = __importDefault(require("cross-fetch"));
var p_respostas_1 = require("p-respostas"); const p_respostas_1 = require("p-respostas");
var zod_1 = require("zod"); const zod_1 = require("zod");
var variaveis_1 = require("./variaveis"); const variaveis_1 = require("./variaveis");
//enviar registros para base de dados //enviar registros para base de dados
exports.zp_deletar_registros = zod_1.z.object({ exports.zp_deletar_registros = zod_1.z.object({
tabela: zod_1.z.string(), tabela: zod_1.z.string(),
codigos: zod_1.z.array(zod_1.z.string()), codigos: zod_1.z.array(zod_1.z.string()),
}); });
var deletar_registros = function (_a) { const deletar_registros = ({ conta, produto, emDesenvolvimento }) => async ({ codigos, tabela, }) => {
var conta = _a.conta, produto = _a.produto, emDesenvolvimento = _a.emDesenvolvimento; const url = new URL(`${(0, variaveis_1.urlPilao)(emDesenvolvimento).api}/${Object.keys({ deletar_registros: exports.deletar_registros })[0]}/${produto}/${conta}`);
return function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) { const tamanhoBlocos = 1000;
var url, tamanhoBlocos, bloco, resp; while (codigos.length > 0) {
var codigos = _b.codigos, tabela = _b.tabela; const bloco = codigos.splice(0, tamanhoBlocos);
return __generator(this, function (_c) { const resp = await (0, cross_fetch_1.default)(url.toString(), {
switch (_c.label) { method: "POST",
case 0: body: JSON.stringify({ tabela, codigos: bloco }),
url = new URL("".concat((0, variaveis_1.urlPilao)(emDesenvolvimento).api, "/").concat(Object.keys({ deletar_registros: exports.deletar_registros })[0], "/").concat(produto, "/").concat(conta)); headers: { "Content-Type": "application/json" },
tamanhoBlocos = 1000; })
_c.label = 1; .then((r) => r.json())
case 1: .catch((e) => p_respostas_1.respostaComuns.erro("Erro ao enviar registros", [e.message]))
if (!(codigos.length > 0)) return [3 /*break*/, 3]; .then((r) => r);
bloco = codigos.splice(0, tamanhoBlocos); if (resp.eErro) {
return [4 /*yield*/, (0, cross_fetch_1.default)(url.toString(), { return resp;
method: "POST", }
body: JSON.stringify({ tabela: tabela, codigos: bloco }), }
headers: { "Content-Type": "application/json" }, return p_respostas_1.respostaComuns.valor(true);
})
.then(function (r) { return r.json(); })
.catch(function (e) {
return p_respostas_1.respostaComuns.erro("Erro ao enviar registros", [e.message]);
})
.then(function (r) { return r; })];
case 2:
resp = _c.sent();
if (resp.eErro) {
return [2 /*return*/, resp];
}
return [3 /*break*/, 1];
case 3: return [2 /*return*/, p_respostas_1.respostaComuns.valor(true)];
}
});
}); };
}; };
exports.deletar_registros = deletar_registros; exports.deletar_registros = deletar_registros;

View file

@ -1,65 +1,13 @@
"use strict"; "use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __importDefault = (this && this.__importDefault) || function (mod) { var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": 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.enviar_registros = exports.zp_enviar_registros = exports.zp_registrar_base_dados = void 0;
var cross_fetch_1 = __importDefault(require("cross-fetch")); const cross_fetch_1 = __importDefault(require("cross-fetch"));
var p_respostas_1 = require("p-respostas"); const p_respostas_1 = require("p-respostas");
var zod_1 = require("zod"); const zod_1 = require("zod");
var 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({
@ -75,46 +23,25 @@ exports.zp_enviar_registros = zod_1.z.object({
tipo: variaveis_1.z_tipo_coluna_base_dados.optional().nullable(), tipo: variaveis_1.z_tipo_coluna_base_dados.optional().nullable(),
}))), }))),
}); });
var enviar_registros = function (_a) { const enviar_registros = ({ conta, produto, emDesenvolvimento }) => async ({ registros, tabela, }) => {
var conta = _a.conta, produto = _a.produto, emDesenvolvimento = _a.emDesenvolvimento; const url = new URL(`${(0, variaveis_1.urlPilao)(emDesenvolvimento).api}/${Object.keys({ enviar_registros: exports.enviar_registros })[0]}/${produto}/${conta}`);
return function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) { const tamanhoBlocos = 1000;
var url, tamanhoBlocos, bloco, resp; while (registros.length > 0) {
var registros = _b.registros, tabela = _b.tabela; const bloco = registros
return __generator(this, function (_c) { .splice(0, tamanhoBlocos)
switch (_c.label) { .map((r) => Object.fromEntries(Object.entries(r).map(([k, v]) => [k, v === undefined ? null : v])));
case 0: const resp = await (0, cross_fetch_1.default)(url.toString(), {
url = new URL("".concat((0, variaveis_1.urlPilao)(emDesenvolvimento).api, "/").concat(Object.keys({ enviar_registros: exports.enviar_registros })[0], "/").concat(produto, "/").concat(conta)); method: "POST",
tamanhoBlocos = 1000; body: JSON.stringify({ tabela, registros: bloco }),
_c.label = 1; headers: { "Content-Type": "application/json" },
case 1: })
if (!(registros.length > 0)) return [3 /*break*/, 3]; .then((r) => r.json())
bloco = registros .catch((e) => p_respostas_1.respostaComuns.erro("Erro ao enviar registros", [e.message]))
.splice(0, tamanhoBlocos) .then((r) => r);
.map(function (r) { if (resp.eErro) {
return Object.fromEntries(Object.entries(r).map(function (_a) { return resp;
var _b = __read(_a, 2), k = _b[0], v = _b[1]; }
return [k, v === undefined ? null : v]; }
})); return p_respostas_1.respostaComuns.valor(true);
});
return [4 /*yield*/, (0, cross_fetch_1.default)(url.toString(), {
method: "POST",
body: JSON.stringify({ tabela: tabela, registros: bloco }),
headers: { "Content-Type": "application/json" },
})
.then(function (r) { return r.json(); })
.catch(function (e) {
return p_respostas_1.respostaComuns.erro("Erro ao enviar registros", [e.message]);
})
.then(function (r) { return r; })];
case 2:
resp = _c.sent();
if (resp.eErro) {
return [2 /*return*/, resp];
}
return [3 /*break*/, 1];
case 3: return [2 /*return*/, p_respostas_1.respostaComuns.valor(true)];
}
});
}); };
}; };
exports.enviar_registros = enviar_registros; exports.enviar_registros = enviar_registros;

View file

@ -6,16 +6,39 @@ export declare const zp_serie_registrar: z.ZodObject<{
colanuEixoX: z.ZodString; colanuEixoX: z.ZodString;
colunaAgrupamento: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; colunaAgrupamento: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
agregacao: z.ZodEnum<["contagem", "somatoria"]>; agregacao: z.ZodEnum<["contagem", "somatoria"]>;
filtro: z.ZodOptional<z.ZodArray<z.ZodObject<{
coluna: z.ZodString;
valor: z.ZodString;
operador: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
}, "strip", z.ZodTypeAny, {
valor: string;
coluna: string;
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
}, {
valor: string;
coluna: string;
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
}>, "many">>;
}, "strip", z.ZodTypeAny, { }, "strip", z.ZodTypeAny, {
tabela: string; tabela: string;
colanuEixoX: string; colanuEixoX: string;
agregacao: "contagem" | "somatoria"; agregacao: "contagem" | "somatoria";
colunaAgrupamento?: string[] | undefined; colunaAgrupamento?: string[] | undefined;
filtro?: {
valor: string;
coluna: string;
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
}[] | undefined;
}, { }, {
tabela: string; tabela: string;
colanuEixoX: string; colanuEixoX: string;
agregacao: "contagem" | "somatoria"; agregacao: "contagem" | "somatoria";
colunaAgrupamento?: string[] | undefined; colunaAgrupamento?: string[] | undefined;
filtro?: {
valor: string;
coluna: string;
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
}[] | undefined;
}>; }>;
export declare const serie_consultar: (cliente: z.infer<typeof zp_produto_conta>) => (parametros: z.infer<typeof zp_serie_registrar>) => { export declare const serie_consultar: (cliente: z.infer<typeof zp_produto_conta>) => (parametros: z.infer<typeof zp_serie_registrar>) => {
dados: () => Promise<tipoResposta<{ dados: () => Promise<tipoResposta<{

View file

@ -1,88 +1,46 @@
"use strict"; "use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __importDefault = (this && this.__importDefault) || function (mod) { var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.serie_consultar = exports.zp_serie_registrar = void 0; exports.serie_consultar = exports.zp_serie_registrar = void 0;
var cross_fetch_1 = __importDefault(require("cross-fetch")); const cross_fetch_1 = __importDefault(require("cross-fetch"));
var p_respostas_1 = require("p-respostas"); const p_respostas_1 = require("p-respostas");
var zod_1 = require("zod"); const zod_1 = require("zod");
var variaveis_1 = require("./variaveis"); const variaveis_1 = require("./variaveis");
const filtro = zod_1.z.object({
coluna: zod_1.z.string(),
valor: zod_1.z.string(),
operador: variaveis_1.operadores_pilao,
});
exports.zp_serie_registrar = zod_1.z.object({ exports.zp_serie_registrar = zod_1.z.object({
tabela: zod_1.z.string(), tabela: zod_1.z.string(),
colanuEixoX: zod_1.z.string(), colanuEixoX: zod_1.z.string(),
colunaAgrupamento: zod_1.z.string().array().optional(), colunaAgrupamento: zod_1.z.string().array().optional(),
agregacao: variaveis_1.tiposSeriesAgregacoes, agregacao: variaveis_1.tiposSeriesAgregacoes,
filtro: filtro.array().optional(),
}); });
var serie_consultar = function (cliente) { const serie_consultar = (cliente) => (parametros) => {
return function (parametros) { const dados = async () => {
var dados = function () { return __awaiter(void 0, void 0, void 0, function () { const url = new URL(`${(0, variaveis_1.urlPilao)(cliente.emDesenvolvimento).api}/${variaveis_1.tiposSeriesAgregacoes.enum.contagem}/${cliente.produto}/${cliente.conta}`);
var url, resp; const resp = await (0, cross_fetch_1.default)(url.toString(), {
return __generator(this, function (_a) { method: "POST",
switch (_a.label) { body: JSON.stringify(parametros),
case 0: headers: { "Content-Type": "application/json" },
url = new URL("".concat((0, variaveis_1.urlPilao)(cliente.emDesenvolvimento).api, "/").concat(variaveis_1.tiposSeriesAgregacoes.enum.contagem, "/").concat(cliente.produto, "/").concat(cliente.conta)); })
return [4 /*yield*/, (0, cross_fetch_1.default)(url.toString(), { .then((r) => r.json())
method: "POST", .catch((e) => p_respostas_1.respostaComuns.erro("Erro ao enviar registros", [e.message]))
body: JSON.stringify(parametros), .then((r) => r);
headers: { "Content-Type": "application/json" }, return resp;
}) };
.then(function (r) { return r.json(); }) const url = () => {
.catch(function (e) { const vUrl = new URL(`${(0, variaveis_1.urlPilao)(cliente.emDesenvolvimento).site}/${variaveis_1.tiposSeriesAgregacoes.enum.contagem}/${cliente.produto}/${cliente.conta}`);
return p_respostas_1.respostaComuns.erro("Erro ao enviar registros", [e.message]); const serie = encodeURIComponent(JSON.stringify(parametros, null, 2));
}) return `${vUrl.href}?serie=${serie}`;
.then(function (r) { return r; })]; };
case 1: return {
resp = _a.sent(); dados,
return [2 /*return*/, resp]; url,
}
});
}); };
var url = function () {
var vUrl = new URL("".concat((0, variaveis_1.urlPilao)(cliente.emDesenvolvimento).site, "/").concat(variaveis_1.tiposSeriesAgregacoes.enum.contagem, "/").concat(cliente.produto, "/").concat(cliente.conta));
var serie = encodeURIComponent(JSON.stringify(parametros, null, 2));
return "".concat(vUrl.href, "?serie=").concat(serie);
};
return {
dados: dados,
url: url,
};
}; };
}; };
exports.serie_consultar = serie_consultar; exports.serie_consultar = serie_consultar;

View file

@ -61,16 +61,39 @@ export declare const pPilao: {
colanuEixoX: import("zod").ZodString; colanuEixoX: import("zod").ZodString;
colunaAgrupamento: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>; colunaAgrupamento: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
agregacao: import("zod").ZodEnum<["contagem", "somatoria"]>; agregacao: import("zod").ZodEnum<["contagem", "somatoria"]>;
filtro: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
coluna: import("zod").ZodString;
valor: import("zod").ZodString;
operador: import("zod").ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
}, "strip", import("zod").ZodTypeAny, {
valor: string;
coluna: string;
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
}, {
valor: string;
coluna: string;
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
}>, "many">>;
}, "strip", import("zod").ZodTypeAny, { }, "strip", import("zod").ZodTypeAny, {
tabela: string; tabela: string;
colanuEixoX: string; colanuEixoX: string;
agregacao: "contagem" | "somatoria"; agregacao: "contagem" | "somatoria";
colunaAgrupamento?: string[] | undefined; colunaAgrupamento?: string[] | undefined;
filtro?: {
valor: string;
coluna: string;
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
}[] | undefined;
}, { }, {
tabela: string; tabela: string;
colanuEixoX: string; colanuEixoX: string;
agregacao: "contagem" | "somatoria"; agregacao: "contagem" | "somatoria";
colunaAgrupamento?: string[] | undefined; colunaAgrupamento?: string[] | undefined;
filtro?: {
valor: string;
coluna: string;
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
}[] | undefined;
}>; }>;
serie_consultar: (cliente: import("zod").TypeOf<typeof zp_produto_conta>) => (parametros: import("zod").TypeOf<typeof zp_serie_registrar>) => { serie_consultar: (cliente: import("zod").TypeOf<typeof zp_produto_conta>) => (parametros: import("zod").TypeOf<typeof zp_serie_registrar>) => {
dados: () => Promise<import("p-respostas").tipoResposta<{ dados: () => Promise<import("p-respostas").tipoResposta<{
@ -105,4 +128,14 @@ export declare const pPilao: {
tabela: string; tabela: string;
codigos: string[]; codigos: string[];
}>; }>;
operadores_pilao: import("zod").ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
operadores_permitidos_por_tipo: {
texto: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
numero: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
confirmacao: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
lista_texto: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
lista_numero: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
data: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
mes: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
};
}; };

View file

@ -1,14 +1,14 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.pPilao = exports.tiposSeriesAgregacoes = exports.urlPilao = exports.PREFIXO_PILAO = void 0; exports.pPilao = exports.tiposSeriesAgregacoes = exports.urlPilao = exports.PREFIXO_PILAO = void 0;
var _deletar_registros_1 = require("./_deletar_registros"); 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; } });
var _enviar_registros_1 = require("./_enviar_registros"); const _enviar_registros_1 = require("./_enviar_registros");
var variaveis_2 = require("./variaveis"); const variaveis_2 = require("./variaveis");
Object.defineProperty(exports, "tiposSeriesAgregacoes", { enumerable: true, get: function () { return variaveis_2.tiposSeriesAgregacoes; } }); Object.defineProperty(exports, "tiposSeriesAgregacoes", { enumerable: true, get: function () { return variaveis_2.tiposSeriesAgregacoes; } });
var _serie_consultar_1 = require("./_serie_consultar"); const _serie_consultar_1 = require("./_serie_consultar");
exports.pPilao = { exports.pPilao = {
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, enviar_registros: _enviar_registros_1.enviar_registros,
@ -19,4 +19,6 @@ exports.pPilao = {
validarZ: variaveis_2.validarZ, validarZ: variaveis_2.validarZ,
deletar_registros: _deletar_registros_1.deletar_registros, deletar_registros: _deletar_registros_1.deletar_registros,
zp_deletar_registros: _deletar_registros_1.zp_deletar_registros, zp_deletar_registros: _deletar_registros_1.zp_deletar_registros,
operadores_pilao: variaveis_2.operadores_pilao,
operadores_permitidos_por_tipo: variaveis_2.operadores_permitidos_por_tipo,
}; };

View file

@ -16,6 +16,10 @@ export declare const zp_produto_conta: z.ZodObject<{
emDesenvolvimento?: boolean | undefined; emDesenvolvimento?: boolean | undefined;
}>; }>;
export declare const z_tipo_coluna_base_dados: z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "data", "mes"]>; export declare const z_tipo_coluna_base_dados: z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "data", "mes"]>;
export declare const operadores_pilao: z.ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
export declare const operadores_permitidos_por_tipo: {
[key in z.infer<typeof z_tipo_coluna_base_dados>]: z.infer<typeof operadores_pilao>[];
};
export declare const tiposSeriesAgregacoes: z.ZodEnum<["contagem", "somatoria"]>; export declare const tiposSeriesAgregacoes: z.ZodEnum<["contagem", "somatoria"]>;
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>;

View file

@ -1,14 +1,14 @@
"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.tiposSeriesAgregacoes = 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.tiposSeriesAgregacoes = 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;
var p_respostas_1 = require("p-respostas"); const p_respostas_1 = require("p-respostas");
var zod_1 = require("zod"); const zod_1 = require("zod");
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";
var validarZ = function (zodType, objeto, mensagem) { const validarZ = (zodType, objeto, mensagem) => {
var validar = zodType.safeParse(objeto); const validar = zodType.safeParse(objeto);
if (!validar.success) { if (!validar.success) {
return p_respostas_1.respostaComuns.erro(mensagem, validar.error.errors.map(function (e) { return "".concat(e.path, " ").concat(e.message); })); return p_respostas_1.respostaComuns.erro(mensagem, validar.error.errors.map((e) => `${e.path} ${e.message}`));
} }
return p_respostas_1.respostaComuns.valor(validar.data); return p_respostas_1.respostaComuns.valor(validar.data);
}; };
@ -27,6 +27,16 @@ exports.z_tipo_coluna_base_dados = zod_1.z.enum([
"data", "data",
"mes", "mes",
]); ]);
exports.operadores_pilao = zod_1.z.enum(["=", "!=", ">", "<", ">=", "<=", "∩"]);
exports.operadores_permitidos_por_tipo = {
confirmacao: ["=", "!="],
data: ["=", "!=", ">", "<", ">=", "<="],
lista_numero: ["∩"],
lista_texto: ["∩"],
mes: ["=", "!=", ">", "<", ">=", "<="],
numero: ["=", "!=", ">", "<", ">=", "<="],
texto: ["=", "!="],
};
exports.tiposSeriesAgregacoes = zod_1.z.enum(["contagem", "somatoria"]); exports.tiposSeriesAgregacoes = zod_1.z.enum(["contagem", "somatoria"]);
exports.z_validar_colunna_base_dados = { exports.z_validar_colunna_base_dados = {
texto: zod_1.z.string().nullable(), texto: zod_1.z.string().nullable(),
@ -35,12 +45,12 @@ exports.z_validar_colunna_base_dados = {
lista_texto: zod_1.z.array(zod_1.z.string()).nullable(), lista_texto: zod_1.z.array(zod_1.z.string()).nullable(),
lista_numero: zod_1.z.array(zod_1.z.number()).nullable(), lista_numero: zod_1.z.array(zod_1.z.number()).nullable(),
}; };
var urlPilao = function (emDesenvolvimento) { return ({ const urlPilao = (emDesenvolvimento) => ({
api: (emDesenvolvimento api: (emDesenvolvimento
? "http://127.0.0.1:5080" ? "http://127.0.0.1:5080"
: "https://carro-de-boi.idz.one") + exports.PREFIXO_PILAO, : "https://carro-de-boi.idz.one") + exports.PREFIXO_PILAO,
site: (emDesenvolvimento site: (emDesenvolvimento
? "http://127.0.0.1:5081" ? "http://127.0.0.1:5081"
: "https://carro-de-boi.idz.one") + exports.PREFIXO_PILAO, : "https://carro-de-boi.idz.one") + exports.PREFIXO_PILAO,
}); }; });
exports.urlPilao = urlPilao; exports.urlPilao = urlPilao;

View file

@ -1,7 +1,7 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.chaves_produto = void 0; exports.chaves_produto = void 0;
var zod_1 = require("zod"); const zod_1 = require("zod");
exports.chaves_produto = zod_1.z.enum([ exports.chaves_produto = zod_1.z.enum([
"suporte", "suporte",
"betha-meio-ambiente", "betha-meio-ambiente",

View file

@ -1,7 +1,7 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.zAuntenticacaoResiduos = void 0; exports.zAuntenticacaoResiduos = void 0;
var zod_1 = require("zod"); const zod_1 = require("zod");
exports.zAuntenticacaoResiduos = zod_1.z.object({ exports.zAuntenticacaoResiduos = zod_1.z.object({
// usuários // usuários
codigo_usuario: zod_1.z.string().uuid(), codigo_usuario: zod_1.z.string().uuid(),

View file

@ -1,8 +1,8 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.ztokenQuipo = exports.tipos_acesso_quipo = void 0; exports.ztokenQuipo = exports.tipos_acesso_quipo = void 0;
var zod_1 = require("zod"); const zod_1 = require("zod");
var produtos_1 = require("./produtos"); const produtos_1 = require("./produtos");
exports.tipos_acesso_quipo = zod_1.z.enum(["publico", "governo", "sociedade"]); exports.tipos_acesso_quipo = zod_1.z.enum(["publico", "governo", "sociedade"]);
exports.ztokenQuipo = zod_1.z.object({ exports.ztokenQuipo = zod_1.z.object({
provedor: zod_1.z.string(), provedor: zod_1.z.string(),

View file

@ -1,5 +1,5 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.zAmbiente = void 0; exports.zAmbiente = void 0;
var zod_1 = require("zod"); const zod_1 = require("zod");
exports.zAmbiente = zod_1.z.enum(["desenvolvimento", "producao"]); exports.zAmbiente = zod_1.z.enum(["desenvolvimento", "producao"]);

View file

@ -1,6 +1,6 @@
{ {
"name": "p-drives", "name": "p-drives",
"version": "0.112.0", "version": "0.114.0",
"description": "", "description": "",
"main": "src/index.ts", "main": "src/index.ts",
"exports": { "exports": {

View file

@ -3,16 +3,24 @@ import type { tipoResposta } from "p-respostas"
import { respostaComuns } from "p-respostas" import { respostaComuns } from "p-respostas"
import { z } from "zod" import { z } from "zod"
import { import {
operadores_pilao,
tiposSeriesAgregacoes, tiposSeriesAgregacoes,
urlPilao, urlPilao,
type zp_produto_conta, type zp_produto_conta,
} from "./variaveis" } from "./variaveis"
const filtro = z.object({
coluna: z.string(),
valor: z.string(),
operador: operadores_pilao,
})
export const zp_serie_registrar = z.object({ export const zp_serie_registrar = z.object({
tabela: z.string(), tabela: z.string(),
colanuEixoX: z.string(), colanuEixoX: z.string(),
colunaAgrupamento: z.string().array().optional(), colunaAgrupamento: z.string().array().optional(),
agregacao: tiposSeriesAgregacoes, agregacao: tiposSeriesAgregacoes,
filtro: filtro.array().optional(),
}) })
export const serie_consultar = export const serie_consultar =

View file

@ -5,7 +5,13 @@ import {
zp_enviar_registros, zp_enviar_registros,
zp_registrar_base_dados, zp_registrar_base_dados,
} from "./_enviar_registros" } from "./_enviar_registros"
import { tiposSeriesAgregacoes, validarZ, zp_produto_conta } from "./variaveis" import {
operadores_permitidos_por_tipo,
operadores_pilao,
tiposSeriesAgregacoes,
validarZ,
zp_produto_conta,
} from "./variaveis"
import { serie_consultar, zp_serie_registrar } from "./_serie_consultar" import { serie_consultar, zp_serie_registrar } from "./_serie_consultar"
@ -21,4 +27,6 @@ export const pPilao = {
validarZ, validarZ,
deletar_registros, deletar_registros,
zp_deletar_registros, zp_deletar_registros,
operadores_pilao,
operadores_permitidos_por_tipo,
} }

View file

@ -36,6 +36,22 @@ export const z_tipo_coluna_base_dados = z.enum([
"mes", "mes",
]) ])
export const operadores_pilao = z.enum(["=", "!=", ">", "<", ">=", "<=", "∩"])
export const operadores_permitidos_por_tipo: {
[key in z.infer<typeof z_tipo_coluna_base_dados>]: z.infer<
typeof operadores_pilao
>[]
} = {
confirmacao: ["=", "!="],
data: ["=", "!=", ">", "<", ">=", "<="],
lista_numero: ["∩"],
lista_texto: ["∩"],
mes: ["=", "!=", ">", "<", ">=", "<="],
numero: ["=", "!=", ">", "<", ">=", "<="],
texto: ["=", "!="],
}
export const tiposSeriesAgregacoes = z.enum(["contagem", "somatoria"]) export const tiposSeriesAgregacoes = z.enum(["contagem", "somatoria"])
export const z_validar_colunna_base_dados = { export const z_validar_colunna_base_dados = {

View file

@ -2,7 +2,7 @@
"extends": "./tsconfig.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"outDir": "./dist-import", "outDir": "./dist-import",
"target": "ES2015", "target": "ES2020",
"module": "ES2015", "module": "ES2015",
"declaration": true, "declaration": true,
} }

View file

@ -2,7 +2,7 @@
"extends": "./tsconfig.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"module": "commonjs", "module": "commonjs",
"target": "ES5", "target": "ES2020",
"outDir": "./dist-require", "outDir": "./dist-require",
"declaration": true, "declaration": true,
}, },

View file

@ -1,7 +1,7 @@
{ {
"compilerOptions": { "compilerOptions": {
"lib": ["es5", "es6", "es7", "esnext", "dom"], "lib": ["es5", "es6", "es7", "esnext", "dom"],
"target": "es2018", "target": "ES2020",
"removeComments": false, "removeComments": false,
"esModuleInterop": true, "esModuleInterop": true,
"moduleResolution": "node", "moduleResolution": "node",