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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@bpmromandie/audittrail-service-lib

v1.0.6

Published

The `audittrail-service-lib` is a TypeScript library designed to facilitate the creation, management, and retrieval of audit logs in microservices architecture. It leverages modern technologies like Axios for HTTP requests and Pino for logging, providing

Downloads

154

Readme

AuditTrail Service Library

The audittrail-service-lib is a TypeScript library designed to facilitate the creation, management, and retrieval of audit logs in microservices architecture. It leverages modern technologies like Axios for HTTP requests and Pino for logging, providing a robust solution for integrating audit trail capabilities into your applications.

Publishing with Scripts

This project includes scripts to facilitate building and publishing the package to a private npm registry. Below are the instructions for using these scripts.

Requirements Setup

  • npm: Ensure that npm is installed and available in your system's PATH.
  • Private npm registry: If you're using a private npm registry (https://bin.swisscom.com/artifactory/api/npm/kyc-npm-local/), make sure to have the necessary authentication set up (e.g., using .npmrc).
.npmrc Configuration for Private NPM Registry

Installation

.npmrc Configuration (Recommended)

For the correct registry settings, add the following to your project's .npmrc file:

# Use the default npm registry for public packages
registry=https://registry.npmjs.org/

# Use the private Artifactory registry for @bpmromandie scope
@bpmromandie:registry=https://bin.swisscom.com/artifactory/api/npm/kyc-npm-local/
//bin.swisscom.com/artifactory/api/npm/kyc-npm-local/:username=YOUR_USERNAME
//bin.swisscom.com/artifactory/api/npm/kyc-npm-local/:_password=YOUR_BASE64_ENCODED_PASSWORD
//bin.swisscom.com/artifactory/api/npm/kyc-npm-local/:email=YOUR_EMAIL

This ensures that public packages are fetched from the public registry and private packages (under @bpmromandie) are fetched from your Artifactory registry.

If your project uses private npm packages (e.g., @bpmromandie scope), you must configure .npmrc with the correct registry and credentials. Here's an example .npmrc file:

  • Ensure you have npm installed and configured correctly on your system before running these scripts.
  • The scripts will check if the necessary configurations (like .npmrc) are set for the private registry before proceeding with the build and publish steps.
  • You might need to provide authentication details for accessing the private registry. This can typically be done by modifying the .npmrc file within the script or manually before running the script.
  • Replace YOUR_USERNAME, YOUR_BASE64_ENCODED_PASSWORD, and YOUR_EMAIL with your actual credentials.
  • Ensure .npmrc is in your project root and will be copied during the Docker build process.

Using PowerShell Script (Windows)

The publish.ps1 script automates the process of building and publishing the package to a private registry. To use this script:

  1. Open PowerShell as Administrator.
  2. Navigate to the project directory where publish.ps1 is located.
  3. Run the script:
    .\publish.ps1

Using Shell Script (Unix/Linux/Mac)

The publish.ps1 script serves a similar purpose but is intended for use in Unix-like environments. To use this script:

  1. Open Terminal
  2. Navigate to the project directory where publish.sh is located
  3. mage the script executable(if not already)
chmod +x publish.sh
  1. Run the script
./publish.sh

Features

  • Create Log Entries: Easily log audit events in your service.
  • Fetch Logs: Retrieve logs based on various criteria.
  • Connection Checks: Verify service connectivity.
  • Configurable: Flexible initialization to suit different deployment environments.

Installation

Install audittrail-service-lib using npm:

npm install audittrail-service-lib

Usage

Here's how to use audittrail-service-lib in your project:

Initializing the AuditTrailService

import { AuditTrailService } from 'audittrail-service-lib';

const apiUrl = 'http://localhost:6004'; 
const service = new AuditTrailService({baseUrl: apiUrl});

Creating a Log Entry

const logEntry = {
  message: 'User login successful',
  level: 'info'
};

service.createLog(logEntry)
  .then(() => console.log('Log entry created'))
  .catch(error => console.error('Error creating log entry', error));

Fetching Logs

service.getLogs()
  .then(logs => console.log('Logs:', logs))
  .catch(error => console.error('Error fetching logs', error));

API Reference

  • createLog(logData): Create a new log entry.
  • getLogs(): Fetch all logs.
  • filterLogs(criteria): Fetch logs that meet specified criteria.

Quick local setup

  • npm config set @bpmromandie:registry https://bin.swisscom.com/artifactory/api/npm/kyc-npm-local/
  • npm login --scope=@bpmromandie --registry=https://bin.swisscom.com/artifactory/api/npm/kyc-npm-local/
  • npm i
  • modify the package version in package.json
  • npm run build
  • npm publish