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

@vncsleal/prisml

v0.3.1

Published

PrisML: compiler-first ML for TypeScript + Prisma

Downloads

52

Readme

@vncsleal/prisml

Compiler-first machine learning library for TypeScript + Prisma applications.

Overview

PrisML treats ML model training as a compile-time step, generating immutable ONNX artifacts that provide type-safe, in-process predictions at runtime.

Philosophy:

  • Training = compilation (build-time)
  • Artifacts = immutable binaries (committed to git)
  • Predictions = synchronous function calls (in-process)

Installation

npm install @vncsleal/prisml

Python training backend requires:

pip install -r node_modules/@vncsleal/prisml/python/requirements.txt

Quick Start

1. Define your model (prisml.config.ts)

import { defineModel } from '@vncsleal/prisml';

export const salesModel = defineModel<Product>({
  name: 'productSales',
  modelName: 'Product',
  output: { field: 'sales', taskType: 'regression' },
  features: {
    price: (p) => p.price,
    stock: (p) => p.stock,
    category: (p) => p.category, // string → one-hot encoded automatically
  },
  // algorithm is optional — omit it and FLAML AutoML selects the best estimator
  qualityGates: [
    { metric: 'r2', threshold: 0.85, comparison: 'gte' },
  ],
});

2. Train (build-time)

npx prisml train --config ./prisml.config.ts --schema ./prisma/schema.prisma

Outputs to .prisml/:

  • productSales.onnx — model binary
  • productSales.metadata.json — schema contract

3. Predict (runtime)

import { PredictionSession } from '@vncsleal/prisml';
import { salesModel } from './prisml.config';

const session = new PredictionSession();
await session.load(salesModel); // resolves .prisml/ and prisma/schema.prisma automatically

const result = await session.predict(salesModel, product);
// { modelName: 'productSales', prediction: 42.3, timestamp: '...' }

API

defineModel<T>(definition)

Declares a model. Pure config — no side effects.

new PredictionSession()

session.load(model, opts?)

Loads a trained model from .prisml/<name>.{onnx,metadata.json} and hashes prisma/schema.prisma automatically.

  • opts.artifactsDir — override artifacts directory (default: .prisml/)
  • opts.schemaPath — override schema path (default: prisma/schema.prisma)

session.predict(model, entity)

Runs inference on a single entity using the resolvers declared in model.features.

session.predictBatch(model, entities)

Runs inference over an array of entities. Preflight is atomic — any validation failure aborts the entire batch with no partial execution.

session.initializeModel(metadataPath, onnxPath, schemaHash)

Low-level path-based initializer. Prefer session.load().

hashPrismaSchema(schema: string): string

Returns the normalized SHA-256 hash of a full Prisma schema string. Used for drift detection.

hashPrismaModelSubset(schema: string, modelName: string): string

Returns a SHA-256 hash scoped to a single model block and its referenced enums. Changes to unrelated models do not invalidate artifacts compiled with this hash (default for artifacts compiled with metadataSchemaVersion >= 1.2.0).

Quality Gates

qualityGates: [
  { metric: 'r2', threshold: 0.85, comparison: 'gte' },
  { metric: 'rmse', threshold: 500, comparison: 'lte' },
]

prisml train exits non-zero if any gate fails.

Supported Algorithms

| Name | Regression | Classification | |------|-----------|----------------| | (omit) | AutoML (FLAML, default) — selects best estimator in 60s | same | | linear | LinearRegression | LogisticRegression | | tree | DecisionTreeRegressor | DecisionTreeClassifier | | forest | RandomForestRegressor | RandomForestClassifier | | gbm | GradientBoostingRegressor | GradientBoostingClassifier |

Feature Encoding

| Feature type | Encoding | |---|---| | number | Standard scaling (mean/std computed at train time) | | boolean | 0 / 1 | | string | One-hot encoding (categories computed at train time) | | Date | Unix timestamp (ms) | | null / undefined | Imputation |

License

MIT © Vinicius Leal