@totto2727/reylo
v0.7.1
Published
Import SQL files as fully typed queries. A TypeScript content mapper plus a runtime loader.
Readme
Reylo: SQLite and HCL
This fork of Reylo imports .sql files as typed TypeScript queries.
It maintains only the runtime @totto2727/reylo and the SQLite/HCL tooling @totto2727/reylo-sqlite.
Analysis reads a local SQLite database or a static Atlas HCL schema.
The application supplies its own SQLite driver for execution.
Setup
Use Node 24 or later and TypeScript 7.1 with content mapper support. Install the two fork packages, runtime and SQLite/HCL tooling, at the same version:
nub add @totto2727/reylo
nub add -D @totto2727/reylo-sqlite [email protected]Configure the content mapper in tsconfig.json:
{
"compilerOptions": {
"target": "esnext",
"module": "nodenext",
"strict": true,
"noEmit": true
},
"contentMappers": [
{
"package": "@totto2727/reylo",
"extensions": [".sql", ".reylo.yaml", ".reylo.yml"]
}
]
}Choose one analysis source in .reylo.yaml:
# A local database that already contains the schema:
direct_url: file:./app.db# Or a local static Atlas SQLite schema:
direct_url: hcl:./schema.hclHCL analysis needs no Atlas executable, database server, or migration execution.
It supports static SQLite main schemas, not arbitrary HCL evaluation.
The schema is an analysis input, not a runtime connection or a migration.
The application must create and maintain its runtime database separately.
Use typed SQL
-- get_user.sql
select id, name from users where id = :idimport { DatabaseSync } from "node:sqlite";
import getUser from "./get_user.sql";
const db = new DatabaseSync("app.db");
const user = getUser.runSync(db, { id: 1 });
console.log(user);
db.close();Enable the loader with node --import @totto2727/reylo/register main.ts, or use the preload configuration in the nub example.
Run the type check with nubx tsc --noEmit --runExternalCode.
See the examples for complete SQLite and HCL projects, and the usage skill for configuration and native-driver guidance.
Effect execution
Use the optional @totto2727/reylo/effect entry point to run a typed query with a Layer-provided QueryExecutor.
The application adapts its existing Effect-native client; Reylo owns parameter encoding, row decoding, and cardinality.
Client-specific transactions and batches remain in the application.
See Effect query execution for the service contract and dependency composition.
Version 0.7 compatibility
Unconstrained JSON values use the exported Json union rather than unknown.
The previous generic Json<T> row-to-JSON utility is now named AsJson<T>.
Date and timestamp values outside years 0000 through 9999 use ISO 8601 extended years.
The fork keeps the two scoped packages above and reuses upstream @reylosql/engine-* native binaries, pinned to 0.7.0.
The fork packages are 0.7.1; this fork-only patch does not change the required native release.
The package manager installs the binary for the host platform through optional dependencies.
Do not omit optional dependencies when installing analysis tooling.
Analysis starts the engine as a child process, including when its schema comes from HCL.
The fork no longer ships a WebAssembly component or needs Rust to build its npm distributions.
Native engine sources, build configuration, and source-level oracle cases are maintained only upstream, not in this fork.
See the tooling package for supported platforms and missing-binary guidance.
Maintenance
Read AGENTS.md before changing this repository. The upstream differences record the exact upstream base and retained shared code. The publishing guide describes the two-package release. Upstream's documentation describes a broader product and is not this fork's support matrix.
Local development with Nix
Enter the default development shell to obtain Nub 0.9.6 from the official Nub flake:
nix develop
nub --versionNub manages the Node runtime required by the project; the shell does not install a separate Node package.
CI uses the empty ci shell and continues to install Nub through its existing setup action.
License
Reylo retains its MIT license. The translated native HCL parser carries MPL-2.0, with additional notices in licenses/. See the upstream source and this fork's source.
