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

@jrosadob/ms-sophia-framework-mysql

v0.0.4

Published

node -v npm -v nest --version npm i -g @nestjs/cli # Revisar disponibilidad npm view ms-sophia-framework-mysql version # Crear el workspace (No funciona con pnpm) nest new ms-sophia-framework-mysql --package-manager npm # Ingresar cd ms-sophia-framework-m

Readme

Sophia Framework

node -v npm -v nest --version npm i -g @nestjs/cli

Revisar disponibilidad

npm view ms-sophia-framework-mysql version

Crear el workspace (No funciona con pnpm)

nest new ms-sophia-framework-mysql --package-manager npm

Ingresar

cd ms-sophia-framework-mysql

Generar la libreria

nest g library ms-sophia-framework-mysql

Compilar

npm run build

Validsate

nest build ms-sophia-framework-mysql

Pack en tg.gz para despliegue local

npm pack

Publish

npm publish --access public

v47

Define propiedes dinamicas para el datasource: entities, subscribers, synchronize, logging, logger: typeOrmLogger

Publish

  • Actualizar version in package.json
  • Run ./publish.sh

CLI

$ pnpm install
$ pnpm add @nestjs/config   # Install package
$ pnpm run start            # Development
$ pnpm run start:dev        # Wath mode
$ pnpm run start:prod       # Production mode

$ pnpm run test             # Unit tests
$ pnpm run test:e2e         # e2e tests
$ pnpm run test:cov         # Coverage test

Packages

pnpm add @nestjs/config
pnpm add @nestjs/swagger
pnpm add @nestjs/typeorm
pnpm add axios
pnpm add class-transformer
pnpm add class-validator
pnpm add js
pnpm add js-yaml
pnpm add mysql2
pnpm add nanoid
pnpm add typeorm
pnpm add @nestjs/microservices

PreHook

app.useGlobalInterceptors(new LoggingInterceptor(configService));
app.useGlobalFilters(new AllExceptionsFilter());

Idempotencia de Controladores TCP

Asegurarse de que sea idempotente Si es para traer datos no hay problema Pero si es para guardar datos, debe usarse una transaccion con una tabla que tiene PK ms-accounts, module-name y method-name. Si todo sale bien enviar el ACK. Si se detacto duplicado no ejecutar el metodo de negocio, pero enviar el ACK para que RabbitMQ no siga enviando mensajes.

@MessagePattern({ cmd: 'charge' })
async handleCharge(@Payload() data: any, @Ctx() ctx: RmqContext) {
  const channel = ctx.getChannelRef();
  const msg = ctx.getMessage();

  const key =
    msg.properties?.headers?.['x-idempotency-key'] ||
    msg.properties?.messageId;

  if (!key) {
    // Sin clave no hay deduplicación confiable
    // Decide: rechazar o procesar con riesgo
    channel.nack(msg, false, false);
    return;
  }

  try {
    await this.dataSource.transaction(async (manager) => {
      // 1) Intentar registrar el mensaje
      // Si falla por unique, es duplicado
      await manager.query(
        `INSERT INTO processed_messages (consumer_name, message_key)
         VALUES (?, ?)`,
        ['payments-consumer', key],
      );

      // 2) Lógica de negocio real (solo primera vez)
      await this.paymentService.charge(data, manager);
    });

    // 3) Confirmar
    channel.ack(msg);
  } catch (e: any) {
    // Duplicado por unique constraint: confirmar y salir
    if (isDuplicateKeyError(e)) {
      channel.ack(msg);
      return;
    }

    // Error real: reintentar o enviar a DLQ según estrategia
    channel.nack(msg, false, true);
  }
}