@nest-omni/core 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README +16 -0
- package/dist/boilerplate.polyfill.js.map +1 -1
- package/dist/common/abstract-client.service.js.map +1 -1
- package/dist/common/abstract.entity.js.map +1 -1
- package/dist/common/dto/abstract.dto.js.map +1 -1
- package/dist/common/utils.js.map +1 -1
- package/dist/decorators/auth-user.decorator.js.map +1 -1
- package/dist/decorators/field.decorators.js.map +1 -1
- package/dist/decorators/omni-auth.decorator.js.map +1 -1
- package/dist/decorators/swagger.schema.js.map +1 -1
- package/dist/decorators/transform.decorators.js.map +1 -1
- package/dist/decorators/user-check.decorator.js.map +1 -1
- package/dist/decorators/user.decorator.js.map +1 -1
- package/dist/filters/bad-request.filter.js.map +1 -1
- package/dist/health-checker/health-checker.controller.js.map +1 -1
- package/dist/health-checker/health-indicators/service.indicator.js.map +1 -1
- package/dist/helpers/common.helper.js.map +1 -1
- package/dist/helpers/date.helper.js.map +1 -1
- package/dist/interceptors/language-interceptor.service.js.map +1 -1
- package/dist/interceptors/translation-interceptor.service.js.map +1 -1
- package/dist/middlewares/request-id.middleware.js.map +1 -1
- package/dist/providers/context.provider.js.map +1 -1
- package/dist/providers/generator.provider.js.map +1 -1
- package/dist/setup/bootstrap.setup.js.map +1 -1
- package/dist/setup-swagger.js.map +1 -1
- package/dist/shared/serviceRegistryModule.js.map +1 -1
- package/dist/shared/services/api-config.service.js.map +1 -1
- package/dist/shared/services/translation.service.js.map +1 -1
- package/dist/snake-naming.strategy.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/validators/file-mimetype.validator.js.map +1 -1
- package/dist/validators/is-unique.validator.js.map +1 -1
- package/dist/validators/skip-empty.validator.js.map +1 -1
- package/package.json +11 -7
- package/dist/guards/auth.guard.d.ts +0 -4
- package/dist/guards/auth.guard.js +0 -13
- package/dist/guards/auth.guard.js.map +0 -1
- package/dist/guards/roles.guard.d.ts +0 -7
- package/dist/guards/roles.guard.js +0 -36
- package/dist/guards/roles.guard.js.map +0 -1
- package/dist/helpers/excel.helper.d.ts +0 -12
- package/dist/helpers/excel.helper.js +0 -250
- package/dist/helpers/excel.helper.js.map +0 -1
- package/src/boilerplate.polyfill.d.ts +0 -39
- package/src/boilerplate.polyfill.js +0 -78
- package/src/boilerplate.polyfill.ts +0 -202
- package/src/common/abstract-client.service.d.ts +0 -20
- package/src/common/abstract-client.service.js +0 -39
- package/src/common/abstract-client.service.ts +0 -56
- package/src/common/abstract.entity.d.ts +0 -24
- package/src/common/abstract.entity.js +0 -152
- package/src/common/abstract.entity.ts +0 -73
- package/src/common/dto/abstract.dto.d.ts +0 -13
- package/src/common/dto/abstract.dto.js +0 -96
- package/src/common/dto/abstract.dto.ts +0 -64
- package/src/common/dto/bulk-id.dto.d.ts +0 -3
- package/src/common/dto/bulk-id.dto.js +0 -63
- package/src/common/dto/bulk-id.dto.ts +0 -13
- package/src/common/dto/create-translation.dto.d.ts +0 -5
- package/src/common/dto/create-translation.dto.js +0 -63
- package/src/common/dto/create-translation.dto.ts +0 -10
- package/src/common/dto/page-meta.dto.d.ts +0 -15
- package/src/common/dto/page-meta.dto.js +0 -88
- package/src/common/dto/page-meta.dto.ts +0 -37
- package/src/common/dto/page-options.dto.d.ts +0 -8
- package/src/common/dto/page-options.dto.js +0 -87
- package/src/common/dto/page-options.dto.ts +0 -35
- package/src/common/dto/page.dto.d.ts +0 -11
- package/src/common/dto/page.dto.js +0 -94
- package/src/common/dto/page.dto.ts +0 -36
- package/src/common/utils.d.ts +0 -14
- package/src/common/utils.js +0 -39
- package/src/common/utils.ts +0 -45
- package/src/constants/index.d.ts +0 -4
- package/src/constants/index.js +0 -20
- package/src/constants/index.ts +0 -4
- package/src/constants/language-code.d.ts +0 -5
- package/src/constants/language-code.js +0 -10
- package/src/constants/language-code.ts +0 -7
- package/src/constants/order.d.ts +0 -4
- package/src/constants/order.js +0 -8
- package/src/constants/order.ts +0 -4
- package/src/constants/role-type.d.ts +0 -4
- package/src/constants/role-type.js +0 -8
- package/src/constants/role-type.ts +0 -4
- package/src/constants/token-type.d.ts +0 -4
- package/src/constants/token-type.js +0 -8
- package/src/constants/token-type.ts +0 -4
- package/src/decorators/api-page-ok-response.decorator.d.ts +0 -5
- package/src/decorators/api-page-ok-response.decorator.js +0 -25
- package/src/decorators/api-page-ok-response.decorator.ts +0 -31
- package/src/decorators/auth-user.decorator.d.ts +0 -1
- package/src/decorators/auth-user.decorator.js +0 -15
- package/src/decorators/auth-user.decorator.ts +0 -16
- package/src/decorators/controller.decorator.d.ts +0 -1
- package/src/decorators/controller.decorator.js +0 -34
- package/src/decorators/controller.decorator.ts +0 -8
- package/src/decorators/field.decorators.d.ts +0 -71
- package/src/decorators/field.decorators.js +0 -455
- package/src/decorators/field.decorators.ts +0 -773
- package/src/decorators/http.decorators.d.ts +0 -3
- package/src/decorators/http.decorators.js +0 -8
- package/src/decorators/http.decorators.ts +0 -10
- package/src/decorators/index.d.ts +0 -12
- package/src/decorators/index.js +0 -28
- package/src/decorators/index.ts +0 -12
- package/src/decorators/omni-auth.decorator.d.ts +0 -8
- package/src/decorators/omni-auth.decorator.js +0 -60
- package/src/decorators/omni-auth.decorator.ts +0 -46
- package/src/decorators/operation.decorator.d.ts +0 -1
- package/src/decorators/operation.decorator.js +0 -6
- package/src/decorators/operation.decorator.ts +0 -4
- package/src/decorators/property.decorators.d.ts +0 -15
- package/src/decorators/property.decorators.js +0 -36
- package/src/decorators/property.decorators.ts +0 -62
- package/src/decorators/public-route.decorator.d.ts +0 -3
- package/src/decorators/public-route.decorator.js +0 -8
- package/src/decorators/public-route.decorator.ts +0 -8
- package/src/decorators/swagger.schema.d.ts +0 -5
- package/src/decorators/swagger.schema.js +0 -82
- package/src/decorators/swagger.schema.ts +0 -117
- package/src/decorators/timestamp-column.decorator.d.ts +0 -1
- package/src/decorators/timestamp-column.decorator.js +0 -28
- package/src/decorators/timestamp-column.decorator.ts +0 -29
- package/src/decorators/transform.decorators.d.ts +0 -35
- package/src/decorators/transform.decorators.js +0 -122
- package/src/decorators/transform.decorators.ts +0 -147
- package/src/decorators/translate.decorator.d.ts +0 -5
- package/src/decorators/translate.decorator.js +0 -18
- package/src/decorators/translate.decorator.ts +0 -19
- package/src/decorators/use-dto.decorator.d.ts +0 -4
- package/src/decorators/use-dto.decorator.js +0 -9
- package/src/decorators/use-dto.decorator.ts +0 -11
- package/src/decorators/user-check.decorator.d.ts +0 -6
- package/src/decorators/user-check.decorator.js +0 -44
- package/src/decorators/user-check.decorator.ts +0 -30
- package/src/decorators/user.decorator.d.ts +0 -8
- package/src/decorators/user.decorator.js +0 -62
- package/src/decorators/user.decorator.ts +0 -48
- package/src/decorators/user_auth.decorator.d.ts +0 -1
- package/src/decorators/user_auth.decorator.js +0 -16
- package/src/decorators/user_auth.decorator.ts +0 -15
- package/src/decorators/validator.decorators.d.ts +0 -10
- package/src/decorators/validator.decorators.js +0 -59
- package/src/decorators/validator.decorators.ts +0 -78
- package/src/exceptions/file-not-image.exception.d.ts +0 -4
- package/src/exceptions/file-not-image.exception.js +0 -10
- package/src/exceptions/file-not-image.exception.ts +0 -7
- package/src/exceptions/index.d.ts +0 -2
- package/src/exceptions/index.js +0 -18
- package/src/exceptions/index.ts +0 -2
- package/src/exceptions/page-type.exception.d.ts +0 -4
- package/src/exceptions/page-type.exception.js +0 -10
- package/src/exceptions/page-type.exception.ts +0 -7
- package/src/exceptions/user-not-found.exception.d.ts +0 -4
- package/src/exceptions/user-not-found.exception.js +0 -10
- package/src/exceptions/user-not-found.exception.ts +0 -7
- package/src/filters/bad-request.filter.d.ts +0 -5
- package/src/filters/bad-request.filter.js +0 -104
- package/src/filters/bad-request.filter.ts +0 -67
- package/src/filters/constraint-errors.d.ts +0 -1
- package/src/filters/constraint-errors.js +0 -7
- package/src/filters/constraint-errors.ts +0 -5
- package/src/filters/index.d.ts +0 -3
- package/src/filters/index.js +0 -19
- package/src/filters/index.ts +0 -3
- package/src/filters/query-failed.filter.d.ts +0 -10
- package/src/filters/query-failed.filter.js +0 -81
- package/src/filters/query-failed.filter.ts +0 -32
- package/src/health-checker/health-checker.controller.d.ts +0 -15
- package/src/health-checker/health-checker.controller.js +0 -104
- package/src/health-checker/health-checker.controller.ts +0 -51
- package/src/health-checker/health-checker.module.d.ts +0 -2
- package/src/health-checker/health-checker.module.js +0 -69
- package/src/health-checker/health-checker.module.ts +0 -13
- package/src/health-checker/health-indicators/service.indicator.d.ts +0 -8
- package/src/health-checker/health-indicators/service.indicator.js +0 -102
- package/src/health-checker/health-indicators/service.indicator.ts +0 -44
- package/src/helpers/common.helper.d.ts +0 -16
- package/src/helpers/common.helper.js +0 -49
- package/src/helpers/common.helper.ts +0 -49
- package/src/helpers/date.helper.d.ts +0 -10
- package/src/helpers/date.helper.js +0 -81
- package/src/helpers/date.helper.ts +0 -64
- package/src/helpers/excel.helper.d.ts +0 -27
- package/src/helpers/excel.helper.js +0 -338
- package/src/helpers/index.d.ts +0 -3
- package/src/helpers/index.js +0 -19
- package/src/helpers/index.ts +0 -3
- package/src/i18n/en_US/validation.json +0 -38
- package/src/i18n/zh_CN/validation.json +0 -38
- package/src/index.d.ts +0 -11
- package/src/index.js +0 -28
- package/src/index.ts +0 -12
- package/src/interceptors/auth-user.interceptor.d.ts +0 -4
- package/src/interceptors/auth-user.interceptor.js +0 -68
- package/src/interceptors/auth-user.interceptor.ts +0 -20
- package/src/interceptors/index.d.ts +0 -2
- package/src/interceptors/index.js +0 -18
- package/src/interceptors/index.ts +0 -2
- package/src/interceptors/language-interceptor.service.d.ts +0 -6
- package/src/interceptors/language-interceptor.service.js +0 -74
- package/src/interceptors/language-interceptor.service.ts +0 -31
- package/src/interceptors/translation-interceptor.service.d.ts +0 -5
- package/src/interceptors/translation-interceptor.service.js +0 -83
- package/src/interceptors/translation-interceptor.service.ts +0 -43
- package/src/interfaces/IApiFile.d.ts +0 -4
- package/src/interfaces/IApiFile.js +0 -2
- package/src/interfaces/IApiFile.ts +0 -4
- package/src/interfaces/IFile.d.ts +0 -9
- package/src/interfaces/IFile.js +0 -2
- package/src/interfaces/IFile.ts +0 -8
- package/src/interfaces/ITranslationDecoratorInterface.d.ts +0 -3
- package/src/interfaces/ITranslationDecoratorInterface.js +0 -2
- package/src/interfaces/ITranslationDecoratorInterface.ts +0 -3
- package/src/interfaces/index.d.ts +0 -3
- package/src/interfaces/index.js +0 -19
- package/src/interfaces/index.ts +0 -3
- package/src/interfaces/response.d.ts +0 -25
- package/src/interfaces/response.js +0 -2
- package/src/interfaces/response.ts +0 -37
- package/src/middlewares/index.d.ts +0 -3
- package/src/middlewares/index.js +0 -19
- package/src/middlewares/index.ts +0 -3
- package/src/middlewares/omni-auth.middleware.d.ts +0 -1
- package/src/middlewares/omni-auth.middleware.js +0 -13
- package/src/middlewares/omni-auth.middleware.ts +0 -10
- package/src/middlewares/powerby.middleware.d.ts +0 -1
- package/src/middlewares/powerby.middleware.js +0 -10
- package/src/middlewares/powerby.middleware.ts +0 -6
- package/src/middlewares/request-id.middleware.d.ts +0 -7
- package/src/middlewares/request-id.middleware.js +0 -22
- package/src/middlewares/request-id.middleware.ts +0 -28
- package/src/providers/context.provider.d.ts +0 -32
- package/src/providers/context.provider.js +0 -73
- package/src/providers/context.provider.ts +0 -98
- package/src/providers/generator.provider.d.ts +0 -13
- package/src/providers/generator.provider.js +0 -54
- package/src/providers/generator.provider.ts +0 -66
- package/src/providers/index.d.ts +0 -2
- package/src/providers/index.js +0 -18
- package/src/providers/index.ts +0 -2
- package/src/setup/bootstrap.setup.d.ts +0 -5
- package/src/setup/bootstrap.setup.js +0 -138
- package/src/setup/bootstrap.setup.ts +0 -139
- package/src/setup/index.d.ts +0 -1
- package/src/setup/index.js +0 -17
- package/src/setup/index.ts +0 -1
- package/src/setup/microservices.setup.js +0 -55
- package/src/setup-swagger.d.ts +0 -2
- package/src/setup-swagger.js +0 -62
- package/src/setup-swagger.ts +0 -67
- package/src/shared/index.d.ts +0 -2
- package/src/shared/index.js +0 -18
- package/src/shared/index.ts +0 -2
- package/src/shared/serviceRegistryModule.d.ts +0 -2
- package/src/shared/serviceRegistryModule.js +0 -176
- package/src/shared/serviceRegistryModule.ts +0 -110
- package/src/shared/services/api-config.service.d.ts +0 -73
- package/src/shared/services/api-config.service.js +0 -335
- package/src/shared/services/api-config.service.ts +0 -319
- package/src/shared/services/aws-s3.service.d.ts +0 -10
- package/src/shared/services/aws-s3.service.js +0 -96
- package/src/shared/services/aws-s3.service.ts +0 -39
- package/src/shared/services/generator.service.d.ts +0 -4
- package/src/shared/services/generator.service.js +0 -67
- package/src/shared/services/generator.service.ts +0 -13
- package/src/shared/services/index.d.ts +0 -5
- package/src/shared/services/index.js +0 -21
- package/src/shared/services/index.ts +0 -5
- package/src/shared/services/translation.service.d.ts +0 -9
- package/src/shared/services/translation.service.js +0 -109
- package/src/shared/services/translation.service.ts +0 -59
- package/src/shared/services/validator.service.d.ts +0 -3
- package/src/shared/services/validator.service.js +0 -64
- package/src/shared/services/validator.service.ts +0 -10
- package/src/snake-naming.strategy.d.ts +0 -11
- package/src/snake-naming.strategy.js +0 -37
- package/src/snake-naming.strategy.ts +0 -64
- package/src/types.d.ts +0 -9
- package/src/types.js +0 -2
- package/src/types.ts +0 -44
- package/src/validators/file-mimetype.validator.d.ts +0 -13
- package/src/validators/file-mimetype.validator.js +0 -21
- package/src/validators/file-mimetype.validator.ts +0 -34
- package/src/validators/index.d.ts +0 -3
- package/src/validators/index.js +0 -19
- package/src/validators/index.ts +0 -3
- package/src/validators/is-exists.validator.d.ts +0 -18
- package/src/validators/is-exists.validator.js +0 -99
- package/src/validators/is-exists.validator.ts +0 -60
- package/src/validators/is-unique.validator.d.ts +0 -17
- package/src/validators/is-unique.validator.js +0 -131
- package/src/validators/is-unique.validator.ts +0 -93
- package/src/validators/phone-country-code.validator.d.ts +0 -2
- package/src/validators/phone-country-code.validator.js +0 -30
- package/src/validators/phone-country-code.validator.ts +0 -36
- package/src/validators/same-as.validator.d.ts +0 -2
- package/src/validators/same-as.validator.js +0 -25
- package/src/validators/same-as.validator.ts +0 -27
- package/src/validators/skip-empty.validator.d.ts +0 -6
- package/src/validators/skip-empty.validator.js +0 -23
- package/src/validators/skip-empty.validator.ts +0 -25
- package/tsconfig.json +0 -21
- package/tsconfig.lib.json +0 -16
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SameAs = void 0;
|
|
4
|
-
const class_validator_1 = require("class-validator");
|
|
5
|
-
function SameAs(property, validationOptions) {
|
|
6
|
-
return function (object, propertyName) {
|
|
7
|
-
(0, class_validator_1.registerDecorator)({
|
|
8
|
-
name: 'sameAs',
|
|
9
|
-
target: object.constructor,
|
|
10
|
-
propertyName,
|
|
11
|
-
options: validationOptions,
|
|
12
|
-
constraints: [property],
|
|
13
|
-
validator: {
|
|
14
|
-
validate(value, args) {
|
|
15
|
-
const [relatedPropertyName] = args.constraints;
|
|
16
|
-
return (args === null || args === void 0 ? void 0 : args.object[relatedPropertyName]) === value;
|
|
17
|
-
},
|
|
18
|
-
defaultMessage() {
|
|
19
|
-
return '$property must match $constraint1';
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
exports.SameAs = SameAs;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { ValidationOptions } from 'class-validator';
|
|
2
|
-
import { registerDecorator } from 'class-validator';
|
|
3
|
-
|
|
4
|
-
export function SameAs(
|
|
5
|
-
property: string,
|
|
6
|
-
validationOptions?: ValidationOptions,
|
|
7
|
-
): PropertyDecorator {
|
|
8
|
-
return function (object, propertyName: string) {
|
|
9
|
-
registerDecorator({
|
|
10
|
-
name: 'sameAs',
|
|
11
|
-
target: object.constructor,
|
|
12
|
-
propertyName,
|
|
13
|
-
options: validationOptions,
|
|
14
|
-
constraints: [property],
|
|
15
|
-
validator: {
|
|
16
|
-
validate(value, args) {
|
|
17
|
-
const [relatedPropertyName] = args!.constraints;
|
|
18
|
-
|
|
19
|
-
return args?.object[relatedPropertyName] === value;
|
|
20
|
-
},
|
|
21
|
-
defaultMessage() {
|
|
22
|
-
return '$property must match $constraint1';
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* When the value is emtpy, validation is skipped
|
|
3
|
-
* @param field
|
|
4
|
-
* @constructor
|
|
5
|
-
*/
|
|
6
|
-
export declare function SkipEmpty(field?: string): <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SkipEmpty = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
6
|
-
const class_validator_1 = require("class-validator");
|
|
7
|
-
const lodash_1 = require("lodash");
|
|
8
|
-
/**
|
|
9
|
-
* When the value is emtpy, validation is skipped
|
|
10
|
-
* @param field
|
|
11
|
-
* @constructor
|
|
12
|
-
*/
|
|
13
|
-
function SkipEmpty(field) {
|
|
14
|
-
return (0, common_1.applyDecorators)((0, swagger_1.ApiProperty)({ required: false }), (0, class_validator_1.ValidateIf)((obj, value) => {
|
|
15
|
-
if (field) {
|
|
16
|
-
value = obj[field];
|
|
17
|
-
}
|
|
18
|
-
return !(value === null ||
|
|
19
|
-
value === undefined ||
|
|
20
|
-
((0, lodash_1.isString)(value) && value.trim() === ''));
|
|
21
|
-
}));
|
|
22
|
-
}
|
|
23
|
-
exports.SkipEmpty = SkipEmpty;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { applyDecorators } from '@nestjs/common';
|
|
2
|
-
import { ApiProperty } from '@nestjs/swagger';
|
|
3
|
-
import { ValidateIf } from 'class-validator';
|
|
4
|
-
import { isString } from 'lodash';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* When the value is emtpy, validation is skipped
|
|
8
|
-
* @param field
|
|
9
|
-
* @constructor
|
|
10
|
-
*/
|
|
11
|
-
export function SkipEmpty(field?: string) {
|
|
12
|
-
return applyDecorators(
|
|
13
|
-
ApiProperty({ required: false }),
|
|
14
|
-
ValidateIf((obj, value) => {
|
|
15
|
-
if (field) {
|
|
16
|
-
value = obj[field];
|
|
17
|
-
}
|
|
18
|
-
return !(
|
|
19
|
-
value === null ||
|
|
20
|
-
value === undefined ||
|
|
21
|
-
(isString(value) && value.trim() === '')
|
|
22
|
-
);
|
|
23
|
-
}),
|
|
24
|
-
);
|
|
25
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"module": "commonjs",
|
|
4
|
-
"declaration": true,
|
|
5
|
-
"removeComments": true,
|
|
6
|
-
"emitDecoratorMetadata": true,
|
|
7
|
-
"experimentalDecorators": true,
|
|
8
|
-
"allowSyntheticDefaultImports": true,
|
|
9
|
-
"target": "ES2022",
|
|
10
|
-
"sourceMap": true,
|
|
11
|
-
"outDir": "./dist",
|
|
12
|
-
"baseUrl": "./",
|
|
13
|
-
"incremental": true,
|
|
14
|
-
"skipLibCheck": true,
|
|
15
|
-
"strictNullChecks": false,
|
|
16
|
-
"noImplicitAny": false,
|
|
17
|
-
"strictBindCallApply": false,
|
|
18
|
-
"forceConsistentCasingInFileNames": false,
|
|
19
|
-
"noFallthroughCasesInSwitch": false
|
|
20
|
-
}
|
|
21
|
-
}
|
package/tsconfig.lib.json
DELETED