nest-knexjs 0.0.9 → 0.0.12

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.
@@ -20,12 +20,12 @@ jobs:
20
20
  fetch-depth: 0
21
21
 
22
22
  - name: Initialize CodeQL
23
- uses: github/codeql-action/init@v1
23
+ uses: github/codeql-action/init@v2
24
24
  with:
25
25
  languages: javascript
26
26
 
27
27
  - name: Autobuild
28
- uses: github/codeql-action/autobuild@v1
28
+ uses: github/codeql-action/autobuild@v2
29
29
 
30
30
  - name: Perform CodeQL Analysis
31
- uses: github/codeql-action/analyze@v1
31
+ uses: github/codeql-action/analyze@v2
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ npx --no-install commitlint --edit $1
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ npx lint-staged
package/README.md CHANGED
@@ -51,7 +51,7 @@ or
51
51
  - [Usage](#usage)
52
52
  - [KnexModule](#knexmodule)
53
53
  - [ExampleOfUse](#example-of-use)
54
- - [MultiConnectionsDatabae](#multi-connections-database)
54
+ - [MultiConnectionsDatabase](#multi-connections-database)
55
55
  - [CreateMigrations](#create-migrations)
56
56
  - [RunMigrations](#run-migrations)
57
57
  - [CreateSeeds](#create-seeds)
@@ -134,7 +134,7 @@ export class UsersController {
134
134
  constructor(private readonly usersService: UsersService) {}
135
135
 
136
136
  @Get()
137
- async getHello() {
137
+ async getAllUsers() {
138
138
  return await this.usersService.findAll();
139
139
  }
140
140
  }
@@ -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.9",
3
+ "version": "0.0.12",
4
4
  "description": "Knexjs module for Nest framework (node.js) 😻",
5
5
  "author": "Tony133",
6
6
  "license": "MIT",
@@ -15,55 +15,48 @@
15
15
  "test:e2e": "jest --config ./tests/jest-e2e.json --runInBand",
16
16
  "test:e2e:dev": "jest --config ./tests/jest-e2e.json --runInBand --watch",
17
17
  "prerelease": "npm run build",
18
- "release": "release-it"
18
+ "release": "release-it",
19
+ "prepare": "husky install"
19
20
  },
20
21
  "devDependencies": {
21
- "@commitlint/cli": "16.2.3",
22
- "@commitlint/config-angular": "16.2.3",
23
- "@nestjs/common": "8.4.4",
24
- "@nestjs/core": "8.4.4",
25
- "@nestjs/platform-express": "8.4.4",
26
- "@nestjs/testing": "8.4.4",
22
+ "@commitlint/cli": "17.0.3",
23
+ "@commitlint/config-angular": "17.0.3",
24
+ "@nestjs/common": "9.0.1",
25
+ "@nestjs/core": "9.0.1",
26
+ "@nestjs/platform-express": "9.0.1",
27
+ "@nestjs/testing": "9.0.1",
27
28
  "@types/express": "4.17.13",
28
- "@types/node": "16.11.27",
29
- "@types/jest": "27.4.1",
29
+ "@types/node": "16.11.43",
30
+ "@types/jest": "28.1.4",
30
31
  "@types/supertest": "2.0.12",
31
- "@typescript-eslint/eslint-plugin": "5.19.0",
32
- "@typescript-eslint/parser": "5.19.0",
33
- "eslint": "8.13.0",
32
+ "@typescript-eslint/eslint-plugin": "5.30.5",
33
+ "@typescript-eslint/parser": "5.30.5",
34
+ "eslint": "8.19.0",
34
35
  "eslint-config-prettier": "8.5.0",
35
36
  "eslint-plugin-import": "2.26.0",
36
- "knex": "1.0.7",
37
+ "knex": "2.1.0",
37
38
  "mysql": "2.18.1",
38
- "husky": "7.0.4",
39
- "prettier": "2.6.2",
40
- "jest": "27.5.1",
39
+ "husky": "8.0.1",
40
+ "prettier": "2.7.1",
41
+ "jest": "28.1.2",
41
42
  "reflect-metadata": "0.1.13",
42
- "release-it": "14.14.2",
43
- "supertest": "6.2.2",
44
- "ts-node": "10.7.0",
43
+ "release-it": "15.1.1",
44
+ "supertest": "6.2.4",
45
+ "ts-node": "10.8.2",
45
46
  "rxjs": "7.5.5",
46
- "ts-jest": "27.1.4",
47
- "tsconfig-paths": "3.14.1",
48
- "typescript": "4.6.3"
47
+ "ts-jest": "28.0.5",
48
+ "tsconfig-paths": "4.0.0",
49
+ "typescript": "4.7.4"
49
50
  },
50
51
  "peerDependencies": {
51
- "@nestjs/common": "^7.0.0 || ^8.0.0",
52
- "@nestjs/core": "^7.0.0 || ^8.0.0",
52
+ "@nestjs/common": "^7.0.0 || ^8.0.0 || ^9.0.0",
53
+ "@nestjs/core": "^7.0.0 || ^8.0.0 || ^9.0.0",
53
54
  "reflect-metadata": "^0.1.13",
54
55
  "rxjs": "^6.6.3 || ^7.2.0",
55
- "knex": "^0.21.17 || ^0.95.0 || ^1.0.0"
56
+ "knex": "^0.21.17 || ^0.95.0 || ^1.0.0 || ^2.0.0"
56
57
  },
57
58
  "lint-staged": {
58
- "*.ts": [
59
- "prettier --write"
60
- ]
61
- },
62
- "husky": {
63
- "hooks": {
64
- "commit-msg": "commitlint -c .commitlintrc.json -E HUSKY_GIT_PARAMS",
65
- "pre-commit": "lint-staged"
66
- }
59
+ "**/*.{ts,json}": []
67
60
  },
68
61
  "repository": {
69
62
  "type": "git",
@@ -1,5 +1,5 @@
1
1
  import { Module } from '@nestjs/common';
2
- import { KnexModule } from '../../lib';
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',
@@ -1,5 +1,5 @@
1
1
  import { Module } from '@nestjs/common';
2
- import { KnexModule } from '../../lib';
2
+ import { KnexModule } from '../../../lib';
3
3
  import { PostModule } from './post/post.module';
4
4
  import { UsersModule } from './users/users.module';
5
5
 
@@ -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
- @Put(':id')
33
+ @Patch(':id')
34
34
  update(@Param('id') id: string, @Body() updateUserDto: UpdateUserDto) {
35
35
  return this.usersService.update(+id, updateUserDto);
36
36
  }
@@ -1,4 +1,3 @@
1
-
2
1
  {
3
2
  "moduleFileExtensions": ["js", "json", "ts"],
4
3
  "rootDir": "..",
@@ -7,4 +6,4 @@
7
6
  "transform": {
8
7
  "^.+\\.(t|j)s$": "ts-jest"
9
8
  }
10
- }
9
+ }
@@ -1,5 +1,4 @@
1
1
  {
2
2
  "extends": "./tsconfig.json",
3
3
  "exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
4
- }
5
-
4
+ }
@@ -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();