Registry / database / lambdaorm

lambdaorm

JSON →
library2.3.15jsnpmunverified

λORM is a TypeScript ORM for Node.js that enables distributed queries across multiple database engines (MySQL, MariaDB, SQLite, PostgreSQL, Oracle, SQL Server, MongoDB). Version 2.3.15 supports lambda expression-based queries using a domain model, allowing data retrieval and modification from different databases in a single query. Released under MIT license, with active development and semantic versioning. Key differentiators: support for distributed queries, CQRS pattern via configuration, and multiple consumption modes (library, CLI, REST API).

npm install lambdaorm
INSTALL
IMPORT
SIG · LAMBDAORM
L
lambdaorm
databasejavascriptv2.3.15
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default import (orchestrator)
import { createClient } from 'lambdaorm';
const orm = require('lambdaorm');
ESM only; CommonJS require() is not supported.
execute query
const { execute } = await orm.createClient({...});
const execute = require('lambdaorm').execute;
You must call createClient() to get an executable instance; direct import of execute does not exist.
Query definitions
import { Query } from 'lambdaorm';
import { q } from 'lambdaorm';
Named export for query definition classes is 'Query', not 'q'.
Type imports
import type { ClientOptions } from 'lambdaorm';
TypeScript types are exported; use type-only imports for types to avoid bundling runtime code.
CommonJS fallback (if possible)
const orm = await import('lambdaorm');
const orm = require('lambdaorm');
Use dynamic import() for CommonJS projects; require() will fail with ESM-only packages.

Creates a client with an in-memory SQLite database, defines a domain model, and runs a distributed query using lambda expressions.

import { createClient } from 'lambdaorm'; const orm = await createClient({ domain: [{ name: 'Products', fields: { name: 'string', price: 'number', category: { name: 'string' }, supplier: { name: 'string', country: 'string' }, inStock: 'number' } }], connections: [ { name: 'mydb', dialect: 'sqlite', connection: { database: ':memory:' } } ] }); // Run a sample query const query = (country: string) => Products .map(p => ({ category: p.category.name, largestPrice: max(p.price) })) .filter(p => (p.price > 5 && p.supplier.country == country) || (p.inStock < 3)) .having(p => max(p.price) > 50) .sort(p => desc(p.largestPrice)); const result = await orm.execute(query, { country: 'ARG' }); console.log(result); await orm.end();
Debug
Known issues
gotchacreateClient() returns a Promise; you must await it before using orm.execute()
fix
Wrap in async function and use await.
affects: >=1.0.0
breakingIn version 2.x, the query syntax changed from string-based to lambda-expression-based; string queries are no longer supported.
fix
Rewrite queries using lambda expressions (e.g., Products.filter(...).map(...))
affects: >=2.0.0
gotchaThe domain model must be explicitly defined in the client options; automatic schema discovery is not supported.
fix
Define all entities and their fields in the 'domain' array when calling createClient().
affects: >=1.0.0
deprecatedThe 'orm' object from createClient() has a deprecated method 'disconnect()'; use 'end()' instead.
fix
Replace orm.disconnect() with orm.end().
affects: >=2.3.0
Errors
Common errors & fixes
Error: Cannot find module 'lambdaorm'
Package not installed or import path incorrect.
fix
Run 'npm install lambdaorm' and ensure your import uses 'import' syntax (ESM).
TypeError: orm.execute is not a function
createClient() was not awaited; orm is a Promise.
fix
Add 'await' before createClient() call.
Error: dialect 'sqlite' is not supported (not installed)
Missing optional peer dependency for the chosen dialect.
fix
Install the corresponding connector: 'npm install sqlite3' for SQLite.
Error: Invalid query expression: expected lambda function
Passed a string instead of a lambda function for the query.
fix
Use arrow function syntax for queries: (args) => Entity.filter(...)...
Error: Connection 'main' not found
Connection name in query does not match any defined connection.
fix
Ensure the connection name in query source matches the 'name' field in connections array.
Upgrade
Version history
2.3.15latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
lambdaorm — npm install lambdaorm · libregistry