@elsikora/nestjs-crud-automator 1.6.4-dev.1 → 1.6.5-dev.1
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.md +381 -266
- package/dist/cjs/class/metadata-storage.class.js +2 -3
- package/dist/cjs/class/metadata-storage.class.js.map +1 -1
- package/dist/cjs/decorator/api/method.decorator.js +56 -56
- package/dist/cjs/decorator/api/method.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/property/date.decorator.js +2 -2
- package/dist/cjs/decorator/api/property/date.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/property/string.decorator.js +2 -2
- package/dist/cjs/decorator/api/property/string.decorator.js.map +1 -1
- package/dist/cjs/factory/api/controller.factory.js +3 -0
- package/dist/cjs/factory/api/controller.factory.js.map +1 -1
- package/dist/cjs/package.json +8 -0
- package/dist/cjs/utility/api/controller/get-list/transform-filter.utility.js +3 -1
- package/dist/cjs/utility/api/controller/get-list/transform-filter.utility.js.map +1 -1
- package/dist/cjs/utility/api/controller/write-dto-swagger.utility.js +1 -1
- package/dist/cjs/utility/api/controller/write-dto-swagger.utility.js.map +1 -1
- package/dist/cjs/utility/api/controller/write-method.utility.js +6 -1
- package/dist/cjs/utility/api/controller/write-method.utility.js.map +1 -1
- package/dist/cjs/utility/camel-case-string.utility.js +1 -1
- package/dist/cjs/utility/camel-case-string.utility.js.map +1 -1
- package/dist/cjs/utility/dto/generate-exception.utility.js +5 -5
- package/dist/cjs/utility/dto/generate-exception.utility.js.map +1 -1
- package/dist/cjs/utility/dto/generate-get-list-response.utility.js +5 -0
- package/dist/cjs/utility/dto/generate-get-list-response.utility.js.map +1 -1
- package/dist/cjs/utility/dto/generate-relation-response.utility.js +1 -0
- package/dist/cjs/utility/dto/generate-relation-response.utility.js.map +1 -1
- package/dist/cjs/utility/dto/get-get-list-query-base-class.utility.js +4 -0
- package/dist/cjs/utility/dto/get-get-list-query-base-class.utility.js.map +1 -1
- package/dist/cjs/validator/has-paired-custom-suffixes-fields.validator.js.map +1 -1
- package/dist/esm/class/api/index.d.ts +1 -0
- package/dist/esm/class/api/service-base.class.d.ts +11 -0
- package/dist/esm/class/index.d.ts +3 -0
- package/dist/esm/class/metadata-storage.class.d.ts +12 -0
- package/dist/esm/class/utility/dto/index.d.ts +2 -0
- package/dist/esm/class/utility/dto/property/factory/boolean.class.d.ts +6 -0
- package/dist/esm/class/utility/dto/property/factory/date.class.d.ts +6 -0
- package/dist/esm/class/utility/dto/property/factory/enum.class.d.ts +6 -0
- package/dist/esm/class/utility/dto/property/factory/index.d.ts +6 -0
- package/dist/esm/class/utility/dto/property/factory/number.class.d.ts +7 -0
- package/dist/esm/class/utility/dto/property/factory/object.class.d.ts +6 -0
- package/dist/esm/class/utility/dto/property/factory/relation.class.d.ts +7 -0
- package/dist/esm/class/utility/dto/property/factory/string.class.d.ts +6 -0
- package/dist/esm/class/utility/dto/property/factory/uuid.class.d.ts +6 -0
- package/dist/esm/class/utility/dto/property/index.d.ts +1 -0
- package/dist/esm/class/utility/dto/strategy/body.class.d.ts +6 -0
- package/dist/esm/class/utility/dto/strategy/index.d.ts +4 -0
- package/dist/esm/class/utility/dto/strategy/query.class.d.ts +6 -0
- package/dist/esm/class/utility/dto/strategy/request.class.d.ts +6 -0
- package/dist/esm/class/utility/dto/strategy/response.class.d.ts +6 -0
- package/dist/esm/class/utility/index.d.ts +1 -0
- package/dist/esm/constant/date.constant.d.ts +4 -0
- package/dist/esm/constant/decorator/api/controller.constant.d.ts +3 -0
- package/dist/esm/constant/decorator/api/function.constant.d.ts +4 -0
- package/dist/esm/constant/decorator/api/index.d.ts +3 -0
- package/dist/esm/constant/decorator/api/property-describe.constant.d.ts +3 -0
- package/dist/esm/constant/decorator/index.d.ts +1 -0
- package/dist/esm/constant/dto/exception.constant.d.ts +6 -0
- package/dist/esm/constant/dto/index.d.ts +3 -0
- package/dist/esm/constant/dto/list.constant.d.ts +7 -0
- package/dist/esm/constant/dto/transformer-value.constant.d.ts +7 -0
- package/dist/esm/constant/factory/dto/get-list-query.constant.d.ts +6 -0
- package/dist/esm/constant/factory/dto/index.d.ts +1 -0
- package/dist/esm/constant/factory/index.d.ts +1 -0
- package/dist/esm/constant/index.d.ts +6 -0
- package/dist/esm/constant/interface/api/filter.constant.d.ts +3 -0
- package/dist/esm/constant/interface/api/index.d.ts +2 -0
- package/dist/esm/constant/interface/api/property/index.d.ts +2 -0
- package/dist/esm/constant/interface/api/property/string.constant.d.ts +6 -0
- package/dist/esm/constant/interface/api/property/wallet.constant.d.ts +5 -0
- package/dist/esm/constant/interface/index.d.ts +1 -0
- package/dist/esm/constant/number.constant.d.ts +18 -0
- package/dist/esm/constant/utility/dto/constant.d.ts +6 -0
- package/dist/esm/constant/utility/dto/generate.constant.d.ts +4 -0
- package/dist/esm/decorator/api/controller.decorator.d.ts +3 -0
- package/dist/esm/decorator/api/function/create.decorator.d.ts +2 -0
- package/dist/esm/decorator/api/function/decorator.d.ts +3 -0
- package/dist/esm/decorator/api/function/delete.decorator.d.ts +2 -0
- package/dist/esm/decorator/api/function/get-list.decorator.d.ts +2 -0
- package/dist/esm/decorator/api/function/get-many.decorator.d.ts +2 -0
- package/dist/esm/decorator/api/function/get.decorator.d.ts +2 -0
- package/dist/esm/decorator/api/function/index.d.ts +7 -0
- package/dist/esm/decorator/api/function/update.decorator.d.ts +2 -0
- package/dist/esm/decorator/api/index.d.ts +5 -0
- package/dist/esm/decorator/api/method.decorator.d.ts +2 -0
- package/dist/esm/decorator/api/property/boolean.decorator.d.ts +2 -0
- package/dist/esm/decorator/api/property/date.decorator.d.ts +2 -0
- package/dist/esm/decorator/api/property/describe.decorator.d.ts +2 -0
- package/dist/esm/decorator/api/property/enum.decorator.d.ts +2 -0
- package/dist/esm/decorator/api/property/index.d.ts +7 -0
- package/dist/esm/decorator/api/property/number.decorator.d.ts +2 -0
- package/dist/esm/decorator/api/property/object.decorator.d.ts +2 -0
- package/dist/esm/decorator/api/property/string.decorator.d.ts +2 -0
- package/dist/esm/decorator/api/property/uuid.decorator.d.ts +2 -0
- package/dist/esm/decorator/api/service.decorator.d.ts +3 -0
- package/dist/esm/decorator/index.d.ts +1 -0
- package/dist/esm/enum/decorator/api/action.enum.d.ts +30 -0
- package/dist/esm/enum/decorator/api/authentication-type.enum.d.ts +6 -0
- package/dist/esm/enum/decorator/api/controller/index.d.ts +2 -0
- package/dist/esm/enum/decorator/api/controller/load-relations-strategy.enum.d.ts +4 -0
- package/dist/esm/enum/decorator/api/controller/request-transformer-type.enum.d.ts +4 -0
- package/dist/esm/enum/decorator/api/dto-type.enum.d.ts +6 -0
- package/dist/esm/enum/decorator/api/function/index.d.ts +1 -0
- package/dist/esm/enum/decorator/api/function/type.enum.d.ts +8 -0
- package/dist/esm/enum/decorator/api/index.d.ts +7 -0
- package/dist/esm/enum/decorator/api/property/data-type.enum.d.ts +18 -0
- package/dist/esm/enum/decorator/api/property/date/identifier.enum.d.ts +14 -0
- package/dist/esm/enum/decorator/api/property/date/index.d.ts +2 -0
- package/dist/esm/enum/decorator/api/property/date/type.enum.d.ts +5 -0
- package/dist/esm/enum/decorator/api/property/desribe-type.enum.d.ts +10 -0
- package/dist/esm/enum/decorator/api/property/index.d.ts +5 -0
- package/dist/esm/enum/decorator/api/property/number-type.enum.d.ts +4 -0
- package/dist/esm/enum/decorator/api/property/string-type.enum.d.ts +11 -0
- package/dist/esm/enum/decorator/api/route-type.enum.d.ts +8 -0
- package/dist/esm/enum/decorator/index.d.ts +1 -0
- package/dist/esm/enum/exception.enum.d.ts +30 -0
- package/dist/esm/enum/filter-operation.enum.d.ts +110 -0
- package/dist/esm/enum/filter-order-direction.enum.d.ts +4 -0
- package/dist/esm/enum/index.d.ts +4 -0
- package/dist/esm/enum/utility/error-string-action.enum.d.ts +102 -0
- package/dist/esm/enum/utility/index.d.ts +1 -0
- package/dist/esm/external/tslib/tslib.es6.js +35 -0
- package/dist/esm/external/tslib/tslib.es6.js.map +1 -0
- package/dist/esm/factory/api/controller.factory.d.ts +18 -0
- package/dist/esm/factory/api/index.d.ts +1 -0
- package/dist/esm/factory/index.d.ts +1 -0
- package/dist/esm/index.d.ts +10 -0
- package/dist/esm/interceptor/correlation-id-response-body.interceptor.d.ts +5 -0
- package/dist/esm/interceptor/index.d.ts +1 -0
- package/dist/esm/interface/api-authentication-request.interface.d.ts +4 -0
- package/dist/esm/interface/api-base-entity.interface.d.ts +4 -0
- package/dist/esm/interface/api-dto-validator.interface.d.ts +4 -0
- package/dist/esm/interface/api-request-validator.interface.d.ts +7 -0
- package/dist/esm/interface/class/dto/index.d.ts +1 -0
- package/dist/esm/interface/class/dto/strategy.interface.d.ts +5 -0
- package/dist/esm/interface/class/index.d.ts +2 -0
- package/dist/esm/interface/class/metadata-entry.interface.d.ts +2 -0
- package/dist/esm/interface/decorator/api/controller/base.interface.d.ts +4 -0
- package/dist/esm/interface/decorator/api/controller/index.d.ts +3 -0
- package/dist/esm/interface/decorator/api/controller/properties/index.d.ts +1 -0
- package/dist/esm/interface/decorator/api/controller/properties/route/authentication.interface.d.ts +9 -0
- package/dist/esm/interface/decorator/api/controller/properties/route/auto-dto-config.interface.d.ts +4 -0
- package/dist/esm/interface/decorator/api/controller/properties/route/base-request.interface.d.ts +8 -0
- package/dist/esm/interface/decorator/api/controller/properties/route/base-response.interface.d.ts +7 -0
- package/dist/esm/interface/decorator/api/controller/properties/route/base.interface.d.ts +11 -0
- package/dist/esm/interface/decorator/api/controller/properties/route/index.d.ts +7 -0
- package/dist/esm/interface/decorator/api/controller/properties/route/with-auto-dto.interface.d.ts +7 -0
- package/dist/esm/interface/decorator/api/controller/properties/route/with-dto.interface.d.ts +7 -0
- package/dist/esm/interface/decorator/api/controller/properties.interface.d.ts +11 -0
- package/dist/esm/interface/decorator/api/function/create-executor-properties.interface.d.ts +8 -0
- package/dist/esm/interface/decorator/api/function/delete-executor-properties.interface.d.ts +9 -0
- package/dist/esm/interface/decorator/api/function/get-executor-properties.interface.d.ts +8 -0
- package/dist/esm/interface/decorator/api/function/get-list-executor-properties.interface.d.ts +8 -0
- package/dist/esm/interface/decorator/api/function/get-many-executor-properties.interface.d.ts +8 -0
- package/dist/esm/interface/decorator/api/function/index.d.ts +7 -0
- package/dist/esm/interface/decorator/api/function/properties.interface.d.ts +4 -0
- package/dist/esm/interface/decorator/api/function/update-executor-properties.interface.d.ts +10 -0
- package/dist/esm/interface/decorator/api/get-list-response-result.interface.d.ts +7 -0
- package/dist/esm/interface/decorator/api/index.d.ts +5 -0
- package/dist/esm/interface/decorator/api/method/index.d.ts +2 -0
- package/dist/esm/interface/decorator/api/method/properties.interface.d.ts +17 -0
- package/dist/esm/interface/decorator/api/method/throttler-properties.interface.d.ts +4 -0
- package/dist/esm/interface/decorator/api/response-type.interface.d.ts +9 -0
- package/dist/esm/interface/decorator/index.d.ts +1 -0
- package/dist/esm/interface/dto-generate-factory.interface.d.ts +6 -0
- package/dist/esm/interface/entity/column.interface.d.ts +7 -0
- package/dist/esm/interface/entity/index.d.ts +2 -0
- package/dist/esm/interface/entity/interface.d.ts +7 -0
- package/dist/esm/interface/index.d.ts +8 -0
- package/dist/esm/interface/utility/api/controller/index.d.ts +1 -0
- package/dist/esm/interface/utility/api/controller/primary-column.interface.d.ts +4 -0
- package/dist/esm/interface/utility/api/index.d.ts +1 -0
- package/dist/esm/interface/utility/error-string-properties.interface.d.ts +5 -0
- package/dist/esm/interface/utility/get-entity-columns-properties.interface.d.ts +6 -0
- package/dist/esm/interface/utility/index.d.ts +2 -0
- package/dist/esm/package.json +8 -0
- package/dist/esm/src/class/api/service-base.class.js +23 -0
- package/dist/esm/src/class/api/service-base.class.js.map +1 -0
- package/dist/esm/src/class/metadata-storage.class.js +47 -0
- package/dist/esm/src/class/metadata-storage.class.js.map +1 -0
- package/dist/esm/src/class/utility/dto/property/factory/boolean.class.js +15 -0
- package/dist/esm/src/class/utility/dto/property/factory/boolean.class.js.map +1 -0
- package/dist/esm/src/class/utility/dto/property/factory/date.class.js +15 -0
- package/dist/esm/src/class/utility/dto/property/factory/date.class.js.map +1 -0
- package/dist/esm/src/class/utility/dto/property/factory/enum.class.js +15 -0
- package/dist/esm/src/class/utility/dto/property/factory/enum.class.js.map +1 -0
- package/dist/esm/src/class/utility/dto/property/factory/number.class.js +32 -0
- package/dist/esm/src/class/utility/dto/property/factory/number.class.js.map +1 -0
- package/dist/esm/src/class/utility/dto/property/factory/object.class.js +16 -0
- package/dist/esm/src/class/utility/dto/property/factory/object.class.js.map +1 -0
- package/dist/esm/src/class/utility/dto/property/factory/relation.class.js +29 -0
- package/dist/esm/src/class/utility/dto/property/factory/relation.class.js.map +1 -0
- package/dist/esm/src/class/utility/dto/property/factory/string.class.js +15 -0
- package/dist/esm/src/class/utility/dto/property/factory/string.class.js.map +1 -0
- package/dist/esm/src/class/utility/dto/property/factory/uuid.class.js +11 -0
- package/dist/esm/src/class/utility/dto/property/factory/uuid.class.js.map +1 -0
- package/dist/esm/src/class/utility/dto/strategy/body.class.js +47 -0
- package/dist/esm/src/class/utility/dto/strategy/body.class.js.map +1 -0
- package/dist/esm/src/class/utility/dto/strategy/query.class.js +44 -0
- package/dist/esm/src/class/utility/dto/strategy/query.class.js.map +1 -0
- package/dist/esm/src/class/utility/dto/strategy/request.class.js +47 -0
- package/dist/esm/src/class/utility/dto/strategy/request.class.js.map +1 -0
- package/dist/esm/src/class/utility/dto/strategy/response.class.js +47 -0
- package/dist/esm/src/class/utility/dto/strategy/response.class.js.map +1 -0
- package/dist/esm/src/constant/date.constant.js +9 -0
- package/dist/esm/src/constant/date.constant.js.map +1 -0
- package/dist/esm/src/constant/decorator/api/controller.constant.js +7 -0
- package/dist/esm/src/constant/decorator/api/controller.constant.js.map +1 -0
- package/dist/esm/src/constant/decorator/api/function.constant.js +24 -0
- package/dist/esm/src/constant/decorator/api/function.constant.js.map +1 -0
- package/dist/esm/src/constant/decorator/api/property-describe.constant.js +7 -0
- package/dist/esm/src/constant/decorator/api/property-describe.constant.js.map +1 -0
- package/dist/esm/src/constant/dto/exception.constant.js +13 -0
- package/dist/esm/src/constant/dto/exception.constant.js.map +1 -0
- package/dist/esm/src/constant/dto/list.constant.js +13 -0
- package/dist/esm/src/constant/dto/list.constant.js.map +1 -0
- package/dist/esm/src/constant/dto/transformer-value.constant.js +15 -0
- package/dist/esm/src/constant/dto/transformer-value.constant.js.map +1 -0
- package/dist/esm/src/constant/factory/dto/get-list-query.constant.js +13 -0
- package/dist/esm/src/constant/factory/dto/get-list-query.constant.js.map +1 -0
- package/dist/esm/src/constant/interface/api/filter.constant.js +7 -0
- package/dist/esm/src/constant/interface/api/filter.constant.js.map +1 -0
- package/dist/esm/src/constant/interface/api/property/string.constant.js +11 -0
- package/dist/esm/src/constant/interface/api/property/string.constant.js.map +1 -0
- package/dist/esm/src/constant/interface/api/property/wallet.constant.js +11 -0
- package/dist/esm/src/constant/interface/api/property/wallet.constant.js.map +1 -0
- package/dist/esm/src/constant/number.constant.js +37 -0
- package/dist/esm/src/constant/number.constant.js.map +1 -0
- package/dist/esm/src/constant/utility/dto/constant.js +53 -0
- package/dist/esm/src/constant/utility/dto/constant.js.map +1 -0
- package/dist/esm/src/constant/utility/dto/generate.constant.js +9 -0
- package/dist/esm/src/constant/utility/dto/generate.constant.js.map +1 -0
- package/dist/esm/src/decorator/api/controller.decorator.js +16 -0
- package/dist/esm/src/decorator/api/controller.decorator.js.map +1 -0
- package/dist/esm/src/decorator/api/function/create.decorator.js +51 -0
- package/dist/esm/src/decorator/api/function/create.decorator.js.map +1 -0
- package/dist/esm/src/decorator/api/function/decorator.js +69 -0
- package/dist/esm/src/decorator/api/function/decorator.js.map +1 -0
- package/dist/esm/src/decorator/api/function/delete.decorator.js +69 -0
- package/dist/esm/src/decorator/api/function/delete.decorator.js.map +1 -0
- package/dist/esm/src/decorator/api/function/get-list.decorator.js +58 -0
- package/dist/esm/src/decorator/api/function/get-list.decorator.js.map +1 -0
- package/dist/esm/src/decorator/api/function/get-many.decorator.js +55 -0
- package/dist/esm/src/decorator/api/function/get-many.decorator.js.map +1 -0
- package/dist/esm/src/decorator/api/function/get.decorator.js +55 -0
- package/dist/esm/src/decorator/api/function/get.decorator.js.map +1 -0
- package/dist/esm/src/decorator/api/function/update.decorator.js +80 -0
- package/dist/esm/src/decorator/api/function/update.decorator.js.map +1 -0
- package/dist/esm/src/decorator/api/method.decorator.js +349 -0
- package/dist/esm/src/decorator/api/method.decorator.js.map +1 -0
- package/dist/esm/src/decorator/api/property/boolean.decorator.js +177 -0
- package/dist/esm/src/decorator/api/property/boolean.decorator.js.map +1 -0
- package/dist/esm/src/decorator/api/property/date.decorator.js +204 -0
- package/dist/esm/src/decorator/api/property/date.decorator.js.map +1 -0
- package/dist/esm/src/decorator/api/property/describe.decorator.js +29 -0
- package/dist/esm/src/decorator/api/property/describe.decorator.js.map +1 -0
- package/dist/esm/src/decorator/api/property/enum.decorator.js +103 -0
- package/dist/esm/src/decorator/api/property/enum.decorator.js.map +1 -0
- package/dist/esm/src/decorator/api/property/number.decorator.js +213 -0
- package/dist/esm/src/decorator/api/property/number.decorator.js.map +1 -0
- package/dist/esm/src/decorator/api/property/object.decorator.js +102 -0
- package/dist/esm/src/decorator/api/property/object.decorator.js.map +1 -0
- package/dist/esm/src/decorator/api/property/string.decorator.js +232 -0
- package/dist/esm/src/decorator/api/property/string.decorator.js.map +1 -0
- package/dist/esm/src/decorator/api/property/uuid.decorator.js +118 -0
- package/dist/esm/src/decorator/api/property/uuid.decorator.js.map +1 -0
- package/dist/esm/src/decorator/api/service.decorator.js +161 -0
- package/dist/esm/src/decorator/api/service.decorator.js.map +1 -0
- package/dist/esm/src/enum/decorator/api/action.enum.js +34 -0
- package/dist/esm/src/enum/decorator/api/action.enum.js.map +1 -0
- package/dist/esm/src/enum/decorator/api/authentication-type.enum.js +10 -0
- package/dist/esm/src/enum/decorator/api/authentication-type.enum.js.map +1 -0
- package/dist/esm/src/enum/decorator/api/controller/load-relations-strategy.enum.js +8 -0
- package/dist/esm/src/enum/decorator/api/controller/load-relations-strategy.enum.js.map +1 -0
- package/dist/esm/src/enum/decorator/api/controller/request-transformer-type.enum.js +8 -0
- package/dist/esm/src/enum/decorator/api/controller/request-transformer-type.enum.js.map +1 -0
- package/dist/esm/src/enum/decorator/api/dto-type.enum.js +10 -0
- package/dist/esm/src/enum/decorator/api/dto-type.enum.js.map +1 -0
- package/dist/esm/src/enum/decorator/api/function/type.enum.js +12 -0
- package/dist/esm/src/enum/decorator/api/function/type.enum.js.map +1 -0
- package/dist/esm/src/enum/decorator/api/property/data-type.enum.js +22 -0
- package/dist/esm/src/enum/decorator/api/property/data-type.enum.js.map +1 -0
- package/dist/esm/src/enum/decorator/api/property/date/identifier.enum.js +18 -0
- package/dist/esm/src/enum/decorator/api/property/date/identifier.enum.js.map +1 -0
- package/dist/esm/src/enum/decorator/api/property/date/type.enum.js +11 -0
- package/dist/esm/src/enum/decorator/api/property/date/type.enum.js.map +1 -0
- package/dist/esm/src/enum/decorator/api/property/desribe-type.enum.js +14 -0
- package/dist/esm/src/enum/decorator/api/property/desribe-type.enum.js.map +1 -0
- package/dist/esm/src/enum/decorator/api/property/number-type.enum.js +10 -0
- package/dist/esm/src/enum/decorator/api/property/number-type.enum.js.map +1 -0
- package/dist/esm/src/enum/decorator/api/property/string-type.enum.js +17 -0
- package/dist/esm/src/enum/decorator/api/property/string-type.enum.js.map +1 -0
- package/dist/esm/src/enum/decorator/api/route-type.enum.js +12 -0
- package/dist/esm/src/enum/decorator/api/route-type.enum.js.map +1 -0
- package/dist/esm/src/enum/exception.enum.js +34 -0
- package/dist/esm/src/enum/exception.enum.js.map +1 -0
- package/dist/esm/src/enum/filter-operation.enum.js +123 -0
- package/dist/esm/src/enum/filter-operation.enum.js.map +1 -0
- package/dist/esm/src/enum/filter-order-direction.enum.js +8 -0
- package/dist/esm/src/enum/filter-order-direction.enum.js.map +1 -0
- package/dist/esm/src/enum/utility/error-string-action.enum.js +106 -0
- package/dist/esm/src/enum/utility/error-string-action.enum.js.map +1 -0
- package/dist/esm/src/factory/api/controller.factory.js +216 -0
- package/dist/esm/src/factory/api/controller.factory.js.map +1 -0
- package/dist/esm/src/index.js +82 -0
- package/dist/esm/src/index.js.map +1 -0
- package/dist/esm/src/interceptor/correlation-id-response-body.interceptor.js +76 -0
- package/dist/esm/src/interceptor/correlation-id-response-body.interceptor.js.map +1 -0
- package/dist/esm/src/utility/api/controller/apply-decorators.utility.js +81 -0
- package/dist/esm/src/utility/api/controller/apply-decorators.utility.js.map +1 -0
- package/dist/esm/src/utility/api/controller/apply-metadata.utility.js +76 -0
- package/dist/esm/src/utility/api/controller/apply-metadata.utility.js.map +1 -0
- package/dist/esm/src/utility/api/controller/get-list/transform-filter.utility.js +48 -0
- package/dist/esm/src/utility/api/controller/get-list/transform-filter.utility.js.map +1 -0
- package/dist/esm/src/utility/api/controller/get-list/transform-operation.utility.js +80 -0
- package/dist/esm/src/utility/api/controller/get-list/transform-operation.utility.js.map +1 -0
- package/dist/esm/src/utility/api/controller/get-method-name.utility.js +9 -0
- package/dist/esm/src/utility/api/controller/get-method-name.utility.js.map +1 -0
- package/dist/esm/src/utility/api/controller/get-primary-column.utility.js +13 -0
- package/dist/esm/src/utility/api/controller/get-primary-column.utility.js.map +1 -0
- package/dist/esm/src/utility/api/controller/handle-request-relations.utility.js +70 -0
- package/dist/esm/src/utility/api/controller/handle-request-relations.utility.js.map +1 -0
- package/dist/esm/src/utility/api/controller/transform-data.utility.js +147 -0
- package/dist/esm/src/utility/api/controller/transform-data.utility.js.map +1 -0
- package/dist/esm/src/utility/api/controller/validate-request.utility.js +16 -0
- package/dist/esm/src/utility/api/controller/validate-request.utility.js.map +1 -0
- package/dist/esm/src/utility/api/controller/write-dto-swagger.utility.js +77 -0
- package/dist/esm/src/utility/api/controller/write-dto-swagger.utility.js.map +1 -0
- package/dist/esm/src/utility/api/controller/write-method.utility.js +18 -0
- package/dist/esm/src/utility/api/controller/write-method.utility.js.map +1 -0
- package/dist/esm/src/utility/api/filter-order-by-from-entity.utility.js +46 -0
- package/dist/esm/src/utility/api/filter-order-by-from-entity.utility.js.map +1 -0
- package/dist/esm/src/utility/camel-case-string.utility.js +29 -0
- package/dist/esm/src/utility/camel-case-string.utility.js.map +1 -0
- package/dist/esm/src/utility/capitalize-string.utility.js +6 -0
- package/dist/esm/src/utility/capitalize-string.utility.js.map +1 -0
- package/dist/esm/src/utility/dto/analize.utility.js +25 -0
- package/dist/esm/src/utility/dto/analize.utility.js.map +1 -0
- package/dist/esm/src/utility/dto/build-decorator.utility.js +49 -0
- package/dist/esm/src/utility/dto/build-decorator.utility.js.map +1 -0
- package/dist/esm/src/utility/dto/generate-decorator.utility.js +13 -0
- package/dist/esm/src/utility/dto/generate-decorator.utility.js.map +1 -0
- package/dist/esm/src/utility/dto/generate-exception.utility.js +96 -0
- package/dist/esm/src/utility/dto/generate-exception.utility.js.map +1 -0
- package/dist/esm/src/utility/dto/generate-filter-decorator.utility.js +50 -0
- package/dist/esm/src/utility/dto/generate-filter-decorator.utility.js.map +1 -0
- package/dist/esm/src/utility/dto/generate-get-list-response.utility.js +102 -0
- package/dist/esm/src/utility/dto/generate-get-list-response.utility.js.map +1 -0
- package/dist/esm/src/utility/dto/generate-relation-response.utility.js +19 -0
- package/dist/esm/src/utility/dto/generate-relation-response.utility.js.map +1 -0
- package/dist/esm/src/utility/dto/generate.utility.js +131 -0
- package/dist/esm/src/utility/dto/generate.utility.js.map +1 -0
- package/dist/esm/src/utility/dto/get-decorator-config.utility.js +18 -0
- package/dist/esm/src/utility/dto/get-decorator-config.utility.js.map +1 -0
- package/dist/esm/src/utility/dto/get-get-list-query-base-class.utility.js +95 -0
- package/dist/esm/src/utility/dto/get-get-list-query-base-class.utility.js.map +1 -0
- package/dist/esm/src/utility/dto/handle-date-property.utility.js +33 -0
- package/dist/esm/src/utility/dto/handle-date-property.utility.js.map +1 -0
- package/dist/esm/src/utility/dto/is-property-exposed-for-guard.utility.js +13 -0
- package/dist/esm/src/utility/dto/is-property-exposed-for-guard.utility.js.map +1 -0
- package/dist/esm/src/utility/dto/is-property-should-be-marked.utility.js +44 -0
- package/dist/esm/src/utility/dto/is-property-should-be-marked.utility.js.map +1 -0
- package/dist/esm/src/utility/dto/is-should-be-generated.utility.js +39 -0
- package/dist/esm/src/utility/dto/is-should-be-generated.utility.js.map +1 -0
- package/dist/esm/src/utility/dto/validate-property-config.utility.js +4 -0
- package/dist/esm/src/utility/dto/validate-property-config.utility.js.map +1 -0
- package/dist/esm/src/utility/error-exception.utility.js +6 -0
- package/dist/esm/src/utility/error-exception.utility.js.map +1 -0
- package/dist/esm/src/utility/error-string.utility.js +6 -0
- package/dist/esm/src/utility/error-string.utility.js.map +1 -0
- package/dist/esm/src/utility/generate-entity-information.utility.js +76 -0
- package/dist/esm/src/utility/generate-entity-information.utility.js.map +1 -0
- package/dist/esm/src/utility/get-entity-columns.utility.js +20 -0
- package/dist/esm/src/utility/get-entity-columns.utility.js.map +1 -0
- package/dist/esm/src/utility/is-error-of-type.utility.js +66 -0
- package/dist/esm/src/utility/is-error-of-type.utility.js.map +1 -0
- package/dist/esm/src/validator/all-or-none-of-listed-properties.validator.js +23 -0
- package/dist/esm/src/validator/all-or-none-of-listed-properties.validator.js.map +1 -0
- package/dist/esm/src/validator/has-at-least-one-and-only-one-of-listed-properties.validator.js +33 -0
- package/dist/esm/src/validator/has-at-least-one-and-only-one-of-listed-properties.validator.js.map +1 -0
- package/dist/esm/src/validator/has-at-least-one-of-listed-properties.validator.js +29 -0
- package/dist/esm/src/validator/has-at-least-one-of-listed-properties.validator.js.map +1 -0
- package/dist/esm/src/validator/has-at-least-one-property.validator.js +17 -0
- package/dist/esm/src/validator/has-at-least-one-property.validator.js.map +1 -0
- package/dist/esm/src/validator/has-paired-custom-suffixes-fields.validator.js +214 -0
- package/dist/esm/src/validator/has-paired-custom-suffixes-fields.validator.js.map +1 -0
- package/dist/esm/src/validator/is-regular-expression.validator.js +25 -0
- package/dist/esm/src/validator/is-regular-expression.validator.js.map +1 -0
- package/dist/esm/src/validator/only-one-of-listed-properties.validator.js +28 -0
- package/dist/esm/src/validator/only-one-of-listed-properties.validator.js.map +1 -0
- package/dist/esm/type/api-request-transformer.type.d.ts +15 -0
- package/dist/esm/type/class/api-exception.type.d.ts +2 -0
- package/dist/esm/type/class/controller/index.d.ts +1 -0
- package/dist/esm/type/class/controller/method.type.d.ts +5 -0
- package/dist/esm/type/class/index.d.ts +3 -0
- package/dist/esm/type/class/metadata.type.d.ts +2 -0
- package/dist/esm/type/decorator/api/controller/constructor.type.d.ts +4 -0
- package/dist/esm/type/decorator/api/controller/get-list-query.type.d.ts +8 -0
- package/dist/esm/type/decorator/api/controller/index.d.ts +5 -0
- package/dist/esm/type/decorator/api/controller/properties/index.d.ts +1 -0
- package/dist/esm/type/decorator/api/controller/properties/route/base-request-relations.type.d.ts +18 -0
- package/dist/esm/type/decorator/api/controller/properties/route/base-request-transformers.type.d.ts +10 -0
- package/dist/esm/type/decorator/api/controller/properties/route/base-response-transformers.type.d.ts +10 -0
- package/dist/esm/type/decorator/api/controller/properties/route/index.d.ts +3 -0
- package/dist/esm/type/decorator/api/controller/properties-route.type.d.ts +3 -0
- package/dist/esm/type/decorator/api/controller/transformer-config.type.d.ts +8 -0
- package/dist/esm/type/decorator/api/filter/allowed-types.type.d.ts +1 -0
- package/dist/esm/type/decorator/api/filter/extracted-allowed-types.type.d.ts +2 -0
- package/dist/esm/type/decorator/api/filter/field-selector.type.d.ts +3 -0
- package/dist/esm/type/decorator/api/filter/index.d.ts +4 -0
- package/dist/esm/type/decorator/api/filter/order-by.type.d.ts +4 -0
- package/dist/esm/type/decorator/api/function/create-properties.type.d.ts +2 -0
- package/dist/esm/type/decorator/api/function/delete-criteria.type.d.ts +2 -0
- package/dist/esm/type/decorator/api/function/get-list-properties-where.type.d.ts +7 -0
- package/dist/esm/type/decorator/api/function/get-list-properties.type.d.ts +2 -0
- package/dist/esm/type/decorator/api/function/get-many.properties.d.ts +2 -0
- package/dist/esm/type/decorator/api/function/get-properties.type.d.ts +2 -0
- package/dist/esm/type/decorator/api/function/index.d.ts +9 -0
- package/dist/esm/type/decorator/api/function/properties.type.d.ts +7 -0
- package/dist/esm/type/decorator/api/function/update-criteria.type.d.ts +2 -0
- package/dist/esm/type/decorator/api/function/update-properties.type.d.ts +2 -0
- package/dist/esm/type/decorator/api/index.d.ts +5 -0
- package/dist/esm/type/decorator/api/property/base/array/index.d.ts +2 -0
- package/dist/esm/type/decorator/api/property/base/array/optional-properties.type.d.ts +3 -0
- package/dist/esm/type/decorator/api/property/base/array/required-properties.type.d.ts +6 -0
- package/dist/esm/type/decorator/api/property/base/index.d.ts +4 -0
- package/dist/esm/type/decorator/api/property/base/properties.type.d.ts +9 -0
- package/dist/esm/type/decorator/api/property/base/request-properties.type.d.ts +4 -0
- package/dist/esm/type/decorator/api/property/base/response-properties.type.d.ts +4 -0
- package/dist/esm/type/decorator/api/property/date-properties.type.d.ts +6 -0
- package/dist/esm/type/decorator/api/property/describe/array/index.d.ts +2 -0
- package/dist/esm/type/decorator/api/property/describe/array/optional-properties.type.d.ts +3 -0
- package/dist/esm/type/decorator/api/property/describe/array/required-properties.type.d.ts +6 -0
- package/dist/esm/type/decorator/api/property/describe/base-properties.type.d.ts +5 -0
- package/dist/esm/type/decorator/api/property/describe/boolean-properties.type.d.ts +7 -0
- package/dist/esm/type/decorator/api/property/describe/date-properties.type.d.ts +8 -0
- package/dist/esm/type/decorator/api/property/describe/dto/body-properties.type.d.ts +5 -0
- package/dist/esm/type/decorator/api/property/describe/dto/guard-properties.type.d.ts +6 -0
- package/dist/esm/type/decorator/api/property/describe/dto/index.d.ts +5 -0
- package/dist/esm/type/decorator/api/property/describe/dto/properties.type.d.ts +11 -0
- package/dist/esm/type/decorator/api/property/describe/dto/query/get-list-properties.type.d.ts +3 -0
- package/dist/esm/type/decorator/api/property/describe/dto/query/index.d.ts +2 -0
- package/dist/esm/type/decorator/api/property/describe/dto/query/properties.type.d.ts +6 -0
- package/dist/esm/type/decorator/api/property/describe/dto/request-properties.type.d.ts +5 -0
- package/dist/esm/type/decorator/api/property/describe/dto/response-properties.type.d.ts +5 -0
- package/dist/esm/type/decorator/api/property/describe/enum-properties.type.d.ts +9 -0
- package/dist/esm/type/decorator/api/property/describe/example-properties.type.d.ts +7 -0
- package/dist/esm/type/decorator/api/property/describe/index.d.ts +13 -0
- package/dist/esm/type/decorator/api/property/describe/number-properties.type.d.ts +12 -0
- package/dist/esm/type/decorator/api/property/describe/object-properties.type.d.ts +12 -0
- package/dist/esm/type/decorator/api/property/describe/properties/base-dto-properties.type.d.ts +2 -0
- package/dist/esm/type/decorator/api/property/describe/properties/base-properties.type.d.ts +10 -0
- package/dist/esm/type/decorator/api/property/describe/properties/index.d.ts +2 -0
- package/dist/esm/type/decorator/api/property/describe/properties.type.d.ts +9 -0
- package/dist/esm/type/decorator/api/property/describe/relation-properties.type.d.ts +6 -0
- package/dist/esm/type/decorator/api/property/describe/string-properties.type.d.ts +12 -0
- package/dist/esm/type/decorator/api/property/describe/uuid-properties.type.d.ts +7 -0
- package/dist/esm/type/decorator/api/property/enum-properties.type.d.ts +6 -0
- package/dist/esm/type/decorator/api/property/index.d.ts +6 -0
- package/dist/esm/type/decorator/api/property/number-properties.type.d.ts +9 -0
- package/dist/esm/type/decorator/api/property/object-properties.type.d.ts +8 -0
- package/dist/esm/type/decorator/api/property/string-properties.type.d.ts +9 -0
- package/dist/esm/type/decorator/api/property/uuid-properties.type.d.ts +2 -0
- package/dist/esm/type/decorator/api/service/index.d.ts +2 -0
- package/dist/esm/type/decorator/api/service/keys.type.d.ts +4 -0
- package/dist/esm/type/decorator/api/service/properties.type.d.ts +3 -0
- package/dist/esm/type/decorator/index.d.ts +1 -0
- package/dist/esm/type/factory/api/controller/index.d.ts +4 -0
- package/dist/esm/type/factory/api/controller/method-map.type.d.ts +12 -0
- package/dist/esm/type/factory/api/controller/method-name-map.type.d.ts +5 -0
- package/dist/esm/type/factory/api/controller/method-name.type.d.ts +4 -0
- package/dist/esm/type/factory/api/controller/target-methods.type.d.ts +9 -0
- package/dist/esm/type/factory/api/index.d.ts +1 -0
- package/dist/esm/type/factory/index.d.ts +1 -0
- package/dist/esm/type/index.d.ts +5 -0
- package/dist/esm/type/utility/api/controller/index.d.ts +1 -0
- package/dist/esm/type/utility/api/controller/transform-data/data.type.d.ts +6 -0
- package/dist/esm/type/utility/api/controller/transform-data/index.d.ts +3 -0
- package/dist/esm/type/utility/api/controller/transform-data/is-validation-properties.type.d.ts +3 -0
- package/dist/esm/type/utility/api/controller/transform-data/object-to-transform.type.d.ts +9 -0
- package/dist/esm/type/utility/api/index.d.ts +1 -0
- package/dist/esm/type/utility/capitalize-string.type.d.ts +1 -0
- package/dist/esm/type/utility/date-keys.type.d.ts +2 -0
- package/dist/esm/type/utility/date-range-keys.type.d.ts +4 -0
- package/dist/esm/type/utility/dto/generate-allowed-combination.type.d.ts +9 -0
- package/dist/esm/type/utility/dto/generate-is-allowed-combination.type.d.ts +3 -0
- package/dist/esm/type/utility/dto/index.d.ts +2 -0
- package/dist/esm/type/utility/filter-keys.type.d.ts +7 -0
- package/dist/esm/type/utility/index.d.ts +7 -0
- package/dist/esm/type/utility/non-date-keys.type.d.ts +2 -0
- package/dist/esm/utility/api/controller/apply-decorators.utility.d.ts +4 -0
- package/dist/esm/utility/api/controller/apply-metadata.utility.d.ts +4 -0
- package/dist/esm/utility/api/controller/get-list/index.d.ts +2 -0
- package/dist/esm/utility/api/controller/get-list/transform-filter.utility.d.ts +3 -0
- package/dist/esm/utility/api/controller/get-list/transform-operation.utility.d.ts +3 -0
- package/dist/esm/utility/api/controller/get-method-name.utility.d.ts +2 -0
- package/dist/esm/utility/api/controller/get-primary-column.utility.d.ts +3 -0
- package/dist/esm/utility/api/controller/handle-request-relations.utility.d.ts +4 -0
- package/dist/esm/utility/api/controller/index.d.ts +9 -0
- package/dist/esm/utility/api/controller/transform-data.utility.d.ts +4 -0
- package/dist/esm/utility/api/controller/validate-request.utility.d.ts +3 -0
- package/dist/esm/utility/api/controller/write-dto-swagger.utility.d.ts +4 -0
- package/dist/esm/utility/api/controller/write-method.utility.d.ts +3 -0
- package/dist/esm/utility/api/filter-order-by-from-entity.utility.d.ts +6 -0
- package/dist/esm/utility/api/index.d.ts +2 -0
- package/dist/esm/utility/camel-case-string.utility.d.ts +1 -0
- package/dist/esm/utility/capitalize-string.utility.d.ts +1 -0
- package/dist/esm/utility/dto/analize.utility.d.ts +2 -0
- package/dist/esm/utility/dto/build-decorator.utility.d.ts +6 -0
- package/dist/esm/utility/dto/generate-decorator.utility.d.ts +4 -0
- package/dist/esm/utility/dto/generate-exception.utility.d.ts +2 -0
- package/dist/esm/utility/dto/generate-filter-decorator.utility.d.ts +3 -0
- package/dist/esm/utility/dto/generate-get-list-response.utility.d.ts +4 -0
- package/dist/esm/utility/dto/generate-relation-response.utility.d.ts +4 -0
- package/dist/esm/utility/dto/generate.utility.d.ts +6 -0
- package/dist/esm/utility/dto/get-decorator-config.utility.d.ts +3 -0
- package/dist/esm/utility/dto/get-get-list-query-base-class.utility.d.ts +5 -0
- package/dist/esm/utility/dto/handle-date-property.utility.d.ts +5 -0
- package/dist/esm/utility/dto/index.d.ts +12 -0
- package/dist/esm/utility/dto/is-property-exposed-for-guard.utility.d.ts +5 -0
- package/dist/esm/utility/dto/is-property-should-be-marked.utility.d.ts +5 -0
- package/dist/esm/utility/dto/is-should-be-generated.utility.d.ts +2 -0
- package/dist/esm/utility/dto/validate-property-config.utility.d.ts +2 -0
- package/dist/esm/utility/error-exception.utility.d.ts +1 -0
- package/dist/esm/utility/error-string.utility.d.ts +2 -0
- package/dist/esm/utility/generate-entity-information.utility.d.ts +2 -0
- package/dist/esm/utility/get-entity-columns.utility.d.ts +2 -0
- package/dist/esm/utility/index.d.ts +9 -0
- package/dist/esm/utility/is-error-of-type.utility.d.ts +2 -0
- package/dist/esm/validator/all-or-none-of-listed-properties.validator.d.ts +5 -0
- package/dist/esm/validator/has-at-least-one-and-only-one-of-listed-properties.validator.d.ts +5 -0
- package/dist/esm/validator/has-at-least-one-of-listed-properties.validator.d.ts +5 -0
- package/dist/esm/validator/has-at-least-one-property.validator.d.ts +5 -0
- package/dist/esm/validator/has-paired-custom-suffixes-fields.validator.d.ts +7 -0
- package/dist/esm/validator/index.d.ts +6 -0
- package/dist/esm/validator/is-regular-expression.validator.d.ts +4 -0
- package/dist/esm/validator/only-one-of-listed-properties.validator.d.ts +5 -0
- package/package.json +22 -14
- package/dist/package.json +0 -97
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { Controller } from '@nestjs/common';
|
|
2
|
+
import { ApiTags } from '@nestjs/swagger';
|
|
3
|
+
import { plainToInstance } from 'class-transformer';
|
|
4
|
+
import { CONTROLLER_API_DECORATOR_CONSTANT } from '../../constant/decorator/api/controller.constant.js';
|
|
5
|
+
import { FUNCTION_API_DECORATOR_CONSTANT } from '../../constant/decorator/api/function.constant.js';
|
|
6
|
+
import '../../enum/decorator/api/action.enum.js';
|
|
7
|
+
import '../../enum/decorator/api/authentication-type.enum.js';
|
|
8
|
+
import '../../enum/decorator/api/controller/load-relations-strategy.enum.js';
|
|
9
|
+
import '../../enum/decorator/api/controller/request-transformer-type.enum.js';
|
|
10
|
+
import { EApiDtoType } from '../../enum/decorator/api/dto-type.enum.js';
|
|
11
|
+
import '../../enum/decorator/api/function/type.enum.js';
|
|
12
|
+
import '../../enum/decorator/api/property/data-type.enum.js';
|
|
13
|
+
import '../../enum/decorator/api/property/date/identifier.enum.js';
|
|
14
|
+
import '../../enum/decorator/api/property/date/type.enum.js';
|
|
15
|
+
import '../../enum/decorator/api/property/desribe-type.enum.js';
|
|
16
|
+
import '../../enum/decorator/api/property/number-type.enum.js';
|
|
17
|
+
import '../../enum/decorator/api/property/string-type.enum.js';
|
|
18
|
+
import { EApiRouteType } from '../../enum/decorator/api/route-type.enum.js';
|
|
19
|
+
import '../../enum/exception.enum.js';
|
|
20
|
+
import '../../enum/filter-order-direction.enum.js';
|
|
21
|
+
import '../../enum/utility/error-string-action.enum.js';
|
|
22
|
+
import { ApiControllerApplyDecorators } from '../../utility/api/controller/apply-decorators.utility.js';
|
|
23
|
+
import { ApiControllerApplyMetadata } from '../../utility/api/controller/apply-metadata.utility.js';
|
|
24
|
+
import { ApiControllerGetListTransformFilter } from '../../utility/api/controller/get-list/transform-filter.utility.js';
|
|
25
|
+
import { ApiControllerHandleRequestRelations } from '../../utility/api/controller/handle-request-relations.utility.js';
|
|
26
|
+
import { ApiControllerTransformData } from '../../utility/api/controller/transform-data.utility.js';
|
|
27
|
+
import { ApiControllerValidateRequest } from '../../utility/api/controller/validate-request.utility.js';
|
|
28
|
+
import { ApiControllerWriteDtoSwagger } from '../../utility/api/controller/write-dto-swagger.utility.js';
|
|
29
|
+
import { ApiControllerWriteMethod } from '../../utility/api/controller/write-method.utility.js';
|
|
30
|
+
import 'typeorm';
|
|
31
|
+
import 'reflect-metadata';
|
|
32
|
+
import '../../constant/utility/dto/constant.js';
|
|
33
|
+
import { ErrorException } from '../../utility/error-exception.utility.js';
|
|
34
|
+
import '../../../external/tslib/tslib.es6.js';
|
|
35
|
+
import 'class-validator';
|
|
36
|
+
import 'lodash/random';
|
|
37
|
+
import '../../validator/all-or-none-of-listed-properties.validator.js';
|
|
38
|
+
import '../../validator/has-at-least-one-and-only-one-of-listed-properties.validator.js';
|
|
39
|
+
import '../../validator/has-at-least-one-of-listed-properties.validator.js';
|
|
40
|
+
import '../../validator/has-at-least-one-property.validator.js';
|
|
41
|
+
import '../../validator/is-regular-expression.validator.js';
|
|
42
|
+
import '../../validator/only-one-of-listed-properties.validator.js';
|
|
43
|
+
import 'node:crypto';
|
|
44
|
+
import { DtoGenerate } from '../../utility/dto/generate.utility.js';
|
|
45
|
+
import { GenerateEntityInformation } from '../../utility/generate-entity-information.utility.js';
|
|
46
|
+
import '../../utility/is-error-of-type.utility.js';
|
|
47
|
+
import { ApiControllerGetPrimaryColumn } from '../../utility/api/controller/get-primary-column.utility.js';
|
|
48
|
+
import { analyzeEntityMetadata } from '../../utility/dto/analize.utility.js';
|
|
49
|
+
|
|
50
|
+
class ApiControllerFactory {
|
|
51
|
+
target;
|
|
52
|
+
properties;
|
|
53
|
+
get targetPrototype() {
|
|
54
|
+
return this.target.prototype;
|
|
55
|
+
}
|
|
56
|
+
ENTITY;
|
|
57
|
+
constructor(target, properties) {
|
|
58
|
+
this.target = target;
|
|
59
|
+
this.properties = properties;
|
|
60
|
+
this.ENTITY = GenerateEntityInformation(properties.entity);
|
|
61
|
+
analyzeEntityMetadata(this.properties.entity);
|
|
62
|
+
if (!this.ENTITY.primaryKey) {
|
|
63
|
+
throw ErrorException(`Primary key for entity ${this.properties.entity.name ?? "UnknownResource"} not found`);
|
|
64
|
+
}
|
|
65
|
+
Controller(this.properties.path ?? (this.properties.entity.name ? this.properties.entity.name.toLowerCase() : "UnknownResource"))(this.target);
|
|
66
|
+
ApiTags(this.properties.name ?? this.properties.entity.name ?? "UnknownResource")(this.target);
|
|
67
|
+
}
|
|
68
|
+
createMethod(method) {
|
|
69
|
+
if (!(method in this.properties.routes) || this.properties.routes[method]?.isEnabled !== false) {
|
|
70
|
+
const routeConfig = this.properties.routes[method] ?? {};
|
|
71
|
+
const routeDecorators = routeConfig.decorators ?? [];
|
|
72
|
+
const methodName = `${CONTROLLER_API_DECORATOR_CONSTANT.RESERVED_METHOD_PREFIX}${method}`;
|
|
73
|
+
ApiControllerWriteMethod(this, this.targetPrototype, method, this.properties, this.ENTITY);
|
|
74
|
+
const targetMethod = this.targetPrototype[methodName];
|
|
75
|
+
ApiControllerApplyMetadata(this.target, this.targetPrototype, this.ENTITY, this.properties, method, methodName, routeConfig);
|
|
76
|
+
ApiControllerApplyDecorators(targetMethod, this.ENTITY, this.properties, method, methodName, routeConfig, routeDecorators);
|
|
77
|
+
ApiControllerWriteDtoSwagger(this.target, this.ENTITY, this.properties, method, routeConfig, this.ENTITY);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
init() {
|
|
81
|
+
for (const method of Object.values(EApiRouteType)) {
|
|
82
|
+
this.createMethod(method);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
[EApiRouteType.CREATE](method, methodName, properties, entityMetadata) {
|
|
86
|
+
this.targetPrototype[methodName] = Object.defineProperty(async function (body, headers, ip, authenticationRequest) {
|
|
87
|
+
const primaryKey = ApiControllerGetPrimaryColumn(body, entityMetadata);
|
|
88
|
+
if (!primaryKey) {
|
|
89
|
+
throw ErrorException("Primary key not found in entity columns");
|
|
90
|
+
}
|
|
91
|
+
ApiControllerTransformData(properties.routes[method]?.request?.transformers, properties, { body }, { authenticationRequest, headers, ip });
|
|
92
|
+
await ApiControllerValidateRequest(properties.routes[method]?.request?.validators, properties, body);
|
|
93
|
+
await ApiControllerHandleRequestRelations(this, properties, properties.routes[method]?.request?.relations, body);
|
|
94
|
+
const createResponse = await this.service.create(body);
|
|
95
|
+
const dto = DtoGenerate(properties.entity, entityMetadata, method, EApiDtoType.RESPONSE, properties.routes[method]?.autoDto?.[EApiDtoType.RESPONSE], properties.routes[method]?.authentication?.guard);
|
|
96
|
+
const requestProperties = {
|
|
97
|
+
relations: properties.routes[method]?.response?.relations,
|
|
98
|
+
where: {
|
|
99
|
+
[primaryKey.key]: createResponse[primaryKey.key],
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
const response = await this.service.get(requestProperties);
|
|
103
|
+
ApiControllerTransformData(properties.routes[method]?.response?.transformers, properties, { response }, { authenticationRequest, headers, ip });
|
|
104
|
+
return plainToInstance(dto, response, {
|
|
105
|
+
excludeExtraneousValues: true,
|
|
106
|
+
});
|
|
107
|
+
}, "name", { value: methodName });
|
|
108
|
+
}
|
|
109
|
+
[EApiRouteType.DELETE](method, methodName, properties, entityMetadata) {
|
|
110
|
+
this.targetPrototype[methodName] = Object.defineProperty(async function (parameters, headers, ip, authenticationRequest) {
|
|
111
|
+
const primaryKey = ApiControllerGetPrimaryColumn(parameters, entityMetadata);
|
|
112
|
+
if (!primaryKey) {
|
|
113
|
+
throw ErrorException("Primary key not found in entity columns");
|
|
114
|
+
}
|
|
115
|
+
ApiControllerTransformData(properties.routes[method]?.request?.transformers, properties, { parameters }, { authenticationRequest, headers, ip });
|
|
116
|
+
await ApiControllerValidateRequest(properties.routes[method]?.request?.validators, properties, parameters);
|
|
117
|
+
await ApiControllerHandleRequestRelations(this, properties, properties.routes[method]?.request?.relations, parameters);
|
|
118
|
+
const requestCriteria = {
|
|
119
|
+
[primaryKey.key]: primaryKey.value,
|
|
120
|
+
};
|
|
121
|
+
await this.service.delete(requestCriteria);
|
|
122
|
+
}, "name", { value: methodName });
|
|
123
|
+
}
|
|
124
|
+
[EApiRouteType.GET](method, methodName, properties, entityMetadata) {
|
|
125
|
+
this.targetPrototype[methodName] = Object.defineProperty(async function (parameters, headers, ip, authenticationRequest) {
|
|
126
|
+
const primaryKey = ApiControllerGetPrimaryColumn(parameters, entityMetadata);
|
|
127
|
+
if (!primaryKey) {
|
|
128
|
+
throw ErrorException("Primary key not found in entity columns");
|
|
129
|
+
}
|
|
130
|
+
ApiControllerTransformData(properties.routes[method]?.request?.transformers, properties, { parameters }, { authenticationRequest, headers, ip });
|
|
131
|
+
await ApiControllerValidateRequest(properties.routes[method]?.request?.validators, properties, parameters);
|
|
132
|
+
await ApiControllerHandleRequestRelations(this, properties, properties.routes[method]?.request?.relations, parameters);
|
|
133
|
+
const requestProperties = {
|
|
134
|
+
relations: properties.routes[method]?.response?.relations,
|
|
135
|
+
where: {
|
|
136
|
+
[primaryKey.key]: primaryKey.value,
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
const response = await this.service.get(requestProperties);
|
|
140
|
+
ApiControllerTransformData(properties.routes[method]?.response?.transformers, properties, { response }, { authenticationRequest, headers, ip });
|
|
141
|
+
const dto = DtoGenerate(properties.entity, entityMetadata, method, EApiDtoType.RESPONSE, properties.routes[method]?.autoDto?.[EApiDtoType.RESPONSE], properties.routes[method]?.authentication?.guard);
|
|
142
|
+
return plainToInstance(dto, response, {
|
|
143
|
+
excludeExtraneousValues: true,
|
|
144
|
+
});
|
|
145
|
+
}, "name", { value: methodName });
|
|
146
|
+
}
|
|
147
|
+
[EApiRouteType.GET_LIST](method, methodName, properties, entityMetadata) {
|
|
148
|
+
this.targetPrototype[methodName] = Object.defineProperty(async function (query, headers, ip, authenticationRequest) {
|
|
149
|
+
ApiControllerTransformData(properties.routes[method]?.request?.transformers, properties, { query }, { authenticationRequest, headers, ip });
|
|
150
|
+
await ApiControllerValidateRequest(properties.routes[method]?.request?.validators, properties, query);
|
|
151
|
+
await ApiControllerHandleRequestRelations(this, properties, properties.routes[method]?.request?.relations, query);
|
|
152
|
+
const { limit, orderBy, orderDirection, page, ...getListQuery } = query;
|
|
153
|
+
const filter = ApiControllerGetListTransformFilter(getListQuery, entityMetadata);
|
|
154
|
+
const requestProperties = {
|
|
155
|
+
relations: properties.routes[method]?.response?.relations,
|
|
156
|
+
skip: query.limit * (query.page - 1),
|
|
157
|
+
take: query.limit,
|
|
158
|
+
where: filter,
|
|
159
|
+
};
|
|
160
|
+
if (orderBy) {
|
|
161
|
+
requestProperties.order = {
|
|
162
|
+
[orderBy]: orderDirection ?? FUNCTION_API_DECORATOR_CONSTANT.DEFAULT_FILTER_ORDER_BY_DIRECTION,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const response = await this.service.getList(requestProperties);
|
|
166
|
+
ApiControllerTransformData(properties.routes[method]?.request?.transformers, properties, { response }, { authenticationRequest, headers, ip });
|
|
167
|
+
const dto = DtoGenerate(properties.entity, entityMetadata, method, EApiDtoType.RESPONSE, properties.routes[method]?.autoDto?.[EApiDtoType.RESPONSE], properties.routes[method]?.authentication?.guard);
|
|
168
|
+
return plainToInstance(dto, response, {
|
|
169
|
+
excludeExtraneousValues: true,
|
|
170
|
+
});
|
|
171
|
+
}, "name", { value: methodName });
|
|
172
|
+
}
|
|
173
|
+
[EApiRouteType.PARTIAL_UPDATE](method, methodName, properties, entityMetadata) {
|
|
174
|
+
this.targetPrototype[methodName] = Object.defineProperty(async function (parameters, body, headers, ip, authenticationRequest) {
|
|
175
|
+
const primaryKey = ApiControllerGetPrimaryColumn(parameters, entityMetadata);
|
|
176
|
+
if (!primaryKey) {
|
|
177
|
+
throw ErrorException("Primary key not found in entity columns");
|
|
178
|
+
}
|
|
179
|
+
ApiControllerTransformData(properties.routes[method]?.request?.transformers, properties, { body, parameters }, { authenticationRequest, headers, ip });
|
|
180
|
+
await ApiControllerValidateRequest(properties.routes[method]?.request?.validators, properties, parameters);
|
|
181
|
+
await ApiControllerHandleRequestRelations(this, properties, properties.routes[method]?.request?.relations, parameters);
|
|
182
|
+
const requestCriteria = {
|
|
183
|
+
[primaryKey.key]: primaryKey.value,
|
|
184
|
+
};
|
|
185
|
+
const response = await this.service.update(requestCriteria, body);
|
|
186
|
+
ApiControllerTransformData(properties.routes[method]?.request?.transformers, properties, { response }, { authenticationRequest, headers, ip });
|
|
187
|
+
const dto = DtoGenerate(properties.entity, entityMetadata, method, EApiDtoType.RESPONSE, properties.routes[method]?.autoDto?.[EApiDtoType.RESPONSE], properties.routes[method]?.authentication?.guard);
|
|
188
|
+
return plainToInstance(dto, response, {
|
|
189
|
+
excludeExtraneousValues: true,
|
|
190
|
+
});
|
|
191
|
+
}, "name", { value: methodName });
|
|
192
|
+
}
|
|
193
|
+
[EApiRouteType.UPDATE](method, methodName, properties, entityMetadata) {
|
|
194
|
+
this.targetPrototype[methodName] = Object.defineProperty(async function (parameters, body, headers, ip, authenticationRequest) {
|
|
195
|
+
const primaryKey = ApiControllerGetPrimaryColumn(parameters, entityMetadata);
|
|
196
|
+
if (!primaryKey) {
|
|
197
|
+
throw ErrorException("Primary key not found in entity columns");
|
|
198
|
+
}
|
|
199
|
+
ApiControllerTransformData(properties.routes[method]?.request?.transformers, properties, { body, parameters }, { authenticationRequest, headers, ip });
|
|
200
|
+
await ApiControllerValidateRequest(properties.routes[method]?.request?.validators, properties, parameters);
|
|
201
|
+
await ApiControllerHandleRequestRelations(this, properties, properties.routes[method]?.request?.relations, parameters);
|
|
202
|
+
const requestCriteria = {
|
|
203
|
+
[primaryKey.key]: primaryKey.value,
|
|
204
|
+
};
|
|
205
|
+
const response = await this.service.update(requestCriteria, body);
|
|
206
|
+
ApiControllerTransformData(properties.routes[method]?.request?.transformers, properties, { response }, { authenticationRequest, headers, ip });
|
|
207
|
+
const dto = DtoGenerate(properties.entity, entityMetadata, method, EApiDtoType.RESPONSE, properties.routes[method]?.autoDto?.[EApiDtoType.RESPONSE], properties.routes[method]?.authentication?.guard);
|
|
208
|
+
return plainToInstance(dto, response, {
|
|
209
|
+
excludeExtraneousValues: true,
|
|
210
|
+
});
|
|
211
|
+
}, "name", { value: methodName });
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export { ApiControllerFactory };
|
|
216
|
+
//# sourceMappingURL=controller.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.factory.js","sources":["../../../../../../src/factory/api/controller.factory.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAqBa,oBAAoB,CAAA;AAQrB,IAAA,MAAA;AACO,IAAA,UAAA;AARlB,IAAA,IAAc,eAAe,GAAA;AAC5B,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,SAA6C;;AAGhD,IAAA,MAAM;IAEvB,WACW,CAAA,MAAqC,EAC9B,UAAuC,EAAA;QAD9C,IAAM,CAAA,MAAA,GAAN,MAAM;QACC,IAAU,CAAA,UAAA,GAAV,UAAU;QAE3B,IAAI,CAAC,MAAM,GAAG,yBAAyB,CAAI,UAAU,CAAC,MAAM,CAAC;AAC7D,QAAA,qBAAqB,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;AAE7C,QAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;AAC5B,YAAA,MAAM,cAAc,CAAC,CAA0B,uBAAA,EAAA,IAAI,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C,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,CAAC,QAAQ,EAAE,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,cAAc,EAAE,KAAK,CAAC;AAEjO,YAAA,OAAO,eAAe,CAAC,GAA0B,EAAE,QAAQ,EAAE;AAE5D,gBAAA,uBAAuB,EAAE,IAAI;AAC7B,aAAA,CAAC;SACF,EACD,MAAM,EACN,EAAE,KAAK,EAAE,UAAU,EAAE,CACrB;;AAEF;;;;"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export { ApiServiceBase } from './class/api/service-base.class.js';
|
|
2
|
+
export { MetadataStorage } from './class/metadata-storage.class.js';
|
|
3
|
+
export { DtoStrategyBody } from './class/utility/dto/strategy/body.class.js';
|
|
4
|
+
export { DtoStrategyQuery } from './class/utility/dto/strategy/query.class.js';
|
|
5
|
+
export { DtoStrategyRequest } from './class/utility/dto/strategy/request.class.js';
|
|
6
|
+
export { DtoStrategyResponse } from './class/utility/dto/strategy/response.class.js';
|
|
7
|
+
export { DATE_CONSTANT } from './constant/date.constant.js';
|
|
8
|
+
export { CONTROLLER_API_DECORATOR_CONSTANT } from './constant/decorator/api/controller.constant.js';
|
|
9
|
+
export { FUNCTION_API_DECORATOR_CONSTANT } from './constant/decorator/api/function.constant.js';
|
|
10
|
+
export { PROPERTY_DESCRIBE_DECORATOR_API_CONSTANT } from './constant/decorator/api/property-describe.constant.js';
|
|
11
|
+
export { EXCEPTION_DTO_CONSTANT } from './constant/dto/exception.constant.js';
|
|
12
|
+
export { TRANSFORMER_VALUE_DTO_CONSTANT } from './constant/dto/transformer-value.constant.js';
|
|
13
|
+
export { GET_LIST_QUERY_DTO_FACTORY_CONSTANT } from './constant/factory/dto/get-list-query.constant.js';
|
|
14
|
+
export { FILTER_API_INTERFACE_CONSTANT } from './constant/interface/api/filter.constant.js';
|
|
15
|
+
export { STRING_PROPERTY_API_INTERFACE_CONSTANT } from './constant/interface/api/property/string.constant.js';
|
|
16
|
+
export { WALLET_PROPERTY_API_INTERFACE_CONSTANT } from './constant/interface/api/property/wallet.constant.js';
|
|
17
|
+
export { NUMBER_CONSTANT } from './constant/number.constant.js';
|
|
18
|
+
export { ApiController } from './decorator/api/controller.decorator.js';
|
|
19
|
+
export { ApiFunctionCreate } from './decorator/api/function/create.decorator.js';
|
|
20
|
+
export { ApiFunction } from './decorator/api/function/decorator.js';
|
|
21
|
+
export { ApiFunctionDelete } from './decorator/api/function/delete.decorator.js';
|
|
22
|
+
export { ApiFunctionGetList } from './decorator/api/function/get-list.decorator.js';
|
|
23
|
+
export { ApiFunctionGetMany } from './decorator/api/function/get-many.decorator.js';
|
|
24
|
+
export { ApiFunctionGet } from './decorator/api/function/get.decorator.js';
|
|
25
|
+
export { ApiFunctionUpdate } from './decorator/api/function/update.decorator.js';
|
|
26
|
+
export { ApiMethod } from './decorator/api/method.decorator.js';
|
|
27
|
+
export { ApiPropertyBoolean } from './decorator/api/property/boolean.decorator.js';
|
|
28
|
+
export { ApiPropertyDate } from './decorator/api/property/date.decorator.js';
|
|
29
|
+
export { ApiPropertyDescribe } from './decorator/api/property/describe.decorator.js';
|
|
30
|
+
export { ApiPropertyNumber } from './decorator/api/property/number.decorator.js';
|
|
31
|
+
export { ApiPropertyObject } from './decorator/api/property/object.decorator.js';
|
|
32
|
+
export { ApiPropertyString } from './decorator/api/property/string.decorator.js';
|
|
33
|
+
export { ApiPropertyUUID } from './decorator/api/property/uuid.decorator.js';
|
|
34
|
+
export { ApiService } from './decorator/api/service.decorator.js';
|
|
35
|
+
export { EApiAction } from './enum/decorator/api/action.enum.js';
|
|
36
|
+
export { EApiAuthenticationType } from './enum/decorator/api/authentication-type.enum.js';
|
|
37
|
+
export { EApiControllerLoadRelationsStrategy } from './enum/decorator/api/controller/load-relations-strategy.enum.js';
|
|
38
|
+
export { EApiControllerRequestTransformerType } from './enum/decorator/api/controller/request-transformer-type.enum.js';
|
|
39
|
+
export { EApiDtoType } from './enum/decorator/api/dto-type.enum.js';
|
|
40
|
+
export { EApiFunctionType } from './enum/decorator/api/function/type.enum.js';
|
|
41
|
+
export { EApiPropertyDataType } from './enum/decorator/api/property/data-type.enum.js';
|
|
42
|
+
export { EApiPropertyDateIdentifier } from './enum/decorator/api/property/date/identifier.enum.js';
|
|
43
|
+
export { EApiPropertyDateType } from './enum/decorator/api/property/date/type.enum.js';
|
|
44
|
+
export { EApiPropertyDescribeType } from './enum/decorator/api/property/desribe-type.enum.js';
|
|
45
|
+
export { EApiPropertyNumberType } from './enum/decorator/api/property/number-type.enum.js';
|
|
46
|
+
export { EApiPropertyStringType } from './enum/decorator/api/property/string-type.enum.js';
|
|
47
|
+
export { EApiRouteType } from './enum/decorator/api/route-type.enum.js';
|
|
48
|
+
export { EException } from './enum/exception.enum.js';
|
|
49
|
+
export { EFilterOrderDirection } from './enum/filter-order-direction.enum.js';
|
|
50
|
+
export { EErrorStringAction } from './enum/utility/error-string-action.enum.js';
|
|
51
|
+
export { ApiControllerFactory } from './factory/api/controller.factory.js';
|
|
52
|
+
export { CorrelationIDResponseBodyInterceptor } from './interceptor/correlation-id-response-body.interceptor.js';
|
|
53
|
+
export { ApiControllerApplyDecorators } from './utility/api/controller/apply-decorators.utility.js';
|
|
54
|
+
export { ApiControllerApplyMetadata } from './utility/api/controller/apply-metadata.utility.js';
|
|
55
|
+
export { ApiControllerGetListTransformFilter } from './utility/api/controller/get-list/transform-filter.utility.js';
|
|
56
|
+
export { ApiControllerGetMethodName } from './utility/api/controller/get-method-name.utility.js';
|
|
57
|
+
export { ApiControllerHandleRequestRelations } from './utility/api/controller/handle-request-relations.utility.js';
|
|
58
|
+
export { ApiControllerTransformData } from './utility/api/controller/transform-data.utility.js';
|
|
59
|
+
export { ApiControllerValidateRequest } from './utility/api/controller/validate-request.utility.js';
|
|
60
|
+
export { ApiControllerWriteDtoSwagger } from './utility/api/controller/write-dto-swagger.utility.js';
|
|
61
|
+
export { ApiControllerWriteMethod } from './utility/api/controller/write-method.utility.js';
|
|
62
|
+
export { FilterOrderByFromEntity } from './utility/api/filter-order-by-from-entity.utility.js';
|
|
63
|
+
export { CamelCaseString } from './utility/camel-case-string.utility.js';
|
|
64
|
+
export { CapitalizeString } from './utility/capitalize-string.utility.js';
|
|
65
|
+
export { DtoBuildDecorator } from './utility/dto/build-decorator.utility.js';
|
|
66
|
+
export { DtoGenerateDecorator } from './utility/dto/generate-decorator.utility.js';
|
|
67
|
+
export { DtoGenerateException } from './utility/dto/generate-exception.utility.js';
|
|
68
|
+
export { DtoGenerateGetListResponse } from './utility/dto/generate-get-list-response.utility.js';
|
|
69
|
+
export { DtoGenerateRelationResponse } from './utility/dto/generate-relation-response.utility.js';
|
|
70
|
+
export { DtoGenerate } from './utility/dto/generate.utility.js';
|
|
71
|
+
export { DtoGetDecoratorConfig } from './utility/dto/get-decorator-config.utility.js';
|
|
72
|
+
export { DtoGetGetListQueryBaseClass } from './utility/dto/get-get-list-query-base-class.utility.js';
|
|
73
|
+
export { DtoHandleDateProperty } from './utility/dto/handle-date-property.utility.js';
|
|
74
|
+
export { DtoIsPropertyExposedForGuard } from './utility/dto/is-property-exposed-for-guard.utility.js';
|
|
75
|
+
export { DtoIsShouldBeGenerated } from './utility/dto/is-should-be-generated.utility.js';
|
|
76
|
+
export { DtoValidatePropertyConfig } from './utility/dto/validate-property-config.utility.js';
|
|
77
|
+
export { ErrorException } from './utility/error-exception.utility.js';
|
|
78
|
+
export { ErrorString } from './utility/error-string.utility.js';
|
|
79
|
+
export { GenerateEntityInformation } from './utility/generate-entity-information.utility.js';
|
|
80
|
+
export { GetEntityColumns } from './utility/get-entity-columns.utility.js';
|
|
81
|
+
export { IsErrorOfType } from './utility/is-error-of-type.utility.js';
|
|
82
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { __decorate } from '../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
import { Injectable, HttpStatus, HttpException, InternalServerErrorException } from '@nestjs/common';
|
|
4
|
+
import { ThrottlerException } from '@nestjs/throttler';
|
|
5
|
+
import { catchError } from 'rxjs/operators';
|
|
6
|
+
|
|
7
|
+
let CorrelationIDResponseBodyInterceptor = class CorrelationIDResponseBodyInterceptor {
|
|
8
|
+
intercept(context, next) {
|
|
9
|
+
return next.handle().pipe(catchError((error) => {
|
|
10
|
+
if (error instanceof ThrottlerException) {
|
|
11
|
+
const request = context.switchToHttp().getRequest();
|
|
12
|
+
let correlationId = request.headers["x-correlation-id"];
|
|
13
|
+
const errorResponse = error.getResponse();
|
|
14
|
+
if (correlationId == undefined) {
|
|
15
|
+
correlationId = randomUUID();
|
|
16
|
+
}
|
|
17
|
+
let customErrorResponse = {};
|
|
18
|
+
customErrorResponse.statusCode = HttpStatus.TOO_MANY_REQUESTS;
|
|
19
|
+
if (typeof errorResponse === "object" && errorResponse != null) {
|
|
20
|
+
customErrorResponse = { ...errorResponse };
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
customErrorResponse.message = errorResponse;
|
|
24
|
+
}
|
|
25
|
+
customErrorResponse.error = "Too Many Requests";
|
|
26
|
+
customErrorResponse.timestamp = Date.now();
|
|
27
|
+
customErrorResponse.correlationID = correlationId;
|
|
28
|
+
throw new HttpException(customErrorResponse, error.getStatus());
|
|
29
|
+
}
|
|
30
|
+
else if (error instanceof HttpException) {
|
|
31
|
+
const request = context.switchToHttp().getRequest();
|
|
32
|
+
let correlationId = request.headers["x-correlation-id"];
|
|
33
|
+
const errorResponse = error.getResponse();
|
|
34
|
+
if (correlationId == undefined) {
|
|
35
|
+
correlationId = randomUUID();
|
|
36
|
+
}
|
|
37
|
+
let customErrorResponse = {};
|
|
38
|
+
if (typeof errorResponse === "object" && errorResponse != null) {
|
|
39
|
+
customErrorResponse = { ...errorResponse };
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
customErrorResponse.message = errorResponse;
|
|
43
|
+
}
|
|
44
|
+
customErrorResponse.correlationID = correlationId;
|
|
45
|
+
customErrorResponse.timestamp = Date.now();
|
|
46
|
+
throw new HttpException(customErrorResponse, error.getStatus());
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const request = context.switchToHttp().getRequest();
|
|
50
|
+
let correlationId = request.headers["x-correlation-id"];
|
|
51
|
+
if (correlationId == undefined) {
|
|
52
|
+
correlationId = randomUUID();
|
|
53
|
+
}
|
|
54
|
+
if (!(error instanceof Error)) {
|
|
55
|
+
error = new InternalServerErrorException("Unknown error");
|
|
56
|
+
}
|
|
57
|
+
const internalError = error;
|
|
58
|
+
const errorResponse = "Internal server error";
|
|
59
|
+
const customErrorResponse = {};
|
|
60
|
+
customErrorResponse.statusCode = HttpStatus.INTERNAL_SERVER_ERROR;
|
|
61
|
+
customErrorResponse.message = errorResponse;
|
|
62
|
+
customErrorResponse.error = "Internal server error";
|
|
63
|
+
customErrorResponse.timestamp = Date.now();
|
|
64
|
+
customErrorResponse.correlationID = correlationId;
|
|
65
|
+
const status = "getStatus" in internalError && typeof internalError.getStatus === "function" ? internalError.getStatus() : HttpStatus.INTERNAL_SERVER_ERROR;
|
|
66
|
+
throw new HttpException(customErrorResponse, status);
|
|
67
|
+
}
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
CorrelationIDResponseBodyInterceptor = __decorate([
|
|
72
|
+
Injectable()
|
|
73
|
+
], CorrelationIDResponseBodyInterceptor);
|
|
74
|
+
|
|
75
|
+
export { CorrelationIDResponseBodyInterceptor };
|
|
76
|
+
//# sourceMappingURL=correlation-id-response-body.interceptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"correlation-id-response-body.interceptor.js","sources":["../../../../../src/interceptor/correlation-id-response-body.interceptor.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAWa,IAAA,oCAAoC,GAA1C,MAAM,oCAAoC,CAAA;IAChD,SAAS,CAAC,OAAyB,EAAE,IAAiB,EAAA;AACrD,QAAA,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CACxB,UAAU,CAAC,CAAC,KAAc,KAAI;AAC7B,YAAA,IAAI,KAAK,YAAY,kBAAkB,EAAE;gBACxC,MAAM,OAAO,GAAmB,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAkB;gBACnF,IAAI,aAAa,GAAW,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAW;AACzE,gBAAA,MAAM,aAAa,GAAoB,KAAK,CAAC,WAAW,EAAE;AAE1D,gBAAA,IAAI,aAAa,IAAI,SAAS,EAAE;oBAC/B,aAAa,GAAG,UAAU,EAAE;;gBAG7B,IAAI,mBAAmB,GAAwB,EAAE;AACjD,gBAAA,mBAAmB,CAAC,UAAU,GAAG,UAAU,CAAC,iBAAiB;gBAE7D,IAAI,OAAO,aAAa,KAAK,QAAQ,IAAI,aAAa,IAAI,IAAI,EAAE;AAC/D,oBAAA,mBAAmB,GAAG,EAAE,GAAG,aAAa,EAAE;;qBACpC;AACN,oBAAA,mBAAmB,CAAC,OAAO,GAAG,aAAa;;AAE5C,gBAAA,mBAAmB,CAAC,KAAK,GAAG,mBAAmB;AAC/C,gBAAA,mBAAmB,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE;AAC1C,gBAAA,mBAAmB,CAAC,aAAa,GAAG,aAAa;gBAEjD,MAAM,IAAI,aAAa,CAAC,mBAAmB,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;;AACzD,iBAAA,IAAI,KAAK,YAAY,aAAa,EAAE;gBAC1C,MAA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KAAK,GAAG,uBAAuB;AACnD,gBAAA,mBAAmB,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE;AAC1C,gBAAA,mBAAmB,CAAC,aAAa,GAAG,aAAa;gBAEjD,MAAM,MAAM,GAAW,WAAW,IAAI,aAAa,IAAI,OAAO,aAAa,CAAC,SAAS,KAAK,UAAU,GAAG,aAAa,CAAC,SAAS,EAAE,GAAG,UAAU,CAAC,qBAAqB;AAEnK,gBAAA,MAAM,IAAI,aAAa,CAAC,mBAAmB,EAAE,MAAM,CAAC;;SAErD,CAAC,CACF;;;AAxEU,oCAAoC,GAAA,UAAA,CAAA;AADhD,IAAA,UAAU;AACE,CAAA,EAAA,oCAAoC,CA0EhD;;;;"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { RequestMethod, HttpStatus } from '@nestjs/common';
|
|
2
|
+
import { ApiMethod } from '../../../decorator/api/method.decorator.js';
|
|
3
|
+
import { EApiAction } from '../../../enum/decorator/api/action.enum.js';
|
|
4
|
+
import '../../../enum/decorator/api/authentication-type.enum.js';
|
|
5
|
+
import '../../../enum/decorator/api/controller/load-relations-strategy.enum.js';
|
|
6
|
+
import '../../../enum/decorator/api/controller/request-transformer-type.enum.js';
|
|
7
|
+
import { EApiDtoType } from '../../../enum/decorator/api/dto-type.enum.js';
|
|
8
|
+
import '../../../enum/decorator/api/function/type.enum.js';
|
|
9
|
+
import '../../../enum/decorator/api/property/data-type.enum.js';
|
|
10
|
+
import '../../../enum/decorator/api/property/date/identifier.enum.js';
|
|
11
|
+
import '../../../enum/decorator/api/property/date/type.enum.js';
|
|
12
|
+
import '../../../enum/decorator/api/property/desribe-type.enum.js';
|
|
13
|
+
import '../../../enum/decorator/api/property/number-type.enum.js';
|
|
14
|
+
import '../../../enum/decorator/api/property/string-type.enum.js';
|
|
15
|
+
import { EApiRouteType } from '../../../enum/decorator/api/route-type.enum.js';
|
|
16
|
+
import '../../../enum/exception.enum.js';
|
|
17
|
+
import '../../../enum/filter-order-direction.enum.js';
|
|
18
|
+
import '../../../enum/utility/error-string-action.enum.js';
|
|
19
|
+
import { DtoGenerate } from '../../dto/generate.utility.js';
|
|
20
|
+
import { ErrorException } from '../../error-exception.utility.js';
|
|
21
|
+
|
|
22
|
+
function ApiControllerApplyDecorators(targetMethod, entity, properties, method, methodName, routeConfig, decorators) {
|
|
23
|
+
const responseDto = routeConfig.dto?.response ?? DtoGenerate(properties.entity, entity, method, EApiDtoType.RESPONSE, routeConfig.autoDto?.[EApiDtoType.RESPONSE], routeConfig.authentication?.guard);
|
|
24
|
+
const customDecorators = [...decorators];
|
|
25
|
+
switch (method) {
|
|
26
|
+
case EApiRouteType.CREATE: {
|
|
27
|
+
customDecorators.push(ApiMethod({ action: EApiAction.CREATE, authentication: routeConfig.authentication, entity: properties.entity, httpCode: HttpStatus.CREATED, method: RequestMethod.POST, path: "", responses: { hasInternalServerError: true, hasUnauthorized: true }, responseType: responseDto }));
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
case EApiRouteType.DELETE: {
|
|
31
|
+
customDecorators.push(ApiMethod({ action: EApiAction.DELETE, authentication: routeConfig.authentication, entity: properties.entity, httpCode: HttpStatus.NO_CONTENT, method: RequestMethod.DELETE, path: `:${String(entity.primaryKey?.name)}`, responses: { hasInternalServerError: true, hasNotFound: true, hasUnauthorized: true }, responseType: undefined }));
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
case EApiRouteType.GET: {
|
|
35
|
+
customDecorators.push(ApiMethod({
|
|
36
|
+
action: EApiAction.FETCH,
|
|
37
|
+
authentication: routeConfig.authentication,
|
|
38
|
+
entity: properties.entity,
|
|
39
|
+
httpCode: HttpStatus.OK,
|
|
40
|
+
method: RequestMethod.GET,
|
|
41
|
+
path: `:${String(entity.primaryKey?.name)}`,
|
|
42
|
+
responses: { hasInternalServerError: true, hasNotFound: true, hasUnauthorized: true },
|
|
43
|
+
responseType: responseDto,
|
|
44
|
+
}));
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
case EApiRouteType.GET_LIST: {
|
|
48
|
+
customDecorators.push(ApiMethod({
|
|
49
|
+
action: EApiAction.FETCH_LIST,
|
|
50
|
+
authentication: routeConfig.authentication,
|
|
51
|
+
entity: properties.entity,
|
|
52
|
+
httpCode: HttpStatus.OK,
|
|
53
|
+
method: RequestMethod.GET,
|
|
54
|
+
path: "",
|
|
55
|
+
responses: { hasInternalServerError: true, hasNotFound: true, hasUnauthorized: true },
|
|
56
|
+
responseType: responseDto,
|
|
57
|
+
}));
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
case EApiRouteType.PARTIAL_UPDATE: {
|
|
61
|
+
customDecorators.push(ApiMethod({ action: EApiAction.UPDATE, authentication: routeConfig.authentication, entity: properties.entity, httpCode: HttpStatus.OK, method: RequestMethod.PATCH, path: `:${String(entity.primaryKey?.name)}`, responses: { hasBadRequest: true, hasInternalServerError: true, hasNotFound: true, hasUnauthorized: true }, responseType: responseDto }));
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
case EApiRouteType.UPDATE: {
|
|
65
|
+
customDecorators.push(ApiMethod({ action: EApiAction.UPDATE, authentication: routeConfig.authentication, entity: properties.entity, httpCode: HttpStatus.OK, method: RequestMethod.PUT, path: `:${String(entity.primaryKey?.name)}`, responses: { hasBadRequest: true, hasInternalServerError: true, hasNotFound: true, hasUnauthorized: true }, responseType: responseDto }));
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
default: {
|
|
69
|
+
throw ErrorException(`Method ${method} not implemented`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (customDecorators.length > 0) {
|
|
73
|
+
for (const decorator of customDecorators) {
|
|
74
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(targetMethod, methodName);
|
|
75
|
+
decorator(targetMethod, methodName, descriptor ?? { value: targetMethod });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export { ApiControllerApplyDecorators };
|
|
81
|
+
//# sourceMappingURL=apply-decorators.utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-decorators.utility.js","sources":["../../../../../../../src/utility/api/controller/apply-decorators.utility.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAYgB,SAAA,4BAA4B,CAAI,YAAoG,EAAE,MAAqB,EAAE,UAAuC,EAAE,MAAqB,EAAE,UAAkB,EAAE,WAA4D,EAAE,UAA6D,EAAA;AAC3X,IAAA,MAAM,WAAW,GAA8B,WAAW,CAAC,GAAG,EAAE,QAAQ,IAAI,WAAW,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,QAAQ,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC,cAAc,EAAE,KAAK,CAAC;AAChO,IAAA,MAAM,gBAAgB,GAA2B,CAAC,GAAG,UAAU,CAAC;IAEhE,QAAQ,MAAM;AACb,QAAA,KAAK,aAAa,CAAC,MAAM,EAAE;YAC1B,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,cAAc,EAAE,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,sBAAsB,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,CAAC;YAEzS;;AAGD,QAAA,KAAK,aAAa,CAAC,MAAM,EAAE;AAC1B,YAAA,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,cAAc,EAAE,WAAW,CAAC,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;YAE9W;;QAGD,SAAS;AACR,YAAA,MAAM,cAAc,CAAC,CAAA,OAAA,EAAU,MAAgB,CAAA,gBAAA,CAAkB,CAAC;;;AAIpE,IAAA,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;AAChC,QAAA,KAAK,MAAM,SAAS,IAAI,gBAAgB,EAAE;YACzC,MAAM,UAAU,GAA6C,OAAO,CAAC,wBAAwB,CAAC,YAAY,EAAE,UAAU,CAAC;AACtH,YAAA,SAAiD,CAAC,YAAY,EAAE,UAAU,EAAE,UAAU,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;;;AAGtH;;;;"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { assignMetadata } from '@nestjs/common';
|
|
2
|
+
import { ROUTE_ARGS_METADATA, PARAMTYPES_METADATA } from '@nestjs/common/constants';
|
|
3
|
+
import { RouteParamtypes } from '@nestjs/common/enums/route-paramtypes.enum';
|
|
4
|
+
import '../../../enum/decorator/api/action.enum.js';
|
|
5
|
+
import '../../../enum/decorator/api/authentication-type.enum.js';
|
|
6
|
+
import '../../../enum/decorator/api/controller/load-relations-strategy.enum.js';
|
|
7
|
+
import '../../../enum/decorator/api/controller/request-transformer-type.enum.js';
|
|
8
|
+
import { EApiDtoType } from '../../../enum/decorator/api/dto-type.enum.js';
|
|
9
|
+
import '../../../enum/decorator/api/function/type.enum.js';
|
|
10
|
+
import '../../../enum/decorator/api/property/data-type.enum.js';
|
|
11
|
+
import '../../../enum/decorator/api/property/date/identifier.enum.js';
|
|
12
|
+
import '../../../enum/decorator/api/property/date/type.enum.js';
|
|
13
|
+
import '../../../enum/decorator/api/property/desribe-type.enum.js';
|
|
14
|
+
import '../../../enum/decorator/api/property/number-type.enum.js';
|
|
15
|
+
import '../../../enum/decorator/api/property/string-type.enum.js';
|
|
16
|
+
import '../../../enum/decorator/api/route-type.enum.js';
|
|
17
|
+
import '../../../enum/exception.enum.js';
|
|
18
|
+
import '../../../enum/filter-order-direction.enum.js';
|
|
19
|
+
import '../../../enum/utility/error-string-action.enum.js';
|
|
20
|
+
import '../../../constant/utility/dto/constant.js';
|
|
21
|
+
import '../../../../external/tslib/tslib.es6.js';
|
|
22
|
+
import '../../../constant/decorator/api/function.constant.js';
|
|
23
|
+
import '@nestjs/swagger';
|
|
24
|
+
import 'class-transformer';
|
|
25
|
+
import 'class-validator';
|
|
26
|
+
import 'lodash/random';
|
|
27
|
+
import '../../../validator/all-or-none-of-listed-properties.validator.js';
|
|
28
|
+
import '../../../validator/has-at-least-one-and-only-one-of-listed-properties.validator.js';
|
|
29
|
+
import '../../../validator/has-at-least-one-of-listed-properties.validator.js';
|
|
30
|
+
import '../../../validator/has-at-least-one-property.validator.js';
|
|
31
|
+
import '../../../validator/is-regular-expression.validator.js';
|
|
32
|
+
import '../../../validator/only-one-of-listed-properties.validator.js';
|
|
33
|
+
import 'node:crypto';
|
|
34
|
+
import { DtoGenerate } from '../../dto/generate.utility.js';
|
|
35
|
+
import 'typeorm';
|
|
36
|
+
import 'reflect-metadata';
|
|
37
|
+
|
|
38
|
+
function ApiControllerApplyMetadata(target, targetPrototype, entity, properties, method, methodName, routeConfig) {
|
|
39
|
+
let parameterIndex = 0;
|
|
40
|
+
let routeArgumentsMetadata = {};
|
|
41
|
+
const parameterTypes = [];
|
|
42
|
+
const requestDto = routeConfig.dto?.request ?? DtoGenerate(properties.entity, entity, method, EApiDtoType.REQUEST, routeConfig.autoDto?.[EApiDtoType.REQUEST], routeConfig.authentication?.guard);
|
|
43
|
+
const queryDto = routeConfig.dto?.query ?? DtoGenerate(properties.entity, entity, method, EApiDtoType.QUERY, routeConfig.autoDto?.[EApiDtoType.QUERY], routeConfig.authentication?.guard);
|
|
44
|
+
const bodyDto = routeConfig.dto?.body ?? DtoGenerate(properties.entity, entity, method, EApiDtoType.BODY, routeConfig.autoDto?.[EApiDtoType.BODY], routeConfig.authentication?.guard);
|
|
45
|
+
if (requestDto) {
|
|
46
|
+
routeArgumentsMetadata = assignMetadata(routeArgumentsMetadata, RouteParamtypes.PARAM, parameterIndex);
|
|
47
|
+
parameterTypes.push(requestDto);
|
|
48
|
+
parameterIndex++;
|
|
49
|
+
}
|
|
50
|
+
if (queryDto) {
|
|
51
|
+
routeArgumentsMetadata = assignMetadata(routeArgumentsMetadata, RouteParamtypes.QUERY, parameterIndex);
|
|
52
|
+
parameterTypes.push(queryDto);
|
|
53
|
+
parameterIndex++;
|
|
54
|
+
}
|
|
55
|
+
if (bodyDto) {
|
|
56
|
+
routeArgumentsMetadata = assignMetadata(routeArgumentsMetadata, RouteParamtypes.BODY, parameterIndex);
|
|
57
|
+
parameterTypes.push(bodyDto);
|
|
58
|
+
parameterIndex++;
|
|
59
|
+
}
|
|
60
|
+
routeArgumentsMetadata = assignMetadata(routeArgumentsMetadata, RouteParamtypes.HEADERS, parameterIndex);
|
|
61
|
+
parameterTypes.push(Object);
|
|
62
|
+
parameterIndex++;
|
|
63
|
+
routeArgumentsMetadata = assignMetadata(routeArgumentsMetadata, RouteParamtypes.IP, parameterIndex);
|
|
64
|
+
parameterTypes.push(Object);
|
|
65
|
+
parameterIndex++;
|
|
66
|
+
if (routeConfig.authentication) {
|
|
67
|
+
routeArgumentsMetadata = assignMetadata(routeArgumentsMetadata, RouteParamtypes.REQUEST, parameterIndex);
|
|
68
|
+
parameterTypes.push(Object);
|
|
69
|
+
parameterIndex++;
|
|
70
|
+
}
|
|
71
|
+
Reflect.defineMetadata(ROUTE_ARGS_METADATA, routeArgumentsMetadata, target, methodName);
|
|
72
|
+
Reflect.defineMetadata(PARAMTYPES_METADATA, parameterTypes, targetPrototype, methodName);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export { ApiControllerApplyMetadata };
|
|
76
|
+
//# sourceMappingURL=apply-metadata.utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-metadata.utility.js","sources":["../../../../../../../src/utility/api/controller/apply-metadata.utility.ts"],"sourcesContent":[null],"names":[],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