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

@andrextor_ia11012/p2p-log-parser

v1.2.0

Published

A secure, strictly-typed library designed to parse and mask sensitive transaction data from Placetopay JSON payloads.

Readme

@p2p/log-parser

A strict, high-performance, Domain-Driven Node.js backend library for parsing, masking, and categorizing Placetopay application logs.

Features

  • Strictly Typed: Written in strict TypeScript (100%) offering bullet-proof definitions.
  • UI Decoupled: A purely structural parsing utility independent of frontend frameworks or styling limitations. Designed natively for Node backend integrations.
  • Auto Data Masking: Redacts sensitive payment data such as PAN, CVV, and credit card expiration dates automatically from logs.
  • Intelligent Parsers: Seamlessly identifies and parses structural log dumps from:
    • AWS CloudWatch CSVs (Checkout Insights).
    • New Relic JSON arrays (REST and Checkout).
    • Laravel generic local laravel.log lines.
  • Parser Discovery: Programmatically discover supported formats per app type with their specific detection rules.
  • Hierarchical Log Grouping: Automatically merges distributed multi-session request traces into structured Session ID -> Execution Time dimensions.
  • Domain Mappers: Built with modular sub-mappers specific to Placetopay domains (Core API REST, Checkout, and Microsites).

Installation

You can install this internal dependency into your project using NPM:

npm i @andrextor_ia11012/p2p-log-parser

Basic Usage

The entrypoint to start parsing logs is the orchestrator P2PParserEngine.

import { P2PParserEngine, AppTypes } from '@p2p/log-parser';

// 1. Initialize the root Engine
const engine = new P2PParserEngine();

// 2. Fetch or receive your multi-line raw payload (e.g. from AWS or a file output)
const rawCsvOrJsonContent = \`"Time","__log__grafana_internal__","@message"
2025-12-28 22:14:00,x,"{""message"":""placetopay_event"",""type"":""checkout.session.created"",""session_id"":64495535}"\`;

// 3. Parse specific application logs or use 'ALL' to infer strategies dynamically
const result = engine.parse(rawCsvOrJsonContent, AppTypes.CHECKOUT);

// Array of all linearly flat parsed log events
console.log(result.events);

// Multi-dimensionally grouped logs: Record<SessionId, Record<ExecutionTime, LogEvent[]>>
console.log(result.groupedBySession);

// Additional domain-aware metadata for multi-session datasets
// v1.1.0+: result.metadata is a discriminated union of Checkout, Rest, or Microsites metadata.
if (result.metadata?.appType === AppTypes.CHECKOUT) {
  // Checkout metadata contains detailed session objects
  console.log(result.metadata.sessions[0].sessionType); // e.g. 'PAYMENT'
  console.log(result.metadata.sessions[0].reference);   // e.g. 'REF-12345'
}

Parser Discovery

You can discover supported log formats programmatically:

const formats = engine.getSupportedFormats();
// {
//   checkout: [{ name: 'Checkout New Relic Parser', detectionRule: '...', ... }, ...],
//   rest: [{ name: 'REST New Relic Parser', ... }]
// }

Custom Action Maps

You can extend or override the built-in action maps by passing a P2PParserEngineConfig:

import { P2PParserEngine } from '@p2p/log-parser';
import type { CheckoutActionDetail, RestActionDetail } from '@p2p/log-parser';

const engine = new P2PParserEngine({
  customCheckoutActions: {
    // Override an existing action
    entry: { message: 'My Custom Entry', category: 'BROWSER_LOAD', source: 'FRONTEND' },
    // Add a new action
    myFlow: { message: 'Integrator Flow', category: 'HTTP_REQ_IN', source: 'BACKEND' },
  },
  customRestActions: {
    refund: { message: 'Refund Operation', category: 'PAYMENT', source: 'BACKEND' },
  },
});

Custom actions are merged with the defaults — existing keys are overridden, new keys are added.

Supported Apps

The library splits strategies cleanly over 3 domain blocks via AppTypes:

  • `AppTypes.CHECKOUT`
  • `AppTypes.REST`
  • `AppTypes.MICROSITES` (Generic Strategy)

Built with Modern Standards

  • Compiler/Bundler: Vite 5 (Library Mode).
  • Quality & Linting: Biomejs strictly configured with 2-level spacing and deep heuristics.
  • Testing: vitest unit and integration tests under the explicit test/ scope.

Developer Quick Start

Clone this repository and run standard scripts:

# Install dependencies
npm install

# Run the entire test suite natively
npm run test

# Run strict code format checking
npm run lint

# Build production distributable artifacts using Vite Library Mode
npm run build

License

Confidential - Property of Placetopay (Evertec).