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

@zaamx/netme-viajes

v0.0.2

Published

Módulo Viajes (incentivo por millas) para Netme/GoLife: campañas, catálogo de acciones, simulador y admin; el motor de cálculo vive en SQL netme_viaje_*.

Readme

@zaamx/netme-viajes

Programa de viajes de incentivo por millas para Netme (GoLife). Plugin Medusa v2 mínimo: crea solo las tablas de configuración (netme_viaje_*) y expone workflows, API admin/store y páginas de admin. Todo el cálculo de millas vive en SQL (netme_viaje_* en el repo del motor, dbGoLife/supabase/migrations/20260925000001_modulo_viajes_motor.sql) y el plugin lo consume por la conexión de Medusa (@InjectManager). Mismo patrón "base mínima + SQL por cliente" que @zaamx/netme.

Spec: docs/spec-viajes-golife.md. Diseño y runbook: dbGoLife/supabase/docs/24-modulo-viajes.md.

Instalación (core mlm-medusa)

// medusa-config.ts
plugins: [
  { resolve: "@zaamx/netme", options: {} },
  { resolve: "@zaamx/netme-viajes", options: {} },   // después de @zaamx/netme
]
yarn add @zaamx/netme-viajes
npx medusa db:migrate            # desde el core: crea las tablas netme_viaje_* (módulo netmeViajes)
# luego, en la base del motor: psql -f supabase/migrations/20260925000001_modulo_viajes_motor.sql

Orden obligatorio: migración del plugin (tablas) → migración SQL del motor (funciones que las leen).

Desarrollo

yarn install && yarn build                       # tsc + admin (vite)
npx tsc -p src/admin/tsconfig.json --noEmit      # type-check del admin (vite no lo hace)
DB_HOST=127.0.0.1 DB_PORT=54322 DB_USERNAME=postgres DB_PASSWORD=postgres npx medusa plugin:db:generate
bash dev.sh                                      # plugin:publish (yalc) + plugin:add en el core + plugin:develop

Tras cada cambio en modo dev: plugin:publish + plugin:add en el core + reiniciar yarn dev del core.

Estructura

src/modules/netme-viajes/   módulo netmeViajes: models/ (solo entidades DML), types.ts, defaults.ts,
                            service.ts (CRUD + bridge SQL), migrations/ (generadas por CLI)
src/workflows/              toda mutación (crear/editar/activar/cerrar/clonar campaña, versión N,
                            simular, objetivo, recalcular ciclo, eventos, asistencias, ajustes)
src/api/admin/viajes/       rutas admin (GET/POST/DELETE) + validators.ts (zod); src/api/middlewares.ts
src/api/store/viajes/       /store/viajes/mi-progreso (vista del afiliado)
src/admin/                  routes/viajes (lista) y routes/viajes/[id] (detalle con pestañas), components/viajes
docs/                       spec, modelo de datos, API y admin

Gotchas

  • Claves de MedusaService({...}) = PascalCase exacto del model.define; la pluralización de TIPOS difiere de la de runtime (Eventoes vs Eventos): el service expone crearEventos/borrarEventos.
  • models/*.ts solo exporta entidades DML (plugin:db:generate toma cualquier export como entidad).
  • Arrays a Postgres en manager.execute: literal '{1,2,3}'::bigint[] (knex expande arrays JS a listas).
  • Nunca abrir conexiones propias a Postgres: solo @InjectManager() / PG_CONNECTION del container.