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

@velarscript-labs/sqlite

v0.3.3

Published

Injection-resistant bounded SQLite capability for VelarScript Node applications.

Readme

@velarscript-labs/sqlite

An injection-resistant, bounded asynchronous SQLite capability for VelarScript Node applications, backed by Node's built-in SQLite driver on one owned Worker.

The API accepts only structured DatabaseStatement values from @velarscript-labs/database. Runtime values remain separate from SQL grammar, then Node's SQLTagStore binds them into cached prepared statements. Every SQL shape is parsed as exactly one SQLite statement before native execution.

import {sqlConcat, sqlParameter, sqlTuple, trustedSql} from "@velarscript-labs/database"
import {SqliteTransaction, openSqlite} from "@velarscript-labs/sqlite"

type User:
    id: number
    name: string

using database = await openSqlite("app.sqlite")
await database.execute(trustedSql(
    "CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT NOT NULL)",
))

async def create(transaction: SqliteTransaction) -> User:
    await transaction.execute(sqlConcat([
        trustedSql("INSERT INTO users (id, name) VALUES "),
        sqlTuple([1, "Ada"]),
    ]))
    return (await transaction.one(sqlConcat([
        trustedSql("SELECT id, name FROM users WHERE id = "),
        sqlParameter(1),
    ]), User))!

const user = await database.transaction(create)

Use sqliteLiteral only where SQLite grammar does not accept a bound value, such as a schema default or PRAGMA assignment. It safely quotes strings and validates finite numbers. Ordinary reads and writes use sqlParameter, sqlTuple, or sqlRows.

Use sqliteIdentifier when a table or column name must be selected at runtime. It quotes the complete value as one SQLite identifier; it never treats the value as SQL grammar.

Security and bounds

  • SQL fragments cannot contain raw ? placeholders. Every runtime value is bound by SQLTagStore; it is never interpolated into SQL text.
  • A SQLite-grammar parser rejects invalid SQL, multiple statements, and trailing statements before native execution.
  • Defensive mode, foreign keys, safe-integer reads, strict named-parameter handling, and disabled extension loading are enforced on every connection.
  • SQLite ATTACH/DETACH and load_extension are denied by the authorizer; the run-time attach limit is also zero.
  • SQL length, value length, columns, expression depth, compound selects, VM operations, function arguments, variables, LIKE patterns, and trigger depth have explicit connection limits.
  • One Worker owns one SQLite connection; all connection operations are queued and serialized.
  • queueCapacity bounds admitted operations. Default 64, maximum 1,024.
  • statementCacheCapacity bounds the prepared-statement LRU. Default 128, maximum 1,024.
  • One statement accepts at most 999 parameters and 1 MiB of SQL text.
  • maxRows defaults to 10,000 and is capped at 1,000,000.
  • maxResultBytes defaults to 64 MiB and is capped at 128 MiB. It also bounds parameter bytes for one operation and SQLite value length.
  • Numbers must be finite; integer parameters and results must fit JavaScript's safe integer range. BLOB values use Bytes.
  • A transaction callback is the exclusive connection owner. Use the supplied SqliteTransaction; calling the connection from that callback fails with SqliteConcurrencyError instead of waiting on itself.
  • The callback commits on success and rolls back on failure. Transactions do not expose manual commit/rollback handles.
  • close is idempotent, joins concurrent callers, drains admitted work, rolls back an active transaction, closes the driver, and waits for the Worker.

This package still does not own models, repositories, schema inference, an ORM, or application migrations. Those remain application data and policy.