@lenne.tech/nest-server 3.4.1 → 8.0.2
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/dist/config.env.js +0 -1
- package/dist/config.env.js.map +1 -1
- package/dist/core/common/helpers/input.helper.js +2 -3
- package/dist/core/common/helpers/input.helper.js.map +1 -1
- package/dist/core/common/helpers/service.helper.js +1 -2
- package/dist/core/common/helpers/service.helper.js.map +1 -1
- package/dist/core/common/interfaces/server-options.interface.d.ts +0 -1
- package/dist/core/common/pipes/map-and-validate.pipe.js +2 -3
- package/dist/core/common/pipes/map-and-validate.pipe.js.map +1 -1
- package/dist/core/common/plugins/mongoose-id.plugin.js +1 -1
- package/dist/core/common/plugins/mongoose-id.plugin.js.map +1 -1
- package/dist/core.module.js +21 -18
- package/dist/core.module.js.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/main.js +0 -5
- package/dist/main.js.map +1 -1
- package/dist/server/modules/user/user.model.d.ts +8 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +33 -35
- package/src/config.env.ts +0 -1
- package/src/core/common/interfaces/server-options.interface.ts +0 -6
- package/src/core/common/plugins/mongoose-id.plugin.js +1 -1
- package/src/core.module.ts +26 -22
- package/src/main.ts +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lenne.tech/nest-server",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.2",
|
|
4
4
|
"description": "Modern, fast, powerful Node.js web framework in TypeScript based on Nest with a GraphQL API and a connection to MongoDB (or other databases).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node",
|
|
@@ -52,41 +52,39 @@
|
|
|
52
52
|
"node": ">= 16.13.0"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@apollo/gateway": "0.48.
|
|
56
|
-
"@nestjs/apollo": "10.0.
|
|
57
|
-
"@nestjs/common": "8.2
|
|
58
|
-
"@nestjs/core": "8.2
|
|
59
|
-
"@nestjs/graphql": "10.0.
|
|
55
|
+
"@apollo/gateway": "0.48.3",
|
|
56
|
+
"@nestjs/apollo": "10.0.8",
|
|
57
|
+
"@nestjs/common": "8.4.2",
|
|
58
|
+
"@nestjs/core": "8.4.2",
|
|
59
|
+
"@nestjs/graphql": "10.0.8",
|
|
60
60
|
"@nestjs/jwt": "8.0.0",
|
|
61
|
-
"@nestjs/mongoose": "9.0.
|
|
62
|
-
"@nestjs/passport": "8.1
|
|
63
|
-
"@nestjs/platform-express": "8.2
|
|
64
|
-
"@nestjs/testing": "8.2
|
|
65
|
-
"@shelf/jest-mongodb": "2.2.0",
|
|
61
|
+
"@nestjs/mongoose": "9.0.3",
|
|
62
|
+
"@nestjs/passport": "8.2.1",
|
|
63
|
+
"@nestjs/platform-express": "8.4.2",
|
|
64
|
+
"@nestjs/testing": "8.4.2",
|
|
66
65
|
"@types/ejs": "3.1.0",
|
|
67
|
-
"@types/jest": "27.4.
|
|
68
|
-
"@types/lodash": "4.14.
|
|
66
|
+
"@types/jest": "27.4.1",
|
|
67
|
+
"@types/lodash": "4.14.180",
|
|
69
68
|
"@types/multer": "1.4.7",
|
|
70
|
-
"@types/node": "17.0.
|
|
69
|
+
"@types/node": "17.0.22",
|
|
71
70
|
"@types/node-mailjet": "3.3.8",
|
|
72
71
|
"@types/nodemailer": "6.4.4",
|
|
73
72
|
"@types/passport": "1.0.7",
|
|
74
|
-
"@types/supertest": "2.0.
|
|
75
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
76
|
-
"@typescript-eslint/parser": "5.
|
|
77
|
-
"apollo-server-core": "3.6.
|
|
78
|
-
"apollo-server-express": "3.6.
|
|
73
|
+
"@types/supertest": "2.0.12",
|
|
74
|
+
"@typescript-eslint/eslint-plugin": "5.16.0",
|
|
75
|
+
"@typescript-eslint/parser": "5.16.0",
|
|
76
|
+
"apollo-server-core": "3.6.5",
|
|
77
|
+
"apollo-server-express": "3.6.5",
|
|
79
78
|
"bcrypt": "5.0.1",
|
|
80
79
|
"class-transformer": "0.5.1",
|
|
81
80
|
"class-validator": "0.13.2",
|
|
82
81
|
"coffeescript": "2.6.1",
|
|
83
82
|
"ejs": "3.1.6",
|
|
84
|
-
"eslint": "8.
|
|
85
|
-
"eslint-config-prettier": "8.
|
|
86
|
-
"fastify": "3.27.
|
|
83
|
+
"eslint": "8.11.0",
|
|
84
|
+
"eslint-config-prettier": "8.5.0",
|
|
85
|
+
"fastify": "3.27.4",
|
|
87
86
|
"graphql": "16.3.0",
|
|
88
87
|
"graphql-subscriptions": "2.0.0",
|
|
89
|
-
"graphql-voyager": "1.0.0-rc.31",
|
|
90
88
|
"grunt": "1.4.1",
|
|
91
89
|
"grunt-bg-shell": "2.3.3",
|
|
92
90
|
"grunt-contrib-clean": "2.0.0",
|
|
@@ -94,32 +92,32 @@
|
|
|
94
92
|
"grunt-sync": "0.8.2",
|
|
95
93
|
"husky": "7.0.4",
|
|
96
94
|
"jest": "27.5.1",
|
|
97
|
-
"json-to-graphql-query": "2.2.
|
|
98
|
-
"light-my-request": "4.
|
|
95
|
+
"json-to-graphql-query": "2.2.3",
|
|
96
|
+
"light-my-request": "4.8.0",
|
|
99
97
|
"lodash": "4.17.21",
|
|
100
|
-
"mongodb": "4.
|
|
101
|
-
"mongoose": "6.2.
|
|
98
|
+
"mongodb": "4.4.1",
|
|
99
|
+
"mongoose": "6.2.8",
|
|
102
100
|
"multer": "1.4.4",
|
|
103
|
-
"node-mailjet": "3.3.
|
|
104
|
-
"nodemailer": "6.7.
|
|
101
|
+
"node-mailjet": "3.3.7",
|
|
102
|
+
"nodemailer": "6.7.3",
|
|
105
103
|
"nodemon": "2.0.15",
|
|
106
104
|
"passport": "0.5.2",
|
|
107
105
|
"passport-jwt": "4.0.0",
|
|
108
|
-
"prettier": "2.
|
|
106
|
+
"prettier": "2.6.0",
|
|
109
107
|
"pretty-quick": "3.1.3",
|
|
110
108
|
"reflect-metadata": "0.1.13",
|
|
111
109
|
"rimraf": "3.0.2",
|
|
112
|
-
"rxjs": "7.5.
|
|
110
|
+
"rxjs": "7.5.5",
|
|
113
111
|
"supertest": "6.2.2",
|
|
114
112
|
"ts-jest": "27.1.3",
|
|
115
113
|
"ts-morph": "13.0.3",
|
|
116
|
-
"ts-node": "10.
|
|
117
|
-
"tsconfig-paths": "3.
|
|
118
|
-
"typescript": "4.
|
|
114
|
+
"ts-node": "10.7.0",
|
|
115
|
+
"tsconfig-paths": "3.14.1",
|
|
116
|
+
"typescript": "4.6.2"
|
|
119
117
|
},
|
|
120
118
|
"devDependencies": {
|
|
121
119
|
"find-file-up": "2.0.1",
|
|
122
|
-
"pm2": "5.
|
|
120
|
+
"pm2": "5.2.0"
|
|
123
121
|
},
|
|
124
122
|
"jest": {
|
|
125
123
|
"collectCoverage": true,
|
package/src/config.env.ts
CHANGED
package/src/core.module.ts
CHANGED
|
@@ -43,32 +43,36 @@ export class CoreModule {
|
|
|
43
43
|
driver: {
|
|
44
44
|
imports: [AuthModule],
|
|
45
45
|
inject: [AuthService],
|
|
46
|
-
useFactory: async (authService: any) =>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
46
|
+
useFactory: async (authService: any) =>
|
|
47
|
+
Object.assign(
|
|
48
|
+
{
|
|
49
|
+
autoSchemaFile: 'schema.gql',
|
|
50
|
+
context: ({ req }) => ({ req }),
|
|
51
|
+
installSubscriptionHandlers: true,
|
|
52
|
+
subscriptions: {
|
|
53
|
+
'subscriptions-transport-ws': {
|
|
54
|
+
onConnect: async (connectionParams) => {
|
|
55
|
+
if (config.graphQl.enableSubscriptionAuth) {
|
|
56
|
+
// get authToken from authorization header
|
|
57
|
+
const authToken: string =
|
|
58
|
+
'Authorization' in connectionParams && connectionParams?.Authorization?.split(' ')[1];
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
if (authToken) {
|
|
61
|
+
// verify authToken/getJwtPayLoad
|
|
62
|
+
const payload = authService.decodeJwt(authToken);
|
|
63
|
+
const user = await authService.validateUser(payload);
|
|
64
|
+
// the user/jwtPayload object found will be available as context.currentUser/jwtPayload in your GraphQL resolvers
|
|
65
|
+
return { user: user, headers: connectionParams };
|
|
66
|
+
}
|
|
65
67
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
throw new UnauthorizedException();
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
},
|
|
68
72
|
},
|
|
69
73
|
},
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
options?.graphQl?.driver
|
|
75
|
+
),
|
|
72
76
|
},
|
|
73
77
|
enableSubscriptionAuth: true,
|
|
74
78
|
},
|
package/src/main.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { NestFactory } from '@nestjs/core';
|
|
|
2
2
|
import { NestExpressApplication } from '@nestjs/platform-express';
|
|
3
3
|
import envConfig from './config.env';
|
|
4
4
|
import { ServerModule } from './server/server.module';
|
|
5
|
-
import { express as voyagerMiddleware } from 'graphql-voyager/middleware';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Preparations for server start
|
|
@@ -24,11 +23,6 @@ async function bootstrap() {
|
|
|
24
23
|
// Enable cors to allow requests from other domains
|
|
25
24
|
server.enableCors();
|
|
26
25
|
|
|
27
|
-
// Activate GraphQL Voyager
|
|
28
|
-
if (envConfig.graphQl?.voyager) {
|
|
29
|
-
server.use('/voyager', voyagerMiddleware({ endpointUrl: '/graphql' }));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
26
|
// Start server on configured port
|
|
33
27
|
await server.listen(envConfig.port);
|
|
34
28
|
}
|