nest-knexjs 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.husky/commit-msg +0 -0
- package/.husky/pre-commit +0 -0
- package/README.md +1 -2
- package/package.json +21 -23
- package/tests/app-knex/app/app.module.ts +2 -1
- package/tests/app-multi-database/app/app.module.ts +1 -1
- package/tests/app-multi-database/app/users/users.controller.ts +2 -2
- package/dist/entities-metadata.storage.d.ts +0 -8
- package/dist/entities-metadata.storage.js +0 -31
package/.husky/commit-msg
CHANGED
|
File without changes
|
package/.husky/pre-commit
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ or
|
|
|
51
51
|
- [Usage](#usage)
|
|
52
52
|
- [KnexModule](#knexmodule)
|
|
53
53
|
- [ExampleOfUse](#example-of-use)
|
|
54
|
-
- [
|
|
54
|
+
- [MultiConnectionsDatabase](#multi-connections-database)
|
|
55
55
|
- [CreateMigrations](#create-migrations)
|
|
56
56
|
- [RunMigrations](#run-migrations)
|
|
57
57
|
- [CreateSeeds](#create-seeds)
|
|
@@ -224,7 +224,6 @@ export class PostService {
|
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
async findAll() {
|
|
227
|
-
console.log(this.knexConnection);
|
|
228
227
|
const posts = await this.knexConnection.table('posts');
|
|
229
228
|
return { posts };
|
|
230
229
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nest-knexjs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "Knexjs module for Nest framework (node.js) 😻",
|
|
5
5
|
"author": "Tony133",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,34 +19,34 @@
|
|
|
19
19
|
"prepare": "husky install"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@commitlint/cli": "
|
|
23
|
-
"@commitlint/config-angular": "
|
|
24
|
-
"@nestjs/common": "8.4.
|
|
25
|
-
"@nestjs/core": "8.4.
|
|
26
|
-
"@nestjs/platform-express": "8.4.
|
|
27
|
-
"@nestjs/testing": "8.4.
|
|
22
|
+
"@commitlint/cli": "17.0.3",
|
|
23
|
+
"@commitlint/config-angular": "17.0.3",
|
|
24
|
+
"@nestjs/common": "8.4.7",
|
|
25
|
+
"@nestjs/core": "8.4.7",
|
|
26
|
+
"@nestjs/platform-express": "8.4.7",
|
|
27
|
+
"@nestjs/testing": "8.4.7",
|
|
28
28
|
"@types/express": "4.17.13",
|
|
29
|
-
"@types/node": "16.11.
|
|
30
|
-
"@types/jest": "
|
|
29
|
+
"@types/node": "16.11.43",
|
|
30
|
+
"@types/jest": "28.1.4",
|
|
31
31
|
"@types/supertest": "2.0.12",
|
|
32
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
33
|
-
"@typescript-eslint/parser": "5.
|
|
34
|
-
"eslint": "8.
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "5.30.5",
|
|
33
|
+
"@typescript-eslint/parser": "5.30.5",
|
|
34
|
+
"eslint": "8.19.0",
|
|
35
35
|
"eslint-config-prettier": "8.5.0",
|
|
36
36
|
"eslint-plugin-import": "2.26.0",
|
|
37
|
-
"knex": "2.
|
|
37
|
+
"knex": "2.1.0",
|
|
38
38
|
"mysql": "2.18.1",
|
|
39
39
|
"husky": "8.0.1",
|
|
40
|
-
"prettier": "2.
|
|
41
|
-
"jest": "28.1.
|
|
40
|
+
"prettier": "2.7.1",
|
|
41
|
+
"jest": "28.1.2",
|
|
42
42
|
"reflect-metadata": "0.1.13",
|
|
43
|
-
"release-it": "15.
|
|
44
|
-
"supertest": "6.2.
|
|
45
|
-
"ts-node": "10.
|
|
43
|
+
"release-it": "15.1.1",
|
|
44
|
+
"supertest": "6.2.4",
|
|
45
|
+
"ts-node": "10.8.2",
|
|
46
46
|
"rxjs": "7.5.5",
|
|
47
|
-
"ts-jest": "28.0.
|
|
47
|
+
"ts-jest": "28.0.5",
|
|
48
48
|
"tsconfig-paths": "4.0.0",
|
|
49
|
-
"typescript": "4.
|
|
49
|
+
"typescript": "4.7.4"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@nestjs/common": "^7.0.0 || ^8.0.0",
|
|
@@ -56,9 +56,7 @@
|
|
|
56
56
|
"knex": "^0.21.17 || ^0.95.0 || ^1.0.0 || ^2.0.0"
|
|
57
57
|
},
|
|
58
58
|
"lint-staged": {
|
|
59
|
-
"
|
|
60
|
-
"prettier --write"
|
|
61
|
-
]
|
|
59
|
+
"**/*.{ts,json}": []
|
|
62
60
|
},
|
|
63
61
|
"repository": {
|
|
64
62
|
"type": "git",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Module } from '@nestjs/common';
|
|
2
|
-
import { KnexModule } from '
|
|
2
|
+
import { KnexModule } from '../../../lib';
|
|
3
3
|
import { UsersModule } from './users/users.module';
|
|
4
4
|
|
|
5
5
|
@Module({
|
|
@@ -11,6 +11,7 @@ import { UsersModule } from './users/users.module';
|
|
|
11
11
|
useNullAsDefault: true,
|
|
12
12
|
connection: {
|
|
13
13
|
host: '127.0.0.1',
|
|
14
|
+
port: 3308,
|
|
14
15
|
user: 'root',
|
|
15
16
|
password: 'root',
|
|
16
17
|
database: 'test',
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
Get,
|
|
4
4
|
Post,
|
|
5
5
|
Body,
|
|
6
|
-
Put,
|
|
7
6
|
Param,
|
|
8
7
|
Delete,
|
|
8
|
+
Patch,
|
|
9
9
|
} from '@nestjs/common';
|
|
10
10
|
import { UsersService } from './users.service';
|
|
11
11
|
import { CreateUserDto } from './dto/create-user.dto';
|
|
@@ -30,7 +30,7 @@ export class UsersController {
|
|
|
30
30
|
return this.usersService.findOne(+id);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
@
|
|
33
|
+
@Patch(':id')
|
|
34
34
|
update(@Param('id') id: string, @Body() updateUserDto: UpdateUserDto) {
|
|
35
35
|
return this.usersService.update(+id, updateUserDto);
|
|
36
36
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { KnexModuleOptions } from './interfaces';
|
|
2
|
-
declare type ConnectionToken = KnexModuleOptions | string;
|
|
3
|
-
export declare class EntitiesMetadataStorage {
|
|
4
|
-
private static readonly storage;
|
|
5
|
-
static addEntitiesByConnection(connection: ConnectionToken, entities: Function[]): void;
|
|
6
|
-
static getEntitiesByConnection(connection: ConnectionToken): Function[];
|
|
7
|
-
}
|
|
8
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EntitiesMetadataStorage = void 0;
|
|
4
|
-
class EntitiesMetadataStorage {
|
|
5
|
-
static addEntitiesByConnection(connection, entities) {
|
|
6
|
-
const connectionToken = typeof connection === 'string' ? connection : connection.name;
|
|
7
|
-
if (!connectionToken) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
let collection = this.storage.get(connectionToken);
|
|
11
|
-
if (!collection) {
|
|
12
|
-
collection = [];
|
|
13
|
-
this.storage.set(connectionToken, collection);
|
|
14
|
-
}
|
|
15
|
-
entities.forEach(entity => {
|
|
16
|
-
if (collection.includes(entity)) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
collection.push(entity);
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
static getEntitiesByConnection(connection) {
|
|
23
|
-
const connectionToken = typeof connection === 'string' ? connection : connection.name;
|
|
24
|
-
if (!connectionToken) {
|
|
25
|
-
return [];
|
|
26
|
-
}
|
|
27
|
-
return this.storage.get(connectionToken) || [];
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.EntitiesMetadataStorage = EntitiesMetadataStorage;
|
|
31
|
-
EntitiesMetadataStorage.storage = new Map();
|