
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
sqlkit is a zero-dependency lightweight and expressive SQL query builder and repository layer for TypeScript with PostgreSQL support.
npm install sqlkit
Define Your Domain Model
interface User {
id: string;
name: string;
email: string;
age?: number;
}
import { SelectQueryBuilder } from "sqlkit";
const builder = new SelectQueryBuilder<User>("users");
const { sql, values } = builder
.select(["id", "name"])
.where({ key: "age", operator: ">", value: 18 })
// OR .where(eq("age", 18))
.build();
console.log(sql);
// SELECT "users"."id","users"."name" FROM "users" WHERE "users"."age" > $1
console.log(values); // [18]
import { PostgresAdapter, SelectQueryBuilder } from "sqlkit";
import { Pool } from "pg";
const pool = new Pool({
/* your config */
});
const executor = new PostgresAdapter(pool);
const builder = new SelectQueryBuilder<User>("users", executor);
const users = await builder
.select(["id", "name"])
.where({ key: "age", operator: ">", value: 18 })
// OR .where(eq("age", 18))
.commit();
console.log(users);
// => [{ id: "1", name: "John Doe" }, ...]
import { Repository, gt, like, and } from "sqlkit";
import { PostgresAdapter } from "sqlkit";
import { Pool } from "pg";
const pool = new Pool({
/* your config */
});
const executor = new PostgresAdapter(pool);
const userRepo = new Repository<User>("users", executor);
// Find many
const users = await userRepo.find({
where: and(gt("age", 25), like("name", "%Doe%")),
});
// Paginate
const result = await userRepo.paginate({
page: 1,
limit: 10,
offset: 2,
where: gt("age", 18),
columns: ["age", "email"],
orderBy: [asc("age")],
});
console.log(result.nodes); // array of users
console.log(result.meta);
/*
{
totalCount: 100,
currentPage: 2,
totalPages: 10,
hasNextPage: true
}
*/
// Find one
const user = await userRepo.find(like("email", "%@example.com"));
// Count
const count = await userRepo.count(gt("age", 30));
// Insert
const newUser = await userRepo.insert({
name: "Rayhan",
email: "ray@example.com",
});
// Update
const updated = await userRepo.update(
{ name: "Ray" },
like("email", "%ray%"),
);
// Delete
const deleted = await userRepo.delete(like("name", "Ray%"));
Comparison
Logical
Sorting
FAQs
A lightweight SQL builder for TypeScript
We found that sqlkit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.