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

@loanscope/graph

v0.1.1

Published

Generic typed DAG evaluator with provenance tracking and scoped evaluation, used as the computation substrate for LoanScope underwriting.

Downloads

59

Readme

@loanscope/graph

npm version License: MIT

Generic typed DAG evaluator with provenance tracking, scoped evaluation, and a BlockedNode surface for missing inputs. Used as the computation substrate for the LoanScope underwriting engine.

Why a separate package

Mortgage underwriting is the motivating use case, but the graph mechanism is domain-agnostic — it's a typed DAG library in the same way immer is a typed structural-sharing library. Factoring it out of @loanscope/engine:

  • Keeps engine focused on mortgage orchestration. The engine's source deals with tier resolution, variant selection, effective-data assembly, and scoped responses — not with DAG traversal algorithms.
  • Makes the DAG semantics reusable. Any other LoanScope package (comparison grids, simulations, future rules engines) can compose the same provenance-tracking evaluator without depending on @loanscope/engine.
  • Makes the DAG semantics testable in isolation. The graph package has its own unit test suite (29 tests) pinning ordering, provenance, and blocked-node invariants independent of any mortgage logic.
  • Enables @loanscope/calculations to exist as a pure wiring layer. Calculations imports @loanscope/graph types and emits NodeDefinition / EdgeDefinition values; it never touches traversal code.

What it does

A graph is built from:

  • NodeDefinition<T> — a typed value keyed by string id. Inputs supply values; intermediates and outputs receive values from edges.
  • EdgeDefinition — a pure function over input node ids that produces one or more output node ids. Each edge declares its confidence (derived / estimated / partial), which flows through to the resolved node.

Evaluation is total:

  • Every output is either resolved (with a confidence label) or blocked (with the set of missing input node ids that prevented its evaluation).
  • There are no silent defaults: a missing input blocks downstream evaluation cleanly rather than being coerced to 0 / null.
  • Provenance is recorded: every computed value carries the id of the edge that produced it, so downstream tooling can trace any result back to its source.

Checks are first-class edges that emit UnderwritingCheck records; they participate in the same blocked-vs-resolved semantics as every other node.

Install

pnpm add @loanscope/graph

Usage

Rarely consumed directly by external code — @loanscope/calculations is the canonical in-repo consumer. See that package for end-to-end examples of building a graph from node and edge definitions and evaluating it via @loanscope/graph.

Part of the LoanScope monorepo

See the repository root for the full list of @loanscope/* packages and the architecture reference.

License

MIT