@nest-omni/core 2.0.1-9 → 3.1.1-9

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.
Files changed (205) hide show
  1. package/index.js +4 -0
  2. package/package.json +150 -46
  3. package/.hygen/new/crud/controller.ejs.t +0 -82
  4. package/.hygen/new/crud/create.dto.ejs.t +0 -12
  5. package/.hygen/new/crud/entity.ejs.t +0 -26
  6. package/.hygen/new/crud/get.dto.ejs.t +0 -19
  7. package/.hygen/new/crud/index-dto.ejs.t +0 -29
  8. package/.hygen/new/crud/index-response.dto.ejs.t +0 -18
  9. package/.hygen/new/crud/module.ejs.t +0 -32
  10. package/.hygen/new/crud/prompt.js +0 -89
  11. package/.hygen/new/crud/service.ejs.t +0 -76
  12. package/.hygen/new/crud/update.dto.ejs.t +0 -11
  13. package/.hygen/new/module/controller.ejs.t +0 -93
  14. package/.hygen/new/module/create-command.ejs.t +0 -90
  15. package/.hygen/new/module/create.dto.ejs.t +0 -11
  16. package/.hygen/new/module/dto.ejs.t +0 -24
  17. package/.hygen/new/module/entity.ejs.t +0 -33
  18. package/.hygen/new/module/get-query.ejs.t +0 -57
  19. package/.hygen/new/module/module.ejs.t +0 -44
  20. package/.hygen/new/module/not-found.exception.ejs.t +0 -18
  21. package/.hygen/new/module/page-options.dto.ejs.t +0 -12
  22. package/.hygen/new/module/prompt.js +0 -104
  23. package/.hygen/new/module/repository.ejs.t +0 -16
  24. package/.hygen/new/module/service.ejs.t +0 -139
  25. package/.hygen/new/module/translation-dto.ejs.t +0 -27
  26. package/.hygen/new/module/translation-entity.ejs.t +0 -40
  27. package/.hygen/new/module/translation-repository.ejs.t +0 -16
  28. package/.hygen/new/module/update.dto.ejs.t +0 -10
  29. package/.hygen.js +0 -116
  30. package/common/abstract-client.service.d.ts +0 -16
  31. package/common/abstract-client.service.js +0 -35
  32. package/common/abstract.entity.d.ts +0 -18
  33. package/common/abstract.entity.js +0 -78
  34. package/common/boilerplate.polyfill.d.ts +0 -39
  35. package/common/boilerplate.polyfill.js +0 -77
  36. package/common/dto/abstract.dto.d.ts +0 -13
  37. package/common/dto/abstract.dto.js +0 -59
  38. package/common/dto/bulk-id.dto.d.ts +0 -3
  39. package/common/dto/bulk-id.dto.js +0 -27
  40. package/common/dto/create-translation.dto.d.ts +0 -5
  41. package/common/dto/create-translation.dto.js +0 -25
  42. package/common/dto/index.d.ts +0 -6
  43. package/common/dto/index.js +0 -22
  44. package/common/dto/page-meta.dto.d.ts +0 -15
  45. package/common/dto/page-meta.dto.js +0 -48
  46. package/common/dto/page-options.dto.d.ts +0 -8
  47. package/common/dto/page-options.dto.js +0 -52
  48. package/common/dto/page.dto.d.ts +0 -11
  49. package/common/dto/page.dto.js +0 -53
  50. package/common/index.d.ts +0 -7
  51. package/common/index.js +0 -23
  52. package/common/snake-naming.strategy.d.ts +0 -11
  53. package/common/snake-naming.strategy.js +0 -37
  54. package/common/types.d.ts +0 -9
  55. package/common/types.js +0 -2
  56. package/common/utils.d.ts +0 -3
  57. package/common/utils.js +0 -24
  58. package/constants/index.d.ts +0 -2
  59. package/constants/index.js +0 -18
  60. package/constants/language-code.d.ts +0 -5
  61. package/constants/language-code.js +0 -9
  62. package/constants/order.d.ts +0 -4
  63. package/constants/order.js +0 -8
  64. package/decorators/api-page-ok-response.decorator.d.ts +0 -5
  65. package/decorators/api-page-ok-response.decorator.js +0 -24
  66. package/decorators/auth-user.decorator.d.ts +0 -1
  67. package/decorators/auth-user.decorator.js +0 -14
  68. package/decorators/controller.decorator.d.ts +0 -1
  69. package/decorators/controller.decorator.js +0 -10
  70. package/decorators/field.decorators.d.ts +0 -79
  71. package/decorators/field.decorators.js +0 -497
  72. package/decorators/http.decorators.d.ts +0 -3
  73. package/decorators/http.decorators.js +0 -7
  74. package/decorators/index.d.ts +0 -12
  75. package/decorators/index.js +0 -28
  76. package/decorators/operation.decorator.d.ts +0 -1
  77. package/decorators/operation.decorator.js +0 -6
  78. package/decorators/property.decorators.d.ts +0 -15
  79. package/decorators/property.decorators.js +0 -31
  80. package/decorators/public-route.decorator.d.ts +0 -3
  81. package/decorators/public-route.decorator.js +0 -7
  82. package/decorators/swagger.schema.d.ts +0 -5
  83. package/decorators/swagger.schema.js +0 -78
  84. package/decorators/timestamp-column.decorator.d.ts +0 -1
  85. package/decorators/timestamp-column.decorator.js +0 -27
  86. package/decorators/transform.decorators.d.ts +0 -8
  87. package/decorators/transform.decorators.js +0 -100
  88. package/decorators/translate.decorator.d.ts +0 -5
  89. package/decorators/translate.decorator.js +0 -17
  90. package/decorators/use-dto.decorator.d.ts +0 -4
  91. package/decorators/use-dto.decorator.js +0 -8
  92. package/decorators/user-check.decorator.d.ts +0 -6
  93. package/decorators/user-check.decorator.js +0 -21
  94. package/decorators/user.decorator.d.ts +0 -12
  95. package/decorators/user.decorator.js +0 -44
  96. package/decorators/user_auth.decorator.d.ts +0 -1
  97. package/decorators/user_auth.decorator.js +0 -15
  98. package/decorators/validator.decorators.d.ts +0 -11
  99. package/decorators/validator.decorators.js +0 -78
  100. package/exceptions/file-not-image.exception.d.ts +0 -4
  101. package/exceptions/file-not-image.exception.js +0 -10
  102. package/exceptions/index.d.ts +0 -2
  103. package/exceptions/index.js +0 -18
  104. package/exceptions/page-type.exception.d.ts +0 -4
  105. package/exceptions/page-type.exception.js +0 -10
  106. package/exceptions/user-not-found.exception.d.ts +0 -4
  107. package/exceptions/user-not-found.exception.js +0 -10
  108. package/filters/bad-request.filter.d.ts +0 -5
  109. package/filters/bad-request.filter.js +0 -71
  110. package/filters/constraint-errors.d.ts +0 -1
  111. package/filters/constraint-errors.js +0 -6
  112. package/filters/index.d.ts +0 -3
  113. package/filters/index.js +0 -19
  114. package/filters/query-failed.filter.d.ts +0 -10
  115. package/filters/query-failed.filter.js +0 -42
  116. package/health-checker/health-checker.controller.d.ts +0 -15
  117. package/health-checker/health-checker.controller.js +0 -72
  118. package/health-checker/health-checker.module.d.ts +0 -2
  119. package/health-checker/health-checker.module.js +0 -25
  120. package/health-checker/health-indicators/service.indicator.d.ts +0 -8
  121. package/health-checker/health-indicators/service.indicator.js +0 -66
  122. package/helpers/common.helper.d.ts +0 -3
  123. package/helpers/common.helper.js +0 -36
  124. package/helpers/date.helper.d.ts +0 -10
  125. package/helpers/date.helper.js +0 -57
  126. package/helpers/index.d.ts +0 -2
  127. package/helpers/index.js +0 -18
  128. package/i18n/en_US/validation.json +0 -41
  129. package/i18n/zh_CN/validation.json +0 -41
  130. package/index.d.ts +0 -11
  131. package/interceptors/index.d.ts +0 -2
  132. package/interceptors/index.js +0 -18
  133. package/interceptors/language-interceptor.service.d.ts +0 -6
  134. package/interceptors/language-interceptor.service.js +0 -29
  135. package/interceptors/translation-interceptor.service.d.ts +0 -5
  136. package/interceptors/translation-interceptor.service.js +0 -34
  137. package/interfaces/IApiFile.d.ts +0 -4
  138. package/interfaces/IApiFile.js +0 -2
  139. package/interfaces/IFile.d.ts +0 -8
  140. package/interfaces/IFile.js +0 -2
  141. package/interfaces/ITranslationDecoratorInterface.d.ts +0 -3
  142. package/interfaces/ITranslationDecoratorInterface.js +0 -2
  143. package/interfaces/index.d.ts +0 -3
  144. package/interfaces/index.js +0 -19
  145. package/interfaces/response.d.ts +0 -25
  146. package/interfaces/response.js +0 -2
  147. package/middlewares/index.d.ts +0 -4
  148. package/middlewares/index.js +0 -20
  149. package/middlewares/omni-auth.middleware.d.ts +0 -1
  150. package/middlewares/omni-auth.middleware.js +0 -13
  151. package/middlewares/powerby.middleware.d.ts +0 -1
  152. package/middlewares/powerby.middleware.js +0 -10
  153. package/middlewares/request-id.middleware.d.ts +0 -7
  154. package/middlewares/request-id.middleware.js +0 -22
  155. package/middlewares/xml.middleware.d.ts +0 -4
  156. package/middlewares/xml.middleware.js +0 -24
  157. package/providers/context.provider.d.ts +0 -34
  158. package/providers/context.provider.js +0 -80
  159. package/providers/generator.provider.d.ts +0 -9
  160. package/providers/generator.provider.js +0 -50
  161. package/providers/index.d.ts +0 -2
  162. package/providers/index.js +0 -18
  163. package/setup/bootstrap.setup.d.ts +0 -2
  164. package/setup/bootstrap.setup.js +0 -227
  165. package/setup/index.d.ts +0 -1
  166. package/setup/index.js +0 -17
  167. package/shared/index.d.ts +0 -2
  168. package/shared/index.js +0 -18
  169. package/shared/serviceRegistryModule.d.ts +0 -2
  170. package/shared/serviceRegistryModule.js +0 -111
  171. package/shared/services/api-config.service.d.ts +0 -58
  172. package/shared/services/api-config.service.js +0 -302
  173. package/shared/services/generator.service.d.ts +0 -4
  174. package/shared/services/generator.service.js +0 -23
  175. package/shared/services/index.d.ts +0 -4
  176. package/shared/services/index.js +0 -20
  177. package/shared/services/translation.service.d.ts +0 -9
  178. package/shared/services/translation.service.js +0 -70
  179. package/shared/services/validator.service.d.ts +0 -3
  180. package/shared/services/validator.service.js +0 -20
  181. package/tsconfig.tsbuildinfo +0 -1
  182. package/validator-json/decorators.d.ts +0 -6
  183. package/validator-json/decorators.js +0 -22
  184. package/validator-json/default.d.ts +0 -6
  185. package/validator-json/default.js +0 -130
  186. package/validator-json/defaultConverters.d.ts +0 -8
  187. package/validator-json/defaultConverters.js +0 -376
  188. package/validator-json/index.d.ts +0 -4
  189. package/validator-json/index.js +0 -20
  190. package/validator-json/options.d.ts +0 -11
  191. package/validator-json/options.js +0 -10
  192. package/validators/file-mimetype.validator.d.ts +0 -13
  193. package/validators/file-mimetype.validator.js +0 -21
  194. package/validators/index.d.ts +0 -6
  195. package/validators/index.js +0 -22
  196. package/validators/is-exists.validator.d.ts +0 -18
  197. package/validators/is-exists.validator.js +0 -62
  198. package/validators/is-unique.validator.d.ts +0 -17
  199. package/validators/is-unique.validator.js +0 -93
  200. package/validators/phone-country-code.validator.d.ts +0 -2
  201. package/validators/phone-country-code.validator.js +0 -29
  202. package/validators/same-as.validator.d.ts +0 -2
  203. package/validators/same-as.validator.js +0 -24
  204. package/validators/skip-empty.validator.d.ts +0 -1
  205. package/validators/skip-empty.validator.js +0 -17
