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

intifact

v1.1.2

Published

SDK TypeScript para la API de Facturación Electrónica SUNAT de Intifact

Readme

intifact

SDK TypeScript auto-generado para la API de Facturación Electrónica SUNAT de Intifact (Perú).

Sigue siempre la versión más reciente de la API: los tipos se regeneran desde el openapi.json que la API expone en /docs/json.

Instalación

npm install intifact

Uso básico

import { FacturacionClient } from "intifact";

const fact = new FacturacionClient({
  baseUrl: "https://api-facturacion.intifact.com",
  apiKey: process.env.FACTURACION_API_KEY, // tu API key fact_live_/fact_test_
});

// Enviar factura → 202 (encolada)
const { data, error } = await fact.sendInvoice({
  tipoDoc: "01",
  serie: "F001",
  correlativo: "1",
  empresaRuc: "20553510661",
  /* ...resto del payload */
});

if (error) throw error;
console.log("Encolada:", data.data.id);

// Esperar hasta que SUNAT responda
const finalDoc = await fact.waitForDocument(data.data.id);
console.log("Estado:", finalDoc.data.sunat.estado);

Métodos

Emisión

  • sendInvoice(body) — factura (01) o boleta (03)
  • computeInvoice(body) — calcular importes (Modelo B) sin emitir
  • sendNote(body) — nota crédito (07) o débito (08)
  • computeNote(body) — calcular importes de nota sin emitir
  • sendDespatch(body) — guía remisión remitente (09)
  • sendDespatchMulti(body) — varias guías en un request
  • sendDespatchTransportista(body) — guía remisión transportista (31)
  • sendSummary(body) — resumen diario
  • sendVoided(body) — comunicación de baja

Anulaciones

  • cancelInvoice(body) — anular factura
  • cancelBoleta(body) — anular boleta

Consultas

  • listDocuments(query?) — listado paginado con filtros
  • getDocument(id) — detalle completo
  • getNextCorrelativo(query) — siguiente correlativo de una serie
  • getTicketStatus(ticket, ruc) — estado de ticket asíncrono

Archivos (ArrayBuffer)

  • getInvoiceXml(id) / getInvoiceCdr(id) / getInvoicePdf(id)
  • getNoteXml(id) / getNotePdf(id)
  • getDespatchXml(id) / getDespatchPdf(id, format?)format: a4 | ticket80 | ticket58

Webhooks

  • createWebhook(body) / listWebhooks() / getWebhook(id)
  • updateWebhook(id, body) / deleteWebhook(id)
  • listWebhookDeliveries(id) / redeliverWebhook(id, deliveryId)
  • testWebhook(id) / rotateWebhookSecret(id)

Catálogos SUNAT

  • getCatalogs() / getCatalog(key)

Consulta pública (sin auth — clientes finales)

  • consultarComprobante(ruc, tipoDoc, serie, numero)
  • consultarComprobantePdf(...) / consultarComprobanteXml(...) → ArrayBuffer

Cola

  • retryDocument(id) — re-encolar documento fallido
  • getQueueStats() — estado de BullMQ
  • waitForDocument(id, opts?) — polling hasta estado final

Empresas (solo lectura)

  • listCompanies() / getCompany(id) / getCompanyLogo(id)

Crear empresas, subir certificado/logo, gestionar API keys, tenants, audit y planes son operaciones administrativas (requieren MASTER_API_KEY) y no se exponen en el SDK — las gestiona el backend (ERP).

Regenerar tipos

Cada vez que la API agrega o cambia endpoints:

npm run gen                 # contra http://localhost:3000
npm run gen -- --url=...    # contra producción

Esto descarga openapi.json y regenera src/types.ts con openapi-typescript.

Stack

  • openapi-typescript — genera tipos TS desde la spec
  • openapi-fetch — runtime client liviano (<6kB) con tipado completo