@steroidsjs/nest 1.0.0

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 (127) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/domain/base/BaseEnum.d.ts +9 -0
  4. package/domain/base/BaseEnum.js +35 -0
  5. package/domain/base/BaseEnum.js.map +1 -0
  6. package/index.d.ts +0 -0
  7. package/index.js +1 -0
  8. package/index.js.map +1 -0
  9. package/infrastructure/commands/MigrateCommand.d.ts +23 -0
  10. package/infrastructure/commands/MigrateCommand.js +186 -0
  11. package/infrastructure/commands/MigrateCommand.js.map +1 -0
  12. package/infrastructure/decorators/ApiOkSearchResponse.d.ts +1 -0
  13. package/infrastructure/decorators/ApiOkSearchResponse.js +25 -0
  14. package/infrastructure/decorators/ApiOkSearchResponse.js.map +1 -0
  15. package/infrastructure/decorators/fields/BaseField.d.ts +17 -0
  16. package/infrastructure/decorators/fields/BaseField.js +24 -0
  17. package/infrastructure/decorators/fields/BaseField.js.map +1 -0
  18. package/infrastructure/decorators/fields/BooleanField.d.ts +2 -0
  19. package/infrastructure/decorators/fields/BooleanField.js +17 -0
  20. package/infrastructure/decorators/fields/BooleanField.js.map +1 -0
  21. package/infrastructure/decorators/fields/CoordinateField.d.ts +7 -0
  22. package/infrastructure/decorators/fields/CoordinateField.js +18 -0
  23. package/infrastructure/decorators/fields/CoordinateField.js.map +1 -0
  24. package/infrastructure/decorators/fields/CreateTimeField.d.ts +5 -0
  25. package/infrastructure/decorators/fields/CreateTimeField.js +35 -0
  26. package/infrastructure/decorators/fields/CreateTimeField.js.map +1 -0
  27. package/infrastructure/decorators/fields/DateField.d.ts +2 -0
  28. package/infrastructure/decorators/fields/DateField.js +17 -0
  29. package/infrastructure/decorators/fields/DateField.js.map +1 -0
  30. package/infrastructure/decorators/fields/DateTimeField.d.ts +5 -0
  31. package/infrastructure/decorators/fields/DateTimeField.js +19 -0
  32. package/infrastructure/decorators/fields/DateTimeField.js.map +1 -0
  33. package/infrastructure/decorators/fields/DecimalField.d.ts +7 -0
  34. package/infrastructure/decorators/fields/DecimalField.js +18 -0
  35. package/infrastructure/decorators/fields/DecimalField.js.map +1 -0
  36. package/infrastructure/decorators/fields/EmailField.d.ts +2 -0
  37. package/infrastructure/decorators/fields/EmailField.js +19 -0
  38. package/infrastructure/decorators/fields/EmailField.js.map +1 -0
  39. package/infrastructure/decorators/fields/EnumField.d.ts +6 -0
  40. package/infrastructure/decorators/fields/EnumField.js +31 -0
  41. package/infrastructure/decorators/fields/EnumField.js.map +1 -0
  42. package/infrastructure/decorators/fields/ExtendField.d.ts +5 -0
  43. package/infrastructure/decorators/fields/ExtendField.js +20 -0
  44. package/infrastructure/decorators/fields/ExtendField.js.map +1 -0
  45. package/infrastructure/decorators/fields/ExtendFields.d.ts +1 -0
  46. package/infrastructure/decorators/fields/ExtendFields.js +15 -0
  47. package/infrastructure/decorators/fields/ExtendFields.js.map +1 -0
  48. package/infrastructure/decorators/fields/FileField.d.ts +2 -0
  49. package/infrastructure/decorators/fields/FileField.js +16 -0
  50. package/infrastructure/decorators/fields/FileField.js.map +1 -0
  51. package/infrastructure/decorators/fields/HtmlField.d.ts +2 -0
  52. package/infrastructure/decorators/fields/HtmlField.js +15 -0
  53. package/infrastructure/decorators/fields/HtmlField.js.map +1 -0
  54. package/infrastructure/decorators/fields/IntegerField.d.ts +2 -0
  55. package/infrastructure/decorators/fields/IntegerField.js +22 -0
  56. package/infrastructure/decorators/fields/IntegerField.js.map +1 -0
  57. package/infrastructure/decorators/fields/PasswordField.d.ts +2 -0
  58. package/infrastructure/decorators/fields/PasswordField.js +20 -0
  59. package/infrastructure/decorators/fields/PasswordField.js.map +1 -0
  60. package/infrastructure/decorators/fields/PhoneField.d.ts +2 -0
  61. package/infrastructure/decorators/fields/PhoneField.js +20 -0
  62. package/infrastructure/decorators/fields/PhoneField.js.map +1 -0
  63. package/infrastructure/decorators/fields/PrimaryKeyField.d.ts +2 -0
  64. package/infrastructure/decorators/fields/PrimaryKeyField.js +14 -0
  65. package/infrastructure/decorators/fields/PrimaryKeyField.js.map +1 -0
  66. package/infrastructure/decorators/fields/RelationField.d.ts +6 -0
  67. package/infrastructure/decorators/fields/RelationField.js +16 -0
  68. package/infrastructure/decorators/fields/RelationField.js.map +1 -0
  69. package/infrastructure/decorators/fields/StringField.d.ts +2 -0
  70. package/infrastructure/decorators/fields/StringField.js +24 -0
  71. package/infrastructure/decorators/fields/StringField.js.map +1 -0
  72. package/infrastructure/decorators/fields/TextField.d.ts +2 -0
  73. package/infrastructure/decorators/fields/TextField.js +16 -0
  74. package/infrastructure/decorators/fields/TextField.js.map +1 -0
  75. package/infrastructure/decorators/fields/TimeField.d.ts +2 -0
  76. package/infrastructure/decorators/fields/TimeField.js +17 -0
  77. package/infrastructure/decorators/fields/TimeField.js.map +1 -0
  78. package/infrastructure/decorators/fields/UidField.d.ts +2 -0
  79. package/infrastructure/decorators/fields/UidField.js +34 -0
  80. package/infrastructure/decorators/fields/UidField.js.map +1 -0
  81. package/infrastructure/decorators/fields/UpdateTimeField.d.ts +5 -0
  82. package/infrastructure/decorators/fields/UpdateTimeField.js +37 -0
  83. package/infrastructure/decorators/fields/UpdateTimeField.js.map +1 -0
  84. package/infrastructure/decorators/fields/index.d.ts +18 -0
  85. package/infrastructure/decorators/fields/index.js +40 -0
  86. package/infrastructure/decorators/fields/index.js.map +1 -0
  87. package/infrastructure/exception/ValidationException.d.ts +5 -0
  88. package/infrastructure/exception/ValidationException.js +12 -0
  89. package/infrastructure/exception/ValidationException.js.map +1 -0
  90. package/infrastructure/helpers/ConditionHelper.d.ts +8 -0
  91. package/infrastructure/helpers/ConditionHelper.js +74 -0
  92. package/infrastructure/helpers/ConditionHelper.js.map +1 -0
  93. package/infrastructure/helpers/DataMapperHelper.d.ts +4 -0
  94. package/infrastructure/helpers/DataMapperHelper.js +18 -0
  95. package/infrastructure/helpers/DataMapperHelper.js.map +1 -0
  96. package/infrastructure/helpers/MetaHelper.d.ts +5 -0
  97. package/infrastructure/helpers/MetaHelper.js +35 -0
  98. package/infrastructure/helpers/MetaHelper.js.map +1 -0
  99. package/infrastructure/helpers/SearchHelper.d.ts +7 -0
  100. package/infrastructure/helpers/SearchHelper.js +30 -0
  101. package/infrastructure/helpers/SearchHelper.js.map +1 -0
  102. package/infrastructure/pipes/ValidationPipe.d.ts +4 -0
  103. package/infrastructure/pipes/ValidationPipe.js +37 -0
  104. package/infrastructure/pipes/ValidationPipe.js.map +1 -0
  105. package/infrastructure/repositories/CrudRepository.d.ts +18 -0
  106. package/infrastructure/repositories/CrudRepository.js +53 -0
  107. package/infrastructure/repositories/CrudRepository.js.map +1 -0
  108. package/infrastructure/schemas/BaseSchema.d.ts +6 -0
  109. package/infrastructure/schemas/BaseSchema.js +19 -0
  110. package/infrastructure/schemas/BaseSchema.js.map +1 -0
  111. package/infrastructure/schemas/SearchSchema.d.ts +7 -0
  112. package/infrastructure/schemas/SearchSchema.js +36 -0
  113. package/infrastructure/schemas/SearchSchema.js.map +1 -0
  114. package/package.json +40 -0
  115. package/tsconfig.tsbuildinfo +1 -0
  116. package/usecases/dtos/SearchInputDto.d.ts +10 -0
  117. package/usecases/dtos/SearchInputDto.js +29 -0
  118. package/usecases/dtos/SearchInputDto.js.map +1 -0
  119. package/usecases/dtos/SearchResultDto.d.ts +5 -0
  120. package/usecases/dtos/SearchResultDto.js +7 -0
  121. package/usecases/dtos/SearchResultDto.js.map +1 -0
  122. package/usecases/interfaces/ICrudRepository.d.ts +12 -0
  123. package/usecases/interfaces/ICrudRepository.js +3 -0
  124. package/usecases/interfaces/ICrudRepository.js.map +1 -0
  125. package/usecases/services/CrudService.d.ts +16 -0
  126. package/usecases/services/CrudService.js +45 -0
  127. package/usecases/services/CrudService.js.map +1 -0
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnumField = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const typeorm_1 = require("typeorm");
6
+ const class_validator_1 = require("class-validator");
7
+ const BaseField_1 = require("./BaseField");
8
+ const BaseEnum_1 = require("../../../domain/base/BaseEnum");
9
+ function EnumField(options = {}) {
10
+ if (Array.isArray(options.enum)) {
11
+ options.enum = options.enum.reduce((obj, value) => {
12
+ if (value.prototype instanceof BaseEnum_1.default) {
13
+ obj = Object.assign(Object.assign({}, obj), value.toEnum());
14
+ }
15
+ else if (typeof value === 'string') {
16
+ obj[value] = value;
17
+ }
18
+ return obj;
19
+ }, {});
20
+ }
21
+ else if (typeof options.enum === 'function' && options.enum.prototype instanceof BaseEnum_1.default) {
22
+ options.enum = options.enum.toEnum();
23
+ }
24
+ return (0, common_1.applyDecorators)((0, BaseField_1.BaseField)(Object.assign(Object.assign({}, options), { decoratorName: 'EnumField', appType: 'enum' })), (0, typeorm_1.Column)({
25
+ type: 'varchar',
26
+ default: options.defaultValue,
27
+ nullable: options.nullable,
28
+ }), (0, class_validator_1.IsEnum)(options.enum));
29
+ }
30
+ exports.EnumField = EnumField;
31
+ //# sourceMappingURL=EnumField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnumField.js","sourceRoot":"","sources":["../../../../src/infrastructure/decorators/fields/EnumField.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAC/C,qCAA+B;AAC/B,qDAAuC;AACvC,2CAAyD;AACzD,4DAAqD;AAMrD,SAAgB,SAAS,CAAC,UAA8B,EAAE;IACtD,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAC7B,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;YAC9C,IAAI,KAAK,CAAC,SAAS,YAAY,kBAAQ,EAAE;gBACrC,GAAG,mCACI,GAAG,GACH,KAAK,CAAC,MAAM,EAAE,CACpB,CAAC;aACL;iBAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;gBAClC,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;aACtB;YACD,OAAO,GAAG,CAAC;QACf,CAAC,EAAE,EAAE,CAAC,CAAC;KACV;SAAM,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,SAAS,YAAY,kBAAQ,EAAE;QACzF,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;KACxC;IAED,OAAO,IAAA,wBAAe,EAClB,IAAA,qBAAS,kCACF,OAAO,KACV,aAAa,EAAE,WAAW,EAC1B,OAAO,EAAE,MAAM,IACjB,EACF,IAAA,gBAAM,EAAC;QACH,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,OAAO,CAAC,YAAY;QAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ;KAC7B,CAAC,EACF,IAAA,wBAAM,EAAC,OAAO,CAAC,IAAI,CAAC,CACvB,CAAC;AACN,CAAC;AA9BD,8BA8BC"}
@@ -0,0 +1,5 @@
1
+ import { IBaseFieldOptions } from './BaseField';
2
+ export interface IExtendFieldOptions extends IBaseFieldOptions {
3
+ propertyName?: string;
4
+ }
5
+ export declare function ExtendField(modelClass: any, options?: IExtendFieldOptions): (object: any, propertyName: any) => void;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExtendField = void 0;
4
+ const BaseField_1 = require("./BaseField");
5
+ function ExtendField(modelClass, options = {}) {
6
+ return (object, propertyName) => {
7
+ if (options.propertyName) {
8
+ propertyName = options.propertyName;
9
+ }
10
+ const modelMeta = Reflect.getMetadata(BaseField_1.MODEL_META_KEY, modelClass.prototype, propertyName);
11
+ const extendOptions = Object.assign(Object.assign({}, modelMeta._raw), options);
12
+ const decorator = require('./index')[extendOptions.decoratorName];
13
+ if (!decorator) {
14
+ throw new Error(`Not found Field decorator ${extendOptions.decoratorName}, property: ${propertyName}`);
15
+ }
16
+ decorator(extendOptions)(object, propertyName);
17
+ };
18
+ }
19
+ exports.ExtendField = ExtendField;
20
+ //# sourceMappingURL=ExtendField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExtendField.js","sourceRoot":"","sources":["../../../../src/infrastructure/decorators/fields/ExtendField.ts"],"names":[],"mappings":";;;AAAA,2CAA8D;AAM9D,SAAgB,WAAW,CAAC,UAAU,EAAE,UAA+B,EAAE;IACrE,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE;QAC5B,IAAI,OAAO,CAAC,YAAY,EAAE;YACtB,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;SACvC;QAED,MAAM,SAAS,GAAQ,OAAO,CAAC,WAAW,CAAC,0BAAc,EAAE,UAAU,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;QAC/F,MAAM,aAAa,mCACZ,SAAS,CAAC,IAAI,GACd,OAAO,CACb,CAAC;QAEF,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;QAClE,IAAI,CAAC,SAAS,EAAE;YACZ,MAAM,IAAI,KAAK,CAAC,6BAA6B,aAAa,CAAC,aAAa,eAAe,YAAY,EAAE,CAAC,CAAC;SAC1G;QAED,SAAS,CAAC,aAAa,CAAC,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACnD,CAAC,CAAC;AACN,CAAC;AAnBD,kCAmBC"}
@@ -0,0 +1 @@
1
+ export declare function ExtendFields(modelClass: any): (object: any) => void;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExtendFields = void 0;
4
+ const constants_1 = require("@nestjs/swagger/dist/constants");
5
+ function ExtendFields(modelClass) {
6
+ return (object) => {
7
+ const properties = Reflect.getMetadata(constants_1.DECORATORS.API_MODEL_PROPERTIES_ARRAY, modelClass.prototype);
8
+ (properties || []).forEach(propertyName => {
9
+ propertyName = propertyName.replace(/^:/, '');
10
+ console.log(11, Object.keys(object.prototype));
11
+ });
12
+ };
13
+ }
14
+ exports.ExtendFields = ExtendFields;
15
+ //# sourceMappingURL=ExtendFields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExtendFields.js","sourceRoot":"","sources":["../../../../src/infrastructure/decorators/fields/ExtendFields.ts"],"names":[],"mappings":";;;AAAA,8DAA0D;AAG1D,SAAgB,YAAY,CAAC,UAAU;IACnC,OAAO,CAAC,MAAM,EAAE,EAAE;QACd,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,sBAAU,CAAC,0BAA0B,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;QACpG,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;YACtC,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAE9C,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QAEnD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC;AAVD,oCAUC"}
@@ -0,0 +1,2 @@
1
+ import { IBaseFieldOptions } from './BaseField';
2
+ export declare function FileField(options?: IBaseFieldOptions): <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FileField = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const typeorm_1 = require("typeorm");
6
+ const class_validator_1 = require("class-validator");
7
+ const BaseField_1 = require("./BaseField");
8
+ function FileField(options = {}) {
9
+ return (0, common_1.applyDecorators)((0, BaseField_1.BaseField)(Object.assign(Object.assign({}, options), { decoratorName: 'FileField', appType: 'file' })), (0, typeorm_1.Column)({
10
+ type: 'integer',
11
+ default: options.defaultValue,
12
+ nullable: options.nullable,
13
+ }), (0, class_validator_1.IsInt)());
14
+ }
15
+ exports.FileField = FileField;
16
+ //# sourceMappingURL=FileField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileField.js","sourceRoot":"","sources":["../../../../src/infrastructure/decorators/fields/FileField.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAC/C,qCAA+B;AAC/B,qDAAsC;AACtC,2CAAyD;AAEzD,SAAgB,SAAS,CAAC,UAA6B,EAAE;IACrD,OAAO,IAAA,wBAAe,EAClB,IAAA,qBAAS,kCACF,OAAO,KACV,aAAa,EAAE,WAAW,EAC1B,OAAO,EAAE,MAAM,IACjB,EACF,IAAA,gBAAM,EAAC;QACH,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,OAAO,CAAC,YAAY;QAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ;KAC7B,CAAC,EACF,IAAA,uBAAK,GAAE,CACV,CAAC;AACN,CAAC;AAdD,8BAcC"}
@@ -0,0 +1,2 @@
1
+ import { IBaseFieldOptions } from './BaseField';
2
+ export declare function HtmlField(options?: IBaseFieldOptions): <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HtmlField = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const typeorm_1 = require("typeorm");
6
+ const BaseField_1 = require("./BaseField");
7
+ function HtmlField(options = {}) {
8
+ return (0, common_1.applyDecorators)((0, BaseField_1.BaseField)(Object.assign(Object.assign({}, options), { decoratorName: 'HtmlField', appType: 'html' })), (0, typeorm_1.Column)({
9
+ type: 'text',
10
+ default: options.defaultValue,
11
+ nullable: options.nullable,
12
+ }));
13
+ }
14
+ exports.HtmlField = HtmlField;
15
+ //# sourceMappingURL=HtmlField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HtmlField.js","sourceRoot":"","sources":["../../../../src/infrastructure/decorators/fields/HtmlField.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAC/C,qCAA+B;AAC/B,2CAAyD;AAEzD,SAAgB,SAAS,CAAC,UAA6B,EAAE;IACrD,OAAO,IAAA,wBAAe,EAClB,IAAA,qBAAS,kCACF,OAAO,KACV,aAAa,EAAE,WAAW,EAC1B,OAAO,EAAE,MAAM,IACjB,EACF,IAAA,gBAAM,EAAC;QACH,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,OAAO,CAAC,YAAY;QAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ;KAC7B,CAAC,CACL,CAAC;AACN,CAAC;AAbD,8BAaC"}
@@ -0,0 +1,2 @@
1
+ import { IBaseFieldOptions } from './BaseField';
2
+ export declare function IntegerField(options?: IBaseFieldOptions): <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IntegerField = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const typeorm_1 = require("typeorm");
6
+ const class_validator_1 = require("class-validator");
7
+ const BaseField_1 = require("./BaseField");
8
+ function IntegerField(options = {}) {
9
+ return (0, common_1.applyDecorators)(...[
10
+ (0, BaseField_1.BaseField)(Object.assign(Object.assign({}, options), { decoratorName: 'IntegerField', appType: 'integer' })),
11
+ (0, typeorm_1.Column)({
12
+ type: 'integer',
13
+ default: options.defaultValue,
14
+ nullable: options.nullable,
15
+ }),
16
+ (0, class_validator_1.IsInt)(),
17
+ typeof options.min === 'number' && (0, class_validator_1.Min)(options.min),
18
+ typeof options.max === 'number' && (0, class_validator_1.Max)(options.max),
19
+ ].filter(Boolean));
20
+ }
21
+ exports.IntegerField = IntegerField;
22
+ //# sourceMappingURL=IntegerField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntegerField.js","sourceRoot":"","sources":["../../../../src/infrastructure/decorators/fields/IntegerField.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAC/C,qCAA+B;AAC/B,qDAAgD;AAChD,2CAAyD;AAEzD,SAAgB,YAAY,CAAC,UAA6B,EAAE;IACxD,OAAO,IAAA,wBAAe,EAAC,GAAG;QACtB,IAAA,qBAAS,kCACF,OAAO,KACV,aAAa,EAAE,cAAc,EAC7B,OAAO,EAAE,SAAS,IACpB;QACF,IAAA,gBAAM,EAAC;YACH,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,OAAO,CAAC,YAAY;YAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC7B,CAAC;QACF,IAAA,uBAAK,GAAE;QACP,OAAO,OAAO,CAAC,GAAG,KAAK,QAAQ,IAAI,IAAA,qBAAG,EAAC,OAAO,CAAC,GAAG,CAAC;QACnD,OAAO,OAAO,CAAC,GAAG,KAAK,QAAQ,IAAI,IAAA,qBAAG,EAAC,OAAO,CAAC,GAAG,CAAC;KACtD,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;AACvB,CAAC;AAhBD,oCAgBC"}
@@ -0,0 +1,2 @@
1
+ import { IBaseFieldOptions } from './BaseField';
2
+ export declare function PasswordField(options?: IBaseFieldOptions): <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PasswordField = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const typeorm_1 = require("typeorm");
6
+ const class_transformer_1 = require("class-transformer");
7
+ const BaseField_1 = require("./BaseField");
8
+ function PasswordField(options = {}) {
9
+ if (!options.label) {
10
+ options.label = 'Пароль';
11
+ }
12
+ return (0, common_1.applyDecorators)((0, BaseField_1.BaseField)(Object.assign(Object.assign({}, options), { decoratorName: 'PasswordField', appType: 'password' })), (0, typeorm_1.Column)({
13
+ type: 'text',
14
+ length: options.max,
15
+ default: options.defaultValue,
16
+ nullable: options.nullable,
17
+ }), (0, class_transformer_1.Exclude)());
18
+ }
19
+ exports.PasswordField = PasswordField;
20
+ //# sourceMappingURL=PasswordField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PasswordField.js","sourceRoot":"","sources":["../../../../src/infrastructure/decorators/fields/PasswordField.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAC/C,qCAA+B;AAC/B,yDAA0C;AAC1C,2CAAyD;AAEzD,SAAgB,aAAa,CAAC,UAA6B,EAAE;IACzD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;QAChB,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC;KAC5B;IAED,OAAO,IAAA,wBAAe,EAClB,IAAA,qBAAS,kCACF,OAAO,KACV,aAAa,EAAE,eAAe,EAC9B,OAAO,EAAE,UAAU,IACrB,EACF,IAAA,gBAAM,EAAC;QACH,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,OAAO,CAAC,GAAG;QACnB,OAAO,EAAE,OAAO,CAAC,YAAY;QAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ;KAC7B,CAAC,EACF,IAAA,2BAAO,GAAE,CACZ,CAAC;AACN,CAAC;AAnBD,sCAmBC"}
@@ -0,0 +1,2 @@
1
+ import { IBaseFieldOptions } from './BaseField';
2
+ export declare function PhoneField(options?: IBaseFieldOptions): <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PhoneField = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const typeorm_1 = require("typeorm");
6
+ const class_validator_1 = require("class-validator");
7
+ const BaseField_1 = require("./BaseField");
8
+ function PhoneField(options = {}) {
9
+ if (!options.label) {
10
+ options.label = 'Телефон';
11
+ }
12
+ return (0, common_1.applyDecorators)((0, BaseField_1.BaseField)(Object.assign(Object.assign({}, options), { decoratorName: 'PhoneField', appType: 'phone' })), (0, typeorm_1.Column)({
13
+ type: 'varchar',
14
+ length: options.max || 16,
15
+ default: options.defaultValue,
16
+ nullable: options.nullable,
17
+ }), (0, class_validator_1.IsPhoneNumber)());
18
+ }
19
+ exports.PhoneField = PhoneField;
20
+ //# sourceMappingURL=PhoneField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PhoneField.js","sourceRoot":"","sources":["../../../../src/infrastructure/decorators/fields/PhoneField.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAC/C,qCAA+B;AAC/B,qDAA8C;AAC9C,2CAAyD;AAEzD,SAAgB,UAAU,CAAC,UAA6B,EAAE;IACtD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;QAChB,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC;KAC7B;IAED,OAAO,IAAA,wBAAe,EAClB,IAAA,qBAAS,kCACF,OAAO,KACV,aAAa,EAAE,YAAY,EAC3B,OAAO,EAAE,OAAO,IAClB,EACF,IAAA,gBAAM,EAAC;QACH,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EAAE;QACzB,OAAO,EAAE,OAAO,CAAC,YAAY;QAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ;KAC7B,CAAC,EACF,IAAA,+BAAa,GAAE,CAClB,CAAC;AACN,CAAC;AAnBD,gCAmBC"}
@@ -0,0 +1,2 @@
1
+ import { IBaseFieldOptions } from './BaseField';
2
+ export declare function PrimaryKeyField(options?: IBaseFieldOptions): <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PrimaryKeyField = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const typeorm_1 = require("typeorm");
6
+ const BaseField_1 = require("./BaseField");
7
+ function PrimaryKeyField(options = {}) {
8
+ if (!options.label) {
9
+ options.label = 'ИД';
10
+ }
11
+ return (0, common_1.applyDecorators)((0, BaseField_1.BaseField)(Object.assign(Object.assign({}, options), { decoratorName: 'PrimaryKeyField', appType: 'primaryKey' })), (0, typeorm_1.PrimaryGeneratedColumn)({ type: 'integer' }));
12
+ }
13
+ exports.PrimaryKeyField = PrimaryKeyField;
14
+ //# sourceMappingURL=PrimaryKeyField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrimaryKeyField.js","sourceRoot":"","sources":["../../../../src/infrastructure/decorators/fields/PrimaryKeyField.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAC/C,qCAA+C;AAC/C,2CAAyD;AAEzD,SAAgB,eAAe,CAAC,UAA6B,EAAE;IAC3D,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;QAChB,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;KACxB;IAED,OAAO,IAAA,wBAAe,EAClB,IAAA,qBAAS,kCACF,OAAO,KACV,aAAa,EAAE,iBAAiB,EAChC,OAAO,EAAE,YAAY,IACvB,EACF,IAAA,gCAAsB,EAAC,EAAC,IAAI,EAAE,SAAS,EAAC,CAAC,CAC5C,CAAC;AACN,CAAC;AAbD,0CAaC"}
@@ -0,0 +1,6 @@
1
+ import { IBaseFieldOptions } from './BaseField';
2
+ export interface IRelationFieldOptions extends IBaseFieldOptions {
3
+ relationType?: 'hasOne' | 'hasMany';
4
+ relationModel?: any;
5
+ }
6
+ export declare function RelationField(options?: IRelationFieldOptions): <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RelationField = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const typeorm_1 = require("typeorm");
6
+ const class_validator_1 = require("class-validator");
7
+ const BaseField_1 = require("./BaseField");
8
+ function RelationField(options = {}) {
9
+ return (0, common_1.applyDecorators)((0, BaseField_1.BaseField)(Object.assign(Object.assign({}, options), { decoratorName: 'RelationField', appType: 'integer' })), (0, typeorm_1.Column)({
10
+ type: 'integer',
11
+ default: options.defaultValue,
12
+ nullable: options.nullable,
13
+ }), (0, class_validator_1.IsInt)());
14
+ }
15
+ exports.RelationField = RelationField;
16
+ //# sourceMappingURL=RelationField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RelationField.js","sourceRoot":"","sources":["../../../../src/infrastructure/decorators/fields/RelationField.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAC/C,qCAA+B;AAC/B,qDAAsC;AACtC,2CAAyD;AAOzD,SAAgB,aAAa,CAAC,UAAiC,EAAE;IAC7D,OAAO,IAAA,wBAAe,EAClB,IAAA,qBAAS,kCACF,OAAO,KACV,aAAa,EAAE,eAAe,EAC9B,OAAO,EAAE,SAAS,IACpB,EACF,IAAA,gBAAM,EAAC;QACH,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,OAAO,CAAC,YAAY;QAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ;KAC7B,CAAC,EACF,IAAA,uBAAK,GAAE,CACV,CAAC;AACN,CAAC;AAdD,sCAcC"}
@@ -0,0 +1,2 @@
1
+ import { IBaseFieldOptions } from './BaseField';
2
+ export declare function StringField(options?: IBaseFieldOptions): <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StringField = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const typeorm_1 = require("typeorm");
6
+ const class_validator_1 = require("class-validator");
7
+ const BaseField_1 = require("./BaseField");
8
+ function StringField(options = {}) {
9
+ return (0, common_1.applyDecorators)(...[
10
+ (0, BaseField_1.BaseField)(Object.assign(Object.assign({}, options), { decoratorName: 'StringField', appType: 'string' })),
11
+ (0, typeorm_1.Column)({
12
+ type: 'varchar',
13
+ length: options.max,
14
+ default: options.defaultValue,
15
+ nullable: options.nullable,
16
+ }),
17
+ (0, class_validator_1.IsString)(),
18
+ (0, class_validator_1.IsOptional)(),
19
+ typeof options.min === 'number' && (0, class_validator_1.MinLength)(options.min),
20
+ typeof options.max === 'number' && (0, class_validator_1.MaxLength)(options.max),
21
+ ].filter(Boolean));
22
+ }
23
+ exports.StringField = StringField;
24
+ //# sourceMappingURL=StringField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StringField.js","sourceRoot":"","sources":["../../../../src/infrastructure/decorators/fields/StringField.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAC/C,qCAA+B;AAC/B,qDAA2E;AAC3E,2CAAyD;AAEzD,SAAgB,WAAW,CAAC,UAA6B,EAAE;IACvD,OAAO,IAAA,wBAAe,EAAC,GAAG;QACtB,IAAA,qBAAS,kCACF,OAAO,KACV,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,QAAQ,IACnB;QACF,IAAA,gBAAM,EAAC;YACH,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,OAAO,CAAC,GAAG;YACnB,OAAO,EAAE,OAAO,CAAC,YAAY;YAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC7B,CAAC;QACF,IAAA,0BAAQ,GAAE;QACV,IAAA,4BAAU,GAAE;QACZ,OAAO,OAAO,CAAC,GAAG,KAAK,QAAQ,IAAI,IAAA,2BAAS,EAAC,OAAO,CAAC,GAAG,CAAC;QACzD,OAAO,OAAO,CAAC,GAAG,KAAK,QAAQ,IAAI,IAAA,2BAAS,EAAC,OAAO,CAAC,GAAG,CAAC;KAC5D,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;AACvB,CAAC;AAlBD,kCAkBC"}
@@ -0,0 +1,2 @@
1
+ import { IBaseFieldOptions } from './BaseField';
2
+ export declare function TextField(options?: IBaseFieldOptions): <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TextField = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const typeorm_1 = require("typeorm");
6
+ const BaseField_1 = require("./BaseField");
7
+ function TextField(options = {}) {
8
+ return (0, common_1.applyDecorators)((0, BaseField_1.BaseField)(Object.assign(Object.assign({}, options), { decoratorName: 'TextField', appType: 'text' })), (0, typeorm_1.Column)({
9
+ type: 'text',
10
+ length: options.max,
11
+ default: options.defaultValue,
12
+ nullable: options.nullable,
13
+ }));
14
+ }
15
+ exports.TextField = TextField;
16
+ //# sourceMappingURL=TextField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextField.js","sourceRoot":"","sources":["../../../../src/infrastructure/decorators/fields/TextField.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAC/C,qCAA+B;AAC/B,2CAAyD;AAEzD,SAAgB,SAAS,CAAC,UAA6B,EAAE;IACrD,OAAO,IAAA,wBAAe,EAClB,IAAA,qBAAS,kCACF,OAAO,KACV,aAAa,EAAE,WAAW,EAC1B,OAAO,EAAE,MAAM,IACjB,EACF,IAAA,gBAAM,EAAC;QACH,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,OAAO,CAAC,GAAG;QACnB,OAAO,EAAE,OAAO,CAAC,YAAY;QAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ;KAC7B,CAAC,CACL,CAAC;AACN,CAAC;AAdD,8BAcC"}
@@ -0,0 +1,2 @@
1
+ import { IBaseFieldOptions } from './BaseField';
2
+ export declare function TimeField(options?: IBaseFieldOptions): <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TimeField = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const typeorm_1 = require("typeorm");
6
+ const class_validator_1 = require("class-validator");
7
+ const BaseField_1 = require("./BaseField");
8
+ function TimeField(options = {}) {
9
+ return (0, common_1.applyDecorators)((0, BaseField_1.BaseField)(Object.assign(Object.assign({}, options), { decoratorName: 'TimeField', appType: 'time' })), (0, typeorm_1.Column)({
10
+ type: 'varchar',
11
+ length: 5,
12
+ default: options.defaultValue,
13
+ nullable: options.nullable,
14
+ }), (0, class_validator_1.IsMilitaryTime)());
15
+ }
16
+ exports.TimeField = TimeField;
17
+ //# sourceMappingURL=TimeField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimeField.js","sourceRoot":"","sources":["../../../../src/infrastructure/decorators/fields/TimeField.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAC/C,qCAA+B;AAC/B,qDAA+C;AAC/C,2CAAyD;AAEzD,SAAgB,SAAS,CAAC,UAA6B,EAAE;IACrD,OAAO,IAAA,wBAAe,EAClB,IAAA,qBAAS,kCACF,OAAO,KACV,aAAa,EAAE,WAAW,EAC1B,OAAO,EAAE,MAAM,IACjB,EACF,IAAA,gBAAM,EAAC;QACH,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,OAAO,CAAC,YAAY;QAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ;KAC7B,CAAC,EACF,IAAA,gCAAc,GAAE,CACnB,CAAC;AACN,CAAC;AAfD,8BAeC"}
@@ -0,0 +1,2 @@
1
+ import { IBaseFieldOptions } from './BaseField';
2
+ export declare function UidField(options?: IBaseFieldOptions): <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UidField = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const uuid_1 = require("uuid");
6
+ const typeorm_1 = require("typeorm");
7
+ const EventListenerTypes_1 = require("typeorm/metadata/types/EventListenerTypes");
8
+ const BaseField_1 = require("./BaseField");
9
+ const UidBehaviour = (object, propertyName) => {
10
+ const methodName = propertyName + '__uidBehaviour';
11
+ if (!object[methodName]) {
12
+ object[methodName] = function () {
13
+ this[propertyName] = (0, uuid_1.v4)();
14
+ };
15
+ }
16
+ (0, typeorm_1.getMetadataArgsStorage)().entityListeners.push({
17
+ target: object.constructor,
18
+ propertyName: methodName,
19
+ type: EventListenerTypes_1.EventListenerTypes.BEFORE_INSERT,
20
+ });
21
+ };
22
+ function UidField(options = {}) {
23
+ if (!options.label) {
24
+ options.label = 'Уникальный код';
25
+ }
26
+ return (0, common_1.applyDecorators)((0, BaseField_1.BaseField)(Object.assign(Object.assign({}, options), { decoratorName: 'UidField', appType: 'uid' })), (0, typeorm_1.Column)({
27
+ type: options.dbType || 'varchar',
28
+ length: 36,
29
+ default: null,
30
+ update: false,
31
+ }), UidBehaviour);
32
+ }
33
+ exports.UidField = UidField;
34
+ //# sourceMappingURL=UidField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UidField.js","sourceRoot":"","sources":["../../../../src/infrastructure/decorators/fields/UidField.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAC/C,+BAAoC;AACpC,qCAAuD;AACvD,kFAA6E;AAC7E,2CAAyD;AAEzD,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE;IAC1C,MAAM,UAAU,GAAG,YAAY,GAAG,gBAAgB,CAAC;IACnD,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE;QAErB,MAAM,CAAC,UAAU,CAAC,GAAG;YACjB,IAAI,CAAC,YAAY,CAAC,GAAG,IAAA,SAAM,GAAE,CAAC;QAClC,CAAC,CAAC;KACL;IAED,IAAA,gCAAsB,GAAE,CAAC,eAAe,CAAC,IAAI,CAAC;QAC1C,MAAM,EAAE,MAAM,CAAC,WAAW;QAC1B,YAAY,EAAE,UAAU;QACxB,IAAI,EAAE,uCAAkB,CAAC,aAAa;KACzC,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,SAAgB,QAAQ,CAAC,UAA6B,EAAE;IACpD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;QAChB,OAAO,CAAC,KAAK,GAAG,gBAAgB,CAAC;KACpC;IAED,OAAO,IAAA,wBAAe,EAClB,IAAA,qBAAS,kCACF,OAAO,KACV,aAAa,EAAE,UAAU,EACzB,OAAO,EAAE,KAAK,IAChB,EACF,IAAA,gBAAM,EAAC;QACH,IAAI,EAAE,OAAO,CAAC,MAAM,IAAI,SAAS;QACjC,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,KAAK;KAChB,CAAC,EACF,YAAY,CAGf,CAAC;AACN,CAAC;AArBD,4BAqBC"}
@@ -0,0 +1,5 @@
1
+ import { IBaseFieldOptions } from './BaseField';
2
+ export interface IUpdateTimeFieldOptions extends IBaseFieldOptions {
3
+ precision?: number;
4
+ }
5
+ export declare function UpdateTimeField(options?: IUpdateTimeFieldOptions): <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateTimeField = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const lodash_1 = require("lodash");
6
+ const typeorm_1 = require("typeorm");
7
+ const EventListenerTypes_1 = require("typeorm/metadata/types/EventListenerTypes");
8
+ const class_transformer_1 = require("class-transformer");
9
+ const BaseField_1 = require("./BaseField");
10
+ const UpdateTimeBehaviour = (object, propertyName) => {
11
+ const methodName = propertyName + '__updateTimeBehaviour';
12
+ if (!object[methodName]) {
13
+ object[methodName] = function () {
14
+ this[propertyName] = new Date();
15
+ };
16
+ }
17
+ [EventListenerTypes_1.EventListenerTypes.BEFORE_INSERT, EventListenerTypes_1.EventListenerTypes.BEFORE_INSERT].forEach(type => {
18
+ (0, typeorm_1.getMetadataArgsStorage)().entityListeners.push({
19
+ target: object.constructor,
20
+ propertyName: methodName,
21
+ type,
22
+ });
23
+ });
24
+ };
25
+ function UpdateTimeField(options = {}) {
26
+ if (!options.label) {
27
+ options.label = 'Обновлен';
28
+ }
29
+ return (0, common_1.applyDecorators)((0, BaseField_1.BaseField)(Object.assign(Object.assign({}, options), { decoratorName: 'UpdateTimeField', appType: 'updateTime' })), (0, typeorm_1.UpdateDateColumn)({
30
+ type: 'timestamp',
31
+ precision: (0, lodash_1.has)(options, 'precision') ? options.precision : 0,
32
+ default: (0, lodash_1.has)(options, 'defaultValue') ? options.defaultValue : undefined,
33
+ nullable: (0, lodash_1.has)(options, 'nullable') ? options.nullable : false,
34
+ }), UpdateTimeBehaviour, (0, class_transformer_1.Type)(() => Date));
35
+ }
36
+ exports.UpdateTimeField = UpdateTimeField;
37
+ //# sourceMappingURL=UpdateTimeField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UpdateTimeField.js","sourceRoot":"","sources":["../../../../src/infrastructure/decorators/fields/UpdateTimeField.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAC/C,mCAAmC;AACnC,qCAAiE;AACjE,kFAA6E;AAC7E,yDAAuC;AACvC,2CAAyD;AAMzD,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE;IACjD,MAAM,UAAU,GAAG,YAAY,GAAG,uBAAuB,CAAC;IAC1D,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE;QAErB,MAAM,CAAC,UAAU,CAAC,GAAG;YACjB,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC;QACpC,CAAC,CAAC;KACL;IAED,CAAC,uCAAkB,CAAC,aAAa,EAAE,uCAAkB,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAChF,IAAA,gCAAsB,GAAE,CAAC,eAAe,CAAC,IAAI,CAAC;YAC1C,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,UAAU;YACxB,IAAI;SACP,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,SAAgB,eAAe,CAAC,UAAmC,EAAE;IACjE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;QAChB,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC;KAC9B;IAED,OAAO,IAAA,wBAAe,EAClB,IAAA,qBAAS,kCACF,OAAO,KACV,aAAa,EAAE,iBAAiB,EAChC,OAAO,EAAE,YAAY,IACvB,EACF,IAAA,0BAAgB,EAAC;QACb,IAAI,EAAE,WAAW;QACjB,SAAS,EAAE,IAAA,YAAI,EAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC7D,OAAO,EAAE,IAAA,YAAI,EAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS;QACzE,QAAQ,EAAE,IAAA,YAAI,EAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK;KACjE,CAAC,EACF,mBAAmB,EACnB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CACnB,CAAC;AACN,CAAC;AApBD,0CAoBC"}
@@ -0,0 +1,18 @@
1
+ export { BooleanField } from './BooleanField';
2
+ export { CreateTimeField } from './CreateTimeField';
3
+ export { DateField } from './DateField';
4
+ export { DateTimeField } from './DateTimeField';
5
+ export { DecimalField } from './DecimalField';
6
+ export { EmailField } from './EmailField';
7
+ export { EnumField } from './EnumField';
8
+ export { FileField } from './FileField';
9
+ export { HtmlField } from './HtmlField';
10
+ export { IntegerField } from './IntegerField';
11
+ export { PasswordField } from './PasswordField';
12
+ export { PhoneField } from './PhoneField';
13
+ export { PrimaryKeyField } from './PrimaryKeyField';
14
+ export { StringField } from './StringField';
15
+ export { TextField } from './TextField';
16
+ export { TimeField } from './TimeField';
17
+ export { UidField } from './UidField';
18
+ export { UpdateTimeField } from './UpdateTimeField';
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateTimeField = exports.UidField = exports.TimeField = exports.TextField = exports.StringField = exports.PrimaryKeyField = exports.PhoneField = exports.PasswordField = exports.IntegerField = exports.HtmlField = exports.FileField = exports.EnumField = exports.EmailField = exports.DecimalField = exports.DateTimeField = exports.DateField = exports.CreateTimeField = exports.BooleanField = void 0;
4
+ var BooleanField_1 = require("./BooleanField");
5
+ Object.defineProperty(exports, "BooleanField", { enumerable: true, get: function () { return BooleanField_1.BooleanField; } });
6
+ var CreateTimeField_1 = require("./CreateTimeField");
7
+ Object.defineProperty(exports, "CreateTimeField", { enumerable: true, get: function () { return CreateTimeField_1.CreateTimeField; } });
8
+ var DateField_1 = require("./DateField");
9
+ Object.defineProperty(exports, "DateField", { enumerable: true, get: function () { return DateField_1.DateField; } });
10
+ var DateTimeField_1 = require("./DateTimeField");
11
+ Object.defineProperty(exports, "DateTimeField", { enumerable: true, get: function () { return DateTimeField_1.DateTimeField; } });
12
+ var DecimalField_1 = require("./DecimalField");
13
+ Object.defineProperty(exports, "DecimalField", { enumerable: true, get: function () { return DecimalField_1.DecimalField; } });
14
+ var EmailField_1 = require("./EmailField");
15
+ Object.defineProperty(exports, "EmailField", { enumerable: true, get: function () { return EmailField_1.EmailField; } });
16
+ var EnumField_1 = require("./EnumField");
17
+ Object.defineProperty(exports, "EnumField", { enumerable: true, get: function () { return EnumField_1.EnumField; } });
18
+ var FileField_1 = require("./FileField");
19
+ Object.defineProperty(exports, "FileField", { enumerable: true, get: function () { return FileField_1.FileField; } });
20
+ var HtmlField_1 = require("./HtmlField");
21
+ Object.defineProperty(exports, "HtmlField", { enumerable: true, get: function () { return HtmlField_1.HtmlField; } });
22
+ var IntegerField_1 = require("./IntegerField");
23
+ Object.defineProperty(exports, "IntegerField", { enumerable: true, get: function () { return IntegerField_1.IntegerField; } });
24
+ var PasswordField_1 = require("./PasswordField");
25
+ Object.defineProperty(exports, "PasswordField", { enumerable: true, get: function () { return PasswordField_1.PasswordField; } });
26
+ var PhoneField_1 = require("./PhoneField");
27
+ Object.defineProperty(exports, "PhoneField", { enumerable: true, get: function () { return PhoneField_1.PhoneField; } });
28
+ var PrimaryKeyField_1 = require("./PrimaryKeyField");
29
+ Object.defineProperty(exports, "PrimaryKeyField", { enumerable: true, get: function () { return PrimaryKeyField_1.PrimaryKeyField; } });
30
+ var StringField_1 = require("./StringField");
31
+ Object.defineProperty(exports, "StringField", { enumerable: true, get: function () { return StringField_1.StringField; } });
32
+ var TextField_1 = require("./TextField");
33
+ Object.defineProperty(exports, "TextField", { enumerable: true, get: function () { return TextField_1.TextField; } });
34
+ var TimeField_1 = require("./TimeField");
35
+ Object.defineProperty(exports, "TimeField", { enumerable: true, get: function () { return TimeField_1.TimeField; } });
36
+ var UidField_1 = require("./UidField");
37
+ Object.defineProperty(exports, "UidField", { enumerable: true, get: function () { return UidField_1.UidField; } });
38
+ var UpdateTimeField_1 = require("./UpdateTimeField");
39
+ Object.defineProperty(exports, "UpdateTimeField", { enumerable: true, get: function () { return UpdateTimeField_1.UpdateTimeField; } });
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/infrastructure/decorators/fields/index.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAApC,4GAAA,YAAY,OAAA;AACpB,qDAAkD;AAA1C,kHAAA,eAAe,OAAA;AACvB,yCAAsC;AAA9B,sGAAA,SAAS,OAAA;AACjB,iDAA8C;AAAtC,8GAAA,aAAa,OAAA;AACrB,+CAA4C;AAApC,4GAAA,YAAY,OAAA;AACpB,2CAAwC;AAAhC,wGAAA,UAAU,OAAA;AAClB,yCAAsC;AAA9B,sGAAA,SAAS,OAAA;AACjB,yCAAsC;AAA9B,sGAAA,SAAS,OAAA;AACjB,yCAAsC;AAA9B,sGAAA,SAAS,OAAA;AACjB,+CAA4C;AAApC,4GAAA,YAAY,OAAA;AACpB,iDAA8C;AAAtC,8GAAA,aAAa,OAAA;AACrB,2CAAwC;AAAhC,wGAAA,UAAU,OAAA;AAClB,qDAAkD;AAA1C,kHAAA,eAAe,OAAA;AACvB,6CAA0C;AAAlC,0GAAA,WAAW,OAAA;AACnB,yCAAsC;AAA9B,sGAAA,SAAS,OAAA;AACjB,yCAAsC;AAA9B,sGAAA,SAAS,OAAA;AACjB,uCAAoC;AAA5B,oGAAA,QAAQ,OAAA;AAChB,qDAAkD;AAA1C,kHAAA,eAAe,OAAA"}
@@ -0,0 +1,5 @@
1
+ import { HttpException } from '@nestjs/common';
2
+ export declare class ValidationException extends HttpException {
3
+ messages: any;
4
+ constructor(response: any);
5
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ValidationException = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ class ValidationException extends common_1.HttpException {
6
+ constructor(response) {
7
+ super(response, common_1.HttpStatus.BAD_REQUEST);
8
+ this.messages = response;
9
+ }
10
+ }
11
+ exports.ValidationException = ValidationException;
12
+ //# sourceMappingURL=ValidationException.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidationException.js","sourceRoot":"","sources":["../../../src/infrastructure/exception/ValidationException.ts"],"names":[],"mappings":";;;AAAA,2CAAyD;AAEzD,MAAa,mBAAoB,SAAQ,sBAAa;IAGlD,YAAY,QAAQ;QAChB,KAAK,CAAC,QAAQ,EAAE,mBAAU,CAAC,WAAW,CAAC,CAAC;QACxC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;CACJ;AAPD,kDAOC"}
@@ -0,0 +1,8 @@
1
+ import { Brackets } from 'typeorm';
2
+ import { WhereExpressionBuilder } from 'typeorm/query-builder/WhereExpressionBuilder';
3
+ export declare type IConditionOperatorSingle = '=' | '>' | '>=' | '=>' | '<' | '<=' | '=<' | 'like' | 'ilike' | 'between' | 'in' | 'and' | '&&' | 'or' | '||';
4
+ export declare type IConditionOperatorAndOr = 'and' | '&&' | 'or' | '||';
5
+ export declare type ICondition = Record<string, unknown> | [IConditionOperatorAndOr, ...any[]] | [IConditionOperatorSingle, string, ...any[]] | ICondition[] | ((qb: WhereExpressionBuilder) => any);
6
+ export declare class ConditionHelper {
7
+ static toTypeOrm(condition: ICondition): Record<string, unknown> | Brackets;
8
+ }