@nest-omni/core 3.1.1-10 → 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 (211) hide show
  1. package/package.json +27 -19
  2. package/.hygen/new/crud/controller.ejs.t +0 -82
  3. package/.hygen/new/crud/create.dto.ejs.t +0 -12
  4. package/.hygen/new/crud/entity.ejs.t +0 -26
  5. package/.hygen/new/crud/get.dto.ejs.t +0 -19
  6. package/.hygen/new/crud/index-dto.ejs.t +0 -29
  7. package/.hygen/new/crud/index-response.dto.ejs.t +0 -18
  8. package/.hygen/new/crud/module.ejs.t +0 -32
  9. package/.hygen/new/crud/prompt.js +0 -89
  10. package/.hygen/new/crud/service.ejs.t +0 -76
  11. package/.hygen/new/crud/update.dto.ejs.t +0 -11
  12. package/.hygen/new/module/controller.ejs.t +0 -93
  13. package/.hygen/new/module/create-command.ejs.t +0 -90
  14. package/.hygen/new/module/create.dto.ejs.t +0 -11
  15. package/.hygen/new/module/dto.ejs.t +0 -24
  16. package/.hygen/new/module/entity.ejs.t +0 -33
  17. package/.hygen/new/module/get-query.ejs.t +0 -57
  18. package/.hygen/new/module/module.ejs.t +0 -44
  19. package/.hygen/new/module/not-found.exception.ejs.t +0 -18
  20. package/.hygen/new/module/page-options.dto.ejs.t +0 -12
  21. package/.hygen/new/module/prompt.js +0 -104
  22. package/.hygen/new/module/repository.ejs.t +0 -16
  23. package/.hygen/new/module/service.ejs.t +0 -139
  24. package/.hygen/new/module/translation-dto.ejs.t +0 -27
  25. package/.hygen/new/module/translation-entity.ejs.t +0 -40
  26. package/.hygen/new/module/translation-repository.ejs.t +0 -16
  27. package/.hygen/new/module/update.dto.ejs.t +0 -10
  28. package/.hygen.js +0 -116
  29. package/common/abstract.entity.d.ts +0 -18
  30. package/common/abstract.entity.js +0 -78
  31. package/common/boilerplate.polyfill.d.ts +0 -39
  32. package/common/boilerplate.polyfill.js +0 -77
  33. package/common/dto/abstract.dto.d.ts +0 -13
  34. package/common/dto/abstract.dto.js +0 -59
  35. package/common/dto/bulk-id.dto.d.ts +0 -3
  36. package/common/dto/bulk-id.dto.js +0 -27
  37. package/common/dto/create-translation.dto.d.ts +0 -5
  38. package/common/dto/create-translation.dto.js +0 -25
  39. package/common/dto/index.d.ts +0 -6
  40. package/common/dto/index.js +0 -22
  41. package/common/dto/page-meta.dto.d.ts +0 -15
  42. package/common/dto/page-meta.dto.js +0 -48
  43. package/common/dto/page-options.dto.d.ts +0 -8
  44. package/common/dto/page-options.dto.js +0 -52
  45. package/common/dto/page.dto.d.ts +0 -11
  46. package/common/dto/page.dto.js +0 -53
  47. package/common/index.d.ts +0 -6
  48. package/common/index.js +0 -22
  49. package/common/snake-naming.strategy.d.ts +0 -11
  50. package/common/snake-naming.strategy.js +0 -37
  51. package/common/types.d.ts +0 -9
  52. package/common/types.js +0 -2
  53. package/common/utils.d.ts +0 -3
  54. package/common/utils.js +0 -24
  55. package/constants/index.d.ts +0 -2
  56. package/constants/index.js +0 -18
  57. package/constants/language-code.d.ts +0 -5
  58. package/constants/language-code.js +0 -9
  59. package/constants/order.d.ts +0 -4
  60. package/constants/order.js +0 -8
  61. package/decorators/api-page-ok-response.decorator.d.ts +0 -5
  62. package/decorators/api-page-ok-response.decorator.js +0 -24
  63. package/decorators/auth-user.decorator.d.ts +0 -1
  64. package/decorators/auth-user.decorator.js +0 -14
  65. package/decorators/controller.decorator.d.ts +0 -1
  66. package/decorators/controller.decorator.js +0 -10
  67. package/decorators/field.decorators.d.ts +0 -79
  68. package/decorators/field.decorators.js +0 -497
  69. package/decorators/http.decorators.d.ts +0 -3
  70. package/decorators/http.decorators.js +0 -7
  71. package/decorators/index.d.ts +0 -12
  72. package/decorators/index.js +0 -28
  73. package/decorators/operation.decorator.d.ts +0 -1
  74. package/decorators/operation.decorator.js +0 -6
  75. package/decorators/property.decorators.d.ts +0 -15
  76. package/decorators/property.decorators.js +0 -31
  77. package/decorators/public-route.decorator.d.ts +0 -3
  78. package/decorators/public-route.decorator.js +0 -7
  79. package/decorators/swagger.schema.d.ts +0 -5
  80. package/decorators/swagger.schema.js +0 -78
  81. package/decorators/timestamp-column.decorator.d.ts +0 -1
  82. package/decorators/timestamp-column.decorator.js +0 -27
  83. package/decorators/transform.decorators.d.ts +0 -8
  84. package/decorators/transform.decorators.js +0 -100
  85. package/decorators/translate.decorator.d.ts +0 -5
  86. package/decorators/translate.decorator.js +0 -17
  87. package/decorators/use-dto.decorator.d.ts +0 -4
  88. package/decorators/use-dto.decorator.js +0 -8
  89. package/decorators/user-check.decorator.d.ts +0 -6
  90. package/decorators/user-check.decorator.js +0 -21
  91. package/decorators/user.decorator.d.ts +0 -12
  92. package/decorators/user.decorator.js +0 -44
  93. package/decorators/user_auth.decorator.d.ts +0 -1
  94. package/decorators/user_auth.decorator.js +0 -15
  95. package/decorators/validator.decorators.d.ts +0 -11
  96. package/decorators/validator.decorators.js +0 -78
  97. package/exceptions/file-not-image.exception.d.ts +0 -4
  98. package/exceptions/file-not-image.exception.js +0 -10
  99. package/exceptions/index.d.ts +0 -2
  100. package/exceptions/index.js +0 -18
  101. package/exceptions/page-type.exception.d.ts +0 -4
  102. package/exceptions/page-type.exception.js +0 -10
  103. package/exceptions/user-not-found.exception.d.ts +0 -4
  104. package/exceptions/user-not-found.exception.js +0 -10
  105. package/filters/bad-request.filter.d.ts +0 -5
  106. package/filters/bad-request.filter.js +0 -71
  107. package/filters/constraint-errors.d.ts +0 -1
  108. package/filters/constraint-errors.js +0 -6
  109. package/filters/index.d.ts +0 -3
  110. package/filters/index.js +0 -19
  111. package/filters/query-failed.filter.d.ts +0 -10
  112. package/filters/query-failed.filter.js +0 -42
  113. package/health-checker/health-checker.controller.d.ts +0 -13
  114. package/health-checker/health-checker.controller.js +0 -69
  115. package/health-checker/health-checker.module.d.ts +0 -2
  116. package/health-checker/health-checker.module.js +0 -24
  117. package/health-checker/index.d.ts +0 -2
  118. package/health-checker/index.js +0 -18
  119. package/helpers/common.helper.d.ts +0 -3
  120. package/helpers/common.helper.js +0 -36
  121. package/helpers/date.helper.d.ts +0 -10
  122. package/helpers/date.helper.js +0 -57
  123. package/helpers/index.d.ts +0 -2
  124. package/helpers/index.js +0 -18
  125. package/i18n/en_US/validation.json +0 -41
  126. package/i18n/zh_CN/validation.json +0 -41
  127. package/index.d.ts +0 -15
  128. package/interceptors/index.d.ts +0 -2
  129. package/interceptors/index.js +0 -18
  130. package/interceptors/language-interceptor.service.d.ts +0 -6
  131. package/interceptors/language-interceptor.service.js +0 -29
  132. package/interceptors/translation-interceptor.service.d.ts +0 -5
  133. package/interceptors/translation-interceptor.service.js +0 -34
  134. package/interfaces/IApiFile.d.ts +0 -4
  135. package/interfaces/IApiFile.js +0 -2
  136. package/interfaces/IFile.d.ts +0 -8
  137. package/interfaces/IFile.js +0 -2
  138. package/interfaces/ITranslationDecoratorInterface.d.ts +0 -3
  139. package/interfaces/ITranslationDecoratorInterface.js +0 -2
  140. package/interfaces/index.d.ts +0 -3
  141. package/interfaces/index.js +0 -19
  142. package/interfaces/response.d.ts +0 -25
  143. package/interfaces/response.js +0 -2
  144. package/middlewares/index.d.ts +0 -4
  145. package/middlewares/index.js +0 -20
  146. package/middlewares/omni-auth.middleware.d.ts +0 -1
  147. package/middlewares/omni-auth.middleware.js +0 -13
  148. package/middlewares/powerby.middleware.d.ts +0 -1
  149. package/middlewares/powerby.middleware.js +0 -10
  150. package/middlewares/request-id.middleware.d.ts +0 -7
  151. package/middlewares/request-id.middleware.js +0 -22
  152. package/middlewares/xml.middleware.d.ts +0 -4
  153. package/middlewares/xml.middleware.js +0 -24
  154. package/providers/context.provider.d.ts +0 -34
  155. package/providers/context.provider.js +0 -80
  156. package/providers/generator.provider.d.ts +0 -9
  157. package/providers/generator.provider.js +0 -50
  158. package/providers/index.d.ts +0 -2
  159. package/providers/index.js +0 -18
  160. package/setup/bootstrap.setup.d.ts +0 -2
  161. package/setup/bootstrap.setup.js +0 -177
  162. package/setup/index.d.ts +0 -6
  163. package/setup/index.js +0 -22
  164. package/setup/mode.setup.d.ts +0 -12
  165. package/setup/mode.setup.js +0 -60
  166. package/setup/redis.lock.decorator.d.ts +0 -5
  167. package/setup/redis.lock.decorator.js +0 -60
  168. package/setup/redis.lock.service.d.ts +0 -56
  169. package/setup/redis.lock.service.js +0 -338
  170. package/setup/schedule.decorator.d.ts +0 -21
  171. package/setup/schedule.decorator.js +0 -127
  172. package/setup/worker.decorator.d.ts +0 -14
  173. package/setup/worker.decorator.js +0 -130
  174. package/shared/index.d.ts +0 -2
  175. package/shared/index.js +0 -18
  176. package/shared/serviceRegistryModule.d.ts +0 -2
  177. package/shared/serviceRegistryModule.js +0 -109
  178. package/shared/services/api-config.service.d.ts +0 -59
  179. package/shared/services/api-config.service.js +0 -311
  180. package/shared/services/generator.service.d.ts +0 -4
  181. package/shared/services/generator.service.js +0 -23
  182. package/shared/services/index.d.ts +0 -4
  183. package/shared/services/index.js +0 -20
  184. package/shared/services/translation.service.d.ts +0 -9
  185. package/shared/services/translation.service.js +0 -70
  186. package/shared/services/validator.service.d.ts +0 -3
  187. package/shared/services/validator.service.js +0 -20
  188. package/validator-json/decorators.d.ts +0 -6
  189. package/validator-json/decorators.js +0 -22
  190. package/validator-json/default.d.ts +0 -6
  191. package/validator-json/default.js +0 -138
  192. package/validator-json/defaultConverters.d.ts +0 -8
  193. package/validator-json/defaultConverters.js +0 -376
  194. package/validator-json/index.d.ts +0 -4
  195. package/validator-json/index.js +0 -20
  196. package/validator-json/options.d.ts +0 -11
  197. package/validator-json/options.js +0 -10
  198. package/validators/file-mimetype.validator.d.ts +0 -13
  199. package/validators/file-mimetype.validator.js +0 -21
  200. package/validators/index.d.ts +0 -6
  201. package/validators/index.js +0 -22
  202. package/validators/is-exists.validator.d.ts +0 -18
  203. package/validators/is-exists.validator.js +0 -60
  204. package/validators/is-unique.validator.d.ts +0 -17
  205. package/validators/is-unique.validator.js +0 -91
  206. package/validators/phone-country-code.validator.d.ts +0 -2
  207. package/validators/phone-country-code.validator.js +0 -29
  208. package/validators/same-as.validator.d.ts +0 -2
  209. package/validators/same-as.validator.js +0 -24
  210. package/validators/skip-empty.validator.d.ts +0 -1
  211. package/validators/skip-empty.validator.js +0 -17
