@lenne.tech/nest-server 10.3.2 → 10.3.4
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 +3 -3
- package/dist/config.env.js.map +1 -1
- package/dist/core/common/models/core-persistence.model.d.ts +1 -0
- package/dist/core/common/models/core-persistence.model.js +8 -0
- package/dist/core/common/models/core-persistence.model.js.map +1 -1
- package/dist/core/common/services/model-doc.service.js +1 -1
- package/dist/core/common/services/model-doc.service.js.map +1 -1
- package/dist/test/test.helper.d.ts +1 -0
- package/dist/test/test.helper.js +7 -1
- package/dist/test/test.helper.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +12 -12
- package/src/config.env.ts +3 -3
- package/src/core/common/models/core-persistence.model.ts +12 -0
- package/src/core/common/services/model-doc.service.ts +1 -1
- package/src/test/test.helper.ts +10 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lenne.tech/nest-server",
|
|
3
|
-
"version": "10.3.
|
|
3
|
+
"version": "10.3.4",
|
|
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",
|
|
@@ -68,13 +68,13 @@
|
|
|
68
68
|
"@lenne.tech/mongoose-gridfs": "1.4.2",
|
|
69
69
|
"@lenne.tech/multer-gridfs-storage": "5.0.6",
|
|
70
70
|
"@nestjs/apollo": "12.2.0",
|
|
71
|
-
"@nestjs/common": "10.4.
|
|
72
|
-
"@nestjs/core": "10.4.
|
|
71
|
+
"@nestjs/common": "10.4.1",
|
|
72
|
+
"@nestjs/core": "10.4.1",
|
|
73
73
|
"@nestjs/graphql": "12.2.0",
|
|
74
74
|
"@nestjs/jwt": "10.2.0",
|
|
75
75
|
"@nestjs/mongoose": "10.0.10",
|
|
76
76
|
"@nestjs/passport": "10.0.3",
|
|
77
|
-
"@nestjs/platform-express": "10.4.
|
|
77
|
+
"@nestjs/platform-express": "10.4.1",
|
|
78
78
|
"@nestjs/schedule": "4.1.0",
|
|
79
79
|
"@nestjs/terminus": "10.2.3",
|
|
80
80
|
"apollo-server-core": "3.13.0",
|
|
@@ -94,9 +94,9 @@
|
|
|
94
94
|
"light-my-request": "5.13.0",
|
|
95
95
|
"lodash": "4.17.21",
|
|
96
96
|
"mongodb": "6.8.0",
|
|
97
|
-
"mongoose": "7.8.
|
|
97
|
+
"mongoose": "7.8.1",
|
|
98
98
|
"multer": "1.4.5-lts.1",
|
|
99
|
-
"node-mailjet": "
|
|
99
|
+
"node-mailjet": "4.0.1",
|
|
100
100
|
"nodemailer": "6.9.14",
|
|
101
101
|
"nodemon": "3.1.4",
|
|
102
102
|
"passport": "0.7.0",
|
|
@@ -112,10 +112,10 @@
|
|
|
112
112
|
"@compodoc/compodoc": "1.1.25",
|
|
113
113
|
"@lenne.tech/eslint-config-ts": "0.0.16",
|
|
114
114
|
"@nestjs/cli": "10.4.4",
|
|
115
|
-
"@nestjs/schematics": "10.1.
|
|
116
|
-
"@nestjs/testing": "10.4.
|
|
115
|
+
"@nestjs/schematics": "10.1.4",
|
|
116
|
+
"@nestjs/testing": "10.4.1",
|
|
117
117
|
"@swc/cli": "0.4.0",
|
|
118
|
-
"@swc/core": "1.7.
|
|
118
|
+
"@swc/core": "1.7.14",
|
|
119
119
|
"@swc/jest": "0.2.36",
|
|
120
120
|
"@types/compression": "1.7.5",
|
|
121
121
|
"@types/cookie-parser": "1.4.7",
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
"@types/jest": "29.5.12",
|
|
125
125
|
"@types/lodash": "4.17.7",
|
|
126
126
|
"@types/multer": "1.4.11",
|
|
127
|
-
"@types/node": "
|
|
127
|
+
"@types/node": "20.16.1",
|
|
128
128
|
"@types/nodemailer": "6.4.15",
|
|
129
129
|
"@types/passport": "1.0.16",
|
|
130
130
|
"@types/supertest": "6.0.2",
|
|
@@ -133,14 +133,14 @@
|
|
|
133
133
|
"coffeescript": "2.7.0",
|
|
134
134
|
"eslint": "8.57.0",
|
|
135
135
|
"eslint-config-prettier": "9.1.0",
|
|
136
|
-
"eslint-plugin-unused-imports": "
|
|
136
|
+
"eslint-plugin-unused-imports": "4.1.3",
|
|
137
137
|
"find-file-up": "2.0.1",
|
|
138
138
|
"grunt": "1.6.1",
|
|
139
139
|
"grunt-bg-shell": "2.3.3",
|
|
140
140
|
"grunt-contrib-clean": "2.0.1",
|
|
141
141
|
"grunt-contrib-watch": "1.1.0",
|
|
142
142
|
"grunt-sync": "0.8.2",
|
|
143
|
-
"husky": "9.1.
|
|
143
|
+
"husky": "9.1.5",
|
|
144
144
|
"jest": "29.7.0",
|
|
145
145
|
"npm-watch": "0.13.0",
|
|
146
146
|
"pm2": "5.4.2",
|
package/src/config.env.ts
CHANGED
|
@@ -45,7 +45,7 @@ const config: { [env: string]: IServerOptions } = {
|
|
|
45
45
|
driver: {
|
|
46
46
|
introspection: true,
|
|
47
47
|
},
|
|
48
|
-
maxComplexity:
|
|
48
|
+
maxComplexity: 1000,
|
|
49
49
|
},
|
|
50
50
|
healthCheck: {
|
|
51
51
|
configs: {
|
|
@@ -158,7 +158,7 @@ const config: { [env: string]: IServerOptions } = {
|
|
|
158
158
|
driver: {
|
|
159
159
|
introspection: true,
|
|
160
160
|
},
|
|
161
|
-
maxComplexity:
|
|
161
|
+
maxComplexity: 1000,
|
|
162
162
|
},
|
|
163
163
|
healthCheck: {
|
|
164
164
|
configs: {
|
|
@@ -262,7 +262,7 @@ const config: { [env: string]: IServerOptions } = {
|
|
|
262
262
|
driver: {
|
|
263
263
|
introspection: true,
|
|
264
264
|
},
|
|
265
|
-
maxComplexity:
|
|
265
|
+
maxComplexity: 1000,
|
|
266
266
|
},
|
|
267
267
|
healthCheck: {
|
|
268
268
|
configs: {
|
|
@@ -4,6 +4,7 @@ import { Types } from 'mongoose';
|
|
|
4
4
|
|
|
5
5
|
import { Restricted } from '../decorators/restricted.decorator';
|
|
6
6
|
import { RoleEnum } from '../enums/role.enum';
|
|
7
|
+
import { getStringIds } from '../helpers/db.helper';
|
|
7
8
|
import { CoreModel } from './core-model.model';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -101,4 +102,15 @@ export abstract class CorePersistenceModel extends CoreModel {
|
|
|
101
102
|
this.updatedAt = this.tags === undefined ? this.createdAt : this.updatedAt;
|
|
102
103
|
return this;
|
|
103
104
|
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Map input
|
|
108
|
+
*/
|
|
109
|
+
override map(input) {
|
|
110
|
+
super.map(input);
|
|
111
|
+
if (input._id) {
|
|
112
|
+
this.id = getStringIds(input);
|
|
113
|
+
}
|
|
114
|
+
return this;
|
|
115
|
+
}
|
|
104
116
|
}
|
package/src/test/test.helper.ts
CHANGED
|
@@ -125,6 +125,7 @@ export interface TestGraphQLOptions {
|
|
|
125
125
|
*/
|
|
126
126
|
export interface TestRestOptions {
|
|
127
127
|
attachments?: Record<string, string>;
|
|
128
|
+
headers?: Record<string, string>;
|
|
128
129
|
log?: boolean;
|
|
129
130
|
logError?: boolean;
|
|
130
131
|
method?: 'DELETE' | 'GET' | 'PATCH' | 'POST' | 'PUT';
|
|
@@ -320,6 +321,7 @@ export class TestHelper {
|
|
|
320
321
|
|
|
321
322
|
// Request configuration
|
|
322
323
|
const requestConfig: any = {
|
|
324
|
+
headers: config.headers,
|
|
323
325
|
method: config.method,
|
|
324
326
|
url,
|
|
325
327
|
};
|
|
@@ -435,7 +437,7 @@ export class TestHelper {
|
|
|
435
437
|
): Promise<any> {
|
|
436
438
|
// Token
|
|
437
439
|
if (token) {
|
|
438
|
-
requestConfig.headers = { authorization: `Bearer ${token}
|
|
440
|
+
requestConfig.headers = { authorization: `Bearer ${token}`, ...(requestConfig.headers || {}) };
|
|
439
441
|
}
|
|
440
442
|
|
|
441
443
|
// Init response
|
|
@@ -465,6 +467,13 @@ export class TestHelper {
|
|
|
465
467
|
request.set('Authorization', `bearer ${token}`);
|
|
466
468
|
}
|
|
467
469
|
|
|
470
|
+
// Headers
|
|
471
|
+
if (requestConfig.headers) {
|
|
472
|
+
for (const [key, value] of Object.entries(requestConfig.headers)) {
|
|
473
|
+
request.set(key, value);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
468
477
|
// Process variables (incl. attachments for GraphQL)
|
|
469
478
|
if (variables) {
|
|
470
479
|
request = this.processVariables(request, variables, (requestConfig.payload as any)?.query);
|