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

@empleado-juan/commons

v1.0.4

Published

Shared code between frontend and backend services

Readme

@empleado-juan/commons

npm version

Paquete de código compartido entre frontend y backend para el sistema Empleado Juan Control.

Instalación

npm install @empleado-juan/commons

Características

  • TypeScript: Tipos completamente tipados
  • Tree-shakeable: Solo importa lo que necesitas
  • Zero dependencies: No trae dependencias extra
  • ESM + CommonJS: Compatible con ambos formatos

Contenido

📦 Types

Interfaces TypeScript compartidas:

import type {
  AttendanceRecord,
  EmployeeData,
  LicenseStatus,
  EventMessage,
  HeartbeatMetrics
} from '@empleado-juan/commons';

// Ejemplo de uso
const attendance: AttendanceRecord = {
  id: '123',
  employeeId: 'emp-456',
  timestamp: new Date(),
  eventType: 'CHECK_IN',
  branchId: 'branch-1'
};

🏷️ Enums

Enumeraciones del dominio:

import {
  AttendanceEventType,
  PaymentType,
  LicenseValidationReason,
  MessageBrokerType
} from '@empleado-juan/commons';

// Ejemplo de uso
if (record.eventType === AttendanceEventType.CHECK_IN) {
  console.log('Empleado ingresó');
}

const paymentType = PaymentType.BIWEEKLY;

Enums disponibles:

  • AttendanceEventType: CHECK_IN, CHECK_OUT, BREAK_START, BREAK_END, etc.
  • PaymentType: MONTHLY, BIWEEKLY, WEEKLY
  • ContractType: FULL_TIME, PART_TIME, CONTRACTOR, TEMPORARY
  • LicenseValidationReason: VALID, EXPIRED, INVALID, etc.
  • MessageBrokerType: RABBITMQ, KAFKA, SQS

🔧 Constants

Constantes del sistema:

import { LICENSE_CONSTANTS } from '@empleado-juan/commons';

// Ejemplo de uso
const cacheTTL = LICENSE_CONSTANTS.CACHE_TTL; // 5 minutos
const gracePeriod = LICENSE_CONSTANTS.GRACE_PERIOD; // 24 horas

📡 Event Topics

Definición de eventos del sistema:

import { EVENT_TOPICS } from '@empleado-juan/commons';

// Ejemplo de uso
const topic = EVENT_TOPICS.ATTENDANCE_CREATED; // 'attendance-created'
const empTopic = EVENT_TOPICS.EMPLOYEE_UPDATED; // 'employee-updated'

Topics disponibles:

  • ATTENDANCE_CREATED, ATTENDANCE_UPDATED
  • EMPLOYEE_CREATED, EMPLOYEE_UPDATED, EMPLOYEE_DELETED
  • COMPENSATION_CREATED, COMPENSATION_UPDATED
  • SCHEDULE_CREATED, SCHEDULE_UPDATED

Ejemplos de Uso

Frontend (React/Next.js)

import { AttendanceEventType, type EmployeeData } from '@empleado-juan/commons';

function EmployeeCard({ employee }: { employee: EmployeeData }) {
  return (
    <div>
      <h3>{employee.firstName} {employee.lastName}</h3>
      <p>Status: {employee.isActive ? 'Activo' : 'Inactivo'}</p>
    </div>
  );
}

Backend (Node.js)

import { EVENT_TOPICS, type EventMessage } from '@empleado-juan/commons';

async function publishEvent(topic: string, data: any) {
  const message: EventMessage = {
    key: data.id,
    value: data,
    headers: {
      'event-type': topic,
      'timestamp': new Date().toISOString()
    }
  };

  await messageQueue.send(EVENT_TOPICS.EMPLOYEE_CREATED, message);
}

Desarrollo

Setup

git clone <repo>
cd commons
npm install

Build

npm run build

Publish

# Incrementar versión
npm version patch|minor|major

# Compilar
npm run build

# Publicar
npm publish --access public

License

MIT © Empleado Juan Team