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.
@homeofthings/nestjs-sqlite3
Advanced tools
HomeOfThings - NestJs Sqlite3: Sqlite3 module for NestJs based on 'sqlite3orm'
This module allows you to map your model, written in JavaScript or TypeScript, to a database schema using SQLite Version 3. nestjs-sqlite3 offers connection pool, automatic upgrades and online backups as well as typesafe database queries and refactoring, using a filter syntax designed to serialize safely without any SQL injection possibility
NOTE: Your contribution is highly welcome! Feel free to pick-up a TODO-item or add yours.
This module is based on sqlite3orm supporting SQLCipher
npm install @homeofthings/nestjs-sqlite3
AppModule
by providing connection options synchronously@Module({
imports: [
Sqlite3Module.register(Sqlite3Module, {file: SQL_MEMORY_DB_SHARED}),
],
})
export class AppModule {}
AppModule
by providing connection options asynchronously@Module({
imports: [
Sqlite3Module.registerAsync(Sqlite3Module, {
imports: [], // optional
useFactory: (): Promise<Sqlite3ModuleOptions> => Promise.resolve({
// provide your options
}),
inject: [], // optional inject params for useFactory method
}),
],
})
export class AppModule {}
TODO:
const connection = await this._connectionManager.getConnection(connectionName);
is using asynchronous context tracking to get the same database connection from the pool throughout the lifetime of a web request or any other asynchronous duration
You can create a new context by calling ConnectionManager.createConnectionContext()
and close it by calling ConnectionManager.closeConnectionContext()
.
For web requests this is automatically accomblished by the provided Sqlite3Interceptor
.
If you a need for a connection which works independend from the asynchronous context, you can get it from the pool:
const connection = await this._connectionManager.getConnectionPool(connectionName).get();
TODO: using InjectConnectionPool
decorator
please see (https://github.com/gms1/node-sqlite3-orm#mapping-intruduction)
TODO: using InjectEntityManager
decorator
TODO: calling forFeature
TODO: using InjectRepository
decorator
TODO: define custom repository class
TODO: calling forFeature
TODO: using InjectCustomRepository
decorator
please see (https://github.com/gms1/node-sqlite3-orm#typesafe-query-syntax)
please see (https://github.com/gms1/node-sqlite3-orm#schema-creation)
TODO
const connection = await this._connectionManager.getConnection(connectionName);
const autoUpgrader = new AutoUpgrader(connection);
// run autoupgrade for all registered tables
autoUpgrader.upgradeAllTables();
// run autoupgrade for all tables referenced by a connection:
autoUpgrader.upgradeTables(ConnectionManager.getTables(connectionName));
NOTE: if you are using a single database, you can call
upgradeAllTables
, otherwise you will need to specify the tables for the specific database that you want to upgrade. All tables referenced by aforFeature
call for a specific database can be retrieved by callingConnectionManager.getTables
TODO
const connection = await this._connectionManager.getConnection(connectionName);
const backup = await connection.backup('backup.db');
await backup.step(-1);
backup.finish();
TODO
FAQs
HomeOfThings - NestJs Sqlite3: Sqlite3 module for NestJs based on 'sqlite3orm'
The npm package @homeofthings/nestjs-sqlite3 receives a total of 6 weekly downloads. As such, @homeofthings/nestjs-sqlite3 popularity was classified as not popular.
We found that @homeofthings/nestjs-sqlite3 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.