@lenne.tech/nest-server 10.0.7 → 10.0.9
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 +1 -0
- package/dist/config.env.js.map +1 -1
- package/dist/core/common/args/filter.args.js +2 -1
- package/dist/core/common/args/filter.args.js.map +1 -1
- package/dist/core/common/args/pagination.args.js +2 -1
- package/dist/core/common/args/pagination.args.js.map +1 -1
- package/dist/core/common/filters/http-exception-log.filter.js +2 -1
- package/dist/core/common/filters/http-exception-log.filter.js.map +1 -1
- package/dist/core/common/helpers/db.helper.js +6 -0
- package/dist/core/common/helpers/db.helper.js.map +1 -1
- package/dist/core/common/inputs/combined-filter.input.js +2 -1
- package/dist/core/common/inputs/combined-filter.input.js.map +1 -1
- package/dist/core/common/inputs/filter.input.js +2 -1
- package/dist/core/common/inputs/filter.input.js.map +1 -1
- package/dist/core/common/inputs/single-filter.input.js +2 -1
- package/dist/core/common/inputs/single-filter.input.js.map +1 -1
- package/dist/core/common/inputs/sort.input.js +2 -1
- package/dist/core/common/inputs/sort.input.js.map +1 -1
- package/dist/core/common/interceptors/check-response.interceptor.js +2 -1
- package/dist/core/common/interceptors/check-response.interceptor.js.map +1 -1
- package/dist/core/common/interceptors/check-security.interceptor.js +2 -1
- package/dist/core/common/interceptors/check-security.interceptor.js.map +1 -1
- package/dist/core/common/interfaces/cron-job-config.interface.d.ts +1 -0
- package/dist/core/common/models/core-persistence.model.js +2 -1
- package/dist/core/common/models/core-persistence.model.js.map +1 -1
- package/dist/core/common/pipes/check-input.pipe.js +2 -1
- package/dist/core/common/pipes/check-input.pipe.js.map +1 -1
- package/dist/core/common/pipes/map-and-validate.pipe.js +2 -1
- package/dist/core/common/pipes/map-and-validate.pipe.js.map +1 -1
- package/dist/core/common/plugins/complexity.plugin.js +2 -1
- package/dist/core/common/plugins/complexity.plugin.js.map +1 -1
- package/dist/core/common/scalars/any.scalar.js +4 -4
- package/dist/core/common/scalars/any.scalar.js.map +1 -1
- package/dist/core/common/scalars/date-timestamp.scalar.js +2 -1
- package/dist/core/common/scalars/date-timestamp.scalar.js.map +1 -1
- package/dist/core/common/scalars/date.scalar.js +2 -1
- package/dist/core/common/scalars/date.scalar.js.map +1 -1
- package/dist/core/common/scalars/json.scalar.js +4 -4
- package/dist/core/common/scalars/json.scalar.js.map +1 -1
- package/dist/core/common/services/core-cron-jobs.service.js +4 -3
- package/dist/core/common/services/core-cron-jobs.service.js.map +1 -1
- package/dist/core/common/services/email.service.js +2 -1
- package/dist/core/common/services/email.service.js.map +1 -1
- package/dist/core/common/services/mailjet.service.js +2 -1
- package/dist/core/common/services/mailjet.service.js.map +1 -1
- package/dist/core/common/services/model-doc.service.js +2 -1
- package/dist/core/common/services/model-doc.service.js.map +1 -1
- package/dist/core/common/services/template.service.js +2 -1
- package/dist/core/common/services/template.service.js.map +1 -1
- package/dist/core/common/types/wrapper.type.d.ts +1 -0
- package/dist/core/common/types/wrapper.type.js +3 -0
- package/dist/core/common/types/wrapper.type.js.map +1 -0
- package/dist/core/modules/auth/core-auth.controller.js +2 -1
- package/dist/core/modules/auth/core-auth.controller.js.map +1 -1
- package/dist/core/modules/auth/core-auth.model.js +2 -1
- package/dist/core/modules/auth/core-auth.model.js.map +1 -1
- package/dist/core/modules/auth/core-auth.module.js +2 -1
- package/dist/core/modules/auth/core-auth.module.js.map +1 -1
- package/dist/core/modules/auth/core-auth.resolver.js +2 -1
- package/dist/core/modules/auth/core-auth.resolver.js.map +1 -1
- package/dist/core/modules/auth/guards/refresh-token.guard.js +2 -1
- package/dist/core/modules/auth/guards/refresh-token.guard.js.map +1 -1
- package/dist/core/modules/auth/guards/roles.guard.js +2 -1
- package/dist/core/modules/auth/guards/roles.guard.js.map +1 -1
- package/dist/core/modules/auth/inputs/core-auth-sign-in.input.js +2 -1
- package/dist/core/modules/auth/inputs/core-auth-sign-in.input.js.map +1 -1
- package/dist/core/modules/auth/inputs/core-auth-sign-up.input.js +2 -1
- package/dist/core/modules/auth/inputs/core-auth-sign-up.input.js.map +1 -1
- package/dist/core/modules/auth/services/core-auth.service.js +15 -6
- package/dist/core/modules/auth/services/core-auth.service.js.map +1 -1
- package/dist/core/modules/auth/strategies/jwt-refresh.strategy.js +2 -1
- package/dist/core/modules/auth/strategies/jwt-refresh.strategy.js.map +1 -1
- package/dist/core/modules/auth/strategies/jwt.strategy.js +2 -1
- package/dist/core/modules/auth/strategies/jwt.strategy.js.map +1 -1
- package/dist/core/modules/auth/tokens.decorator.d.ts +1 -1
- package/dist/core/modules/file/core-file-info.model.js +2 -1
- package/dist/core/modules/file/core-file-info.model.js.map +1 -1
- package/dist/core/modules/file/core-file.controller.js +2 -1
- package/dist/core/modules/file/core-file.controller.js.map +1 -1
- package/dist/core/modules/file/core-file.resolver.js +2 -1
- package/dist/core/modules/file/core-file.resolver.js.map +1 -1
- package/dist/core/modules/file/core-file.service.d.ts +1 -1
- package/dist/core/modules/file/core-file.service.js +1 -1
- package/dist/core/modules/file/core-file.service.js.map +1 -1
- package/dist/core/modules/health-check/core-health-check-result.model.js +2 -1
- package/dist/core/modules/health-check/core-health-check-result.model.js.map +1 -1
- package/dist/core/modules/health-check/core-health-check.controller.js +2 -1
- package/dist/core/modules/health-check/core-health-check.controller.js.map +1 -1
- package/dist/core/modules/health-check/core-health-check.module.js +2 -1
- package/dist/core/modules/health-check/core-health-check.module.js.map +1 -1
- package/dist/core/modules/health-check/core-health-check.resolver.js +2 -1
- package/dist/core/modules/health-check/core-health-check.resolver.js.map +1 -1
- package/dist/core/modules/health-check/core-health-check.service.js +2 -1
- package/dist/core/modules/health-check/core-health-check.service.js.map +1 -1
- package/dist/core/modules/user/core-user.model.js +2 -1
- package/dist/core/modules/user/core-user.model.js.map +1 -1
- package/dist/core/modules/user/inputs/core-user-create.input.js +2 -1
- package/dist/core/modules/user/inputs/core-user-create.input.js.map +1 -1
- package/dist/core/modules/user/inputs/core-user.input.js +2 -1
- package/dist/core/modules/user/inputs/core-user.input.js.map +1 -1
- package/dist/core.module.js +6 -1
- package/dist/core.module.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/server/common/models/persistence.model.js +2 -1
- package/dist/server/common/models/persistence.model.js.map +1 -1
- package/dist/server/common/services/cron-jobs.service.js +2 -1
- package/dist/server/common/services/cron-jobs.service.js.map +1 -1
- package/dist/server/modules/auth/auth.controller.js +2 -1
- package/dist/server/modules/auth/auth.controller.js.map +1 -1
- package/dist/server/modules/auth/auth.model.js +2 -1
- package/dist/server/modules/auth/auth.model.js.map +1 -1
- package/dist/server/modules/auth/auth.module.js +2 -1
- package/dist/server/modules/auth/auth.module.js.map +1 -1
- package/dist/server/modules/auth/auth.resolver.js +2 -1
- package/dist/server/modules/auth/auth.resolver.js.map +1 -1
- package/dist/server/modules/auth/auth.service.js +2 -1
- package/dist/server/modules/auth/auth.service.js.map +1 -1
- package/dist/server/modules/auth/inputs/auth-sign-in.input.js +2 -1
- package/dist/server/modules/auth/inputs/auth-sign-in.input.js.map +1 -1
- package/dist/server/modules/auth/inputs/auth-sign-up.input.js +2 -1
- package/dist/server/modules/auth/inputs/auth-sign-up.input.js.map +1 -1
- package/dist/server/modules/file/file-info.model.d.ts +5 -1
- package/dist/server/modules/file/file-info.model.js +2 -1
- package/dist/server/modules/file/file-info.model.js.map +1 -1
- package/dist/server/modules/file/file.controller.js +2 -1
- package/dist/server/modules/file/file.controller.js.map +1 -1
- package/dist/server/modules/file/file.module.js +2 -1
- package/dist/server/modules/file/file.module.js.map +1 -1
- package/dist/server/modules/file/file.resolver.js +2 -1
- package/dist/server/modules/file/file.resolver.js.map +1 -1
- package/dist/server/modules/file/file.service.js +2 -1
- package/dist/server/modules/file/file.service.js.map +1 -1
- package/dist/server/modules/file/multer-config.service.js +3 -2
- package/dist/server/modules/file/multer-config.service.js.map +1 -1
- package/dist/server/modules/user/avatar.controller.js +2 -1
- package/dist/server/modules/user/avatar.controller.js.map +1 -1
- package/dist/server/modules/user/inputs/user-create.input.js +2 -1
- package/dist/server/modules/user/inputs/user-create.input.js.map +1 -1
- package/dist/server/modules/user/inputs/user.input.js +2 -1
- package/dist/server/modules/user/inputs/user.input.js.map +1 -1
- package/dist/server/modules/user/outputs/find-and-count-users-result.output.js +2 -1
- package/dist/server/modules/user/outputs/find-and-count-users-result.output.js.map +1 -1
- package/dist/server/modules/user/user.model.d.ts +5 -1
- package/dist/server/modules/user/user.model.js +2 -1
- package/dist/server/modules/user/user.model.js.map +1 -1
- package/dist/server/modules/user/user.module.js +2 -1
- package/dist/server/modules/user/user.module.js.map +1 -1
- package/dist/server/modules/user/user.resolver.js +2 -1
- package/dist/server/modules/user/user.resolver.js.map +1 -1
- package/dist/server/modules/user/user.service.js +2 -1
- package/dist/server/modules/user/user.service.js.map +1 -1
- package/dist/server/server.controller.js +2 -1
- package/dist/server/server.controller.js.map +1 -1
- package/dist/server/server.module.js +2 -1
- package/dist/server/server.module.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +49 -46
- package/src/config.env.ts +25 -0
- package/src/core/common/helpers/db.helper.ts +9 -0
- package/src/core/common/interfaces/cron-job-config.interface.ts +9 -3
- package/src/core/common/interfaces/server-options.interface.ts +7 -0
- package/src/core/common/services/core-cron-jobs.service.ts +7 -4
- package/src/core/common/types/wrapper.type.ts +10 -0
- package/src/core/modules/auth/services/core-auth.service.ts +15 -8
- package/src/core/modules/file/core-file.service.ts +1 -1
- package/src/core.module.ts +6 -0
- package/src/index.ts +1 -0
- package/src/server/modules/file/multer-config.service.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lenne.tech/nest-server",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.9",
|
|
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",
|
|
@@ -62,75 +62,75 @@
|
|
|
62
62
|
"node": ">= 16.13.0"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@apollo/gateway": "2.5.
|
|
66
|
-
"@
|
|
67
|
-
"@
|
|
68
|
-
"@nestjs/
|
|
69
|
-
"@nestjs/
|
|
70
|
-
"@nestjs/
|
|
65
|
+
"@apollo/gateway": "2.5.6",
|
|
66
|
+
"@lenne.tech/mongoose-gridfs": "1.4.2",
|
|
67
|
+
"@lenne.tech/multer-gridfs-storage": "5.0.6",
|
|
68
|
+
"@nestjs/apollo": "12.0.9",
|
|
69
|
+
"@nestjs/common": "10.2.7",
|
|
70
|
+
"@nestjs/core": "10.2.7",
|
|
71
|
+
"@nestjs/graphql": "12.0.9",
|
|
72
|
+
"@nestjs/jwt": "10.1.1",
|
|
71
73
|
"@nestjs/mongoose": "10.0.1",
|
|
72
|
-
"@nestjs/passport": "10.0.
|
|
73
|
-
"@nestjs/platform-express": "10.
|
|
74
|
-
"@nestjs/schedule": "3.0.
|
|
75
|
-
"@nestjs/terminus": "10.
|
|
76
|
-
"apollo-server-core": "3.
|
|
74
|
+
"@nestjs/passport": "10.0.2",
|
|
75
|
+
"@nestjs/platform-express": "10.2.7",
|
|
76
|
+
"@nestjs/schedule": "3.0.4",
|
|
77
|
+
"@nestjs/terminus": "10.1.1",
|
|
78
|
+
"apollo-server-core": "^3.12.1",
|
|
77
79
|
"apollo-server-express": "3.11.1",
|
|
78
|
-
"bcrypt": "5.1.
|
|
80
|
+
"bcrypt": "5.1.1",
|
|
79
81
|
"class-transformer": "0.5.1",
|
|
80
82
|
"class-validator": "0.14.0",
|
|
81
83
|
"compression": "1.7.4",
|
|
82
84
|
"cookie-parser": "1.4.6",
|
|
83
85
|
"ejs": "3.1.9",
|
|
84
|
-
"graphql": "16.
|
|
86
|
+
"graphql": "16.8.1",
|
|
85
87
|
"graphql-query-complexity": "0.12.0",
|
|
86
88
|
"graphql-subscriptions": "2.0.0",
|
|
87
89
|
"graphql-upload": "15.0.2",
|
|
88
|
-
"js-sha256": "0.
|
|
90
|
+
"js-sha256": "0.10.1",
|
|
89
91
|
"json-to-graphql-query": "2.2.5",
|
|
90
|
-
"light-my-request": "5.
|
|
92
|
+
"light-my-request": "5.11.0",
|
|
91
93
|
"lodash": "4.17.21",
|
|
92
|
-
"mongodb": "
|
|
93
|
-
"mongoose": "6.
|
|
94
|
-
"mongoose-gridfs": "1.3.0",
|
|
94
|
+
"mongodb": "5.9.0",
|
|
95
|
+
"mongoose": "7.6.3",
|
|
95
96
|
"multer": "1.4.5-lts.1",
|
|
96
|
-
"multer-gridfs-storage": "5.0.2",
|
|
97
97
|
"node-mailjet": "6.0.4",
|
|
98
|
-
"nodemailer": "6.9.
|
|
98
|
+
"nodemailer": "6.9.6",
|
|
99
99
|
"nodemon": "3.0.1",
|
|
100
100
|
"passport": "0.6.0",
|
|
101
101
|
"passport-jwt": "4.0.1",
|
|
102
102
|
"reflect-metadata": "0.1.13",
|
|
103
103
|
"rfdc": "1.3.0",
|
|
104
|
-
"rimraf": "5.0.
|
|
104
|
+
"rimraf": "5.0.5",
|
|
105
105
|
"rxjs": "7.8.1",
|
|
106
106
|
"yuml-diagram": "1.2.0"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
109
|
"@babel/plugin-proposal-private-methods": "7.18.6",
|
|
110
|
-
"@compodoc/compodoc": "1.1.
|
|
111
|
-
"@lenne.tech/eslint-config-ts": "0.0.
|
|
112
|
-
"@nestjs/cli": "10.1.
|
|
110
|
+
"@compodoc/compodoc": "1.1.22",
|
|
111
|
+
"@lenne.tech/eslint-config-ts": "0.0.10",
|
|
112
|
+
"@nestjs/cli": "10.1.18",
|
|
113
113
|
"@nestjs/schematics": "10.0.2",
|
|
114
|
-
"@nestjs/testing": "10.
|
|
114
|
+
"@nestjs/testing": "10.2.7",
|
|
115
115
|
"@swc/cli": "0.1.62",
|
|
116
|
-
"@swc/core": "1.3.
|
|
117
|
-
"@swc/jest": "0.2.
|
|
118
|
-
"@types/compression": "1.7.
|
|
119
|
-
"@types/cookie-parser": "1.4.
|
|
116
|
+
"@swc/core": "1.3.93",
|
|
117
|
+
"@swc/jest": "0.2.29",
|
|
118
|
+
"@types/compression": "1.7.4",
|
|
119
|
+
"@types/cookie-parser": "1.4.5",
|
|
120
120
|
"@types/cron": "2.0.1",
|
|
121
|
-
"@types/ejs": "3.1.
|
|
122
|
-
"@types/express": "4.17.
|
|
123
|
-
"@types/jest": "29.5.
|
|
124
|
-
"@types/lodash": "4.14.
|
|
125
|
-
"@types/multer": "1.4.
|
|
126
|
-
"@types/node": "20.
|
|
127
|
-
"@types/nodemailer": "6.4.
|
|
128
|
-
"@types/passport": "1.0.
|
|
129
|
-
"@types/supertest": "2.0.
|
|
130
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
131
|
-
"@typescript-eslint/parser": "6.
|
|
121
|
+
"@types/ejs": "3.1.4",
|
|
122
|
+
"@types/express": "4.17.20",
|
|
123
|
+
"@types/jest": "29.5.6",
|
|
124
|
+
"@types/lodash": "4.14.200",
|
|
125
|
+
"@types/multer": "1.4.9",
|
|
126
|
+
"@types/node": "20.8.7",
|
|
127
|
+
"@types/nodemailer": "6.4.13",
|
|
128
|
+
"@types/passport": "1.0.14",
|
|
129
|
+
"@types/supertest": "2.0.15",
|
|
130
|
+
"@typescript-eslint/eslint-plugin": "6.8.0",
|
|
131
|
+
"@typescript-eslint/parser": "6.8.0",
|
|
132
132
|
"coffeescript": "2.7.0",
|
|
133
|
-
"eslint": "8.
|
|
133
|
+
"eslint": "8.51.0",
|
|
134
134
|
"eslint-config-prettier": "9.0.0",
|
|
135
135
|
"eslint-plugin-unused-imports": "3.0.0",
|
|
136
136
|
"find-file-up": "2.0.1",
|
|
@@ -140,23 +140,26 @@
|
|
|
140
140
|
"grunt-contrib-watch": "1.1.0",
|
|
141
141
|
"grunt-sync": "0.8.2",
|
|
142
142
|
"husky": "8.0.3",
|
|
143
|
-
"jest": "29.
|
|
143
|
+
"jest": "29.7.0",
|
|
144
144
|
"npm-watch": "0.11.0",
|
|
145
145
|
"pm2": "5.3.0",
|
|
146
|
-
"prettier": "3.0.
|
|
146
|
+
"prettier": "3.0.3",
|
|
147
147
|
"pretty-quick": "3.1.3",
|
|
148
148
|
"supertest": "6.3.3",
|
|
149
149
|
"ts-jest": "29.1.1",
|
|
150
|
-
"ts-loader": "9.
|
|
150
|
+
"ts-loader": "9.5.0",
|
|
151
151
|
"ts-morph": "19.0.0",
|
|
152
152
|
"ts-node": "10.9.1",
|
|
153
153
|
"tsconfig-paths": "4.2.0",
|
|
154
|
-
"typescript": "5.
|
|
154
|
+
"typescript": "5.2.2",
|
|
155
155
|
"yalc": "1.0.0-pre.53"
|
|
156
156
|
},
|
|
157
157
|
"overrides": {
|
|
158
158
|
"multer-gridfs-storage": {
|
|
159
159
|
"multer": "$multer"
|
|
160
|
+
},
|
|
161
|
+
"@lykmapipo/common": {
|
|
162
|
+
"flat": "5.0.2"
|
|
160
163
|
}
|
|
161
164
|
},
|
|
162
165
|
"jest": {
|
package/src/config.env.ts
CHANGED
|
@@ -18,6 +18,7 @@ const config: { [env: string]: IServerOptions } = {
|
|
|
18
18
|
sayHello: {
|
|
19
19
|
cronTime: CronExpression.EVERY_10_SECONDS,
|
|
20
20
|
runOnInit: false,
|
|
21
|
+
disabled: false,
|
|
21
22
|
runParallel: 1,
|
|
22
23
|
timeZone: 'Europe/Berlin',
|
|
23
24
|
throwException: false,
|
|
@@ -65,12 +66,20 @@ const config: { [env: string]: IServerOptions } = {
|
|
|
65
66
|
},
|
|
66
67
|
ignoreSelectionsForPopulate: true,
|
|
67
68
|
jwt: {
|
|
69
|
+
// Each secret should be unique and not reused in other environments,
|
|
70
|
+
// also the JWT secret should be different from the Refresh secret!
|
|
71
|
+
// crypto.randomBytes(512).toString('base64') (see https://nodejs.org/api/crypto.html#crypto)
|
|
72
|
+
// tslint:disable-next-line:max-line-length
|
|
68
73
|
secret: 'SECRET_OR_PRIVATE_KEY_LOCAL',
|
|
69
74
|
signInOptions: {
|
|
70
75
|
expiresIn: '15m',
|
|
71
76
|
},
|
|
72
77
|
refresh: {
|
|
73
78
|
renewal: true,
|
|
79
|
+
// Each secret should be unique and not reused in other environments,
|
|
80
|
+
// also the JWT secret should be different from the Refresh secret!
|
|
81
|
+
// crypto.randomBytes(512).toString('base64') (see https://nodejs.org/api/crypto.html#crypto)
|
|
82
|
+
// tslint:disable-next-line:max-line-length
|
|
74
83
|
secret: 'SECRET_OR_PRIVATE_KEY_LOCAL_REFRESH',
|
|
75
84
|
signInOptions: {
|
|
76
85
|
expiresIn: '7d',
|
|
@@ -147,12 +156,20 @@ const config: { [env: string]: IServerOptions } = {
|
|
|
147
156
|
},
|
|
148
157
|
ignoreSelectionsForPopulate: true,
|
|
149
158
|
jwt: {
|
|
159
|
+
// Each secret should be unique and not reused in other environments,
|
|
160
|
+
// also the JWT secret should be different from the Refresh secret!
|
|
161
|
+
// crypto.randomBytes(512).toString('base64') (see https://nodejs.org/api/crypto.html#crypto)
|
|
162
|
+
// tslint:disable-next-line:max-line-length
|
|
150
163
|
secret: 'SECRET_OR_PRIVATE_KEY_DEV',
|
|
151
164
|
signInOptions: {
|
|
152
165
|
expiresIn: '15m',
|
|
153
166
|
},
|
|
154
167
|
refresh: {
|
|
155
168
|
renewal: true,
|
|
169
|
+
// Each secret should be unique and not reused in other environments,
|
|
170
|
+
// also the JWT secret should be different from the Refresh secret!
|
|
171
|
+
// crypto.randomBytes(512).toString('base64') (see https://nodejs.org/api/crypto.html#crypto)
|
|
172
|
+
// tslint:disable-next-line:max-line-length
|
|
156
173
|
secret: 'SECRET_OR_PRIVATE_KEY_DEV_REFRESH',
|
|
157
174
|
signInOptions: {
|
|
158
175
|
expiresIn: '7d',
|
|
@@ -229,12 +246,20 @@ const config: { [env: string]: IServerOptions } = {
|
|
|
229
246
|
},
|
|
230
247
|
ignoreSelectionsForPopulate: true,
|
|
231
248
|
jwt: {
|
|
249
|
+
// Each secret should be unique and not reused in other environments,
|
|
250
|
+
// also the JWT secret should be different from the Refresh secret!
|
|
251
|
+
// crypto.randomBytes(512).toString('base64') (see https://nodejs.org/api/crypto.html#crypto)
|
|
252
|
+
// tslint:disable-next-line:max-line-length
|
|
232
253
|
secret: 'SECRET_OR_PRIVATE_KEY_PROD',
|
|
233
254
|
signInOptions: {
|
|
234
255
|
expiresIn: '15m',
|
|
235
256
|
},
|
|
236
257
|
refresh: {
|
|
237
258
|
renewal: true,
|
|
259
|
+
// Each secret should be unique and not reused in other environments,
|
|
260
|
+
// also the JWT secret should be different from the Refresh secret!
|
|
261
|
+
// crypto.randomBytes(512).toString('base64') (see https://nodejs.org/api/crypto.html#crypto)
|
|
262
|
+
// tslint:disable-next-line:max-line-length
|
|
238
263
|
secret: 'SECRET_OR_PRIVATE_KEY_PROD_REFRESH',
|
|
239
264
|
signInOptions: {
|
|
240
265
|
expiresIn: '7d',
|
|
@@ -623,11 +623,17 @@ export async function setPopulates<T = Query<any, any> | Document>(
|
|
|
623
623
|
* Get ID of element as string
|
|
624
624
|
*/
|
|
625
625
|
function getStringId(element: any): string {
|
|
626
|
+
|
|
626
627
|
// Check element
|
|
627
628
|
if (!element) {
|
|
628
629
|
return element;
|
|
629
630
|
}
|
|
630
631
|
|
|
632
|
+
// Buffer handling
|
|
633
|
+
if (element instanceof Buffer) {
|
|
634
|
+
return element.toString();
|
|
635
|
+
}
|
|
636
|
+
|
|
631
637
|
// String handling
|
|
632
638
|
if (typeof element === 'string') {
|
|
633
639
|
return element;
|
|
@@ -640,6 +646,9 @@ function getStringId(element: any): string {
|
|
|
640
646
|
}
|
|
641
647
|
|
|
642
648
|
if (element.id) {
|
|
649
|
+
if (element.id instanceof Buffer && element.toHexString) {
|
|
650
|
+
return element.toHexString();
|
|
651
|
+
}
|
|
643
652
|
return getStringId(element.id);
|
|
644
653
|
} else if (element._id) {
|
|
645
654
|
return getStringId(element._id);
|
|
@@ -18,13 +18,19 @@ export interface CronJobConfig {
|
|
|
18
18
|
*/
|
|
19
19
|
cronTime: CronExpression | string | Date | Falsy;
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Whether the cron job is disabled or not.
|
|
23
|
+
* This option is set to `false` by default
|
|
24
|
+
*/
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
|
|
21
27
|
/**
|
|
22
28
|
* A function that will fire when the job is complete, when it is stopped.
|
|
23
29
|
*/
|
|
24
30
|
onComplete?: CronCommand | null;
|
|
25
31
|
|
|
26
32
|
/**
|
|
27
|
-
* This will immediately fire
|
|
33
|
+
* This will immediately fire the `onTick` function as soon as the requisite initialization has happened.
|
|
28
34
|
* This option is set to `true` by default.
|
|
29
35
|
*/
|
|
30
36
|
runOnInit?: boolean;
|
|
@@ -58,8 +64,8 @@ export interface CronJobConfig {
|
|
|
58
64
|
unrefTimeout?: boolean;
|
|
59
65
|
|
|
60
66
|
/**
|
|
61
|
-
* This allows you to specify the offset of
|
|
62
|
-
* Probably don't use both
|
|
67
|
+
* This allows you to specify the offset of the timezone rather than using the `timeZone` parameter.
|
|
68
|
+
* Probably don't use both `timeZone` and `utcOffset` together or weird things may happen.
|
|
63
69
|
*/
|
|
64
70
|
utcOffset?: string | number;
|
|
65
71
|
}
|
|
@@ -30,6 +30,8 @@ export interface IJwt {
|
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* Secret to encrypt the JWT
|
|
33
|
+
* Each secret should be unique and not reused in other environments,
|
|
34
|
+
* also the JWT secret should be different from the Refresh secret!
|
|
33
35
|
*/
|
|
34
36
|
secret?: string;
|
|
35
37
|
|
|
@@ -288,10 +290,15 @@ export interface IServerOptions {
|
|
|
288
290
|
|
|
289
291
|
/**
|
|
290
292
|
* Configuration of JavaScript Web Token (JWT) module
|
|
293
|
+
*
|
|
294
|
+
* Hint: The secrets of the different environments should be different, otherwise a JWT can be used in different
|
|
295
|
+
* environments, which can lead to security vulnerabilities.
|
|
291
296
|
*/
|
|
292
297
|
jwt?: {
|
|
293
298
|
/**
|
|
294
299
|
* Configuration for refresh Token (JWT)
|
|
300
|
+
* Hint: The secret of the JWT and the Refresh Token should be different, otherwise a new RefreshToken can also be
|
|
301
|
+
* requested with the JWT, which can lead to a security vulnerability.
|
|
295
302
|
*/
|
|
296
303
|
refresh?: {
|
|
297
304
|
/**
|
|
@@ -62,15 +62,18 @@ export abstract class CoreCronJobs implements OnApplicationBootstrap {
|
|
|
62
62
|
// Init cron jobs
|
|
63
63
|
for (const [name, CronExpressionOrConfig] of Object.entries(this.cronJobs)) {
|
|
64
64
|
// Check config
|
|
65
|
-
if (
|
|
65
|
+
if (
|
|
66
|
+
!CronExpressionOrConfig
|
|
67
|
+
|| (typeof CronExpressionOrConfig === 'object' && (CronExpressionOrConfig as CronJobConfig).disabled)
|
|
68
|
+
) {
|
|
66
69
|
continue;
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
// Prepare config
|
|
70
|
-
let conf:
|
|
71
|
-
if (typeof
|
|
73
|
+
let conf: CronJobConfig = (CronExpressionOrConfig as CronJobConfig);
|
|
74
|
+
if (typeof CronExpressionOrConfig === 'string' || CronExpressionOrConfig instanceof Date) {
|
|
72
75
|
conf = {
|
|
73
|
-
cronTime:
|
|
76
|
+
cronTime: CronExpressionOrConfig as string | Date,
|
|
74
77
|
};
|
|
75
78
|
}
|
|
76
79
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrapper type used to circumvent ESM modules circular dependency issue
|
|
3
|
+
* caused by reflection metadata saving the type of the property.
|
|
4
|
+
*
|
|
5
|
+
* It is needed if swc is used and ReferenceError occurs:
|
|
6
|
+
* @Inject(forwardRef(() => CustomService)) private readonly customService: WrapperType<CustomService>,
|
|
7
|
+
*
|
|
8
|
+
* See https://docs.nestjs.com/recipes/swc#common-pitfalls
|
|
9
|
+
*/
|
|
10
|
+
export type WrapperType<T> = T; // WrapperType === Relation
|
|
@@ -123,16 +123,23 @@ export class CoreAuthService {
|
|
|
123
123
|
});
|
|
124
124
|
|
|
125
125
|
// Get and check user
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
try {
|
|
127
|
+
const user = await this.userService.create(input, serviceOptionsForUserService);
|
|
128
|
+
if (!user) {
|
|
129
|
+
throw new BadRequestException('Email address already in use');
|
|
130
|
+
}
|
|
130
131
|
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
// Set device ID
|
|
133
|
+
const { deviceId, deviceDescription } = input;
|
|
133
134
|
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
// Return tokens and user
|
|
136
|
+
return this.getResult(user, { deviceId, deviceDescription });
|
|
137
|
+
} catch (err) {
|
|
138
|
+
if (err?.message === 'Unprocessable Entity') {
|
|
139
|
+
throw new BadRequestException('Email address already in use');
|
|
140
|
+
}
|
|
141
|
+
throw err;
|
|
142
|
+
}
|
|
136
143
|
}
|
|
137
144
|
|
|
138
145
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NotFoundException } from '@nestjs/common';
|
|
2
2
|
import { GridFSBucket, GridFSBucketReadStream, GridFSBucketReadStreamOptions } from 'mongodb';
|
|
3
3
|
import { Connection, Types } from 'mongoose';
|
|
4
|
-
import { MongoGridFSOptions, MongooseGridFS, createBucket } from 'mongoose-gridfs';
|
|
4
|
+
import { MongoGridFSOptions, MongooseGridFS, createBucket } from '@lenne.tech/mongoose-gridfs';
|
|
5
5
|
import { FilterArgs } from '../../common/args/filter.args';
|
|
6
6
|
import { getObjectIds, getStringIds } from '../../common/helpers/db.helper';
|
|
7
7
|
import { convertFilterArgsToQuery } from '../../common/helpers/filter.helper';
|
package/src/core.module.ts
CHANGED
|
@@ -128,6 +128,12 @@ export class CoreModule implements NestModule {
|
|
|
128
128
|
options,
|
|
129
129
|
);
|
|
130
130
|
|
|
131
|
+
// Check secrets
|
|
132
|
+
const jwtConfig = config.jwt;
|
|
133
|
+
if (jwtConfig?.secret && jwtConfig.secret && jwtConfig.refresh && jwtConfig.refresh.secret === jwtConfig.secret) {
|
|
134
|
+
console.warn('JWT secret and refresh secret are equal, this can lead to security vulnerabilities!');
|
|
135
|
+
}
|
|
136
|
+
|
|
131
137
|
// Set providers
|
|
132
138
|
const providers: any[] = [
|
|
133
139
|
// The ConfigService provides access to the current configuration of the module
|
package/src/index.ts
CHANGED
|
@@ -80,6 +80,7 @@ export * from './core/common/types/remove-methods.type';
|
|
|
80
80
|
export * from './core/common/types/require-only-one.type';
|
|
81
81
|
export * from './core/common/types/required-at-least-one.type';
|
|
82
82
|
export * from './core/common/types/string-or-object-id.type';
|
|
83
|
+
export * from './core/common/types/wrapper.type';
|
|
83
84
|
|
|
84
85
|
// =====================================================================================================================
|
|
85
86
|
// Core - Modules - Auth
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Injectable } from '@nestjs/common';
|
|
2
2
|
import { MulterModuleOptions, MulterOptionsFactory } from '@nestjs/platform-express';
|
|
3
|
-
import { GridFsStorage } from 'multer-gridfs-storage';
|
|
3
|
+
import { GridFsStorage } from '@lenne.tech/multer-gridfs-storage';
|
|
4
4
|
import envConfig from '../../../config.env';
|
|
5
5
|
|
|
6
6
|
@Injectable()
|