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

@moderta/reporting-core

v0.1.0

Published

Pure TypeScript reporting domain and business logic library.

Readme

@moderta/reporting-core

Framework-independent reporting domain and application logic for Moderta reporting workflows.

This package is designed to be reused by backend services or other TypeScript projects without depending on a host backend repository, NestJS, React, databases, rendering libraries, or file generation tools.

Installation

npm install @moderta/reporting-core @moderta/api-contracts

@moderta/api-contracts owns the shared reporting contracts. This package depends on those contracts and re-exports the reporting domain surface used by reporting-core consumers.

Development

npm install
npm test
npm run typecheck
npm run build

The build output is emitted to dist/.

Architecture

Reporting-core contains pure TypeScript modules organized around reporting domain behavior:

  • domain: reporting contracts, value objects, controlled vocabularies, and business rules
  • application/calculations: calculation engine, pipeline, calculator registry, calculator contracts, reusable calculators, and carbon calculators
  • application/definitions: report definition registry
  • application/builders: semantic report builder
  • shared/result: serializable result primitives for expected domain failures

All modules are deterministic and framework-neutral. They do not perform I/O, fetch data, persist records, render UI, or generate files.

Public API

Consumers import from the package root:

import {
  createCalculationEngine,
  createReportBuilder,
  createReportDefinitionRegistry,
  createScope1StationaryCombustionCalculator,
  failure,
  success,
  type CalculationInput,
  type CalculationResult,
  type ReportDefinition,
  type ReportDocument
} from "@moderta/reporting-core";

The package exposes:

  • domain contracts such as ReportDefinition, ReportDocument, Metric, ReportTable, CalculationInput, CalculationContext, and CalculationResult
  • controlled vocabularies such as ReportTypes, ReportSectionKinds, MetricValueTypes, AggregationTypes, and FilterOperators
  • business rule primitives and report rules
  • the calculation engine, pipeline, stages, and calculator registry
  • reusable calculators such as createNumericSumCalculator
  • Scope 1 carbon calculators for stationary combustion, mobile combustion, fugitive emissions, and process emissions
  • the report definition registry
  • the semantic report builder
  • result primitives such as Result, success, failure, isSuccess, and isFailure

Responsibilities

Reporting-core owns:

  • reporting-domain invariants and business rules
  • calculation orchestration
  • pure calculator implementations
  • report definition registration and lookup
  • semantic report document assembly
  • framework-neutral error and warning propagation

Reporting-core does not own:

  • HTTP controllers or clients
  • database access, repositories, or migrations
  • NestJS modules, providers, decorators, or dependency injection
  • React components or frontend state
  • HTML, PDF, Word, or Excel rendering/export
  • authentication, authorization, or tenancy enforcement
  • infrastructure SDK integration
  • report scheduling or background jobs

How Other Packages Use It

Reporting backends should load or construct ReportDefinition objects, register them with createReportDefinitionRegistry, run calculations with createCalculationEngine, and build semantic ReportDocument objects with createReportBuilder.

Rendering packages should consume the generated ReportDocument and transform it into HTML, PDF, Word, Excel, or UI-specific output outside this package.

Shared data contract changes should be made in @moderta/api-contracts, not in reporting-core.