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

@wvlet/wvlet

v2025.1.24

Published

TypeScript SDK for Wvlet - A flow-style query language

Downloads

209

Readme

Wvlet TypeScript SDK

TypeScript/JavaScript SDK for Wvlet - A flow-style query language that compiles to SQL.

Installation

npm install @wvlet/wvlet
# or
yarn add @wvlet/wvlet
# or
pnpm add @wvlet/wvlet

Quick Start

import { WvletCompiler } from '@wvlet/wvlet';

const compiler = new WvletCompiler();

// Compile a Wvlet query to SQL
const sql = compiler.compile('from users select name, email');
console.log(sql);
// Output: SELECT name, email FROM users

Usage

Basic Compilation

import { WvletCompiler } from '@wvlet/wvlet';

const compiler = new WvletCompiler({
  target: 'duckdb' // or 'trino'
});

// Compile a query
const sql = compiler.compile('from users where age > 18 select *');

Error Handling

import { WvletCompiler, CompilationError } from '@wvlet/wvlet';

const compiler = new WvletCompiler();

try {
  const sql = compiler.compile('invalid query syntax');
} catch (error) {
  if (error instanceof CompilationError) {
    console.error(`Error at line ${error.location?.line}, column ${error.location?.column}`);
    console.error(`Message: ${error.message}`);
    console.error(`Status: ${error.statusCode}`);
  }
}

Convenience Function

import { compile } from '@wvlet/wvlet';

// Use the default compiler with a single function call
const sql = compile('from orders select count(*)');

API Reference

WvletCompiler

Constructor

new WvletCompiler(options?: CompileOptions)

Options:

  • target: Target SQL dialect ('duckdb' | 'trino'). Default: 'duckdb'
  • profile: Profile name for configuration

Methods

compile(query: string, options?: CompileOptions): string

Compiles a Wvlet query to SQL.

static getVersion(): string

Returns the version of the Wvlet compiler.

Examples

Query with JOIN

const sql = compiler.compile(`
  from users u
  join orders o on u.id = o.user_id
  select u.name, count(*) as order_count
  group by u.name
`);

Query with CTE

const sql = compiler.compile(`
  with active_users as (
    from users
    where last_login > current_date - interval '30 days'
    select *
  )
  from active_users
  select name, email
`);

Browser Support

This SDK works in both Node.js and modern browsers that support ES modules.

License

Apache License 2.0

Contributing

See the main Wvlet repository for contribution guidelines.