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

@harbortouch/skytab-analytics-report-utils

v0.10.0

Published

Centralized report column presentation configuration for SkyTab Analytics

Readme

skytab-analytics-report-utils

A framework-agnostic TypeScript library that centralises all report column presentation configuration for SkyTab Analytics. It is the shared source of truth consumed by frontend, backend, and export services — ensuring column definitions, types, widths, footers, and i18n keys stay consistent across all applications.

What it provides

  • Which columns exist in each report
  • How each column is typed (money, percent, string, etc.)
  • Column widths and alignment rules
  • Footer aggregation logic (sum / percent-change / average)
  • Column group structure (for multi-level headers)
  • i18n translation key references for column labels and tooltips

No React. No i18n runtime. No API dependencies. Consumers apply the configuration using their own framework.


Installation

# Local development (consuming project's package.json)
{
  "dependencies": {
    "@harbortouch/skytab-analytics-report-utils": "file:../skytab-analytics-report-utils"
  }
}

Requires Node ≥ 22.6.0 and pnpm ≥ 9.0.0.


Usage

// Import everything from the main entry point
import {
  salesSummaryConfig,
  COLUMN_REGISTRY,
  getColumnAlignment,
  calculateReportTotals,
} from '@harbortouch/skytab-analytics-report-utils';

// Sub-path imports for smaller bundles
import { COLUMN_REGISTRY } from '@harbortouch/skytab-analytics-report-utils/columns';
import { salesSummaryConfig } from '@harbortouch/skytab-analytics-report-utils/reports';

Integrating with the frontend (React + TanStack Table)

import { salesSummaryConfig } from '@harbortouch/skytab-analytics-report-utils';
import { type FieldConfig } from '@hooks/useReportBuilder';

const FIELD_CONFIG = salesSummaryConfig.fields as Record<keyof SalesSummaryRecord, FieldConfig<SalesSummaryRecord>>;

Computing totals rows

import { calculateReportTotals, salesSummaryConfig } from '@harbortouch/skytab-analytics-report-utils';

const totals = calculateReportTotals(
  data,                        // row data array
  salesSummaryConfig.fields,   // field config from this library
  { labelField: 'groupByName', label: 'Total' },
);

Repository structure

src/
├── types.ts                — Core interfaces (FieldType, ColumnPresentationConfig, ReportConfig, …)
├── columns/
│   └── index.ts            — ReportColumnKey union type + COLUMN_REGISTRY (i18n keys)
├── reports/
│   ├── salesSummary.ts
│   ├── ticketSummary.ts
│   ├── ticketLive.ts
│   ├── productMix.ts
│   ├── modifierMix.ts
│   ├── itemTax.ts
│   └── index.ts            — Re-exports all report configs
├── totals.ts               — calculateReportTotals() utility
├── utils/
│   └── alignment.ts        — getColumnAlignment(), isNumericType()
└── index.ts                — Main entry point

Available reports

| Export | Report | |---|---| | salesSummaryConfig | Sales Summary | | ticketSummaryConfig | Ticket Summary | | ticketLiveConfig | Ticket Live | | productMixConfig | Product Mix | | modifierMixConfig | Modifier Mix | | itemTaxConfig | Item Tax |


Core concepts

FieldType

Governs both formatting and alignment for a column:

| Type | Alignment | Description | |---|---|---| | string | left | Plain text | | date | left | Calendar date | | time | left | Time of day | | boolean | right | True/false flag | | money | right | Currency value | | number | right | Integer or generic numeric | | fixedNumber | right | Decimal with fixed precision | | percent | right | Ratio displayed as percentage (×100) |

FooterCalculation

Declarative aggregation for totals rows:

| Type | Formula | |---|---| | sum | Σ row[field] | | percentChange | (Σ numerator − Σ denominator) / Σ denominator | | average | Σ numerator / Σ denominator |

Column Registry

Every column key maps to three i18n keys via COLUMN_REGISTRY:

{
  titleKey: 'common.report-col.net-sales',
  shortTitleKey: 'common.report-col.net-sales.short',
  infoTextKey: 'common.report-col.net-sales.info',
}

Consumers resolve these keys through their own i18n framework.


Adding a new report

  1. Create src/reports/<reportName>.ts with a FIELDS record and a ReportConfig export.
  2. Re-export from src/reports/index.ts.
  3. Re-export from src/index.ts.
  4. Add any new column keys to src/columns/index.ts (ReportColumnKey union + COLUMN_REGISTRY entry).
  5. Build and verify:
pnpm build
pnpm typecheck

Development

pnpm build       # Build ESM + CJS outputs to dist/
pnpm dev         # Watch mode
pnpm typecheck   # TypeScript type check (no emit)
pnpm lint:js     # ESLint
pnpm lint:js:fix # ESLint with auto-fix