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

@liqueur/protocol

v0.1.0

Published

Liquid Protocol - Type definitions and validators for AI-driven dynamic UI generation

Readme

@liqueur/protocol

JSON Schema specification for AI-driven dashboard generation

Overview

@liqueur/protocol provides TypeScript type definitions and validation for the Liquid Protocol - a JSON Schema-based specification for generating dynamic dashboards through AI.

Key principle: AI outputs JSON schemas only, never executable code. This eliminates XSS, SQL injection, and arbitrary code execution risks.

Features

  • Type-safe schema definitions - Comprehensive TypeScript types
  • Runtime validation - SchemaValidator for verifying JSON schemas
  • Component types - Chart (bar, line, pie, area) and Table
  • Data source abstractions - Filters, aggregation, sorting, pagination
  • Layout system - Grid and Stack layouts

Installation

npm install @liqueur/protocol

Usage

Define a Schema

import type { LiquidViewSchema } from '@liqueur/protocol';

const schema: LiquidViewSchema = {
  version: '1.0',
  layout: { type: 'grid', columns: 2 },
  components: [
    {
      type: 'chart',
      chart_type: 'bar',
      title: 'Monthly Expenses',
      data_source: 'expenses'
    },
    {
      type: 'table',
      columns: ['date', 'category', 'amount'],
      title: 'Recent Transactions',
      data_source: 'transactions'
    }
  ],
  data_sources: {
    expenses: {
      resource: 'transactions',
      filters: [{ field: 'type', op: 'eq', value: 'EXPENSE' }],
      aggregation: { type: 'sum', field: 'amount', by: 'month' }
    },
    transactions: {
      resource: 'transactions',
      sort: { field: 'date', direction: 'desc' },
      limit: 10
    }
  }
};

Validate a Schema

import { SchemaValidator } from '@liqueur/protocol';

const validator = new SchemaValidator();
const result = validator.validate(schema);

if (!result.valid) {
  console.error('Validation errors:', result.errors);
}

Schema Specification

LiquidViewSchema

interface LiquidViewSchema {
  version: '1.0';
  layout: Layout;
  components: Component[];
  data_sources?: Record<string, DataSource>;
}

Components

Chart

interface ChartComponent {
  type: 'chart';
  chart_type: 'bar' | 'line' | 'pie' | 'area';
  title?: string;
  data_source?: string;
  xKey?: string;      // X-axis field
  yKeys?: string[];   // Y-axis fields
  width?: number | string;
  height?: number;
}

Table

interface TableComponent {
  type: 'table';
  columns: string[];
  title?: string;
  data_source?: string;
}

DataSource

interface DataSource {
  resource: string;                    // Table/model name
  filters?: Filter[];                  // WHERE conditions
  aggregation?: Aggregation;           // GROUP BY + aggregate
  sort?: { field: string; direction: 'asc' | 'desc' };
  limit?: number;
}

Filter

interface Filter {
  field: string;
  op: 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'contains';
  value: string | number | boolean | (string | number)[];
}

Aggregation

interface Aggregation {
  type: 'sum' | 'avg' | 'count' | 'min' | 'max';
  field?: string;  // Required for sum, avg, min, max
  by?: string;     // GROUP BY field
}

Layout

// Grid layout
interface GridLayout {
  type: 'grid';
  columns?: number;  // Default: 2
  gap?: number;      // Default: 16
}

// Stack layout
interface StackLayout {
  type: 'stack';
  gap?: number;
}

Validation Error Codes

| Code | Description | |------|-------------| | MISSING_REQUIRED_FIELD | Required field is missing | | INVALID_TYPE | Field type mismatch | | INVALID_ENUM_VALUE | Value not in allowed list | | INVALID_LAYOUT_TYPE | Invalid layout type | | INVALID_COMPONENT_TYPE | Invalid component type | | INVALID_CHART_TYPE | Invalid chart type | | DATA_SOURCE_NOT_FOUND | Referenced data source doesn't exist |

Development

# Build
npm run build

# Test
npm test

# Test with coverage
npm run test:coverage

# Type check
npm run typecheck

License

MIT