@nest-omni/core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/boilerplate.polyfill.d.ts +39 -0
- package/dist/boilerplate.polyfill.js +66 -0
- package/dist/boilerplate.polyfill.js.map +1 -0
- package/dist/common/abstract-client.service.d.ts +16 -0
- package/dist/common/abstract-client.service.js +26 -0
- package/dist/common/abstract-client.service.js.map +1 -0
- package/dist/common/abstract.entity.d.ts +17 -0
- package/dist/common/abstract.entity.js +71 -0
- package/dist/common/abstract.entity.js.map +1 -0
- package/dist/common/dto/abstract.dto.d.ts +13 -0
- package/dist/common/dto/abstract.dto.js +63 -0
- package/dist/common/dto/abstract.dto.js.map +1 -0
- package/dist/common/dto/bulk-id.dto.d.ts +3 -0
- package/dist/common/dto/bulk-id.dto.js +29 -0
- package/dist/common/dto/bulk-id.dto.js.map +1 -0
- package/dist/common/dto/create-translation.dto.d.ts +5 -0
- package/dist/common/dto/create-translation.dto.js +28 -0
- package/dist/common/dto/create-translation.dto.js.map +1 -0
- package/dist/common/dto/page-meta.dto.d.ts +15 -0
- package/dist/common/dto/page-meta.dto.js +55 -0
- package/dist/common/dto/page-meta.dto.js.map +1 -0
- package/dist/common/dto/page-options.dto.d.ts +8 -0
- package/dist/common/dto/page-options.dto.js +52 -0
- package/dist/common/dto/page-options.dto.js.map +1 -0
- package/dist/common/dto/page.dto.d.ts +11 -0
- package/dist/common/dto/page.dto.js +61 -0
- package/dist/common/dto/page.dto.js.map +1 -0
- package/dist/common/utils.d.ts +3 -0
- package/dist/common/utils.js +26 -0
- package/dist/common/utils.js.map +1 -0
- package/dist/constants/index.d.ts +4 -0
- package/dist/constants/index.js +21 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/language-code.d.ts +5 -0
- package/dist/constants/language-code.js +10 -0
- package/dist/constants/language-code.js.map +1 -0
- package/dist/constants/order.d.ts +4 -0
- package/dist/constants/order.js +9 -0
- package/dist/constants/order.js.map +1 -0
- package/dist/constants/role-type.d.ts +4 -0
- package/dist/constants/role-type.js +9 -0
- package/dist/constants/role-type.js.map +1 -0
- package/dist/constants/token-type.d.ts +4 -0
- package/dist/constants/token-type.js +9 -0
- package/dist/constants/token-type.js.map +1 -0
- package/dist/decorators/api-page-ok-response.decorator.d.ts +5 -0
- package/dist/decorators/api-page-ok-response.decorator.js +26 -0
- package/dist/decorators/api-page-ok-response.decorator.js.map +1 -0
- package/dist/decorators/auth-user.decorator.d.ts +1 -0
- package/dist/decorators/auth-user.decorator.js +16 -0
- package/dist/decorators/auth-user.decorator.js.map +1 -0
- package/dist/decorators/controller.decorator.d.ts +1 -0
- package/dist/decorators/controller.decorator.js +12 -0
- package/dist/decorators/controller.decorator.js.map +1 -0
- package/dist/decorators/field.decorators.d.ts +71 -0
- package/dist/decorators/field.decorators.js +457 -0
- package/dist/decorators/field.decorators.js.map +1 -0
- package/dist/decorators/http.decorators.d.ts +3 -0
- package/dist/decorators/http.decorators.js +9 -0
- package/dist/decorators/http.decorators.js.map +1 -0
- package/dist/decorators/index.d.ts +12 -0
- package/dist/decorators/index.js +29 -0
- package/dist/decorators/index.js.map +1 -0
- package/dist/decorators/omni-auth.decorator.d.ts +8 -0
- package/dist/decorators/omni-auth.decorator.js +36 -0
- package/dist/decorators/omni-auth.decorator.js.map +1 -0
- package/dist/decorators/operation.decorator.d.ts +1 -0
- package/dist/decorators/operation.decorator.js +7 -0
- package/dist/decorators/operation.decorator.js.map +1 -0
- package/dist/decorators/property.decorators.d.ts +15 -0
- package/dist/decorators/property.decorators.js +43 -0
- package/dist/decorators/property.decorators.js.map +1 -0
- package/dist/decorators/public-route.decorator.d.ts +3 -0
- package/dist/decorators/public-route.decorator.js +8 -0
- package/dist/decorators/public-route.decorator.js.map +1 -0
- package/dist/decorators/swagger.schema.d.ts +5 -0
- package/dist/decorators/swagger.schema.js +80 -0
- package/dist/decorators/swagger.schema.js.map +1 -0
- package/dist/decorators/timestamp-column.decorator.d.ts +1 -0
- package/dist/decorators/timestamp-column.decorator.js +29 -0
- package/dist/decorators/timestamp-column.decorator.js.map +1 -0
- package/dist/decorators/transform.decorators.d.ts +8 -0
- package/dist/decorators/transform.decorators.js +96 -0
- package/dist/decorators/transform.decorators.js.map +1 -0
- package/dist/decorators/translate.decorator.d.ts +5 -0
- package/dist/decorators/translate.decorator.js +18 -0
- package/dist/decorators/translate.decorator.js.map +1 -0
- package/dist/decorators/use-dto.decorator.d.ts +4 -0
- package/dist/decorators/use-dto.decorator.js +10 -0
- package/dist/decorators/use-dto.decorator.js.map +1 -0
- package/dist/decorators/user-check.decorator.d.ts +6 -0
- package/dist/decorators/user-check.decorator.js +22 -0
- package/dist/decorators/user-check.decorator.js.map +1 -0
- package/dist/decorators/user.decorator.d.ts +8 -0
- package/dist/decorators/user.decorator.js +39 -0
- package/dist/decorators/user.decorator.js.map +1 -0
- package/dist/decorators/user_auth.decorator.d.ts +1 -0
- package/dist/decorators/user_auth.decorator.js +17 -0
- package/dist/decorators/user_auth.decorator.js.map +1 -0
- package/dist/decorators/validator.decorators.d.ts +10 -0
- package/dist/decorators/validator.decorators.js +63 -0
- package/dist/decorators/validator.decorators.js.map +1 -0
- package/dist/exceptions/file-not-image.exception.d.ts +4 -0
- package/dist/exceptions/file-not-image.exception.js +11 -0
- package/dist/exceptions/file-not-image.exception.js.map +1 -0
- package/dist/exceptions/index.d.ts +2 -0
- package/dist/exceptions/index.js +19 -0
- package/dist/exceptions/index.js.map +1 -0
- package/dist/exceptions/page-type.exception.d.ts +4 -0
- package/dist/exceptions/page-type.exception.js +11 -0
- package/dist/exceptions/page-type.exception.js.map +1 -0
- package/dist/exceptions/user-not-found.exception.d.ts +4 -0
- package/dist/exceptions/user-not-found.exception.js +11 -0
- package/dist/exceptions/user-not-found.exception.js.map +1 -0
- package/dist/filters/bad-request.filter.d.ts +5 -0
- package/dist/filters/bad-request.filter.js +65 -0
- package/dist/filters/bad-request.filter.js.map +1 -0
- package/dist/filters/constraint-errors.d.ts +1 -0
- package/dist/filters/constraint-errors.js +7 -0
- package/dist/filters/constraint-errors.js.map +1 -0
- package/dist/filters/index.d.ts +3 -0
- package/dist/filters/index.js +20 -0
- package/dist/filters/index.js.map +1 -0
- package/dist/filters/query-failed.filter.d.ts +10 -0
- package/dist/filters/query-failed.filter.js +43 -0
- package/dist/filters/query-failed.filter.js.map +1 -0
- package/dist/guards/auth.guard.d.ts +4 -0
- package/dist/guards/auth.guard.js +13 -0
- package/dist/guards/auth.guard.js.map +1 -0
- package/dist/guards/roles.guard.d.ts +7 -0
- package/dist/guards/roles.guard.js +36 -0
- package/dist/guards/roles.guard.js.map +1 -0
- package/dist/health-checker/health-checker.controller.d.ts +15 -0
- package/dist/health-checker/health-checker.controller.js +68 -0
- package/dist/health-checker/health-checker.controller.js.map +1 -0
- package/dist/health-checker/health-checker.module.d.ts +2 -0
- package/dist/health-checker/health-checker.module.js +26 -0
- package/dist/health-checker/health-checker.module.js.map +1 -0
- package/dist/health-checker/health-indicators/service.indicator.d.ts +8 -0
- package/dist/health-checker/health-indicators/service.indicator.js +57 -0
- package/dist/health-checker/health-indicators/service.indicator.js.map +1 -0
- package/dist/helpers/common.helper.d.ts +3 -0
- package/dist/helpers/common.helper.js +37 -0
- package/dist/helpers/common.helper.js.map +1 -0
- package/dist/helpers/date.helper.d.ts +10 -0
- package/dist/helpers/date.helper.js +59 -0
- package/dist/helpers/date.helper.js.map +1 -0
- package/dist/helpers/excel.helper.d.ts +12 -0
- package/dist/helpers/excel.helper.js +250 -0
- package/dist/helpers/excel.helper.js.map +1 -0
- package/dist/helpers/index.d.ts +3 -0
- package/dist/helpers/index.js +20 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/interceptors/auth-user.interceptor.d.ts +4 -0
- package/dist/interceptors/auth-user.interceptor.js +25 -0
- package/dist/interceptors/auth-user.interceptor.js.map +1 -0
- package/dist/interceptors/index.d.ts +2 -0
- package/dist/interceptors/index.js +19 -0
- package/dist/interceptors/index.js.map +1 -0
- package/dist/interceptors/language-interceptor.service.d.ts +6 -0
- package/dist/interceptors/language-interceptor.service.js +31 -0
- package/dist/interceptors/language-interceptor.service.js.map +1 -0
- package/dist/interceptors/translation-interceptor.service.d.ts +5 -0
- package/dist/interceptors/translation-interceptor.service.js +35 -0
- package/dist/interceptors/translation-interceptor.service.js.map +1 -0
- package/dist/interfaces/IApiFile.d.ts +4 -0
- package/dist/interfaces/IApiFile.js +3 -0
- package/dist/interfaces/IApiFile.js.map +1 -0
- package/dist/interfaces/IFile.d.ts +9 -0
- package/dist/interfaces/IFile.js +3 -0
- package/dist/interfaces/IFile.js.map +1 -0
- package/dist/interfaces/ITranslationDecoratorInterface.d.ts +3 -0
- package/dist/interfaces/ITranslationDecoratorInterface.js +3 -0
- package/dist/interfaces/ITranslationDecoratorInterface.js.map +1 -0
- package/dist/interfaces/index.d.ts +3 -0
- package/dist/interfaces/index.js +20 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/response.d.ts +25 -0
- package/dist/interfaces/response.js +3 -0
- package/dist/interfaces/response.js.map +1 -0
- package/dist/middlewares/index.d.ts +3 -0
- package/dist/middlewares/index.js +20 -0
- package/dist/middlewares/index.js.map +1 -0
- package/dist/middlewares/omni-auth.middleware.d.ts +1 -0
- package/dist/middlewares/omni-auth.middleware.js +14 -0
- package/dist/middlewares/omni-auth.middleware.js.map +1 -0
- package/dist/middlewares/powerby.middleware.d.ts +1 -0
- package/dist/middlewares/powerby.middleware.js +11 -0
- package/dist/middlewares/powerby.middleware.js.map +1 -0
- package/dist/middlewares/request-id.middleware.d.ts +7 -0
- package/dist/middlewares/request-id.middleware.js +23 -0
- package/dist/middlewares/request-id.middleware.js.map +1 -0
- package/dist/providers/context.provider.d.ts +32 -0
- package/dist/providers/context.provider.js +71 -0
- package/dist/providers/context.provider.js.map +1 -0
- package/dist/providers/generator.provider.d.ts +9 -0
- package/dist/providers/generator.provider.js +51 -0
- package/dist/providers/generator.provider.js.map +1 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.js +19 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/setup/bootstrap.setup.d.ts +5 -0
- package/dist/setup/bootstrap.setup.js +102 -0
- package/dist/setup/bootstrap.setup.js.map +1 -0
- package/dist/setup/index.d.ts +1 -0
- package/dist/setup/index.js +18 -0
- package/dist/setup/index.js.map +1 -0
- package/dist/setup-swagger.d.ts +2 -0
- package/dist/setup-swagger.js +63 -0
- package/dist/setup-swagger.js.map +1 -0
- package/dist/shared/index.d.ts +2 -0
- package/dist/shared/index.js +19 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/serviceRegistryModule.d.ts +2 -0
- package/dist/shared/serviceRegistryModule.js +102 -0
- package/dist/shared/serviceRegistryModule.js.map +1 -0
- package/dist/shared/services/api-config.service.d.ts +70 -0
- package/dist/shared/services/api-config.service.js +286 -0
- package/dist/shared/services/api-config.service.js.map +1 -0
- package/dist/shared/services/aws-s3.service.d.ts +10 -0
- package/dist/shared/services/aws-s3.service.js +49 -0
- package/dist/shared/services/aws-s3.service.js.map +1 -0
- package/dist/shared/services/generator.service.d.ts +4 -0
- package/dist/shared/services/generator.service.js +24 -0
- package/dist/shared/services/generator.service.js.map +1 -0
- package/dist/shared/services/index.d.ts +5 -0
- package/dist/shared/services/index.js +22 -0
- package/dist/shared/services/index.js.map +1 -0
- package/dist/shared/services/translation.service.d.ts +9 -0
- package/dist/shared/services/translation.service.js +61 -0
- package/dist/shared/services/translation.service.js.map +1 -0
- package/dist/shared/services/validator.service.d.ts +3 -0
- package/dist/shared/services/validator.service.js +21 -0
- package/dist/shared/services/validator.service.js.map +1 -0
- package/dist/snake-naming.strategy.d.ts +11 -0
- package/dist/snake-naming.strategy.js +38 -0
- package/dist/snake-naming.strategy.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types.d.ts +9 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/validators/file-mimetype.validator.d.ts +13 -0
- package/dist/validators/file-mimetype.validator.js +24 -0
- package/dist/validators/file-mimetype.validator.js.map +1 -0
- package/dist/validators/index.d.ts +3 -0
- package/dist/validators/index.js +20 -0
- package/dist/validators/index.js.map +1 -0
- package/dist/validators/is-exists.validator.d.ts +18 -0
- package/dist/validators/is-exists.validator.js +52 -0
- package/dist/validators/is-exists.validator.js.map +1 -0
- package/dist/validators/is-unique.validator.d.ts +17 -0
- package/dist/validators/is-unique.validator.js +83 -0
- package/dist/validators/is-unique.validator.js.map +1 -0
- package/dist/validators/phone-country-code.validator.d.ts +2 -0
- package/dist/validators/phone-country-code.validator.js +31 -0
- package/dist/validators/phone-country-code.validator.js.map +1 -0
- package/dist/validators/same-as.validator.d.ts +2 -0
- package/dist/validators/same-as.validator.js +26 -0
- package/dist/validators/same-as.validator.js.map +1 -0
- package/dist/validators/skip-empty.validator.d.ts +1 -0
- package/dist/validators/skip-empty.validator.js +19 -0
- package/dist/validators/skip-empty.validator.js.map +1 -0
- package/package.json +66 -0
- package/src/boilerplate.polyfill.d.ts +39 -0
- package/src/boilerplate.polyfill.js +78 -0
- package/src/boilerplate.polyfill.ts +202 -0
- package/src/common/abstract-client.service.d.ts +20 -0
- package/src/common/abstract-client.service.js +39 -0
- package/src/common/abstract-client.service.ts +56 -0
- package/src/common/abstract.entity.d.ts +24 -0
- package/src/common/abstract.entity.js +152 -0
- package/src/common/abstract.entity.ts +73 -0
- package/src/common/dto/abstract.dto.d.ts +13 -0
- package/src/common/dto/abstract.dto.js +96 -0
- package/src/common/dto/abstract.dto.ts +64 -0
- package/src/common/dto/bulk-id.dto.d.ts +3 -0
- package/src/common/dto/bulk-id.dto.js +63 -0
- package/src/common/dto/bulk-id.dto.ts +13 -0
- package/src/common/dto/create-translation.dto.d.ts +5 -0
- package/src/common/dto/create-translation.dto.js +63 -0
- package/src/common/dto/create-translation.dto.ts +10 -0
- package/src/common/dto/page-meta.dto.d.ts +15 -0
- package/src/common/dto/page-meta.dto.js +88 -0
- package/src/common/dto/page-meta.dto.ts +37 -0
- package/src/common/dto/page-options.dto.d.ts +8 -0
- package/src/common/dto/page-options.dto.js +87 -0
- package/src/common/dto/page-options.dto.ts +35 -0
- package/src/common/dto/page.dto.d.ts +11 -0
- package/src/common/dto/page.dto.js +94 -0
- package/src/common/dto/page.dto.ts +36 -0
- package/src/common/utils.d.ts +14 -0
- package/src/common/utils.js +39 -0
- package/src/common/utils.ts +45 -0
- package/src/constants/index.d.ts +4 -0
- package/src/constants/index.js +20 -0
- package/src/constants/index.ts +4 -0
- package/src/constants/language-code.d.ts +5 -0
- package/src/constants/language-code.js +10 -0
- package/src/constants/language-code.ts +7 -0
- package/src/constants/order.d.ts +4 -0
- package/src/constants/order.js +8 -0
- package/src/constants/order.ts +4 -0
- package/src/constants/role-type.d.ts +4 -0
- package/src/constants/role-type.js +8 -0
- package/src/constants/role-type.ts +4 -0
- package/src/constants/token-type.d.ts +4 -0
- package/src/constants/token-type.js +8 -0
- package/src/constants/token-type.ts +4 -0
- package/src/decorators/api-page-ok-response.decorator.d.ts +5 -0
- package/src/decorators/api-page-ok-response.decorator.js +25 -0
- package/src/decorators/api-page-ok-response.decorator.ts +31 -0
- package/src/decorators/auth-user.decorator.d.ts +1 -0
- package/src/decorators/auth-user.decorator.js +15 -0
- package/src/decorators/auth-user.decorator.ts +16 -0
- package/src/decorators/controller.decorator.d.ts +1 -0
- package/src/decorators/controller.decorator.js +34 -0
- package/src/decorators/controller.decorator.ts +8 -0
- package/src/decorators/field.decorators.d.ts +71 -0
- package/src/decorators/field.decorators.js +455 -0
- package/src/decorators/field.decorators.ts +773 -0
- package/src/decorators/http.decorators.d.ts +3 -0
- package/src/decorators/http.decorators.js +8 -0
- package/src/decorators/http.decorators.ts +10 -0
- package/src/decorators/index.d.ts +12 -0
- package/src/decorators/index.js +28 -0
- package/src/decorators/index.ts +12 -0
- package/src/decorators/omni-auth.decorator.d.ts +8 -0
- package/src/decorators/omni-auth.decorator.js +60 -0
- package/src/decorators/omni-auth.decorator.ts +46 -0
- package/src/decorators/operation.decorator.d.ts +1 -0
- package/src/decorators/operation.decorator.js +6 -0
- package/src/decorators/operation.decorator.ts +4 -0
- package/src/decorators/property.decorators.d.ts +15 -0
- package/src/decorators/property.decorators.js +36 -0
- package/src/decorators/property.decorators.ts +62 -0
- package/src/decorators/public-route.decorator.d.ts +3 -0
- package/src/decorators/public-route.decorator.js +8 -0
- package/src/decorators/public-route.decorator.ts +8 -0
- package/src/decorators/swagger.schema.d.ts +5 -0
- package/src/decorators/swagger.schema.js +82 -0
- package/src/decorators/swagger.schema.ts +117 -0
- package/src/decorators/timestamp-column.decorator.d.ts +1 -0
- package/src/decorators/timestamp-column.decorator.js +28 -0
- package/src/decorators/timestamp-column.decorator.ts +29 -0
- package/src/decorators/transform.decorators.d.ts +35 -0
- package/src/decorators/transform.decorators.js +122 -0
- package/src/decorators/transform.decorators.ts +147 -0
- package/src/decorators/translate.decorator.d.ts +5 -0
- package/src/decorators/translate.decorator.js +18 -0
- package/src/decorators/translate.decorator.ts +19 -0
- package/src/decorators/use-dto.decorator.d.ts +4 -0
- package/src/decorators/use-dto.decorator.js +9 -0
- package/src/decorators/use-dto.decorator.ts +11 -0
- package/src/decorators/user-check.decorator.d.ts +6 -0
- package/src/decorators/user-check.decorator.js +44 -0
- package/src/decorators/user-check.decorator.ts +30 -0
- package/src/decorators/user.decorator.d.ts +8 -0
- package/src/decorators/user.decorator.js +62 -0
- package/src/decorators/user.decorator.ts +48 -0
- package/src/decorators/user_auth.decorator.d.ts +1 -0
- package/src/decorators/user_auth.decorator.js +16 -0
- package/src/decorators/user_auth.decorator.ts +15 -0
- package/src/decorators/validator.decorators.d.ts +10 -0
- package/src/decorators/validator.decorators.js +59 -0
- package/src/decorators/validator.decorators.ts +78 -0
- package/src/exceptions/file-not-image.exception.d.ts +4 -0
- package/src/exceptions/file-not-image.exception.js +10 -0
- package/src/exceptions/file-not-image.exception.ts +7 -0
- package/src/exceptions/index.d.ts +2 -0
- package/src/exceptions/index.js +18 -0
- package/src/exceptions/index.ts +2 -0
- package/src/exceptions/page-type.exception.d.ts +4 -0
- package/src/exceptions/page-type.exception.js +10 -0
- package/src/exceptions/page-type.exception.ts +7 -0
- package/src/exceptions/user-not-found.exception.d.ts +4 -0
- package/src/exceptions/user-not-found.exception.js +10 -0
- package/src/exceptions/user-not-found.exception.ts +7 -0
- package/src/filters/bad-request.filter.d.ts +5 -0
- package/src/filters/bad-request.filter.js +104 -0
- package/src/filters/bad-request.filter.ts +67 -0
- package/src/filters/constraint-errors.d.ts +1 -0
- package/src/filters/constraint-errors.js +7 -0
- package/src/filters/constraint-errors.ts +5 -0
- package/src/filters/index.d.ts +3 -0
- package/src/filters/index.js +19 -0
- package/src/filters/index.ts +3 -0
- package/src/filters/query-failed.filter.d.ts +10 -0
- package/src/filters/query-failed.filter.js +81 -0
- package/src/filters/query-failed.filter.ts +32 -0
- package/src/health-checker/health-checker.controller.d.ts +15 -0
- package/src/health-checker/health-checker.controller.js +104 -0
- package/src/health-checker/health-checker.controller.ts +51 -0
- package/src/health-checker/health-checker.module.d.ts +2 -0
- package/src/health-checker/health-checker.module.js +69 -0
- package/src/health-checker/health-checker.module.ts +13 -0
- package/src/health-checker/health-indicators/service.indicator.d.ts +8 -0
- package/src/health-checker/health-indicators/service.indicator.js +102 -0
- package/src/health-checker/health-indicators/service.indicator.ts +44 -0
- package/src/helpers/common.helper.d.ts +16 -0
- package/src/helpers/common.helper.js +49 -0
- package/src/helpers/common.helper.ts +49 -0
- package/src/helpers/date.helper.d.ts +10 -0
- package/src/helpers/date.helper.js +81 -0
- package/src/helpers/date.helper.ts +64 -0
- package/src/helpers/excel.helper.d.ts +27 -0
- package/src/helpers/excel.helper.js +338 -0
- package/src/helpers/index.d.ts +3 -0
- package/src/helpers/index.js +19 -0
- package/src/helpers/index.ts +3 -0
- package/src/i18n/en_US/validation.json +38 -0
- package/src/i18n/zh_CN/validation.json +38 -0
- package/src/index.d.ts +11 -0
- package/src/index.js +28 -0
- package/src/index.ts +12 -0
- package/src/interceptors/auth-user.interceptor.d.ts +4 -0
- package/src/interceptors/auth-user.interceptor.js +68 -0
- package/src/interceptors/auth-user.interceptor.ts +20 -0
- package/src/interceptors/index.d.ts +2 -0
- package/src/interceptors/index.js +18 -0
- package/src/interceptors/index.ts +2 -0
- package/src/interceptors/language-interceptor.service.d.ts +6 -0
- package/src/interceptors/language-interceptor.service.js +74 -0
- package/src/interceptors/language-interceptor.service.ts +31 -0
- package/src/interceptors/translation-interceptor.service.d.ts +5 -0
- package/src/interceptors/translation-interceptor.service.js +83 -0
- package/src/interceptors/translation-interceptor.service.ts +43 -0
- package/src/interfaces/IApiFile.d.ts +4 -0
- package/src/interfaces/IApiFile.js +2 -0
- package/src/interfaces/IApiFile.ts +4 -0
- package/src/interfaces/IFile.d.ts +9 -0
- package/src/interfaces/IFile.js +2 -0
- package/src/interfaces/IFile.ts +8 -0
- package/src/interfaces/ITranslationDecoratorInterface.d.ts +3 -0
- package/src/interfaces/ITranslationDecoratorInterface.js +2 -0
- package/src/interfaces/ITranslationDecoratorInterface.ts +3 -0
- package/src/interfaces/index.d.ts +3 -0
- package/src/interfaces/index.js +19 -0
- package/src/interfaces/index.ts +3 -0
- package/src/interfaces/response.d.ts +25 -0
- package/src/interfaces/response.js +2 -0
- package/src/interfaces/response.ts +37 -0
- package/src/middlewares/index.d.ts +3 -0
- package/src/middlewares/index.js +19 -0
- package/src/middlewares/index.ts +3 -0
- package/src/middlewares/omni-auth.middleware.d.ts +1 -0
- package/src/middlewares/omni-auth.middleware.js +13 -0
- package/src/middlewares/omni-auth.middleware.ts +10 -0
- package/src/middlewares/powerby.middleware.d.ts +1 -0
- package/src/middlewares/powerby.middleware.js +10 -0
- package/src/middlewares/powerby.middleware.ts +6 -0
- package/src/middlewares/request-id.middleware.d.ts +7 -0
- package/src/middlewares/request-id.middleware.js +22 -0
- package/src/middlewares/request-id.middleware.ts +28 -0
- package/src/providers/context.provider.d.ts +32 -0
- package/src/providers/context.provider.js +73 -0
- package/src/providers/context.provider.ts +98 -0
- package/src/providers/generator.provider.d.ts +13 -0
- package/src/providers/generator.provider.js +54 -0
- package/src/providers/generator.provider.ts +66 -0
- package/src/providers/index.d.ts +2 -0
- package/src/providers/index.js +18 -0
- package/src/providers/index.ts +2 -0
- package/src/setup/bootstrap.setup.d.ts +5 -0
- package/src/setup/bootstrap.setup.js +138 -0
- package/src/setup/bootstrap.setup.ts +139 -0
- package/src/setup/index.d.ts +1 -0
- package/src/setup/index.js +17 -0
- package/src/setup/index.ts +1 -0
- package/src/setup/microservices.setup.js +55 -0
- package/src/setup-swagger.d.ts +2 -0
- package/src/setup-swagger.js +62 -0
- package/src/setup-swagger.ts +67 -0
- package/src/shared/index.d.ts +2 -0
- package/src/shared/index.js +18 -0
- package/src/shared/index.ts +2 -0
- package/src/shared/serviceRegistryModule.d.ts +2 -0
- package/src/shared/serviceRegistryModule.js +176 -0
- package/src/shared/serviceRegistryModule.ts +110 -0
- package/src/shared/services/api-config.service.d.ts +73 -0
- package/src/shared/services/api-config.service.js +335 -0
- package/src/shared/services/api-config.service.ts +319 -0
- package/src/shared/services/aws-s3.service.d.ts +10 -0
- package/src/shared/services/aws-s3.service.js +96 -0
- package/src/shared/services/aws-s3.service.ts +39 -0
- package/src/shared/services/generator.service.d.ts +4 -0
- package/src/shared/services/generator.service.js +67 -0
- package/src/shared/services/generator.service.ts +13 -0
- package/src/shared/services/index.d.ts +5 -0
- package/src/shared/services/index.js +21 -0
- package/src/shared/services/index.ts +5 -0
- package/src/shared/services/translation.service.d.ts +9 -0
- package/src/shared/services/translation.service.js +109 -0
- package/src/shared/services/translation.service.ts +59 -0
- package/src/shared/services/validator.service.d.ts +3 -0
- package/src/shared/services/validator.service.js +64 -0
- package/src/shared/services/validator.service.ts +10 -0
- package/src/snake-naming.strategy.d.ts +11 -0
- package/src/snake-naming.strategy.js +37 -0
- package/src/snake-naming.strategy.ts +64 -0
- package/src/types.d.ts +9 -0
- package/src/types.js +2 -0
- package/src/types.ts +44 -0
- package/src/validators/file-mimetype.validator.d.ts +13 -0
- package/src/validators/file-mimetype.validator.js +21 -0
- package/src/validators/file-mimetype.validator.ts +34 -0
- package/src/validators/index.d.ts +3 -0
- package/src/validators/index.js +19 -0
- package/src/validators/index.ts +3 -0
- package/src/validators/is-exists.validator.d.ts +18 -0
- package/src/validators/is-exists.validator.js +99 -0
- package/src/validators/is-exists.validator.ts +60 -0
- package/src/validators/is-unique.validator.d.ts +17 -0
- package/src/validators/is-unique.validator.js +131 -0
- package/src/validators/is-unique.validator.ts +93 -0
- package/src/validators/phone-country-code.validator.d.ts +2 -0
- package/src/validators/phone-country-code.validator.js +30 -0
- package/src/validators/phone-country-code.validator.ts +36 -0
- package/src/validators/same-as.validator.d.ts +2 -0
- package/src/validators/same-as.validator.js +25 -0
- package/src/validators/same-as.validator.ts +27 -0
- package/src/validators/skip-empty.validator.d.ts +6 -0
- package/src/validators/skip-empty.validator.js +23 -0
- package/src/validators/skip-empty.validator.ts +25 -0
- package/tsconfig.json +21 -0
- package/tsconfig.lib.json +16 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
4
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
5
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
6
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
7
|
+
var _, done = false;
|
|
8
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
+
var context = {};
|
|
10
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
+
if (kind === "accessor") {
|
|
15
|
+
if (result === void 0) continue;
|
|
16
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
+
}
|
|
21
|
+
else if (_ = accept(result)) {
|
|
22
|
+
if (kind === "field") initializers.unshift(_);
|
|
23
|
+
else descriptor[key] = _;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
+
done = true;
|
|
28
|
+
};
|
|
29
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
+
var useValue = arguments.length > 2;
|
|
31
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
+
}
|
|
34
|
+
return useValue ? value : void 0;
|
|
35
|
+
};
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
46
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
47
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
exports.AwsS3Service = void 0;
|
|
54
|
+
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
55
|
+
const common_1 = require("@nestjs/common");
|
|
56
|
+
const mime_types_1 = __importDefault(require("mime-types"));
|
|
57
|
+
let AwsS3Service = (() => {
|
|
58
|
+
let _classDecorators = [(0, common_1.Injectable)()];
|
|
59
|
+
let _classDescriptor;
|
|
60
|
+
let _classExtraInitializers = [];
|
|
61
|
+
let _classThis;
|
|
62
|
+
var AwsS3Service = _classThis = class {
|
|
63
|
+
constructor(configService, generatorService) {
|
|
64
|
+
this.configService = configService;
|
|
65
|
+
this.generatorService = generatorService;
|
|
66
|
+
const awsS3Config = configService.awsS3Config;
|
|
67
|
+
this.s3 = new client_s3_1.S3({
|
|
68
|
+
apiVersion: awsS3Config.bucketApiVersion,
|
|
69
|
+
region: awsS3Config.bucketRegion,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
uploadImage(file) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
const fileName = this.generatorService.fileName(mime_types_1.default.extension(file.mimetype));
|
|
75
|
+
const key = 'images/' + fileName;
|
|
76
|
+
yield this.s3.putObject({
|
|
77
|
+
Bucket: this.configService.awsS3Config.bucketName,
|
|
78
|
+
Body: file.buffer,
|
|
79
|
+
ACL: 'public-read',
|
|
80
|
+
Key: key,
|
|
81
|
+
});
|
|
82
|
+
return key;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
__setFunctionName(_classThis, "AwsS3Service");
|
|
87
|
+
(() => {
|
|
88
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
89
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
90
|
+
AwsS3Service = _classThis = _classDescriptor.value;
|
|
91
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
92
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
93
|
+
})();
|
|
94
|
+
return AwsS3Service = _classThis;
|
|
95
|
+
})();
|
|
96
|
+
exports.AwsS3Service = AwsS3Service;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { S3 } from '@aws-sdk/client-s3';
|
|
2
|
+
import { Injectable } from '@nestjs/common';
|
|
3
|
+
import mime from 'mime-types';
|
|
4
|
+
|
|
5
|
+
import type { IFile } from '../../interfaces';
|
|
6
|
+
import { ApiConfigService } from './api-config.service';
|
|
7
|
+
import { GeneratorService } from './generator.service';
|
|
8
|
+
|
|
9
|
+
@Injectable()
|
|
10
|
+
export class AwsS3Service {
|
|
11
|
+
private readonly s3: S3;
|
|
12
|
+
|
|
13
|
+
constructor(
|
|
14
|
+
public configService: ApiConfigService,
|
|
15
|
+
public generatorService: GeneratorService,
|
|
16
|
+
) {
|
|
17
|
+
const awsS3Config = configService.awsS3Config;
|
|
18
|
+
|
|
19
|
+
this.s3 = new S3({
|
|
20
|
+
apiVersion: awsS3Config.bucketApiVersion,
|
|
21
|
+
region: awsS3Config.bucketRegion,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async uploadImage(file: IFile): Promise<string> {
|
|
26
|
+
const fileName = this.generatorService.fileName(
|
|
27
|
+
<string>mime.extension(file.mimetype),
|
|
28
|
+
);
|
|
29
|
+
const key = 'images/' + fileName;
|
|
30
|
+
await this.s3.putObject({
|
|
31
|
+
Bucket: this.configService.awsS3Config.bucketName,
|
|
32
|
+
Body: file.buffer,
|
|
33
|
+
ACL: 'public-read',
|
|
34
|
+
Key: key,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return key;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
4
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
5
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
6
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
7
|
+
var _, done = false;
|
|
8
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
+
var context = {};
|
|
10
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
+
if (kind === "accessor") {
|
|
15
|
+
if (result === void 0) continue;
|
|
16
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
+
}
|
|
21
|
+
else if (_ = accept(result)) {
|
|
22
|
+
if (kind === "field") initializers.unshift(_);
|
|
23
|
+
else descriptor[key] = _;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
+
done = true;
|
|
28
|
+
};
|
|
29
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
+
var useValue = arguments.length > 2;
|
|
31
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
+
}
|
|
34
|
+
return useValue ? value : void 0;
|
|
35
|
+
};
|
|
36
|
+
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
37
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
38
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
39
|
+
};
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.GeneratorService = void 0;
|
|
42
|
+
const common_1 = require("@nestjs/common");
|
|
43
|
+
const uuid_1 = require("uuid");
|
|
44
|
+
let GeneratorService = (() => {
|
|
45
|
+
let _classDecorators = [(0, common_1.Injectable)()];
|
|
46
|
+
let _classDescriptor;
|
|
47
|
+
let _classExtraInitializers = [];
|
|
48
|
+
let _classThis;
|
|
49
|
+
var GeneratorService = _classThis = class {
|
|
50
|
+
uuid() {
|
|
51
|
+
return (0, uuid_1.v1)();
|
|
52
|
+
}
|
|
53
|
+
fileName(ext) {
|
|
54
|
+
return this.uuid() + '.' + ext;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
__setFunctionName(_classThis, "GeneratorService");
|
|
58
|
+
(() => {
|
|
59
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
60
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
61
|
+
GeneratorService = _classThis = _classDescriptor.value;
|
|
62
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
63
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
64
|
+
})();
|
|
65
|
+
return GeneratorService = _classThis;
|
|
66
|
+
})();
|
|
67
|
+
exports.GeneratorService = GeneratorService;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { v1 as uuid } from 'uuid';
|
|
3
|
+
|
|
4
|
+
@Injectable()
|
|
5
|
+
export class GeneratorService {
|
|
6
|
+
public uuid(): string {
|
|
7
|
+
return uuid();
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
public fileName(ext: string): string {
|
|
11
|
+
return this.uuid() + '.' + ext;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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-config.service"), exports);
|
|
18
|
+
__exportStar(require("./aws-s3.service"), exports);
|
|
19
|
+
__exportStar(require("./generator.service"), exports);
|
|
20
|
+
__exportStar(require("./translation.service"), exports);
|
|
21
|
+
__exportStar(require("./validator.service"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TranslateOptions } from 'nestjs-i18n';
|
|
2
|
+
import { I18nService } from 'nestjs-i18n';
|
|
3
|
+
import { AbstractDto } from '../../common/dto/abstract.dto';
|
|
4
|
+
export declare class TranslationService {
|
|
5
|
+
private readonly i18n;
|
|
6
|
+
constructor(i18n: I18nService);
|
|
7
|
+
translate(key: string, options?: TranslateOptions): Promise<string>;
|
|
8
|
+
translateNecessaryKeys<T extends AbstractDto>(dto: T): Promise<T>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
4
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
5
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
6
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
7
|
+
var _, done = false;
|
|
8
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
+
var context = {};
|
|
10
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
+
if (kind === "accessor") {
|
|
15
|
+
if (result === void 0) continue;
|
|
16
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
+
}
|
|
21
|
+
else if (_ = accept(result)) {
|
|
22
|
+
if (kind === "field") initializers.unshift(_);
|
|
23
|
+
else descriptor[key] = _;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
+
done = true;
|
|
28
|
+
};
|
|
29
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
+
var useValue = arguments.length > 2;
|
|
31
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
+
}
|
|
34
|
+
return useValue ? value : void 0;
|
|
35
|
+
};
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
46
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
47
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.TranslationService = void 0;
|
|
51
|
+
const common_1 = require("@nestjs/common");
|
|
52
|
+
const lodash_1 = require("lodash");
|
|
53
|
+
const abstract_dto_1 = require("../../common/dto/abstract.dto");
|
|
54
|
+
const decorators_1 = require("../../decorators");
|
|
55
|
+
const providers_1 = require("../../providers");
|
|
56
|
+
let TranslationService = (() => {
|
|
57
|
+
let _classDecorators = [(0, common_1.Injectable)()];
|
|
58
|
+
let _classDescriptor;
|
|
59
|
+
let _classExtraInitializers = [];
|
|
60
|
+
let _classThis;
|
|
61
|
+
var TranslationService = _classThis = class {
|
|
62
|
+
constructor(i18n) {
|
|
63
|
+
this.i18n = i18n;
|
|
64
|
+
}
|
|
65
|
+
translate(key, options) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
return this.i18n.translate(`${key}`, Object.assign(Object.assign({}, options), { lang: providers_1.ContextProvider.getLanguage() }));
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
translateNecessaryKeys(dto) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
if ((0, lodash_1.isString)(dto)) {
|
|
73
|
+
return dto;
|
|
74
|
+
}
|
|
75
|
+
yield Promise.all((0, lodash_1.map)(dto, (value, key) => __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
var _a;
|
|
77
|
+
if ((0, lodash_1.isString)(value)) {
|
|
78
|
+
const translateDec = Reflect.getMetadata(decorators_1.STATIC_TRANSLATION_DECORATOR_KEY, dto, key);
|
|
79
|
+
if (translateDec) {
|
|
80
|
+
return this.translate(`${(_a = translateDec.translationKey) !== null && _a !== void 0 ? _a : key}.${value}`);
|
|
81
|
+
}
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (value instanceof abstract_dto_1.AbstractDto) {
|
|
85
|
+
return this.translateNecessaryKeys(value);
|
|
86
|
+
}
|
|
87
|
+
if ((0, lodash_1.isArray)(value)) {
|
|
88
|
+
return Promise.all((0, lodash_1.map)(value, (v) => {
|
|
89
|
+
if (v instanceof abstract_dto_1.AbstractDto) {
|
|
90
|
+
return this.translateNecessaryKeys(v);
|
|
91
|
+
}
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
})));
|
|
95
|
+
return dto;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
__setFunctionName(_classThis, "TranslationService");
|
|
100
|
+
(() => {
|
|
101
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
102
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
103
|
+
TranslationService = _classThis = _classDescriptor.value;
|
|
104
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
105
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
106
|
+
})();
|
|
107
|
+
return TranslationService = _classThis;
|
|
108
|
+
})();
|
|
109
|
+
exports.TranslationService = TranslationService;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { isArray, isString, map } from 'lodash';
|
|
3
|
+
import type { TranslateOptions } from 'nestjs-i18n';
|
|
4
|
+
import { I18nService } from 'nestjs-i18n';
|
|
5
|
+
|
|
6
|
+
import { AbstractDto } from '../../common/dto/abstract.dto';
|
|
7
|
+
import { STATIC_TRANSLATION_DECORATOR_KEY } from '../../decorators';
|
|
8
|
+
import type { ITranslationDecoratorInterface } from '../../interfaces';
|
|
9
|
+
import { ContextProvider } from '../../providers';
|
|
10
|
+
|
|
11
|
+
@Injectable()
|
|
12
|
+
export class TranslationService {
|
|
13
|
+
constructor(private readonly i18n: I18nService) {}
|
|
14
|
+
|
|
15
|
+
async translate(key: string, options?: TranslateOptions): Promise<string> {
|
|
16
|
+
return this.i18n.translate(`${key}`, {
|
|
17
|
+
...options,
|
|
18
|
+
lang: ContextProvider.getLanguage(),
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async translateNecessaryKeys<T extends AbstractDto>(dto: T): Promise<T> {
|
|
23
|
+
if (isString(dto)) {
|
|
24
|
+
return dto;
|
|
25
|
+
}
|
|
26
|
+
await Promise.all(
|
|
27
|
+
map(dto, async (value, key) => {
|
|
28
|
+
if (isString(value)) {
|
|
29
|
+
const translateDec: ITranslationDecoratorInterface | undefined =
|
|
30
|
+
Reflect.getMetadata(STATIC_TRANSLATION_DECORATOR_KEY, dto, key);
|
|
31
|
+
|
|
32
|
+
if (translateDec) {
|
|
33
|
+
return this.translate(
|
|
34
|
+
`${translateDec.translationKey ?? key}.${value}`,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (value instanceof AbstractDto) {
|
|
42
|
+
return this.translateNecessaryKeys(value);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (isArray(value)) {
|
|
46
|
+
return Promise.all(
|
|
47
|
+
map(value, (v) => {
|
|
48
|
+
if (v instanceof AbstractDto) {
|
|
49
|
+
return this.translateNecessaryKeys(v);
|
|
50
|
+
}
|
|
51
|
+
}),
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
}),
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
return dto;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
4
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
5
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
6
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
7
|
+
var _, done = false;
|
|
8
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
+
var context = {};
|
|
10
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
+
if (kind === "accessor") {
|
|
15
|
+
if (result === void 0) continue;
|
|
16
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
+
}
|
|
21
|
+
else if (_ = accept(result)) {
|
|
22
|
+
if (kind === "field") initializers.unshift(_);
|
|
23
|
+
else descriptor[key] = _;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
+
done = true;
|
|
28
|
+
};
|
|
29
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
+
var useValue = arguments.length > 2;
|
|
31
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
+
}
|
|
34
|
+
return useValue ? value : void 0;
|
|
35
|
+
};
|
|
36
|
+
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
37
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
38
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
39
|
+
};
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.ValidatorService = void 0;
|
|
42
|
+
const common_1 = require("@nestjs/common");
|
|
43
|
+
let ValidatorService = (() => {
|
|
44
|
+
let _classDecorators = [(0, common_1.Injectable)()];
|
|
45
|
+
let _classDescriptor;
|
|
46
|
+
let _classExtraInitializers = [];
|
|
47
|
+
let _classThis;
|
|
48
|
+
var ValidatorService = _classThis = class {
|
|
49
|
+
isImage(mimeType) {
|
|
50
|
+
const imageMimeTypes = ['image/jpeg', 'image/png'];
|
|
51
|
+
return imageMimeTypes.includes(mimeType);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
__setFunctionName(_classThis, "ValidatorService");
|
|
55
|
+
(() => {
|
|
56
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
57
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
58
|
+
ValidatorService = _classThis = _classDescriptor.value;
|
|
59
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
60
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
61
|
+
})();
|
|
62
|
+
return ValidatorService = _classThis;
|
|
63
|
+
})();
|
|
64
|
+
exports.ValidatorService = ValidatorService;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NamingStrategyInterface } from 'typeorm';
|
|
2
|
+
import { DefaultNamingStrategy } from 'typeorm';
|
|
3
|
+
export declare class SnakeNamingStrategy extends DefaultNamingStrategy implements NamingStrategyInterface {
|
|
4
|
+
tableName(className: string, customName: string | undefined): string;
|
|
5
|
+
columnName(propertyName: string, customName: string | undefined, embeddedPrefixes: string[]): string;
|
|
6
|
+
relationName(propertyName: string): string;
|
|
7
|
+
joinColumnName(relationName: string, referencedColumnName: string): string;
|
|
8
|
+
joinTableName(firstTableName: string, secondTableName: string, firstPropertyName: string, _secondPropertyName: string): string;
|
|
9
|
+
joinTableColumnName(tableName: string, propertyName: string, columnName?: string): string;
|
|
10
|
+
classTableInheritanceParentColumnName(parentTableName: string, parentTableIdPropertyName: string): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SnakeNamingStrategy = void 0;
|
|
4
|
+
const typeorm_1 = require("typeorm");
|
|
5
|
+
const StringUtils_1 = require("typeorm/util/StringUtils");
|
|
6
|
+
class SnakeNamingStrategy extends typeorm_1.DefaultNamingStrategy {
|
|
7
|
+
tableName(className, customName) {
|
|
8
|
+
if (className.includes('Entity')) {
|
|
9
|
+
className = className.replace('Entity', '');
|
|
10
|
+
}
|
|
11
|
+
return customName !== null && customName !== void 0 ? customName : (0, StringUtils_1.snakeCase)(className);
|
|
12
|
+
}
|
|
13
|
+
columnName(propertyName, customName, embeddedPrefixes) {
|
|
14
|
+
return ((0, StringUtils_1.snakeCase)(embeddedPrefixes.join('_')) +
|
|
15
|
+
(customName !== null && customName !== void 0 ? customName : (0, StringUtils_1.snakeCase)(propertyName)));
|
|
16
|
+
}
|
|
17
|
+
relationName(propertyName) {
|
|
18
|
+
return (0, StringUtils_1.snakeCase)(propertyName);
|
|
19
|
+
}
|
|
20
|
+
joinColumnName(relationName, referencedColumnName) {
|
|
21
|
+
return (0, StringUtils_1.snakeCase)(relationName + '_' + referencedColumnName);
|
|
22
|
+
}
|
|
23
|
+
joinTableName(firstTableName, secondTableName, firstPropertyName, _secondPropertyName) {
|
|
24
|
+
return (0, StringUtils_1.snakeCase)(firstTableName +
|
|
25
|
+
'_' +
|
|
26
|
+
firstPropertyName.replace(/\./gi, '_') +
|
|
27
|
+
'_' +
|
|
28
|
+
secondTableName);
|
|
29
|
+
}
|
|
30
|
+
joinTableColumnName(tableName, propertyName, columnName) {
|
|
31
|
+
return (0, StringUtils_1.snakeCase)(tableName + '_' + (columnName !== null && columnName !== void 0 ? columnName : propertyName));
|
|
32
|
+
}
|
|
33
|
+
classTableInheritanceParentColumnName(parentTableName, parentTableIdPropertyName) {
|
|
34
|
+
return (0, StringUtils_1.snakeCase)(`${parentTableName}_${parentTableIdPropertyName}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.SnakeNamingStrategy = SnakeNamingStrategy;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { NamingStrategyInterface } from 'typeorm';
|
|
2
|
+
import { DefaultNamingStrategy } from 'typeorm';
|
|
3
|
+
import { snakeCase } from 'typeorm/util/StringUtils';
|
|
4
|
+
|
|
5
|
+
export class SnakeNamingStrategy
|
|
6
|
+
extends DefaultNamingStrategy
|
|
7
|
+
implements NamingStrategyInterface
|
|
8
|
+
{
|
|
9
|
+
tableName(className: string, customName: string | undefined): string {
|
|
10
|
+
if (className.includes('Entity')) {
|
|
11
|
+
className = className.replace('Entity', '');
|
|
12
|
+
}
|
|
13
|
+
return customName ?? snakeCase(className);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
columnName(
|
|
17
|
+
propertyName: string,
|
|
18
|
+
customName: string | undefined,
|
|
19
|
+
embeddedPrefixes: string[],
|
|
20
|
+
): string {
|
|
21
|
+
return (
|
|
22
|
+
snakeCase(embeddedPrefixes.join('_')) +
|
|
23
|
+
(customName ?? snakeCase(propertyName))
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
relationName(propertyName: string): string {
|
|
28
|
+
return snakeCase(propertyName);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
joinColumnName(relationName: string, referencedColumnName: string): string {
|
|
32
|
+
return snakeCase(relationName + '_' + referencedColumnName);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
joinTableName(
|
|
36
|
+
firstTableName: string,
|
|
37
|
+
secondTableName: string,
|
|
38
|
+
firstPropertyName: string,
|
|
39
|
+
_secondPropertyName: string,
|
|
40
|
+
): string {
|
|
41
|
+
return snakeCase(
|
|
42
|
+
firstTableName +
|
|
43
|
+
'_' +
|
|
44
|
+
firstPropertyName.replace(/\./gi, '_') +
|
|
45
|
+
'_' +
|
|
46
|
+
secondTableName,
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
joinTableColumnName(
|
|
51
|
+
tableName: string,
|
|
52
|
+
propertyName: string,
|
|
53
|
+
columnName?: string,
|
|
54
|
+
): string {
|
|
55
|
+
return snakeCase(tableName + '_' + (columnName ?? propertyName));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
classTableInheritanceParentColumnName(
|
|
59
|
+
parentTableName: string,
|
|
60
|
+
parentTableIdPropertyName: string,
|
|
61
|
+
): string {
|
|
62
|
+
return snakeCase(`${parentTableName}_${parentTableIdPropertyName}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
package/src/types.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type Constructor<T, Arguments extends unknown[] = undefined[]> = new (...arguments_: Arguments) => T;
|
|
2
|
+
export type Plain<T> = T;
|
|
3
|
+
export type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
|
|
4
|
+
export type PathImpl2<T> = PathImpl<T, keyof T> | keyof T;
|
|
5
|
+
export type Path<T> = keyof T extends string ? PathImpl2<T> extends string | keyof T ? PathImpl2<T> : keyof T : never;
|
|
6
|
+
export type PathValue<T, P extends Path<T>> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? Rest extends Path<T[Key]> ? PathValue<T[Key], Rest> : never : never : P extends keyof T ? T[P] : never;
|
|
7
|
+
export type KeyOfType<Entity, U> = {
|
|
8
|
+
[P in keyof Required<Entity>]: Required<Entity>[P] extends U ? P : Required<Entity>[P] extends U[] ? P : never;
|
|
9
|
+
}[keyof Entity];
|
package/src/types.js
ADDED