@@ -1,18 +0,0 @@
1
- import type { ValidationArguments, ValidationOptions, ValidatorConstraintInterface } from 'class-validator';
2
- import type { EntitySchema, FindOptionsWhere, ObjectType } from 'typeorm';
3
- import { DataSource } from 'typeorm';
4
- export declare class IsExistsValidator implements ValidatorConstraintInterface {
5
- private readonly dataSource;
6
- constructor(dataSource: DataSource);
7
- validate<E>(value: string, args: IExistsValidationArguments<E>): Promise<boolean>;
8
- defaultMessage(args: ValidationArguments): string;
9
- }
10
- type ExistsValidationConstraints<E> = [
11
- ObjectType<E> | EntitySchema<E> | string,
12
- (validationArguments: ValidationArguments) => FindOptionsWhere<E>
13
- ];
14
- interface IExistsValidationArguments<E> extends ValidationArguments {
15
- constraints: ExistsValidationConstraints<E>;
16
- }
17
- export declare function IsExists<E>(constraints: Partial<ExistsValidationConstraints<E>>, validationOptions?: ValidationOptions): PropertyDecorator;
18
- export {};
@@ -1,62 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
- return new (P || (P = Promise))(function (resolve, reject) {
14
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
- step((generator = generator.apply(thisArg, _arguments || [])).next());
18
- });
19
- };
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.IsExistsValidator = void 0;
22
- exports.IsExists = IsExists;
23
- const class_validator_1 = require("class-validator");
24
- const typeorm_1 = require("typeorm");
25
- const typeorm_transactional_1 = require("typeorm-transactional");
26
- const nestjs_i18n_1 = require("nestjs-i18n");
27
- const common_1 = require("@nestjs/common");
28
- let IsExistsValidator = class IsExistsValidator {
29
- constructor(dataSource) {
30
- this.dataSource = dataSource;
31
- this.dataSource = (0, typeorm_transactional_1.getDataSourceByName)('default');
32
- }
33
- validate(value, args) {
34
- return __awaiter(this, void 0, void 0, function* () {
35
- const [entityClass, findCondition] = args.constraints;
36
- args.value = value;
37
- return ((yield this.dataSource.getRepository(entityClass).count({
38
- where: findCondition(args),
39
- })) > 0);
40
- });
41
- }
42
- defaultMessage(args) {
43
- return (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_EXISTS')(args);
44
- }
45
- };
46
- exports.IsExistsValidator = IsExistsValidator;
47
- exports.IsExistsValidator = IsExistsValidator = __decorate([
48
- (0, common_1.Injectable)(),
49
- (0, class_validator_1.ValidatorConstraint)({ name: 'isExists', async: true }),
50
- __metadata("design:paramtypes", [typeorm_1.DataSource])
51
- ], IsExistsValidator);
52
- function IsExists(constraints, validationOptions) {
53
- return (object, propertyName) => {
54
- (0, class_validator_1.registerDecorator)({
55
- target: object.constructor,
56
- propertyName,
57
- options: validationOptions,
58
- constraints,
59
- validator: IsExistsValidator,
60
- });
61
- };
62
- }
@@ -1,17 +0,0 @@
1
- import type { ValidationArguments, ValidationOptions, ValidatorConstraintInterface } from 'class-validator';
2
- import { DataSource, EntitySchema, FindOptionsWhere, ObjectType } from 'typeorm';
3
- export declare class IsUniqueValidator implements ValidatorConstraintInterface {
4
- private readonly dataSource;
5
- constructor(dataSource: DataSource);
6
- validate<E>(value: string, args: IUniqueValidationArguments<E>): Promise<boolean>;
7
- defaultMessage(args: ValidationArguments): string;
8
- }
9
- type UniqueValidationConstraints<E> = [
10
- ObjectType<E> | EntitySchema<E> | string,
11
- (validationArguments: ValidationArguments) => FindOptionsWhere<E>
12
- ];
13
- interface IUniqueValidationArguments<E> extends ValidationArguments {
14
- constraints: UniqueValidationConstraints<E>;
15
- }
16
- export declare function IsUnique<E>(constraints: Partial<UniqueValidationConstraints<E>>, validationOptions?: ValidationOptions): PropertyDecorator;
17
- export {};
@@ -1,93 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
- return new (P || (P = Promise))(function (resolve, reject) {
14
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
- step((generator = generator.apply(thisArg, _arguments || [])).next());
18
- });
19
- };
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.IsUniqueValidator = void 0;
22
- exports.IsUnique = IsUnique;
23
- const class_validator_1 = require("class-validator");
24
- const typeorm_1 = require("typeorm");
25
- const typeorm_transactional_1 = require("typeorm-transactional");
26
- const nestjs_i18n_1 = require("nestjs-i18n");
27
- let IsUniqueValidator = class IsUniqueValidator {
28
- constructor(dataSource) {
29
- this.dataSource = dataSource;
30
- this.dataSource = (0, typeorm_transactional_1.getDataSourceByName)('default');
31
- }
32
- validate(value, args) {
33
- return __awaiter(this, void 0, void 0, function* () {
34
- const [entityClass, findCondition] = args.constraints;
35
- args.value = value;
36
- let exists;
37
- const defCon = findCondition(args);
38
- const pkCols = this.dataSource
39
- .getMetadata(entityClass)
40
- .primaryColumns.map((column) => column.propertyName);
41
- const isNew = pkCols.some((pk) => args.object[pk]);
42
- if (!isNew) {
43
- exists =
44
- (yield this.dataSource
45
- .getRepository(entityClass)
46
- .count({ where: defCon })) < 1;
47
- }
48
- else {
49
- const entities = yield this.dataSource
50
- .getRepository(entityClass)
51
- .createQueryBuilder()
52
- .where(defCon)
53
- .select(pkCols)
54
- .limit(2)
55
- .execute();
56
- const entityCount = entities.length;
57
- if (entityCount === 1) {
58
- const entity = entities[0];
59
- const oldPk = {};
60
- const newPk = {};
61
- pkCols.map((pk) => {
62
- oldPk[pk] = entity[pk];
63
- newPk[pk] = args.object[pk];
64
- });
65
- exists = JSON.stringify(oldPk) === JSON.stringify(newPk);
66
- }
67
- else {
68
- exists = entityCount < 1;
69
- }
70
- }
71
- return exists;
72
- });
73
- }
74
- defaultMessage(args) {
75
- return (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_UNIQUE')(args);
76
- }
77
- };
78
- exports.IsUniqueValidator = IsUniqueValidator;
79
- exports.IsUniqueValidator = IsUniqueValidator = __decorate([
80
- (0, class_validator_1.ValidatorConstraint)({ name: 'isUnique', async: true }),
81
- __metadata("design:paramtypes", [typeorm_1.DataSource])
82
- ], IsUniqueValidator);
83
- function IsUnique(constraints, validationOptions) {
84
- return function (object, propertyName) {
85
- (0, class_validator_1.registerDecorator)({
86
- target: object.constructor,
87
- propertyName,
88
- options: validationOptions,
89
- constraints,
90
- validator: IsUniqueValidator,
91
- });
92
- };
93
- }
@@ -1,2 +0,0 @@
1
- import { ValidationOptions } from 'class-validator';
2
- export declare function IsPhoneNumberWithCountryCode(validationOptions?: ValidationOptions): (object: NonNullable<unknown>, propertyName: string) => void;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IsPhoneNumberWithCountryCode = IsPhoneNumberWithCountryCode;
4
- const class_validator_1 = require("class-validator");
5
- function IsPhoneNumberWithCountryCode(validationOptions) {
6
- return function (object, propertyName) {
7
- (0, class_validator_1.ValidateIf)((_, value) => !!value)(object, propertyName);
8
- const countryCodePropertyName = 'countryCode';
9
- (0, class_validator_1.registerDecorator)({
10
- name: 'isPhoneNumberWithCountryCode',
11
- target: object.constructor,
12
- propertyName: propertyName,
13
- constraints: [countryCodePropertyName],
14
- options: validationOptions,
15
- validator: {
16
- validate(value, args) {
17
- const [countryCodePropertyName] = args.constraints;
18
- const countryCode = args.object[countryCodePropertyName];
19
- return (0, class_validator_1.isPhoneNumber)(value, countryCode);
20
- },
21
- defaultMessage(args) {
22
- const [countryCodePropertyName] = args.constraints;
23
- const countryCode = args.object[countryCodePropertyName];
24
- return `$property must be a valid phone number in the country code ${countryCode}`;
25
- },
26
- },
27
- });
28
- };
29
- }
@@ -1,2 +0,0 @@
1
- import type { ValidationOptions } from 'class-validator';
2
- export declare function SameAs(property: string, validationOptions?: ValidationOptions): PropertyDecorator;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SameAs = SameAs;
4
- const class_validator_1 = require("class-validator");
5
- function SameAs(property, validationOptions) {
6
- return function (object, propertyName) {
7
- (0, class_validator_1.registerDecorator)({
8
- name: 'sameAs',
9
- target: object.constructor,
10
- propertyName,
11
- options: validationOptions,
12
- constraints: [property],
13
- validator: {
14
- validate(value, args) {
15
- const [relatedPropertyName] = args.constraints;
16
- return (args === null || args === void 0 ? void 0 : args.object[relatedPropertyName]) === value;
17
- },
18
- defaultMessage() {
19
- return '$property must match $constraint1';
20
- },
21
- },
22
- });
23
- };
24
- }
@@ -1 +0,0 @@
1
- export declare function SkipEmpty(field?: string): <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SkipEmpty = SkipEmpty;
4
- const common_1 = require("@nestjs/common");
5
- const swagger_1 = require("@nestjs/swagger");
6
- const class_validator_1 = require("class-validator");
7
- const lodash_1 = require("lodash");
8
- function SkipEmpty(field) {
9
- return (0, common_1.applyDecorators)((0, swagger_1.ApiProperty)({ required: false }), (0, class_validator_1.ValidateIf)((obj, value) => {
10
- if (field) {
11
- value = obj[field];
12
- }
13
- return !(value === null ||
14
- value === undefined ||
15
- ((0, lodash_1.isString)(value) && value.trim() === ''));
16
- }));
17
- }