build
This commit is contained in:
parent
81d017e8af
commit
f3b5bb3bce
20 changed files with 224 additions and 564 deletions
|
|
@ -1,23 +0,0 @@
|
|||
import { respostaComuns } from "p-respostas";
|
||||
import node_fetch from "cross-fetch";
|
||||
const codigoContaSite = async ({
|
||||
url_api_autenticacao,
|
||||
post
|
||||
}) => {
|
||||
const url = `${url_api_autenticacao}/api/codigo_prefeitura_site`;
|
||||
try {
|
||||
const resp = await 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;
|
||||
} catch (e) {
|
||||
return respostaComuns.erro(`erro ao buscar c\xF3digo do site: ${e}`);
|
||||
}
|
||||
};
|
||||
export {
|
||||
codigoContaSite
|
||||
};
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
import node_fetch from "cross-fetch";
|
||||
import { respostaComuns } from "p-respostas";
|
||||
const usuarios_quipo = async ({
|
||||
token_produto,
|
||||
url_api_autenticacao,
|
||||
inquilino
|
||||
}) => {
|
||||
const url = `${url_api_autenticacao}/api/usuarios__listar`;
|
||||
if (!token_produto) return respostaComuns.erro("token_produto n\xE3o informado");
|
||||
const headers = {
|
||||
token: token_produto,
|
||||
"Content-Type": "application/json"
|
||||
};
|
||||
return node_fetch(url, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ inquilino }),
|
||||
headers
|
||||
}).then((r) => r.json()).catch(
|
||||
(e) => respostaComuns.erro(`Erro ao buscar usu\xE1rios quipo governo ${e.message}`)
|
||||
).then((r) => r);
|
||||
};
|
||||
export {
|
||||
usuarios_quipo
|
||||
};
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
import node_fetch from "cross-fetch";
|
||||
import { respostaComuns } from "p-respostas";
|
||||
const usuarios_quipo_vincular = async ({
|
||||
token_produto,
|
||||
url_api_autenticacao,
|
||||
inquilino_codigo,
|
||||
vinculo,
|
||||
usuario_codigo,
|
||||
email
|
||||
}) => {
|
||||
const url = `${url_api_autenticacao}/api/vinculos__criar`;
|
||||
if (!token_produto) return respostaComuns.erro("token_produto n\xE3o informado");
|
||||
const headers = {
|
||||
token: token_produto,
|
||||
"Content-Type": "application/json"
|
||||
};
|
||||
const parametros = {
|
||||
vinculos: { inquilino_codigo, usuario_codigo, vinculo },
|
||||
email
|
||||
};
|
||||
return await node_fetch(url, {
|
||||
headers,
|
||||
body: JSON.stringify(parametros),
|
||||
method: "POST"
|
||||
}).then(async (r) => await r.json()).catch(
|
||||
(e) => respostaComuns.erro(`Erro ao criar vinculo de usuario ${e.message}`)
|
||||
);
|
||||
};
|
||||
export {
|
||||
usuarios_quipo_vincular
|
||||
};
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
import node_fetch from "cross-fetch";
|
||||
const validarToken = async ({
|
||||
url_api_autenticacao,
|
||||
post
|
||||
}) => {
|
||||
const url = `${url_api_autenticacao}/api/validar_token`;
|
||||
try {
|
||||
const resposta = await node_fetch(url, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(post),
|
||||
headers: { "Content-Type": "application/json" }
|
||||
}).then((r) => r.json()).then((r) => r).then(
|
||||
(resposta2) => resposta2.eCerto ? "valido" : "erro"
|
||||
).catch(() => "erro");
|
||||
return resposta;
|
||||
} catch (_e) {
|
||||
return "erro";
|
||||
}
|
||||
};
|
||||
export {
|
||||
validarToken
|
||||
};
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
import { codigoContaSite } from "./_codigoContaSite";
|
||||
import { usuarios_quipo } from "./_usuarios_quipo";
|
||||
import { usuarios_quipo_vincular } from "./_usuarios_quipo_vincular";
|
||||
import { validarToken } from "./_validarToken";
|
||||
const pAutenticacao = {
|
||||
validarToken,
|
||||
codigoContaSite,
|
||||
usuarios_quipo,
|
||||
usuarios_quipo_vincular
|
||||
};
|
||||
export {
|
||||
pAutenticacao
|
||||
};
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
export * from "./autenticacao";
|
||||
export * from "./lista-prefeituras";
|
||||
export * from "./lista-usuarios";
|
||||
export * from "./lista-vinculos";
|
||||
export * from "./produtos";
|
||||
export * from "./tokens";
|
||||
1
dist-front/index.mjs
Normal file
1
dist-front/index.mjs
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -1,26 +0,0 @@
|
|||
import cFetch from "cross-fetch";
|
||||
import { respostaComuns } from "p-respostas";
|
||||
const tx_listar_prefeituras = "listar_prefeituras";
|
||||
const listarPrefeituras = async ({
|
||||
url_api_autenticacao
|
||||
}) => {
|
||||
const url = `${url_api_autenticacao}/api/${tx_listar_prefeituras}`;
|
||||
return cFetch(url).then(async (a) => {
|
||||
const texto = await a.text();
|
||||
try {
|
||||
const res = JSON.parse(texto);
|
||||
return res;
|
||||
} catch (error) {
|
||||
return respostaComuns.erro(`Erro ao listar cidades: ${error.message}`, [
|
||||
texto,
|
||||
error
|
||||
]);
|
||||
}
|
||||
}).catch(
|
||||
(error) => respostaComuns.erro(`Erro ao listar cidades: ${error.message}`, [error])
|
||||
);
|
||||
};
|
||||
export {
|
||||
listarPrefeituras,
|
||||
tx_listar_prefeituras
|
||||
};
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
import cFetch from "cross-fetch";
|
||||
import { respostaComuns } from "p-respostas";
|
||||
const tx_usuarios__listar = "usuarios__listar";
|
||||
const listarUsuarios = async ({
|
||||
token,
|
||||
url_api_autenticacao
|
||||
}, parametros) => {
|
||||
const url = `${url_api_autenticacao}/api/${tx_usuarios__listar}`;
|
||||
return cFetch(url, {
|
||||
headers: { token, "Content-Type": "application/json" },
|
||||
body: JSON.stringify(parametros),
|
||||
method: "post"
|
||||
}).then(async (a) => {
|
||||
const texto = await a.text();
|
||||
try {
|
||||
const res = JSON.parse(texto);
|
||||
return res;
|
||||
} catch (error) {
|
||||
return respostaComuns.erro(
|
||||
`Erro ao listar usu\xE1rios: ${error.message}`,
|
||||
[texto, error]
|
||||
);
|
||||
}
|
||||
}).catch(
|
||||
(error) => respostaComuns.erro(`Erro ao listar usu\xE1rios: ${error.message}`, [error])
|
||||
);
|
||||
};
|
||||
export {
|
||||
listarUsuarios,
|
||||
tx_usuarios__listar
|
||||
};
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
import cFetch from "cross-fetch";
|
||||
import { cacheM } from "p-comuns";
|
||||
import { respostaComuns } from "p-respostas";
|
||||
import { uuidV3 } from "./plugins/uuid";
|
||||
const tx_vinculos__listar = "vinculos__listar";
|
||||
const listarVinculos = async ({
|
||||
token,
|
||||
url_api_autenticacao,
|
||||
desativarCache
|
||||
}) => {
|
||||
const chaveCache = uuidV3({ token, url_api_autenticacao });
|
||||
if (!desativarCache) {
|
||||
const valorCache = cacheM(chaveCache);
|
||||
if (valorCache) return valorCache;
|
||||
}
|
||||
const res = (async () => {
|
||||
const url = `${url_api_autenticacao}/api/${tx_vinculos__listar}`;
|
||||
return cFetch(url, {
|
||||
headers: { token, "Content-Type": "application/json" },
|
||||
body: "{}",
|
||||
method: "post"
|
||||
}).then(async (a) => {
|
||||
const texto = await a.text();
|
||||
try {
|
||||
const res2 = JSON.parse(texto);
|
||||
return res2;
|
||||
} catch (error) {
|
||||
return respostaComuns.erro(
|
||||
`Erro ao listar cidades: ${error.message}`,
|
||||
[texto, error]
|
||||
);
|
||||
}
|
||||
}).catch(
|
||||
(error) => respostaComuns.erro(`Erro ao listar cidades: ${error.message}`, [
|
||||
error
|
||||
])
|
||||
);
|
||||
})();
|
||||
cacheM(
|
||||
chaveCache,
|
||||
res.then((a) => {
|
||||
try {
|
||||
} catch {
|
||||
}
|
||||
return a;
|
||||
}),
|
||||
10
|
||||
);
|
||||
return res;
|
||||
};
|
||||
export {
|
||||
listarVinculos,
|
||||
tx_vinculos__listar
|
||||
};
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
import { NIL, v3, v4 } from "uuid";
|
||||
const uuidV3 = (qualquerCoisa) => v3(
|
||||
typeof qualquerCoisa == "string" ? qualquerCoisa : typeof qualquerCoisa == "number" ? String(qualquerCoisa) : JSON.stringify(qualquerCoisa),
|
||||
NIL
|
||||
);
|
||||
const uuidV4 = v4;
|
||||
export {
|
||||
uuidV3,
|
||||
uuidV4
|
||||
};
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
import { ProdutoQuipo } from "./tipagem";
|
||||
const produto_betha_meio_ambiente = new ProdutoQuipo({
|
||||
chave_produto: "betha-meio-ambiente",
|
||||
titulo: "Betha Meio Ambiente",
|
||||
descricao: "Betha Meio Ambiente: Software de gest\xE3o de processos ambientais para \xF3rg\xE3os p\xFAblicos da Betha Sistemas.",
|
||||
url_produto: ({ inquilino, base_url, vinculo }) => `${base_url}/${inquilino}${vinculo == "anonimo" ? "" : `/${vinculo}#/admin`}`
|
||||
});
|
||||
export {
|
||||
produto_betha_meio_ambiente
|
||||
};
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
import { Produto } from "./tipagem";
|
||||
const produto_suporte = new Produto({
|
||||
chave_produto: "suporte",
|
||||
titulo: "Suporte",
|
||||
descricao: "Gest\xE3o de contas e usu\xE1rios dos produtos da e-licencie",
|
||||
url_produto: ({ base_url }) => base_url
|
||||
});
|
||||
export {
|
||||
produto_suporte
|
||||
};
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
import { produto_betha_meio_ambiente } from "./_betha-meio-ambiente";
|
||||
import { produto_e_licencie } from "./_e-licencie";
|
||||
import { produto_e_licencie_gov } from "./_e-licencie-gov";
|
||||
import { produto_suporte } from "./_suporte";
|
||||
import {
|
||||
chaves_produto,
|
||||
opcoesVinculos,
|
||||
opcoesVinculosGov,
|
||||
Produto,
|
||||
provedoresGov,
|
||||
versao_usuarios
|
||||
} from "./tipagem";
|
||||
const listaProdutos = {
|
||||
"betha-meio-ambiente": produto_betha_meio_ambiente,
|
||||
"e-licencie": produto_e_licencie,
|
||||
"e-licencie-gov": produto_e_licencie_gov,
|
||||
suporte: produto_suporte
|
||||
};
|
||||
export {
|
||||
Produto,
|
||||
chaves_produto,
|
||||
listaProdutos,
|
||||
opcoesVinculos,
|
||||
opcoesVinculosGov,
|
||||
produto_betha_meio_ambiente,
|
||||
produto_e_licencie,
|
||||
produto_e_licencie_gov,
|
||||
produto_suporte,
|
||||
provedoresGov,
|
||||
versao_usuarios
|
||||
};
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
var chaves_produto = /* @__PURE__ */ ((chaves_produto2) => {
|
||||
chaves_produto2["suporte"] = "suporte";
|
||||
chaves_produto2["betha-meio-ambiente"] = "betha-meio-ambiente";
|
||||
chaves_produto2["e-licencie-gov"] = "e-licencie-gov";
|
||||
chaves_produto2["e-licencie"] = "e-licencie";
|
||||
return chaves_produto2;
|
||||
})(chaves_produto || {});
|
||||
const opcoesVinculosGov = {
|
||||
governo: "Governo",
|
||||
sociedade: "Sociedade",
|
||||
anonimo: "An\xF4nimo"
|
||||
};
|
||||
const opcoesVinculosSuporte = {
|
||||
"suporte-1": "Suporte Prim\xE1rio"
|
||||
};
|
||||
const opcoesVinculos = {
|
||||
["suporte" /* suporte */]: opcoesVinculosSuporte,
|
||||
["betha-meio-ambiente" /* betha-meio-ambiente */]: opcoesVinculosGov,
|
||||
["e-licencie-gov" /* e-licencie-gov */]: opcoesVinculosGov,
|
||||
["e-licencie" /* e-licencie */]: {}
|
||||
};
|
||||
const tiposAcesso = opcoesVinculosGov;
|
||||
const provedoresGov = {
|
||||
/** Sistema de login da Beta */
|
||||
"betha-sistemas": "Betha Sistemas",
|
||||
/** sistema de login do altenticado */
|
||||
"e-licencie": "e-licencie"
|
||||
};
|
||||
class Produto {
|
||||
constructor(_) {
|
||||
this.chave_produto = _.chave_produto;
|
||||
this.titulo = _.titulo;
|
||||
this.descricao = _.descricao;
|
||||
this.url_produto = _.url_produto;
|
||||
}
|
||||
extruturaToken(_) {
|
||||
return { ..._, chave_produto: this.chave_produto };
|
||||
}
|
||||
}
|
||||
class ProdutoQuipo extends Produto {
|
||||
extruturaToken(_) {
|
||||
return { ..._, chave_produto: this.chave_produto };
|
||||
}
|
||||
}
|
||||
var versao_usuarios = /* @__PURE__ */ ((versao_usuarios2) => {
|
||||
versao_usuarios2["versao_usuarios_autenticacao"] = "versao_usuarios_autenticacao";
|
||||
versao_usuarios2["versao_usuarios_quipo"] = "versao_usuarios_quipo";
|
||||
return versao_usuarios2;
|
||||
})(versao_usuarios || {});
|
||||
export {
|
||||
Produto,
|
||||
ProdutoQuipo,
|
||||
chaves_produto,
|
||||
opcoesVinculos,
|
||||
opcoesVinculosGov,
|
||||
opcoesVinculosSuporte,
|
||||
provedoresGov,
|
||||
tiposAcesso,
|
||||
versao_usuarios
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue