add consultaUsuariosexterno
This commit is contained in:
parent
07a656a2b4
commit
9491278d6c
62 changed files with 489 additions and 200 deletions
25
dist-import/autenticacao.d.ts
vendored
25
dist-import/autenticacao.d.ts
vendored
|
|
@ -1,25 +0,0 @@
|
||||||
import { type tipoResposta } from "p-respostas";
|
|
||||||
type tipoPostValidarTokem = {
|
|
||||||
token: string;
|
|
||||||
};
|
|
||||||
type tipoPostCodigoContaSite = {
|
|
||||||
site: string;
|
|
||||||
};
|
|
||||||
/** todas as rotas de comunicação com autenticador partem dessa variável */
|
|
||||||
export declare const pAutenticacao: {
|
|
||||||
validarToken: ({ ambiente, post, buscar, }: {
|
|
||||||
ambiente: "desenvolvimento" | "producao";
|
|
||||||
post: tipoPostValidarTokem;
|
|
||||||
/** função que conecta com a API */
|
|
||||||
buscar: (url: string, post: tipoPostValidarTokem) => Promise<tipoResposta<any>>;
|
|
||||||
}) => Promise<"valido" | "erro">;
|
|
||||||
urlAutenticacao: (ambiente: "desenvolvimento" | "producao") => string;
|
|
||||||
codigoContaSite: ({ ambiente, post, buscar, }: {
|
|
||||||
ambiente: "desenvolvimento" | "producao";
|
|
||||||
post: tipoPostCodigoContaSite;
|
|
||||||
/** função que conecta com a API */
|
|
||||||
buscar: (url: string, post: tipoPostCodigoContaSite) => Promise<tipoResposta<string>>;
|
|
||||||
}) => Promise<tipoResposta<string>>;
|
|
||||||
};
|
|
||||||
export {};
|
|
||||||
//# sourceMappingURL=autenticacao.d.ts.map
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
{"version":3,"file":"autenticacao.d.ts","sourceRoot":"","sources":["../src/autenticacao.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/D,KAAK,oBAAoB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAC7C,KAAK,uBAAuB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAgE/C,2EAA2E;AAC3E,eAAO,MAAM,aAAa;;kBAlDd,iBAAiB,GAAG,UAAU;cAClC,oBAAoB;QAC1B,mCAAmC;sBAE5B,MAAM,QACL,oBAAoB,KACvB,QAAQ,aAAa,GAAG,CAAC,CAAC;UAC7B,QAAQ,QAAQ,GAAG,MAAM,CAAC;gCApBK,iBAAiB,GAAG,UAAU;;kBAyCrD,iBAAiB,GAAG,UAAU;cAClC,uBAAuB;QAC7B,mCAAmC;sBAE5B,MAAM,QACL,uBAAuB,KAC1B,QAAQ,aAAa,MAAM,CAAC,CAAC;UAChC,QAAQ,aAAa,MAAM,CAAC,CAAC;CAmBhC,CAAA"}
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
{"version":3,"file":"autenticacao.js","sourceRoot":"","sources":["../src/autenticacao.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAqB,MAAM,aAAa,CAAA;AAI/D,MAAM,eAAe,GAAG,CAAC,QAAwC,EAAE,EAAE,CACnE,GACE,QAAQ,IAAI,UAAU;IACpB,CAAC,CAAC,8BAA8B;IAChC,CAAC,CAAC,uBACN,eAAe,CAAA;AAEjB,+BAA+B;AAC/B,MAAM,YAAY,GAAG,CAAO,EAC1B,QAAQ,EACR,IAAI,EACJ,MAAM,GASP,EAA8B,EAAE;IAC/B,MAAM,GAAG,GAAG,GAAG,eAAe,CAAC,QAAQ,CAAC,oBAAoB,CAAA;IAE5D,IAAI;QACF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC;aACrC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CACjB,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAE,QAAkB,CAAC,CAAC,CAAE,MAAgB,CAC1D;aACA,KAAK,CAAC,GAAG,EAAE,CAAC,MAAe,CAAC,CAAA;QAE/B,OAAO,QAAQ,CAAA;KAChB;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,MAAM,CAAA;KACd;AACH,CAAC,CAAA,CAAA;AAED,MAAM,eAAe,GAAG,CAAO,EAC7B,QAAQ,EACR,IAAI,EACJ,MAAM,GASP,EAAiC,EAAE;IAClC,MAAM,GAAG,GAAG,GAAG,eAAe,CAAC,QAAQ,CAAC,6BAA6B,CAAA;IAErE,IAAI;QACF,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAC/C,cAAc,CAAC,IAAI,CAAC,kCAAkC,CAAC,EAAE,CAAC,CAC3D,CAAA;QAED,OAAO,IAAI,CAAA;KACZ;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,cAAc,CAAC,IAAI,CAAC,kCAAkC,CAAC,EAAE,CAAC,CAAA;KAClE;AACH,CAAC,CAAA,CAAA;AAED,2EAA2E;AAC3E,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,YAAY;IACZ,eAAe;IACf,eAAe;CAChB,CAAA"}
|
|
||||||
12
dist-import/autenticacao/_codigoContaSite.d.ts
vendored
Normal file
12
dist-import/autenticacao/_codigoContaSite.d.ts
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { type tipoResposta } from "p-respostas";
|
||||||
|
type tipoPostCodigoContaSite = {
|
||||||
|
site: string;
|
||||||
|
};
|
||||||
|
export declare const codigoContaSite: ({ ambiente, post, buscar, }: {
|
||||||
|
ambiente: "desenvolvimento" | "producao";
|
||||||
|
post: tipoPostCodigoContaSite;
|
||||||
|
/** função que conecta com a API */
|
||||||
|
buscar: (url: string, post: tipoPostCodigoContaSite) => Promise<tipoResposta<string>>;
|
||||||
|
}) => Promise<tipoResposta<string>>;
|
||||||
|
export {};
|
||||||
|
//# sourceMappingURL=_codigoContaSite.d.ts.map
|
||||||
1
dist-import/autenticacao/_codigoContaSite.d.ts.map
Normal file
1
dist-import/autenticacao/_codigoContaSite.d.ts.map
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"_codigoContaSite.d.ts","sourceRoot":"","sources":["../../src/autenticacao/_codigoContaSite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/D,KAAK,uBAAuB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAE/C,eAAO,MAAM,eAAe;cAKhB,iBAAiB,GAAG,UAAU;UAClC,uBAAuB;IAC7B,mCAAmC;kBAE5B,MAAM,QACL,uBAAuB,KAC1B,QAAQ,aAAa,MAAM,CAAC,CAAC;MAChC,QAAQ,aAAa,MAAM,CAAC,CAY/B,CAAA"}
|
||||||
|
|
@ -8,23 +8,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
import { respostaComuns } from "p-respostas";
|
import { respostaComuns } from "p-respostas";
|
||||||
const urlAutenticacao = (ambiente) => `${ambiente == "producao"
|
import { urlAutenticacao } from "./_urlAutenticacao";
|
||||||
? "https://carro-de-boi.idz.one"
|
export const codigoContaSite = ({ ambiente, post, buscar, }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
: "http://localhost:5030"}/autenticacao`;
|
|
||||||
/** faz a validação do token */
|
|
||||||
const validarToken = ({ ambiente, post, buscar, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
||||||
const url = `${urlAutenticacao(ambiente)}/api/validar_token`;
|
|
||||||
try {
|
|
||||||
const resposta = yield buscar(url, post)
|
|
||||||
.then((resposta) => resposta.eCerto ? "valido" : "erro")
|
|
||||||
.catch(() => "erro");
|
|
||||||
return resposta;
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
return "erro";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const codigoContaSite = ({ ambiente, post, buscar, }) => __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 buscar(url, post).catch((e) => respostaComuns.erro(`erro ao buscar código do site: ${e}`));
|
||||||
|
|
@ -34,10 +19,4 @@ const codigoContaSite = ({ ambiente, post, buscar, }) => __awaiter(void 0, void
|
||||||
return respostaComuns.erro(`erro ao buscar código do site: ${e}`);
|
return respostaComuns.erro(`erro ao buscar código do site: ${e}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
/** todas as rotas de comunicação com autenticador partem dessa variável */
|
//# sourceMappingURL=_codigoContaSite.js.map
|
||||||
export const pAutenticacao = {
|
|
||||||
validarToken,
|
|
||||||
urlAutenticacao,
|
|
||||||
codigoContaSite,
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=autenticacao.js.map
|
|
||||||
1
dist-import/autenticacao/_codigoContaSite.js.map
Normal file
1
dist-import/autenticacao/_codigoContaSite.js.map
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"_codigoContaSite.js","sourceRoot":"","sources":["../../src/autenticacao/_codigoContaSite.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAqB,MAAM,aAAa,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAGpD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAO,EACpC,QAAQ,EACR,IAAI,EACJ,MAAM,GASP,EAAiC,EAAE;IAClC,MAAM,GAAG,GAAG,GAAG,eAAe,CAAC,QAAQ,CAAC,6BAA6B,CAAA;IAErE,IAAI;QACF,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAC/C,cAAc,CAAC,IAAI,CAAC,kCAAkC,CAAC,EAAE,CAAC,CAC3D,CAAA;QAED,OAAO,IAAI,CAAA;KACZ;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,cAAc,CAAC,IAAI,CAAC,kCAAkC,CAAC,EAAE,CAAC,CAAA;KAClE;AACH,CAAC,CAAA,CAAA"}
|
||||||
16
dist-import/autenticacao/_consultaUsuariosexterno.d.ts
vendored
Normal file
16
dist-import/autenticacao/_consultaUsuariosexterno.d.ts
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { type tipoResposta } from "p-respostas";
|
||||||
|
export type tipoUsuarioExterno = {
|
||||||
|
nome: string;
|
||||||
|
email: string;
|
||||||
|
telefone: string;
|
||||||
|
vinculo: string;
|
||||||
|
codigo_produto: string;
|
||||||
|
chave_produto: string;
|
||||||
|
};
|
||||||
|
export declare const consultaUsuariosexterno: ({ token_produto, ambiente, codigo_produto, chave_produto, }: {
|
||||||
|
ambiente: "desenvolvimento" | "producao";
|
||||||
|
token_produto: string;
|
||||||
|
codigo_produto: string;
|
||||||
|
chave_produto: string;
|
||||||
|
}) => Promise<tipoResposta<tipoUsuarioExterno[]>>;
|
||||||
|
//# sourceMappingURL=_consultaUsuariosexterno.d.ts.map
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"_consultaUsuariosexterno.d.ts","sourceRoot":"","sources":["../../src/autenticacao/_consultaUsuariosexterno.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,uBAAuB;cAMxB,iBAAiB,GAAG,UAAU;mBACzB,MAAM;oBACL,MAAM;mBACP,MAAM;MACnB,QAAQ,aAAa,kBAAkB,EAAE,CAAC,CAG7C,CAAA"}
|
||||||
15
dist-import/autenticacao/_consultaUsuariosexterno.js
Normal file
15
dist-import/autenticacao/_consultaUsuariosexterno.js
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
import { respostaComuns } from "p-respostas";
|
||||||
|
export const consultaUsuariosexterno = ({ token_produto, ambiente, codigo_produto, chave_produto, }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
|
console.log(token_produto, ambiente, codigo_produto, chave_produto);
|
||||||
|
return respostaComuns.valor([]);
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=_consultaUsuariosexterno.js.map
|
||||||
1
dist-import/autenticacao/_consultaUsuariosexterno.js.map
Normal file
1
dist-import/autenticacao/_consultaUsuariosexterno.js.map
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"_consultaUsuariosexterno.js","sourceRoot":"","sources":["../../src/autenticacao/_consultaUsuariosexterno.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAqB,MAAM,aAAa,CAAA;AAW/D,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAO,EAC5C,aAAa,EACb,QAAQ,EACR,cAAc,EACd,aAAa,GAMd,EAA+C,EAAE;IAChD,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,CAAC,CAAA;IACnE,OAAO,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;AACjC,CAAC,CAAA,CAAA"}
|
||||||
2
dist-import/autenticacao/_urlAutenticacao.d.ts
vendored
Normal file
2
dist-import/autenticacao/_urlAutenticacao.d.ts
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
export declare const urlAutenticacao: (ambiente: "desenvolvimento" | "producao") => string;
|
||||||
|
//# sourceMappingURL=_urlAutenticacao.d.ts.map
|
||||||
1
dist-import/autenticacao/_urlAutenticacao.d.ts.map
Normal file
1
dist-import/autenticacao/_urlAutenticacao.d.ts.map
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"_urlAutenticacao.d.ts","sourceRoot":"","sources":["../../src/autenticacao/_urlAutenticacao.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,aAAc,iBAAiB,GAAG,UAAU,WAKvD,CAAA"}
|
||||||
4
dist-import/autenticacao/_urlAutenticacao.js
Normal file
4
dist-import/autenticacao/_urlAutenticacao.js
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
export const urlAutenticacao = (ambiente) => `${ambiente == "producao"
|
||||||
|
? "https://carro-de-boi.idz.one"
|
||||||
|
: "http://localhost:5030"}/autenticacao`;
|
||||||
|
//# sourceMappingURL=_urlAutenticacao.js.map
|
||||||
1
dist-import/autenticacao/_urlAutenticacao.js.map
Normal file
1
dist-import/autenticacao/_urlAutenticacao.js.map
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"_urlAutenticacao.js","sourceRoot":"","sources":["../../src/autenticacao/_urlAutenticacao.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAwC,EAAE,EAAE,CAC1E,GACE,QAAQ,IAAI,UAAU;IACpB,CAAC,CAAC,8BAA8B;IAChC,CAAC,CAAC,uBACN,eAAe,CAAA"}
|
||||||
13
dist-import/autenticacao/_validarToken.d.ts
vendored
Normal file
13
dist-import/autenticacao/_validarToken.d.ts
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
import type { tipoResposta } from "p-respostas";
|
||||||
|
type tipoPostValidarTokem = {
|
||||||
|
token: string;
|
||||||
|
};
|
||||||
|
/** faz a validação do token */
|
||||||
|
export declare const validarToken: ({ ambiente, post, buscar, }: {
|
||||||
|
ambiente: "desenvolvimento" | "producao";
|
||||||
|
post: tipoPostValidarTokem;
|
||||||
|
/** função que conecta com a API */
|
||||||
|
buscar: (url: string, post: tipoPostValidarTokem) => Promise<tipoResposta<any>>;
|
||||||
|
}) => Promise<"valido" | "erro">;
|
||||||
|
export {};
|
||||||
|
//# sourceMappingURL=_validarToken.d.ts.map
|
||||||
1
dist-import/autenticacao/_validarToken.d.ts.map
Normal file
1
dist-import/autenticacao/_validarToken.d.ts.map
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"_validarToken.d.ts","sourceRoot":"","sources":["../../src/autenticacao/_validarToken.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,KAAK,oBAAoB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAE7C,+BAA+B;AAC/B,eAAO,MAAM,YAAY;cAKb,iBAAiB,GAAG,UAAU;UAClC,oBAAoB;IAC1B,mCAAmC;kBAE5B,MAAM,QACL,oBAAoB,KACvB,QAAQ,aAAa,GAAG,CAAC,CAAC;MAC7B,QAAQ,QAAQ,GAAG,MAAM,CAc5B,CAAA"}
|
||||||
24
dist-import/autenticacao/_validarToken.js
Normal file
24
dist-import/autenticacao/_validarToken.js
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
import { urlAutenticacao } from "./_urlAutenticacao";
|
||||||
|
/** faz a validação do token */
|
||||||
|
export const validarToken = ({ ambiente, post, buscar, }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
|
const url = `${urlAutenticacao(ambiente)}/api/validar_token`;
|
||||||
|
try {
|
||||||
|
const resposta = yield buscar(url, post)
|
||||||
|
.then((resposta) => resposta.eCerto ? "valido" : "erro")
|
||||||
|
.catch(() => "erro");
|
||||||
|
return resposta;
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
return "erro";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=_validarToken.js.map
|
||||||
1
dist-import/autenticacao/_validarToken.js.map
Normal file
1
dist-import/autenticacao/_validarToken.js.map
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"_validarToken.js","sourceRoot":"","sources":["../../src/autenticacao/_validarToken.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAGpD,+BAA+B;AAC/B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAO,EACjC,QAAQ,EACR,IAAI,EACJ,MAAM,GASP,EAA8B,EAAE;IAC/B,MAAM,GAAG,GAAG,GAAG,eAAe,CAAC,QAAQ,CAAC,oBAAoB,CAAA;IAE5D,IAAI;QACF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC;aACrC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CACjB,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAE,QAAkB,CAAC,CAAC,CAAE,MAAgB,CAC1D;aACA,KAAK,CAAC,GAAG,EAAE,CAAC,MAAe,CAAC,CAAA;QAE/B,OAAO,QAAQ,CAAA;KAChB;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,MAAM,CAAA;KACd;AACH,CAAC,CAAA,CAAA"}
|
||||||
30
dist-import/autenticacao/index.d.ts
vendored
Normal file
30
dist-import/autenticacao/index.d.ts
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
export type { tipoUsuarioExterno } from "./_consultaUsuariosexterno";
|
||||||
|
/** todas as rotas de comunicação com autenticador partem dessa variável */
|
||||||
|
export declare const pAutenticacao: {
|
||||||
|
validarToken: ({ ambiente, post, buscar, }: {
|
||||||
|
ambiente: "desenvolvimento" | "producao";
|
||||||
|
post: {
|
||||||
|
token: string;
|
||||||
|
};
|
||||||
|
buscar: (url: string, post: {
|
||||||
|
token: string;
|
||||||
|
}) => Promise<import("p-respostas").tipoResposta<any>>;
|
||||||
|
}) => Promise<"valido" | "erro">;
|
||||||
|
urlAutenticacao: (ambiente: "desenvolvimento" | "producao") => string;
|
||||||
|
codigoContaSite: ({ ambiente, post, buscar, }: {
|
||||||
|
ambiente: "desenvolvimento" | "producao";
|
||||||
|
post: {
|
||||||
|
site: string;
|
||||||
|
};
|
||||||
|
buscar: (url: string, post: {
|
||||||
|
site: string;
|
||||||
|
}) => Promise<import("p-respostas").tipoResposta<string>>;
|
||||||
|
}) => Promise<import("p-respostas").tipoResposta<string>>;
|
||||||
|
consultaUsuariosexterno: ({ token_produto, ambiente, codigo_produto, chave_produto, }: {
|
||||||
|
ambiente: "desenvolvimento" | "producao";
|
||||||
|
token_produto: string;
|
||||||
|
codigo_produto: string;
|
||||||
|
chave_produto: string;
|
||||||
|
}) => Promise<import("p-respostas").tipoResposta<import("./_consultaUsuariosexterno").tipoUsuarioExterno[]>>;
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=index.d.ts.map
|
||||||
1
dist-import/autenticacao/index.d.ts.map
Normal file
1
dist-import/autenticacao/index.d.ts.map
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/autenticacao/index.ts"],"names":[],"mappings":"AAKA,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAEpE,2EAA2E;AAC3E,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;CAKzB,CAAA"}
|
||||||
12
dist-import/autenticacao/index.js
Normal file
12
dist-import/autenticacao/index.js
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { codigoContaSite } from "./_codigoContaSite";
|
||||||
|
import { consultaUsuariosexterno } from "./_consultaUsuariosexterno";
|
||||||
|
import { urlAutenticacao } from "./_urlAutenticacao";
|
||||||
|
import { validarToken } from "./_validarToken";
|
||||||
|
/** todas as rotas de comunicação com autenticador partem dessa variável */
|
||||||
|
export const pAutenticacao = {
|
||||||
|
validarToken,
|
||||||
|
urlAutenticacao,
|
||||||
|
codigoContaSite,
|
||||||
|
consultaUsuariosexterno,
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=index.js.map
|
||||||
1
dist-import/autenticacao/index.js.map
Normal file
1
dist-import/autenticacao/index.js.map
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/autenticacao/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAI9C,2EAA2E;AAC3E,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,YAAY;IACZ,eAAe;IACf,eAAe;IACf,uBAAuB;CACxB,CAAA"}
|
||||||
2
dist-import/index.d.ts
vendored
2
dist-import/index.d.ts
vendored
|
|
@ -1,3 +1,3 @@
|
||||||
export * from "./tokenQuipo";
|
export * from "./tokenQuipo";
|
||||||
export * from "./autenticacao";
|
export * from "./autenticacao/_codigoContaSite";
|
||||||
//# sourceMappingURL=index.d.ts.map
|
//# sourceMappingURL=index.d.ts.map
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA"}
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,iCAAiC,CAAA"}
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
export * from "./tokenQuipo";
|
export * from "./tokenQuipo";
|
||||||
export * from "./autenticacao";
|
export * from "./autenticacao/_codigoContaSite";
|
||||||
//# sourceMappingURL=index.js.map
|
//# sourceMappingURL=index.js.map
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA"}
|
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,iCAAiC,CAAA"}
|
||||||
25
dist-require/autenticacao.d.ts
vendored
25
dist-require/autenticacao.d.ts
vendored
|
|
@ -1,25 +0,0 @@
|
||||||
import { type tipoResposta } from "p-respostas";
|
|
||||||
type tipoPostValidarTokem = {
|
|
||||||
token: string;
|
|
||||||
};
|
|
||||||
type tipoPostCodigoContaSite = {
|
|
||||||
site: string;
|
|
||||||
};
|
|
||||||
/** todas as rotas de comunicação com autenticador partem dessa variável */
|
|
||||||
export declare const pAutenticacao: {
|
|
||||||
validarToken: ({ ambiente, post, buscar, }: {
|
|
||||||
ambiente: "desenvolvimento" | "producao";
|
|
||||||
post: tipoPostValidarTokem;
|
|
||||||
/** função que conecta com a API */
|
|
||||||
buscar: (url: string, post: tipoPostValidarTokem) => Promise<tipoResposta<any>>;
|
|
||||||
}) => Promise<"valido" | "erro">;
|
|
||||||
urlAutenticacao: (ambiente: "desenvolvimento" | "producao") => string;
|
|
||||||
codigoContaSite: ({ ambiente, post, buscar, }: {
|
|
||||||
ambiente: "desenvolvimento" | "producao";
|
|
||||||
post: tipoPostCodigoContaSite;
|
|
||||||
/** função que conecta com a API */
|
|
||||||
buscar: (url: string, post: tipoPostCodigoContaSite) => Promise<tipoResposta<string>>;
|
|
||||||
}) => Promise<tipoResposta<string>>;
|
|
||||||
};
|
|
||||||
export {};
|
|
||||||
//# sourceMappingURL=autenticacao.d.ts.map
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
{"version":3,"file":"autenticacao.d.ts","sourceRoot":"","sources":["../src/autenticacao.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/D,KAAK,oBAAoB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAC7C,KAAK,uBAAuB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAgE/C,2EAA2E;AAC3E,eAAO,MAAM,aAAa;;kBAlDd,iBAAiB,GAAG,UAAU;cAClC,oBAAoB;QAC1B,mCAAmC;sBAE5B,MAAM,QACL,oBAAoB,KACvB,QAAQ,aAAa,GAAG,CAAC,CAAC;UAC7B,QAAQ,QAAQ,GAAG,MAAM,CAAC;gCApBK,iBAAiB,GAAG,UAAU;;kBAyCrD,iBAAiB,GAAG,UAAU;cAClC,uBAAuB;QAC7B,mCAAmC;sBAE5B,MAAM,QACL,uBAAuB,KAC1B,QAAQ,aAAa,MAAM,CAAC,CAAC;UAChC,QAAQ,aAAa,MAAM,CAAC,CAAC;CAmBhC,CAAA"}
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
{"version":3,"file":"autenticacao.js","sourceRoot":"","sources":["../src/autenticacao.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA+D;AAI/D,IAAM,eAAe,GAAG,UAAC,QAAwC;IAC/D,OAAA,UACE,QAAQ,IAAI,UAAU;QACpB,CAAC,CAAC,8BAA8B;QAChC,CAAC,CAAC,uBAAuB,kBACd;AAJf,CAIe,CAAA;AAEjB,+BAA+B;AAC/B,IAAM,YAAY,GAAG,UAAO,EAY3B;QAXC,QAAQ,cAAA,EACR,IAAI,UAAA,EACJ,MAAM,YAAA;;;;;;oBAUA,GAAG,GAAG,UAAG,eAAe,CAAC,QAAQ,CAAC,uBAAoB,CAAA;;;;oBAGzC,qBAAM,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC;6BACrC,IAAI,CAAC,UAAC,QAAQ;4BACb,OAAA,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAE,QAAkB,CAAC,CAAC,CAAE,MAAgB;wBAAzD,CAAyD,CAC1D;6BACA,KAAK,CAAC,cAAM,OAAA,MAAe,EAAf,CAAe,CAAC,EAAA;;oBAJzB,QAAQ,GAAG,SAIc;oBAE/B,sBAAO,QAAQ,EAAA;;;oBAEf,sBAAO,MAAM,EAAA;;;;;CAEhB,CAAA;AAED,IAAM,eAAe,GAAG,UAAO,EAY9B;QAXC,QAAQ,cAAA,EACR,IAAI,UAAA,EACJ,MAAM,YAAA;;;;;;oBAUA,GAAG,GAAG,UAAG,eAAe,CAAC,QAAQ,CAAC,gCAA6B,CAAA;;;;oBAGtD,qBAAM,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,UAAC,CAAC;4BAC3C,OAAA,4BAAc,CAAC,IAAI,CAAC,8CAAkC,CAAC,CAAE,CAAC;wBAA1D,CAA0D,CAC3D,EAAA;;oBAFK,IAAI,GAAG,SAEZ;oBAED,sBAAO,IAAI,EAAA;;;oBAEX,sBAAO,4BAAc,CAAC,IAAI,CAAC,8CAAkC,GAAC,CAAE,CAAC,EAAA;;;;;CAEpE,CAAA;AAED,2EAA2E;AAC9D,QAAA,aAAa,GAAG;IAC3B,YAAY,cAAA;IACZ,eAAe,iBAAA;IACf,eAAe,iBAAA;CAChB,CAAA"}
|
|
||||||
12
dist-require/autenticacao/_codigoContaSite.d.ts
vendored
Normal file
12
dist-require/autenticacao/_codigoContaSite.d.ts
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { type tipoResposta } from "p-respostas";
|
||||||
|
type tipoPostCodigoContaSite = {
|
||||||
|
site: string;
|
||||||
|
};
|
||||||
|
export declare const codigoContaSite: ({ ambiente, post, buscar, }: {
|
||||||
|
ambiente: "desenvolvimento" | "producao";
|
||||||
|
post: tipoPostCodigoContaSite;
|
||||||
|
/** função que conecta com a API */
|
||||||
|
buscar: (url: string, post: tipoPostCodigoContaSite) => Promise<tipoResposta<string>>;
|
||||||
|
}) => Promise<tipoResposta<string>>;
|
||||||
|
export {};
|
||||||
|
//# sourceMappingURL=_codigoContaSite.d.ts.map
|
||||||
1
dist-require/autenticacao/_codigoContaSite.d.ts.map
Normal file
1
dist-require/autenticacao/_codigoContaSite.d.ts.map
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"_codigoContaSite.d.ts","sourceRoot":"","sources":["../../src/autenticacao/_codigoContaSite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/D,KAAK,uBAAuB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAE/C,eAAO,MAAM,eAAe;cAKhB,iBAAiB,GAAG,UAAU;UAClC,uBAAuB;IAC7B,mCAAmC;kBAE5B,MAAM,QACL,uBAAuB,KAC1B,QAAQ,aAAa,MAAM,CAAC,CAAC;MAChC,QAAQ,aAAa,MAAM,CAAC,CAY/B,CAAA"}
|
||||||
68
dist-require/autenticacao/_codigoContaSite.js
Normal file
68
dist-require/autenticacao/_codigoContaSite.js
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
"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 };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.codigoContaSite = void 0;
|
||||||
|
var p_respostas_1 = require("p-respostas");
|
||||||
|
var _urlAutenticacao_1 = require("./_urlAutenticacao");
|
||||||
|
var codigoContaSite = function (_a) {
|
||||||
|
var ambiente = _a.ambiente, post = _a.post, buscar = _a.buscar;
|
||||||
|
return __awaiter(void 0, void 0, void 0, function () {
|
||||||
|
var url, resp, e_1;
|
||||||
|
return __generator(this, function (_b) {
|
||||||
|
switch (_b.label) {
|
||||||
|
case 0:
|
||||||
|
url = "".concat((0, _urlAutenticacao_1.urlAutenticacao)(ambiente), "/api/codigo_prefeitura_site");
|
||||||
|
_b.label = 1;
|
||||||
|
case 1:
|
||||||
|
_b.trys.push([1, 3, , 4]);
|
||||||
|
return [4 /*yield*/, buscar(url, post).catch(function (e) {
|
||||||
|
return p_respostas_1.respostaComuns.erro("erro ao buscar c\u00F3digo do site: ".concat(e));
|
||||||
|
})];
|
||||||
|
case 2:
|
||||||
|
resp = _b.sent();
|
||||||
|
return [2 /*return*/, resp];
|
||||||
|
case 3:
|
||||||
|
e_1 = _b.sent();
|
||||||
|
return [2 /*return*/, p_respostas_1.respostaComuns.erro("erro ao buscar c\u00F3digo do site: ".concat(e_1))];
|
||||||
|
case 4: return [2 /*return*/];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
exports.codigoContaSite = codigoContaSite;
|
||||||
|
//# sourceMappingURL=_codigoContaSite.js.map
|
||||||
1
dist-require/autenticacao/_codigoContaSite.js.map
Normal file
1
dist-require/autenticacao/_codigoContaSite.js.map
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"_codigoContaSite.js","sourceRoot":"","sources":["../../src/autenticacao/_codigoContaSite.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA+D;AAC/D,uDAAoD;AAG7C,IAAM,eAAe,GAAG,UAAO,EAYrC;QAXC,QAAQ,cAAA,EACR,IAAI,UAAA,EACJ,MAAM,YAAA;;;;;;oBAUA,GAAG,GAAG,UAAG,IAAA,kCAAe,EAAC,QAAQ,CAAC,gCAA6B,CAAA;;;;oBAGtD,qBAAM,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,UAAC,CAAC;4BAC3C,OAAA,4BAAc,CAAC,IAAI,CAAC,8CAAkC,CAAC,CAAE,CAAC;wBAA1D,CAA0D,CAC3D,EAAA;;oBAFK,IAAI,GAAG,SAEZ;oBAED,sBAAO,IAAI,EAAA;;;oBAEX,sBAAO,4BAAc,CAAC,IAAI,CAAC,8CAAkC,GAAC,CAAE,CAAC,EAAA;;;;;CAEpE,CAAA;AAxBY,QAAA,eAAe,mBAwB3B"}
|
||||||
16
dist-require/autenticacao/_consultaUsuariosexterno.d.ts
vendored
Normal file
16
dist-require/autenticacao/_consultaUsuariosexterno.d.ts
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { type tipoResposta } from "p-respostas";
|
||||||
|
export type tipoUsuarioExterno = {
|
||||||
|
nome: string;
|
||||||
|
email: string;
|
||||||
|
telefone: string;
|
||||||
|
vinculo: string;
|
||||||
|
codigo_produto: string;
|
||||||
|
chave_produto: string;
|
||||||
|
};
|
||||||
|
export declare const consultaUsuariosexterno: ({ token_produto, ambiente, codigo_produto, chave_produto, }: {
|
||||||
|
ambiente: "desenvolvimento" | "producao";
|
||||||
|
token_produto: string;
|
||||||
|
codigo_produto: string;
|
||||||
|
chave_produto: string;
|
||||||
|
}) => Promise<tipoResposta<tipoUsuarioExterno[]>>;
|
||||||
|
//# sourceMappingURL=_consultaUsuariosexterno.d.ts.map
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"_consultaUsuariosexterno.d.ts","sourceRoot":"","sources":["../../src/autenticacao/_consultaUsuariosexterno.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,uBAAuB;cAMxB,iBAAiB,GAAG,UAAU;mBACzB,MAAM;oBACL,MAAM;mBACP,MAAM;MACnB,QAAQ,aAAa,kBAAkB,EAAE,CAAC,CAG7C,CAAA"}
|
||||||
51
dist-require/autenticacao/_consultaUsuariosexterno.js
Normal file
51
dist-require/autenticacao/_consultaUsuariosexterno.js
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
"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 };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.consultaUsuariosexterno = void 0;
|
||||||
|
var p_respostas_1 = require("p-respostas");
|
||||||
|
var consultaUsuariosexterno = function (_a) {
|
||||||
|
var token_produto = _a.token_produto, ambiente = _a.ambiente, codigo_produto = _a.codigo_produto, chave_produto = _a.chave_produto;
|
||||||
|
return __awaiter(void 0, void 0, void 0, function () {
|
||||||
|
return __generator(this, function (_b) {
|
||||||
|
console.log(token_produto, ambiente, codigo_produto, chave_produto);
|
||||||
|
return [2 /*return*/, p_respostas_1.respostaComuns.valor([])];
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
exports.consultaUsuariosexterno = consultaUsuariosexterno;
|
||||||
|
//# sourceMappingURL=_consultaUsuariosexterno.js.map
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"_consultaUsuariosexterno.js","sourceRoot":"","sources":["../../src/autenticacao/_consultaUsuariosexterno.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA+D;AAWxD,IAAM,uBAAuB,GAAG,UAAO,EAU7C;QATC,aAAa,mBAAA,EACb,QAAQ,cAAA,EACR,cAAc,oBAAA,EACd,aAAa,mBAAA;;;YAOb,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,CAAC,CAAA;YACnE,sBAAO,4BAAc,CAAC,KAAK,CAAC,EAAE,CAAC,EAAA;;;CAChC,CAAA;AAbY,QAAA,uBAAuB,2BAanC"}
|
||||||
2
dist-require/autenticacao/_urlAutenticacao.d.ts
vendored
Normal file
2
dist-require/autenticacao/_urlAutenticacao.d.ts
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
export declare const urlAutenticacao: (ambiente: "desenvolvimento" | "producao") => string;
|
||||||
|
//# sourceMappingURL=_urlAutenticacao.d.ts.map
|
||||||
1
dist-require/autenticacao/_urlAutenticacao.d.ts.map
Normal file
1
dist-require/autenticacao/_urlAutenticacao.d.ts.map
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"_urlAutenticacao.d.ts","sourceRoot":"","sources":["../../src/autenticacao/_urlAutenticacao.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,aAAc,iBAAiB,GAAG,UAAU,WAKvD,CAAA"}
|
||||||
10
dist-require/autenticacao/_urlAutenticacao.js
Normal file
10
dist-require/autenticacao/_urlAutenticacao.js
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.urlAutenticacao = void 0;
|
||||||
|
var urlAutenticacao = function (ambiente) {
|
||||||
|
return "".concat(ambiente == "producao"
|
||||||
|
? "https://carro-de-boi.idz.one"
|
||||||
|
: "http://localhost:5030", "/autenticacao");
|
||||||
|
};
|
||||||
|
exports.urlAutenticacao = urlAutenticacao;
|
||||||
|
//# sourceMappingURL=_urlAutenticacao.js.map
|
||||||
1
dist-require/autenticacao/_urlAutenticacao.js.map
Normal file
1
dist-require/autenticacao/_urlAutenticacao.js.map
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"_urlAutenticacao.js","sourceRoot":"","sources":["../../src/autenticacao/_urlAutenticacao.ts"],"names":[],"mappings":";;;AAAO,IAAM,eAAe,GAAG,UAAC,QAAwC;IACtE,OAAA,UACE,QAAQ,IAAI,UAAU;QACpB,CAAC,CAAC,8BAA8B;QAChC,CAAC,CAAC,uBAAuB,kBACd;AAJf,CAIe,CAAA;AALJ,QAAA,eAAe,mBAKX"}
|
||||||
13
dist-require/autenticacao/_validarToken.d.ts
vendored
Normal file
13
dist-require/autenticacao/_validarToken.d.ts
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
import type { tipoResposta } from "p-respostas";
|
||||||
|
type tipoPostValidarTokem = {
|
||||||
|
token: string;
|
||||||
|
};
|
||||||
|
/** faz a validação do token */
|
||||||
|
export declare const validarToken: ({ ambiente, post, buscar, }: {
|
||||||
|
ambiente: "desenvolvimento" | "producao";
|
||||||
|
post: tipoPostValidarTokem;
|
||||||
|
/** função que conecta com a API */
|
||||||
|
buscar: (url: string, post: tipoPostValidarTokem) => Promise<tipoResposta<any>>;
|
||||||
|
}) => Promise<"valido" | "erro">;
|
||||||
|
export {};
|
||||||
|
//# sourceMappingURL=_validarToken.d.ts.map
|
||||||
1
dist-require/autenticacao/_validarToken.d.ts.map
Normal file
1
dist-require/autenticacao/_validarToken.d.ts.map
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"_validarToken.d.ts","sourceRoot":"","sources":["../../src/autenticacao/_validarToken.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,KAAK,oBAAoB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAE7C,+BAA+B;AAC/B,eAAO,MAAM,YAAY;cAKb,iBAAiB,GAAG,UAAU;UAClC,oBAAoB;IAC1B,mCAAmC;kBAE5B,MAAM,QACL,oBAAoB,KACvB,QAAQ,aAAa,GAAG,CAAC,CAAC;MAC7B,QAAQ,QAAQ,GAAG,MAAM,CAc5B,CAAA"}
|
||||||
|
|
@ -36,13 +36,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.pAutenticacao = void 0;
|
exports.validarToken = void 0;
|
||||||
var p_respostas_1 = require("p-respostas");
|
var _urlAutenticacao_1 = require("./_urlAutenticacao");
|
||||||
var urlAutenticacao = function (ambiente) {
|
|
||||||
return "".concat(ambiente == "producao"
|
|
||||||
? "https://carro-de-boi.idz.one"
|
|
||||||
: "http://localhost:5030", "/autenticacao");
|
|
||||||
};
|
|
||||||
/** 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, buscar = _a.buscar;
|
||||||
|
|
@ -51,7 +46,7 @@ var validarToken = function (_a) {
|
||||||
return __generator(this, function (_b) {
|
return __generator(this, function (_b) {
|
||||||
switch (_b.label) {
|
switch (_b.label) {
|
||||||
case 0:
|
case 0:
|
||||||
url = "".concat(urlAutenticacao(ambiente), "/api/validar_token");
|
url = "".concat((0, _urlAutenticacao_1.urlAutenticacao)(ambiente), "/api/validar_token");
|
||||||
_b.label = 1;
|
_b.label = 1;
|
||||||
case 1:
|
case 1:
|
||||||
_b.trys.push([1, 3, , 4]);
|
_b.trys.push([1, 3, , 4]);
|
||||||
|
|
@ -71,35 +66,5 @@ var validarToken = function (_a) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var codigoContaSite = function (_a) {
|
exports.validarToken = validarToken;
|
||||||
var ambiente = _a.ambiente, post = _a.post, buscar = _a.buscar;
|
//# sourceMappingURL=_validarToken.js.map
|
||||||
return __awaiter(void 0, void 0, void 0, function () {
|
|
||||||
var url, resp, e_2;
|
|
||||||
return __generator(this, function (_b) {
|
|
||||||
switch (_b.label) {
|
|
||||||
case 0:
|
|
||||||
url = "".concat(urlAutenticacao(ambiente), "/api/codigo_prefeitura_site");
|
|
||||||
_b.label = 1;
|
|
||||||
case 1:
|
|
||||||
_b.trys.push([1, 3, , 4]);
|
|
||||||
return [4 /*yield*/, buscar(url, post).catch(function (e) {
|
|
||||||
return p_respostas_1.respostaComuns.erro("erro ao buscar c\u00F3digo do site: ".concat(e));
|
|
||||||
})];
|
|
||||||
case 2:
|
|
||||||
resp = _b.sent();
|
|
||||||
return [2 /*return*/, resp];
|
|
||||||
case 3:
|
|
||||||
e_2 = _b.sent();
|
|
||||||
return [2 /*return*/, p_respostas_1.respostaComuns.erro("erro ao buscar c\u00F3digo do site: ".concat(e_2))];
|
|
||||||
case 4: return [2 /*return*/];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
/** todas as rotas de comunicação com autenticador partem dessa variável */
|
|
||||||
exports.pAutenticacao = {
|
|
||||||
validarToken: validarToken,
|
|
||||||
urlAutenticacao: urlAutenticacao,
|
|
||||||
codigoContaSite: codigoContaSite,
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=autenticacao.js.map
|
|
||||||
1
dist-require/autenticacao/_validarToken.js.map
Normal file
1
dist-require/autenticacao/_validarToken.js.map
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"_validarToken.js","sourceRoot":"","sources":["../../src/autenticacao/_validarToken.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uDAAoD;AAGpD,+BAA+B;AACxB,IAAM,YAAY,GAAG,UAAO,EAYlC;QAXC,QAAQ,cAAA,EACR,IAAI,UAAA,EACJ,MAAM,YAAA;;;;;;oBAUA,GAAG,GAAG,UAAG,IAAA,kCAAe,EAAC,QAAQ,CAAC,uBAAoB,CAAA;;;;oBAGzC,qBAAM,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC;6BACrC,IAAI,CAAC,UAAC,QAAQ;4BACb,OAAA,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAE,QAAkB,CAAC,CAAC,CAAE,MAAgB;wBAAzD,CAAyD,CAC1D;6BACA,KAAK,CAAC,cAAM,OAAA,MAAe,EAAf,CAAe,CAAC,EAAA;;oBAJzB,QAAQ,GAAG,SAIc;oBAE/B,sBAAO,QAAQ,EAAA;;;oBAEf,sBAAO,MAAM,EAAA;;;;;CAEhB,CAAA;AA1BY,QAAA,YAAY,gBA0BxB"}
|
||||||
30
dist-require/autenticacao/index.d.ts
vendored
Normal file
30
dist-require/autenticacao/index.d.ts
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
export type { tipoUsuarioExterno } from "./_consultaUsuariosexterno";
|
||||||
|
/** todas as rotas de comunicação com autenticador partem dessa variável */
|
||||||
|
export declare const pAutenticacao: {
|
||||||
|
validarToken: ({ ambiente, post, buscar, }: {
|
||||||
|
ambiente: "desenvolvimento" | "producao";
|
||||||
|
post: {
|
||||||
|
token: string;
|
||||||
|
};
|
||||||
|
buscar: (url: string, post: {
|
||||||
|
token: string;
|
||||||
|
}) => Promise<import("p-respostas").tipoResposta<any>>;
|
||||||
|
}) => Promise<"valido" | "erro">;
|
||||||
|
urlAutenticacao: (ambiente: "desenvolvimento" | "producao") => string;
|
||||||
|
codigoContaSite: ({ ambiente, post, buscar, }: {
|
||||||
|
ambiente: "desenvolvimento" | "producao";
|
||||||
|
post: {
|
||||||
|
site: string;
|
||||||
|
};
|
||||||
|
buscar: (url: string, post: {
|
||||||
|
site: string;
|
||||||
|
}) => Promise<import("p-respostas").tipoResposta<string>>;
|
||||||
|
}) => Promise<import("p-respostas").tipoResposta<string>>;
|
||||||
|
consultaUsuariosexterno: ({ token_produto, ambiente, codigo_produto, chave_produto, }: {
|
||||||
|
ambiente: "desenvolvimento" | "producao";
|
||||||
|
token_produto: string;
|
||||||
|
codigo_produto: string;
|
||||||
|
chave_produto: string;
|
||||||
|
}) => Promise<import("p-respostas").tipoResposta<import("./_consultaUsuariosexterno").tipoUsuarioExterno[]>>;
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=index.d.ts.map
|
||||||
1
dist-require/autenticacao/index.d.ts.map
Normal file
1
dist-require/autenticacao/index.d.ts.map
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/autenticacao/index.ts"],"names":[],"mappings":"AAKA,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAEpE,2EAA2E;AAC3E,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;CAKzB,CAAA"}
|
||||||
15
dist-require/autenticacao/index.js
Normal file
15
dist-require/autenticacao/index.js
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.pAutenticacao = void 0;
|
||||||
|
var _codigoContaSite_1 = require("./_codigoContaSite");
|
||||||
|
var _consultaUsuariosexterno_1 = require("./_consultaUsuariosexterno");
|
||||||
|
var _urlAutenticacao_1 = require("./_urlAutenticacao");
|
||||||
|
var _validarToken_1 = require("./_validarToken");
|
||||||
|
/** todas as rotas de comunicação com autenticador partem dessa variável */
|
||||||
|
exports.pAutenticacao = {
|
||||||
|
validarToken: _validarToken_1.validarToken,
|
||||||
|
urlAutenticacao: _urlAutenticacao_1.urlAutenticacao,
|
||||||
|
codigoContaSite: _codigoContaSite_1.codigoContaSite,
|
||||||
|
consultaUsuariosexterno: _consultaUsuariosexterno_1.consultaUsuariosexterno,
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=index.js.map
|
||||||
1
dist-require/autenticacao/index.js.map
Normal file
1
dist-require/autenticacao/index.js.map
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/autenticacao/index.ts"],"names":[],"mappings":";;;AAAA,uDAAoD;AACpD,uEAAoE;AACpE,uDAAoD;AACpD,iDAA8C;AAI9C,2EAA2E;AAC9D,QAAA,aAAa,GAAG;IAC3B,YAAY,8BAAA;IACZ,eAAe,oCAAA;IACf,eAAe,oCAAA;IACf,uBAAuB,oDAAA;CACxB,CAAA"}
|
||||||
2
dist-require/index.d.ts
vendored
2
dist-require/index.d.ts
vendored
|
|
@ -1,3 +1,3 @@
|
||||||
export * from "./tokenQuipo";
|
export * from "./tokenQuipo";
|
||||||
export * from "./autenticacao";
|
export * from "./autenticacao/_codigoContaSite";
|
||||||
//# sourceMappingURL=index.d.ts.map
|
//# sourceMappingURL=index.d.ts.map
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA"}
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,iCAAiC,CAAA"}
|
||||||
|
|
@ -15,5 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
__exportStar(require("./tokenQuipo"), exports);
|
__exportStar(require("./tokenQuipo"), exports);
|
||||||
__exportStar(require("./autenticacao"), exports);
|
__exportStar(require("./autenticacao/_codigoContaSite"), exports);
|
||||||
//# sourceMappingURL=index.js.map
|
//# sourceMappingURL=index.js.map
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,iDAA8B"}
|
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,kEAA+C"}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "p-drives",
|
"name": "p-drives",
|
||||||
"version": "0.40.0",
|
"version": "0.41.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
|
|
|
||||||
|
|
@ -1,72 +0,0 @@
|
||||||
import { respostaComuns, type tipoResposta } from "p-respostas"
|
|
||||||
type tipoPostValidarTokem = { token: string }
|
|
||||||
type tipoPostCodigoContaSite = { site: string }
|
|
||||||
|
|
||||||
const urlAutenticacao = (ambiente: "desenvolvimento" | "producao") =>
|
|
||||||
`${
|
|
||||||
ambiente == "producao"
|
|
||||||
? "https://carro-de-boi.idz.one"
|
|
||||||
: "http://localhost:5030"
|
|
||||||
}/autenticacao`
|
|
||||||
|
|
||||||
/** faz a validação do token */
|
|
||||||
const validarToken = async ({
|
|
||||||
ambiente,
|
|
||||||
post,
|
|
||||||
buscar,
|
|
||||||
}: {
|
|
||||||
ambiente: "desenvolvimento" | "producao"
|
|
||||||
post: tipoPostValidarTokem
|
|
||||||
/** função que conecta com a API */
|
|
||||||
buscar: (
|
|
||||||
url: string,
|
|
||||||
post: tipoPostValidarTokem,
|
|
||||||
) => Promise<tipoResposta<any>>
|
|
||||||
}): Promise<"valido" | "erro"> => {
|
|
||||||
const url = `${urlAutenticacao(ambiente)}/api/validar_token`
|
|
||||||
|
|
||||||
try {
|
|
||||||
const resposta = await buscar(url, post)
|
|
||||||
.then((resposta) =>
|
|
||||||
resposta.eCerto ? ("valido" as const) : ("erro" as const),
|
|
||||||
)
|
|
||||||
.catch(() => "erro" as const)
|
|
||||||
|
|
||||||
return resposta
|
|
||||||
} catch (e) {
|
|
||||||
return "erro"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const codigoContaSite = async ({
|
|
||||||
ambiente,
|
|
||||||
post,
|
|
||||||
buscar,
|
|
||||||
}: {
|
|
||||||
ambiente: "desenvolvimento" | "producao"
|
|
||||||
post: tipoPostCodigoContaSite
|
|
||||||
/** função que conecta com a API */
|
|
||||||
buscar: (
|
|
||||||
url: string,
|
|
||||||
post: tipoPostCodigoContaSite,
|
|
||||||
) => Promise<tipoResposta<string>>
|
|
||||||
}): Promise<tipoResposta<string>> => {
|
|
||||||
const url = `${urlAutenticacao(ambiente)}/api/codigo_prefeitura_site`
|
|
||||||
|
|
||||||
try {
|
|
||||||
const resp = await buscar(url, post).catch((e) =>
|
|
||||||
respostaComuns.erro(`erro ao buscar código do site: ${e}`),
|
|
||||||
)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
} catch (e) {
|
|
||||||
return respostaComuns.erro(`erro ao buscar código do site: ${e}`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** todas as rotas de comunicação com autenticador partem dessa variável */
|
|
||||||
export const pAutenticacao = {
|
|
||||||
validarToken,
|
|
||||||
urlAutenticacao,
|
|
||||||
codigoContaSite,
|
|
||||||
}
|
|
||||||
29
src/autenticacao/_codigoContaSite.ts
Normal file
29
src/autenticacao/_codigoContaSite.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
import { respostaComuns, type tipoResposta } from "p-respostas"
|
||||||
|
import { urlAutenticacao } from "./_urlAutenticacao"
|
||||||
|
type tipoPostCodigoContaSite = { site: string }
|
||||||
|
|
||||||
|
export const codigoContaSite = async ({
|
||||||
|
ambiente,
|
||||||
|
post,
|
||||||
|
buscar,
|
||||||
|
}: {
|
||||||
|
ambiente: "desenvolvimento" | "producao"
|
||||||
|
post: tipoPostCodigoContaSite
|
||||||
|
/** função que conecta com a API */
|
||||||
|
buscar: (
|
||||||
|
url: string,
|
||||||
|
post: tipoPostCodigoContaSite,
|
||||||
|
) => Promise<tipoResposta<string>>
|
||||||
|
}): Promise<tipoResposta<string>> => {
|
||||||
|
const url = `${urlAutenticacao(ambiente)}/api/codigo_prefeitura_site`
|
||||||
|
|
||||||
|
try {
|
||||||
|
const resp = await buscar(url, post).catch((e) =>
|
||||||
|
respostaComuns.erro(`erro ao buscar código do site: ${e}`),
|
||||||
|
)
|
||||||
|
|
||||||
|
return resp
|
||||||
|
} catch (e) {
|
||||||
|
return respostaComuns.erro(`erro ao buscar código do site: ${e}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
25
src/autenticacao/_consultaUsuariosexterno.ts
Normal file
25
src/autenticacao/_consultaUsuariosexterno.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
import { respostaComuns, type tipoResposta } from "p-respostas"
|
||||||
|
|
||||||
|
export type tipoUsuarioExterno = {
|
||||||
|
nome: string
|
||||||
|
email: string
|
||||||
|
telefone: string
|
||||||
|
vinculo: string
|
||||||
|
codigo_produto: string
|
||||||
|
chave_produto: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export const consultaUsuariosexterno = async ({
|
||||||
|
token_produto,
|
||||||
|
ambiente,
|
||||||
|
codigo_produto,
|
||||||
|
chave_produto,
|
||||||
|
}: {
|
||||||
|
ambiente: "desenvolvimento" | "producao"
|
||||||
|
token_produto: string
|
||||||
|
codigo_produto: string
|
||||||
|
chave_produto: string
|
||||||
|
}): Promise<tipoResposta<tipoUsuarioExterno[]>> => {
|
||||||
|
console.log(token_produto, ambiente, codigo_produto, chave_produto)
|
||||||
|
return respostaComuns.valor([])
|
||||||
|
}
|
||||||
6
src/autenticacao/_urlAutenticacao.ts
Normal file
6
src/autenticacao/_urlAutenticacao.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
export const urlAutenticacao = (ambiente: "desenvolvimento" | "producao") =>
|
||||||
|
`${
|
||||||
|
ambiente == "producao"
|
||||||
|
? "https://carro-de-boi.idz.one"
|
||||||
|
: "http://localhost:5030"
|
||||||
|
}/autenticacao`
|
||||||
32
src/autenticacao/_validarToken.ts
Normal file
32
src/autenticacao/_validarToken.ts
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
import type { tipoResposta } from "p-respostas"
|
||||||
|
import { urlAutenticacao } from "./_urlAutenticacao"
|
||||||
|
type tipoPostValidarTokem = { token: string }
|
||||||
|
|
||||||
|
/** faz a validação do token */
|
||||||
|
export const validarToken = async ({
|
||||||
|
ambiente,
|
||||||
|
post,
|
||||||
|
buscar,
|
||||||
|
}: {
|
||||||
|
ambiente: "desenvolvimento" | "producao"
|
||||||
|
post: tipoPostValidarTokem
|
||||||
|
/** função que conecta com a API */
|
||||||
|
buscar: (
|
||||||
|
url: string,
|
||||||
|
post: tipoPostValidarTokem,
|
||||||
|
) => Promise<tipoResposta<any>>
|
||||||
|
}): Promise<"valido" | "erro"> => {
|
||||||
|
const url = `${urlAutenticacao(ambiente)}/api/validar_token`
|
||||||
|
|
||||||
|
try {
|
||||||
|
const resposta = await buscar(url, post)
|
||||||
|
.then((resposta) =>
|
||||||
|
resposta.eCerto ? ("valido" as const) : ("erro" as const),
|
||||||
|
)
|
||||||
|
.catch(() => "erro" as const)
|
||||||
|
|
||||||
|
return resposta
|
||||||
|
} catch (e) {
|
||||||
|
return "erro"
|
||||||
|
}
|
||||||
|
}
|
||||||
14
src/autenticacao/index.ts
Normal file
14
src/autenticacao/index.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { codigoContaSite } from "./_codigoContaSite"
|
||||||
|
import { consultaUsuariosexterno } from "./_consultaUsuariosexterno"
|
||||||
|
import { urlAutenticacao } from "./_urlAutenticacao"
|
||||||
|
import { validarToken } from "./_validarToken"
|
||||||
|
|
||||||
|
export type { tipoUsuarioExterno } from "./_consultaUsuariosexterno"
|
||||||
|
|
||||||
|
/** todas as rotas de comunicação com autenticador partem dessa variável */
|
||||||
|
export const pAutenticacao = {
|
||||||
|
validarToken,
|
||||||
|
urlAutenticacao,
|
||||||
|
codigoContaSite,
|
||||||
|
consultaUsuariosexterno,
|
||||||
|
}
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
export * from "./tokenQuipo"
|
export * from "./tokenQuipo"
|
||||||
export * from "./autenticacao"
|
export * from "./autenticacao/_codigoContaSite"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue