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

@fumh_terol/payload-plugin-audit-log

v1.0.17

Published

Audit log plugin for Payload CMS - tracks field-level changes on documents

Readme

Payload Audit Log Plugin

Plugin de auditoría para Payload CMS que registra cambios a nivel de campo en documentos.

Características

  • Colección de auditoría centralizada: Todos los cambios se almacenan en audit-logs
  • Campo de historial en cada documento: Muestra los cambios realizados directamente en el documento
  • Seguimiento a nivel de campo: Registra qué campos cambiaron, valores antiguos y nuevos
  • Soporte multi-colección: Configurable por colección
  • Control de usuario: Registra qué usuario realizó cada cambio
  • Timestamps precisos: Fecha y hora de cada operación

Instalación

npm install @fumh_terol/payload-plugin-audit-log

Uso

Configuración básica

import { auditLogPlugin } from '@fumh_terol/payload-plugin-audit-log'
import { buildConfig } from 'payload'

export default buildConfig({
  // ... tu config
  plugins: [
    auditLogPlugin({
      // Colecciones a monitorear
      watch: [
        {
          collection: 'posts',
          // Campos específicos a trackear (null = todos)
          fields: ['title', 'content', 'status'],
        },
        {
          collection: 'products',
          fields: null, // Trackea todos los campos
        },
      ],
      collectionsUrl: '/collections',
      // Permite borrar logs si req.user.roles incluye 'admin'
      deleteAccess: {
        field: 'roles',
        values: ['admin'],
      },
      logUser: true, // Registrar usuario
      logTimestamp: true, // Registrar timestamp
    }),
  ],
})

Opciones del plugin

| Opción | Tipo | Descripción | |--------|------|-------------| | auditCollectionSlug | string | Slug de la colección de auditoría (default: 'audit-logs') | | collectionsUrl | string | URL base para enlaces a documentos (default: '/collections') | | deleteAccess | { field: string; values: unknown \| unknown[] } | Permite borrar logs a usuarios cuyo campo coincida con alguno de los valores | | watch | WatchConfig[] | Array de configuraciones por colección | | trackedFields | Record<string, string[]> | Campos a trackear por colección (alternativa a watch) | | logUser | boolean | Registrar el usuario que hizo el cambio (default: true) | | logTimestamp | boolean | Registrar timestamp (default: true) | | includeDiffs | boolean | Incluir diferencias old/new (default: true) |

Colecciones monitoreadas

El plugin añade automáticamente a cada colección monitorizada:

  1. Campo audit_logs_changes: Array de solo lectura con el historial de cambios
  2. Hooks: beforeChange, afterChange, afterDelete para registrar cambios

Colección de Auditoría

La colección audit-logs almacena:

| Campo | Tipo | Descripción | |-------|------|-------------| | auditTitle | text | Título legible del evento | | timestamp | date | Fecha y hora del cambio | | collectionSlug | text | Nombre de la colección | | documentId | text | ID del documento afectado | | operation | select | create, update, delete, restore | | userEmail | text | Email del usuario (si está habilitado) | | userId | text | ID del usuario (si está habilitado) | | changes | array | Array de cambios con field, label, oldValue, newValue |

Ejemplo de uso

// En payload.config.ts
import { auditLogPlugin } from '@fumh_terol/payload-plugin-audit-log'

export default buildConfig({
  // ...
  plugins: [
    auditLogPlugin({
      watch: [
        { collection: 'posts', fields: ['title', 'content'] },
        { collection: 'pages', fields: null }, // Todos los campos
        { collection: 'users', fields: ['name', 'email', 'role'] },
      ],
      collectionsUrl: '/admin/collections',
      deleteAccess: {
        field: 'roles',
        values: ['admin'],
      },
      logUser: true,
    }),
  ],
})

Desarrollo

# Instalar dependencias
npm install

# Compilar
npm run build

# Desarrollo (requiere MongoDB)
cp dev/.env.example dev/.env
npm run dev

Licencia

MIT