build
This commit is contained in:
parent
a6205f1ab6
commit
e580643abc
40 changed files with 329 additions and 507 deletions
|
|
@ -4,10 +4,8 @@ import type { zAmbiente } from "../ts/ambiente";
|
||||||
type tipoPostCodigoContaSite = {
|
type tipoPostCodigoContaSite = {
|
||||||
site: string;
|
site: string;
|
||||||
};
|
};
|
||||||
export declare const codigoContaSite: ({ ambiente, post, buscar, }: {
|
export declare const codigoContaSite: ({ ambiente, post, }: {
|
||||||
ambiente: z.infer<typeof zAmbiente>;
|
ambiente: z.infer<typeof zAmbiente>;
|
||||||
post: tipoPostCodigoContaSite;
|
post: tipoPostCodigoContaSite;
|
||||||
/** função que conecta com a API */
|
|
||||||
buscar: (url: string, post: tipoPostCodigoContaSite) => Promise<tipoResposta<string>>;
|
|
||||||
}) => Promise<tipoResposta<string>>;
|
}) => Promise<tipoResposta<string>>;
|
||||||
export {};
|
export {};
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
};
|
};
|
||||||
import { respostaComuns } from "p-respostas";
|
import { respostaComuns } from "p-respostas";
|
||||||
import { urlAutenticacao } from "./_urlAutenticacao";
|
import { urlAutenticacao } from "./_urlAutenticacao";
|
||||||
export const codigoContaSite = ({ ambiente, post, buscar, }) => __awaiter(void 0, void 0, void 0, function* () {
|
import node_fetch from "cross-fetch";
|
||||||
|
export const codigoContaSite = ({ ambiente, post, }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const url = `${urlAutenticacao(ambiente)}/api/codigo_prefeitura_site`;
|
const url = `${urlAutenticacao(ambiente)}/api/codigo_prefeitura_site`;
|
||||||
try {
|
try {
|
||||||
const resp = yield buscar(url, post).catch((e) => respostaComuns.erro(`erro ao buscar código do site: ${e}`));
|
const resp = yield node_fetch(url, {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(post),
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
})
|
||||||
|
.then((r) => r.json())
|
||||||
|
.catch((e) => respostaComuns.erro("Erro ao enviar registros", [e.message]))
|
||||||
|
.then((r) => r);
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,7 @@ export type tipoUsuarioExterno = {
|
||||||
codigo_conta: string;
|
codigo_conta: string;
|
||||||
chave_produto: string;
|
chave_produto: string;
|
||||||
};
|
};
|
||||||
export declare const usuarios_quipo_governo: ({ token_produto, ambiente, buscar, }: {
|
export declare const usuarios_quipo_governo: ({ token_produto, ambiente, }: {
|
||||||
ambiente: z.infer<typeof zAmbiente>;
|
ambiente: z.infer<typeof zAmbiente>;
|
||||||
token_produto: string;
|
token_produto: string;
|
||||||
buscar: (url: string, headers: {
|
|
||||||
[k: string]: string;
|
|
||||||
}) => Promise<tipoResposta<tipoUsuarioExterno[]>>;
|
|
||||||
}) => Promise<tipoResposta<tipoUsuarioExterno[]>>;
|
}) => Promise<tipoResposta<tipoUsuarioExterno[]>>;
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
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 = ({ token_produto, ambiente, buscar, }) => __awaiter(void 0, void 0, void 0, function* () {
|
export const usuarios_quipo_governo = ({ token_produto, ambiente, }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
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");
|
||||||
const headers = {
|
const headers = {
|
||||||
token: token_produto,
|
token: token_produto,
|
||||||
};
|
};
|
||||||
return buscar(url, headers).catch((e) => respostaComuns.erro(`erro ao buscar usuários quipo governo: ${e}`));
|
return node_fetch(url, {
|
||||||
|
headers,
|
||||||
|
})
|
||||||
|
.then((r) => r.json())
|
||||||
|
.catch((e) => respostaComuns.erro("Erro ao buscar usuários quipo governo", [e.message]))
|
||||||
|
.then((r) => r);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
5
dist-import/autenticacao/_validarToken.d.ts
vendored
5
dist-import/autenticacao/_validarToken.d.ts
vendored
|
|
@ -1,14 +1,11 @@
|
||||||
import type { tipoResposta } from "p-respostas";
|
|
||||||
type tipoPostValidarTokem = {
|
type tipoPostValidarTokem = {
|
||||||
token: string;
|
token: string;
|
||||||
};
|
};
|
||||||
import type { z } from "zod";
|
import type { z } from "zod";
|
||||||
import type { zAmbiente } from "../ts/ambiente";
|
import type { zAmbiente } from "../ts/ambiente";
|
||||||
/** faz a validação do token */
|
/** faz a validação do token */
|
||||||
export declare const validarToken: ({ ambiente, post, buscar, }: {
|
export declare const validarToken: ({ ambiente, post, }: {
|
||||||
ambiente: z.infer<typeof zAmbiente>;
|
ambiente: z.infer<typeof zAmbiente>;
|
||||||
post: tipoPostValidarTokem;
|
post: tipoPostValidarTokem;
|
||||||
/** função que conecta com a API */
|
|
||||||
buscar: (url: string, post: tipoPostValidarTokem) => Promise<tipoResposta<any>>;
|
|
||||||
}) => Promise<"valido" | "erro">;
|
}) => Promise<"valido" | "erro">;
|
||||||
export {};
|
export {};
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
import { urlAutenticacao } from "./_urlAutenticacao";
|
import { urlAutenticacao } from "./_urlAutenticacao";
|
||||||
|
import node_fetch from "cross-fetch";
|
||||||
/** faz a validação do token */
|
/** faz a validação do token */
|
||||||
export const validarToken = ({ ambiente, post, buscar, }) => __awaiter(void 0, void 0, void 0, function* () {
|
export const validarToken = ({ ambiente, post, }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const url = `${urlAutenticacao(ambiente)}/api/validar_token`;
|
const url = `${urlAutenticacao(ambiente)}/api/validar_token`;
|
||||||
try {
|
try {
|
||||||
const resposta = yield buscar(url, post)
|
const resposta = yield node_fetch(url, {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(post),
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
})
|
||||||
|
.then((r) => r.json())
|
||||||
|
.then((r) => r)
|
||||||
.then((resposta) => resposta.eCerto ? "valido" : "erro")
|
.then((resposta) => resposta.eCerto ? "valido" : "erro")
|
||||||
.catch(() => "erro");
|
.catch(() => "erro");
|
||||||
return resposta;
|
return resposta;
|
||||||
|
|
|
||||||
15
dist-import/autenticacao/index.d.ts
vendored
15
dist-import/autenticacao/index.d.ts
vendored
|
|
@ -2,30 +2,21 @@ import { type tipoUsuarioExterno } from "./_usuarios_quipo_governo";
|
||||||
export type { tipoUsuarioExterno };
|
export type { tipoUsuarioExterno };
|
||||||
/** todas as rotas de comunicação com autenticador partem dessa variável */
|
/** todas as rotas de comunicação com autenticador partem dessa variável */
|
||||||
export declare const pAutenticacao: {
|
export declare const pAutenticacao: {
|
||||||
validarToken: ({ ambiente, post, buscar, }: {
|
validarToken: ({ ambiente, post, }: {
|
||||||
ambiente: "desenvolvimento" | "producao";
|
ambiente: "desenvolvimento" | "producao";
|
||||||
post: {
|
post: {
|
||||||
token: string;
|
token: string;
|
||||||
};
|
};
|
||||||
buscar: (url: string, post: {
|
|
||||||
token: string;
|
|
||||||
}) => Promise<import("p-respostas").tipoResposta<any>>;
|
|
||||||
}) => Promise<"valido" | "erro">;
|
}) => Promise<"valido" | "erro">;
|
||||||
urlAutenticacao: (ambiente: "desenvolvimento" | "producao") => string;
|
urlAutenticacao: (ambiente: "desenvolvimento" | "producao") => string;
|
||||||
codigoContaSite: ({ ambiente, post, buscar, }: {
|
codigoContaSite: ({ ambiente, post, }: {
|
||||||
ambiente: "desenvolvimento" | "producao";
|
ambiente: "desenvolvimento" | "producao";
|
||||||
post: {
|
post: {
|
||||||
site: string;
|
site: string;
|
||||||
};
|
};
|
||||||
buscar: (url: string, post: {
|
|
||||||
site: string;
|
|
||||||
}) => Promise<import("p-respostas").tipoResposta<string>>;
|
|
||||||
}) => Promise<import("p-respostas").tipoResposta<string>>;
|
}) => Promise<import("p-respostas").tipoResposta<string>>;
|
||||||
usuarios_quipo_governo: ({ token_produto, ambiente, buscar, }: {
|
usuarios_quipo_governo: ({ token_produto, ambiente, }: {
|
||||||
ambiente: "desenvolvimento" | "producao";
|
ambiente: "desenvolvimento" | "producao";
|
||||||
token_produto: string;
|
token_produto: string;
|
||||||
buscar: (url: string, headers: {
|
|
||||||
[k: string]: string;
|
|
||||||
}) => Promise<import("p-respostas").tipoResposta<tipoUsuarioExterno[]>>;
|
|
||||||
}) => Promise<import("p-respostas").tipoResposta<tipoUsuarioExterno[]>>;
|
}) => Promise<import("p-respostas").tipoResposta<tipoUsuarioExterno[]>>;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
2
dist-import/pilao-de-dados/_variaveis.d.ts
vendored
2
dist-import/pilao-de-dados/_variaveis.d.ts
vendored
|
|
@ -12,7 +12,7 @@ export declare const zp_produto_conta: z.ZodObject<{
|
||||||
produto: string;
|
produto: string;
|
||||||
conta: string;
|
conta: string;
|
||||||
}>;
|
}>;
|
||||||
export declare const z_tipo_coluna_base_dados: z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero"]>;
|
export declare const z_tipo_coluna_base_dados: z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "data", "mes"]>;
|
||||||
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>;
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ export const z_tipo_coluna_base_dados = z.enum([
|
||||||
"confirmacao",
|
"confirmacao",
|
||||||
"lista_texto",
|
"lista_texto",
|
||||||
"lista_numero",
|
"lista_numero",
|
||||||
|
"data",
|
||||||
|
"mes",
|
||||||
]);
|
]);
|
||||||
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 = {
|
||||||
|
|
|
||||||
20
dist-import/pilao-de-dados/enviar_registros.d.ts
vendored
20
dist-import/pilao-de-dados/enviar_registros.d.ts
vendored
|
|
@ -5,50 +5,50 @@ export declare const zp_registrar_base_dados: z.ZodObject<{
|
||||||
tabela: z.ZodString;
|
tabela: z.ZodString;
|
||||||
colunas: z.ZodArray<z.ZodObject<{
|
colunas: z.ZodArray<z.ZodObject<{
|
||||||
coluna: z.ZodString;
|
coluna: z.ZodString;
|
||||||
tipo: z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero"]>;
|
tipo: z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "data", "mes"]>;
|
||||||
}, "strip", z.ZodTypeAny, {
|
}, "strip", z.ZodTypeAny, {
|
||||||
coluna: string;
|
coluna: string;
|
||||||
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
|
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
|
||||||
}, {
|
}, {
|
||||||
coluna: string;
|
coluna: string;
|
||||||
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
|
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
|
||||||
}>, "many">;
|
}>, "many">;
|
||||||
}, "strip", z.ZodTypeAny, {
|
}, "strip", z.ZodTypeAny, {
|
||||||
tabela: string;
|
tabela: string;
|
||||||
colunas: {
|
colunas: {
|
||||||
coluna: string;
|
coluna: string;
|
||||||
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
|
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
|
||||||
}[];
|
}[];
|
||||||
}, {
|
}, {
|
||||||
tabela: string;
|
tabela: string;
|
||||||
colunas: {
|
colunas: {
|
||||||
coluna: string;
|
coluna: string;
|
||||||
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
|
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
|
||||||
}[];
|
}[];
|
||||||
}>;
|
}>;
|
||||||
export declare const zp_enviar_registros: z.ZodObject<{
|
export declare const zp_enviar_registros: z.ZodObject<{
|
||||||
tabela: z.ZodString;
|
tabela: z.ZodString;
|
||||||
registros: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodObject<{
|
registros: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodObject<{
|
||||||
valor: z.ZodAny;
|
valor: z.ZodAny;
|
||||||
tipo: z.ZodNullable<z.ZodOptional<z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero"]>>>;
|
tipo: z.ZodNullable<z.ZodOptional<z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "data", "mes"]>>>;
|
||||||
}, "strip", z.ZodTypeAny, {
|
}, "strip", z.ZodTypeAny, {
|
||||||
valor?: any;
|
valor?: any;
|
||||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
|
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
|
||||||
}, {
|
}, {
|
||||||
valor?: any;
|
valor?: any;
|
||||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
|
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
|
||||||
}>>, "many">;
|
}>>, "many">;
|
||||||
}, "strip", z.ZodTypeAny, {
|
}, "strip", z.ZodTypeAny, {
|
||||||
tabela: string;
|
tabela: string;
|
||||||
registros: Record<string, {
|
registros: Record<string, {
|
||||||
valor?: any;
|
valor?: any;
|
||||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
|
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
|
||||||
}>[];
|
}>[];
|
||||||
}, {
|
}, {
|
||||||
tabela: string;
|
tabela: string;
|
||||||
registros: Record<string, {
|
registros: Record<string, {
|
||||||
valor?: any;
|
valor?: any;
|
||||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
|
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
|
||||||
}>[];
|
}>[];
|
||||||
}>;
|
}>;
|
||||||
export declare const enviar_registros: ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { registros, tabela }, }: {
|
export declare const enviar_registros: ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { registros, tabela }, }: {
|
||||||
|
|
|
||||||
78
dist-import/pilao-de-dados/index.d.ts
vendored
78
dist-import/pilao-de-dados/index.d.ts
vendored
|
|
@ -5,25 +5,25 @@ export declare const pPilao: {
|
||||||
tabela: import("zod").ZodString;
|
tabela: import("zod").ZodString;
|
||||||
colunas: import("zod").ZodArray<import("zod").ZodObject<{
|
colunas: import("zod").ZodArray<import("zod").ZodObject<{
|
||||||
coluna: import("zod").ZodString;
|
coluna: import("zod").ZodString;
|
||||||
tipo: import("zod").ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero"]>;
|
tipo: import("zod").ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "data", "mes"]>;
|
||||||
}, "strip", import("zod").ZodTypeAny, {
|
}, "strip", import("zod").ZodTypeAny, {
|
||||||
coluna: string;
|
coluna: string;
|
||||||
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
|
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
|
||||||
}, {
|
}, {
|
||||||
coluna: string;
|
coluna: string;
|
||||||
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
|
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
|
||||||
}>, "many">;
|
}>, "many">;
|
||||||
}, "strip", import("zod").ZodTypeAny, {
|
}, "strip", import("zod").ZodTypeAny, {
|
||||||
tabela: string;
|
tabela: string;
|
||||||
colunas: {
|
colunas: {
|
||||||
coluna: string;
|
coluna: string;
|
||||||
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
|
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
|
||||||
}[];
|
}[];
|
||||||
}, {
|
}, {
|
||||||
tabela: string;
|
tabela: string;
|
||||||
colunas: {
|
colunas: {
|
||||||
coluna: string;
|
coluna: string;
|
||||||
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
|
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
|
||||||
}[];
|
}[];
|
||||||
}>;
|
}>;
|
||||||
enviar_registros: ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { registros, tabela }, }: {
|
enviar_registros: ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { registros, tabela }, }: {
|
||||||
|
|
@ -36,7 +36,7 @@ export declare const pPilao: {
|
||||||
tabela: string;
|
tabela: string;
|
||||||
registros: Record<string, {
|
registros: Record<string, {
|
||||||
valor?: any;
|
valor?: any;
|
||||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
|
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
|
||||||
}>[];
|
}>[];
|
||||||
};
|
};
|
||||||
}) => Promise<import("p-respostas").tipoResposta<true>>;
|
}) => Promise<import("p-respostas").tipoResposta<true>>;
|
||||||
|
|
@ -44,28 +44,44 @@ export declare const pPilao: {
|
||||||
tabela: import("zod").ZodString;
|
tabela: import("zod").ZodString;
|
||||||
registros: import("zod").ZodArray<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
registros: import("zod").ZodArray<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
||||||
valor: import("zod").ZodAny;
|
valor: import("zod").ZodAny;
|
||||||
tipo: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero"]>>>;
|
tipo: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "data", "mes"]>>>;
|
||||||
}, "strip", import("zod").ZodTypeAny, {
|
}, "strip", import("zod").ZodTypeAny, {
|
||||||
valor?: any;
|
valor?: any;
|
||||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
|
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
|
||||||
}, {
|
}, {
|
||||||
valor?: any;
|
valor?: any;
|
||||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
|
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
|
||||||
}>>, "many">;
|
}>>, "many">;
|
||||||
}, "strip", import("zod").ZodTypeAny, {
|
}, "strip", import("zod").ZodTypeAny, {
|
||||||
tabela: string;
|
tabela: string;
|
||||||
registros: Record<string, {
|
registros: Record<string, {
|
||||||
valor?: any;
|
valor?: any;
|
||||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
|
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
|
||||||
}>[];
|
}>[];
|
||||||
}, {
|
}, {
|
||||||
tabela: string;
|
tabela: string;
|
||||||
registros: Record<string, {
|
registros: Record<string, {
|
||||||
valor?: any;
|
valor?: any;
|
||||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
|
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
|
||||||
}>[];
|
}>[];
|
||||||
}>;
|
}>;
|
||||||
serie_registrar: ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { agregacao, colanuEixoX, colunaAgrupamento, identificador, tabela, }, }: {
|
zp_serie_registrar: import("zod").ZodObject<{
|
||||||
|
tabela: import("zod").ZodString;
|
||||||
|
colanuEixoX: import("zod").ZodString;
|
||||||
|
colunaAgrupamento: import("zod").ZodString;
|
||||||
|
agregacao: import("zod").ZodEnum<["contagem", "somatoria"]>;
|
||||||
|
}, "strip", import("zod").ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaAgrupamento: string;
|
||||||
|
agregacao: "contagem" | "somatoria";
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaAgrupamento: string;
|
||||||
|
agregacao: "contagem" | "somatoria";
|
||||||
|
}>;
|
||||||
|
serie_consultar: ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { agregacao, colanuEixoX, colunaAgrupamento, tabela }, }: {
|
||||||
emDesenvolvimento?: boolean | null | undefined;
|
emDesenvolvimento?: boolean | null | undefined;
|
||||||
cliente: {
|
cliente: {
|
||||||
produto: string;
|
produto: string;
|
||||||
|
|
@ -73,47 +89,16 @@ export declare const pPilao: {
|
||||||
};
|
};
|
||||||
parametros: {
|
parametros: {
|
||||||
tabela: string;
|
tabela: string;
|
||||||
identificador: string;
|
|
||||||
colanuEixoX: string;
|
colanuEixoX: string;
|
||||||
colunaAgrupamento: string;
|
colunaAgrupamento: string;
|
||||||
agregacao: "contagem" | "somatoria";
|
agregacao: "contagem" | "somatoria";
|
||||||
};
|
};
|
||||||
}) => Promise<import("p-respostas").tipoResposta<true>>;
|
|
||||||
zp_serie_registrar: import("zod").ZodObject<{
|
|
||||||
tabela: import("zod").ZodString;
|
|
||||||
identificador: import("zod").ZodString;
|
|
||||||
colanuEixoX: import("zod").ZodString;
|
|
||||||
colunaAgrupamento: import("zod").ZodString;
|
|
||||||
agregacao: import("zod").ZodEnum<["contagem", "somatoria"]>;
|
|
||||||
}, "strip", import("zod").ZodTypeAny, {
|
|
||||||
tabela: string;
|
|
||||||
identificador: string;
|
|
||||||
colanuEixoX: string;
|
|
||||||
colunaAgrupamento: string;
|
|
||||||
agregacao: "contagem" | "somatoria";
|
|
||||||
}, {
|
|
||||||
tabela: string;
|
|
||||||
identificador: string;
|
|
||||||
colanuEixoX: string;
|
|
||||||
colunaAgrupamento: string;
|
|
||||||
agregacao: "contagem" | "somatoria";
|
|
||||||
}>;
|
|
||||||
serie_consultar: ({ emDesenvolvimento, parametros: { identificador }, cliente: { conta, produto }, }: {
|
|
||||||
emDesenvolvimento?: boolean | null | undefined;
|
|
||||||
cliente: {
|
|
||||||
produto: string;
|
|
||||||
conta: string;
|
|
||||||
};
|
|
||||||
parametros: {
|
|
||||||
identificador: string;
|
|
||||||
};
|
|
||||||
}) => {
|
}) => {
|
||||||
dados: () => Promise<import("p-respostas").tipoResposta<{
|
dados: () => Promise<import("p-respostas").tipoResposta<{
|
||||||
registros: any[];
|
registros: any[];
|
||||||
legenda: string;
|
legenda: string;
|
||||||
serie: {
|
serie: {
|
||||||
tabela: string;
|
tabela: string;
|
||||||
identificador: string;
|
|
||||||
colanuEixoX: string;
|
colanuEixoX: string;
|
||||||
colunaAgrupamento: string;
|
colunaAgrupamento: string;
|
||||||
agregacao: "contagem" | "somatoria";
|
agregacao: "contagem" | "somatoria";
|
||||||
|
|
@ -121,13 +106,6 @@ export declare const pPilao: {
|
||||||
}>>;
|
}>>;
|
||||||
url: () => string;
|
url: () => string;
|
||||||
};
|
};
|
||||||
zp_serie_consultar: import("zod").ZodObject<{
|
|
||||||
identificador: import("zod").ZodString;
|
|
||||||
}, "strip", import("zod").ZodTypeAny, {
|
|
||||||
identificador: string;
|
|
||||||
}, {
|
|
||||||
identificador: string;
|
|
||||||
}>;
|
|
||||||
zp_produto_conta: import("zod").ZodObject<{
|
zp_produto_conta: import("zod").ZodObject<{
|
||||||
produto: import("zod").ZodString;
|
produto: import("zod").ZodString;
|
||||||
conta: import("zod").ZodString;
|
conta: import("zod").ZodString;
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,14 @@
|
||||||
import { tiposSeriesAgregacoes, validarZ, zp_produto_conta } from "./_variaveis";
|
import { tiposSeriesAgregacoes, validarZ, zp_produto_conta } from "./_variaveis";
|
||||||
import { deletar_registros, zp_deletar_registros } from "./deletar_registros";
|
import { deletar_registros, zp_deletar_registros } from "./deletar_registros";
|
||||||
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 { serie_consultar, zp_serie_consultar } from "./serie_consultar";
|
import { serie_consultar, zp_serie_registrar } from "./serie_consultar";
|
||||||
import { serie_registrar, zp_serie_registrar } from "./serie_registrar";
|
|
||||||
export { tiposSeriesAgregacoes };
|
export { tiposSeriesAgregacoes };
|
||||||
export const pPilao = {
|
export const pPilao = {
|
||||||
zp_registrar_base_dados,
|
zp_registrar_base_dados,
|
||||||
enviar_registros,
|
enviar_registros,
|
||||||
zp_enviar_registros,
|
zp_enviar_registros,
|
||||||
serie_registrar,
|
|
||||||
zp_serie_registrar,
|
zp_serie_registrar,
|
||||||
serie_consultar,
|
serie_consultar,
|
||||||
zp_serie_consultar,
|
|
||||||
zp_produto_conta,
|
zp_produto_conta,
|
||||||
validarZ,
|
validarZ,
|
||||||
deletar_registros,
|
deletar_registros,
|
||||||
|
|
|
||||||
22
dist-import/pilao-de-dados/serie_consultar.d.ts
vendored
22
dist-import/pilao-de-dados/serie_consultar.d.ts
vendored
|
|
@ -1,19 +1,27 @@
|
||||||
import type { tipoResposta } from "p-respostas";
|
import type { tipoResposta } from "p-respostas";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { type zp_produto_conta } from "./_variaveis";
|
import { type zp_produto_conta } from "./_variaveis";
|
||||||
import type { zp_serie_registrar } from "./serie_registrar";
|
export declare const zp_serie_registrar: z.ZodObject<{
|
||||||
export declare const zp_serie_consultar: z.ZodObject<{
|
tabela: z.ZodString;
|
||||||
identificador: z.ZodString;
|
colanuEixoX: z.ZodString;
|
||||||
|
colunaAgrupamento: z.ZodString;
|
||||||
|
agregacao: z.ZodEnum<["contagem", "somatoria"]>;
|
||||||
}, "strip", z.ZodTypeAny, {
|
}, "strip", z.ZodTypeAny, {
|
||||||
identificador: string;
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaAgrupamento: string;
|
||||||
|
agregacao: "contagem" | "somatoria";
|
||||||
}, {
|
}, {
|
||||||
identificador: string;
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaAgrupamento: string;
|
||||||
|
agregacao: "contagem" | "somatoria";
|
||||||
}>;
|
}>;
|
||||||
export declare const serie_consultar: ({ emDesenvolvimento, parametros: { identificador }, cliente: { conta, produto }, }: {
|
export declare const serie_consultar: ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { agregacao, colanuEixoX, colunaAgrupamento, tabela }, }: {
|
||||||
emDesenvolvimento?: boolean | undefined | null;
|
emDesenvolvimento?: boolean | undefined | null;
|
||||||
/** Identificação do cliente */
|
/** Identificação do cliente */
|
||||||
cliente: z.infer<typeof zp_produto_conta>;
|
cliente: z.infer<typeof zp_produto_conta>;
|
||||||
parametros: z.infer<typeof zp_serie_consultar>;
|
parametros: z.infer<typeof zp_serie_registrar>;
|
||||||
}) => {
|
}) => {
|
||||||
dados: () => Promise<tipoResposta<{
|
dados: () => Promise<tipoResposta<{
|
||||||
registros: any[];
|
registros: any[];
|
||||||
|
|
|
||||||
|
|
@ -11,17 +11,22 @@ 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 { PREFIXO, baseUrlPilao, tiposSeriesAgregacoes, } from "./_variaveis";
|
import { PREFIXO, baseUrlPilao, tiposSeriesAgregacoes, } from "./_variaveis";
|
||||||
//consultar compilação
|
export const zp_serie_registrar = z.object({
|
||||||
export const zp_serie_consultar = z.object({
|
tabela: z.string(),
|
||||||
identificador: z.string(),
|
colanuEixoX: z.string(),
|
||||||
|
colunaAgrupamento: z.string(),
|
||||||
|
agregacao: tiposSeriesAgregacoes,
|
||||||
});
|
});
|
||||||
export const serie_consultar = ({ emDesenvolvimento, parametros: { identificador }, cliente: { conta, produto }, }) => {
|
export const serie_consultar = ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { agregacao, colanuEixoX, colunaAgrupamento, tabela }, }) => {
|
||||||
const dados = () => __awaiter(void 0, void 0, void 0, function* () {
|
const dados = () => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const url = new URL(`${baseUrlPilao(emDesenvolvimento)}${`${PREFIXO}/${tiposSeriesAgregacoes.enum.contagem}/${produto}/${conta}`}`);
|
const url = new URL(`${baseUrlPilao(emDesenvolvimento)}${`${PREFIXO}/${tiposSeriesAgregacoes.enum.contagem}/${produto}/${conta}`}`);
|
||||||
const resp = yield node_fetch(url.toString(), {
|
const resp = yield node_fetch(url.toString(), {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
identificador,
|
agregacao,
|
||||||
|
colanuEixoX,
|
||||||
|
colunaAgrupamento,
|
||||||
|
tabela,
|
||||||
}),
|
}),
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
})
|
})
|
||||||
|
|
@ -31,12 +36,20 @@ export const serie_consultar = ({ emDesenvolvimento, parametros: { identificador
|
||||||
return resp;
|
return resp;
|
||||||
});
|
});
|
||||||
const url = () => {
|
const url = () => {
|
||||||
|
const pr = {
|
||||||
|
produto,
|
||||||
|
conta,
|
||||||
|
agregacao,
|
||||||
|
colanuEixoX,
|
||||||
|
colunaAgrupamento,
|
||||||
|
tabela,
|
||||||
|
};
|
||||||
const vUrl = new URL(`${emDesenvolvimento
|
const vUrl = new URL(`${emDesenvolvimento
|
||||||
? "http://127.0.0.1:5081"
|
? "http://127.0.0.1:5081"
|
||||||
: "https://carro-de-boi.idz.one"}${PREFIXO}/${tiposSeriesAgregacoes.enum.contagem}`);
|
: "https://carro-de-boi.idz.one"}${PREFIXO}/${tiposSeriesAgregacoes.enum.contagem}`);
|
||||||
vUrl.searchParams.append("produto", produto);
|
for (const [k, v] of Object.entries(pr)) {
|
||||||
vUrl.searchParams.append("conta", conta);
|
vUrl.searchParams.append(k, JSON.stringify(v));
|
||||||
vUrl.searchParams.append("identificador", identificador);
|
}
|
||||||
return vUrl.href;
|
return vUrl.href;
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
29
dist-import/pilao-de-dados/serie_registrar.d.ts
vendored
29
dist-import/pilao-de-dados/serie_registrar.d.ts
vendored
|
|
@ -1,29 +0,0 @@
|
||||||
import { type tipoResposta } from "p-respostas";
|
|
||||||
import { z } from "zod";
|
|
||||||
import { type zp_produto_conta } from "./_variaveis";
|
|
||||||
export declare const zp_serie_registrar: z.ZodObject<{
|
|
||||||
tabela: z.ZodString;
|
|
||||||
identificador: z.ZodString;
|
|
||||||
colanuEixoX: z.ZodString;
|
|
||||||
colunaAgrupamento: z.ZodString;
|
|
||||||
agregacao: z.ZodEnum<["contagem", "somatoria"]>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
tabela: string;
|
|
||||||
identificador: string;
|
|
||||||
colanuEixoX: string;
|
|
||||||
colunaAgrupamento: string;
|
|
||||||
agregacao: "contagem" | "somatoria";
|
|
||||||
}, {
|
|
||||||
tabela: string;
|
|
||||||
identificador: string;
|
|
||||||
colanuEixoX: string;
|
|
||||||
colunaAgrupamento: string;
|
|
||||||
agregacao: "contagem" | "somatoria";
|
|
||||||
}>;
|
|
||||||
export declare const serie_registrar: ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { agregacao, colanuEixoX, colunaAgrupamento, identificador, tabela, }, }: {
|
|
||||||
emDesenvolvimento?: boolean | undefined | null;
|
|
||||||
/** Identificação do cliente */
|
|
||||||
cliente: z.infer<typeof zp_produto_conta>;
|
|
||||||
/** Parametros da função */
|
|
||||||
parametros: z.infer<typeof zp_serie_registrar>;
|
|
||||||
}) => Promise<tipoResposta<true>>;
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
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 { PREFIXO, baseUrlPilao, tiposSeriesAgregacoes, } from "./_variaveis";
|
|
||||||
//registrar serie
|
|
||||||
export const zp_serie_registrar = z.object({
|
|
||||||
tabela: z.string(),
|
|
||||||
identificador: z.string(),
|
|
||||||
colanuEixoX: z.string(),
|
|
||||||
colunaAgrupamento: z.string(),
|
|
||||||
agregacao: tiposSeriesAgregacoes,
|
|
||||||
});
|
|
||||||
export const serie_registrar = ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { agregacao, colanuEixoX, colunaAgrupamento, identificador, tabela, }, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
||||||
const url = new URL(`${baseUrlPilao(emDesenvolvimento)}${`${PREFIXO}/${Object.keys({ serie_registrar })[0]}/${produto}/${conta}`}`);
|
|
||||||
const resp = yield node_fetch(url.toString(), {
|
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify({
|
|
||||||
tabela,
|
|
||||||
agregacao,
|
|
||||||
emDesenvolvimento,
|
|
||||||
colanuEixoX,
|
|
||||||
colunaAgrupamento,
|
|
||||||
identificador,
|
|
||||||
}),
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
})
|
|
||||||
.then((r) => r.json())
|
|
||||||
.catch((e) => respostaComuns.erro("Erro ao enviar registros", [e.message]))
|
|
||||||
.then((r) => r);
|
|
||||||
return resp;
|
|
||||||
});
|
|
||||||
|
|
@ -4,10 +4,8 @@ import type { zAmbiente } from "../ts/ambiente";
|
||||||
type tipoPostCodigoContaSite = {
|
type tipoPostCodigoContaSite = {
|
||||||
site: string;
|
site: string;
|
||||||
};
|
};
|
||||||
export declare const codigoContaSite: ({ ambiente, post, buscar, }: {
|
export declare const codigoContaSite: ({ ambiente, post, }: {
|
||||||
ambiente: z.infer<typeof zAmbiente>;
|
ambiente: z.infer<typeof zAmbiente>;
|
||||||
post: tipoPostCodigoContaSite;
|
post: tipoPostCodigoContaSite;
|
||||||
/** função que conecta com a API */
|
|
||||||
buscar: (url: string, post: tipoPostCodigoContaSite) => Promise<tipoResposta<string>>;
|
|
||||||
}) => Promise<tipoResposta<string>>;
|
}) => Promise<tipoResposta<string>>;
|
||||||
export {};
|
export {};
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,16 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
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 });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.codigoContaSite = void 0;
|
exports.codigoContaSite = void 0;
|
||||||
var p_respostas_1 = require("p-respostas");
|
var p_respostas_1 = require("p-respostas");
|
||||||
var _urlAutenticacao_1 = require("./_urlAutenticacao");
|
var _urlAutenticacao_1 = require("./_urlAutenticacao");
|
||||||
|
var cross_fetch_1 = __importDefault(require("cross-fetch"));
|
||||||
var codigoContaSite = function (_a) {
|
var codigoContaSite = function (_a) {
|
||||||
var ambiente = _a.ambiente, post = _a.post, buscar = _a.buscar;
|
var ambiente = _a.ambiente, post = _a.post;
|
||||||
return __awaiter(void 0, void 0, void 0, function () {
|
return __awaiter(void 0, void 0, void 0, function () {
|
||||||
var url, resp, e_1;
|
var url, resp, e_1;
|
||||||
return __generator(this, function (_b) {
|
return __generator(this, function (_b) {
|
||||||
|
|
@ -50,9 +54,16 @@ var codigoContaSite = function (_a) {
|
||||||
_b.label = 1;
|
_b.label = 1;
|
||||||
case 1:
|
case 1:
|
||||||
_b.trys.push([1, 3, , 4]);
|
_b.trys.push([1, 3, , 4]);
|
||||||
return [4 /*yield*/, buscar(url, post).catch(function (e) {
|
return [4 /*yield*/, (0, cross_fetch_1.default)(url, {
|
||||||
return p_respostas_1.respostaComuns.erro("erro ao buscar c\u00F3digo do site: ".concat(e));
|
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:
|
case 2:
|
||||||
resp = _b.sent();
|
resp = _b.sent();
|
||||||
return [2 /*return*/, resp];
|
return [2 /*return*/, resp];
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,7 @@ export type tipoUsuarioExterno = {
|
||||||
codigo_conta: string;
|
codigo_conta: string;
|
||||||
chave_produto: string;
|
chave_produto: string;
|
||||||
};
|
};
|
||||||
export declare const usuarios_quipo_governo: ({ token_produto, ambiente, buscar, }: {
|
export declare const usuarios_quipo_governo: ({ token_produto, ambiente, }: {
|
||||||
ambiente: z.infer<typeof zAmbiente>;
|
ambiente: z.infer<typeof zAmbiente>;
|
||||||
token_produto: string;
|
token_produto: string;
|
||||||
buscar: (url: string, headers: {
|
|
||||||
[k: string]: string;
|
|
||||||
}) => Promise<tipoResposta<tipoUsuarioExterno[]>>;
|
|
||||||
}) => Promise<tipoResposta<tipoUsuarioExterno[]>>;
|
}) => Promise<tipoResposta<tipoUsuarioExterno[]>>;
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,16 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
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 });
|
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"));
|
||||||
var p_respostas_1 = require("p-respostas");
|
var p_respostas_1 = require("p-respostas");
|
||||||
var _urlAutenticacao_1 = require("./_urlAutenticacao");
|
var _urlAutenticacao_1 = require("./_urlAutenticacao");
|
||||||
var usuarios_quipo_governo = function (_a) {
|
var usuarios_quipo_governo = function (_a) {
|
||||||
var token_produto = _a.token_produto, ambiente = _a.ambiente, buscar = _a.buscar;
|
var token_produto = _a.token_produto, ambiente = _a.ambiente;
|
||||||
return __awaiter(void 0, void 0, void 0, function () {
|
return __awaiter(void 0, void 0, void 0, function () {
|
||||||
var url, headers;
|
var url, headers;
|
||||||
return __generator(this, function (_b) {
|
return __generator(this, function (_b) {
|
||||||
|
|
@ -50,9 +54,14 @@ var usuarios_quipo_governo = function (_a) {
|
||||||
headers = {
|
headers = {
|
||||||
token: token_produto,
|
token: token_produto,
|
||||||
};
|
};
|
||||||
return [2 /*return*/, buscar(url, headers).catch(function (e) {
|
return [2 /*return*/, (0, cross_fetch_1.default)(url, {
|
||||||
return p_respostas_1.respostaComuns.erro("erro ao buscar usu\u00E1rios quipo governo: ".concat(e));
|
headers: headers,
|
||||||
})];
|
})
|
||||||
|
.then(function (r) { return r.json(); })
|
||||||
|
.catch(function (e) {
|
||||||
|
return p_respostas_1.respostaComuns.erro("Erro ao buscar usuários quipo governo", [e.message]);
|
||||||
|
})
|
||||||
|
.then(function (r) { return r; })];
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
5
dist-require/autenticacao/_validarToken.d.ts
vendored
5
dist-require/autenticacao/_validarToken.d.ts
vendored
|
|
@ -1,14 +1,11 @@
|
||||||
import type { tipoResposta } from "p-respostas";
|
|
||||||
type tipoPostValidarTokem = {
|
type tipoPostValidarTokem = {
|
||||||
token: string;
|
token: string;
|
||||||
};
|
};
|
||||||
import type { z } from "zod";
|
import type { z } from "zod";
|
||||||
import type { zAmbiente } from "../ts/ambiente";
|
import type { zAmbiente } from "../ts/ambiente";
|
||||||
/** faz a validação do token */
|
/** faz a validação do token */
|
||||||
export declare const validarToken: ({ ambiente, post, buscar, }: {
|
export declare const validarToken: ({ ambiente, post, }: {
|
||||||
ambiente: z.infer<typeof zAmbiente>;
|
ambiente: z.infer<typeof zAmbiente>;
|
||||||
post: tipoPostValidarTokem;
|
post: tipoPostValidarTokem;
|
||||||
/** função que conecta com a API */
|
|
||||||
buscar: (url: string, post: tipoPostValidarTokem) => Promise<tipoResposta<any>>;
|
|
||||||
}) => Promise<"valido" | "erro">;
|
}) => Promise<"valido" | "erro">;
|
||||||
export {};
|
export {};
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,16 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
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 });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.validarToken = void 0;
|
exports.validarToken = void 0;
|
||||||
var _urlAutenticacao_1 = require("./_urlAutenticacao");
|
var _urlAutenticacao_1 = require("./_urlAutenticacao");
|
||||||
|
var cross_fetch_1 = __importDefault(require("cross-fetch"));
|
||||||
/** faz a validação do token */
|
/** faz a validação do token */
|
||||||
var validarToken = function (_a) {
|
var validarToken = function (_a) {
|
||||||
var ambiente = _a.ambiente, post = _a.post, buscar = _a.buscar;
|
var ambiente = _a.ambiente, post = _a.post;
|
||||||
return __awaiter(void 0, void 0, void 0, function () {
|
return __awaiter(void 0, void 0, void 0, function () {
|
||||||
var url, resposta, e_1;
|
var url, resposta, e_1;
|
||||||
return __generator(this, function (_b) {
|
return __generator(this, function (_b) {
|
||||||
|
|
@ -50,7 +54,13 @@ var validarToken = function (_a) {
|
||||||
_b.label = 1;
|
_b.label = 1;
|
||||||
case 1:
|
case 1:
|
||||||
_b.trys.push([1, 3, , 4]);
|
_b.trys.push([1, 3, , 4]);
|
||||||
return [4 /*yield*/, buscar(url, post)
|
return [4 /*yield*/, (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) {
|
.then(function (resposta) {
|
||||||
return resposta.eCerto ? "valido" : "erro";
|
return resposta.eCerto ? "valido" : "erro";
|
||||||
})
|
})
|
||||||
|
|
|
||||||
15
dist-require/autenticacao/index.d.ts
vendored
15
dist-require/autenticacao/index.d.ts
vendored
|
|
@ -2,30 +2,21 @@ import { type tipoUsuarioExterno } from "./_usuarios_quipo_governo";
|
||||||
export type { tipoUsuarioExterno };
|
export type { tipoUsuarioExterno };
|
||||||
/** todas as rotas de comunicação com autenticador partem dessa variável */
|
/** todas as rotas de comunicação com autenticador partem dessa variável */
|
||||||
export declare const pAutenticacao: {
|
export declare const pAutenticacao: {
|
||||||
validarToken: ({ ambiente, post, buscar, }: {
|
validarToken: ({ ambiente, post, }: {
|
||||||
ambiente: "desenvolvimento" | "producao";
|
ambiente: "desenvolvimento" | "producao";
|
||||||
post: {
|
post: {
|
||||||
token: string;
|
token: string;
|
||||||
};
|
};
|
||||||
buscar: (url: string, post: {
|
|
||||||
token: string;
|
|
||||||
}) => Promise<import("p-respostas").tipoResposta<any>>;
|
|
||||||
}) => Promise<"valido" | "erro">;
|
}) => Promise<"valido" | "erro">;
|
||||||
urlAutenticacao: (ambiente: "desenvolvimento" | "producao") => string;
|
urlAutenticacao: (ambiente: "desenvolvimento" | "producao") => string;
|
||||||
codigoContaSite: ({ ambiente, post, buscar, }: {
|
codigoContaSite: ({ ambiente, post, }: {
|
||||||
ambiente: "desenvolvimento" | "producao";
|
ambiente: "desenvolvimento" | "producao";
|
||||||
post: {
|
post: {
|
||||||
site: string;
|
site: string;
|
||||||
};
|
};
|
||||||
buscar: (url: string, post: {
|
|
||||||
site: string;
|
|
||||||
}) => Promise<import("p-respostas").tipoResposta<string>>;
|
|
||||||
}) => Promise<import("p-respostas").tipoResposta<string>>;
|
}) => Promise<import("p-respostas").tipoResposta<string>>;
|
||||||
usuarios_quipo_governo: ({ token_produto, ambiente, buscar, }: {
|
usuarios_quipo_governo: ({ token_produto, ambiente, }: {
|
||||||
ambiente: "desenvolvimento" | "producao";
|
ambiente: "desenvolvimento" | "producao";
|
||||||
token_produto: string;
|
token_produto: string;
|
||||||
buscar: (url: string, headers: {
|
|
||||||
[k: string]: string;
|
|
||||||
}) => Promise<import("p-respostas").tipoResposta<tipoUsuarioExterno[]>>;
|
|
||||||
}) => Promise<import("p-respostas").tipoResposta<tipoUsuarioExterno[]>>;
|
}) => Promise<import("p-respostas").tipoResposta<tipoUsuarioExterno[]>>;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
2
dist-require/pilao-de-dados/_variaveis.d.ts
vendored
2
dist-require/pilao-de-dados/_variaveis.d.ts
vendored
|
|
@ -12,7 +12,7 @@ export declare const zp_produto_conta: z.ZodObject<{
|
||||||
produto: string;
|
produto: string;
|
||||||
conta: string;
|
conta: string;
|
||||||
}>;
|
}>;
|
||||||
export declare const z_tipo_coluna_base_dados: z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero"]>;
|
export declare const z_tipo_coluna_base_dados: z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "data", "mes"]>;
|
||||||
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>;
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,8 @@ exports.z_tipo_coluna_base_dados = zod_1.z.enum([
|
||||||
"confirmacao",
|
"confirmacao",
|
||||||
"lista_texto",
|
"lista_texto",
|
||||||
"lista_numero",
|
"lista_numero",
|
||||||
|
"data",
|
||||||
|
"mes",
|
||||||
]);
|
]);
|
||||||
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 = {
|
||||||
|
|
|
||||||
|
|
@ -5,50 +5,50 @@ export declare const zp_registrar_base_dados: z.ZodObject<{
|
||||||
tabela: z.ZodString;
|
tabela: z.ZodString;
|
||||||
colunas: z.ZodArray<z.ZodObject<{
|
colunas: z.ZodArray<z.ZodObject<{
|
||||||
coluna: z.ZodString;
|
coluna: z.ZodString;
|
||||||
tipo: z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero"]>;
|
tipo: z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "data", "mes"]>;
|
||||||
}, "strip", z.ZodTypeAny, {
|
}, "strip", z.ZodTypeAny, {
|
||||||
coluna: string;
|
coluna: string;
|
||||||
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
|
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
|
||||||
}, {
|
}, {
|
||||||
coluna: string;
|
coluna: string;
|
||||||
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
|
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
|
||||||
}>, "many">;
|
}>, "many">;
|
||||||
}, "strip", z.ZodTypeAny, {
|
}, "strip", z.ZodTypeAny, {
|
||||||
tabela: string;
|
tabela: string;
|
||||||
colunas: {
|
colunas: {
|
||||||
coluna: string;
|
coluna: string;
|
||||||
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
|
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
|
||||||
}[];
|
}[];
|
||||||
}, {
|
}, {
|
||||||
tabela: string;
|
tabela: string;
|
||||||
colunas: {
|
colunas: {
|
||||||
coluna: string;
|
coluna: string;
|
||||||
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
|
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
|
||||||
}[];
|
}[];
|
||||||
}>;
|
}>;
|
||||||
export declare const zp_enviar_registros: z.ZodObject<{
|
export declare const zp_enviar_registros: z.ZodObject<{
|
||||||
tabela: z.ZodString;
|
tabela: z.ZodString;
|
||||||
registros: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodObject<{
|
registros: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodObject<{
|
||||||
valor: z.ZodAny;
|
valor: z.ZodAny;
|
||||||
tipo: z.ZodNullable<z.ZodOptional<z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero"]>>>;
|
tipo: z.ZodNullable<z.ZodOptional<z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "data", "mes"]>>>;
|
||||||
}, "strip", z.ZodTypeAny, {
|
}, "strip", z.ZodTypeAny, {
|
||||||
valor?: any;
|
valor?: any;
|
||||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
|
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
|
||||||
}, {
|
}, {
|
||||||
valor?: any;
|
valor?: any;
|
||||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
|
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
|
||||||
}>>, "many">;
|
}>>, "many">;
|
||||||
}, "strip", z.ZodTypeAny, {
|
}, "strip", z.ZodTypeAny, {
|
||||||
tabela: string;
|
tabela: string;
|
||||||
registros: Record<string, {
|
registros: Record<string, {
|
||||||
valor?: any;
|
valor?: any;
|
||||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
|
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
|
||||||
}>[];
|
}>[];
|
||||||
}, {
|
}, {
|
||||||
tabela: string;
|
tabela: string;
|
||||||
registros: Record<string, {
|
registros: Record<string, {
|
||||||
valor?: any;
|
valor?: any;
|
||||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
|
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
|
||||||
}>[];
|
}>[];
|
||||||
}>;
|
}>;
|
||||||
export declare const enviar_registros: ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { registros, tabela }, }: {
|
export declare const enviar_registros: ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { registros, tabela }, }: {
|
||||||
|
|
|
||||||
78
dist-require/pilao-de-dados/index.d.ts
vendored
78
dist-require/pilao-de-dados/index.d.ts
vendored
|
|
@ -5,25 +5,25 @@ export declare const pPilao: {
|
||||||
tabela: import("zod").ZodString;
|
tabela: import("zod").ZodString;
|
||||||
colunas: import("zod").ZodArray<import("zod").ZodObject<{
|
colunas: import("zod").ZodArray<import("zod").ZodObject<{
|
||||||
coluna: import("zod").ZodString;
|
coluna: import("zod").ZodString;
|
||||||
tipo: import("zod").ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero"]>;
|
tipo: import("zod").ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "data", "mes"]>;
|
||||||
}, "strip", import("zod").ZodTypeAny, {
|
}, "strip", import("zod").ZodTypeAny, {
|
||||||
coluna: string;
|
coluna: string;
|
||||||
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
|
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
|
||||||
}, {
|
}, {
|
||||||
coluna: string;
|
coluna: string;
|
||||||
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
|
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
|
||||||
}>, "many">;
|
}>, "many">;
|
||||||
}, "strip", import("zod").ZodTypeAny, {
|
}, "strip", import("zod").ZodTypeAny, {
|
||||||
tabela: string;
|
tabela: string;
|
||||||
colunas: {
|
colunas: {
|
||||||
coluna: string;
|
coluna: string;
|
||||||
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
|
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
|
||||||
}[];
|
}[];
|
||||||
}, {
|
}, {
|
||||||
tabela: string;
|
tabela: string;
|
||||||
colunas: {
|
colunas: {
|
||||||
coluna: string;
|
coluna: string;
|
||||||
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
|
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
|
||||||
}[];
|
}[];
|
||||||
}>;
|
}>;
|
||||||
enviar_registros: ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { registros, tabela }, }: {
|
enviar_registros: ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { registros, tabela }, }: {
|
||||||
|
|
@ -36,7 +36,7 @@ export declare const pPilao: {
|
||||||
tabela: string;
|
tabela: string;
|
||||||
registros: Record<string, {
|
registros: Record<string, {
|
||||||
valor?: any;
|
valor?: any;
|
||||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
|
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
|
||||||
}>[];
|
}>[];
|
||||||
};
|
};
|
||||||
}) => Promise<import("p-respostas").tipoResposta<true>>;
|
}) => Promise<import("p-respostas").tipoResposta<true>>;
|
||||||
|
|
@ -44,28 +44,44 @@ export declare const pPilao: {
|
||||||
tabela: import("zod").ZodString;
|
tabela: import("zod").ZodString;
|
||||||
registros: import("zod").ZodArray<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
registros: import("zod").ZodArray<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
||||||
valor: import("zod").ZodAny;
|
valor: import("zod").ZodAny;
|
||||||
tipo: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero"]>>>;
|
tipo: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "data", "mes"]>>>;
|
||||||
}, "strip", import("zod").ZodTypeAny, {
|
}, "strip", import("zod").ZodTypeAny, {
|
||||||
valor?: any;
|
valor?: any;
|
||||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
|
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
|
||||||
}, {
|
}, {
|
||||||
valor?: any;
|
valor?: any;
|
||||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
|
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
|
||||||
}>>, "many">;
|
}>>, "many">;
|
||||||
}, "strip", import("zod").ZodTypeAny, {
|
}, "strip", import("zod").ZodTypeAny, {
|
||||||
tabela: string;
|
tabela: string;
|
||||||
registros: Record<string, {
|
registros: Record<string, {
|
||||||
valor?: any;
|
valor?: any;
|
||||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
|
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
|
||||||
}>[];
|
}>[];
|
||||||
}, {
|
}, {
|
||||||
tabela: string;
|
tabela: string;
|
||||||
registros: Record<string, {
|
registros: Record<string, {
|
||||||
valor?: any;
|
valor?: any;
|
||||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
|
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
|
||||||
}>[];
|
}>[];
|
||||||
}>;
|
}>;
|
||||||
serie_registrar: ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { agregacao, colanuEixoX, colunaAgrupamento, identificador, tabela, }, }: {
|
zp_serie_registrar: import("zod").ZodObject<{
|
||||||
|
tabela: import("zod").ZodString;
|
||||||
|
colanuEixoX: import("zod").ZodString;
|
||||||
|
colunaAgrupamento: import("zod").ZodString;
|
||||||
|
agregacao: import("zod").ZodEnum<["contagem", "somatoria"]>;
|
||||||
|
}, "strip", import("zod").ZodTypeAny, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaAgrupamento: string;
|
||||||
|
agregacao: "contagem" | "somatoria";
|
||||||
|
}, {
|
||||||
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaAgrupamento: string;
|
||||||
|
agregacao: "contagem" | "somatoria";
|
||||||
|
}>;
|
||||||
|
serie_consultar: ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { agregacao, colanuEixoX, colunaAgrupamento, tabela }, }: {
|
||||||
emDesenvolvimento?: boolean | null | undefined;
|
emDesenvolvimento?: boolean | null | undefined;
|
||||||
cliente: {
|
cliente: {
|
||||||
produto: string;
|
produto: string;
|
||||||
|
|
@ -73,47 +89,16 @@ export declare const pPilao: {
|
||||||
};
|
};
|
||||||
parametros: {
|
parametros: {
|
||||||
tabela: string;
|
tabela: string;
|
||||||
identificador: string;
|
|
||||||
colanuEixoX: string;
|
colanuEixoX: string;
|
||||||
colunaAgrupamento: string;
|
colunaAgrupamento: string;
|
||||||
agregacao: "contagem" | "somatoria";
|
agregacao: "contagem" | "somatoria";
|
||||||
};
|
};
|
||||||
}) => Promise<import("p-respostas").tipoResposta<true>>;
|
|
||||||
zp_serie_registrar: import("zod").ZodObject<{
|
|
||||||
tabela: import("zod").ZodString;
|
|
||||||
identificador: import("zod").ZodString;
|
|
||||||
colanuEixoX: import("zod").ZodString;
|
|
||||||
colunaAgrupamento: import("zod").ZodString;
|
|
||||||
agregacao: import("zod").ZodEnum<["contagem", "somatoria"]>;
|
|
||||||
}, "strip", import("zod").ZodTypeAny, {
|
|
||||||
tabela: string;
|
|
||||||
identificador: string;
|
|
||||||
colanuEixoX: string;
|
|
||||||
colunaAgrupamento: string;
|
|
||||||
agregacao: "contagem" | "somatoria";
|
|
||||||
}, {
|
|
||||||
tabela: string;
|
|
||||||
identificador: string;
|
|
||||||
colanuEixoX: string;
|
|
||||||
colunaAgrupamento: string;
|
|
||||||
agregacao: "contagem" | "somatoria";
|
|
||||||
}>;
|
|
||||||
serie_consultar: ({ emDesenvolvimento, parametros: { identificador }, cliente: { conta, produto }, }: {
|
|
||||||
emDesenvolvimento?: boolean | null | undefined;
|
|
||||||
cliente: {
|
|
||||||
produto: string;
|
|
||||||
conta: string;
|
|
||||||
};
|
|
||||||
parametros: {
|
|
||||||
identificador: string;
|
|
||||||
};
|
|
||||||
}) => {
|
}) => {
|
||||||
dados: () => Promise<import("p-respostas").tipoResposta<{
|
dados: () => Promise<import("p-respostas").tipoResposta<{
|
||||||
registros: any[];
|
registros: any[];
|
||||||
legenda: string;
|
legenda: string;
|
||||||
serie: {
|
serie: {
|
||||||
tabela: string;
|
tabela: string;
|
||||||
identificador: string;
|
|
||||||
colanuEixoX: string;
|
colanuEixoX: string;
|
||||||
colunaAgrupamento: string;
|
colunaAgrupamento: string;
|
||||||
agregacao: "contagem" | "somatoria";
|
agregacao: "contagem" | "somatoria";
|
||||||
|
|
@ -121,13 +106,6 @@ export declare const pPilao: {
|
||||||
}>>;
|
}>>;
|
||||||
url: () => string;
|
url: () => string;
|
||||||
};
|
};
|
||||||
zp_serie_consultar: import("zod").ZodObject<{
|
|
||||||
identificador: import("zod").ZodString;
|
|
||||||
}, "strip", import("zod").ZodTypeAny, {
|
|
||||||
identificador: string;
|
|
||||||
}, {
|
|
||||||
identificador: string;
|
|
||||||
}>;
|
|
||||||
zp_produto_conta: import("zod").ZodObject<{
|
zp_produto_conta: import("zod").ZodObject<{
|
||||||
produto: import("zod").ZodString;
|
produto: import("zod").ZodString;
|
||||||
conta: import("zod").ZodString;
|
conta: import("zod").ZodString;
|
||||||
|
|
|
||||||
|
|
@ -6,15 +6,12 @@ Object.defineProperty(exports, "tiposSeriesAgregacoes", { enumerable: true, get:
|
||||||
var deletar_registros_1 = require("./deletar_registros");
|
var deletar_registros_1 = require("./deletar_registros");
|
||||||
var enviar_registros_1 = require("./enviar_registros");
|
var enviar_registros_1 = require("./enviar_registros");
|
||||||
var serie_consultar_1 = require("./serie_consultar");
|
var serie_consultar_1 = require("./serie_consultar");
|
||||||
var serie_registrar_1 = require("./serie_registrar");
|
|
||||||
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,
|
||||||
zp_enviar_registros: enviar_registros_1.zp_enviar_registros,
|
zp_enviar_registros: enviar_registros_1.zp_enviar_registros,
|
||||||
serie_registrar: serie_registrar_1.serie_registrar,
|
zp_serie_registrar: serie_consultar_1.zp_serie_registrar,
|
||||||
zp_serie_registrar: serie_registrar_1.zp_serie_registrar,
|
|
||||||
serie_consultar: serie_consultar_1.serie_consultar,
|
serie_consultar: serie_consultar_1.serie_consultar,
|
||||||
zp_serie_consultar: serie_consultar_1.zp_serie_consultar,
|
|
||||||
zp_produto_conta: _variaveis_1.zp_produto_conta,
|
zp_produto_conta: _variaveis_1.zp_produto_conta,
|
||||||
validarZ: _variaveis_1.validarZ,
|
validarZ: _variaveis_1.validarZ,
|
||||||
deletar_registros: deletar_registros_1.deletar_registros,
|
deletar_registros: deletar_registros_1.deletar_registros,
|
||||||
|
|
|
||||||
22
dist-require/pilao-de-dados/serie_consultar.d.ts
vendored
22
dist-require/pilao-de-dados/serie_consultar.d.ts
vendored
|
|
@ -1,19 +1,27 @@
|
||||||
import type { tipoResposta } from "p-respostas";
|
import type { tipoResposta } from "p-respostas";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { type zp_produto_conta } from "./_variaveis";
|
import { type zp_produto_conta } from "./_variaveis";
|
||||||
import type { zp_serie_registrar } from "./serie_registrar";
|
export declare const zp_serie_registrar: z.ZodObject<{
|
||||||
export declare const zp_serie_consultar: z.ZodObject<{
|
tabela: z.ZodString;
|
||||||
identificador: z.ZodString;
|
colanuEixoX: z.ZodString;
|
||||||
|
colunaAgrupamento: z.ZodString;
|
||||||
|
agregacao: z.ZodEnum<["contagem", "somatoria"]>;
|
||||||
}, "strip", z.ZodTypeAny, {
|
}, "strip", z.ZodTypeAny, {
|
||||||
identificador: string;
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaAgrupamento: string;
|
||||||
|
agregacao: "contagem" | "somatoria";
|
||||||
}, {
|
}, {
|
||||||
identificador: string;
|
tabela: string;
|
||||||
|
colanuEixoX: string;
|
||||||
|
colunaAgrupamento: string;
|
||||||
|
agregacao: "contagem" | "somatoria";
|
||||||
}>;
|
}>;
|
||||||
export declare const serie_consultar: ({ emDesenvolvimento, parametros: { identificador }, cliente: { conta, produto }, }: {
|
export declare const serie_consultar: ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { agregacao, colanuEixoX, colunaAgrupamento, tabela }, }: {
|
||||||
emDesenvolvimento?: boolean | undefined | null;
|
emDesenvolvimento?: boolean | undefined | null;
|
||||||
/** Identificação do cliente */
|
/** Identificação do cliente */
|
||||||
cliente: z.infer<typeof zp_produto_conta>;
|
cliente: z.infer<typeof zp_produto_conta>;
|
||||||
parametros: z.infer<typeof zp_serie_consultar>;
|
parametros: z.infer<typeof zp_serie_registrar>;
|
||||||
}) => {
|
}) => {
|
||||||
dados: () => Promise<tipoResposta<{
|
dados: () => Promise<tipoResposta<{
|
||||||
registros: any[];
|
registros: any[];
|
||||||
|
|
|
||||||
|
|
@ -35,21 +35,50 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
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;
|
||||||
|
};
|
||||||
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_consultar = void 0;
|
exports.serie_consultar = exports.zp_serie_registrar = void 0;
|
||||||
var cross_fetch_1 = __importDefault(require("cross-fetch"));
|
var cross_fetch_1 = __importDefault(require("cross-fetch"));
|
||||||
var p_respostas_1 = require("p-respostas");
|
var p_respostas_1 = require("p-respostas");
|
||||||
var zod_1 = require("zod");
|
var zod_1 = require("zod");
|
||||||
var _variaveis_1 = require("./_variaveis");
|
var _variaveis_1 = require("./_variaveis");
|
||||||
//consultar compilação
|
exports.zp_serie_registrar = zod_1.z.object({
|
||||||
exports.zp_serie_consultar = zod_1.z.object({
|
tabela: zod_1.z.string(),
|
||||||
identificador: zod_1.z.string(),
|
colanuEixoX: zod_1.z.string(),
|
||||||
|
colunaAgrupamento: zod_1.z.string(),
|
||||||
|
agregacao: _variaveis_1.tiposSeriesAgregacoes,
|
||||||
});
|
});
|
||||||
var serie_consultar = function (_a) {
|
var serie_consultar = function (_a) {
|
||||||
var emDesenvolvimento = _a.emDesenvolvimento, identificador = _a.parametros.identificador, _b = _a.cliente, conta = _b.conta, produto = _b.produto;
|
var emDesenvolvimento = _a.emDesenvolvimento, _b = _a.cliente, conta = _b.conta, produto = _b.produto, _c = _a.parametros, agregacao = _c.agregacao, colanuEixoX = _c.colanuEixoX, colunaAgrupamento = _c.colunaAgrupamento, tabela = _c.tabela;
|
||||||
var dados = function () { return __awaiter(void 0, void 0, void 0, function () {
|
var dados = function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||||
var url, resp;
|
var url, resp;
|
||||||
return __generator(this, function (_a) {
|
return __generator(this, function (_a) {
|
||||||
|
|
@ -59,7 +88,10 @@ var serie_consultar = function (_a) {
|
||||||
return [4 /*yield*/, (0, cross_fetch_1.default)(url.toString(), {
|
return [4 /*yield*/, (0, cross_fetch_1.default)(url.toString(), {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
identificador: identificador,
|
agregacao: agregacao,
|
||||||
|
colanuEixoX: colanuEixoX,
|
||||||
|
colunaAgrupamento: colunaAgrupamento,
|
||||||
|
tabela: tabela,
|
||||||
}),
|
}),
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
})
|
})
|
||||||
|
|
@ -75,12 +107,31 @@ var serie_consultar = function (_a) {
|
||||||
});
|
});
|
||||||
}); };
|
}); };
|
||||||
var url = function () {
|
var url = function () {
|
||||||
|
var e_1, _a;
|
||||||
|
var pr = {
|
||||||
|
produto: produto,
|
||||||
|
conta: conta,
|
||||||
|
agregacao: agregacao,
|
||||||
|
colanuEixoX: colanuEixoX,
|
||||||
|
colunaAgrupamento: colunaAgrupamento,
|
||||||
|
tabela: tabela,
|
||||||
|
};
|
||||||
var vUrl = new URL("".concat(emDesenvolvimento
|
var vUrl = new URL("".concat(emDesenvolvimento
|
||||||
? "http://127.0.0.1:5081"
|
? "http://127.0.0.1:5081"
|
||||||
: "https://carro-de-boi.idz.one").concat(_variaveis_1.PREFIXO, "/").concat(_variaveis_1.tiposSeriesAgregacoes.enum.contagem));
|
: "https://carro-de-boi.idz.one").concat(_variaveis_1.PREFIXO, "/").concat(_variaveis_1.tiposSeriesAgregacoes.enum.contagem));
|
||||||
vUrl.searchParams.append("produto", produto);
|
try {
|
||||||
vUrl.searchParams.append("conta", conta);
|
for (var _b = __values(Object.entries(pr)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||||
vUrl.searchParams.append("identificador", identificador);
|
var _d = __read(_c.value, 2), k = _d[0], v = _d[1];
|
||||||
|
vUrl.searchParams.append(k, JSON.stringify(v));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||||
|
finally {
|
||||||
|
try {
|
||||||
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||||
|
}
|
||||||
|
finally { if (e_1) throw e_1.error; }
|
||||||
|
}
|
||||||
return vUrl.href;
|
return vUrl.href;
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
29
dist-require/pilao-de-dados/serie_registrar.d.ts
vendored
29
dist-require/pilao-de-dados/serie_registrar.d.ts
vendored
|
|
@ -1,29 +0,0 @@
|
||||||
import { type tipoResposta } from "p-respostas";
|
|
||||||
import { z } from "zod";
|
|
||||||
import { type zp_produto_conta } from "./_variaveis";
|
|
||||||
export declare const zp_serie_registrar: z.ZodObject<{
|
|
||||||
tabela: z.ZodString;
|
|
||||||
identificador: z.ZodString;
|
|
||||||
colanuEixoX: z.ZodString;
|
|
||||||
colunaAgrupamento: z.ZodString;
|
|
||||||
agregacao: z.ZodEnum<["contagem", "somatoria"]>;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
tabela: string;
|
|
||||||
identificador: string;
|
|
||||||
colanuEixoX: string;
|
|
||||||
colunaAgrupamento: string;
|
|
||||||
agregacao: "contagem" | "somatoria";
|
|
||||||
}, {
|
|
||||||
tabela: string;
|
|
||||||
identificador: string;
|
|
||||||
colanuEixoX: string;
|
|
||||||
colunaAgrupamento: string;
|
|
||||||
agregacao: "contagem" | "somatoria";
|
|
||||||
}>;
|
|
||||||
export declare const serie_registrar: ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { agregacao, colanuEixoX, colunaAgrupamento, identificador, tabela, }, }: {
|
|
||||||
emDesenvolvimento?: boolean | undefined | null;
|
|
||||||
/** Identificação do cliente */
|
|
||||||
cliente: z.infer<typeof zp_produto_conta>;
|
|
||||||
/** Parametros da função */
|
|
||||||
parametros: z.infer<typeof zp_serie_registrar>;
|
|
||||||
}) => Promise<tipoResposta<true>>;
|
|
||||||
|
|
@ -1,85 +0,0 @@
|
||||||
"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_registrar = 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");
|
|
||||||
//registrar serie
|
|
||||||
exports.zp_serie_registrar = zod_1.z.object({
|
|
||||||
tabela: zod_1.z.string(),
|
|
||||||
identificador: zod_1.z.string(),
|
|
||||||
colanuEixoX: zod_1.z.string(),
|
|
||||||
colunaAgrupamento: zod_1.z.string(),
|
|
||||||
agregacao: _variaveis_1.tiposSeriesAgregacoes,
|
|
||||||
});
|
|
||||||
var serie_registrar = function (_a) {
|
|
||||||
var emDesenvolvimento = _a.emDesenvolvimento, _b = _a.cliente, conta = _b.conta, produto = _b.produto, _c = _a.parametros, agregacao = _c.agregacao, colanuEixoX = _c.colanuEixoX, colunaAgrupamento = _c.colunaAgrupamento, identificador = _c.identificador, tabela = _c.tabela;
|
|
||||||
return __awaiter(void 0, void 0, void 0, function () {
|
|
||||||
var url, resp;
|
|
||||||
return __generator(this, function (_d) {
|
|
||||||
switch (_d.label) {
|
|
||||||
case 0:
|
|
||||||
url = new URL("".concat((0, _variaveis_1.baseUrlPilao)(emDesenvolvimento)).concat("".concat(_variaveis_1.PREFIXO, "/").concat(Object.keys({ serie_registrar: exports.serie_registrar })[0], "/").concat(produto, "/").concat(conta)));
|
|
||||||
return [4 /*yield*/, (0, cross_fetch_1.default)(url.toString(), {
|
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify({
|
|
||||||
tabela: tabela,
|
|
||||||
agregacao: agregacao,
|
|
||||||
emDesenvolvimento: emDesenvolvimento,
|
|
||||||
colanuEixoX: colanuEixoX,
|
|
||||||
colunaAgrupamento: colunaAgrupamento,
|
|
||||||
identificador: identificador,
|
|
||||||
}),
|
|
||||||
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 = _d.sent();
|
|
||||||
return [2 /*return*/, resp];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
exports.serie_registrar = serie_registrar;
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "p-drives",
|
"name": "p-drives",
|
||||||
"version": "0.74.0",
|
"version": "0.77.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
|
|
|
||||||
|
|
@ -3,26 +3,28 @@ import type { z } from "zod"
|
||||||
import type { zAmbiente } from "../ts/ambiente"
|
import type { zAmbiente } from "../ts/ambiente"
|
||||||
import { urlAutenticacao } from "./_urlAutenticacao"
|
import { urlAutenticacao } from "./_urlAutenticacao"
|
||||||
type tipoPostCodigoContaSite = { site: string }
|
type tipoPostCodigoContaSite = { site: string }
|
||||||
|
import node_fetch from "cross-fetch"
|
||||||
|
|
||||||
export const codigoContaSite = async ({
|
export const codigoContaSite = async ({
|
||||||
ambiente,
|
ambiente,
|
||||||
post,
|
post,
|
||||||
buscar,
|
|
||||||
}: {
|
}: {
|
||||||
ambiente: z.infer<typeof zAmbiente>
|
ambiente: z.infer<typeof zAmbiente>
|
||||||
post: tipoPostCodigoContaSite
|
post: tipoPostCodigoContaSite
|
||||||
/** função que conecta com a API */
|
|
||||||
buscar: (
|
|
||||||
url: string,
|
|
||||||
post: tipoPostCodigoContaSite,
|
|
||||||
) => Promise<tipoResposta<string>>
|
|
||||||
}): Promise<tipoResposta<string>> => {
|
}): Promise<tipoResposta<string>> => {
|
||||||
const url = `${urlAutenticacao(ambiente)}/api/codigo_prefeitura_site`
|
const url = `${urlAutenticacao(ambiente)}/api/codigo_prefeitura_site`
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const resp = await buscar(url, post).catch((e) =>
|
const resp = await node_fetch(url, {
|
||||||
respostaComuns.erro(`erro ao buscar código do site: ${e}`),
|
method: "POST",
|
||||||
)
|
body: JSON.stringify(post),
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
})
|
||||||
|
.then((r) => r.json())
|
||||||
|
.catch((e) =>
|
||||||
|
respostaComuns.erro("Erro ao enviar registros", [e.message]),
|
||||||
|
)
|
||||||
|
.then((r) => r as tipoResposta<string>)
|
||||||
|
|
||||||
return resp
|
return resp
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import node_fetch from "cross-fetch"
|
||||||
import { respostaComuns, type tipoResposta } from "p-respostas"
|
import { respostaComuns, type tipoResposta } from "p-respostas"
|
||||||
import type { z } from "zod"
|
import type { z } from "zod"
|
||||||
import type { zAmbiente } from "../ts/ambiente"
|
import type { zAmbiente } from "../ts/ambiente"
|
||||||
|
|
@ -15,14 +16,9 @@ export type tipoUsuarioExterno = {
|
||||||
export const usuarios_quipo_governo = async ({
|
export const usuarios_quipo_governo = async ({
|
||||||
token_produto,
|
token_produto,
|
||||||
ambiente,
|
ambiente,
|
||||||
buscar,
|
|
||||||
}: {
|
}: {
|
||||||
ambiente: z.infer<typeof zAmbiente>
|
ambiente: z.infer<typeof zAmbiente>
|
||||||
token_produto: string
|
token_produto: string
|
||||||
buscar: (
|
|
||||||
url: string,
|
|
||||||
headers: { [k: string]: string },
|
|
||||||
) => Promise<tipoResposta<tipoUsuarioExterno[]>>
|
|
||||||
}): Promise<tipoResposta<tipoUsuarioExterno[]>> => {
|
}): Promise<tipoResposta<tipoUsuarioExterno[]>> => {
|
||||||
const url = `${urlAutenticacao(ambiente)}/api/usuarios_quipo_governo`
|
const url = `${urlAutenticacao(ambiente)}/api/usuarios_quipo_governo`
|
||||||
|
|
||||||
|
|
@ -32,7 +28,12 @@ export const usuarios_quipo_governo = async ({
|
||||||
token: token_produto,
|
token: token_produto,
|
||||||
}
|
}
|
||||||
|
|
||||||
return buscar(url, headers).catch((e) =>
|
return node_fetch(url, {
|
||||||
respostaComuns.erro(`erro ao buscar usuários quipo governo: ${e}`),
|
headers,
|
||||||
)
|
})
|
||||||
|
.then((r) => r.json())
|
||||||
|
.catch((e) =>
|
||||||
|
respostaComuns.erro("Erro ao buscar usuários quipo governo", [e.message]),
|
||||||
|
)
|
||||||
|
.then((r) => r as tipoResposta<tipoUsuarioExterno[]>)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import type { tipoResposta } from "p-respostas"
|
import type { tipoResposta } from "p-respostas"
|
||||||
import { urlAutenticacao } from "./_urlAutenticacao"
|
import { urlAutenticacao } from "./_urlAutenticacao"
|
||||||
type tipoPostValidarTokem = { token: string }
|
type tipoPostValidarTokem = { token: string }
|
||||||
|
import node_fetch from "cross-fetch"
|
||||||
import type { z } from "zod"
|
import type { z } from "zod"
|
||||||
import type { zAmbiente } from "../ts/ambiente"
|
import type { zAmbiente } from "../ts/ambiente"
|
||||||
|
|
||||||
|
|
@ -8,20 +9,20 @@ import type { zAmbiente } from "../ts/ambiente"
|
||||||
export const validarToken = async ({
|
export const validarToken = async ({
|
||||||
ambiente,
|
ambiente,
|
||||||
post,
|
post,
|
||||||
buscar,
|
|
||||||
}: {
|
}: {
|
||||||
ambiente: z.infer<typeof zAmbiente>
|
ambiente: z.infer<typeof zAmbiente>
|
||||||
post: tipoPostValidarTokem
|
post: tipoPostValidarTokem
|
||||||
/** função que conecta com a API */
|
|
||||||
buscar: (
|
|
||||||
url: string,
|
|
||||||
post: tipoPostValidarTokem,
|
|
||||||
) => Promise<tipoResposta<any>>
|
|
||||||
}): Promise<"valido" | "erro"> => {
|
}): Promise<"valido" | "erro"> => {
|
||||||
const url = `${urlAutenticacao(ambiente)}/api/validar_token`
|
const url = `${urlAutenticacao(ambiente)}/api/validar_token`
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const resposta = await buscar(url, post)
|
const resposta = await node_fetch(url, {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(post),
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
})
|
||||||
|
.then((r) => r.json())
|
||||||
|
.then((r) => r as tipoResposta<any>)
|
||||||
.then((resposta) =>
|
.then((resposta) =>
|
||||||
resposta.eCerto ? ("valido" as const) : ("erro" as const),
|
resposta.eCerto ? ("valido" as const) : ("erro" as const),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,8 @@ export const z_tipo_coluna_base_dados = z.enum([
|
||||||
"confirmacao",
|
"confirmacao",
|
||||||
"lista_texto",
|
"lista_texto",
|
||||||
"lista_numero",
|
"lista_numero",
|
||||||
|
"data",
|
||||||
|
"mes",
|
||||||
])
|
])
|
||||||
|
|
||||||
export const tiposSeriesAgregacoes = z.enum(["contagem", "somatoria"])
|
export const tiposSeriesAgregacoes = z.enum(["contagem", "somatoria"])
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,7 @@ import {
|
||||||
zp_registrar_base_dados,
|
zp_registrar_base_dados,
|
||||||
} from "./enviar_registros"
|
} from "./enviar_registros"
|
||||||
|
|
||||||
import { serie_consultar, zp_serie_consultar } from "./serie_consultar"
|
import { serie_consultar, zp_serie_registrar } from "./serie_consultar"
|
||||||
import { serie_registrar, zp_serie_registrar } from "./serie_registrar"
|
|
||||||
|
|
||||||
export { tiposSeriesAgregacoes }
|
export { tiposSeriesAgregacoes }
|
||||||
|
|
||||||
|
|
@ -17,11 +16,9 @@ export const pPilao = {
|
||||||
enviar_registros,
|
enviar_registros,
|
||||||
zp_enviar_registros,
|
zp_enviar_registros,
|
||||||
|
|
||||||
serie_registrar,
|
|
||||||
zp_serie_registrar,
|
zp_serie_registrar,
|
||||||
|
|
||||||
serie_consultar,
|
serie_consultar,
|
||||||
zp_serie_consultar,
|
|
||||||
|
|
||||||
zp_produto_conta,
|
zp_produto_conta,
|
||||||
validarZ,
|
validarZ,
|
||||||
|
|
|
||||||
|
|
@ -8,23 +8,24 @@ import {
|
||||||
tiposSeriesAgregacoes,
|
tiposSeriesAgregacoes,
|
||||||
type zp_produto_conta,
|
type zp_produto_conta,
|
||||||
} from "./_variaveis"
|
} from "./_variaveis"
|
||||||
import type { zp_serie_registrar } from "./serie_registrar"
|
|
||||||
//consultar compilação
|
|
||||||
|
|
||||||
export const zp_serie_consultar = z.object({
|
export const zp_serie_registrar = z.object({
|
||||||
identificador: z.string(),
|
tabela: z.string(),
|
||||||
|
colanuEixoX: z.string(),
|
||||||
|
colunaAgrupamento: z.string(),
|
||||||
|
agregacao: tiposSeriesAgregacoes,
|
||||||
})
|
})
|
||||||
|
|
||||||
export const serie_consultar = ({
|
export const serie_consultar = ({
|
||||||
emDesenvolvimento,
|
emDesenvolvimento,
|
||||||
parametros: { identificador },
|
|
||||||
cliente: { conta, produto },
|
cliente: { conta, produto },
|
||||||
|
parametros: { agregacao, colanuEixoX, colunaAgrupamento, tabela },
|
||||||
}: {
|
}: {
|
||||||
emDesenvolvimento?: boolean | undefined | null
|
emDesenvolvimento?: boolean | undefined | null
|
||||||
|
|
||||||
/** Identificação do cliente */
|
/** Identificação do cliente */
|
||||||
cliente: z.infer<typeof zp_produto_conta>
|
cliente: z.infer<typeof zp_produto_conta>
|
||||||
parametros: z.infer<typeof zp_serie_consultar>
|
parametros: z.infer<typeof zp_serie_registrar>
|
||||||
}) => {
|
}) => {
|
||||||
const dados = async (): Promise<
|
const dados = async (): Promise<
|
||||||
tipoResposta<{
|
tipoResposta<{
|
||||||
|
|
@ -42,7 +43,10 @@ export const serie_consultar = ({
|
||||||
const resp = await node_fetch(url.toString(), {
|
const resp = await node_fetch(url.toString(), {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
identificador,
|
agregacao,
|
||||||
|
colanuEixoX,
|
||||||
|
colunaAgrupamento,
|
||||||
|
tabela,
|
||||||
}),
|
}),
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
})
|
})
|
||||||
|
|
@ -56,6 +60,15 @@ export const serie_consultar = ({
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = (): string => {
|
const url = (): string => {
|
||||||
|
const pr = {
|
||||||
|
produto,
|
||||||
|
conta,
|
||||||
|
agregacao,
|
||||||
|
colanuEixoX,
|
||||||
|
colunaAgrupamento,
|
||||||
|
tabela,
|
||||||
|
}
|
||||||
|
|
||||||
const vUrl = new URL(
|
const vUrl = new URL(
|
||||||
`${
|
`${
|
||||||
emDesenvolvimento
|
emDesenvolvimento
|
||||||
|
|
@ -64,9 +77,9 @@ export const serie_consultar = ({
|
||||||
}${PREFIXO}/${tiposSeriesAgregacoes.enum.contagem}`,
|
}${PREFIXO}/${tiposSeriesAgregacoes.enum.contagem}`,
|
||||||
)
|
)
|
||||||
|
|
||||||
vUrl.searchParams.append("produto", produto)
|
for (const [k, v] of Object.entries(pr)) {
|
||||||
vUrl.searchParams.append("conta", conta)
|
vUrl.searchParams.append(k, JSON.stringify(v))
|
||||||
vUrl.searchParams.append("identificador", identificador)
|
}
|
||||||
|
|
||||||
return vUrl.href
|
return vUrl.href
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,62 +0,0 @@
|
||||||
import node_fetch from "cross-fetch"
|
|
||||||
import { respostaComuns, type tipoResposta } from "p-respostas"
|
|
||||||
import { z } from "zod"
|
|
||||||
import {
|
|
||||||
PREFIXO,
|
|
||||||
baseUrlPilao,
|
|
||||||
tiposSeriesAgregacoes,
|
|
||||||
type zp_produto_conta,
|
|
||||||
} from "./_variaveis"
|
|
||||||
|
|
||||||
//registrar serie
|
|
||||||
|
|
||||||
export const zp_serie_registrar = z.object({
|
|
||||||
tabela: z.string(),
|
|
||||||
identificador: z.string(),
|
|
||||||
colanuEixoX: z.string(),
|
|
||||||
colunaAgrupamento: z.string(),
|
|
||||||
agregacao: tiposSeriesAgregacoes,
|
|
||||||
})
|
|
||||||
|
|
||||||
export const serie_registrar = async ({
|
|
||||||
emDesenvolvimento,
|
|
||||||
cliente: { conta, produto },
|
|
||||||
parametros: {
|
|
||||||
agregacao,
|
|
||||||
colanuEixoX,
|
|
||||||
colunaAgrupamento,
|
|
||||||
identificador,
|
|
||||||
tabela,
|
|
||||||
},
|
|
||||||
}: {
|
|
||||||
emDesenvolvimento?: boolean | undefined | null
|
|
||||||
|
|
||||||
/** Identificação do cliente */
|
|
||||||
cliente: z.infer<typeof zp_produto_conta>
|
|
||||||
/** Parametros da função */
|
|
||||||
parametros: z.infer<typeof zp_serie_registrar>
|
|
||||||
}): Promise<tipoResposta<true>> => {
|
|
||||||
const url = new URL(
|
|
||||||
`${baseUrlPilao(
|
|
||||||
emDesenvolvimento,
|
|
||||||
)}${`${PREFIXO}/${Object.keys({ serie_registrar })[0]}/${produto}/${conta}`}`,
|
|
||||||
)
|
|
||||||
|
|
||||||
const resp = await node_fetch(url.toString(), {
|
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify({
|
|
||||||
tabela,
|
|
||||||
agregacao,
|
|
||||||
emDesenvolvimento,
|
|
||||||
colanuEixoX,
|
|
||||||
colunaAgrupamento,
|
|
||||||
identificador,
|
|
||||||
}),
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
})
|
|
||||||
.then((r) => r.json())
|
|
||||||
.catch((e) => respostaComuns.erro("Erro ao enviar registros", [e.message]))
|
|
||||||
.then((r) => r as tipoResposta<true>)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue