build
This commit is contained in:
parent
f2562a37d1
commit
7032eb1329
39 changed files with 442 additions and 790 deletions
|
|
@ -1,16 +1,7 @@
|
|||
// 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";
|
||||
// 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
|
||||
? "http://localhost:5040/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)) {
|
||||
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())
|
||||
.catch((error) => respostaComuns.erro(error.message));
|
||||
const proxima_avaliacao = response.valor;
|
||||
|
|
@ -56,4 +47,4 @@ export const abrirNps = (emDesenvolvimento) => (parametros) => __awaiter(void 0,
|
|||
document.body.removeChild(iframe);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 { urlAutenticacao } from "./_urlAutenticacao";
|
||||
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`;
|
||||
try {
|
||||
const resp = yield node_fetch(url, {
|
||||
const resp = await node_fetch(url, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(post),
|
||||
headers: { "Content-Type": "application/json" },
|
||||
|
|
@ -26,4 +17,4 @@ export const codigoContaSite = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|||
catch (e) {
|
||||
return respostaComuns.erro(`erro ao buscar código do site: ${e}`);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 { respostaComuns } from "p-respostas";
|
||||
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`;
|
||||
if (!token_produto)
|
||||
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())
|
||||
.catch((e) => respostaComuns.erro(`Erro ao buscar usuários quipo governo ${e.message}`))
|
||||
.then((r) => r);
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 { respostaComuns } from "p-respostas";
|
||||
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`;
|
||||
if (!token_produto)
|
||||
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 },
|
||||
email: email,
|
||||
};
|
||||
return yield node_fetch(url, {
|
||||
return await node_fetch(url, {
|
||||
headers,
|
||||
body: JSON.stringify(parametros),
|
||||
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}`));
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 node_fetch from "cross-fetch";
|
||||
/** 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`;
|
||||
try {
|
||||
const resposta = yield node_fetch(url, {
|
||||
const resposta = await node_fetch(url, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(post),
|
||||
headers: { "Content-Type": "application/json" },
|
||||
|
|
@ -27,4 +18,4 @@ export const validarToken = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|||
catch (e) {
|
||||
return "erro";
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 { respostaComuns } from "p-respostas";
|
||||
import { z } from "zod";
|
||||
|
|
@ -16,12 +7,12 @@ export const zp_deletar_registros = z.object({
|
|||
tabela: 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 tamanhoBlocos = 1000;
|
||||
while (codigos.length > 0) {
|
||||
const bloco = codigos.splice(0, tamanhoBlocos);
|
||||
const resp = yield node_fetch(url.toString(), {
|
||||
const resp = await node_fetch(url.toString(), {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ tabela, codigos: bloco }),
|
||||
headers: { "Content-Type": "application/json" },
|
||||
|
|
@ -34,4 +25,4 @@ export const deletar_registros = ({ conta, produto, emDesenvolvimento }) => (_a)
|
|||
}
|
||||
}
|
||||
return respostaComuns.valor(true);
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 { respostaComuns } from "p-respostas";
|
||||
import { z } from "zod";
|
||||
|
|
@ -26,14 +17,14 @@ export const zp_enviar_registros = z.object({
|
|||
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 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 = yield node_fetch(url.toString(), {
|
||||
const resp = await node_fetch(url.toString(), {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ tabela, registros: bloco }),
|
||||
headers: { "Content-Type": "application/json" },
|
||||
|
|
@ -46,4 +37,4 @@ export const enviar_registros = ({ conta, produto, emDesenvolvimento }) => (_a)
|
|||
}
|
||||
}
|
||||
return respostaComuns.valor(true);
|
||||
});
|
||||
};
|
||||
|
|
|
|||
23
dist-import/pilao-de-dados/_serie_consultar.d.ts
vendored
23
dist-import/pilao-de-dados/_serie_consultar.d.ts
vendored
|
|
@ -6,16 +6,39 @@ export declare const zp_serie_registrar: z.ZodObject<{
|
|||
colanuEixoX: z.ZodString;
|
||||
colunaAgrupamento: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||
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, {
|
||||
tabela: string;
|
||||
colanuEixoX: string;
|
||||
agregacao: "contagem" | "somatoria";
|
||||
colunaAgrupamento?: string[] | undefined;
|
||||
filtro?: {
|
||||
valor: string;
|
||||
coluna: string;
|
||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||
}[] | undefined;
|
||||
}, {
|
||||
tabela: string;
|
||||
colanuEixoX: string;
|
||||
agregacao: "contagem" | "somatoria";
|
||||
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>) => {
|
||||
dados: () => Promise<tipoResposta<{
|
||||
|
|
|
|||
|
|
@ -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 { respostaComuns } from "p-respostas";
|
||||
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({
|
||||
tabela: z.string(),
|
||||
colanuEixoX: z.string(),
|
||||
colunaAgrupamento: z.string().array().optional(),
|
||||
agregacao: tiposSeriesAgregacoes,
|
||||
filtro: filtro.array().optional(),
|
||||
});
|
||||
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 resp = yield node_fetch(url.toString(), {
|
||||
const resp = await node_fetch(url.toString(), {
|
||||
method: "POST",
|
||||
body: JSON.stringify(parametros),
|
||||
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]))
|
||||
.then((r) => r);
|
||||
return resp;
|
||||
});
|
||||
};
|
||||
const url = () => {
|
||||
const vUrl = new URL(`${urlPilao(cliente.emDesenvolvimento).site}/${tiposSeriesAgregacoes.enum.contagem}/${cliente.produto}/${cliente.conta}`);
|
||||
const serie = encodeURIComponent(JSON.stringify(parametros, null, 2));
|
||||
|
|
|
|||
33
dist-import/pilao-de-dados/index.d.ts
vendored
33
dist-import/pilao-de-dados/index.d.ts
vendored
|
|
@ -61,16 +61,39 @@ export declare const pPilao: {
|
|||
colanuEixoX: import("zod").ZodString;
|
||||
colunaAgrupamento: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
||||
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, {
|
||||
tabela: string;
|
||||
colanuEixoX: string;
|
||||
agregacao: "contagem" | "somatoria";
|
||||
colunaAgrupamento?: string[] | undefined;
|
||||
filtro?: {
|
||||
valor: string;
|
||||
coluna: string;
|
||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||
}[] | undefined;
|
||||
}, {
|
||||
tabela: string;
|
||||
colanuEixoX: string;
|
||||
agregacao: "contagem" | "somatoria";
|
||||
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>) => {
|
||||
dados: () => Promise<import("p-respostas").tipoResposta<{
|
||||
|
|
@ -105,4 +128,14 @@ export declare const pPilao: {
|
|||
tabela: string;
|
||||
codigos: string[];
|
||||
}>;
|
||||
operadores_pilao: import("zod").ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||
operadores_permitidos_por_tipo: {
|
||||
texto: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
|
||||
numero: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
|
||||
confirmacao: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
|
||||
lista_texto: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
|
||||
lista_numero: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
|
||||
data: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
|
||||
mes: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { deletar_registros, zp_deletar_registros } from "./_deletar_registros";
|
||||
export { PREFIXO_PILAO, urlPilao } from "./variaveis";
|
||||
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";
|
||||
export { tiposSeriesAgregacoes };
|
||||
export const pPilao = {
|
||||
|
|
@ -14,4 +14,6 @@ export const pPilao = {
|
|||
validarZ,
|
||||
deletar_registros,
|
||||
zp_deletar_registros,
|
||||
operadores_pilao,
|
||||
operadores_permitidos_por_tipo,
|
||||
};
|
||||
|
|
|
|||
4
dist-import/pilao-de-dados/variaveis.d.ts
vendored
4
dist-import/pilao-de-dados/variaveis.d.ts
vendored
|
|
@ -16,6 +16,10 @@ export declare const zp_produto_conta: z.ZodObject<{
|
|||
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 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 z_validar_colunna_base_dados: {
|
||||
texto: z.ZodNullable<z.ZodString>;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,16 @@ export const z_tipo_coluna_base_dados = z.enum([
|
|||
"data",
|
||||
"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 z_validar_colunna_base_dados = {
|
||||
texto: z.string().nullable(),
|
||||
|
|
|
|||
|
|
@ -1,134 +1,40 @@
|
|||
"use strict";
|
||||
// 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 });
|
||||
exports.abrirNps = void 0;
|
||||
var p_respostas_1 = require("p-respostas");
|
||||
const p_respostas_1 = require("p-respostas");
|
||||
// exibe o iframe em tela cheia
|
||||
var abrirNps = function (emDesenvolvimento) {
|
||||
return function (parametros) { return __awaiter(void 0, void 0, void 0, function () {
|
||||
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;
|
||||
var e_1, _g, e_2, _h;
|
||||
return __generator(this, function (_j) {
|
||||
switch (_j.label) {
|
||||
case 0:
|
||||
base_site = emDesenvolvimento
|
||||
const abrirNps = (emDesenvolvimento) => async (parametros) => {
|
||||
const base_site = emDesenvolvimento
|
||||
? "http://localhost:5040/nps"
|
||||
: "https://carro-de-boi.idz.one/nps";
|
||||
base_api = "".concat(base_site, "/api");
|
||||
sistema = parametros.sistema, codigo_organizacao = parametros.codigo_organizacao, codigo_usuario = parametros.codigo_usuario;
|
||||
nome_local_storage_proxima = "nps_proxima_avaliacao_".concat(sistema, "_").concat(codigo_usuario, "_").concat(codigo_organizacao, "_0");
|
||||
proxima_avaliacao = localStorage.getItem(nome_local_storage_proxima);
|
||||
if (!!proxima_avaliacao) return [3 /*break*/, 2];
|
||||
url_proxima_avaliacao = new URL("".concat(base_api, "/").concat(sistema, "/proxima_avaliacao"));
|
||||
try {
|
||||
for (_a = __values(Object.entries(parametros)), _b = _a.next(); !_b.done; _b = _a.next()) {
|
||||
_c = __read(_b.value, 2), chave = _c[0], valor = _c[1];
|
||||
const base_api = `${base_site}/api`;
|
||||
const { sistema, codigo_organizacao, codigo_usuario } = parametros;
|
||||
const nome_local_storage_proxima = `nps_proxima_avaliacao_${sistema}_${codigo_usuario}_${codigo_organizacao}_0`;
|
||||
const proxima_avaliacao = localStorage.getItem(nome_local_storage_proxima);
|
||||
if (!proxima_avaliacao) {
|
||||
const url_proxima_avaliacao = new URL(`${base_api}/${sistema}/proxima_avaliacao`);
|
||||
for (const [chave, valor] of Object.entries(parametros)) {
|
||||
url_proxima_avaliacao.searchParams.append(chave, valor);
|
||||
}
|
||||
const response = await fetch(url_proxima_avaliacao.href)
|
||||
.then((resposta) => resposta.json())
|
||||
.catch((error) => p_respostas_1.respostaComuns.erro(error.message));
|
||||
const proxima_avaliacao = response.valor;
|
||||
proxima_avaliacao &&
|
||||
localStorage.setItem(nome_local_storage_proxima, proxima_avaliacao);
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_b && !_b.done && (_g = _a.return)) _g.call(_a);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
return [4 /*yield*/, fetch(url_proxima_avaliacao.href)
|
||||
.then(function (resposta) {
|
||||
return resposta.json();
|
||||
})
|
||||
.catch(function (error) { return p_respostas_1.respostaComuns.erro(error.message); })];
|
||||
case 1:
|
||||
response = _j.sent();
|
||||
proxima_avaliacao_1 = response.valor;
|
||||
proxima_avaliacao_1 &&
|
||||
localStorage.setItem(nome_local_storage_proxima, proxima_avaliacao_1);
|
||||
_j.label = 2;
|
||||
case 2:
|
||||
abrir_modal = proxima_avaliacao &&
|
||||
const abrir_modal = proxima_avaliacao &&
|
||||
new Date().toISOString().slice(0, 10) >= proxima_avaliacao;
|
||||
if (!abrir_modal) {
|
||||
return [2 /*return*/];
|
||||
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];
|
||||
const urlIfrma = new URL(base_site);
|
||||
for (const [chave, valor] of Object.entries(parametros)) {
|
||||
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");
|
||||
const iframe = document.createElement("iframe");
|
||||
iframe.src = urlIfrma.href;
|
||||
iframe.style.position = "fixed";
|
||||
iframe.style.top = "0";
|
||||
|
|
@ -139,14 +45,10 @@ var abrirNps = function (emDesenvolvimento) {
|
|||
iframe.style.zIndex = "999999";
|
||||
document.body.appendChild(iframe);
|
||||
// receber mensagem do iframe
|
||||
window.addEventListener("message", function (event) {
|
||||
window.addEventListener("message", (event) => {
|
||||
if (event.data === "fechar") {
|
||||
document.body.removeChild(iframe);
|
||||
}
|
||||
});
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
}); };
|
||||
};
|
||||
exports.abrirNps = abrirNps;
|
||||
|
|
|
|||
|
|
@ -1,76 +1,27 @@
|
|||
"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) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.codigoContaSite = void 0;
|
||||
var p_respostas_1 = require("p-respostas");
|
||||
var _urlAutenticacao_1 = require("./_urlAutenticacao");
|
||||
var cross_fetch_1 = __importDefault(require("cross-fetch"));
|
||||
var codigoContaSite = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
||||
var url, resp, e_1;
|
||||
var ambiente = _b.ambiente, post = _b.post;
|
||||
return __generator(this, function (_c) {
|
||||
switch (_c.label) {
|
||||
case 0:
|
||||
url = "".concat((0, _urlAutenticacao_1.urlAutenticacao)(ambiente), "/api/codigo_prefeitura_site");
|
||||
_c.label = 1;
|
||||
case 1:
|
||||
_c.trys.push([1, 3, , 4]);
|
||||
return [4 /*yield*/, (0, cross_fetch_1.default)(url, {
|
||||
const p_respostas_1 = require("p-respostas");
|
||||
const _urlAutenticacao_1 = require("./_urlAutenticacao");
|
||||
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
||||
const codigoContaSite = async ({ ambiente, post, }) => {
|
||||
const url = `${(0, _urlAutenticacao_1.urlAutenticacao)(ambiente)}/api/codigo_prefeitura_site`;
|
||||
try {
|
||||
const resp = await (0, cross_fetch_1.default)(url, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(post),
|
||||
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();
|
||||
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*/];
|
||||
.then((r) => r.json())
|
||||
.catch((e) => p_respostas_1.respostaComuns.erro("Erro ao enviar registros", [e.message]))
|
||||
.then((r) => r);
|
||||
return resp;
|
||||
}
|
||||
});
|
||||
}); };
|
||||
catch (e) {
|
||||
return p_respostas_1.respostaComuns.erro(`erro ao buscar código do site: ${e}`);
|
||||
}
|
||||
};
|
||||
exports.codigoContaSite = codigoContaSite;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.urlAutenticacao = void 0;
|
||||
var urlAutenticacao = function (ambiente) {
|
||||
return "".concat(ambiente == "producao"
|
||||
const urlAutenticacao = (ambiente) => `${ambiente == "producao"
|
||||
? "https://carro-de-boi.idz.one"
|
||||
: "http://localhost:5030", "/autenticacao");
|
||||
};
|
||||
: "http://localhost:5030"}/autenticacao`;
|
||||
exports.urlAutenticacao = urlAutenticacao;
|
||||
|
|
|
|||
|
|
@ -1,66 +1,24 @@
|
|||
"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) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.usuarios_quipo_governo = void 0;
|
||||
var cross_fetch_1 = __importDefault(require("cross-fetch"));
|
||||
var p_respostas_1 = require("p-respostas");
|
||||
var _urlAutenticacao_1 = require("./_urlAutenticacao");
|
||||
var usuarios_quipo_governo = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
||||
var url, headers;
|
||||
var token_produto = _b.token_produto, ambiente = _b.ambiente;
|
||||
return __generator(this, function (_c) {
|
||||
url = "".concat((0, _urlAutenticacao_1.urlAutenticacao)(ambiente), "/api/usuarios_quipo_governo");
|
||||
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
||||
const p_respostas_1 = require("p-respostas");
|
||||
const _urlAutenticacao_1 = require("./_urlAutenticacao");
|
||||
const usuarios_quipo_governo = async ({ token_produto, ambiente, }) => {
|
||||
const url = `${(0, _urlAutenticacao_1.urlAutenticacao)(ambiente)}/api/usuarios_quipo_governo`;
|
||||
if (!token_produto)
|
||||
return [2 /*return*/, p_respostas_1.respostaComuns.erro("token_produto não informado")];
|
||||
headers = {
|
||||
return p_respostas_1.respostaComuns.erro("token_produto não informado");
|
||||
const headers = {
|
||||
token: token_produto,
|
||||
};
|
||||
return [2 /*return*/, (0, cross_fetch_1.default)(url, {
|
||||
headers: headers,
|
||||
return (0, cross_fetch_1.default)(url, {
|
||||
headers,
|
||||
})
|
||||
.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; })];
|
||||
});
|
||||
}); };
|
||||
.then((r) => r.json())
|
||||
.catch((e) => p_respostas_1.respostaComuns.erro(`Erro ao buscar usuários quipo governo ${e.message}`))
|
||||
.then((r) => r);
|
||||
};
|
||||
exports.usuarios_quipo_governo = usuarios_quipo_governo;
|
||||
|
|
|
|||
|
|
@ -1,81 +1,30 @@
|
|||
"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) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.usuarios_quipo_vincular = void 0;
|
||||
var cross_fetch_1 = __importDefault(require("cross-fetch"));
|
||||
var p_respostas_1 = require("p-respostas");
|
||||
var _urlAutenticacao_1 = require("./_urlAutenticacao");
|
||||
var usuarios_quipo_vincular = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
||||
var url, headers, parametros;
|
||||
var token_produto = _b.token_produto, ambiente = _b.ambiente, conta = _b.conta, vinculo = _b.vinculo, codigo_usuario = _b.codigo_usuario, email = _b.email;
|
||||
return __generator(this, function (_c) {
|
||||
switch (_c.label) {
|
||||
case 0:
|
||||
url = "".concat((0, _urlAutenticacao_1.urlAutenticacao)(ambiente), "/api/vinculos__criar");
|
||||
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
||||
const p_respostas_1 = require("p-respostas");
|
||||
const _urlAutenticacao_1 = require("./_urlAutenticacao");
|
||||
const usuarios_quipo_vincular = async ({ token_produto, ambiente, conta, vinculo, codigo_usuario, email, }) => {
|
||||
const url = `${(0, _urlAutenticacao_1.urlAutenticacao)(ambiente)}/api/vinculos__criar`;
|
||||
if (!token_produto)
|
||||
return [2 /*return*/, p_respostas_1.respostaComuns.erro("token_produto não informado")];
|
||||
headers = {
|
||||
return p_respostas_1.respostaComuns.erro("token_produto não informado");
|
||||
const headers = {
|
||||
token: token_produto,
|
||||
"Content-Type": "application/json",
|
||||
};
|
||||
parametros = {
|
||||
vinculos: { codigo_conta: conta, codigo_usuario: codigo_usuario, vinculo: vinculo },
|
||||
const parametros = {
|
||||
vinculos: { codigo_conta: conta, codigo_usuario, vinculo },
|
||||
email: email,
|
||||
};
|
||||
return [4 /*yield*/, (0, cross_fetch_1.default)(url, {
|
||||
headers: headers,
|
||||
return await (0, cross_fetch_1.default)(url, {
|
||||
headers,
|
||||
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()];
|
||||
}
|
||||
});
|
||||
}); };
|
||||
.then(async (r) => await r.json())
|
||||
.catch((e) => p_respostas_1.respostaComuns.erro(`Erro ao criar vinculo de usuario ${e.message}`));
|
||||
};
|
||||
exports.usuarios_quipo_vincular = usuarios_quipo_vincular;
|
||||
|
|
|
|||
|
|
@ -1,77 +1,28 @@
|
|||
"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) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.validarToken = void 0;
|
||||
var _urlAutenticacao_1 = require("./_urlAutenticacao");
|
||||
var cross_fetch_1 = __importDefault(require("cross-fetch"));
|
||||
const _urlAutenticacao_1 = require("./_urlAutenticacao");
|
||||
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
||||
/** faz a validação do token */
|
||||
var validarToken = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
||||
var url, resposta, e_1;
|
||||
var ambiente = _b.ambiente, post = _b.post;
|
||||
return __generator(this, function (_c) {
|
||||
switch (_c.label) {
|
||||
case 0:
|
||||
url = "".concat((0, _urlAutenticacao_1.urlAutenticacao)(ambiente), "/api/validar_token");
|
||||
_c.label = 1;
|
||||
case 1:
|
||||
_c.trys.push([1, 3, , 4]);
|
||||
return [4 /*yield*/, (0, cross_fetch_1.default)(url, {
|
||||
const validarToken = async ({ ambiente, post, }) => {
|
||||
const url = `${(0, _urlAutenticacao_1.urlAutenticacao)(ambiente)}/api/validar_token`;
|
||||
try {
|
||||
const resposta = await (0, cross_fetch_1.default)(url, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(post),
|
||||
headers: { "Content-Type": "application/json" },
|
||||
})
|
||||
.then(function (r) { return r.json(); })
|
||||
.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*/];
|
||||
.then((r) => r.json())
|
||||
.then((r) => r)
|
||||
.then((resposta) => resposta.eCerto ? "valido" : "erro")
|
||||
.catch(() => "erro");
|
||||
return resposta;
|
||||
}
|
||||
});
|
||||
}); };
|
||||
catch (e) {
|
||||
return "erro";
|
||||
}
|
||||
};
|
||||
exports.validarToken = validarToken;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.pAutenticacao = void 0;
|
||||
var _codigoContaSite_1 = require("./_codigoContaSite");
|
||||
var _urlAutenticacao_1 = require("./_urlAutenticacao");
|
||||
var _usuarios_quipo_governo_1 = require("./_usuarios_quipo_governo");
|
||||
var _usuarios_quipo_vincular_1 = require("./_usuarios_quipo_vincular");
|
||||
var _validarToken_1 = require("./_validarToken");
|
||||
const _codigoContaSite_1 = require("./_codigoContaSite");
|
||||
const _urlAutenticacao_1 = require("./_urlAutenticacao");
|
||||
const _usuarios_quipo_governo_1 = require("./_usuarios_quipo_governo");
|
||||
const _usuarios_quipo_vincular_1 = require("./_usuarios_quipo_vincular");
|
||||
const _validarToken_1 = require("./_validarToken");
|
||||
/** todas as rotas de comunicação com autenticador partem dessa variável */
|
||||
exports.pAutenticacao = {
|
||||
validarToken: _validarToken_1.validarToken,
|
||||
|
|
|
|||
|
|
@ -1,87 +1,35 @@
|
|||
"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) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.deletar_registros = exports.zp_deletar_registros = void 0;
|
||||
var cross_fetch_1 = __importDefault(require("cross-fetch"));
|
||||
var p_respostas_1 = require("p-respostas");
|
||||
var zod_1 = require("zod");
|
||||
var variaveis_1 = require("./variaveis");
|
||||
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()),
|
||||
});
|
||||
var deletar_registros = function (_a) {
|
||||
var conta = _a.conta, produto = _a.produto, emDesenvolvimento = _a.emDesenvolvimento;
|
||||
return function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
||||
var url, tamanhoBlocos, bloco, resp;
|
||||
var codigos = _b.codigos, tabela = _b.tabela;
|
||||
return __generator(this, function (_c) {
|
||||
switch (_c.label) {
|
||||
case 0:
|
||||
url = new URL("".concat((0, variaveis_1.urlPilao)(emDesenvolvimento).api, "/").concat(Object.keys({ deletar_registros: exports.deletar_registros })[0], "/").concat(produto, "/").concat(conta));
|
||||
tamanhoBlocos = 1000;
|
||||
_c.label = 1;
|
||||
case 1:
|
||||
if (!(codigos.length > 0)) return [3 /*break*/, 3];
|
||||
bloco = codigos.splice(0, tamanhoBlocos);
|
||||
return [4 /*yield*/, (0, cross_fetch_1.default)(url.toString(), {
|
||||
const deletar_registros = ({ conta, produto, emDesenvolvimento }) => async ({ codigos, tabela, }) => {
|
||||
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: tabela, codigos: bloco }),
|
||||
body: JSON.stringify({ tabela, codigos: 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();
|
||||
.then((r) => r.json())
|
||||
.catch((e) => p_respostas_1.respostaComuns.erro("Erro ao enviar registros", [e.message]))
|
||||
.then((r) => r);
|
||||
if (resp.eErro) {
|
||||
return [2 /*return*/, resp];
|
||||
return resp;
|
||||
}
|
||||
return [3 /*break*/, 1];
|
||||
case 3: return [2 /*return*/, p_respostas_1.respostaComuns.valor(true)];
|
||||
}
|
||||
});
|
||||
}); };
|
||||
return p_respostas_1.respostaComuns.valor(true);
|
||||
};
|
||||
exports.deletar_registros = deletar_registros;
|
||||
|
|
|
|||
|
|
@ -1,65 +1,13 @@
|
|||
"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) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.enviar_registros = exports.zp_enviar_registros = exports.zp_registrar_base_dados = void 0;
|
||||
var cross_fetch_1 = __importDefault(require("cross-fetch"));
|
||||
var p_respostas_1 = require("p-respostas");
|
||||
var zod_1 = require("zod");
|
||||
var variaveis_1 = require("./variaveis");
|
||||
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");
|
||||
exports.zp_registrar_base_dados = zod_1.z.object({
|
||||
tabela: zod_1.z.string(),
|
||||
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(),
|
||||
}))),
|
||||
});
|
||||
var enviar_registros = function (_a) {
|
||||
var conta = _a.conta, produto = _a.produto, emDesenvolvimento = _a.emDesenvolvimento;
|
||||
return function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
||||
var url, tamanhoBlocos, bloco, resp;
|
||||
var registros = _b.registros, tabela = _b.tabela;
|
||||
return __generator(this, function (_c) {
|
||||
switch (_c.label) {
|
||||
case 0:
|
||||
url = new URL("".concat((0, variaveis_1.urlPilao)(emDesenvolvimento).api, "/").concat(Object.keys({ enviar_registros: exports.enviar_registros })[0], "/").concat(produto, "/").concat(conta));
|
||||
tamanhoBlocos = 1000;
|
||||
_c.label = 1;
|
||||
case 1:
|
||||
if (!(registros.length > 0)) return [3 /*break*/, 3];
|
||||
bloco = registros
|
||||
const enviar_registros = ({ conta, produto, emDesenvolvimento }) => async ({ registros, tabela, }) => {
|
||||
const url = new URL(`${(0, variaveis_1.urlPilao)(emDesenvolvimento).api}/${Object.keys({ enviar_registros: exports.enviar_registros })[0]}/${produto}/${conta}`);
|
||||
const tamanhoBlocos = 1000;
|
||||
while (registros.length > 0) {
|
||||
const bloco = registros
|
||||
.splice(0, tamanhoBlocos)
|
||||
.map(function (r) {
|
||||
return Object.fromEntries(Object.entries(r).map(function (_a) {
|
||||
var _b = __read(_a, 2), k = _b[0], v = _b[1];
|
||||
return [k, v === undefined ? null : v];
|
||||
}));
|
||||
});
|
||||
return [4 /*yield*/, (0, cross_fetch_1.default)(url.toString(), {
|
||||
.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: tabela, registros: bloco }),
|
||||
body: JSON.stringify({ 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();
|
||||
.then((r) => r.json())
|
||||
.catch((e) => p_respostas_1.respostaComuns.erro("Erro ao enviar registros", [e.message]))
|
||||
.then((r) => r);
|
||||
if (resp.eErro) {
|
||||
return [2 /*return*/, resp];
|
||||
return resp;
|
||||
}
|
||||
return [3 /*break*/, 1];
|
||||
case 3: return [2 /*return*/, p_respostas_1.respostaComuns.valor(true)];
|
||||
}
|
||||
});
|
||||
}); };
|
||||
return p_respostas_1.respostaComuns.valor(true);
|
||||
};
|
||||
exports.enviar_registros = enviar_registros;
|
||||
|
|
|
|||
|
|
@ -6,16 +6,39 @@ export declare const zp_serie_registrar: z.ZodObject<{
|
|||
colanuEixoX: z.ZodString;
|
||||
colunaAgrupamento: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||
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, {
|
||||
tabela: string;
|
||||
colanuEixoX: string;
|
||||
agregacao: "contagem" | "somatoria";
|
||||
colunaAgrupamento?: string[] | undefined;
|
||||
filtro?: {
|
||||
valor: string;
|
||||
coluna: string;
|
||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||
}[] | undefined;
|
||||
}, {
|
||||
tabela: string;
|
||||
colanuEixoX: string;
|
||||
agregacao: "contagem" | "somatoria";
|
||||
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>) => {
|
||||
dados: () => Promise<tipoResposta<{
|
||||
|
|
|
|||
|
|
@ -1,88 +1,46 @@
|
|||
"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) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.serie_consultar = exports.zp_serie_registrar = void 0;
|
||||
var cross_fetch_1 = __importDefault(require("cross-fetch"));
|
||||
var p_respostas_1 = require("p-respostas");
|
||||
var zod_1 = require("zod");
|
||||
var variaveis_1 = require("./variaveis");
|
||||
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");
|
||||
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({
|
||||
tabela: zod_1.z.string(),
|
||||
colanuEixoX: zod_1.z.string(),
|
||||
colunaAgrupamento: zod_1.z.string().array().optional(),
|
||||
agregacao: variaveis_1.tiposSeriesAgregacoes,
|
||||
filtro: filtro.array().optional(),
|
||||
});
|
||||
var serie_consultar = function (cliente) {
|
||||
return function (parametros) {
|
||||
var dados = function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var url, resp;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
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(), {
|
||||
const serie_consultar = (cliente) => (parametros) => {
|
||||
const dados = async () => {
|
||||
const url = new URL(`${(0, variaveis_1.urlPilao)(cliente.emDesenvolvimento).api}/${variaveis_1.tiposSeriesAgregacoes.enum.contagem}/${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(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 1:
|
||||
resp = _a.sent();
|
||||
return [2 /*return*/, resp];
|
||||
}
|
||||
});
|
||||
}); };
|
||||
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);
|
||||
.then((r) => r.json())
|
||||
.catch((e) => p_respostas_1.respostaComuns.erro("Erro ao enviar registros", [e.message]))
|
||||
.then((r) => r);
|
||||
return resp;
|
||||
};
|
||||
const url = () => {
|
||||
const vUrl = new URL(`${(0, variaveis_1.urlPilao)(cliente.emDesenvolvimento).site}/${variaveis_1.tiposSeriesAgregacoes.enum.contagem}/${cliente.produto}/${cliente.conta}`);
|
||||
const serie = encodeURIComponent(JSON.stringify(parametros, null, 2));
|
||||
return `${vUrl.href}?serie=${serie}`;
|
||||
};
|
||||
return {
|
||||
dados: dados,
|
||||
url: url,
|
||||
};
|
||||
dados,
|
||||
url,
|
||||
};
|
||||
};
|
||||
exports.serie_consultar = serie_consultar;
|
||||
|
|
|
|||
33
dist-require/pilao-de-dados/index.d.ts
vendored
33
dist-require/pilao-de-dados/index.d.ts
vendored
|
|
@ -61,16 +61,39 @@ export declare const pPilao: {
|
|||
colanuEixoX: import("zod").ZodString;
|
||||
colunaAgrupamento: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
||||
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, {
|
||||
tabela: string;
|
||||
colanuEixoX: string;
|
||||
agregacao: "contagem" | "somatoria";
|
||||
colunaAgrupamento?: string[] | undefined;
|
||||
filtro?: {
|
||||
valor: string;
|
||||
coluna: string;
|
||||
operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩";
|
||||
}[] | undefined;
|
||||
}, {
|
||||
tabela: string;
|
||||
colanuEixoX: string;
|
||||
agregacao: "contagem" | "somatoria";
|
||||
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>) => {
|
||||
dados: () => Promise<import("p-respostas").tipoResposta<{
|
||||
|
|
@ -105,4 +128,14 @@ export declare const pPilao: {
|
|||
tabela: string;
|
||||
codigos: string[];
|
||||
}>;
|
||||
operadores_pilao: import("zod").ZodEnum<["=", "!=", ">", "<", ">=", "<=", "∩"]>;
|
||||
operadores_permitidos_por_tipo: {
|
||||
texto: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
|
||||
numero: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
|
||||
confirmacao: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
|
||||
lista_texto: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
|
||||
lista_numero: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
|
||||
data: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
|
||||
mes: ("=" | "!=" | ">" | "<" | ">=" | "<=" | "∩")[];
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
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");
|
||||
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; } });
|
||||
var _enviar_registros_1 = require("./_enviar_registros");
|
||||
var variaveis_2 = require("./variaveis");
|
||||
const _enviar_registros_1 = require("./_enviar_registros");
|
||||
const variaveis_2 = require("./variaveis");
|
||||
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 = {
|
||||
zp_registrar_base_dados: _enviar_registros_1.zp_registrar_base_dados,
|
||||
enviar_registros: _enviar_registros_1.enviar_registros,
|
||||
|
|
@ -19,4 +19,6 @@ exports.pPilao = {
|
|||
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_permitidos_por_tipo: variaveis_2.operadores_permitidos_por_tipo,
|
||||
};
|
||||
|
|
|
|||
4
dist-require/pilao-de-dados/variaveis.d.ts
vendored
4
dist-require/pilao-de-dados/variaveis.d.ts
vendored
|
|
@ -16,6 +16,10 @@ export declare const zp_produto_conta: z.ZodObject<{
|
|||
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 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 z_validar_colunna_base_dados: {
|
||||
texto: z.ZodNullable<z.ZodString>;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
"use strict";
|
||||
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;
|
||||
var p_respostas_1 = require("p-respostas");
|
||||
var zod_1 = require("zod");
|
||||
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;
|
||||
const p_respostas_1 = require("p-respostas");
|
||||
const zod_1 = require("zod");
|
||||
exports.zAmbiente = zod_1.z.enum(["desenvolvimento", "producao"]);
|
||||
exports.PREFIXO_PILAO = "/pilao-de-dados";
|
||||
var validarZ = function (zodType, objeto, mensagem) {
|
||||
var validar = zodType.safeParse(objeto);
|
||||
const validarZ = (zodType, objeto, mensagem) => {
|
||||
const validar = zodType.safeParse(objeto);
|
||||
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);
|
||||
};
|
||||
|
|
@ -27,6 +27,16 @@ exports.z_tipo_coluna_base_dados = zod_1.z.enum([
|
|||
"data",
|
||||
"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.z_validar_colunna_base_dados = {
|
||||
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_numero: zod_1.z.array(zod_1.z.number()).nullable(),
|
||||
};
|
||||
var urlPilao = function (emDesenvolvimento) { return ({
|
||||
const urlPilao = (emDesenvolvimento) => ({
|
||||
api: (emDesenvolvimento
|
||||
? "http://127.0.0.1:5080"
|
||||
: "https://carro-de-boi.idz.one") + exports.PREFIXO_PILAO,
|
||||
site: (emDesenvolvimento
|
||||
? "http://127.0.0.1:5081"
|
||||
: "https://carro-de-boi.idz.one") + exports.PREFIXO_PILAO,
|
||||
}); };
|
||||
});
|
||||
exports.urlPilao = urlPilao;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.chaves_produto = void 0;
|
||||
var zod_1 = require("zod");
|
||||
const zod_1 = require("zod");
|
||||
exports.chaves_produto = zod_1.z.enum([
|
||||
"suporte",
|
||||
"betha-meio-ambiente",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.zAuntenticacaoResiduos = void 0;
|
||||
var zod_1 = require("zod");
|
||||
const zod_1 = require("zod");
|
||||
exports.zAuntenticacaoResiduos = zod_1.z.object({
|
||||
// usuários
|
||||
codigo_usuario: zod_1.z.string().uuid(),
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ztokenQuipo = exports.tipos_acesso_quipo = void 0;
|
||||
var zod_1 = require("zod");
|
||||
var produtos_1 = require("./produtos");
|
||||
const zod_1 = require("zod");
|
||||
const produtos_1 = require("./produtos");
|
||||
exports.tipos_acesso_quipo = zod_1.z.enum(["publico", "governo", "sociedade"]);
|
||||
exports.ztokenQuipo = zod_1.z.object({
|
||||
provedor: zod_1.z.string(),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.zAmbiente = void 0;
|
||||
var zod_1 = require("zod");
|
||||
const zod_1 = require("zod");
|
||||
exports.zAmbiente = zod_1.z.enum(["desenvolvimento", "producao"]);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "p-drives",
|
||||
"version": "0.112.0",
|
||||
"version": "0.114.0",
|
||||
"description": "",
|
||||
"main": "src/index.ts",
|
||||
"exports": {
|
||||
|
|
|
|||
|
|
@ -3,16 +3,24 @@ import type { tipoResposta } from "p-respostas"
|
|||
import { respostaComuns } from "p-respostas"
|
||||
import { z } from "zod"
|
||||
import {
|
||||
operadores_pilao,
|
||||
tiposSeriesAgregacoes,
|
||||
urlPilao,
|
||||
type zp_produto_conta,
|
||||
} from "./variaveis"
|
||||
|
||||
const filtro = z.object({
|
||||
coluna: z.string(),
|
||||
valor: z.string(),
|
||||
operador: operadores_pilao,
|
||||
})
|
||||
|
||||
export const zp_serie_registrar = z.object({
|
||||
tabela: z.string(),
|
||||
colanuEixoX: z.string(),
|
||||
colunaAgrupamento: z.string().array().optional(),
|
||||
agregacao: tiposSeriesAgregacoes,
|
||||
filtro: filtro.array().optional(),
|
||||
})
|
||||
|
||||
export const serie_consultar =
|
||||
|
|
|
|||
|
|
@ -5,7 +5,13 @@ import {
|
|||
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"
|
||||
|
||||
|
|
@ -21,4 +27,6 @@ export const pPilao = {
|
|||
validarZ,
|
||||
deletar_registros,
|
||||
zp_deletar_registros,
|
||||
operadores_pilao,
|
||||
operadores_permitidos_por_tipo,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,22 @@ export const z_tipo_coluna_base_dados = z.enum([
|
|||
"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 z_validar_colunna_base_dados = {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist-import",
|
||||
"target": "ES2015",
|
||||
"target": "ES2020",
|
||||
"module": "ES2015",
|
||||
"declaration": true,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "ES5",
|
||||
"target": "ES2020",
|
||||
"outDir": "./dist-require",
|
||||
"declaration": true,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es5", "es6", "es7", "esnext", "dom"],
|
||||
"target": "es2018",
|
||||
"target": "ES2020",
|
||||
"removeComments": false,
|
||||
"esModuleInterop": true,
|
||||
"moduleResolution": "node",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue