SQL support for Orbit, a library for managing data synchronization and caching in JavaScript applications. orbit-sql provides SQL query building via Knex for server-side Orbit apps using PostgreSQL, MySQL, or SQLite. Current stable version is 0.4.2. The library integrates with the Orbit ecosystem, enabling SQL-backed records and queries. It is released on an as-needed basis, with a focus on Knex-based SQL support rather than raw queries. Key differentiators: built specifically for Orbit's data model, leverages Knex for cross-dialect compatibility, and provides typed query results in TypeScript.
npm install orbit-sqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up an in-memory SQLite database with Knex and runs a query using orbit-sql.
Always pass a Knex instance and call db.destroy() when the application shuts down.
Enable esModuleInterop in tsconfig.json or use default import.
Use import { SQLRecord } from 'orbit-sql' instead of 'orbit-sql/record'.const sql = orbitSQL({ db: knexInstance });Ensure db is a Knex instance: const db = Knex({ client: 'sqlite3', connection: { ... } });Use arrow function with explicit return: q => q.filter({ ... }); or check parameters.