@lenne.tech/nest-server 8.6.19 → 8.6.20
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/helpers/common.helper.d.ts +2 -0
- package/dist/core/common/helpers/common.helper.js +16 -0
- package/dist/core/common/helpers/common.helper.js.map +1 -0
- package/dist/core/common/helpers/model.helper.js +8 -6
- package/dist/core/common/helpers/model.helper.js.map +1 -1
- package/dist/core/common/types/remove-methods.type.d.ts +3 -0
- package/dist/core/common/types/remove-methods.type.js +3 -0
- package/dist/core/common/types/remove-methods.type.js.map +1 -0
- package/dist/core/common/types/string-or-object-id.type.d.ts +1 -1
- package/dist/core/modules/file/core-file.service.d.ts +2 -2
- package/dist/core/modules/file/core-file.service.js.map +1 -1
- package/dist/core/modules/file/interfaces/file-service-options.interface.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/core/common/helpers/common.helper.ts +18 -0
- package/src/core/common/helpers/model.helper.ts +8 -6
- package/src/core/common/types/plain-input.type.ts +1 -1
- package/src/core/common/types/remove-methods.type.ts +4 -0
- package/src/core/common/types/string-or-object-id.type.ts +4 -1
- package/src/core/modules/file/core-file.service.ts +2 -2
- package/src/core/modules/file/interfaces/file-service-options.interface.ts +1 -0
- package/src/index.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lenne.tech/nest-server",
|
|
3
|
-
"version": "8.6.
|
|
3
|
+
"version": "8.6.20",
|
|
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",
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wait a certain number of milliseconds
|
|
3
|
+
*/
|
|
4
|
+
export function sleep(ms: number) {
|
|
5
|
+
return new Promise<void>((resolve) => {
|
|
6
|
+
setTimeout(() => {
|
|
7
|
+
resolve();
|
|
8
|
+
}, ms);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Wait a certain number of milliseconds
|
|
14
|
+
* Alias of sleep
|
|
15
|
+
*/
|
|
16
|
+
export function wait(ms: number) {
|
|
17
|
+
return sleep(ms);
|
|
18
|
+
}
|
|
@@ -175,9 +175,10 @@ export function mapClasses<T = Record<string, any>>(
|
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
// Process input
|
|
178
|
-
for (const [prop,
|
|
179
|
-
if (prop in
|
|
180
|
-
const targetClass =
|
|
178
|
+
for (const [prop, mapTarget] of Object.entries(mapping)) {
|
|
179
|
+
if (prop in input) {
|
|
180
|
+
const targetClass = mapTarget as any;
|
|
181
|
+
const value = input[prop];
|
|
181
182
|
|
|
182
183
|
// Process array
|
|
183
184
|
if (Array.isArray(value)) {
|
|
@@ -250,9 +251,10 @@ export async function mapClassesAsync<T = Record<string, any>>(
|
|
|
250
251
|
}
|
|
251
252
|
|
|
252
253
|
// Process input
|
|
253
|
-
for (const [prop,
|
|
254
|
-
if (prop in
|
|
255
|
-
const targetClass =
|
|
254
|
+
for (const [prop, mapTarget] of Object.entries(mapping)) {
|
|
255
|
+
if (prop in input) {
|
|
256
|
+
const targetClass = mapTarget as any;
|
|
257
|
+
const value = input[prop];
|
|
256
258
|
|
|
257
259
|
// Process array
|
|
258
260
|
if (Array.isArray(value)) {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { Types } from 'mongoose';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Everything which will be used by getStringIds or getObjectIds (see helpers/db.helper.ts)
|
|
5
|
+
*/
|
|
6
|
+
export type StringOrObjectId<T = any> = string | Types.ObjectId | T;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NotFoundException } from '@nestjs/common';
|
|
2
|
-
import { GridFSBucket, GridFSBucketReadStreamOptions } from 'mongodb';
|
|
2
|
+
import { GridFSBucket, GridFSBucketReadStream, GridFSBucketReadStreamOptions } from 'mongodb';
|
|
3
3
|
import { Connection, Types } from 'mongoose';
|
|
4
4
|
import { createBucket, MongoGridFSOptions, MongooseGridFS } from 'mongoose-gridfs';
|
|
5
5
|
import { FilterArgs } from '../../common/args/filter.args';
|
|
@@ -115,7 +115,7 @@ export abstract class CoreFileService {
|
|
|
115
115
|
if (!(await this.checkRights(id, { ...serviceOptions, checkInputType: 'id' }))) {
|
|
116
116
|
return null;
|
|
117
117
|
}
|
|
118
|
-
return this.files.openDownloadStream(getObjectIds(id));
|
|
118
|
+
return this.files.openDownloadStream(getObjectIds(id)) as GridFSBucketReadStream;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
/**
|
package/src/index.ts
CHANGED
|
@@ -18,6 +18,7 @@ export * from './core/common/enums/logical-operator.enum';
|
|
|
18
18
|
export * from './core/common/enums/process-type.enum';
|
|
19
19
|
export * from './core/common/enums/role.enum';
|
|
20
20
|
export * from './core/common/enums/sort-order.emum';
|
|
21
|
+
export * from './core/common/helpers/common.helper';
|
|
21
22
|
export * from './core/common/helpers/config.helper';
|
|
22
23
|
export * from './core/common/helpers/context.helper';
|
|
23
24
|
export * from './core/common/helpers/db.helper';
|
|
@@ -61,6 +62,7 @@ export * from './core/common/types/field-selection.type';
|
|
|
61
62
|
export * from './core/common/types/ids.type';
|
|
62
63
|
export * from './core/common/types/maybe-promise.type';
|
|
63
64
|
export * from './core/common/types/plain-input.type';
|
|
65
|
+
export * from './core/common/types/remove-methods.type';
|
|
64
66
|
export * from './core/common/types/require-only-one.type';
|
|
65
67
|
export * from './core/common/types/required-at-least-one.type';
|
|
66
68
|
export * from './core/common/types/string-or-object-id.type';
|