merge
This commit is contained in:
commit
e498c967be
34 changed files with 674 additions and 232 deletions
|
|
@ -21,6 +21,6 @@ export const usuarios_quipo_governo = ({ token_produto, ambiente, }) => __awaite
|
|||
headers,
|
||||
})
|
||||
.then((r) => r.json())
|
||||
.catch((e) => respostaComuns.erro("Erro ao buscar usuários quipo governo", [e.message]))
|
||||
.catch((e) => respostaComuns.erro(`Erro ao buscar usuários quipo governo ${e.message}`))
|
||||
.then((r) => r);
|
||||
});
|
||||
|
|
|
|||
11
dist-import/autenticacao/_usuarios_quipo_vincular.d.ts
vendored
Normal file
11
dist-import/autenticacao/_usuarios_quipo_vincular.d.ts
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { type tipoResposta } from "p-respostas";
|
||||
import type { z } from "zod";
|
||||
import type { zAmbiente } from "../ts/ambiente";
|
||||
export declare const usuarios_quipo_vincular: ({ token_produto, ambiente, conta, vinculo, codigo_usuario, email, }: {
|
||||
ambiente: z.infer<typeof zAmbiente>;
|
||||
token_produto: string;
|
||||
conta: string;
|
||||
vinculo: string;
|
||||
codigo_usuario?: string | undefined;
|
||||
email: string;
|
||||
}) => Promise<tipoResposta<string>>;
|
||||
32
dist-import/autenticacao/_usuarios_quipo_vincular.js
Normal file
32
dist-import/autenticacao/_usuarios_quipo_vincular.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
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 node_fetch from "cross-fetch";
|
||||
import { respostaComuns } from "p-respostas";
|
||||
import { urlAutenticacao } from "./_urlAutenticacao";
|
||||
export const usuarios_quipo_vincular = ({ token_produto, ambiente, conta, vinculo, codigo_usuario, email, }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = `${urlAutenticacao(ambiente)}/api/vinculos__criar`;
|
||||
if (!token_produto)
|
||||
return respostaComuns.erro("token_produto não informado");
|
||||
const headers = {
|
||||
token: token_produto,
|
||||
"Content-Type": "application/json",
|
||||
};
|
||||
const parametros = {
|
||||
vinculos: { codigo_conta: conta, codigo_usuario, vinculo },
|
||||
email: email,
|
||||
};
|
||||
return yield node_fetch(url, {
|
||||
headers,
|
||||
body: JSON.stringify(parametros),
|
||||
method: "POST",
|
||||
})
|
||||
.then((r) => __awaiter(void 0, void 0, void 0, function* () { return yield r.json(); }))
|
||||
.catch((e) => respostaComuns.erro(`Erro ao criar vinculo de usuario ${e.message}`));
|
||||
});
|
||||
9
dist-import/autenticacao/index.d.ts
vendored
9
dist-import/autenticacao/index.d.ts
vendored
|
|
@ -3,6 +3,7 @@ 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";
|
||||
post: {
|
||||
token: string;
|
||||
|
|
@ -19,4 +20,12 @@ export declare const pAutenticacao: {
|
|||
ambiente: "desenvolvimento" | "producao";
|
||||
token_produto: string;
|
||||
}) => Promise<import("p-respostas").tipoResposta<tipoUsuarioExterno[]>>;
|
||||
usuarios_quipo_vincular: ({ token_produto, ambiente, conta, vinculo, codigo_usuario, email, }: {
|
||||
ambiente: "desenvolvimento" | "producao";
|
||||
token_produto: string;
|
||||
conta: string;
|
||||
vinculo: string;
|
||||
codigo_usuario?: string | undefined;
|
||||
email: string;
|
||||
}) => Promise<import("p-respostas").tipoResposta<string>>;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { codigoContaSite } from "./_codigoContaSite";
|
||||
import { urlAutenticacao } from "./_urlAutenticacao";
|
||||
import { usuarios_quipo_governo, } from "./_usuarios_quipo_governo";
|
||||
import { usuarios_quipo_vincular } from "./_usuarios_quipo_vincular";
|
||||
import { validarToken } from "./_validarToken";
|
||||
/** todas as rotas de comunicação com autenticador partem dessa variável */
|
||||
export const pAutenticacao = {
|
||||
|
|
@ -8,4 +9,5 @@ export const pAutenticacao = {
|
|||
urlAutenticacao,
|
||||
codigoContaSite,
|
||||
usuarios_quipo_governo,
|
||||
usuarios_quipo_vincular,
|
||||
};
|
||||
|
|
|
|||
9
dist-import/email/index.d.ts
vendored
Normal file
9
dist-import/email/index.d.ts
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { type tipoResposta } from "p-respostas";
|
||||
export declare const enviarEmail: ({ email, nome, assunto, texto, htlm, }: {
|
||||
email: string;
|
||||
nome?: string | undefined;
|
||||
assunto: string;
|
||||
/** Verão em texto do html, não obrigatório */
|
||||
texto?: string | undefined;
|
||||
htlm: string;
|
||||
}) => Promise<tipoResposta<string>>;
|
||||
58
dist-import/email/index.js
Normal file
58
dist-import/email/index.js
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
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 nodemailer from "nodemailer";
|
||||
import { respostaComuns } from "p-respostas";
|
||||
// const confEmail = {
|
||||
// host: "email-smtp.us-east-1.amazonaws.com",
|
||||
// port: 587,
|
||||
// secure: false,
|
||||
// user: "AKIA2LGJTHGX2ZKMMYHG",
|
||||
// pass: "BFuchUwoUYYDJK8l+pd1NvZxk70PjhMX+KbQy+5HfPDl",
|
||||
// requireTLS: true,
|
||||
// ignoreTLS: false,
|
||||
// emailDe: "nao-responder@e-licencie.com.br",
|
||||
// nomeDe: "🌱 Betha Meio Ambiente",
|
||||
// };
|
||||
const confEmail = {
|
||||
host: "email-smtp.us-east-1.amazonaws.com",
|
||||
port: 587,
|
||||
secure: false,
|
||||
user: "AKIA2LGJTHGX2ZKMMYHG",
|
||||
pass: "BFuchUwoUYYDJK8l+pd1NvZxk70PjhMX+KbQy+5HfPDl",
|
||||
requireTLS: true,
|
||||
ignoreTLS: false,
|
||||
emailDe: "nao-responder@gestao-ambiental-brasil.idz.one",
|
||||
nomeDe: "🌱 Betha Meio Ambiente",
|
||||
};
|
||||
export const enviarEmail = ({ email, nome, assunto, texto, htlm, }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const info = yield nodemailer
|
||||
.createTransport({
|
||||
host: confEmail.host,
|
||||
port: confEmail.port,
|
||||
secure: confEmail.secure,
|
||||
auth: {
|
||||
user: confEmail.user,
|
||||
pass: confEmail.pass,
|
||||
},
|
||||
})
|
||||
.sendMail({
|
||||
from: { address: confEmail.emailDe, name: confEmail.nomeDe },
|
||||
to: nome ? { address: email, name: nome } : email,
|
||||
subject: assunto,
|
||||
text: texto,
|
||||
html: htlm,
|
||||
})
|
||||
.then(() => respostaComuns.valor(`Email "${assunto}" enviado para ${email}`))
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
return respostaComuns.erro(`Erro ao enviar email para ${email}: ${err.message}`);
|
||||
});
|
||||
return info;
|
||||
});
|
||||
1
dist-import/index.d.ts
vendored
1
dist-import/index.d.ts
vendored
|
|
@ -4,3 +4,4 @@ export * from "./produtos";
|
|||
export * from "./pilao-de-dados";
|
||||
export * from "./residuos";
|
||||
export * from "./NPS";
|
||||
export * from "./email";
|
||||
|
|
|
|||
|
|
@ -4,3 +4,4 @@ export * from "./produtos";
|
|||
export * from "./pilao-de-dados";
|
||||
export * from "./residuos";
|
||||
export * from "./NPS";
|
||||
export * from "./email";
|
||||
|
|
|
|||
10
dist-import/pilao-de-dados/index.d.ts
vendored
10
dist-import/pilao-de-dados/index.d.ts
vendored
|
|
@ -27,8 +27,8 @@ export declare const pPilao: {
|
|||
}[];
|
||||
}>;
|
||||
enviar_registros: ({ conta, produto, emDesenvolvimento }: {
|
||||
produto: string;
|
||||
conta: string;
|
||||
produto: string;
|
||||
emDesenvolvimento?: boolean | undefined;
|
||||
}) => ({ registros, tabela, }: {
|
||||
tabela: string;
|
||||
|
|
@ -79,8 +79,8 @@ export declare const pPilao: {
|
|||
colunaAgrupamento?: string[] | undefined;
|
||||
}>;
|
||||
serie_consultar: (cliente: {
|
||||
produto: string;
|
||||
conta: string;
|
||||
produto: string;
|
||||
emDesenvolvimento?: boolean | undefined;
|
||||
}) => (parametros: {
|
||||
tabela: string;
|
||||
|
|
@ -105,18 +105,18 @@ export declare const pPilao: {
|
|||
conta: import("zod").ZodString;
|
||||
emDesenvolvimento: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
||||
}, "strip", import("zod").ZodTypeAny, {
|
||||
produto: string;
|
||||
conta: string;
|
||||
produto: string;
|
||||
emDesenvolvimento?: boolean | undefined;
|
||||
}, {
|
||||
produto: string;
|
||||
conta: string;
|
||||
produto: string;
|
||||
emDesenvolvimento?: boolean | undefined;
|
||||
}>;
|
||||
validarZ: <T>(zodType: import("zod").ZodType<T, any, T>, objeto: any, mensagem: string) => import("p-respostas").tipoRespostaErro | import("p-respostas").tipoRespostaSucesso<T>;
|
||||
deletar_registros: ({ conta, produto, emDesenvolvimento }: {
|
||||
produto: string;
|
||||
conta: string;
|
||||
produto: string;
|
||||
emDesenvolvimento?: boolean | undefined;
|
||||
}) => ({ codigos, tabela, }: {
|
||||
tabela: string;
|
||||
|
|
|
|||
4
dist-import/pilao-de-dados/variaveis.d.ts
vendored
4
dist-import/pilao-de-dados/variaveis.d.ts
vendored
|
|
@ -7,12 +7,12 @@ export declare const zp_produto_conta: z.ZodObject<{
|
|||
conta: z.ZodString;
|
||||
emDesenvolvimento: z.ZodOptional<z.ZodBoolean>;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
produto: string;
|
||||
conta: string;
|
||||
produto: string;
|
||||
emDesenvolvimento?: boolean | undefined;
|
||||
}, {
|
||||
produto: string;
|
||||
conta: string;
|
||||
produto: string;
|
||||
emDesenvolvimento?: boolean | undefined;
|
||||
}>;
|
||||
export declare const z_tipo_coluna_base_dados: z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "data", "mes"]>;
|
||||
|
|
|
|||
3
dist-import/residuos/index.d.ts
vendored
3
dist-import/residuos/index.d.ts
vendored
|
|
@ -6,6 +6,7 @@ export declare const zAuntenticacaoResiduos: z.ZodObject<{
|
|||
documento_usuario: z.ZodString;
|
||||
organizacao: z.ZodString;
|
||||
rotas: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
||||
tipo_usuario: z.ZodString;
|
||||
sistema: z.ZodString;
|
||||
sistema_cor: z.ZodString;
|
||||
sistema_nome: z.ZodString;
|
||||
|
|
@ -22,6 +23,7 @@ export declare const zAuntenticacaoResiduos: z.ZodObject<{
|
|||
documento_usuario: string;
|
||||
organizacao: string;
|
||||
rotas: {};
|
||||
tipo_usuario: string;
|
||||
sistema: string;
|
||||
sistema_cor: string;
|
||||
sistema_nome: string;
|
||||
|
|
@ -37,6 +39,7 @@ export declare const zAuntenticacaoResiduos: z.ZodObject<{
|
|||
documento_usuario: string;
|
||||
organizacao: string;
|
||||
rotas: {};
|
||||
tipo_usuario: string;
|
||||
sistema: string;
|
||||
sistema_cor: string;
|
||||
sistema_nome: string;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ export const zAuntenticacaoResiduos = z.object({
|
|||
documento_usuario: z.string(),
|
||||
organizacao: z.string(),
|
||||
rotas: z.object({}),
|
||||
tipo_usuario: z.string(),
|
||||
// Dados do sistema
|
||||
sistema: z.string(),
|
||||
sistema_cor: z.string(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue