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

dynamodb-partiql-parser

v0.1.1

Published

PartiQL parser and linter for DynamoDB — lexer, CST parser, and DynamoDB-dialect diagnostics with quick fixes. Pure TypeScript, zero dependencies.

Readme

dynamodb-partiql-parser

A PartiQL parser and linter for DynamoDB, in pure TypeScript with zero dependencies.

DynamoDB accepts a narrow subset of PartiQL. Everything else fails at request time with a ValidationException, after you've already sent the statement. This package parses the full grammar, then tells you before execution which constructs DynamoDB will reject: JOIN, GROUP BY, LIMIT, OFFSET, subqueries, CASE WHEN, CAST, aggregates, SQL-only functions, and a few dozen more. Where a rewrite exists, diagnostics carry a machine-applicable quick fix (IN (...) to [...], LIKE to contains(), IS NULL to attribute_not_exists()).

It was built for the query editor in DynoTable, where it lints on every keystroke. The parser is a hand-written lexer and recursive-descent CST parser: error-tolerant, no stack overflows on adversarial input, no grammar files, no build step surprises. 448 unit tests and a 200+ fixture corpus derived from the AWS PartiQL reference pin its behavior.

As of August 2026, the other PartiQL parsers on npm are WASM builds of AWS's Rust implementation, and nothing on the registry knows what DynamoDB rejects. That gap is why this exists.

Install

npm install dynamodb-partiql-parser

ESM and CJS, browser-safe, no Node-only APIs.

Thirty seconds

import {lint} from 'dynamodb-partiql-parser';

const diagnostics = lint(`SELECT * FROM "Orders" GROUP BY status`);

for (const d of diagnostics) {
  console.log(d.severity, d.message, d.range);
  // error  GROUP BY is not supported by DynamoDB PartiQL.  {start: 23, end: 38}
}

lint() never throws. It returns structural parse errors plus every DynamoDB-unsupported construct, each with a source range and, where possible, quick-fix edits.

API

| Export | What it does | | --- | --- | | lint(text) | Parse + DynamoDB-dialect check in one call. Returns Diagnostic[]. Never throws. | | parse(text) | Full parse. Returns {cst, diagnostics} with the complete CST, error-tolerant. | | findUnsupportedConstructs(cst, text) | The DynamoDB-dialect walker on its own, for use with parse. | | tokenize(text) | The lexer on its own. Returns tokens with ranges. | | isKeyword(word) | PartiQL keyword check. | | DIAGNOSTIC_CODES | The diagnostic code constants (partiql-parse-error, partiql-unsupported, partiql-warning, partiql-quick-fix). |

All CST node types (SelectStatement, InsertStatement, Expression, and the rest) and the Diagnostic / QuickFix shapes are exported as types. The full generated reference lives at dynotable.github.io/dynamodb-partiql-parser.

Diagnostics and quick fixes

interface Diagnostic {
  code: DiagnosticCode;
  message: string;
  range: {start: number; end: number}; // character offsets into the input
  severity?: 'error' | 'warning' | 'info';
  actions?: QuickFix[];
}

interface QuickFix {
  label: string; // e.g. `Replace with contains(name, 'value')`
  edit: {start: number; end: number; text: string};
}

Applying a fix is a string splice:

const fixed = text.slice(0, fix.edit.start) + fix.edit.text + text.slice(fix.edit.end);

Walking the CST

import {parse} from 'dynamodb-partiql-parser';

const {cst} = parse(`UPDATE "Users" SET active = false WHERE id = 'u1'`);
const stmt = cst.statements[0];

if (stmt.kind === 'update_statement') {
  // typed access to assignments, WHERE clause, ranges
  console.log(stmt.assignments.length);
}

The CST keeps source ranges on every node, so it works for editor tooling, codemods, and query analysis, not just validation.

Gating writes

import {parse} from 'dynamodb-partiql-parser';

const {cst} = parse(text);
const kind = cst.statements[0]?.kind;
const isWrite = kind === 'insert_statement' || kind === 'update_statement' || kind === 'delete_statement';

Useful when an editor auto-executes read statements but requires confirmation for writes. If you use CodeMirror, codemirror-lang-partiql packages this pattern as canAutoExecutePartiQL().

What gets flagged

The dialect walker covers the DynamoDB PartiQL restrictions documented in the AWS PartiQL reference: unsupported clauses (JOIN, GROUP BY, HAVING, LIMIT, OFFSET, DISTINCT, TOP, UNION and other set ops, WITH/CTE, OVER), unsupported expressions (CASE WHEN, CAST/CONVERT, subqueries, arithmetic * / % ||, paren-list IN), SQL functions DynamoDB doesn't have (with the DynamoDB replacement suggested where one exists), DDL, multi-statement scripts, aliasing rules, quoting conventions, and full-table-scan warnings for SELECTs whose WHERE can't use a key. Each rule cites the construct in its message.

Relationship to the editor

This is the same parser that runs inside DynoTable's PartiQL editor; the app consumes it with a thin CodeMirror adapter. If you want the editor wiring instead of the raw parser, use codemirror-lang-partiql. For a walkthrough of DynamoDB's PartiQL dialect itself, see the DynamoDB PartiQL guide.

License

MIT © DynoTable