@homeofthings/nestjs-sqlite3
Advanced tools
Comparing version 2.0.1 to 2.0.2
# CHANGELOG | ||
| Release | Notes | | ||
|---------|-----------------------| | ||
| 2.0.1 | maintenance release | | ||
| ------- | --------------------- | | ||
| 2.0.1-2 | maintenance release | | ||
| 2.0.0 | nestjs 10x | | ||
@@ -7,0 +7,0 @@ | 1.0.4-4 | maintenance release | |
{ | ||
"name": "@homeofthings/nestjs-sqlite3", | ||
"description": "HomeOfThings - NestJs Sqlite3: Sqlite3 module for NestJs based on 'sqlite3orm'", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"keywords": [ | ||
@@ -31,13 +31,15 @@ "nestjs", | ||
"dependencies": { | ||
"@homeofthings/nestjs-utils": "~2.0.0", | ||
"@nestjs/common": "^10.3.0", | ||
"@nestjs/core": "^10.3.0", | ||
"@homeofthings/nestjs-utils": "~2.0.2", | ||
"reflect-metadata": "^0.2.1", | ||
"sqlite3orm": "~2.7.1", | ||
"sqlite3orm": "~2.7.2", | ||
"tslib": "^2.6.2", | ||
"@homeofthings/node-utils": "~1.0.0", | ||
"rxjs": "^7.4.0" | ||
"@homeofthings/node-utils": "~1.0.1" | ||
}, | ||
"peerDependencies": { | ||
"rxjs": "^7.4.0", | ||
"@nestjs/common": "^10.3.0", | ||
"@nestjs/core": "^10.3.0" | ||
}, | ||
"main": "./src/index.js", | ||
"type": "commonjs" | ||
} |
@@ -34,3 +34,3 @@ [![npm version](https://badge.fury.io/js/%40homeofthings%2Fnestjs-sqlite3.svg)](https://badge.fury.io/js/%40homeofthings%2Fnestjs-sqlite3) | ||
imports: [ | ||
Sqlite3Module.register(Sqlite3Module, {file: SQL_MEMORY_DB_SHARED}), | ||
Sqlite3Module.register(Sqlite3Module, { file: SQL_MEMORY_DB_SHARED }), | ||
], | ||
@@ -48,5 +48,6 @@ }) | ||
imports: [], // optional | ||
useFactory: (): Promise<Sqlite3ConnectionOptions> => Promise.resolve({ | ||
// provide your options | ||
}), | ||
useFactory: (): Promise<Sqlite3ConnectionOptions> => | ||
Promise.resolve({ | ||
// provide your options | ||
}), | ||
inject: [], // optional inject params for useFactory method | ||
@@ -71,3 +72,3 @@ }), | ||
```Typescript | ||
const connection = await this.connectionManager.getConnection(connectionName); | ||
const connection = await this.connectionManager.getConnection(connectionName); | ||
``` | ||
@@ -82,3 +83,3 @@ | ||
```Typescript | ||
const connection = await this.connectionManager.getConnectionPool(connectionName).get(); | ||
const connection = await this.connectionManager.getConnectionPool(connectionName).get(); | ||
``` | ||
@@ -208,10 +209,10 @@ | ||
```Typescript | ||
const connection = await this.connectionManager.getConnection(connectionName); | ||
const autoUpgrader = new AutoUpgrader(connection); | ||
const connection = await this.connectionManager.getConnection(connectionName); | ||
const autoUpgrader = new AutoUpgrader(connection); | ||
// run autoupgrade for all registered tables | ||
autoUpgrader.upgradeAllTables(); | ||
// run autoupgrade for all registered tables | ||
autoUpgrader.upgradeAllTables(); | ||
// run autoupgrade for all tables referenced by a connection: | ||
autoUpgrader.upgradeTables(ConnectionManager.getTables(connectionName)); | ||
// run autoupgrade for all tables referenced by a connection: | ||
autoUpgrader.upgradeTables(ConnectionManager.getTables(connectionName)); | ||
``` | ||
@@ -227,6 +228,6 @@ | ||
```Typescript | ||
const connection = await this.connectionManager.getConnection(connectionName); | ||
const backup = await connection.backup('backup.db'); | ||
await backup.step(-1); | ||
backup.finish(); | ||
const connection = await this.connectionManager.getConnection(connectionName); | ||
const backup = await connection.backup('backup.db'); | ||
await backup.step(-1); | ||
backup.finish(); | ||
``` | ||
@@ -233,0 +234,0 @@ |
@@ -8,4 +8,4 @@ "use strict"; | ||
const sqlite3orm_1 = require("sqlite3orm"); | ||
const model_1 = require("../model"); | ||
const sqlite3_utils_1 = require("./sqlite3.utils"); | ||
const model_1 = require("../model"); | ||
exports.Entity = sqlite3orm_1.table; | ||
@@ -12,0 +12,0 @@ exports.Column = sqlite3orm_1.field; |
import { GenericDictionary } from '@homeofthings/node-utils'; | ||
import { SqlConnectionPool, SqlDatabase } from 'sqlite3orm'; | ||
import { Sqlite3ConnectionOptions } from './sqlite3.options'; | ||
import { ConnectionManager, Repository } from '../..'; | ||
import { EntityManager } from '../service/entity-manager'; | ||
import { Sqlite3ConnectionOptions } from './sqlite3.options'; | ||
export * from './sqlite3.constants'; | ||
@@ -7,0 +7,0 @@ export * from './sqlite3.options'; |
import { SqlConnectionPool, SqlDatabase, Table } from 'sqlite3orm'; | ||
import { Sqlite3ConnectionOptions } from '../model'; | ||
import { EntityManager } from './entity-manager'; | ||
import { Sqlite3ConnectionOptions } from '../model'; | ||
export declare class ConnectionManager { | ||
@@ -5,0 +5,0 @@ private static _instance; |
@@ -9,4 +9,4 @@ "use strict"; | ||
const sqlite3orm_1 = require("sqlite3orm"); | ||
const model_1 = require("../model"); | ||
const entity_manager_1 = require("./entity-manager"); | ||
const model_1 = require("../model"); | ||
let ConnectionManager = class ConnectionManager { | ||
@@ -145,3 +145,2 @@ static { ConnectionManager_1 = this; } | ||
* get the instance of the connection manager singleton | ||
* | ||
*/ | ||
@@ -148,0 +147,0 @@ static getInstance() { |
@@ -26,7 +26,7 @@ "use strict"; | ||
const entityManagerInjectionToken = (0, sqlite3_utils_1.getEntityManagerInjectionToken)(connectionName); | ||
const providers = entitiesOrRepository.map((entityOrReository) => { | ||
if (entityOrReository.prototype instanceof repository_1.Repository) { | ||
const providers = entitiesOrRepository.map((entityOrRepository) => { | ||
if (entityOrRepository.prototype instanceof repository_1.Repository) { | ||
return { | ||
provide: (0, sqlite3_utils_1.getCustomRepositoryInjectionToken)(entityOrReository.name, connectionName), | ||
useFactory: (entityManager) => entityManager.getCustomRepository(entityOrReository), | ||
provide: (0, sqlite3_utils_1.getCustomRepositoryInjectionToken)(entityOrRepository.name, connectionName), | ||
useFactory: (entityManager) => entityManager.getCustomRepository(entityOrRepository), | ||
inject: [entityManagerInjectionToken], | ||
@@ -38,4 +38,4 @@ // TODO: add extra property similar to the `target` property below | ||
return { | ||
provide: (0, sqlite3_utils_1.getRepositoryInjectionToken)(entityOrReository.name, connectionName), | ||
useFactory: (entityManager) => entityManager.getRepository(entityOrReository), | ||
provide: (0, sqlite3_utils_1.getRepositoryInjectionToken)(entityOrRepository.name, connectionName), | ||
useFactory: (entityManager) => entityManager.getRepository(entityOrRepository), | ||
inject: [entityManagerInjectionToken], | ||
@@ -46,3 +46,3 @@ /** | ||
*/ | ||
target: entity_manager_1.EntityManager.getEntityTarget(entityOrReository), | ||
target: entity_manager_1.EntityManager.getEntityTarget(entityOrRepository), | ||
}; | ||
@@ -49,0 +49,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
103058
236
1495
- Removed@nestjs/common@^10.3.0
- Removed@nestjs/core@^10.3.0
- Removedrxjs@^7.4.0
Updatedsqlite3orm@~2.7.2