Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Lil ORM is a super lightweight SQLite ORM for Node.js. With its clear API, you can easily interact with SQLite databases.
Lil ORM is a super lightweight SQLite ORM for Node.js. With its clear API, you can easily interact with SQLite databases
npm i lil-orm
@Entity('user')
class UserEntity {
@PrimaryKey({
autoIncrement: true,
})
@Column({
type: 'INTEGER',
name: 'id',
})
id: number;
@Column({
type: 'TEXT',
name: 'name',
})
name: string;
@Column({
type: 'TEXT',
name: 'email',
})
email: string;
@Column({
type: 'JSON',
name: 'config',
})
config: any;
@Column({
type: 'BOOLEAN',
name: 'is_active',
})
isActive: boolean;
@Column({
type: 'DATE',
name: 'created_at',
})
createdAt: Date;
}
supported types:
TEXT
INTEGER
REAL
BOOLEAN
DATE (ISO Format)
JSON
⚠️ Warning: Important Configuration Required
To ensure proper functioning of the library, please make sure to configure your TypeScript project correctly.
Option 1: Enable useDefineForClassFields
In your project's tsconfig.json
, add or modify the compilerOptions
section to include the following:
{
"compilerOptions": {
"useDefineForClassFields": true
}
}
Option 2: Initialize Every Property with Default Values
If you cannot enable useDefineForClassFields
or prefer not to modify your TypeScript configuration, make sure to explicitly initialize every property in your entity class with a default value.
For example:
@Entity('tableName')
class MyEntity {
@PrimaryKey({
autoIncrement: true,
})
@Column({
type: 'INTEGER'
})
id: number = 0;
@Column({
type: 'TEXT'
})
name: string = '';
// ...other properties
}
import { LilORM } from 'lil-orm';
const databaseConnectionString = ':memory:';
const module = new LilORM(databaseConnectionString);
(experimental API name)
module.createTable(UserEntity) //to create a table from an entity
//get repository for DAO
const repository = module.getRepository<UserEntity>(UserEntity);
//Create
await repository.create({
id: 1,
email: 'test@gmail.com',
name: 'test',
config: {
test: true,
},
isActive: true,
createdAt: new Date(),
});
//Find one
await repository.findOne({ id: 1 });
//Find all
await repository.findAll();
//Update
const updatedUser = {
id: 1,
email: 'updated@gmail.com',
name: 'updated',
};
await repository.update(updatedUser);
//Delete
await repository.delete({ id: 69 });
import { Transaction } from 'lil-orm';
const repository = module.getRepository<UserEntity>(UserEntity);
const transaction = new Transaction(repository.dbInstance);
transaction.transaction(async (transaction) => {
repository.create(
{
id: 1,
email: 'test@gmail.com',
name: 'test',
config: {
test: true,
},
isActive: true,
createdAt: new Date(),
},
transaction,
);
});
FAQs
Lil ORM is a lightweight and flexible ORM for Node.js, designed with a clear and intuitive API to simplify database operations. Engineered for adaptability, it enables efficient interaction with databases.
The npm package lil-orm receives a total of 3 weekly downloads. As such, lil-orm popularity was classified as not popular.
We found that lil-orm 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.