This commit is contained in:
Luiz H. R. Silva 2024-06-04 10:44:32 -03:00
parent 43616225e7
commit 7e7fbb6809
17 changed files with 159 additions and 18 deletions

24
dist-require/autenticacao.d.ts vendored Normal file
View file

@ -0,0 +1,24 @@
type tipoPostValidarTokem = {
token: string;
};
/** todas as rotas de comunicação com autenticador partem dessa variável */
export declare const pAutenticacao: {
urlValidarToken: ({ ambiente, post, buscar, }: {
ambiente: "desenvolvimento" | "producao";
post: tipoPostValidarTokem;
buscar: (url: string, post: tipoPostValidarTokem) => Promise<{
cod: 200;
valor: any;
eCerto: true;
eErro: false;
mensagem: undefined;
} | {
cod: 400;
valor: any;
eCerto: false;
eErro: true;
mensagem: string;
}>;
}) => Promise<"valido" | "erro">;
};
export {};

View file

@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.pAutenticacao = void 0;
/** retorna uma url e os parametros que devem ser enviádos */
const urlValidarToken = async ({ ambiente, post, buscar, }) => {
const url = `${ambiente == "producao"
? "https://carro-de-boi.idz.one"
: "http://localhost:5030"}/autenticacao/api/validar_token`;
try {
const resposta = await buscar(url, post)
.then((resposta) => resposta.eCerto ? "valido" : "erro")
.catch((e) => "erro");
return resposta;
}
catch (e) {
return "erro";
}
};
/** todas as rotas de comunicação com autenticador partem dessa variável */
exports.pAutenticacao = { urlValidarToken };

View file

@ -1 +1,2 @@
export * from "./tokenQuipo";
export * from "./autenticacao";

View file

@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./tokenQuipo"), exports);
__exportStar(require("./autenticacao"), exports);

View file

@ -27,5 +27,5 @@ export declare const ztokenQuipo: z.ZodObject<{
codigo_acesso_produto: string;
tipo_de_acesso: "publico" | "governo" | "sociedade";
}>;
export type tipos_de_acesso_quipo = z.infer<typeof ztokenQuipo>['tipo_de_acesso'];
export type tipos_de_acesso_quipo = z.infer<typeof ztokenQuipo>["tipo_de_acesso"];
export type tipoTokenQuipo = z.infer<typeof ztokenQuipo>;

View file

@ -10,5 +10,5 @@ exports.ztokenQuipo = zod_1.z.object({
nome_conta: zod_1.z.string(),
codigo_autenticacao: zod_1.z.string(),
codigo_acesso_produto: zod_1.z.string(),
tipo_de_acesso: zod_1.z.enum(['publico', 'governo', 'sociedade']),
tipo_de_acesso: zod_1.z.enum(["publico", "governo", "sociedade"]),
});