@lenne.tech/nest-server 9.0.22 → 9.0.24
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/core/common/decorators/restricted.decorator.d.ts +1 -1
- package/dist/core/common/helpers/graphql.helper.d.ts +1 -1
- package/dist/core/common/helpers/input.helper.js +7 -3
- package/dist/core/common/helpers/input.helper.js.map +1 -1
- package/dist/core/common/helpers/model.helper.js +10 -2
- package/dist/core/common/helpers/model.helper.js.map +1 -1
- package/dist/core/common/pipes/map-and-validate.pipe.js +1 -1
- package/dist/core/common/pipes/map-and-validate.pipe.js.map +1 -1
- package/dist/core/common/services/mailjet.service.js +11 -1
- package/dist/core/common/services/mailjet.service.js.map +1 -1
- package/dist/core/common/types/core-model-constructor.type.d.ts +1 -1
- package/dist/core/common/types/falsy.type.d.ts +1 -1
- package/dist/core/common/types/field-selection.type.d.ts +1 -1
- package/dist/core/common/types/ids.type.d.ts +1 -1
- package/dist/core/common/types/maybe-promise.type.d.ts +1 -1
- package/dist/core/common/types/plain-input.type.d.ts +1 -1
- package/dist/core/common/types/plain-object.type.d.ts +1 -1
- package/dist/core/common/types/remove-methods.type.d.ts +1 -1
- package/dist/core/common/types/require-only-one.type.d.ts +1 -1
- package/dist/core/common/types/required-at-least-one.type.d.ts +1 -1
- package/dist/core/common/types/string-or-object-id.type.d.ts +1 -1
- package/dist/core/modules/auth/guards/auth.guard.d.ts +1 -1
- package/dist/core/modules/file/core-file.service.d.ts +1 -1
- package/dist/core/modules/user/core-user.model.d.ts +1 -1
- package/dist/server/modules/file/file-info.model.d.ts +1 -1
- package/dist/server/modules/user/user.model.d.ts +2 -2
- package/dist/test/test.helper.d.ts +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +34 -34
- package/src/core/common/helpers/input.helper.ts +9 -3
- package/src/core/common/helpers/model.helper.ts +16 -2
- package/src/core/common/pipes/map-and-validate.pipe.ts +1 -1
- package/src/core/common/services/mailjet.service.ts +22 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lenne.tech/nest-server",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.24",
|
|
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",
|
|
@@ -60,78 +60,78 @@
|
|
|
60
60
|
"node": ">= 16.13.0"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@apollo/gateway": "2.
|
|
64
|
-
"@nestjs/apollo": "10.1.
|
|
65
|
-
"@nestjs/common": "9.1
|
|
66
|
-
"@nestjs/core": "9.1
|
|
67
|
-
"@nestjs/graphql": "10.1.
|
|
68
|
-
"@nestjs/jwt": "
|
|
63
|
+
"@apollo/gateway": "2.2.3",
|
|
64
|
+
"@nestjs/apollo": "10.1.7",
|
|
65
|
+
"@nestjs/common": "9.2.1",
|
|
66
|
+
"@nestjs/core": "9.2.1",
|
|
67
|
+
"@nestjs/graphql": "10.1.7",
|
|
68
|
+
"@nestjs/jwt": "10.0.1",
|
|
69
69
|
"@nestjs/mongoose": "9.2.1",
|
|
70
70
|
"@nestjs/passport": "9.0.0",
|
|
71
|
-
"@nestjs/platform-express": "9.1
|
|
71
|
+
"@nestjs/platform-express": "9.2.1",
|
|
72
72
|
"@nestjs/schedule": "2.1.0",
|
|
73
73
|
"apollo-server-core": "3.11.1",
|
|
74
74
|
"apollo-server-express": "3.11.1",
|
|
75
75
|
"bcrypt": "5.1.0",
|
|
76
76
|
"class-transformer": "0.5.1",
|
|
77
|
-
"class-validator": "0.
|
|
77
|
+
"class-validator": "0.14.0",
|
|
78
78
|
"ejs": "3.1.8",
|
|
79
79
|
"graphql": "16.6.0",
|
|
80
80
|
"graphql-subscriptions": "2.0.0",
|
|
81
81
|
"graphql-upload": "15.0.2",
|
|
82
82
|
"js-sha256": "0.9.0",
|
|
83
83
|
"json-to-graphql-query": "2.2.4",
|
|
84
|
-
"light-my-request": "5.
|
|
84
|
+
"light-my-request": "5.8.0",
|
|
85
85
|
"lodash": "4.17.21",
|
|
86
|
-
"mongodb": "4.
|
|
87
|
-
"mongoose": "6.
|
|
86
|
+
"mongodb": "4.13.0",
|
|
87
|
+
"mongoose": "6.8.4",
|
|
88
88
|
"mongoose-gridfs": "1.3.0",
|
|
89
89
|
"multer-gridfs-storage": "5.0.2",
|
|
90
90
|
"multer": "1.4.5-lts.1",
|
|
91
|
-
"node-mailjet": "
|
|
92
|
-
"nodemailer": "6.
|
|
91
|
+
"node-mailjet": "6.0.1",
|
|
92
|
+
"nodemailer": "6.9.0",
|
|
93
93
|
"nodemon": "2.0.20",
|
|
94
94
|
"passport": "0.6.0",
|
|
95
|
-
"passport-jwt": "4.0.
|
|
95
|
+
"passport-jwt": "4.0.1",
|
|
96
96
|
"reflect-metadata": "0.1.13",
|
|
97
97
|
"rfdc": "1.3.0",
|
|
98
|
-
"rimraf": "
|
|
99
|
-
"rxjs": "7.
|
|
98
|
+
"rimraf": "4.1.1",
|
|
99
|
+
"rxjs": "7.8.0"
|
|
100
100
|
},
|
|
101
101
|
"devDependencies": {
|
|
102
|
-
"@nestjs/testing": "9.1
|
|
102
|
+
"@nestjs/testing": "9.2.1",
|
|
103
103
|
"@types/cron": "2.0.0",
|
|
104
104
|
"@types/ejs": "3.1.1",
|
|
105
|
-
"@types/jest": "29.2.
|
|
106
|
-
"@types/lodash": "4.14.
|
|
105
|
+
"@types/jest": "29.2.6",
|
|
106
|
+
"@types/lodash": "4.14.191",
|
|
107
107
|
"@types/multer": "1.4.7",
|
|
108
|
-
"@types/node": "18.11.
|
|
109
|
-
"@types/nodemailer": "6.4.
|
|
108
|
+
"@types/node": "18.11.18",
|
|
109
|
+
"@types/nodemailer": "6.4.7",
|
|
110
110
|
"@types/passport": "1.0.11",
|
|
111
111
|
"@types/supertest": "2.0.12",
|
|
112
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
113
|
-
"@typescript-eslint/parser": "5.
|
|
112
|
+
"@typescript-eslint/eslint-plugin": "5.48.2",
|
|
113
|
+
"@typescript-eslint/parser": "5.48.2",
|
|
114
114
|
"coffeescript": "2.7.0",
|
|
115
|
-
"eslint": "8.
|
|
116
|
-
"eslint-config-prettier": "8.
|
|
115
|
+
"eslint": "8.32.0",
|
|
116
|
+
"eslint-config-prettier": "8.6.0",
|
|
117
117
|
"find-file-up": "2.0.1",
|
|
118
118
|
"grunt": "1.5.3",
|
|
119
119
|
"grunt-bg-shell": "2.3.3",
|
|
120
120
|
"grunt-contrib-clean": "2.0.1",
|
|
121
121
|
"grunt-contrib-watch": "1.1.0",
|
|
122
122
|
"grunt-sync": "0.8.2",
|
|
123
|
-
"husky": "8.0.
|
|
124
|
-
"jest": "29.
|
|
123
|
+
"husky": "8.0.3",
|
|
124
|
+
"jest": "29.3.1",
|
|
125
125
|
"npm-watch": "0.11.0",
|
|
126
126
|
"pm2": "5.2.2",
|
|
127
|
-
"prettier": "2.
|
|
127
|
+
"prettier": "2.8.3",
|
|
128
128
|
"pretty-quick": "3.1.3",
|
|
129
|
-
"supertest": "6.3.
|
|
130
|
-
"ts-jest": "29.0.
|
|
131
|
-
"ts-morph": "
|
|
129
|
+
"supertest": "6.3.3",
|
|
130
|
+
"ts-jest": "29.0.5",
|
|
131
|
+
"ts-morph": "17.0.1",
|
|
132
132
|
"ts-node": "10.9.1",
|
|
133
|
-
"tsconfig-paths": "4.1.
|
|
134
|
-
"typescript": "4.
|
|
133
|
+
"tsconfig-paths": "4.1.2",
|
|
134
|
+
"typescript": "4.9.4",
|
|
135
135
|
"yalc": "1.0.0-pre.53"
|
|
136
136
|
},
|
|
137
137
|
"overrides": {
|
|
@@ -222,6 +222,7 @@ export async function check(
|
|
|
222
222
|
throwError: true,
|
|
223
223
|
...options,
|
|
224
224
|
validatorOptions: {
|
|
225
|
+
forbidUnknownValues: false,
|
|
225
226
|
skipUndefinedProperties: true,
|
|
226
227
|
...options?.validatorOptions,
|
|
227
228
|
},
|
|
@@ -323,12 +324,12 @@ export function clone(object: any, options?: { proto?: boolean; circles?: boolea
|
|
|
323
324
|
try {
|
|
324
325
|
return rfdc(config)(object);
|
|
325
326
|
} catch (e) {
|
|
326
|
-
console.debug(e);
|
|
327
|
+
console.debug(e, config, object, 'automatic try to use rfdc with circles');
|
|
327
328
|
if (!config.circles) {
|
|
328
329
|
try {
|
|
329
330
|
return rfdc({ ...config, ...{ circles: true } })(object);
|
|
330
331
|
} catch (e) {
|
|
331
|
-
console.debug(e);
|
|
332
|
+
console.debug(e, 'rfcd with circles did not work automatic use of _.clone!');
|
|
332
333
|
return _.clone(object);
|
|
333
334
|
}
|
|
334
335
|
} else {
|
|
@@ -664,8 +665,13 @@ export function processDeep(
|
|
|
664
665
|
...options,
|
|
665
666
|
};
|
|
666
667
|
|
|
668
|
+
// Check for falsifiable values
|
|
669
|
+
if (!data) {
|
|
670
|
+
return func(data);
|
|
671
|
+
}
|
|
672
|
+
|
|
667
673
|
// Prevent circular processing
|
|
668
|
-
if (typeof data === 'object') {
|
|
674
|
+
else if (typeof data === 'object') {
|
|
669
675
|
if (processedObjects.get(data)) {
|
|
670
676
|
return data;
|
|
671
677
|
}
|
|
@@ -164,6 +164,7 @@ export function maps<T = Record<string, any>>(
|
|
|
164
164
|
* @param input - The input object to map
|
|
165
165
|
* @param mapping - A mapping of property names to classes
|
|
166
166
|
* @param [target] - The object to map the input to. If not provided, a new object will be created
|
|
167
|
+
* @param [options] - Additional settings for processing
|
|
167
168
|
* @returns Record with mapped objects
|
|
168
169
|
*/
|
|
169
170
|
export function mapClasses<T = Record<string, any>>(
|
|
@@ -193,8 +194,14 @@ export function mapClasses<T = Record<string, any>>(
|
|
|
193
194
|
const targetClass = mapTarget as any;
|
|
194
195
|
const value = input[prop];
|
|
195
196
|
|
|
197
|
+
// Do not process null (undefined is removed at the end)
|
|
198
|
+
if (value === null) {
|
|
199
|
+
target[prop] = null;
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
|
|
196
203
|
// Process array
|
|
197
|
-
if (Array.isArray(value)) {
|
|
204
|
+
else if (Array.isArray(value)) {
|
|
198
205
|
const arr = [];
|
|
199
206
|
for (const item of value) {
|
|
200
207
|
if (item instanceof targetClass) {
|
|
@@ -248,6 +255,7 @@ export function mapClasses<T = Record<string, any>>(
|
|
|
248
255
|
* @param input - The input object to map
|
|
249
256
|
* @param mapping - A mapping of property names to classes
|
|
250
257
|
* @param [target] - The object to map the input to. If not provided, a new object will be created
|
|
258
|
+
* @param [options] - Additional settings for processing
|
|
251
259
|
* @returns Record with mapped objects
|
|
252
260
|
*/
|
|
253
261
|
export async function mapClassesAsync<T = Record<string, any>>(
|
|
@@ -277,8 +285,14 @@ export async function mapClassesAsync<T = Record<string, any>>(
|
|
|
277
285
|
const targetClass = mapTarget as any;
|
|
278
286
|
const value = input[prop];
|
|
279
287
|
|
|
288
|
+
// Do not process zero (undefined is removed at the end)
|
|
289
|
+
if (value === null) {
|
|
290
|
+
target[prop] = null;
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
|
|
280
294
|
// Process array
|
|
281
|
-
if (Array.isArray(value)) {
|
|
295
|
+
else if (Array.isArray(value)) {
|
|
282
296
|
const arr = [];
|
|
283
297
|
for (const item of value) {
|
|
284
298
|
if (item instanceof targetClass) {
|
|
@@ -22,7 +22,7 @@ export class MapAndValidatePipe implements PipeTransform {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// Validate
|
|
25
|
-
const errors = await validate(value);
|
|
25
|
+
const errors = await validate(value, { forbidUnknownValues: false });
|
|
26
26
|
if (errors.length > 0) {
|
|
27
27
|
throw new BadRequestException('Input validation failed:' + errors.join('; '));
|
|
28
28
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { template } from 'lodash';
|
|
2
3
|
import { ConfigService } from './config.service';
|
|
3
4
|
// eslint-disable-next-line
|
|
4
5
|
const Mailjet = require('node-mailjet');
|
|
@@ -81,7 +82,27 @@ export class MailjetService {
|
|
|
81
82
|
apiSecret: this.configService.getFastButReadOnly('email.mailjet.api_key_private'),
|
|
82
83
|
});
|
|
83
84
|
} catch (e) {
|
|
84
|
-
|
|
85
|
+
if (
|
|
86
|
+
this.configService.getFastButReadOnly('email.mailjet.api_key_public') &&
|
|
87
|
+
this.configService.getFastButReadOnly('email.mailjet.api_key_private')
|
|
88
|
+
) {
|
|
89
|
+
throw new Error('Cannot connect to mailjet.');
|
|
90
|
+
}
|
|
91
|
+
console.debug(
|
|
92
|
+
JSON.stringify(
|
|
93
|
+
{
|
|
94
|
+
info: 'Mailjet credentials are missing',
|
|
95
|
+
'email.mailjet.api_key_public':
|
|
96
|
+
this.configService.getFastButReadOnly('email.mailjet.api_key_public') || 'missing',
|
|
97
|
+
'email.mailjet.api_key_private':
|
|
98
|
+
this.configService.getFastButReadOnly('email.mailjet.api_key_private') || 'missing',
|
|
99
|
+
templateData: templateData,
|
|
100
|
+
},
|
|
101
|
+
null,
|
|
102
|
+
2
|
|
103
|
+
)
|
|
104
|
+
);
|
|
105
|
+
return;
|
|
85
106
|
}
|
|
86
107
|
|
|
87
108
|
// Send mail with mailjet
|