convertido para pnpm
This commit is contained in:
parent
59e710f6cf
commit
175d767d27
115 changed files with 2366 additions and 1451 deletions
23
dist-front/autenticacao/_codigoContaSite.js
Normal file
23
dist-front/autenticacao/_codigoContaSite.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
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
|
||||
};
|
||||
24
dist-front/autenticacao/_usuarios_quipo.js
Normal file
24
dist-front/autenticacao/_usuarios_quipo.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
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
|
||||
};
|
||||
31
dist-front/autenticacao/_usuarios_quipo_vincular.js
Normal file
31
dist-front/autenticacao/_usuarios_quipo_vincular.js
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
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
|
||||
};
|
||||
22
dist-front/autenticacao/_validarToken.js
Normal file
22
dist-front/autenticacao/_validarToken.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
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
|
||||
};
|
||||
13
dist-front/autenticacao/index.js
Normal file
13
dist-front/autenticacao/index.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
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
|
||||
};
|
||||
6
dist-front/index.js
Normal file
6
dist-front/index.js
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export * from "./autenticacao";
|
||||
export * from "./lista-prefeituras";
|
||||
export * from "./lista-usuarios";
|
||||
export * from "./lista-vinculos";
|
||||
export * from "./produtos";
|
||||
export * from "./tokens";
|
||||
26
dist-front/lista-prefeituras.js
Normal file
26
dist-front/lista-prefeituras.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
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
|
||||
};
|
||||
31
dist-front/lista-usuarios.js
Normal file
31
dist-front/lista-usuarios.js
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
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
|
||||
};
|
||||
54
dist-front/lista-vinculos.js
Normal file
54
dist-front/lista-vinculos.js
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
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
|
||||
};
|
||||
10
dist-front/plugins/uuid.js
Normal file
10
dist-front/plugins/uuid.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
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
|
||||
};
|
||||
10
dist-front/produtos/_betha-meio-ambiente.js
Normal file
10
dist-front/produtos/_betha-meio-ambiente.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
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
|
||||
};
|
||||
11
dist-front/produtos/_e-licencie-gov.js
Normal file
11
dist-front/produtos/_e-licencie-gov.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { produto_betha_meio_ambiente } from "./_betha-meio-ambiente";
|
||||
import { ProdutoQuipo } from "./tipagem";
|
||||
const produto_e_licencie_gov = new ProdutoQuipo({
|
||||
...produto_betha_meio_ambiente,
|
||||
titulo: "e-Licencie Gov",
|
||||
chave_produto: "e-licencie-gov",
|
||||
url_produto: ({ inquilino, base_url, vinculo }) => `${base_url}/${inquilino}${vinculo == "anonimo" ? "" : `/${vinculo}#/admin`}`
|
||||
});
|
||||
export {
|
||||
produto_e_licencie_gov
|
||||
};
|
||||
10
dist-front/produtos/_e-licencie.js
Normal file
10
dist-front/produtos/_e-licencie.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { Produto } from "./tipagem";
|
||||
const produto_e_licencie = new Produto({
|
||||
chave_produto: "e-licencie",
|
||||
titulo: "e-Licencie",
|
||||
descricao: "e-Licencie: Software de gest\xE3o de processos e dados ambientais.",
|
||||
url_produto: ({ base_url }) => base_url
|
||||
});
|
||||
export {
|
||||
produto_e_licencie
|
||||
};
|
||||
10
dist-front/produtos/_suporte.js
Normal file
10
dist-front/produtos/_suporte.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
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
|
||||
};
|
||||
0
dist-front/produtos/doc.js
Normal file
0
dist-front/produtos/doc.js
Normal file
31
dist-front/produtos/index.js
Normal file
31
dist-front/produtos/index.js
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
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
|
||||
};
|
||||
60
dist-front/produtos/tipagem.js
Normal file
60
dist-front/produtos/tipagem.js
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
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
|
||||
};
|
||||
0
dist-front/tokens/index.js
Normal file
0
dist-front/tokens/index.js
Normal file
Loading…
Add table
Add a link
Reference in a new issue