@@ -1,497 +0,0 @@
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
- const decorators = [
387
- (0, class_transformer_1.Type)(() => Date),
388
- (0, class_validator_1.IsDate)({ message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_DATE') }),
389
- ];
390
- if (options.nullable) {
391
- decorators.push((0, validator_decorators_1.IsNullable)());
392
- }
393
- else {
394
- decorators.push((0, class_validator_1.NotEquals)(null));
395
- }
396
- if (options.minDate) {
397
- decorators.push((0, class_validator_1.MinDate)(options.minDate, {
398
- each: options.each,
399
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.MIN_DATE'),
400
- }));
401
- }
402
- if (options.maxDate) {
403
- decorators.push((0, class_validator_1.MaxDate)(options.maxDate, {
404
- each: options.each,
405
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.MAX_DATE'),
406
- }));
407
- }
408
- if (options.swagger !== false) {
409
- decorators.push((0, swagger_1.ApiProperty)(Object.assign({ type: Date }, options)));
410
- }
411
- return (0, common_1.applyDecorators)(...decorators);
412
- }
413
- function DateFieldOptional(options = {}) {
414
- return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), DateField(Object.assign(Object.assign({}, options), { required: false })));
415
- }
416
- function IpFieldOptional(options = {}) {
417
- return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), IpField(Object.assign({ required: false }, options)));
418
- }
419
- function IpField(options) {
420
- const decorators = [
421
- (0, class_validator_1.IsIP)(options.version || 4, {
422
- each: options.each,
423
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_IP'),
424
- }),
425
- StringField(Object.assign({ toLowerCase: true }, options)),
426
- ];
427
- if (options.nullable) {
428
- decorators.push((0, validator_decorators_1.IsNullable)({ each: options.each }));
429
- }
430
- else {
431
- decorators.push((0, class_validator_1.NotEquals)(null, { each: options.each }));
432
- }
433
- return (0, common_1.applyDecorators)(...decorators);
434
- }
435
- function ObjectField(options = {}) {
436
- const decorators = [
437
- (0, class_transformer_1.Type)(() => Object),
438
- (0, class_validator_1.IsObject)({
439
- each: options.each,
440
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_OBJECT'),
441
- }),
442
- ];
443
- if (options.nullable) {
444
- decorators.push((0, validator_decorators_1.IsNullable)({ each: options.each }));
445
- }
446
- else {
447
- decorators.push((0, class_validator_1.NotEquals)(null, { each: options.each }));
448
- }
449
- if (options.swagger !== false) {
450
- decorators.push((0, swagger_1.ApiProperty)(Object.assign({ type: 'object', isArray: options.each }, options)));
451
- }
452
- return (0, common_1.applyDecorators)(...decorators);
453
- }
454
- function ObjectFieldOptional(options = {}) {
455
- return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), ObjectField(Object.assign({ required: false }, options)));
456
- }
457
- function TimeZoneField(options = {}) {
458
- const decorators = [
459
- StringField(Object.assign({}, options)),
460
- (0, class_validator_1.IsTimeZone)({
461
- each: options.each,
462
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_TIME_ZONE'),
463
- }),
464
- ];
465
- if (options.nullable) {
466
- decorators.push((0, validator_decorators_1.IsNullable)({ each: options.each }));
467
- }
468
- else {
469
- decorators.push((0, class_validator_1.NotEquals)(null, { each: options.each }));
470
- }
471
- return (0, common_1.applyDecorators)(...decorators);
472
- }
473
- function TimeZoneFieldOptional(options = {}) {
474
- return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), TimeZoneField(Object.assign({ required: false }, options)));
475
- }
476
- function LocaleField(options = {}) {
477
- const decorators = [
478
- StringField(Object.assign({}, options)),
479
- (0, class_validator_1.IsLocale)({
480
- each: options.each,
481
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_LOCALE'),
482
- }),
483
- ];
484
- if (options.nullable) {
485
- decorators.push((0, validator_decorators_1.IsNullable)({ each: options.each }));
486
- }
487
- else {
488
- decorators.push((0, class_validator_1.NotEquals)(null, { each: options.each }));
489
- }
490
- if (options.swagger !== false) {
491
- decorators.push((0, swagger_1.ApiProperty)(Object.assign({ type: String }, options)));
492
- }
493
- return (0, common_1.applyDecorators)(...decorators);
494
- }
495
- function LocaleFieldOptional(options = {}) {
496
- return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), LocaleField(Object.assign({ required: false }, options)));
497
- }
@@ -1,3 +0,0 @@
1
- import type { PipeTransform } from '@nestjs/common';
2
- import type { Type } from '@nestjs/common/interfaces';
3
- export declare function UUIDParam(property: string, ...pipes: Array<Type<PipeTransform> | PipeTransform>): ParameterDecorator;
@@ -1,7 +0,0 @@
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
- }
@@ -1,12 +0,0 @@
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';
@@ -1,28 +0,0 @@
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);
@@ -1 +0,0 @@
1
- export declare const OperationLog: (operation: string) => import("@nestjs/common").CustomDecorator<string>;
@@ -1,6 +0,0 @@
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;
@@ -1,15 +0,0 @@
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;
@@ -1,31 +0,0 @@
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
- }
@@ -1,3 +0,0 @@
1
- import type { CustomDecorator } from '@nestjs/common';
2
- export declare const PUBLIC_ROUTE_KEY = "public_route";
3
- export declare const PublicRoute: (isPublic?: boolean) => CustomDecorator;
@@ -1,7 +0,0 @@
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;
@@ -1,5 +0,0 @@
1
- import _ from 'lodash';
2
- import type { IApiFile } from '../interfaces';
3
- export declare function ApiFile(files: _.Many<IApiFile>, options?: Partial<{
4
- isRequired: boolean;
5
- }>): MethodDecorator;