sql-registry is a lightweight TypeScript/JavaScript library (v0.4.1, pre-1.0, active development) for storing SQL in structured Markdown files, binding named parameters safely, and adding controlled dynamic SQL for filters, sorting, and paging. Unlike ORMs or raw query builders, it treats SQL as a reviewable static asset with parameter metadata, dialect variants, and builder logic collocated in Markdown. It enforces named parameter binding via driver values, allowlisted sort keys, validated LIMIT/OFFSET, and static builder fragments. The library handles PostgreSQL-specific syntax and provides an SQL parameter parser. Its release cadence is irregular as it is pre-1.0, with potential breaking changes; users are advised to pin versions.
npm install sql-registryNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows loading a Markdown registry, building a query with named parameters, and obtaining the final SQL string and bound values.
Pin the package version (e.g., "sql-registry": "0.4.1") and review release notes before upgrading.
Always use allowlisted sort keys in the 'orderable' section and validate LIMIT/OFFSET as non-negative integers.
Ensure the file path is correct and the registry is loaded before calling build().
Use the documented builder API as per the Markdown file; expect potential changes in the function signature.
Check type compatibility after upgrades; use explicit type assertions if needed.
Call registry.loadFile('./path/to/file.md') or registry.loadDirectory('./sql/') before registry.build('query.id', params).Verify the SQL ID in the Markdown file (## users.search) and ensure the file is loaded. Use registry.list() to see available IDs.
Ensure all required parameters are provided. Optional parameters can be omitted but may cause builder conditions to skip.
Use: import { SqlRegistry } from 'sql-registry'; const registry = new SqlRegistry({ dialect: 'pg' });No dependency data recorded yet.