@nest-omni/core 3.1.1-9 → 3.1.1
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 +82 -0
- package/.hygen/new/crud/create.dto.ejs.t +12 -0
- package/.hygen/new/crud/entity.ejs.t +26 -0
- package/.hygen/new/crud/get.dto.ejs.t +19 -0
- package/.hygen/new/crud/index-dto.ejs.t +29 -0
- package/.hygen/new/crud/index-response.dto.ejs.t +18 -0
- package/.hygen/new/crud/module.ejs.t +32 -0
- package/.hygen/new/crud/prompt.js +89 -0
- package/.hygen/new/crud/service.ejs.t +76 -0
- package/.hygen/new/crud/update.dto.ejs.t +11 -0
- package/.hygen/new/module/controller.ejs.t +93 -0
- package/.hygen/new/module/create-command.ejs.t +90 -0
- package/.hygen/new/module/create.dto.ejs.t +11 -0
- package/.hygen/new/module/dto.ejs.t +24 -0
- package/.hygen/new/module/entity.ejs.t +33 -0
- package/.hygen/new/module/get-query.ejs.t +57 -0
- package/.hygen/new/module/module.ejs.t +44 -0
- package/.hygen/new/module/not-found.exception.ejs.t +18 -0
- package/.hygen/new/module/page-options.dto.ejs.t +12 -0
- package/.hygen/new/module/prompt.js +104 -0
- package/.hygen/new/module/repository.ejs.t +16 -0
- package/.hygen/new/module/service.ejs.t +139 -0
- package/.hygen/new/module/translation-dto.ejs.t +27 -0
- package/.hygen/new/module/translation-entity.ejs.t +40 -0
- package/.hygen/new/module/translation-repository.ejs.t +16 -0
- package/.hygen/new/module/update.dto.ejs.t +10 -0
- package/.hygen.js +116 -0
- package/cache/cache-metrics.service.d.ts +83 -0
- package/cache/cache-metrics.service.js +298 -0
- package/cache/cache-serialization.service.d.ts +22 -0
- package/cache/cache-serialization.service.js +122 -0
- package/cache/cache.constants.d.ts +2 -0
- package/cache/cache.constants.js +5 -0
- package/cache/cache.health.d.ts +35 -0
- package/cache/cache.health.js +193 -0
- package/cache/cache.module.d.ts +26 -0
- package/cache/cache.module.js +155 -0
- package/cache/cache.service.d.ts +37 -0
- package/cache/cache.service.js +308 -0
- package/cache/cache.warmup.service.d.ts +34 -0
- package/cache/cache.warmup.service.js +199 -0
- package/cache/decorators/cache-evict.decorator.d.ts +2 -0
- package/cache/decorators/cache-evict.decorator.js +72 -0
- package/cache/decorators/cache-put.decorator.d.ts +2 -0
- package/cache/decorators/cache-put.decorator.js +48 -0
- package/cache/decorators/cacheable.decorator.d.ts +4 -0
- package/cache/decorators/cacheable.decorator.js +68 -0
- package/cache/decorators/index.d.ts +3 -0
- package/cache/decorators/index.js +11 -0
- package/cache/dependencies/callback.dependency.d.ts +11 -0
- package/cache/dependencies/callback.dependency.js +92 -0
- package/cache/dependencies/chain.dependency.d.ts +20 -0
- package/cache/dependencies/chain.dependency.js +113 -0
- package/cache/dependencies/db.dependency.d.ts +15 -0
- package/cache/dependencies/db.dependency.js +71 -0
- package/cache/dependencies/file.dependency.d.ts +17 -0
- package/cache/dependencies/file.dependency.js +63 -0
- package/cache/dependencies/index.d.ts +6 -0
- package/cache/dependencies/index.js +22 -0
- package/cache/dependencies/tag.dependency.d.ts +16 -0
- package/cache/dependencies/tag.dependency.js +75 -0
- package/cache/dependencies/time.dependency.d.ts +19 -0
- package/cache/dependencies/time.dependency.js +71 -0
- package/cache/examples/basic-usage.d.ts +58 -0
- package/cache/examples/basic-usage.js +379 -0
- package/cache/index.d.ts +15 -0
- package/cache/index.js +44 -0
- package/cache/interfaces/cache-dependency.interface.d.ts +11 -0
- package/cache/interfaces/cache-dependency.interface.js +2 -0
- package/cache/interfaces/cache-options.interface.d.ts +32 -0
- package/cache/interfaces/cache-options.interface.js +9 -0
- package/cache/interfaces/cache-provider.interface.d.ts +28 -0
- package/cache/interfaces/cache-provider.interface.js +2 -0
- package/cache/interfaces/index.d.ts +3 -0
- package/cache/interfaces/index.js +19 -0
- package/cache/providers/base-cache.provider.d.ts +16 -0
- package/cache/providers/base-cache.provider.js +32 -0
- package/cache/providers/cls-cache.provider.d.ts +16 -0
- package/cache/providers/cls-cache.provider.js +140 -0
- package/cache/providers/index.d.ts +4 -0
- package/cache/providers/index.js +23 -0
- package/cache/providers/memory-cache.provider.d.ts +26 -0
- package/cache/providers/memory-cache.provider.js +171 -0
- package/cache/providers/redis-cache.provider.d.ts +23 -0
- package/cache/providers/redis-cache.provider.js +215 -0
- package/cache/utils/dependency-manager.util.d.ts +15 -0
- package/cache/utils/dependency-manager.util.js +141 -0
- package/cache/utils/index.d.ts +2 -0
- package/cache/utils/index.js +18 -0
- package/cache/utils/key-generator.util.d.ts +13 -0
- package/cache/utils/key-generator.util.js +74 -0
- package/common/abstract.entity.d.ts +20 -0
- package/common/abstract.entity.js +81 -0
- package/common/boilerplate.polyfill.d.ts +50 -0
- package/common/boilerplate.polyfill.js +152 -0
- package/common/dto/abstract.dto.d.ts +13 -0
- package/common/dto/abstract.dto.js +59 -0
- package/common/dto/bulk-id.dto.d.ts +3 -0
- package/common/dto/bulk-id.dto.js +27 -0
- package/common/dto/create-translation.dto.d.ts +5 -0
- package/common/dto/create-translation.dto.js +25 -0
- package/common/dto/dto-container.d.ts +9 -0
- package/common/dto/dto-container.js +59 -0
- package/common/dto/dto-decorators.d.ts +18 -0
- package/common/dto/dto-decorators.js +59 -0
- package/common/dto/dto-extensions.d.ts +12 -0
- package/common/dto/dto-extensions.js +63 -0
- package/common/dto/dto-service-accessor.d.ts +7 -0
- package/common/dto/dto-service-accessor.js +49 -0
- package/common/dto/dto-transformer.d.ts +11 -0
- package/common/dto/dto-transformer.js +49 -0
- package/common/dto/index.d.ts +12 -0
- package/common/dto/index.js +28 -0
- package/common/dto/page-meta.dto.d.ts +15 -0
- package/common/dto/page-meta.dto.js +48 -0
- package/common/dto/page-options.dto.d.ts +5 -0
- package/common/dto/page-options.dto.js +40 -0
- package/common/dto/page.dto.d.ts +11 -0
- package/common/dto/page.dto.js +53 -0
- package/common/examples/paginate-and-map.example.d.ts +14 -0
- package/common/examples/paginate-and-map.example.js +158 -0
- package/common/index.d.ts +6 -0
- package/common/index.js +22 -0
- package/common/snake-naming.strategy.d.ts +11 -0
- package/common/snake-naming.strategy.js +37 -0
- package/common/types.d.ts +9 -0
- package/common/types.js +2 -0
- package/common/utils.d.ts +3 -0
- package/common/utils.js +24 -0
- package/constants/index.d.ts +2 -0
- package/constants/index.js +18 -0
- package/constants/language-code.d.ts +5 -0
- package/constants/language-code.js +9 -0
- package/constants/order.d.ts +4 -0
- package/constants/order.js +8 -0
- package/decorators/api-page-ok-response.decorator.d.ts +5 -0
- package/decorators/api-page-ok-response.decorator.js +24 -0
- package/decorators/auth-user.decorator.d.ts +1 -0
- package/decorators/auth-user.decorator.js +14 -0
- package/decorators/controller.decorator.d.ts +1 -0
- package/decorators/controller.decorator.js +10 -0
- package/decorators/examples/validation-decorators.example.d.ts +69 -0
- package/decorators/examples/validation-decorators.example.js +331 -0
- package/decorators/field.decorators.d.ts +79 -0
- package/decorators/field.decorators.js +499 -0
- package/decorators/http.decorators.d.ts +3 -0
- package/decorators/http.decorators.js +7 -0
- package/decorators/index.d.ts +12 -0
- package/decorators/index.js +28 -0
- package/decorators/operation.decorator.d.ts +1 -0
- package/decorators/operation.decorator.js +6 -0
- package/decorators/property.decorators.d.ts +15 -0
- package/decorators/property.decorators.js +31 -0
- package/decorators/public-route.decorator.d.ts +3 -0
- package/decorators/public-route.decorator.js +7 -0
- package/decorators/swagger.schema.d.ts +5 -0
- package/decorators/swagger.schema.js +78 -0
- package/decorators/timestamp-column.decorator.d.ts +1 -0
- package/decorators/timestamp-column.decorator.js +27 -0
- package/decorators/transform.decorators.d.ts +8 -0
- package/decorators/transform.decorators.js +100 -0
- package/decorators/translate.decorator.d.ts +5 -0
- package/decorators/translate.decorator.js +17 -0
- package/decorators/use-dto.decorator.d.ts +4 -0
- package/decorators/use-dto.decorator.js +8 -0
- package/decorators/user-check.decorator.d.ts +6 -0
- package/decorators/user-check.decorator.js +21 -0
- package/decorators/user.decorator.d.ts +12 -0
- package/decorators/user.decorator.js +44 -0
- package/decorators/user_auth.decorator.d.ts +1 -0
- package/decorators/user_auth.decorator.js +15 -0
- package/decorators/validator.decorators.d.ts +18 -0
- package/decorators/validator.decorators.js +193 -0
- package/exceptions/file-not-image.exception.d.ts +4 -0
- package/exceptions/file-not-image.exception.js +10 -0
- package/exceptions/index.d.ts +2 -0
- package/exceptions/index.js +18 -0
- package/exceptions/page-type.exception.d.ts +4 -0
- package/exceptions/page-type.exception.js +10 -0
- package/exceptions/user-not-found.exception.d.ts +4 -0
- package/exceptions/user-not-found.exception.js +10 -0
- package/filters/bad-request.filter.d.ts +5 -0
- package/filters/bad-request.filter.js +71 -0
- package/filters/constraint-errors.d.ts +1 -0
- package/filters/constraint-errors.js +6 -0
- package/filters/index.d.ts +3 -0
- package/filters/index.js +19 -0
- package/filters/query-failed.filter.d.ts +10 -0
- package/filters/query-failed.filter.js +42 -0
- package/health-checker/health-checker.controller.d.ts +13 -0
- package/health-checker/health-checker.controller.js +69 -0
- package/health-checker/health-checker.module.d.ts +2 -0
- package/health-checker/health-checker.module.js +24 -0
- package/health-checker/index.d.ts +2 -0
- package/health-checker/index.js +18 -0
- package/helpers/common.helper.d.ts +3 -0
- package/helpers/common.helper.js +36 -0
- package/helpers/date.helper.d.ts +10 -0
- package/helpers/date.helper.js +57 -0
- package/helpers/index.d.ts +2 -0
- package/helpers/index.js +18 -0
- package/i18n/en_US/validation.json +44 -0
- package/i18n/zh_CN/validation.json +44 -0
- package/index.d.ts +18 -0
- package/index.js +3 -0
- package/interceptors/index.d.ts +2 -0
- package/interceptors/index.js +18 -0
- package/interceptors/language-interceptor.service.d.ts +6 -0
- package/interceptors/language-interceptor.service.js +29 -0
- package/interceptors/translation-interceptor.service.d.ts +5 -0
- package/interceptors/translation-interceptor.service.js +34 -0
- package/interfaces/IApiFile.d.ts +4 -0
- package/interfaces/IApiFile.js +2 -0
- package/interfaces/IFile.d.ts +8 -0
- package/interfaces/IFile.js +2 -0
- package/interfaces/ITranslationDecoratorInterface.d.ts +3 -0
- package/interfaces/ITranslationDecoratorInterface.js +2 -0
- package/interfaces/index.d.ts +3 -0
- package/interfaces/index.js +19 -0
- package/interfaces/response.d.ts +25 -0
- package/interfaces/response.js +2 -0
- package/middlewares/index.d.ts +4 -0
- package/middlewares/index.js +20 -0
- package/middlewares/omni-auth.middleware.d.ts +1 -0
- package/middlewares/omni-auth.middleware.js +13 -0
- package/middlewares/powerby.middleware.d.ts +1 -0
- package/middlewares/powerby.middleware.js +10 -0
- package/middlewares/request-id.middleware.d.ts +7 -0
- package/middlewares/request-id.middleware.js +22 -0
- package/middlewares/xml.middleware.d.ts +4 -0
- package/middlewares/xml.middleware.js +24 -0
- package/package.json +41 -116
- package/providers/context.provider.d.ts +34 -0
- package/providers/context.provider.js +80 -0
- package/providers/generator.provider.d.ts +9 -0
- package/providers/generator.provider.js +50 -0
- package/providers/index.d.ts +2 -0
- package/providers/index.js +18 -0
- package/redis-lock/examples/lock-strategy.examples.d.ts +73 -0
- package/redis-lock/examples/lock-strategy.examples.js +387 -0
- package/redis-lock/index.d.ts +4 -0
- package/redis-lock/index.js +16 -0
- package/redis-lock/redis-lock.decorator.d.ts +12 -0
- package/redis-lock/redis-lock.decorator.js +125 -0
- package/redis-lock/redis-lock.module.d.ts +23 -0
- package/redis-lock/redis-lock.module.js +117 -0
- package/redis-lock/redis-lock.service.d.ts +66 -0
- package/redis-lock/redis-lock.service.js +413 -0
- package/setup/bootstrap.setup.d.ts +2 -0
- package/setup/bootstrap.setup.js +184 -0
- package/setup/index.d.ts +4 -0
- package/setup/index.js +20 -0
- package/setup/mode.setup.d.ts +12 -0
- package/setup/mode.setup.js +60 -0
- package/setup/schedule.decorator.d.ts +23 -0
- package/setup/schedule.decorator.js +233 -0
- package/setup/worker.decorator.d.ts +14 -0
- package/setup/worker.decorator.js +130 -0
- package/shared/index.d.ts +2 -0
- package/shared/index.js +18 -0
- package/shared/serviceRegistryModule.d.ts +2 -0
- package/shared/serviceRegistryModule.js +170 -0
- package/shared/services/api-config.service.d.ts +54 -0
- package/shared/services/api-config.service.js +287 -0
- package/shared/services/generator.service.d.ts +4 -0
- package/shared/services/generator.service.js +23 -0
- package/shared/services/index.d.ts +4 -0
- package/shared/services/index.js +20 -0
- package/shared/services/translation.service.d.ts +9 -0
- package/shared/services/translation.service.js +70 -0
- package/shared/services/validator.service.d.ts +3 -0
- package/shared/services/validator.service.js +20 -0
- package/validator-json/decorators.d.ts +6 -0
- package/validator-json/decorators.js +22 -0
- package/validator-json/default.d.ts +6 -0
- package/validator-json/default.js +138 -0
- package/validator-json/defaultConverters.d.ts +8 -0
- package/validator-json/defaultConverters.js +376 -0
- package/validator-json/index.d.ts +4 -0
- package/validator-json/index.js +20 -0
- package/validator-json/options.d.ts +11 -0
- package/validator-json/options.js +10 -0
- package/validators/file-mimetype.validator.d.ts +13 -0
- package/validators/file-mimetype.validator.js +21 -0
- package/validators/index.d.ts +6 -0
- package/validators/index.js +22 -0
- package/validators/is-exists.validator.d.ts +18 -0
- package/validators/is-exists.validator.js +60 -0
- package/validators/is-unique.validator.d.ts +17 -0
- package/validators/is-unique.validator.js +91 -0
- package/validators/phone-country-code.validator.d.ts +2 -0
- package/validators/phone-country-code.validator.js +29 -0
- package/validators/same-as.validator.d.ts +2 -0
- package/validators/same-as.validator.js +24 -0
- package/validators/skip-empty.validator.d.ts +1 -0
- package/validators/skip-empty.validator.js +17 -0
- package/vault/index.d.ts +4 -0
- package/vault/index.js +20 -0
- package/vault/interfaces/vault-options.interface.d.ts +22 -0
- package/vault/interfaces/vault-options.interface.js +2 -0
- package/vault/vault-config.loader.d.ts +13 -0
- package/vault/vault-config.loader.js +246 -0
- package/vault/vault-config.service.d.ts +18 -0
- package/vault/vault-config.service.js +174 -0
- package/vault/vault.module.d.ts +2 -0
- package/vault/vault.module.js +21 -0
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NumberField = NumberField;
|
|
4
|
+
exports.NumberFieldOptional = NumberFieldOptional;
|
|
5
|
+
exports.StringField = StringField;
|
|
6
|
+
exports.StringFieldOptional = StringFieldOptional;
|
|
7
|
+
exports.PasswordField = PasswordField;
|
|
8
|
+
exports.PasswordFieldOptional = PasswordFieldOptional;
|
|
9
|
+
exports.BooleanField = BooleanField;
|
|
10
|
+
exports.BooleanFieldOptional = BooleanFieldOptional;
|
|
11
|
+
exports.TranslationsField = TranslationsField;
|
|
12
|
+
exports.TranslationsFieldOptional = TranslationsFieldOptional;
|
|
13
|
+
exports.TmpKeyField = TmpKeyField;
|
|
14
|
+
exports.TmpKeyFieldOptional = TmpKeyFieldOptional;
|
|
15
|
+
exports.getEnumDescription = getEnumDescription;
|
|
16
|
+
exports.EnumField = EnumField;
|
|
17
|
+
exports.ClassField = ClassField;
|
|
18
|
+
exports.EnumFieldOptional = EnumFieldOptional;
|
|
19
|
+
exports.ClassFieldOptional = ClassFieldOptional;
|
|
20
|
+
exports.EmailField = EmailField;
|
|
21
|
+
exports.EmailFieldOptional = EmailFieldOptional;
|
|
22
|
+
exports.PhoneField = PhoneField;
|
|
23
|
+
exports.PhoneFieldOptional = PhoneFieldOptional;
|
|
24
|
+
exports.UUIDField = UUIDField;
|
|
25
|
+
exports.UUIDFieldOptional = UUIDFieldOptional;
|
|
26
|
+
exports.URLField = URLField;
|
|
27
|
+
exports.URLFieldOptional = URLFieldOptional;
|
|
28
|
+
exports.FQDNField = FQDNField;
|
|
29
|
+
exports.FQDNFieldOptional = FQDNFieldOptional;
|
|
30
|
+
exports.DateField = DateField;
|
|
31
|
+
exports.DateFieldOptional = DateFieldOptional;
|
|
32
|
+
exports.IpFieldOptional = IpFieldOptional;
|
|
33
|
+
exports.IpField = IpField;
|
|
34
|
+
exports.ObjectField = ObjectField;
|
|
35
|
+
exports.ObjectFieldOptional = ObjectFieldOptional;
|
|
36
|
+
exports.TimeZoneField = TimeZoneField;
|
|
37
|
+
exports.TimeZoneFieldOptional = TimeZoneFieldOptional;
|
|
38
|
+
exports.LocaleField = LocaleField;
|
|
39
|
+
exports.LocaleFieldOptional = LocaleFieldOptional;
|
|
40
|
+
const common_1 = require("@nestjs/common");
|
|
41
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
42
|
+
const nestjs_i18n_1 = require("nestjs-i18n");
|
|
43
|
+
const class_transformer_1 = require("class-transformer");
|
|
44
|
+
const class_validator_1 = require("class-validator");
|
|
45
|
+
const constants_1 = require("../constants");
|
|
46
|
+
const property_decorators_1 = require("./property.decorators");
|
|
47
|
+
const transform_decorators_1 = require("./transform.decorators");
|
|
48
|
+
const validator_decorators_1 = require("./validator.decorators");
|
|
49
|
+
function NumberField(options = {}) {
|
|
50
|
+
const decorators = [(0, class_transformer_1.Type)(() => Number)];
|
|
51
|
+
if (options.nullable) {
|
|
52
|
+
decorators.push((0, validator_decorators_1.IsNullable)({
|
|
53
|
+
each: options.each,
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
decorators.push((0, class_validator_1.NotEquals)(null, {
|
|
58
|
+
each: options.each,
|
|
59
|
+
message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.NOT_EQUALS'),
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
if (options.swagger !== false) {
|
|
63
|
+
decorators.push((0, swagger_1.ApiProperty)(Object.assign({ type: Number }, options)));
|
|
64
|
+
}
|
|
65
|
+
if (options.each) {
|
|
66
|
+
decorators.push((0, transform_decorators_1.ToArray)());
|
|
67
|
+
}
|
|
68
|
+
if (options.int) {
|
|
69
|
+
decorators.push((0, class_validator_1.IsInt)({
|
|
70
|
+
each: options.each,
|
|
71
|
+
message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_INT'),
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
decorators.push((0, class_validator_1.IsNumber)({}, {
|
|
76
|
+
each: options.each,
|
|
77
|
+
message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_NUMBER'),
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
if (typeof options.min === 'number') {
|
|
81
|
+
decorators.push((0, class_validator_1.Min)(options.min, {
|
|
82
|
+
each: options.each,
|
|
83
|
+
message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.MIN'),
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
if (typeof options.max === 'number') {
|
|
87
|
+
decorators.push((0, class_validator_1.Max)(options.max, {
|
|
88
|
+
each: options.each,
|
|
89
|
+
message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.MAX'),
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
if (options.isPositive) {
|
|
93
|
+
decorators.push((0, class_validator_1.IsPositive)({
|
|
94
|
+
each: options.each,
|
|
95
|
+
message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_POSITIVE'),
|
|
96
|
+
}));
|
|
97
|
+
}
|
|
98
|
+
return (0, common_1.applyDecorators)(...decorators);
|
|
99
|
+
}
|
|
100
|
+
function NumberFieldOptional(options = {}) {
|
|
101
|
+
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), NumberField(Object.assign({ required: false }, options)));
|
|
102
|
+
}
|
|
103
|
+
function StringField(options = {}) {
|
|
104
|
+
var _a;
|
|
105
|
+
const decorators = [
|
|
106
|
+
(0, class_transformer_1.Type)(() => String),
|
|
107
|
+
(0, class_validator_1.IsString)({
|
|
108
|
+
each: options.each,
|
|
109
|
+
message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_STRING'),
|
|
110
|
+
}),
|
|
111
|
+
];
|
|
112
|
+
if (options.nullable) {
|
|
113
|
+
decorators.push((0, validator_decorators_1.IsNullable)({ each: options.each }));
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
decorators.push((0, class_validator_1.NotEquals)(null, {
|
|
117
|
+
each: options.each,
|
|
118
|
+
message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.NOT_EQUALS'),
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
if (options.swagger !== false) {
|
|
122
|
+
decorators.push((0, swagger_1.ApiProperty)(Object.assign(Object.assign({ type: String }, options), { isArray: options.each })));
|
|
123
|
+
}
|
|
124
|
+
const minLength = (_a = options.minLength) !== null && _a !== void 0 ? _a : 1;
|
|
125
|
+
decorators.push((0, class_validator_1.MinLength)(minLength, {
|
|
126
|
+
each: options.each,
|
|
127
|
+
message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.MIN_LENGTH'),
|
|
128
|
+
}));
|
|
129
|
+
if (options.maxLength) {
|
|
130
|
+
decorators.push((0, class_validator_1.MaxLength)(options.maxLength, {
|
|
131
|
+
each: options.each,
|
|
132
|
+
message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.MAX_LENGTH'),
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
if (options.toLowerCase) {
|
|
136
|
+
decorators.push((0, transform_decorators_1.ToLowerCase)());
|
|
137
|
+
}
|
|
138
|
+
if (options.toUpperCase) {
|
|
139
|
+
decorators.push((0, transform_decorators_1.ToUpperCase)());
|
|
140
|
+
}
|
|
141
|
+
return (0, common_1.applyDecorators)(...decorators);
|
|
142
|
+
}
|
|
143
|
+
function StringFieldOptional(options = {}) {
|
|
144
|
+
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), StringField(Object.assign({ required: false }, options)));
|
|
145
|
+
}
|
|
146
|
+
function PasswordField(options = {}) {
|
|
147
|
+
const decorators = [
|
|
148
|
+
StringField(Object.assign(Object.assign({}, options), { minLength: 6 })),
|
|
149
|
+
];
|
|
150
|
+
if (options.nullable) {
|
|
151
|
+
decorators.push((0, validator_decorators_1.IsNullable)());
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
decorators.push((0, class_validator_1.NotEquals)(null));
|
|
155
|
+
}
|
|
156
|
+
return (0, common_1.applyDecorators)(...decorators);
|
|
157
|
+
}
|
|
158
|
+
function PasswordFieldOptional(options = {}) {
|
|
159
|
+
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), PasswordField(Object.assign({ required: false }, options)));
|
|
160
|
+
}
|
|
161
|
+
function BooleanField(options = {}) {
|
|
162
|
+
const decorators = [
|
|
163
|
+
(0, transform_decorators_1.ToBoolean)(),
|
|
164
|
+
(0, class_validator_1.IsBoolean)({ message: 'validation.INVALID_BOOLEAN' }),
|
|
165
|
+
];
|
|
166
|
+
if (options.nullable) {
|
|
167
|
+
decorators.push((0, validator_decorators_1.IsNullable)());
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
decorators.push((0, class_validator_1.NotEquals)(null));
|
|
171
|
+
}
|
|
172
|
+
if (options.swagger !== false) {
|
|
173
|
+
decorators.push((0, swagger_1.ApiProperty)(Object.assign({ type: Boolean }, options)));
|
|
174
|
+
}
|
|
175
|
+
return (0, common_1.applyDecorators)(...decorators);
|
|
176
|
+
}
|
|
177
|
+
function BooleanFieldOptional(options = {}) {
|
|
178
|
+
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), BooleanField(Object.assign({ required: false }, options)));
|
|
179
|
+
}
|
|
180
|
+
function TranslationsField(options) {
|
|
181
|
+
const decorators = [
|
|
182
|
+
(0, class_validator_1.ArrayMinSize)(constants_1.supportedLanguageCount),
|
|
183
|
+
(0, class_validator_1.ArrayMaxSize)(constants_1.supportedLanguageCount),
|
|
184
|
+
(0, class_validator_1.ValidateNested)({
|
|
185
|
+
each: true,
|
|
186
|
+
}),
|
|
187
|
+
(0, class_transformer_1.Type)(() => options.type),
|
|
188
|
+
];
|
|
189
|
+
if (options.nullable) {
|
|
190
|
+
decorators.push((0, validator_decorators_1.IsNullable)());
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
decorators.push((0, class_validator_1.NotEquals)(null));
|
|
194
|
+
}
|
|
195
|
+
if (options.swagger !== false) {
|
|
196
|
+
decorators.push((0, swagger_1.ApiProperty)(Object.assign({ isArray: true }, options)));
|
|
197
|
+
}
|
|
198
|
+
return (0, common_1.applyDecorators)(...decorators);
|
|
199
|
+
}
|
|
200
|
+
function TranslationsFieldOptional(options) {
|
|
201
|
+
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), TranslationsField(Object.assign({ required: false }, options)));
|
|
202
|
+
}
|
|
203
|
+
function TmpKeyField(options = {}) {
|
|
204
|
+
const decorators = [
|
|
205
|
+
StringField(options),
|
|
206
|
+
(0, validator_decorators_1.IsTmpKey)({ each: options.each }),
|
|
207
|
+
];
|
|
208
|
+
if (options.nullable) {
|
|
209
|
+
decorators.push((0, validator_decorators_1.IsNullable)());
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
decorators.push((0, class_validator_1.NotEquals)(null));
|
|
213
|
+
}
|
|
214
|
+
if (options.swagger !== false) {
|
|
215
|
+
decorators.push((0, swagger_1.ApiProperty)(Object.assign(Object.assign({ type: String }, options), { isArray: options.each })));
|
|
216
|
+
}
|
|
217
|
+
return (0, common_1.applyDecorators)(...decorators);
|
|
218
|
+
}
|
|
219
|
+
function TmpKeyFieldOptional(options = {}) {
|
|
220
|
+
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), TmpKeyField(Object.assign({ required: false }, options)));
|
|
221
|
+
}
|
|
222
|
+
function getEnumDescription(enumType) {
|
|
223
|
+
const keys = Object.keys(enumType).filter((k) => typeof enumType[k] === 'number');
|
|
224
|
+
return keys.map((k) => `${enumType[k]}: ${k}`).join(', ');
|
|
225
|
+
}
|
|
226
|
+
function EnumField(getEnum, options = {}) {
|
|
227
|
+
const enumValue = getEnum();
|
|
228
|
+
const decorators = [
|
|
229
|
+
(0, class_validator_1.IsEnum)(enumValue, {
|
|
230
|
+
each: options.each,
|
|
231
|
+
message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_ENUM'),
|
|
232
|
+
}),
|
|
233
|
+
];
|
|
234
|
+
if (options.nullable) {
|
|
235
|
+
decorators.push((0, validator_decorators_1.IsNullable)());
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
decorators.push((0, class_validator_1.NotEquals)(null));
|
|
239
|
+
}
|
|
240
|
+
if (options.each) {
|
|
241
|
+
decorators.push((0, transform_decorators_1.ToArray)());
|
|
242
|
+
}
|
|
243
|
+
if (options.swagger !== false) {
|
|
244
|
+
decorators.push((0, property_decorators_1.ApiEnumProperty)(getEnum, Object.assign(Object.assign({}, options), { isArray: options.each })));
|
|
245
|
+
}
|
|
246
|
+
return (0, common_1.applyDecorators)(...decorators);
|
|
247
|
+
}
|
|
248
|
+
function ClassField(getClass, options = {}) {
|
|
249
|
+
const classValue = getClass();
|
|
250
|
+
if (!classValue) {
|
|
251
|
+
throw new Error('ClassField: recursive class definition');
|
|
252
|
+
}
|
|
253
|
+
const decorators = [
|
|
254
|
+
(0, class_transformer_1.Type)(() => classValue),
|
|
255
|
+
(0, class_validator_1.ValidateNested)({ each: options.each }),
|
|
256
|
+
];
|
|
257
|
+
if (options.required !== false) {
|
|
258
|
+
decorators.push((0, class_validator_1.IsDefined)());
|
|
259
|
+
}
|
|
260
|
+
if (options.nullable) {
|
|
261
|
+
decorators.push((0, validator_decorators_1.IsNullable)());
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
decorators.push((0, class_validator_1.NotEquals)(null));
|
|
265
|
+
}
|
|
266
|
+
if (options.swagger !== false) {
|
|
267
|
+
decorators.push((0, swagger_1.ApiProperty)(Object.assign({ type: () => classValue, isArray: options.each }, options)));
|
|
268
|
+
}
|
|
269
|
+
if (options.each) {
|
|
270
|
+
decorators.push((0, transform_decorators_1.ToArray)());
|
|
271
|
+
}
|
|
272
|
+
return (0, common_1.applyDecorators)(...decorators);
|
|
273
|
+
}
|
|
274
|
+
function EnumFieldOptional(getEnum, options = {}) {
|
|
275
|
+
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), EnumField(getEnum, Object.assign({ required: false }, options)));
|
|
276
|
+
}
|
|
277
|
+
function ClassFieldOptional(getClass, options = {}) {
|
|
278
|
+
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), ClassField(getClass, Object.assign({ required: false }, options)));
|
|
279
|
+
}
|
|
280
|
+
function EmailField(options = {}) {
|
|
281
|
+
var _a;
|
|
282
|
+
const decorators = [
|
|
283
|
+
(0, class_validator_1.IsEmail)(options.emailOptions, Object.assign({ message: (_a = options.message) !== null && _a !== void 0 ? _a : (0, nestjs_i18n_1.i18nValidationMessage)('validation.INVALID_EMAIL') }, options)),
|
|
284
|
+
StringField(Object.assign({ toLowerCase: true }, options)),
|
|
285
|
+
];
|
|
286
|
+
if (options.nullable) {
|
|
287
|
+
decorators.push((0, validator_decorators_1.IsNullable)());
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
decorators.push((0, class_validator_1.NotEquals)(null));
|
|
291
|
+
}
|
|
292
|
+
if (options.swagger !== false) {
|
|
293
|
+
decorators.push((0, swagger_1.ApiProperty)(Object.assign({ type: String }, options)));
|
|
294
|
+
}
|
|
295
|
+
return (0, common_1.applyDecorators)(...decorators);
|
|
296
|
+
}
|
|
297
|
+
function EmailFieldOptional(options = {}) {
|
|
298
|
+
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), EmailField(Object.assign({ required: false }, options)));
|
|
299
|
+
}
|
|
300
|
+
function PhoneField(options = {}) {
|
|
301
|
+
const decorators = [(0, validator_decorators_1.IsPhoneNumber)(), (0, transform_decorators_1.PhoneNumberSerializer)()];
|
|
302
|
+
if (options.nullable) {
|
|
303
|
+
decorators.push((0, validator_decorators_1.IsNullable)());
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
decorators.push((0, class_validator_1.NotEquals)(null));
|
|
307
|
+
}
|
|
308
|
+
if (options.swagger !== false) {
|
|
309
|
+
decorators.push((0, swagger_1.ApiProperty)(Object.assign({ type: String }, options)));
|
|
310
|
+
}
|
|
311
|
+
return (0, common_1.applyDecorators)(...decorators);
|
|
312
|
+
}
|
|
313
|
+
function PhoneFieldOptional(options = {}) {
|
|
314
|
+
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), PhoneField(Object.assign({ required: false }, options)));
|
|
315
|
+
}
|
|
316
|
+
function UUIDField(options = {}) {
|
|
317
|
+
const decorators = [
|
|
318
|
+
(0, class_transformer_1.Type)(() => String),
|
|
319
|
+
(0, class_validator_1.IsUUID)('4', {
|
|
320
|
+
each: options.each,
|
|
321
|
+
message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_UUID'),
|
|
322
|
+
}),
|
|
323
|
+
];
|
|
324
|
+
if (options.nullable) {
|
|
325
|
+
decorators.push((0, validator_decorators_1.IsNullable)({ message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_NULLABLE') }));
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
decorators.push((0, class_validator_1.NotEquals)(null));
|
|
329
|
+
}
|
|
330
|
+
if (options.swagger !== false) {
|
|
331
|
+
decorators.push((0, property_decorators_1.ApiUUIDProperty)(options));
|
|
332
|
+
}
|
|
333
|
+
if (options.each) {
|
|
334
|
+
decorators.push((0, transform_decorators_1.ToArray)());
|
|
335
|
+
}
|
|
336
|
+
return (0, common_1.applyDecorators)(...decorators);
|
|
337
|
+
}
|
|
338
|
+
function UUIDFieldOptional(options = {}) {
|
|
339
|
+
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), UUIDField(Object.assign({ required: false }, options)));
|
|
340
|
+
}
|
|
341
|
+
function URLField(options = {}) {
|
|
342
|
+
const decorators = [StringField(Object.assign({}, options))];
|
|
343
|
+
if (options.simpleUrl) {
|
|
344
|
+
decorators.push((0, validator_decorators_1.IsHttpUrl)({
|
|
345
|
+
each: options.each,
|
|
346
|
+
message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_URL'),
|
|
347
|
+
}));
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
decorators.push((0, class_validator_1.IsUrl)(options.urlOptions, {
|
|
351
|
+
each: options.each,
|
|
352
|
+
message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_URL'),
|
|
353
|
+
}));
|
|
354
|
+
}
|
|
355
|
+
if (options.nullable) {
|
|
356
|
+
decorators.push((0, validator_decorators_1.IsNullable)({ each: options.each }));
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
decorators.push((0, class_validator_1.NotEquals)(null, { each: options.each }));
|
|
360
|
+
}
|
|
361
|
+
return (0, common_1.applyDecorators)(...decorators);
|
|
362
|
+
}
|
|
363
|
+
function URLFieldOptional(options = {}) {
|
|
364
|
+
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), URLField(Object.assign({ required: false }, options)));
|
|
365
|
+
}
|
|
366
|
+
function FQDNField(options = {}) {
|
|
367
|
+
const decorators = [
|
|
368
|
+
(0, class_validator_1.IsFQDN)(options, {
|
|
369
|
+
each: options.each,
|
|
370
|
+
message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_FQDN'),
|
|
371
|
+
}),
|
|
372
|
+
StringField(Object.assign({ toLowerCase: true }, options)),
|
|
373
|
+
];
|
|
374
|
+
if (options.nullable) {
|
|
375
|
+
decorators.push((0, validator_decorators_1.IsNullable)({ each: options.each }));
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
decorators.push((0, class_validator_1.NotEquals)(null, { each: options.each }));
|
|
379
|
+
}
|
|
380
|
+
return (0, common_1.applyDecorators)(...decorators);
|
|
381
|
+
}
|
|
382
|
+
function FQDNFieldOptional(options = {}) {
|
|
383
|
+
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), FQDNField(Object.assign({ required: false }, options)));
|
|
384
|
+
}
|
|
385
|
+
function DateField(options = {}) {
|
|
386
|
+
var _a;
|
|
387
|
+
const decorators = [
|
|
388
|
+
(0, class_transformer_1.Type)(() => Date),
|
|
389
|
+
(0, class_validator_1.IsDate)({ message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_DATE') }),
|
|
390
|
+
];
|
|
391
|
+
if (options.nullable) {
|
|
392
|
+
decorators.push((0, validator_decorators_1.IsNullable)());
|
|
393
|
+
}
|
|
394
|
+
else {
|
|
395
|
+
decorators.push((0, class_validator_1.NotEquals)(null));
|
|
396
|
+
}
|
|
397
|
+
if (options.minDate) {
|
|
398
|
+
decorators.push((0, class_validator_1.MinDate)(options.minDate, {
|
|
399
|
+
each: options.each,
|
|
400
|
+
message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.MIN_DATE'),
|
|
401
|
+
}));
|
|
402
|
+
}
|
|
403
|
+
if (options.maxDate) {
|
|
404
|
+
decorators.push((0, class_validator_1.MaxDate)(options.maxDate, {
|
|
405
|
+
each: options.each,
|
|
406
|
+
message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.MAX_DATE'),
|
|
407
|
+
}));
|
|
408
|
+
}
|
|
409
|
+
if (options.swagger !== false) {
|
|
410
|
+
const swaggerOptions = Object.assign({ type: Date, example: (_a = options.example) !== null && _a !== void 0 ? _a : new Date() }, options);
|
|
411
|
+
decorators.push((0, swagger_1.ApiProperty)(swaggerOptions));
|
|
412
|
+
}
|
|
413
|
+
return (0, common_1.applyDecorators)(...decorators);
|
|
414
|
+
}
|
|
415
|
+
function DateFieldOptional(options = {}) {
|
|
416
|
+
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), DateField(Object.assign(Object.assign({}, options), { required: false })));
|
|
417
|
+
}
|
|
418
|
+
function IpFieldOptional(options = {}) {
|
|
419
|
+
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), IpField(Object.assign({ required: false }, options)));
|
|
420
|
+
}
|
|
421
|
+
function IpField(options) {
|
|
422
|
+
const decorators = [
|
|
423
|
+
(0, class_validator_1.IsIP)(options.version || 4, {
|
|
424
|
+
each: options.each,
|
|
425
|
+
message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_IP'),
|
|
426
|
+
}),
|
|
427
|
+
StringField(Object.assign({ toLowerCase: true }, options)),
|
|
428
|
+
];
|
|
429
|
+
if (options.nullable) {
|
|
430
|
+
decorators.push((0, validator_decorators_1.IsNullable)({ each: options.each }));
|
|
431
|
+
}
|
|
432
|
+
else {
|
|
433
|
+
decorators.push((0, class_validator_1.NotEquals)(null, { each: options.each }));
|
|
434
|
+
}
|
|
435
|
+
return (0, common_1.applyDecorators)(...decorators);
|
|
436
|
+
}
|
|
437
|
+
function ObjectField(options = {}) {
|
|
438
|
+
const decorators = [
|
|
439
|
+
(0, class_transformer_1.Type)(() => Object),
|
|
440
|
+
(0, class_validator_1.IsObject)({
|
|
441
|
+
each: options.each,
|
|
442
|
+
message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_OBJECT'),
|
|
443
|
+
}),
|
|
444
|
+
];
|
|
445
|
+
if (options.nullable) {
|
|
446
|
+
decorators.push((0, validator_decorators_1.IsNullable)({ each: options.each }));
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
449
|
+
decorators.push((0, class_validator_1.NotEquals)(null, { each: options.each }));
|
|
450
|
+
}
|
|
451
|
+
if (options.swagger !== false) {
|
|
452
|
+
decorators.push((0, swagger_1.ApiProperty)(Object.assign({ type: 'object', isArray: options.each }, options)));
|
|
453
|
+
}
|
|
454
|
+
return (0, common_1.applyDecorators)(...decorators);
|
|
455
|
+
}
|
|
456
|
+
function ObjectFieldOptional(options = {}) {
|
|
457
|
+
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), ObjectField(Object.assign({ required: false }, options)));
|
|
458
|
+
}
|
|
459
|
+
function TimeZoneField(options = {}) {
|
|
460
|
+
const decorators = [
|
|
461
|
+
StringField(Object.assign({}, options)),
|
|
462
|
+
(0, class_validator_1.IsTimeZone)({
|
|
463
|
+
each: options.each,
|
|
464
|
+
message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_TIME_ZONE'),
|
|
465
|
+
}),
|
|
466
|
+
];
|
|
467
|
+
if (options.nullable) {
|
|
468
|
+
decorators.push((0, validator_decorators_1.IsNullable)({ each: options.each }));
|
|
469
|
+
}
|
|
470
|
+
else {
|
|
471
|
+
decorators.push((0, class_validator_1.NotEquals)(null, { each: options.each }));
|
|
472
|
+
}
|
|
473
|
+
return (0, common_1.applyDecorators)(...decorators);
|
|
474
|
+
}
|
|
475
|
+
function TimeZoneFieldOptional(options = {}) {
|
|
476
|
+
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), TimeZoneField(Object.assign({ required: false }, options)));
|
|
477
|
+
}
|
|
478
|
+
function LocaleField(options = {}) {
|
|
479
|
+
const decorators = [
|
|
480
|
+
StringField(Object.assign({}, options)),
|
|
481
|
+
(0, class_validator_1.IsLocale)({
|
|
482
|
+
each: options.each,
|
|
483
|
+
message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_LOCALE'),
|
|
484
|
+
}),
|
|
485
|
+
];
|
|
486
|
+
if (options.nullable) {
|
|
487
|
+
decorators.push((0, validator_decorators_1.IsNullable)({ each: options.each }));
|
|
488
|
+
}
|
|
489
|
+
else {
|
|
490
|
+
decorators.push((0, class_validator_1.NotEquals)(null, { each: options.each }));
|
|
491
|
+
}
|
|
492
|
+
if (options.swagger !== false) {
|
|
493
|
+
decorators.push((0, swagger_1.ApiProperty)(Object.assign({ type: String }, options)));
|
|
494
|
+
}
|
|
495
|
+
return (0, common_1.applyDecorators)(...decorators);
|
|
496
|
+
}
|
|
497
|
+
function LocaleFieldOptional(options = {}) {
|
|
498
|
+
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), LocaleField(Object.assign({ required: false }, options)));
|
|
499
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UUIDParam = UUIDParam;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
function UUIDParam(property, ...pipes) {
|
|
6
|
+
return (0, common_1.Param)(property, new common_1.ParseUUIDPipe({ version: '4' }), ...pipes);
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './api-page-ok-response.decorator';
|
|
2
|
+
export * from './auth-user.decorator';
|
|
3
|
+
export * from './field.decorators';
|
|
4
|
+
export * from './http.decorators';
|
|
5
|
+
export * from './property.decorators';
|
|
6
|
+
export * from './public-route.decorator';
|
|
7
|
+
export * from './swagger.schema';
|
|
8
|
+
export * from './transform.decorators';
|
|
9
|
+
export * from './translate.decorator';
|
|
10
|
+
export * from './use-dto.decorator';
|
|
11
|
+
export * from './validator.decorators';
|
|
12
|
+
export * from './controller.decorator';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./api-page-ok-response.decorator"), exports);
|
|
18
|
+
__exportStar(require("./auth-user.decorator"), exports);
|
|
19
|
+
__exportStar(require("./field.decorators"), exports);
|
|
20
|
+
__exportStar(require("./http.decorators"), exports);
|
|
21
|
+
__exportStar(require("./property.decorators"), exports);
|
|
22
|
+
__exportStar(require("./public-route.decorator"), exports);
|
|
23
|
+
__exportStar(require("./swagger.schema"), exports);
|
|
24
|
+
__exportStar(require("./transform.decorators"), exports);
|
|
25
|
+
__exportStar(require("./translate.decorator"), exports);
|
|
26
|
+
__exportStar(require("./use-dto.decorator"), exports);
|
|
27
|
+
__exportStar(require("./validator.decorators"), exports);
|
|
28
|
+
__exportStar(require("./controller.decorator"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const OperationLog: (operation: string) => import("@nestjs/common").CustomDecorator<string>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OperationLog = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const OperationLog = (operation) => (0, common_1.SetMetadata)('operation-log', operation);
|
|
6
|
+
exports.OperationLog = OperationLog;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ApiPropertyOptions } from '@nestjs/swagger';
|
|
2
|
+
export declare function ApiBooleanProperty(options?: Omit<ApiPropertyOptions, 'type'>): PropertyDecorator;
|
|
3
|
+
export declare function ApiBooleanPropertyOptional(options?: Omit<ApiPropertyOptions, 'type' | 'required'>): PropertyDecorator;
|
|
4
|
+
export declare function ApiUUIDProperty(options?: Omit<ApiPropertyOptions, 'type' | 'format'> & Partial<{
|
|
5
|
+
each: boolean;
|
|
6
|
+
}>): PropertyDecorator;
|
|
7
|
+
export declare function ApiUUIDPropertyOptional(options?: Omit<ApiPropertyOptions, 'type' | 'format' | 'required'> & Partial<{
|
|
8
|
+
each: boolean;
|
|
9
|
+
}>): PropertyDecorator;
|
|
10
|
+
export declare function ApiEnumProperty<TEnum>(getEnum: () => TEnum, options?: Omit<ApiPropertyOptions, 'type'> & {
|
|
11
|
+
each?: boolean;
|
|
12
|
+
}): PropertyDecorator;
|
|
13
|
+
export declare function ApiEnumPropertyOptional<TEnum>(getEnum: () => TEnum, options?: Omit<ApiPropertyOptions, 'type' | 'required'> & {
|
|
14
|
+
each?: boolean;
|
|
15
|
+
}): PropertyDecorator;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiBooleanProperty = ApiBooleanProperty;
|
|
4
|
+
exports.ApiBooleanPropertyOptional = ApiBooleanPropertyOptional;
|
|
5
|
+
exports.ApiUUIDProperty = ApiUUIDProperty;
|
|
6
|
+
exports.ApiUUIDPropertyOptional = ApiUUIDPropertyOptional;
|
|
7
|
+
exports.ApiEnumProperty = ApiEnumProperty;
|
|
8
|
+
exports.ApiEnumPropertyOptional = ApiEnumPropertyOptional;
|
|
9
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
10
|
+
const utils_1 = require("../common/utils");
|
|
11
|
+
const field_decorators_1 = require("../decorators/field.decorators");
|
|
12
|
+
function ApiBooleanProperty(options = {}) {
|
|
13
|
+
return (0, swagger_1.ApiProperty)(Object.assign({ type: Boolean }, options));
|
|
14
|
+
}
|
|
15
|
+
function ApiBooleanPropertyOptional(options = {}) {
|
|
16
|
+
return ApiBooleanProperty(Object.assign({ required: false }, options));
|
|
17
|
+
}
|
|
18
|
+
function ApiUUIDProperty(options = {}) {
|
|
19
|
+
return (0, swagger_1.ApiProperty)(Object.assign({ type: options.each ? [String] : String, format: 'uuid', isArray: options.each }, options));
|
|
20
|
+
}
|
|
21
|
+
function ApiUUIDPropertyOptional(options = {}) {
|
|
22
|
+
return ApiUUIDProperty(Object.assign({ required: false }, options));
|
|
23
|
+
}
|
|
24
|
+
function ApiEnumProperty(getEnum, options = {}) {
|
|
25
|
+
const enumValue = getEnum();
|
|
26
|
+
options.description = (0, field_decorators_1.getEnumDescription)(enumValue);
|
|
27
|
+
return (0, swagger_1.ApiProperty)(Object.assign({ enum: enumValue, enumName: (0, utils_1.getVariableName)(getEnum) }, options));
|
|
28
|
+
}
|
|
29
|
+
function ApiEnumPropertyOptional(getEnum, options = {}) {
|
|
30
|
+
return ApiEnumProperty(getEnum, Object.assign({ required: false }, options));
|
|
31
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PublicRoute = exports.PUBLIC_ROUTE_KEY = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
exports.PUBLIC_ROUTE_KEY = 'public_route';
|
|
6
|
+
const PublicRoute = (isPublic = false) => (0, common_1.SetMetadata)(exports.PUBLIC_ROUTE_KEY, isPublic);
|
|
7
|
+
exports.PublicRoute = PublicRoute;
|