This commit is contained in:
Luiz H. R. Silva 2024-06-26 10:29:02 -03:00
commit e498c967be
34 changed files with 674 additions and 232 deletions

View file

@ -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);
});

View 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>>;

View 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}`));
});

View file

@ -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>>;
};

View file

@ -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
View 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>>;

View 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;
});

View file

@ -4,3 +4,4 @@ export * from "./produtos";
export * from "./pilao-de-dados";
export * from "./residuos";
export * from "./NPS";
export * from "./email";

View file

@ -4,3 +4,4 @@ export * from "./produtos";
export * from "./pilao-de-dados";
export * from "./residuos";
export * from "./NPS";
export * from "./email";

View file

@ -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;

View file

@ -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"]>;

View file

@ -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;

View file

@ -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(),

View file

@ -59,7 +59,7 @@ var usuarios_quipo_governo = function (_a) {
})
.then(function (r) { return r.json(); })
.catch(function (e) {
return p_respostas_1.respostaComuns.erro("Erro ao buscar usuários quipo governo", [e.message]);
return p_respostas_1.respostaComuns.erro("Erro ao buscar usu\u00E1rios quipo governo ".concat(e.message));
})
.then(function (r) { return r; })];
});

View 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>>;

View file

@ -0,0 +1,83 @@
"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 };
}
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
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()];
}
});
});
};
exports.usuarios_quipo_vincular = usuarios_quipo_vincular;

View file

@ -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>>;
};

View file

@ -4,6 +4,7 @@ exports.pAutenticacao = void 0;
var _codigoContaSite_1 = require("./_codigoContaSite");
var _urlAutenticacao_1 = require("./_urlAutenticacao");
var _usuarios_quipo_governo_1 = require("./_usuarios_quipo_governo");
var _usuarios_quipo_vincular_1 = require("./_usuarios_quipo_vincular");
var _validarToken_1 = require("./_validarToken");
/** todas as rotas de comunicação com autenticador partem dessa variável */
exports.pAutenticacao = {
@ -11,4 +12,5 @@ exports.pAutenticacao = {
urlAutenticacao: _urlAutenticacao_1.urlAutenticacao,
codigoContaSite: _codigoContaSite_1.codigoContaSite,
usuarios_quipo_governo: _usuarios_quipo_governo_1.usuarios_quipo_governo,
usuarios_quipo_vincular: _usuarios_quipo_vincular_1.usuarios_quipo_vincular,
};

9
dist-require/email/index.d.ts vendored Normal file
View 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>>;

104
dist-require/email/index.js Normal file
View file

@ -0,0 +1,104 @@
"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 };
}
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.enviarEmail = void 0;
var nodemailer_1 = __importDefault(require("nodemailer"));
var p_respostas_1 = require("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",
// };
var 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",
};
var enviarEmail = function (_a) {
var email = _a.email, nome = _a.nome, assunto = _a.assunto, texto = _a.texto, htlm = _a.htlm;
return __awaiter(void 0, void 0, void 0, function () {
var info;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, nodemailer_1.default
.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(function () {
return p_respostas_1.respostaComuns.valor("Email \"".concat(assunto, "\" enviado para ").concat(email));
})
.catch(function (err) {
console.error(err);
return p_respostas_1.respostaComuns.erro("Erro ao enviar email para ".concat(email, ": ").concat(err.message));
})];
case 1:
info = _b.sent();
return [2 /*return*/, info];
}
});
});
};
exports.enviarEmail = enviarEmail;

View file

@ -4,3 +4,4 @@ export * from "./produtos";
export * from "./pilao-de-dados";
export * from "./residuos";
export * from "./NPS";
export * from "./email";

View file

@ -20,3 +20,4 @@ __exportStar(require("./produtos"), exports);
__exportStar(require("./pilao-de-dados"), exports);
__exportStar(require("./residuos"), exports);
__exportStar(require("./NPS"), exports);
__exportStar(require("./email"), exports);

View file

@ -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;

View file

@ -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"]>;

View file

@ -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;

View file

@ -10,6 +10,7 @@ exports.zAuntenticacaoResiduos = zod_1.z.object({
documento_usuario: zod_1.z.string(),
organizacao: zod_1.z.string(),
rotas: zod_1.z.object({}),
tipo_usuario: zod_1.z.string(),
// Dados do sistema
sistema: zod_1.z.string(),
sistema_cor: zod_1.z.string(),

View file

@ -1,6 +1,6 @@
{
"name": "p-drives",
"version": "0.90.0",
"version": "0.97.0",
"description": "",
"main": "src/index.ts",
"exports": {

355
pnpm-lock.yaml generated
View file

@ -1,12 +1,9 @@
lockfileVersion: '9.0'
lockfileVersion: '6.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
importers:
.:
dependencies:
cross-fetch:
specifier: ^4.0.0
@ -14,6 +11,7 @@ importers:
zod:
specifier: latest
version: 3.23.8
devDependencies:
'@biomejs/biome':
specifier: latest
@ -26,164 +24,21 @@ importers:
version: 4.2.1
p-comuns:
specifier: git+http://leitura:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MTQ3NTA1NzYsImlzcyI6IkdpdG5lc3MiLCJwaWQiOjgsInRrbiI6eyJ0eXAiOiJwYXQiLCJpZCI6MzJ9fQ.OYdExOVQm5UI3wfeTaWjmD0o65Y1hrjFz5EvMB1a__U@git.idz.one:3000/git/multi-modulos-ambientais/_comuns.git#producao
version: git+http://leitura:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MTQ3NTA1NzYsImlzcyI6IkdpdG5lc3MiLCJwaWQiOjgsInRrbiI6eyJ0eXAiOiJwYXQiLCJpZCI6MzJ9fQ.OYdExOVQm5UI3wfeTaWjmD0o65Y1hrjFz5EvMB1a__U@git.idz.one:3000/git/multi-modulos-ambientais/_comuns.git#b01ceca6b840e3a30ee85a2dd98015ab0e8f298d(typescript@4.9.5)
version: leitura+eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MTQ3NTA1NzYsImlzcyI6IkdpdG5lc3MiLCJwaWQiOjgsInRrbiI6eyJ0eXAiOiJwYXQiLCJpZCI6MzJ9fQ.OYdExOVQm5UI3wfeTaWjmD0o65Y1hrjFz5EvMB1a__U@git.idz.one+3000/git/multi-modulos-ambientais/_comuns/b01ceca6b840e3a30ee85a2dd98015ab0e8f298d(typescript@4.9.5)
p-respostas:
specifier: git+http://leitura:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MTQ3NTA1NzYsImlzcyI6IkdpdG5lc3MiLCJwaWQiOjgsInRrbiI6eyJ0eXAiOiJwYXQiLCJpZCI6MzJ9fQ.OYdExOVQm5UI3wfeTaWjmD0o65Y1hrjFz5EvMB1a__U@git.idz.one:3000/git/multi-modulos-ambientais/_respostas.git#producao
version: git+http://leitura:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MTQ3NTA1NzYsImlzcyI6IkdpdG5lc3MiLCJwaWQiOjgsInRrbiI6eyJ0eXAiOiJwYXQiLCJpZCI6MzJ9fQ.OYdExOVQm5UI3wfeTaWjmD0o65Y1hrjFz5EvMB1a__U@git.idz.one:3000/git/multi-modulos-ambientais/_respostas.git#c10a2584e6f6ec5c87462c810cafb1dad243067d
version: leitura+eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MTQ3NTA1NzYsImlzcyI6IkdpdG5lc3MiLCJwaWQiOjgsInRrbiI6eyJ0eXAiOiJwYXQiLCJpZCI6MzJ9fQ.OYdExOVQm5UI3wfeTaWjmD0o65Y1hrjFz5EvMB1a__U@git.idz.one+3000/git/multi-modulos-ambientais/_respostas/c10a2584e6f6ec5c87462c810cafb1dad243067d
typescript:
specifier: ^4.9.5
version: 4.9.5
packages:
'@biomejs/biome@1.8.1':
/@biomejs/biome@1.8.1:
resolution: {integrity: sha512-fQXGfvq6DIXem12dGQCM2tNF+vsNHH1qs3C7WeOu75Pd0trduoTmoO7G4ntLJ2qDs5wuw981H+cxQhi1uHnAtA==}
engines: {node: '>=14.21.3'}
hasBin: true
'@biomejs/cli-darwin-arm64@1.8.1':
resolution: {integrity: sha512-XLiB7Uu6GALIOBWzQ2aMD0ru4Ly5/qSeQF7kk3AabzJ/kwsEWSe33iVySBP/SS2qv25cgqNiLksjGcw2bHT3mw==}
engines: {node: '>=14.21.3'}
cpu: [arm64]
os: [darwin]
'@biomejs/cli-darwin-x64@1.8.1':
resolution: {integrity: sha512-uMTSxVLMfqkBVqyc25hSn83jBbp+wtWjzM/pHFlKXt3htJuw7FErVGW0nmQ9Sxa9vJ7GcqoltLMl28VQRIMYzg==}
engines: {node: '>=14.21.3'}
cpu: [x64]
os: [darwin]
'@biomejs/cli-linux-arm64-musl@1.8.1':
resolution: {integrity: sha512-UQ8Wc01J0wQL+5AYOc7qkJn20B4PZmQL1KrmDZh7ot0DvD6aX4+8mmfd/dG5b6Zjo/44QvCKcvkFGCMRYuhWZA==}
engines: {node: '>=14.21.3'}
cpu: [arm64]
os: [linux]
'@biomejs/cli-linux-arm64@1.8.1':
resolution: {integrity: sha512-3SzZRuC/9Oi2P2IBNPsEj0KXxSXUEYRR2kfRF/Ve8QAfGgrt4qnwuWd6QQKKN5R+oYH691qjm+cXBKEcrP1v/Q==}
engines: {node: '>=14.21.3'}
cpu: [arm64]
os: [linux]
'@biomejs/cli-linux-x64-musl@1.8.1':
resolution: {integrity: sha512-fYbP/kNu/rtZ4kKzWVocIdqZOtBSUEg9qUhZaao3dy3CRzafR6u6KDtBeSCnt47O+iLnks1eOR1TUxzr5+QuqA==}
engines: {node: '>=14.21.3'}
cpu: [x64]
os: [linux]
'@biomejs/cli-linux-x64@1.8.1':
resolution: {integrity: sha512-AeBycVdNrTzsyYKEOtR2R0Ph0hCD0sCshcp2aOnfGP0hCZbtFg09D0SdKLbyzKntisY41HxKVrydYiaApp+2uw==}
engines: {node: '>=14.21.3'}
cpu: [x64]
os: [linux]
'@biomejs/cli-win32-arm64@1.8.1':
resolution: {integrity: sha512-6tEd1H/iFKpgpE3OIB7oNgW5XkjiVMzMRPL8zYoZ036YfuJ5nMYm9eB9H/y81+8Z76vL48fiYzMPotJwukGPqQ==}
engines: {node: '>=14.21.3'}
cpu: [arm64]
os: [win32]
'@biomejs/cli-win32-x64@1.8.1':
resolution: {integrity: sha512-g2H31jJzYmS4jkvl6TiyEjEX+Nv79a5km/xn+5DARTp5MBFzC9gwceusSSB2AkJKqZzY131AiACAWjKrVt5Ijw==}
engines: {node: '>=14.21.3'}
cpu: [x64]
os: [win32]
'@types/node@20.14.2':
resolution: {integrity: sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q==}
ansi-styles@4.3.0:
resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==}
engines: {node: '>=8'}
chalk@3.0.0:
resolution: {integrity: sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==}
engines: {node: '>=8'}
check-node-version@4.2.1:
resolution: {integrity: sha512-YYmFYHV/X7kSJhuN/QYHUu998n/TRuDe8UenM3+m5NrkiH670lb9ILqHIvBencvJc4SDh+XcbXMR4b+TtubJiw==}
engines: {node: '>=8.3.0'}
hasBin: true
color-convert@2.0.1:
resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}
engines: {node: '>=7.0.0'}
color-name@1.1.4:
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
cross-fetch@4.0.0:
resolution: {integrity: sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==}
has-flag@4.0.0:
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
engines: {node: '>=8'}
map-values@1.0.1:
resolution: {integrity: sha512-BbShUnr5OartXJe1GeccAWtfro11hhgNJg6G9/UtWKjVGvV5U4C09cg5nk8JUevhXODaXY+hQ3xxMUKSs62ONQ==}
minimist@1.2.8:
resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==}
node-fetch@2.7.0:
resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==}
engines: {node: 4.x || >=6.0.0}
peerDependencies:
encoding: ^0.1.0
peerDependenciesMeta:
encoding:
optional: true
object-filter@1.0.2:
resolution: {integrity: sha512-NahvP2vZcy1ZiiYah30CEPw0FpDcSkSePJBMpzl5EQgCmISijiGuJm3SPYp7U+Lf2TljyaIw3E5EgkEx/TNEVA==}
p-comuns@git+http://leitura:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MTQ3NTA1NzYsImlzcyI6IkdpdG5lc3MiLCJwaWQiOjgsInRrbiI6eyJ0eXAiOiJwYXQiLCJpZCI6MzJ9fQ.OYdExOVQm5UI3wfeTaWjmD0o65Y1hrjFz5EvMB1a__U@git.idz.one:3000/git/multi-modulos-ambientais/_comuns.git#b01ceca6b840e3a30ee85a2dd98015ab0e8f298d:
resolution: {commit: b01ceca6b840e3a30ee85a2dd98015ab0e8f298d, repo: http://leitura:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MTQ3NTA1NzYsImlzcyI6IkdpdG5lc3MiLCJwaWQiOjgsInRrbiI6eyJ0eXAiOiJwYXQiLCJpZCI6MzJ9fQ.OYdExOVQm5UI3wfeTaWjmD0o65Y1hrjFz5EvMB1a__U@git.idz.one:3000/git/multi-modulos-ambientais/_comuns.git, type: git}
version: 0.31.0
peerDependencies:
typescript: ^5.0.0
p-respostas@git+http://leitura:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MTQ3NTA1NzYsImlzcyI6IkdpdG5lc3MiLCJwaWQiOjgsInRrbiI6eyJ0eXAiOiJwYXQiLCJpZCI6MzJ9fQ.OYdExOVQm5UI3wfeTaWjmD0o65Y1hrjFz5EvMB1a__U@git.idz.one:3000/git/multi-modulos-ambientais/_respostas.git#c10a2584e6f6ec5c87462c810cafb1dad243067d:
resolution: {commit: c10a2584e6f6ec5c87462c810cafb1dad243067d, repo: http://leitura:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MTQ3NTA1NzYsImlzcyI6IkdpdG5lc3MiLCJwaWQiOjgsInRrbiI6eyJ0eXAiOiJwYXQiLCJpZCI6MzJ9fQ.OYdExOVQm5UI3wfeTaWjmD0o65Y1hrjFz5EvMB1a__U@git.idz.one:3000/git/multi-modulos-ambientais/_respostas.git, type: git}
version: 0.12.0
queue-microtask@1.2.3:
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
run-parallel@1.2.0:
resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==}
semver@6.3.1:
resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==}
hasBin: true
supports-color@7.2.0:
resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
engines: {node: '>=8'}
tr46@0.0.3:
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
typescript@4.9.5:
resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==}
engines: {node: '>=4.2.0'}
hasBin: true
undici-types@5.26.5:
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
webidl-conversions@3.0.1:
resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==}
whatwg-url@5.0.0:
resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==}
zod@3.23.8:
resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==}
snapshots:
'@biomejs/biome@1.8.1':
requiresBuild: true
optionalDependencies:
'@biomejs/cli-darwin-arm64': 1.8.1
'@biomejs/cli-darwin-x64': 1.8.1
@ -193,45 +48,105 @@ snapshots:
'@biomejs/cli-linux-x64-musl': 1.8.1
'@biomejs/cli-win32-arm64': 1.8.1
'@biomejs/cli-win32-x64': 1.8.1
dev: true
'@biomejs/cli-darwin-arm64@1.8.1':
/@biomejs/cli-darwin-arm64@1.8.1:
resolution: {integrity: sha512-XLiB7Uu6GALIOBWzQ2aMD0ru4Ly5/qSeQF7kk3AabzJ/kwsEWSe33iVySBP/SS2qv25cgqNiLksjGcw2bHT3mw==}
engines: {node: '>=14.21.3'}
cpu: [arm64]
os: [darwin]
requiresBuild: true
dev: true
optional: true
'@biomejs/cli-darwin-x64@1.8.1':
/@biomejs/cli-darwin-x64@1.8.1:
resolution: {integrity: sha512-uMTSxVLMfqkBVqyc25hSn83jBbp+wtWjzM/pHFlKXt3htJuw7FErVGW0nmQ9Sxa9vJ7GcqoltLMl28VQRIMYzg==}
engines: {node: '>=14.21.3'}
cpu: [x64]
os: [darwin]
requiresBuild: true
dev: true
optional: true
'@biomejs/cli-linux-arm64-musl@1.8.1':
/@biomejs/cli-linux-arm64-musl@1.8.1:
resolution: {integrity: sha512-UQ8Wc01J0wQL+5AYOc7qkJn20B4PZmQL1KrmDZh7ot0DvD6aX4+8mmfd/dG5b6Zjo/44QvCKcvkFGCMRYuhWZA==}
engines: {node: '>=14.21.3'}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: true
optional: true
'@biomejs/cli-linux-arm64@1.8.1':
/@biomejs/cli-linux-arm64@1.8.1:
resolution: {integrity: sha512-3SzZRuC/9Oi2P2IBNPsEj0KXxSXUEYRR2kfRF/Ve8QAfGgrt4qnwuWd6QQKKN5R+oYH691qjm+cXBKEcrP1v/Q==}
engines: {node: '>=14.21.3'}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: true
optional: true
'@biomejs/cli-linux-x64-musl@1.8.1':
/@biomejs/cli-linux-x64-musl@1.8.1:
resolution: {integrity: sha512-fYbP/kNu/rtZ4kKzWVocIdqZOtBSUEg9qUhZaao3dy3CRzafR6u6KDtBeSCnt47O+iLnks1eOR1TUxzr5+QuqA==}
engines: {node: '>=14.21.3'}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: true
optional: true
'@biomejs/cli-linux-x64@1.8.1':
/@biomejs/cli-linux-x64@1.8.1:
resolution: {integrity: sha512-AeBycVdNrTzsyYKEOtR2R0Ph0hCD0sCshcp2aOnfGP0hCZbtFg09D0SdKLbyzKntisY41HxKVrydYiaApp+2uw==}
engines: {node: '>=14.21.3'}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: true
optional: true
'@biomejs/cli-win32-arm64@1.8.1':
/@biomejs/cli-win32-arm64@1.8.1:
resolution: {integrity: sha512-6tEd1H/iFKpgpE3OIB7oNgW5XkjiVMzMRPL8zYoZ036YfuJ5nMYm9eB9H/y81+8Z76vL48fiYzMPotJwukGPqQ==}
engines: {node: '>=14.21.3'}
cpu: [arm64]
os: [win32]
requiresBuild: true
dev: true
optional: true
'@biomejs/cli-win32-x64@1.8.1':
/@biomejs/cli-win32-x64@1.8.1:
resolution: {integrity: sha512-g2H31jJzYmS4jkvl6TiyEjEX+Nv79a5km/xn+5DARTp5MBFzC9gwceusSSB2AkJKqZzY131AiACAWjKrVt5Ijw==}
engines: {node: '>=14.21.3'}
cpu: [x64]
os: [win32]
requiresBuild: true
dev: true
optional: true
'@types/node@20.14.2':
/@types/node@20.14.2:
resolution: {integrity: sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q==}
dependencies:
undici-types: 5.26.5
dev: true
ansi-styles@4.3.0:
/ansi-styles@4.3.0:
resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==}
engines: {node: '>=8'}
dependencies:
color-convert: 2.0.1
dev: true
chalk@3.0.0:
/chalk@3.0.0:
resolution: {integrity: sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==}
engines: {node: '>=8'}
dependencies:
ansi-styles: 4.3.0
supports-color: 7.2.0
dev: true
check-node-version@4.2.1:
/check-node-version@4.2.1:
resolution: {integrity: sha512-YYmFYHV/X7kSJhuN/QYHUu998n/TRuDe8UenM3+m5NrkiH670lb9ILqHIvBencvJc4SDh+XcbXMR4b+TtubJiw==}
engines: {node: '>=8.3.0'}
hasBin: true
dependencies:
chalk: 3.0.0
map-values: 1.0.1
@ -239,63 +154,123 @@ snapshots:
object-filter: 1.0.2
run-parallel: 1.2.0
semver: 6.3.1
dev: true
color-convert@2.0.1:
/color-convert@2.0.1:
resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}
engines: {node: '>=7.0.0'}
dependencies:
color-name: 1.1.4
dev: true
color-name@1.1.4: {}
/color-name@1.1.4:
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
dev: true
cross-fetch@4.0.0:
/cross-fetch@4.0.0:
resolution: {integrity: sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==}
dependencies:
node-fetch: 2.7.0
transitivePeerDependencies:
- encoding
dev: false
has-flag@4.0.0: {}
/has-flag@4.0.0:
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
engines: {node: '>=8'}
dev: true
map-values@1.0.1: {}
/map-values@1.0.1:
resolution: {integrity: sha512-BbShUnr5OartXJe1GeccAWtfro11hhgNJg6G9/UtWKjVGvV5U4C09cg5nk8JUevhXODaXY+hQ3xxMUKSs62ONQ==}
dev: true
minimist@1.2.8: {}
/minimist@1.2.8:
resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==}
dev: true
node-fetch@2.7.0:
/node-fetch@2.7.0:
resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==}
engines: {node: 4.x || >=6.0.0}
peerDependencies:
encoding: ^0.1.0
peerDependenciesMeta:
encoding:
optional: true
dependencies:
whatwg-url: 5.0.0
dev: false
object-filter@1.0.2: {}
/object-filter@1.0.2:
resolution: {integrity: sha512-NahvP2vZcy1ZiiYah30CEPw0FpDcSkSePJBMpzl5EQgCmISijiGuJm3SPYp7U+Lf2TljyaIw3E5EgkEx/TNEVA==}
dev: true
p-comuns@git+http://leitura:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MTQ3NTA1NzYsImlzcyI6IkdpdG5lc3MiLCJwaWQiOjgsInRrbiI6eyJ0eXAiOiJwYXQiLCJpZCI6MzJ9fQ.OYdExOVQm5UI3wfeTaWjmD0o65Y1hrjFz5EvMB1a__U@git.idz.one:3000/git/multi-modulos-ambientais/_comuns.git#b01ceca6b840e3a30ee85a2dd98015ab0e8f298d(typescript@4.9.5):
dependencies:
typescript: 4.9.5
zod: 3.23.8
/queue-microtask@1.2.3:
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
dev: true
p-respostas@git+http://leitura:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MTQ3NTA1NzYsImlzcyI6IkdpdG5lc3MiLCJwaWQiOjgsInRrbiI6eyJ0eXAiOiJwYXQiLCJpZCI6MzJ9fQ.OYdExOVQm5UI3wfeTaWjmD0o65Y1hrjFz5EvMB1a__U@git.idz.one:3000/git/multi-modulos-ambientais/_respostas.git#c10a2584e6f6ec5c87462c810cafb1dad243067d:
dependencies:
zod: 3.23.8
queue-microtask@1.2.3: {}
run-parallel@1.2.0:
/run-parallel@1.2.0:
resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==}
dependencies:
queue-microtask: 1.2.3
dev: true
semver@6.3.1: {}
/semver@6.3.1:
resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==}
hasBin: true
dev: true
supports-color@7.2.0:
/supports-color@7.2.0:
resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
engines: {node: '>=8'}
dependencies:
has-flag: 4.0.0
dev: true
tr46@0.0.3: {}
/tr46@0.0.3:
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
dev: false
typescript@4.9.5: {}
/typescript@4.9.5:
resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==}
engines: {node: '>=4.2.0'}
hasBin: true
dev: true
undici-types@5.26.5: {}
/undici-types@5.26.5:
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
dev: true
webidl-conversions@3.0.1: {}
/webidl-conversions@3.0.1:
resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==}
dev: false
whatwg-url@5.0.0:
/whatwg-url@5.0.0:
resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==}
dependencies:
tr46: 0.0.3
webidl-conversions: 3.0.1
dev: false
zod@3.23.8: {}
/zod@3.23.8:
resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==}
leitura+eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MTQ3NTA1NzYsImlzcyI6IkdpdG5lc3MiLCJwaWQiOjgsInRrbiI6eyJ0eXAiOiJwYXQiLCJpZCI6MzJ9fQ.OYdExOVQm5UI3wfeTaWjmD0o65Y1hrjFz5EvMB1a__U@git.idz.one+3000/git/multi-modulos-ambientais/_comuns/b01ceca6b840e3a30ee85a2dd98015ab0e8f298d(typescript@4.9.5):
resolution: {commit: b01ceca6b840e3a30ee85a2dd98015ab0e8f298d, repo: http://leitura:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MTQ3NTA1NzYsImlzcyI6IkdpdG5lc3MiLCJwaWQiOjgsInRrbiI6eyJ0eXAiOiJwYXQiLCJpZCI6MzJ9fQ.OYdExOVQm5UI3wfeTaWjmD0o65Y1hrjFz5EvMB1a__U@git.idz.one:3000/git/multi-modulos-ambientais/_comuns.git, type: git}
id: leitura+eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MTQ3NTA1NzYsImlzcyI6IkdpdG5lc3MiLCJwaWQiOjgsInRrbiI6eyJ0eXAiOiJwYXQiLCJpZCI6MzJ9fQ.OYdExOVQm5UI3wfeTaWjmD0o65Y1hrjFz5EvMB1a__U@git.idz.one+3000/git/multi-modulos-ambientais/_comuns/b01ceca6b840e3a30ee85a2dd98015ab0e8f298d
name: p-comuns
version: 0.31.0
peerDependencies:
typescript: ^5.0.0
dependencies:
typescript: 4.9.5
zod: 3.23.8
dev: true
leitura+eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MTQ3NTA1NzYsImlzcyI6IkdpdG5lc3MiLCJwaWQiOjgsInRrbiI6eyJ0eXAiOiJwYXQiLCJpZCI6MzJ9fQ.OYdExOVQm5UI3wfeTaWjmD0o65Y1hrjFz5EvMB1a__U@git.idz.one+3000/git/multi-modulos-ambientais/_respostas/c10a2584e6f6ec5c87462c810cafb1dad243067d:
resolution: {commit: c10a2584e6f6ec5c87462c810cafb1dad243067d, repo: http://leitura:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MTQ3NTA1NzYsImlzcyI6IkdpdG5lc3MiLCJwaWQiOjgsInRrbiI6eyJ0eXAiOiJwYXQiLCJpZCI6MzJ9fQ.OYdExOVQm5UI3wfeTaWjmD0o65Y1hrjFz5EvMB1a__U@git.idz.one:3000/git/multi-modulos-ambientais/_respostas.git, type: git}
name: p-respostas
version: 0.12.0
requiresBuild: true
dependencies:
zod: 3.23.8
dev: true

View file

@ -33,7 +33,7 @@ export const usuarios_quipo_governo = async ({
})
.then((r) => r.json())
.catch((e) =>
respostaComuns.erro("Erro ao buscar usuários quipo governo", [e.message]),
respostaComuns.erro(`Erro ao buscar usuários quipo governo ${e.message}`),
)
.then((r) => r as tipoResposta<tipoUsuarioExterno[]>)
}

View file

@ -0,0 +1,43 @@
import node_fetch from "cross-fetch"
import { respostaComuns, type tipoResposta } from "p-respostas"
import type { z } from "zod"
import type { zAmbiente } from "../ts/ambiente"
import { urlAutenticacao } from "./_urlAutenticacao"
export const usuarios_quipo_vincular = async ({
token_produto,
ambiente,
conta,
vinculo,
codigo_usuario,
email,
}: {
ambiente: z.infer<typeof zAmbiente>
token_produto: string
conta: string
vinculo: string
codigo_usuario?: string
email: string
}): Promise<tipoResposta<string>> => {
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 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}`),
)
}

View file

@ -4,6 +4,7 @@ import {
type tipoUsuarioExterno,
usuarios_quipo_governo,
} from "./_usuarios_quipo_governo"
import { usuarios_quipo_vincular } from "./_usuarios_quipo_vincular"
import { validarToken } from "./_validarToken"
export type { tipoUsuarioExterno }
@ -14,4 +15,5 @@ export const pAutenticacao = {
urlAutenticacao,
codigoContaSite,
usuarios_quipo_governo,
usuarios_quipo_vincular,
}

69
src/email/index.ts Normal file
View file

@ -0,0 +1,69 @@
import nodemailer from "nodemailer"
import { respostaComuns, type tipoResposta } 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 = async ({
email,
nome,
assunto,
texto,
htlm,
}: {
email: string
nome?: string
assunto: string
/** Verão em texto do html, não obrigatório */
texto?: string
htlm: string
}): Promise<tipoResposta<string>> => {
const info = await 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
}

View file

@ -4,3 +4,4 @@ export * from "./produtos"
export * from "./pilao-de-dados"
export * from "./residuos"
export * from "./NPS"
export * from "./email"

View file

@ -9,6 +9,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(),