ajuste de libs
This commit is contained in:
parent
caf3f59453
commit
547f693652
22 changed files with 236 additions and 306 deletions
|
|
@ -43,36 +43,34 @@ exports.codigoContaSite = void 0;
|
|||
var p_respostas_1 = require("p-respostas");
|
||||
var _urlAutenticacao_1 = require("./_urlAutenticacao");
|
||||
var cross_fetch_1 = __importDefault(require("cross-fetch"));
|
||||
var codigoContaSite = function (_a) {
|
||||
var ambiente = _a.ambiente, post = _a.post;
|
||||
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*/, (0, cross_fetch_1.default)(url, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(post),
|
||||
headers: { "Content-Type": "application/json" },
|
||||
})
|
||||
.then(function (r) { return r.json(); })
|
||||
.catch(function (e) {
|
||||
return p_respostas_1.respostaComuns.erro("Erro ao enviar registros", [e.message]);
|
||||
})
|
||||
.then(function (r) { return r; })];
|
||||
case 2:
|
||||
resp = _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*/];
|
||||
}
|
||||
});
|
||||
var codigoContaSite = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
||||
var url, resp, e_1;
|
||||
var ambiente = _b.ambiente, post = _b.post;
|
||||
return __generator(this, function (_c) {
|
||||
switch (_c.label) {
|
||||
case 0:
|
||||
url = "".concat((0, _urlAutenticacao_1.urlAutenticacao)(ambiente), "/api/codigo_prefeitura_site");
|
||||
_c.label = 1;
|
||||
case 1:
|
||||
_c.trys.push([1, 3, , 4]);
|
||||
return [4 /*yield*/, (0, cross_fetch_1.default)(url, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(post),
|
||||
headers: { "Content-Type": "application/json" },
|
||||
})
|
||||
.then(function (r) { return r.json(); })
|
||||
.catch(function (e) {
|
||||
return p_respostas_1.respostaComuns.erro("Erro ao enviar registros", [e.message]);
|
||||
})
|
||||
.then(function (r) { return r; })];
|
||||
case 2:
|
||||
resp = _c.sent();
|
||||
return [2 /*return*/, resp];
|
||||
case 3:
|
||||
e_1 = _c.sent();
|
||||
return [2 /*return*/, p_respostas_1.respostaComuns.erro("erro ao buscar c\u00F3digo do site: ".concat(e_1))];
|
||||
case 4: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
};
|
||||
}); };
|
||||
exports.codigoContaSite = codigoContaSite;
|
||||
|
|
|
|||
|
|
@ -43,26 +43,24 @@ exports.usuarios_quipo_governo = void 0;
|
|||
var cross_fetch_1 = __importDefault(require("cross-fetch"));
|
||||
var p_respostas_1 = require("p-respostas");
|
||||
var _urlAutenticacao_1 = require("./_urlAutenticacao");
|
||||
var usuarios_quipo_governo = function (_a) {
|
||||
var token_produto = _a.token_produto, ambiente = _a.ambiente;
|
||||
return __awaiter(void 0, void 0, void 0, function () {
|
||||
var url, headers;
|
||||
return __generator(this, function (_b) {
|
||||
url = "".concat((0, _urlAutenticacao_1.urlAutenticacao)(ambiente), "/api/usuarios_quipo_governo");
|
||||
if (!token_produto)
|
||||
return [2 /*return*/, p_respostas_1.respostaComuns.erro("token_produto não informado")];
|
||||
headers = {
|
||||
token: token_produto,
|
||||
};
|
||||
return [2 /*return*/, (0, cross_fetch_1.default)(url, {
|
||||
headers: headers,
|
||||
})
|
||||
.then(function (r) { return r.json(); })
|
||||
.catch(function (e) {
|
||||
return p_respostas_1.respostaComuns.erro("Erro ao buscar usu\u00E1rios quipo governo ".concat(e.message));
|
||||
})
|
||||
.then(function (r) { return r; })];
|
||||
});
|
||||
var usuarios_quipo_governo = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
||||
var url, headers;
|
||||
var token_produto = _b.token_produto, ambiente = _b.ambiente;
|
||||
return __generator(this, function (_c) {
|
||||
url = "".concat((0, _urlAutenticacao_1.urlAutenticacao)(ambiente), "/api/usuarios_quipo_governo");
|
||||
if (!token_produto)
|
||||
return [2 /*return*/, p_respostas_1.respostaComuns.erro("token_produto não informado")];
|
||||
headers = {
|
||||
token: token_produto,
|
||||
};
|
||||
return [2 /*return*/, (0, cross_fetch_1.default)(url, {
|
||||
headers: headers,
|
||||
})
|
||||
.then(function (r) { return r.json(); })
|
||||
.catch(function (e) {
|
||||
return p_respostas_1.respostaComuns.erro("Erro ao buscar usu\u00E1rios quipo governo ".concat(e.message));
|
||||
})
|
||||
.then(function (r) { return r; })];
|
||||
});
|
||||
};
|
||||
}); };
|
||||
exports.usuarios_quipo_governo = usuarios_quipo_governo;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@ export declare const usuarios_quipo_vincular: ({ token_produto, ambiente, conta,
|
|||
token_produto: string;
|
||||
conta: string;
|
||||
vinculo: string;
|
||||
codigo_usuario?: string | undefined;
|
||||
codigo_usuario?: string;
|
||||
email: string;
|
||||
}) => Promise<tipoResposta<string>>;
|
||||
|
|
|
|||
|
|
@ -43,41 +43,39 @@ exports.usuarios_quipo_vincular = void 0;
|
|||
var cross_fetch_1 = __importDefault(require("cross-fetch"));
|
||||
var p_respostas_1 = require("p-respostas");
|
||||
var _urlAutenticacao_1 = require("./_urlAutenticacao");
|
||||
var usuarios_quipo_vincular = function (_a) {
|
||||
var token_produto = _a.token_produto, ambiente = _a.ambiente, conta = _a.conta, vinculo = _a.vinculo, codigo_usuario = _a.codigo_usuario, email = _a.email;
|
||||
return __awaiter(void 0, void 0, void 0, function () {
|
||||
var url, headers, parametros;
|
||||
return __generator(this, function (_b) {
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
url = "".concat((0, _urlAutenticacao_1.urlAutenticacao)(ambiente), "/api/vinculos__criar");
|
||||
if (!token_produto)
|
||||
return [2 /*return*/, p_respostas_1.respostaComuns.erro("token_produto não informado")];
|
||||
headers = {
|
||||
token: token_produto,
|
||||
"Content-Type": "application/json",
|
||||
};
|
||||
parametros = {
|
||||
vinculos: { codigo_conta: conta, codigo_usuario: codigo_usuario, vinculo: vinculo },
|
||||
email: email,
|
||||
};
|
||||
return [4 /*yield*/, (0, cross_fetch_1.default)(url, {
|
||||
headers: headers,
|
||||
body: JSON.stringify(parametros),
|
||||
method: "POST",
|
||||
})
|
||||
.then(function (r) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, r.json()];
|
||||
case 1: return [2 /*return*/, _a.sent()];
|
||||
}
|
||||
}); }); })
|
||||
.catch(function (e) {
|
||||
return p_respostas_1.respostaComuns.erro("Erro ao criar vinculo de usuario ".concat(e.message));
|
||||
})];
|
||||
case 1: return [2 /*return*/, _b.sent()];
|
||||
}
|
||||
});
|
||||
var usuarios_quipo_vincular = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
||||
var url, headers, parametros;
|
||||
var token_produto = _b.token_produto, ambiente = _b.ambiente, conta = _b.conta, vinculo = _b.vinculo, codigo_usuario = _b.codigo_usuario, email = _b.email;
|
||||
return __generator(this, function (_c) {
|
||||
switch (_c.label) {
|
||||
case 0:
|
||||
url = "".concat((0, _urlAutenticacao_1.urlAutenticacao)(ambiente), "/api/vinculos__criar");
|
||||
if (!token_produto)
|
||||
return [2 /*return*/, p_respostas_1.respostaComuns.erro("token_produto não informado")];
|
||||
headers = {
|
||||
token: token_produto,
|
||||
"Content-Type": "application/json",
|
||||
};
|
||||
parametros = {
|
||||
vinculos: { codigo_conta: conta, codigo_usuario: codigo_usuario, vinculo: vinculo },
|
||||
email: email,
|
||||
};
|
||||
return [4 /*yield*/, (0, cross_fetch_1.default)(url, {
|
||||
headers: headers,
|
||||
body: JSON.stringify(parametros),
|
||||
method: "POST",
|
||||
})
|
||||
.then(function (r) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, r.json()];
|
||||
case 1: return [2 /*return*/, _a.sent()];
|
||||
}
|
||||
}); }); })
|
||||
.catch(function (e) {
|
||||
return p_respostas_1.respostaComuns.erro("Erro ao criar vinculo de usuario ".concat(e.message));
|
||||
})];
|
||||
case 1: return [2 /*return*/, _c.sent()];
|
||||
}
|
||||
});
|
||||
};
|
||||
}); };
|
||||
exports.usuarios_quipo_vincular = usuarios_quipo_vincular;
|
||||
|
|
|
|||
|
|
@ -43,37 +43,35 @@ exports.validarToken = void 0;
|
|||
var _urlAutenticacao_1 = require("./_urlAutenticacao");
|
||||
var cross_fetch_1 = __importDefault(require("cross-fetch"));
|
||||
/** faz a validação do token */
|
||||
var validarToken = function (_a) {
|
||||
var ambiente = _a.ambiente, post = _a.post;
|
||||
return __awaiter(void 0, void 0, void 0, function () {
|
||||
var url, resposta, e_1;
|
||||
return __generator(this, function (_b) {
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
url = "".concat((0, _urlAutenticacao_1.urlAutenticacao)(ambiente), "/api/validar_token");
|
||||
_b.label = 1;
|
||||
case 1:
|
||||
_b.trys.push([1, 3, , 4]);
|
||||
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) {
|
||||
return resposta.eCerto ? "valido" : "erro";
|
||||
})
|
||||
.catch(function () { return "erro"; })];
|
||||
case 2:
|
||||
resposta = _b.sent();
|
||||
return [2 /*return*/, resposta];
|
||||
case 3:
|
||||
e_1 = _b.sent();
|
||||
return [2 /*return*/, "erro"];
|
||||
case 4: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
var validarToken = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
||||
var url, resposta, e_1;
|
||||
var ambiente = _b.ambiente, post = _b.post;
|
||||
return __generator(this, function (_c) {
|
||||
switch (_c.label) {
|
||||
case 0:
|
||||
url = "".concat((0, _urlAutenticacao_1.urlAutenticacao)(ambiente), "/api/validar_token");
|
||||
_c.label = 1;
|
||||
case 1:
|
||||
_c.trys.push([1, 3, , 4]);
|
||||
return [4 /*yield*/, (0, cross_fetch_1.default)(url, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(post),
|
||||
headers: { "Content-Type": "application/json" },
|
||||
})
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (r) { return r; })
|
||||
.then(function (resposta) {
|
||||
return resposta.eCerto ? "valido" : "erro";
|
||||
})
|
||||
.catch(function () { return "erro"; })];
|
||||
case 2:
|
||||
resposta = _c.sent();
|
||||
return [2 /*return*/, resposta];
|
||||
case 3:
|
||||
e_1 = _c.sent();
|
||||
return [2 /*return*/, "erro"];
|
||||
case 4: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
};
|
||||
}); };
|
||||
exports.validarToken = validarToken;
|
||||
|
|
|
|||
13
dist-require/autenticacao/index.d.ts
vendored
13
dist-require/autenticacao/index.d.ts
vendored
|
|
@ -3,29 +3,28 @@ export type { tipoUsuarioExterno };
|
|||
/** todas as rotas de comunicação com autenticador partem dessa variável */
|
||||
export declare const pAutenticacao: {
|
||||
validarToken: ({ ambiente, post, }: {
|
||||
/** todas as rotas de comunicação com autenticador partem dessa variável */
|
||||
ambiente: "desenvolvimento" | "producao";
|
||||
ambiente: import("zod").TypeOf<typeof import("../ts/ambiente").zAmbiente>;
|
||||
post: {
|
||||
token: string;
|
||||
};
|
||||
}) => Promise<"valido" | "erro">;
|
||||
urlAutenticacao: (ambiente: "desenvolvimento" | "producao") => string;
|
||||
urlAutenticacao: (ambiente: import("zod").TypeOf<typeof import("../ts/ambiente").zAmbiente>) => string;
|
||||
codigoContaSite: ({ ambiente, post, }: {
|
||||
ambiente: "desenvolvimento" | "producao";
|
||||
ambiente: import("zod").TypeOf<typeof import("../ts/ambiente").zAmbiente>;
|
||||
post: {
|
||||
site: string;
|
||||
};
|
||||
}) => Promise<import("p-respostas").tipoResposta<string>>;
|
||||
usuarios_quipo_governo: ({ token_produto, ambiente, }: {
|
||||
ambiente: "desenvolvimento" | "producao";
|
||||
ambiente: import("zod").TypeOf<typeof import("../ts/ambiente").zAmbiente>;
|
||||
token_produto: string;
|
||||
}) => Promise<import("p-respostas").tipoResposta<tipoUsuarioExterno[]>>;
|
||||
usuarios_quipo_vincular: ({ token_produto, ambiente, conta, vinculo, codigo_usuario, email, }: {
|
||||
ambiente: "desenvolvimento" | "producao";
|
||||
ambiente: import("zod").TypeOf<typeof import("../ts/ambiente").zAmbiente>;
|
||||
token_produto: string;
|
||||
conta: string;
|
||||
vinculo: string;
|
||||
codigo_usuario?: string | undefined;
|
||||
codigo_usuario?: string;
|
||||
email: string;
|
||||
}) => Promise<import("p-respostas").tipoResposta<string>>;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue