@nest-omni/core 1.0.56-1 → 1.0.56-3
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/.hygen/new/crud/controller.ejs.t +24 -36
- package/common/utils.js +4 -3
- package/decorators/api-page-ok-response.decorator.js +2 -1
- package/decorators/auth-user.decorator.js +2 -1
- package/decorators/controller.decorator.js +2 -1
- package/decorators/field.decorators.js +38 -37
- package/decorators/http.decorators.js +2 -1
- package/decorators/property.decorators.js +7 -6
- package/decorators/swagger.schema.js +2 -1
- package/decorators/timestamp-column.decorator.js +2 -1
- package/decorators/transform.decorators.js +9 -8
- package/decorators/translate.decorator.js +3 -3
- package/decorators/use-dto.decorator.js +2 -1
- package/decorators/user-check.decorator.js +2 -2
- package/decorators/user.decorator.js +2 -2
- package/decorators/user_auth.decorator.js +2 -1
- package/decorators/validator.decorators.js +8 -7
- package/helpers/common.helper.js +3 -3
- package/helpers/date.helper.js +7 -6
- package/interceptors/language-interceptor.service.js +2 -2
- package/interfaces/IFile.d.ts +1 -0
- package/package.json +4 -2
- package/setup/bootstrap.setup.d.ts +3 -0
- package/setup/bootstrap.setup.js +2 -1
- package/shared/serviceRegistryModule.js +5 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/validator-json/decorators.js +3 -2
- package/validator-json/default.js +3 -3
- package/validators/is-exists.validator.js +2 -2
- package/validators/is-unique.validator.js +2 -2
- package/validators/phone-country-code.validator.js +2 -1
- package/validators/same-as.validator.js +2 -1
- package/validators/skip-empty.validator.js +2 -1
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IsPassword =
|
|
4
|
-
exports.IsPhoneNumber = IsPhoneNumber;
|
|
5
|
-
exports.IsTmpKey = IsTmpKey;
|
|
6
|
-
exports.IsUndefinable = IsUndefinable;
|
|
7
|
-
exports.IsEmptyable = IsEmptyable;
|
|
8
|
-
exports.IsNullable = IsNullable;
|
|
9
|
-
exports.IsHttpUrl = IsHttpUrl;
|
|
3
|
+
exports.IsHttpUrl = exports.IsNullable = exports.IsEmptyable = exports.IsUndefinable = exports.IsTmpKey = exports.IsPhoneNumber = exports.IsPassword = void 0;
|
|
10
4
|
const class_validator_1 = require("class-validator");
|
|
11
5
|
const lodash_1 = require("lodash");
|
|
12
6
|
function IsPassword(validationOptions) {
|
|
@@ -25,9 +19,11 @@ function IsPassword(validationOptions) {
|
|
|
25
19
|
});
|
|
26
20
|
};
|
|
27
21
|
}
|
|
22
|
+
exports.IsPassword = IsPassword;
|
|
28
23
|
function IsPhoneNumber(validationOptions) {
|
|
29
24
|
return (0, class_validator_1.IsPhoneNumber)(validationOptions === null || validationOptions === void 0 ? void 0 : validationOptions.region, Object.assign({ message: 'error.phoneNumber' }, validationOptions));
|
|
30
25
|
}
|
|
26
|
+
exports.IsPhoneNumber = IsPhoneNumber;
|
|
31
27
|
function IsTmpKey(validationOptions) {
|
|
32
28
|
return (object, propertyName) => {
|
|
33
29
|
(0, class_validator_1.registerDecorator)({
|
|
@@ -46,17 +42,21 @@ function IsTmpKey(validationOptions) {
|
|
|
46
42
|
});
|
|
47
43
|
};
|
|
48
44
|
}
|
|
45
|
+
exports.IsTmpKey = IsTmpKey;
|
|
49
46
|
function IsUndefinable(options) {
|
|
50
47
|
return (0, class_validator_1.ValidateIf)((obj, value) => value !== undefined, options);
|
|
51
48
|
}
|
|
49
|
+
exports.IsUndefinable = IsUndefinable;
|
|
52
50
|
function IsEmptyable(options) {
|
|
53
51
|
return (0, class_validator_1.ValidateIf)((obj, value) => !(value === null ||
|
|
54
52
|
value === undefined ||
|
|
55
53
|
((0, lodash_1.isString)(value) && value.trim() === '')), options);
|
|
56
54
|
}
|
|
55
|
+
exports.IsEmptyable = IsEmptyable;
|
|
57
56
|
function IsNullable(options) {
|
|
58
57
|
return (0, class_validator_1.ValidateIf)((obj, value) => value !== null, options);
|
|
59
58
|
}
|
|
59
|
+
exports.IsNullable = IsNullable;
|
|
60
60
|
function IsHttpUrl(validationOptions) {
|
|
61
61
|
return function (object, propertyName) {
|
|
62
62
|
(0, class_validator_1.registerDecorator)({
|
|
@@ -76,3 +76,4 @@ function IsHttpUrl(validationOptions) {
|
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
+
exports.IsHttpUrl = IsHttpUrl;
|
package/helpers/common.helper.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.randomString = void 0;
|
|
4
|
-
exports.enumToArray = enumToArray;
|
|
5
|
-
exports.getIPAdress = getIPAdress;
|
|
3
|
+
exports.getIPAdress = exports.randomString = exports.enumToArray = void 0;
|
|
6
4
|
const os_1 = require("os");
|
|
7
5
|
function enumToArray(Enum) {
|
|
8
6
|
return Object.keys(Enum)
|
|
9
7
|
.filter((key) => typeof Enum[key] === 'number')
|
|
10
8
|
.map((key) => Enum[key]);
|
|
11
9
|
}
|
|
10
|
+
exports.enumToArray = enumToArray;
|
|
12
11
|
const randomString = (length = 8, charSet) => {
|
|
13
12
|
charSet =
|
|
14
13
|
charSet || 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
@@ -34,3 +33,4 @@ function getIPAdress() {
|
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
35
|
}
|
|
36
|
+
exports.getIPAdress = getIPAdress;
|
package/helpers/date.helper.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.timestamp =
|
|
4
|
-
exports.strToTimeStamp = strToTimeStamp;
|
|
5
|
-
exports.getTodayTimeStamp = getTodayTimeStamp;
|
|
6
|
-
exports.unixtimestampToDate = unixtimestampToDate;
|
|
7
|
-
exports.formatDateTime = formatDateTime;
|
|
8
|
-
exports.timestampColumn = timestampColumn;
|
|
3
|
+
exports.timestampColumn = exports.formatDateTime = exports.unixtimestampToDate = exports.getTodayTimeStamp = exports.strToTimeStamp = exports.timestamp = void 0;
|
|
9
4
|
const moment = require("moment");
|
|
10
5
|
const _ = require("lodash");
|
|
11
6
|
function timestamp(value) {
|
|
@@ -14,12 +9,14 @@ function timestamp(value) {
|
|
|
14
9
|
}
|
|
15
10
|
return Math.round(value / 1000);
|
|
16
11
|
}
|
|
12
|
+
exports.timestamp = timestamp;
|
|
17
13
|
function strToTimeStamp(str) {
|
|
18
14
|
if (_.isEmpty(str)) {
|
|
19
15
|
return 0;
|
|
20
16
|
}
|
|
21
17
|
return moment(str).unix();
|
|
22
18
|
}
|
|
19
|
+
exports.strToTimeStamp = strToTimeStamp;
|
|
23
20
|
function getTodayTimeStamp() {
|
|
24
21
|
const startTime = strToTimeStamp(moment().format('YYYY-MM-DD 00:00:00'));
|
|
25
22
|
const endTime = strToTimeStamp(moment().format('YYYY-MM-DD 23:59:59'));
|
|
@@ -28,9 +25,11 @@ function getTodayTimeStamp() {
|
|
|
28
25
|
endTime,
|
|
29
26
|
};
|
|
30
27
|
}
|
|
28
|
+
exports.getTodayTimeStamp = getTodayTimeStamp;
|
|
31
29
|
function unixtimestampToDate(value) {
|
|
32
30
|
return moment(value * 1000).toDate();
|
|
33
31
|
}
|
|
32
|
+
exports.unixtimestampToDate = unixtimestampToDate;
|
|
34
33
|
function formatDateTime(value, format = 'YYYY-MM-DD HH:mm:ss', holder = '') {
|
|
35
34
|
if (value === 'now') {
|
|
36
35
|
return moment().format(format);
|
|
@@ -43,6 +42,7 @@ function formatDateTime(value, format = 'YYYY-MM-DD HH:mm:ss', holder = '') {
|
|
|
43
42
|
}
|
|
44
43
|
return holder;
|
|
45
44
|
}
|
|
45
|
+
exports.formatDateTime = formatDateTime;
|
|
46
46
|
function timestampColumn(name) {
|
|
47
47
|
return {
|
|
48
48
|
type: 'int',
|
|
@@ -55,3 +55,4 @@ function timestampColumn(name) {
|
|
|
55
55
|
},
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
+
exports.timestampColumn = timestampColumn;
|
|
@@ -6,8 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.LanguageInterceptor = void 0;
|
|
10
|
-
exports.UseLanguageInterceptor = UseLanguageInterceptor;
|
|
9
|
+
exports.UseLanguageInterceptor = exports.LanguageInterceptor = void 0;
|
|
11
10
|
const common_1 = require("@nestjs/common");
|
|
12
11
|
const constants_1 = require("../constants");
|
|
13
12
|
const providers_1 = require("../providers");
|
|
@@ -27,3 +26,4 @@ exports.LanguageInterceptor = LanguageInterceptor = __decorate([
|
|
|
27
26
|
function UseLanguageInterceptor() {
|
|
28
27
|
return (0, common_1.UseInterceptors)(LanguageInterceptor);
|
|
29
28
|
}
|
|
29
|
+
exports.UseLanguageInterceptor = UseLanguageInterceptor;
|
package/interfaces/IFile.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nest-omni/core",
|
|
3
|
-
"version": "1.0.56-
|
|
3
|
+
"version": "1.0.56-3",
|
|
4
4
|
"description": "framework",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"author": "Jinpy",
|
|
18
18
|
"license": "Apache-2.0",
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"typescript": "^5.4.5"
|
|
20
|
+
"typescript": "^5.4.5",
|
|
21
|
+
"@types/compression": "^1.8.1"
|
|
21
22
|
},
|
|
22
23
|
"peerDependencies": {
|
|
23
24
|
"@dataui/crud": "^5.3.0",
|
|
@@ -66,6 +67,7 @@
|
|
|
66
67
|
"uuid": "^9.0.1"
|
|
67
68
|
},
|
|
68
69
|
"dependencies": {
|
|
70
|
+
"compression": "^1.8.0",
|
|
69
71
|
"hygen": "^6.2.11"
|
|
70
72
|
}
|
|
71
73
|
}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node/http" />
|
|
3
|
+
/// <reference types="pino-http" />
|
|
1
4
|
import type { NestExpressApplication } from '@nestjs/platform-express';
|
|
2
5
|
export declare function bootstrapSetup(AppModule: any, SetupSwagger: any): Promise<NestExpressApplication<import("http").Server>>;
|
package/setup/bootstrap.setup.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.bootstrapSetup =
|
|
12
|
+
exports.bootstrapSetup = void 0;
|
|
13
13
|
const core_1 = require("@nestjs/core");
|
|
14
14
|
const typeorm_transactional_1 = require("typeorm-transactional");
|
|
15
15
|
const skywalking_backend_js_1 = require("skywalking-backend-js");
|
|
@@ -173,3 +173,4 @@ function bootstrapSetup(AppModule, SetupSwagger) {
|
|
|
173
173
|
return app;
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
|
+
exports.bootstrapSetup = bootstrapSetup;
|
|
@@ -33,6 +33,7 @@ const health_checker_module_1 = require("../health-checker/health-checker.module
|
|
|
33
33
|
const services_1 = require("./services");
|
|
34
34
|
const fs_1 = require("fs");
|
|
35
35
|
const path_1 = require("path");
|
|
36
|
+
const nestjs_cls_1 = require("nestjs-cls");
|
|
36
37
|
const providers = [
|
|
37
38
|
services_1.ApiConfigService,
|
|
38
39
|
services_1.ValidatorService,
|
|
@@ -77,6 +78,10 @@ const modules = [
|
|
|
77
78
|
expandVariables: false,
|
|
78
79
|
envFilePath: [envFilePath, baseEnvFilePath],
|
|
79
80
|
}),
|
|
81
|
+
nestjs_cls_1.ClsModule.forRoot({
|
|
82
|
+
global: true,
|
|
83
|
+
middleware: { mount: true },
|
|
84
|
+
}),
|
|
80
85
|
nestjs_sentry_1.SentryModule.forRootAsync({
|
|
81
86
|
inject: [services_1.ApiConfigService],
|
|
82
87
|
useFactory(configService) {
|