CaQL JS Compiler

raw JSON →
0.5.0 verified Fri May 01 auth: no javascript abandoned

A JavaScript library that compiles CaQL (Calypso Query Language) queries into executable JavaScript functions. Current stable version is 0.5.0, released with no recent updates (likely abandoned). It allows filtering, sorting, and projecting arrays of objects using a SQL-like query syntax. Compared to libraries like Sequelize or Knex, this is a client-side query engine for in-memory data, not a database ORM. It provides a simple compiler and executor pattern, but lacks TypeScript definitions, ESM support, and has seen no maintenance since its release.

error Cannot find module 'caql-js-compiler'
cause Package not installed.
fix
Run npm install caql-js-compiler
error compiler.compile is not a function
cause Incorrect import (maybe used .default).
fix
Use const JSCompiler = require('caql-js-compiler'); and then new JSCompiler().
deprecated Package has not been updated since 2014; may contain unpatched vulnerabilities.
fix Consider using a maintained alternative like 'sift.js' for querying arrays.
gotcha Requires CommonJS (Node.js); no ES module build provided.
fix Use require() or a bundler with CommonJS interop.
gotcha `execute()` returns an array; it does not modify the original data.
fix Assign the result to a new variable.
gotcha Field names from CaQL SELECT are case-sensitive and must match object keys exactly.
fix Ensure field names match object property names.
npm install caql-js-compiler
yarn add caql-js-compiler
pnpm add caql-js-compiler

Basic usage: query an array of objects with select, where, and order by clauses.

const JSCompiler = require('caql-js-compiler');

const data = [
  { name: 'Alice', age: 30 },
  { name: 'Bob', age: 25 },
  { name: 'Charlie', age: 35 }
];

const compiler = new JSCompiler();
const query = 'select name, age where age >= 30 order by age desc';
const results = compiler.compile(query).execute(data);
console.log(results);
// [ { name: 'Charlie', age: 35 }, { name: 'Alice', age: 30 } ]