@nest-omni/core 1.0.12 → 1.0.14

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 (174) hide show
  1. package/package.json +1 -1
  2. package/common/abstract-client.service.d.ts +0 -16
  3. package/common/abstract-client.service.js +0 -35
  4. package/common/abstract.entity.d.ts +0 -17
  5. package/common/abstract.entity.js +0 -64
  6. package/common/dto/abstract.dto.d.ts +0 -13
  7. package/common/dto/abstract.dto.js +0 -59
  8. package/common/dto/bulk-id.dto.d.ts +0 -3
  9. package/common/dto/bulk-id.dto.js +0 -27
  10. package/common/dto/create-translation.dto.d.ts +0 -5
  11. package/common/dto/create-translation.dto.js +0 -25
  12. package/common/dto/index.d.ts +0 -6
  13. package/common/dto/index.js +0 -22
  14. package/common/dto/page-meta.dto.d.ts +0 -15
  15. package/common/dto/page-meta.dto.js +0 -48
  16. package/common/dto/page-options.dto.d.ts +0 -8
  17. package/common/dto/page-options.dto.js +0 -52
  18. package/common/dto/page.dto.d.ts +0 -11
  19. package/common/dto/page.dto.js +0 -53
  20. package/common/index.d.ts +0 -4
  21. package/common/index.js +0 -20
  22. package/common/utils.d.ts +0 -3
  23. package/common/utils.js +0 -25
  24. package/constants/index.d.ts +0 -2
  25. package/constants/index.js +0 -18
  26. package/constants/language-code.d.ts +0 -5
  27. package/constants/language-code.js +0 -9
  28. package/constants/order.d.ts +0 -4
  29. package/constants/order.js +0 -8
  30. package/decorators/api-page-ok-response.decorator.d.ts +0 -5
  31. package/decorators/api-page-ok-response.decorator.js +0 -25
  32. package/decorators/auth-user.decorator.d.ts +0 -1
  33. package/decorators/auth-user.decorator.js +0 -15
  34. package/decorators/controller.decorator.d.ts +0 -1
  35. package/decorators/controller.decorator.js +0 -11
  36. package/decorators/field.decorators.d.ts +0 -71
  37. package/decorators/field.decorators.js +0 -449
  38. package/decorators/http.decorators.d.ts +0 -3
  39. package/decorators/http.decorators.js +0 -8
  40. package/decorators/index.d.ts +0 -12
  41. package/decorators/index.js +0 -28
  42. package/decorators/omni-auth.decorator.d.ts +0 -8
  43. package/decorators/omni-auth.decorator.js +0 -35
  44. package/decorators/operation.decorator.d.ts +0 -1
  45. package/decorators/operation.decorator.js +0 -6
  46. package/decorators/property.decorators.d.ts +0 -15
  47. package/decorators/property.decorators.js +0 -32
  48. package/decorators/public-route.decorator.d.ts +0 -3
  49. package/decorators/public-route.decorator.js +0 -7
  50. package/decorators/swagger.schema.d.ts +0 -5
  51. package/decorators/swagger.schema.js +0 -79
  52. package/decorators/timestamp-column.decorator.d.ts +0 -1
  53. package/decorators/timestamp-column.decorator.js +0 -28
  54. package/decorators/transform.decorators.d.ts +0 -8
  55. package/decorators/transform.decorators.js +0 -95
  56. package/decorators/translate.decorator.d.ts +0 -5
  57. package/decorators/translate.decorator.js +0 -17
  58. package/decorators/use-dto.decorator.d.ts +0 -4
  59. package/decorators/use-dto.decorator.js +0 -9
  60. package/decorators/user-check.decorator.d.ts +0 -6
  61. package/decorators/user-check.decorator.js +0 -21
  62. package/decorators/user.decorator.d.ts +0 -8
  63. package/decorators/user.decorator.js +0 -38
  64. package/decorators/user_auth.decorator.d.ts +0 -1
  65. package/decorators/user_auth.decorator.js +0 -16
  66. package/decorators/validator.decorators.d.ts +0 -10
  67. package/decorators/validator.decorators.js +0 -59
  68. package/exceptions/file-not-image.exception.d.ts +0 -4
  69. package/exceptions/file-not-image.exception.js +0 -10
  70. package/exceptions/index.d.ts +0 -2
  71. package/exceptions/index.js +0 -18
  72. package/exceptions/page-type.exception.d.ts +0 -4
  73. package/exceptions/page-type.exception.js +0 -10
  74. package/exceptions/user-not-found.exception.d.ts +0 -4
  75. package/exceptions/user-not-found.exception.js +0 -10
  76. package/filters/bad-request.filter.d.ts +0 -5
  77. package/filters/bad-request.filter.js +0 -60
  78. package/filters/constraint-errors.d.ts +0 -1
  79. package/filters/constraint-errors.js +0 -6
  80. package/filters/index.d.ts +0 -3
  81. package/filters/index.js +0 -19
  82. package/filters/query-failed.filter.d.ts +0 -10
  83. package/filters/query-failed.filter.js +0 -42
  84. package/health-checker/health-checker.controller.d.ts +0 -15
  85. package/health-checker/health-checker.controller.js +0 -72
  86. package/health-checker/health-checker.module.d.ts +0 -2
  87. package/health-checker/health-checker.module.js +0 -25
  88. package/health-checker/health-indicators/service.indicator.d.ts +0 -8
  89. package/health-checker/health-indicators/service.indicator.js +0 -66
  90. package/helpers/common.helper.d.ts +0 -3
  91. package/helpers/common.helper.js +0 -36
  92. package/helpers/date.helper.d.ts +0 -10
  93. package/helpers/date.helper.js +0 -58
  94. package/helpers/index.d.ts +0 -2
  95. package/helpers/index.js +0 -18
  96. package/i18n/en_US/validation.json +0 -38
  97. package/i18n/zh_CN/validation.json +0 -38
  98. package/index.js +0 -30
  99. package/interceptors/auth-user.interceptor.d.ts +0 -4
  100. package/interceptors/auth-user.interceptor.js +0 -24
  101. package/interceptors/index.d.ts +0 -2
  102. package/interceptors/index.js +0 -18
  103. package/interceptors/language-interceptor.service.d.ts +0 -6
  104. package/interceptors/language-interceptor.service.js +0 -30
  105. package/interceptors/translation-interceptor.service.d.ts +0 -5
  106. package/interceptors/translation-interceptor.service.js +0 -34
  107. package/interfaces/IApiFile.d.ts +0 -4
  108. package/interfaces/IApiFile.js +0 -2
  109. package/interfaces/IFile.d.ts +0 -9
  110. package/interfaces/IFile.js +0 -2
  111. package/interfaces/ITranslationDecoratorInterface.d.ts +0 -3
  112. package/interfaces/ITranslationDecoratorInterface.js +0 -2
  113. package/interfaces/index.d.ts +0 -3
  114. package/interfaces/index.js +0 -19
  115. package/interfaces/response.d.ts +0 -25
  116. package/interfaces/response.js +0 -2
  117. package/middlewares/index.d.ts +0 -3
  118. package/middlewares/index.js +0 -19
  119. package/middlewares/omni-auth.middleware.d.ts +0 -1
  120. package/middlewares/omni-auth.middleware.js +0 -13
  121. package/middlewares/powerby.middleware.d.ts +0 -1
  122. package/middlewares/powerby.middleware.js +0 -10
  123. package/middlewares/request-id.middleware.d.ts +0 -7
  124. package/middlewares/request-id.middleware.js +0 -22
  125. package/providers/context.provider.d.ts +0 -32
  126. package/providers/context.provider.js +0 -71
  127. package/providers/generator.provider.d.ts +0 -9
  128. package/providers/generator.provider.js +0 -50
  129. package/providers/index.d.ts +0 -2
  130. package/providers/index.js +0 -18
  131. package/setup/bootstrap.setup.d.ts +0 -5
  132. package/setup/bootstrap.setup.js +0 -112
  133. package/setup/index.d.ts +0 -1
  134. package/setup/index.js +0 -17
  135. package/shared/index.d.ts +0 -2
  136. package/shared/index.js +0 -18
  137. package/shared/serviceRegistryModule.d.ts +0 -2
  138. package/shared/serviceRegistryModule.js +0 -110
  139. package/shared/services/api-config.service.d.ts +0 -70
  140. package/shared/services/api-config.service.js +0 -290
  141. package/shared/services/aws-s3.service.d.ts +0 -10
  142. package/shared/services/aws-s3.service.js +0 -56
  143. package/shared/services/generator.service.d.ts +0 -4
  144. package/shared/services/generator.service.js +0 -23
  145. package/shared/services/index.d.ts +0 -5
  146. package/shared/services/index.js +0 -21
  147. package/shared/services/translation.service.d.ts +0 -9
  148. package/shared/services/translation.service.js +0 -70
  149. package/shared/services/validator.service.d.ts +0 -3
  150. package/shared/services/validator.service.js +0 -20
  151. package/validator-json/decorators.d.ts +0 -6
  152. package/validator-json/decorators.js +0 -23
  153. package/validator-json/default.d.ts +0 -6
  154. package/validator-json/default.js +0 -130
  155. package/validator-json/defaultConverters.d.ts +0 -8
  156. package/validator-json/defaultConverters.js +0 -376
  157. package/validator-json/index.d.ts +0 -4
  158. package/validator-json/index.js +0 -20
  159. package/validator-json/options.d.ts +0 -11
  160. package/validator-json/options.js +0 -10
  161. package/validators/file-mimetype.validator.d.ts +0 -13
  162. package/validators/file-mimetype.validator.js +0 -21
  163. package/validators/index.d.ts +0 -6
  164. package/validators/index.js +0 -22
  165. package/validators/is-exists.validator.d.ts +0 -18
  166. package/validators/is-exists.validator.js +0 -61
  167. package/validators/is-unique.validator.d.ts +0 -17
  168. package/validators/is-unique.validator.js +0 -92
  169. package/validators/phone-country-code.validator.d.ts +0 -2
  170. package/validators/phone-country-code.validator.js +0 -30
  171. package/validators/same-as.validator.d.ts +0 -2
  172. package/validators/same-as.validator.js +0 -25
  173. package/validators/skip-empty.validator.d.ts +0 -1
  174. package/validators/skip-empty.validator.js +0 -18
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ApiPageOkResponse = void 0;
4
- const common_1 = require("@nestjs/common");
5
- const swagger_1 = require("@nestjs/swagger");
6
- const page_dto_1 = require("../common/dto/page.dto");
7
- function ApiPageOkResponse(options) {
8
- return (0, common_1.applyDecorators)((0, swagger_1.ApiExtraModels)(page_dto_1.PageDto), (0, swagger_1.ApiExtraModels)(options.type), (0, swagger_1.ApiOkResponse)({
9
- description: options.description,
10
- schema: {
11
- allOf: [
12
- { $ref: (0, swagger_1.getSchemaPath)(page_dto_1.PageDto) },
13
- {
14
- properties: {
15
- results: {
16
- type: 'array',
17
- items: { $ref: (0, swagger_1.getSchemaPath)(options.type) },
18
- },
19
- },
20
- },
21
- ],
22
- },
23
- }));
24
- }
25
- exports.ApiPageOkResponse = ApiPageOkResponse;
@@ -1 +0,0 @@
1
- export declare function AuthUser(): ParameterDecorator;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AuthUser = void 0;
4
- const common_1 = require("@nestjs/common");
5
- function AuthUser() {
6
- return (0, common_1.createParamDecorator)((_data, context) => {
7
- const request = context.switchToHttp().getRequest();
8
- const user = request.user;
9
- if (user === null || user === void 0 ? void 0 : user[Symbol.for('isPublic')]) {
10
- return;
11
- }
12
- return user;
13
- })();
14
- }
15
- exports.AuthUser = AuthUser;
@@ -1 +0,0 @@
1
- export declare function Controller(field: string): <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Controller = void 0;
4
- const common_1 = require("@nestjs/common");
5
- const crud_1 = require("@dataui/crud");
6
- const _ = require("lodash");
7
- function Controller(field) {
8
- const featureName = _.upperFirst(field);
9
- return (0, common_1.applyDecorators)((0, common_1.Controller)(field), (0, crud_1.Feature)(featureName));
10
- }
11
- exports.Controller = Controller;
@@ -1,71 +0,0 @@
1
- import type { ApiPropertyOptions } from '@nestjs/swagger';
2
- import ValidatorJS from 'validator';
3
- type RequireField<T, K extends keyof T> = T & Required<Pick<T, K>>;
4
- interface IFieldOptions {
5
- each?: boolean;
6
- swagger?: boolean;
7
- nullable?: boolean;
8
- group?: string[];
9
- message?: string;
10
- }
11
- interface INumberFieldOptions extends IFieldOptions {
12
- min?: number;
13
- max?: number;
14
- int?: boolean;
15
- isPositive?: boolean;
16
- }
17
- interface IDateFieldOptions extends IFieldOptions {
18
- minDate?: Date | (() => Date);
19
- maxDate?: Date | (() => Date);
20
- }
21
- interface IStringFieldOptions extends IFieldOptions {
22
- minLength?: number;
23
- maxLength?: number;
24
- toLowerCase?: boolean;
25
- toUpperCase?: boolean;
26
- }
27
- interface IEmailFieldOptions {
28
- emailOptions?: ValidatorJS.IsEmailOptions;
29
- }
30
- interface IIPFieldOptions {
31
- version?: ValidatorJS.IPVersion;
32
- }
33
- interface IFQDNFieldOptions extends ValidatorJS.IsFQDNOptions {
34
- }
35
- type IClassFieldOptions = IFieldOptions;
36
- type IBooleanFieldOptions = IFieldOptions;
37
- type IEnumFieldOptions = IFieldOptions;
38
- export declare function NumberField(options?: Omit<ApiPropertyOptions, 'type'> & INumberFieldOptions): PropertyDecorator;
39
- export declare function NumberFieldOptional(options?: Omit<ApiPropertyOptions, 'type' | 'required'> & INumberFieldOptions): PropertyDecorator;
40
- export declare function StringField(options?: Omit<ApiPropertyOptions, 'type'> & IStringFieldOptions): PropertyDecorator;
41
- export declare function StringFieldOptional(options?: Omit<ApiPropertyOptions, 'type' | 'required'> & IStringFieldOptions): PropertyDecorator;
42
- export declare function PasswordField(options?: Omit<ApiPropertyOptions, 'type' | 'minLength'> & IStringFieldOptions): PropertyDecorator;
43
- export declare function PasswordFieldOptional(options?: Omit<ApiPropertyOptions, 'type' | 'required' | 'minLength'> & IStringFieldOptions): PropertyDecorator;
44
- export declare function BooleanField(options?: Omit<ApiPropertyOptions, 'type'> & IBooleanFieldOptions): PropertyDecorator;
45
- export declare function BooleanFieldOptional(options?: Omit<ApiPropertyOptions, 'type' | 'required'> & IBooleanFieldOptions): PropertyDecorator;
46
- export declare function TranslationsField(options: RequireField<Omit<ApiPropertyOptions, 'isArray'>, 'type'> & IFieldOptions): PropertyDecorator;
47
- export declare function TranslationsFieldOptional(options: RequireField<Omit<ApiPropertyOptions, 'isArray'>, 'type'> & IFieldOptions): PropertyDecorator;
48
- export declare function TmpKeyField(options?: Omit<ApiPropertyOptions, 'type'> & IStringFieldOptions): PropertyDecorator;
49
- export declare function TmpKeyFieldOptional(options?: Omit<ApiPropertyOptions, 'type' | 'required'> & IStringFieldOptions): PropertyDecorator;
50
- export declare function getEnumDescription(enumType: any): string;
51
- export declare function EnumField<TEnum extends object>(getEnum: () => TEnum, options?: Omit<ApiPropertyOptions, 'type' | 'enum' | 'enumName' | 'isArray'> & IEnumFieldOptions): PropertyDecorator;
52
- export declare function ClassField<TClass extends object>(getClass: () => TClass, options?: Omit<ApiPropertyOptions, 'type'> & IClassFieldOptions): PropertyDecorator;
53
- export declare function EnumFieldOptional<TEnum extends object>(getEnum: () => TEnum, options?: Omit<ApiPropertyOptions, 'type' | 'required' | 'enum' | 'enumName'> & IEnumFieldOptions): PropertyDecorator;
54
- export declare function ClassFieldOptional<TClass extends object>(getClass: () => TClass, options?: Omit<ApiPropertyOptions, 'type' | 'required'> & IClassFieldOptions): PropertyDecorator;
55
- export declare function EmailField(options?: Omit<ApiPropertyOptions, 'type'> & IStringFieldOptions & IEmailFieldOptions): PropertyDecorator;
56
- export declare function EmailFieldOptional(options?: Omit<ApiPropertyOptions, 'type'> & IStringFieldOptions & IEmailFieldOptions): PropertyDecorator;
57
- export declare function PhoneField(options?: Omit<ApiPropertyOptions, 'type'> & IFieldOptions): PropertyDecorator;
58
- export declare function PhoneFieldOptional(options?: Omit<ApiPropertyOptions, 'type' | 'required'> & IFieldOptions): PropertyDecorator;
59
- export declare function UUIDField(options?: Omit<ApiPropertyOptions, 'type' | 'format' | 'isArray'> & IFieldOptions): PropertyDecorator;
60
- export declare function UUIDFieldOptional(options?: Omit<ApiPropertyOptions, 'type' | 'required' | 'isArray'> & IFieldOptions): PropertyDecorator;
61
- export declare function URLField(options?: Omit<ApiPropertyOptions, 'type'> & IStringFieldOptions): PropertyDecorator;
62
- export declare function URLFieldOptional(options?: Omit<ApiPropertyOptions, 'type'> & IStringFieldOptions): PropertyDecorator;
63
- export declare function FQDNField(options?: Omit<ApiPropertyOptions, 'type'> & IFQDNFieldOptions & IStringFieldOptions): PropertyDecorator;
64
- export declare function FQDNFieldOptional(options?: Omit<ApiPropertyOptions, 'type'> & IFQDNFieldOptions & IStringFieldOptions): PropertyDecorator;
65
- export declare function DateField(options?: Omit<ApiPropertyOptions, 'type'> & IDateFieldOptions): PropertyDecorator;
66
- export declare function DateFieldOptional(options?: Omit<ApiPropertyOptions, 'type' | 'required'> & IDateFieldOptions): PropertyDecorator;
67
- export declare function IpFieldOptional(options?: Omit<ApiPropertyOptions, 'type'> & IIPFieldOptions & IStringFieldOptions): PropertyDecorator;
68
- export declare function IpField(options: Omit<ApiPropertyOptions, 'type'> & IStringFieldOptions & IIPFieldOptions): PropertyDecorator;
69
- export declare function ObjectField(options: Omit<ApiPropertyOptions, 'type'> & IFieldOptions): PropertyDecorator;
70
- export declare function ObjectFieldOptional(options?: Omit<ApiPropertyOptions, 'type'> & IFieldOptions): PropertyDecorator;
71
- export {};
@@ -1,449 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ObjectFieldOptional = exports.ObjectField = exports.IpField = exports.IpFieldOptional = exports.DateFieldOptional = exports.DateField = exports.FQDNFieldOptional = exports.FQDNField = exports.URLFieldOptional = exports.URLField = exports.UUIDFieldOptional = exports.UUIDField = exports.PhoneFieldOptional = exports.PhoneField = exports.EmailFieldOptional = exports.EmailField = exports.ClassFieldOptional = exports.EnumFieldOptional = exports.ClassField = exports.EnumField = exports.getEnumDescription = exports.TmpKeyFieldOptional = exports.TmpKeyField = exports.TranslationsFieldOptional = exports.TranslationsField = exports.BooleanFieldOptional = exports.BooleanField = exports.PasswordFieldOptional = exports.PasswordField = exports.StringFieldOptional = exports.StringField = exports.NumberFieldOptional = exports.NumberField = void 0;
4
- const common_1 = require("@nestjs/common");
5
- const swagger_1 = require("@nestjs/swagger");
6
- const nestjs_i18n_1 = require("nestjs-i18n");
7
- const class_transformer_1 = require("class-transformer");
8
- const class_validator_1 = require("class-validator");
9
- const constants_1 = require("../constants");
10
- const property_decorators_1 = require("./property.decorators");
11
- const transform_decorators_1 = require("./transform.decorators");
12
- const validator_decorators_1 = require("./validator.decorators");
13
- function NumberField(options = {}) {
14
- const decorators = [(0, class_transformer_1.Type)(() => Number)];
15
- if (options.nullable) {
16
- decorators.push((0, validator_decorators_1.IsNullable)({
17
- each: options.each,
18
- }));
19
- }
20
- else {
21
- decorators.push((0, class_validator_1.NotEquals)(null, {
22
- each: options.each,
23
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.NOT_EQUALS'),
24
- }));
25
- }
26
- if (options.swagger !== false) {
27
- decorators.push((0, swagger_1.ApiProperty)(Object.assign({ type: Number }, options)));
28
- }
29
- if (options.each) {
30
- decorators.push((0, transform_decorators_1.ToArray)());
31
- }
32
- if (options.int) {
33
- decorators.push((0, class_validator_1.IsInt)({
34
- each: options.each,
35
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_INT'),
36
- }));
37
- }
38
- else {
39
- decorators.push((0, class_validator_1.IsNumber)({}, {
40
- each: options.each,
41
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_NUMBER'),
42
- }));
43
- }
44
- if (typeof options.min === 'number') {
45
- decorators.push((0, class_validator_1.Min)(options.min, {
46
- each: options.each,
47
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.MIN'),
48
- }));
49
- }
50
- if (typeof options.max === 'number') {
51
- decorators.push((0, class_validator_1.Max)(options.max, {
52
- each: options.each,
53
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.MAX'),
54
- }));
55
- }
56
- if (options.isPositive) {
57
- decorators.push((0, class_validator_1.IsPositive)({
58
- each: options.each,
59
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_POSITIVE'),
60
- }));
61
- }
62
- return (0, common_1.applyDecorators)(...decorators);
63
- }
64
- exports.NumberField = NumberField;
65
- function NumberFieldOptional(options = {}) {
66
- return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), NumberField(Object.assign({ required: false }, options)));
67
- }
68
- exports.NumberFieldOptional = NumberFieldOptional;
69
- function StringField(options = {}) {
70
- var _a;
71
- const decorators = [
72
- (0, class_transformer_1.Type)(() => String),
73
- (0, class_validator_1.IsString)({
74
- each: options.each,
75
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_STRING'),
76
- }),
77
- ];
78
- if (options.nullable) {
79
- decorators.push((0, validator_decorators_1.IsNullable)({ each: options.each }));
80
- }
81
- else {
82
- decorators.push((0, class_validator_1.NotEquals)(null, {
83
- each: options.each,
84
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.NOT_EQUALS'),
85
- }));
86
- }
87
- if (options.swagger !== false) {
88
- decorators.push((0, swagger_1.ApiProperty)(Object.assign(Object.assign({ type: String }, options), { isArray: options.each })));
89
- }
90
- const minLength = (_a = options.minLength) !== null && _a !== void 0 ? _a : 1;
91
- decorators.push((0, class_validator_1.MinLength)(minLength, {
92
- each: options.each,
93
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.MIN_LENGTH'),
94
- }));
95
- if (options.maxLength) {
96
- decorators.push((0, class_validator_1.MaxLength)(options.maxLength, {
97
- each: options.each,
98
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.MAX_LENGTH'),
99
- }));
100
- }
101
- if (options.toLowerCase) {
102
- decorators.push((0, transform_decorators_1.ToLowerCase)());
103
- }
104
- if (options.toUpperCase) {
105
- decorators.push((0, transform_decorators_1.ToUpperCase)());
106
- }
107
- return (0, common_1.applyDecorators)(...decorators);
108
- }
109
- exports.StringField = StringField;
110
- function StringFieldOptional(options = {}) {
111
- return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), StringField(Object.assign({ required: false }, options)));
112
- }
113
- exports.StringFieldOptional = StringFieldOptional;
114
- function PasswordField(options = {}) {
115
- const decorators = [
116
- StringField(Object.assign(Object.assign({}, options), { minLength: 6 })),
117
- ];
118
- if (options.nullable) {
119
- decorators.push((0, validator_decorators_1.IsNullable)());
120
- }
121
- else {
122
- decorators.push((0, class_validator_1.NotEquals)(null));
123
- }
124
- return (0, common_1.applyDecorators)(...decorators);
125
- }
126
- exports.PasswordField = PasswordField;
127
- function PasswordFieldOptional(options = {}) {
128
- return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), PasswordField(Object.assign({ required: false }, options)));
129
- }
130
- exports.PasswordFieldOptional = PasswordFieldOptional;
131
- function BooleanField(options = {}) {
132
- const decorators = [
133
- (0, transform_decorators_1.ToBoolean)(),
134
- (0, class_validator_1.IsBoolean)({ message: 'validation.INVALID_BOOLEAN' }),
135
- ];
136
- if (options.nullable) {
137
- decorators.push((0, validator_decorators_1.IsNullable)());
138
- }
139
- else {
140
- decorators.push((0, class_validator_1.NotEquals)(null));
141
- }
142
- if (options.swagger !== false) {
143
- decorators.push((0, swagger_1.ApiProperty)(Object.assign({ type: Boolean }, options)));
144
- }
145
- return (0, common_1.applyDecorators)(...decorators);
146
- }
147
- exports.BooleanField = BooleanField;
148
- function BooleanFieldOptional(options = {}) {
149
- return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), BooleanField(Object.assign({ required: false }, options)));
150
- }
151
- exports.BooleanFieldOptional = BooleanFieldOptional;
152
- function TranslationsField(options) {
153
- const decorators = [
154
- (0, class_validator_1.ArrayMinSize)(constants_1.supportedLanguageCount),
155
- (0, class_validator_1.ArrayMaxSize)(constants_1.supportedLanguageCount),
156
- (0, class_validator_1.ValidateNested)({
157
- each: true,
158
- }),
159
- (0, class_transformer_1.Type)(() => options.type),
160
- ];
161
- if (options.nullable) {
162
- decorators.push((0, validator_decorators_1.IsNullable)());
163
- }
164
- else {
165
- decorators.push((0, class_validator_1.NotEquals)(null));
166
- }
167
- if (options.swagger !== false) {
168
- decorators.push((0, swagger_1.ApiProperty)(Object.assign({ isArray: true }, options)));
169
- }
170
- return (0, common_1.applyDecorators)(...decorators);
171
- }
172
- exports.TranslationsField = TranslationsField;
173
- function TranslationsFieldOptional(options) {
174
- return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), TranslationsField(Object.assign({ required: false }, options)));
175
- }
176
- exports.TranslationsFieldOptional = TranslationsFieldOptional;
177
- function TmpKeyField(options = {}) {
178
- const decorators = [
179
- StringField(options),
180
- (0, validator_decorators_1.IsTmpKey)({ each: options.each }),
181
- ];
182
- if (options.nullable) {
183
- decorators.push((0, validator_decorators_1.IsNullable)());
184
- }
185
- else {
186
- decorators.push((0, class_validator_1.NotEquals)(null));
187
- }
188
- if (options.swagger !== false) {
189
- decorators.push((0, swagger_1.ApiProperty)(Object.assign(Object.assign({ type: String }, options), { isArray: options.each })));
190
- }
191
- return (0, common_1.applyDecorators)(...decorators);
192
- }
193
- exports.TmpKeyField = TmpKeyField;
194
- function TmpKeyFieldOptional(options = {}) {
195
- return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), TmpKeyField(Object.assign({ required: false }, options)));
196
- }
197
- exports.TmpKeyFieldOptional = TmpKeyFieldOptional;
198
- function getEnumDescription(enumType) {
199
- const keys = Object.keys(enumType).filter((k) => typeof enumType[k] === 'number');
200
- return keys.map((k) => `${enumType[k]}: ${k}`).join(', ');
201
- }
202
- exports.getEnumDescription = getEnumDescription;
203
- function EnumField(getEnum, options = {}) {
204
- const enumValue = getEnum();
205
- const decorators = [
206
- (0, class_validator_1.IsEnum)(enumValue, {
207
- each: options.each,
208
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_ENUM'),
209
- }),
210
- ];
211
- if (options.nullable) {
212
- decorators.push((0, validator_decorators_1.IsNullable)());
213
- }
214
- else {
215
- decorators.push((0, class_validator_1.NotEquals)(null));
216
- }
217
- if (options.each) {
218
- decorators.push((0, transform_decorators_1.ToArray)());
219
- }
220
- if (options.swagger !== false) {
221
- decorators.push((0, property_decorators_1.ApiEnumProperty)(getEnum, Object.assign(Object.assign({}, options), { isArray: options.each })));
222
- }
223
- return (0, common_1.applyDecorators)(...decorators);
224
- }
225
- exports.EnumField = EnumField;
226
- function ClassField(getClass, options = {}) {
227
- const classValue = getClass();
228
- if (!classValue) {
229
- throw new Error('ClassField: recursive class definition');
230
- }
231
- const decorators = [
232
- (0, class_transformer_1.Type)(() => classValue),
233
- (0, class_validator_1.ValidateNested)({ each: options.each }),
234
- ];
235
- if (options.required !== false) {
236
- decorators.push((0, class_validator_1.IsDefined)());
237
- }
238
- if (options.nullable) {
239
- decorators.push((0, validator_decorators_1.IsNullable)());
240
- }
241
- else {
242
- decorators.push((0, class_validator_1.NotEquals)(null));
243
- }
244
- if (options.swagger !== false) {
245
- decorators.push((0, swagger_1.ApiProperty)(Object.assign({ type: () => classValue }, options)));
246
- }
247
- if (options.each) {
248
- decorators.push((0, transform_decorators_1.ToArray)());
249
- }
250
- return (0, common_1.applyDecorators)(...decorators);
251
- }
252
- exports.ClassField = ClassField;
253
- function EnumFieldOptional(getEnum, options = {}) {
254
- return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), EnumField(getEnum, Object.assign({ required: false }, options)));
255
- }
256
- exports.EnumFieldOptional = EnumFieldOptional;
257
- function ClassFieldOptional(getClass, options = {}) {
258
- return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), ClassField(getClass, Object.assign({ required: false }, options)));
259
- }
260
- exports.ClassFieldOptional = ClassFieldOptional;
261
- function EmailField(options = {}) {
262
- var _a;
263
- const decorators = [
264
- (0, class_validator_1.IsEmail)(options.emailOptions, {
265
- message: (_a = options.message) !== null && _a !== void 0 ? _a : (0, nestjs_i18n_1.i18nValidationMessage)('validation.INVALID_EMAIL'),
266
- }),
267
- StringField(Object.assign({ toLowerCase: true }, options)),
268
- ];
269
- if (options.nullable) {
270
- decorators.push((0, validator_decorators_1.IsNullable)());
271
- }
272
- else {
273
- decorators.push((0, class_validator_1.NotEquals)(null));
274
- }
275
- if (options.swagger !== false) {
276
- decorators.push((0, swagger_1.ApiProperty)(Object.assign({ type: String }, options)));
277
- }
278
- return (0, common_1.applyDecorators)(...decorators);
279
- }
280
- exports.EmailField = EmailField;
281
- function EmailFieldOptional(options = {}) {
282
- return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), EmailField(Object.assign({ required: false }, options)));
283
- }
284
- exports.EmailFieldOptional = EmailFieldOptional;
285
- function PhoneField(options = {}) {
286
- const decorators = [(0, validator_decorators_1.IsPhoneNumber)(), (0, transform_decorators_1.PhoneNumberSerializer)()];
287
- if (options.nullable) {
288
- decorators.push((0, validator_decorators_1.IsNullable)());
289
- }
290
- else {
291
- decorators.push((0, class_validator_1.NotEquals)(null));
292
- }
293
- if (options.swagger !== false) {
294
- decorators.push((0, swagger_1.ApiProperty)(Object.assign({ type: String }, options)));
295
- }
296
- return (0, common_1.applyDecorators)(...decorators);
297
- }
298
- exports.PhoneField = PhoneField;
299
- function PhoneFieldOptional(options = {}) {
300
- return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), PhoneField(Object.assign({ required: false }, options)));
301
- }
302
- exports.PhoneFieldOptional = PhoneFieldOptional;
303
- function UUIDField(options = {}) {
304
- const decorators = [
305
- (0, class_transformer_1.Type)(() => String),
306
- (0, class_validator_1.IsUUID)('4', {
307
- each: options.each,
308
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_UUID'),
309
- }),
310
- ];
311
- if (options.nullable) {
312
- decorators.push((0, validator_decorators_1.IsNullable)({ message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_NULLABLE') }));
313
- }
314
- else {
315
- decorators.push((0, class_validator_1.NotEquals)(null));
316
- }
317
- if (options.swagger !== false) {
318
- decorators.push((0, property_decorators_1.ApiUUIDProperty)(options));
319
- }
320
- if (options.each) {
321
- decorators.push((0, transform_decorators_1.ToArray)());
322
- }
323
- return (0, common_1.applyDecorators)(...decorators);
324
- }
325
- exports.UUIDField = UUIDField;
326
- function UUIDFieldOptional(options = {}) {
327
- return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), UUIDField(Object.assign({ required: false }, options)));
328
- }
329
- exports.UUIDFieldOptional = UUIDFieldOptional;
330
- function URLField(options = {}) {
331
- const decorators = [
332
- (0, class_validator_1.IsUrl)({}, {
333
- each: options.each,
334
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_URL'),
335
- }),
336
- StringField(Object.assign({ toLowerCase: true }, options)),
337
- ];
338
- if (options.nullable) {
339
- decorators.push((0, validator_decorators_1.IsNullable)({ each: options.each }));
340
- }
341
- else {
342
- decorators.push((0, class_validator_1.NotEquals)(null, { each: options.each }));
343
- }
344
- return (0, common_1.applyDecorators)(...decorators);
345
- }
346
- exports.URLField = URLField;
347
- function URLFieldOptional(options = {}) {
348
- return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), URLField(Object.assign({ required: false }, options)));
349
- }
350
- exports.URLFieldOptional = URLFieldOptional;
351
- function FQDNField(options = {}) {
352
- const decorators = [
353
- (0, class_validator_1.IsFQDN)(options, {
354
- each: options.each,
355
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_FQDN'),
356
- }),
357
- StringField(Object.assign({ toLowerCase: true }, options)),
358
- ];
359
- if (options.nullable) {
360
- decorators.push((0, validator_decorators_1.IsNullable)({ each: options.each }));
361
- }
362
- else {
363
- decorators.push((0, class_validator_1.NotEquals)(null, { each: options.each }));
364
- }
365
- return (0, common_1.applyDecorators)(...decorators);
366
- }
367
- exports.FQDNField = FQDNField;
368
- function FQDNFieldOptional(options = {}) {
369
- return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), FQDNField(Object.assign({ required: false }, options)));
370
- }
371
- exports.FQDNFieldOptional = FQDNFieldOptional;
372
- function DateField(options = {}) {
373
- const decorators = [
374
- (0, class_transformer_1.Type)(() => Date),
375
- (0, class_validator_1.IsDate)({ message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_DATE') }),
376
- ];
377
- if (options.nullable) {
378
- decorators.push((0, validator_decorators_1.IsNullable)());
379
- }
380
- else {
381
- decorators.push((0, class_validator_1.NotEquals)(null));
382
- }
383
- if (options.minDate) {
384
- decorators.push((0, class_validator_1.MinDate)(options.minDate, {
385
- each: options.each,
386
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.MIN_DATE'),
387
- }));
388
- }
389
- if (options.maxDate) {
390
- decorators.push((0, class_validator_1.MaxDate)(options.maxDate, {
391
- each: options.each,
392
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.MAX_DATE'),
393
- }));
394
- }
395
- if (options.swagger !== false) {
396
- decorators.push((0, swagger_1.ApiProperty)(Object.assign({ type: Date }, options)));
397
- }
398
- return (0, common_1.applyDecorators)(...decorators);
399
- }
400
- exports.DateField = DateField;
401
- function DateFieldOptional(options = {}) {
402
- return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), DateField(Object.assign(Object.assign({}, options), { required: false })));
403
- }
404
- exports.DateFieldOptional = DateFieldOptional;
405
- function IpFieldOptional(options = {}) {
406
- return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), IpField(Object.assign({ required: false }, options)));
407
- }
408
- exports.IpFieldOptional = IpFieldOptional;
409
- function IpField(options) {
410
- const decorators = [
411
- (0, class_validator_1.IsIP)(options.version || 4, {
412
- each: options.each,
413
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_IP'),
414
- }),
415
- StringField(Object.assign({ toLowerCase: true }, options)),
416
- ];
417
- if (options.nullable) {
418
- decorators.push((0, validator_decorators_1.IsNullable)({ each: options.each }));
419
- }
420
- else {
421
- decorators.push((0, class_validator_1.NotEquals)(null, { each: options.each }));
422
- }
423
- return (0, common_1.applyDecorators)(...decorators);
424
- }
425
- exports.IpField = IpField;
426
- function ObjectField(options) {
427
- const decorators = [
428
- (0, class_transformer_1.Type)(() => Object),
429
- (0, class_validator_1.IsObject)({
430
- each: options.each,
431
- message: (0, nestjs_i18n_1.i18nValidationMessage)('validation.IS_OBJECT'),
432
- }),
433
- ];
434
- if (options.nullable) {
435
- decorators.push((0, validator_decorators_1.IsNullable)({ each: options.each }));
436
- }
437
- else {
438
- decorators.push((0, class_validator_1.NotEquals)(null, { each: options.each }));
439
- }
440
- if (options.swagger !== false) {
441
- decorators.push((0, swagger_1.ApiProperty)(Object.assign({ type: 'object' }, options)));
442
- }
443
- return (0, common_1.applyDecorators)(...decorators);
444
- }
445
- exports.ObjectField = ObjectField;
446
- function ObjectFieldOptional(options = {}) {
447
- return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), ObjectField(Object.assign({ required: false }, options)));
448
- }
449
- exports.ObjectFieldOptional = ObjectFieldOptional;
@@ -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,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UUIDParam = void 0;
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
- }
8
- exports.UUIDParam = UUIDParam;
@@ -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,8 +0,0 @@
1
- export interface IOmniAuth {
2
- uid: number;
3
- username: string;
4
- tenantId: string;
5
- appId: string;
6
- }
7
- export declare const OmniAuth: (...dataOrPipes: (string | import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>>)[]) => ParameterDecorator;
8
- export declare function getOmniAuthData(req: any, data?: string): IOmniAuth;