npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mafesoftware/correo

v0.2.1

Published

Envío de mails transaccionales por Resend para los productos de MAFE Software. Sin dependencias, sin framework: fetch inyectable, resultados en vez de excepciones y una plantilla HTML con la marca de cada producto.

Readme

@mafesoftware/correo

Envío de mails transaccionales por Resend para los productos de MAFE Software (store360, consult360, …). Sin dependencias, sin framework: fetch inyectable para los tests y resultados en vez de excepciones — un mail es un aviso, y mandarlo no puede tumbar la operación que lo dispara.

import { enviarCorreo, plantillaCorreo, botonCorreo, escapeHtml } from "@mafesoftware/correo";

const r = await enviarCorreo({
  apiKey: process.env.RESEND_API_KEY!,
  de: "Bestie K-Beauty <[email protected]>",
  para: "[email protected]",
  asunto: "¡Gracias por tu compra!",
  html: plantillaCorreo({
    marca: { nombre: "Bestie K-Beauty", colorFondo: "#5c1f30" },
    cuerpoHtml: `<h1>Pedido W-0012</h1>${botonCorreo("https://bestie.com.ar/cuenta", "Ver mi pedido", "#5c1f30")}`,
  }),
});

if (!r.ok) console.error(r.categoria, r.error);

API

  • enviarCorreo(opciones) — POST a la API de Resend. Nunca tira: devuelve { ok: true, id } o { ok: false, categoria, error }. La categoría dice si reintentar sirve: red, limite y conflicto_idempotencia sí; credenciales y rechazado no. Soporta varios destinatarios, responderA (reply-to) y adjuntos (los bytes se codifican a base64 acá). claveIdempotencia (opcional) se manda como header Idempotency-Key: con la misma clave, un segundo envío no duplica el mail — Resend devuelve el resultado del primero (o, si el cuerpo del segundo envío es DISTINTO al del primero con la misma clave, HTTP 409 → categoria: "conflicto_idempotencia"). señal (opcional, AbortSignal) se pasa tal cual al fetch — cancelarla corta el pedido, aunque no deshace un envío que Resend ya haya aceptado.

    const controlador = new AbortController();
    await enviarCorreo({
      ...opciones,
      claveIdempotencia: "tenant-1:confirmacion-pedido-42",
      señal: controlador.signal,
    });

    Ejemplo completo arriba.

  • plantillaCorreo({ marca, cuerpoHtml, pie }) — la cáscara HTML con la marca del producto: encabezado con color propio, ancho fijo, estilos en línea (los clientes de correo ignoran <style>). El cuerpoHtml lo arma la aplicación; la marca y el pie se escapan acá. Ejemplo arriba.

  • botonCorreo(url, texto, color?) — un <a> con estilo de botón, listo para meter dentro de un cuerpoHtml:

    botonCorreo("https://bestie.com.ar/cuenta", "Ver mi pedido", "#5c1f30");
    // '<p style="..."><a href="https://bestie.com.ar/cuenta" style="...">Ver mi pedido</a></p>'
  • escapeHtml(texto) — escapa &, <, >, " y ' antes de interpolar texto de usuario en HTML:

    escapeHtml('<b>hola</b> & "chau"'); // '&lt;b&gt;hola&lt;/b&gt; &amp; &quot;chau&quot;'

Reglas

  • Todo texto que venga de un usuario pasa por escapeHtml antes de entrar al cuerpo. La plantilla escapa lo suyo (marca, pie); del cuerpoHtml es responsable quien lo arma.
  • El remitente tiene que ser de un dominio verificado en Resend.
  • En los tests, inyectá fetch: la suite no tiene por qué hablar con Resend.