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

@openfactu/plugin-sdk

v0.2.1

Published

SDK oficial para el desarrollo de plugins en la plataforma OpenFactu ERP.

Readme

@openfactu/plugin-sdk

SDK oficial para desarrollar plugins de OpenFactu.

Instalacion

npm install @openfactu/plugin-sdk

Inicio rapido

import type { PluginContext, HookContext } from '@openfactu/plugin-sdk';

const PLUGIN_ID = 'mi-plugin';

export const init = async ({ hooks, migration, documents, app }: PluginContext) => {
  // Añadir campo a una tabla
  await migration.addCustomField({
    pluginId: PLUGIN_ID,
    tableName: 'BusinessPartner',
    fieldName: 'loyalty_points',
    type: 'INTEGER',
    label: 'Puntos de fidelidad',
  });

  // Hook antes de crear factura
  documents.onBeforeCreate('SalesInvoice', async (ctx: HookContext) => {
    if (ctx.data.total > 10000) {
      throw new Error('Limite excedido');
    }
  });

  // Ruta API personalizada
  app.get(`/api/plugins/${PLUGIN_ID}/status`, (req, res) => {
    res.json({ status: 'active' });
  });
};

Tipos disponibles

| Tipo | Descripcion | |------|-------------| | PluginContext | Lo que recibe init(): app, migration, hooks, documents, factuApi | | HookContext | Lo que recibe un hook: tenantId, db, data, user | | PluginInit | Tipo de la funcion init | | PluginManifest | Estructura del manifest.json | | CoreTableName | Tablas del ERP que se pueden extender | | DocumentType | Tipos de documento (salesInvoice, purchaseInvoice, etc.) | | HookEvent | Eventos de hooks (salesInvoice.beforeCreate, etc.) | | HookHandler | Tipo del handler de un hook |

Componentes UI

Los plugins pueden tener componentes React que se cargan en el ERP. Usa @openfactu/ui para los componentes:

import React, { useState } from 'react';
import { Card, Button, Table } from '@openfactu/ui';

const Page = () => {
  return (
    <Card>
      <h2>Mi Plugin</h2>
      <Button onClick={() => alert('hola')}>Click</Button>
    </Card>
  );
};

export default Page;

Manifest

{
  "name": "Mi Plugin",
  "version": "1.0.0",
  "description": "Descripcion",
  "logo": "Puzzle",
  "ui": {
    "routes": [
      {
        "path": "/plugin/mi-plugin",
        "title": "Mi Plugin",
        "type": "custom",
        "config": { "component": "ui/Page.tsx" }
      }
    ],
    "menuItems": [
      { "label": "Mi Plugin", "path": "/plugin/mi-plugin", "icon": "Puzzle" }
    ]
  }
}

Desarrollo remoto

Sube tu plugin a un servidor OpenFactu sin necesidad de acceso SSH:

# Subir una vez
openfactu plugin push --server http://mi-servidor:3000 --client-id ofk_... --client-secret ofs_...

# Auto-sync al guardar
openfactu plugin watch --server http://mi-servidor:3000 --client-id ofk_... --client-secret ofs_...

Las dev keys se generan desde la UI del ERP: Plugins > Desarrollo > Generar API Key.

Links

Licencia

MIT