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

@mdp-framework/gateway

v1.1.99

Published

MDP Gateway - Policy resolver, action engine, and adapter orchestration

Readme

@mdp-framework/gateway

MDP Gateway - Policy resolver, action engine, and adapter orchestration.

Features

  • Policy Resolver: Deterministic policy resolution from registry
  • Action Engine: Execute policy violations with handlers
  • Capsule Store: Dual-backend persistence (file & Postgres)
    • File backend for local development
    • Postgres backend for team/org shared state
    • JSON Merge Patch semantics with append-only arrays
    • Optimistic concurrency control
    • Retention policies and pruning

Installation

npm install @mdp-framework/gateway

Capsule Store Usage

File Backend (Local Development)

import { createCapsuleStore } from '@mdp-framework/gateway/store';

const store = await createCapsuleStore({
  backend: 'file',
  baseDir: '.mlang/state/capsules',
  retention: {
    localDays: 14,
    protectOpen: true,
    pins: ['capsule://proj/TEAM/pr/important-pr'],
  },
});

// CRUD operations
await store.put(capsule);
const result = await store.get('capsule://proj/TEAM/pr/pr-123');
await store.merge(id, { evidence: ['new-evidence'] });
await store.delete(id);

// Bulk operations
const list = await store.list({ kind: 'pr', limit: 10 });
const many = await store.getMany([id1, id2, id3]);

// Maintenance
await store.prune(true); // dry-run
await store.prune(false); // actually delete

// Export/import (NDJSON)
for await (const entry of store.export({ kind: 'pr' })) {
  console.log(entry);
}

Postgres Backend (Team/Org)

const store = await createCapsuleStore({
  backend: 'postgres',
  dsn: process.env.MLANG_STATE_DSN || 'postgresql://localhost/mdp',
  retention: {
    sharedDays: 60,
    protectOpen: true,
    checkLinks: true,
    protectSla: true,
  },
});

// Same API as file backend
await store.put(capsule);
const result = await store.get(id);

Testing

Unit Tests (File Backend)

npm test

Integration Tests (Postgres Backend)

Requires Postgres database:

# Start test database
docker compose -f ../../docker-compose.test.yml up -d postgres

# Run integration tests
TEST_DSN=postgresql://postgres:postgres@localhost:5432/mdp_test npm test

# Stop database
docker compose -f ../../docker-compose.test.yml down

Database Schema

The Postgres backend uses a single table:

CREATE TABLE mdp_capsules (
  id TEXT PRIMARY KEY,
  doc JSONB NOT NULL,
  version INT NOT NULL DEFAULT 1,
  updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE INDEX idx_capsules_updated_at ON mdp_capsules(updated_at);
CREATE INDEX idx_capsules_kind ON mdp_capsules((doc->>'kind'));
CREATE INDEX idx_capsules_status ON mdp_capsules((doc->'metadata'->>'status'));

Schema is automatically created on first connection.

CI Integration

Add to .github/workflows/test.yml:

services:
  postgres:
    image: postgres:16-alpine
    env:
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: mdp_test
    options: >-
      --health-cmd pg_isready
      --health-interval 10s
      --health-timeout 5s
      --health-retries 5

- name: Run tests
  env:
    TEST_DSN: postgresql://postgres:postgres@localhost:5432/mdp_test
  run: npm test

License

MIT