@lenne.tech/nest-server 3.4.0 → 8.0.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lenne.tech/nest-server",
3
- "version": "3.4.0",
3
+ "version": "8.0.1",
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,38 +52,38 @@
52
52
  "node": ">= 16.13.0"
53
53
  },
54
54
  "dependencies": {
55
- "@apollo/gateway": "0.48.1",
56
- "@nestjs/apollo": "10.0.2",
57
- "@nestjs/common": "8.2.6",
58
- "@nestjs/core": "8.2.6",
59
- "@nestjs/graphql": "10.0.2",
55
+ "@apollo/gateway": "0.48.3",
56
+ "@nestjs/apollo": "10.0.7",
57
+ "@nestjs/common": "8.4.1",
58
+ "@nestjs/core": "8.4.1",
59
+ "@nestjs/graphql": "10.0.7",
60
60
  "@nestjs/jwt": "8.0.0",
61
- "@nestjs/mongoose": "9.0.2",
62
- "@nestjs/passport": "8.1.0",
63
- "@nestjs/platform-express": "8.2.6",
64
- "@nestjs/testing": "8.2.6",
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.1",
64
+ "@nestjs/testing": "8.4.1",
65
+ "@shelf/jest-mongodb": "2.2.1",
66
66
  "@types/ejs": "3.1.0",
67
- "@types/jest": "27.4.0",
68
- "@types/lodash": "4.14.178",
67
+ "@types/jest": "27.4.1",
68
+ "@types/lodash": "4.14.180",
69
69
  "@types/multer": "1.4.7",
70
- "@types/node": "17.0.17",
70
+ "@types/node": "17.0.21",
71
71
  "@types/node-mailjet": "3.3.8",
72
72
  "@types/nodemailer": "6.4.4",
73
73
  "@types/passport": "1.0.7",
74
74
  "@types/supertest": "2.0.11",
75
- "@typescript-eslint/eslint-plugin": "5.11.0",
76
- "@typescript-eslint/parser": "5.11.0",
77
- "apollo-server-core": "3.6.3",
78
- "apollo-server-express": "3.6.3",
75
+ "@typescript-eslint/eslint-plugin": "5.15.0",
76
+ "@typescript-eslint/parser": "5.15.0",
77
+ "apollo-server-core": "3.6.4",
78
+ "apollo-server-express": "3.6.4",
79
79
  "bcrypt": "5.0.1",
80
80
  "class-transformer": "0.5.1",
81
81
  "class-validator": "0.13.2",
82
82
  "coffeescript": "2.6.1",
83
83
  "ejs": "3.1.6",
84
- "eslint": "8.9.0",
85
- "eslint-config-prettier": "8.3.0",
86
- "fastify": "3.27.1",
84
+ "eslint": "8.11.0",
85
+ "eslint-config-prettier": "8.5.0",
86
+ "fastify": "3.27.4",
87
87
  "graphql": "16.3.0",
88
88
  "graphql-subscriptions": "2.0.0",
89
89
  "grunt": "1.4.1",
@@ -93,13 +93,13 @@
93
93
  "grunt-sync": "0.8.2",
94
94
  "husky": "7.0.4",
95
95
  "jest": "27.5.1",
96
- "json-to-graphql-query": "2.2.2",
97
- "light-my-request": "4.7.1",
96
+ "json-to-graphql-query": "2.2.3",
97
+ "light-my-request": "4.8.0",
98
98
  "lodash": "4.17.21",
99
- "mongodb": "4.3.1",
100
- "mongoose": "6.2.1",
99
+ "mongodb": "4.4.1",
100
+ "mongoose": "6.2.6",
101
101
  "multer": "1.4.4",
102
- "node-mailjet": "3.3.5",
102
+ "node-mailjet": "3.3.7",
103
103
  "nodemailer": "6.7.2",
104
104
  "nodemon": "2.0.15",
105
105
  "passport": "0.5.2",
@@ -108,17 +108,17 @@
108
108
  "pretty-quick": "3.1.3",
109
109
  "reflect-metadata": "0.1.13",
110
110
  "rimraf": "3.0.2",
111
- "rxjs": "7.5.4",
111
+ "rxjs": "7.5.5",
112
112
  "supertest": "6.2.2",
113
113
  "ts-jest": "27.1.3",
114
114
  "ts-morph": "13.0.3",
115
- "ts-node": "10.5.0",
116
- "tsconfig-paths": "3.12.0",
117
- "typescript": "4.5.5"
115
+ "ts-node": "10.7.0",
116
+ "tsconfig-paths": "3.14.0",
117
+ "typescript": "4.6.2"
118
118
  },
119
119
  "devDependencies": {
120
120
  "find-file-up": "2.0.1",
121
- "pm2": "5.1.2"
121
+ "pm2": "5.2.0"
122
122
  },
123
123
  "jest": {
124
124
  "collectCoverage": true,
@@ -21,7 +21,14 @@ export interface IServerOptions {
21
21
  * and https://www.apollographql.com/docs/apollo-server/api/apollo-server/
22
22
  */
23
23
  graphQl?: {
24
+ /**
25
+ * Driver configuration for Apollo
26
+ */
24
27
  driver?: ApolloDriverConfig;
28
+
29
+ /**
30
+ * Subscription authentication
31
+ */
25
32
  enableSubscriptionAuth?: boolean;
26
33
  };
27
34
 
@@ -43,32 +43,36 @@ export class CoreModule {
43
43
  driver: {
44
44
  imports: [AuthModule],
45
45
  inject: [AuthService],
46
- useFactory: async (authService: any) => ({
47
- autoSchemaFile: 'schema.gql',
48
- context: ({ req }) => ({ req }),
49
- installSubscriptionHandlers: true,
50
- subscriptions: {
51
- 'subscriptions-transport-ws': {
52
- onConnect: async (connectionParams) => {
53
- if (config.graphQl.enableSubscriptionAuth) {
54
- // get authToken from authorization header
55
- const authToken: string =
56
- 'Authorization' in connectionParams && connectionParams?.Authorization?.split(' ')[1];
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
- if (authToken) {
59
- // verify authToken/getJwtPayLoad
60
- const payload = authService.decodeJwt(authToken);
61
- const user = await authService.validateUser(payload);
62
- // the user/jwtPayload object found will be available as context.currentUser/jwtPayload in your GraphQL resolvers
63
- return { user: user, headers: connectionParams };
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
- throw new UnauthorizedException();
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
  },