@elsikora/nestjs-crud-automator 1.17.1-dev.1 → 1.18.0-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/dist/cjs/class/api/authorization/policy/registry.class.d.ts +1 -5
- package/dist/cjs/class/api/authorization/policy/registry.class.js +41 -34
- package/dist/cjs/class/api/authorization/policy/registry.class.js.map +1 -1
- package/dist/cjs/class/api/subscriber/registry.class.js +13 -0
- package/dist/cjs/class/api/subscriber/registry.class.js.map +1 -1
- package/dist/cjs/class/metadata-storage.class.d.ts +2 -1
- package/dist/cjs/class/metadata-storage.class.js +53 -17
- package/dist/cjs/class/metadata-storage.class.js.map +1 -1
- package/dist/cjs/constant/dto/auto-context.constant.d.ts +4 -0
- package/dist/cjs/constant/dto/auto-context.constant.js +10 -0
- package/dist/cjs/constant/dto/auto-context.constant.js.map +1 -0
- package/dist/cjs/constant/dto/index.d.ts +1 -0
- package/dist/cjs/decorator/api/authorization/policy.decorator.d.ts +1 -0
- package/dist/cjs/decorator/api/authorization/policy.decorator.js +1 -0
- package/dist/cjs/decorator/api/authorization/policy.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/controller/decorator.d.ts +1 -1
- package/dist/cjs/decorator/api/controller/decorator.js +1 -1
- package/dist/cjs/decorator/api/controller/observable.decorator.d.ts +1 -0
- package/dist/cjs/decorator/api/controller/observable.decorator.js +1 -0
- package/dist/cjs/decorator/api/controller/observable.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/controller/securable.decorator.d.ts +1 -0
- package/dist/cjs/decorator/api/controller/securable.decorator.js +1 -0
- package/dist/cjs/decorator/api/controller/securable.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/function/create.decorator.d.ts +1 -0
- package/dist/cjs/decorator/api/function/create.decorator.js +1 -0
- package/dist/cjs/decorator/api/function/create.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/function/decorator.d.ts +1 -0
- package/dist/cjs/decorator/api/function/decorator.js +1 -0
- package/dist/cjs/decorator/api/function/decorator.js.map +1 -1
- package/dist/cjs/decorator/api/function/delete.decorator.d.ts +1 -0
- package/dist/cjs/decorator/api/function/delete.decorator.js +1 -0
- package/dist/cjs/decorator/api/function/delete.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/function/get-list.decorator.d.ts +1 -0
- package/dist/cjs/decorator/api/function/get-list.decorator.js +1 -0
- package/dist/cjs/decorator/api/function/get-list.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/function/get-many.decorator.d.ts +1 -0
- package/dist/cjs/decorator/api/function/get-many.decorator.js +1 -0
- package/dist/cjs/decorator/api/function/get-many.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/function/get.decorator.d.ts +1 -0
- package/dist/cjs/decorator/api/function/get.decorator.js +1 -0
- package/dist/cjs/decorator/api/function/get.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/function/update.decorator.d.ts +1 -0
- package/dist/cjs/decorator/api/function/update.decorator.js +1 -0
- package/dist/cjs/decorator/api/function/update.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/method.decorator.d.ts +1 -0
- package/dist/cjs/decorator/api/method.decorator.js +1 -0
- package/dist/cjs/decorator/api/method.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/property/boolean.decorator.d.ts +1 -0
- package/dist/cjs/decorator/api/property/boolean.decorator.js +11 -4
- package/dist/cjs/decorator/api/property/boolean.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/property/copy.decorator.d.ts +34 -14
- package/dist/cjs/decorator/api/property/copy.decorator.js +83 -30
- package/dist/cjs/decorator/api/property/copy.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/property/date.decorator.d.ts +1 -0
- package/dist/cjs/decorator/api/property/date.decorator.js +11 -4
- package/dist/cjs/decorator/api/property/date.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/property/describe.decorator.d.ts +1 -1
- package/dist/cjs/decorator/api/property/describe.decorator.js +1 -1
- package/dist/cjs/decorator/api/property/enum.decorator.d.ts +1 -0
- package/dist/cjs/decorator/api/property/enum.decorator.js +11 -4
- package/dist/cjs/decorator/api/property/enum.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/property/number.decorator.d.ts +1 -0
- package/dist/cjs/decorator/api/property/number.decorator.js +15 -5
- package/dist/cjs/decorator/api/property/number.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/property/object.decorator.d.ts +1 -0
- package/dist/cjs/decorator/api/property/object.decorator.js +13 -4
- package/dist/cjs/decorator/api/property/object.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/property/string.decorator.d.ts +1 -0
- package/dist/cjs/decorator/api/property/string.decorator.js +15 -5
- package/dist/cjs/decorator/api/property/string.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/property/uuid.decorator.d.ts +1 -0
- package/dist/cjs/decorator/api/property/uuid.decorator.js +12 -5
- package/dist/cjs/decorator/api/property/uuid.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/service/observable.decorator.d.ts +1 -0
- package/dist/cjs/decorator/api/service/observable.decorator.js +1 -0
- package/dist/cjs/decorator/api/service/observable.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/service.decorator.d.ts +1 -1
- package/dist/cjs/decorator/api/service.decorator.js +1 -1
- package/dist/cjs/decorator/api/subscriber/function.decorator.d.ts +1 -0
- package/dist/cjs/decorator/api/subscriber/function.decorator.js +1 -0
- package/dist/cjs/decorator/api/subscriber/function.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/subscriber/route.decorator.d.ts +1 -0
- package/dist/cjs/decorator/api/subscriber/route.decorator.js +1 -0
- package/dist/cjs/decorator/api/subscriber/route.decorator.js.map +1 -1
- package/dist/cjs/factory/api/controller.factory.js +0 -2
- package/dist/cjs/factory/api/controller.factory.js.map +1 -1
- package/dist/cjs/index.js +27 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interface/class/api/authorization/policy/registry.interface.d.ts +0 -1
- package/dist/cjs/type/auto-context-metadata.type.d.ts +5 -0
- package/dist/cjs/type/decorator/api/property/base/properties.type.d.ts +2 -1
- package/dist/cjs/type/decorator/api/property/copy-properties.type.d.ts +13 -0
- package/dist/cjs/type/decorator/api/property/entity.type.d.ts +3 -0
- package/dist/cjs/type/decorator/api/property/index.d.ts +2 -0
- package/dist/cjs/type/index.d.ts +1 -0
- package/dist/cjs/utility/api/controller/apply-metadata.utility.js +1 -1
- package/dist/cjs/utility/auto-dto-context-queue.utility.d.ts +11 -0
- package/dist/cjs/utility/auto-dto-context-queue.utility.js +40 -0
- package/dist/cjs/utility/auto-dto-context-queue.utility.js.map +1 -0
- package/dist/cjs/utility/defer-property-decorator-execution.utility.d.ts +5 -0
- package/dist/cjs/utility/defer-property-decorator-execution.utility.js +16 -0
- package/dist/cjs/utility/defer-property-decorator-execution.utility.js.map +1 -0
- package/dist/cjs/utility/dto/auto-context-pop.utility.d.ts +6 -0
- package/dist/cjs/utility/dto/auto-context-pop.utility.js +38 -0
- package/dist/cjs/utility/dto/auto-context-pop.utility.js.map +1 -0
- package/dist/cjs/utility/dto/auto-context-push.utility.d.ts +9 -0
- package/dist/cjs/utility/dto/auto-context-push.utility.js +35 -0
- package/dist/cjs/utility/dto/auto-context-push.utility.js.map +1 -0
- package/dist/cjs/utility/dto/build-decorator.utility.js +9 -1
- package/dist/cjs/utility/dto/build-decorator.utility.js.map +1 -1
- package/dist/cjs/utility/dto/generate-dynamic.utility.js +21 -13
- package/dist/cjs/utility/dto/generate-dynamic.utility.js.map +1 -1
- package/dist/cjs/utility/dto/generate.utility.js +35 -27
- package/dist/cjs/utility/dto/generate.utility.js.map +1 -1
- package/dist/cjs/utility/dto/index.d.ts +2 -1
- package/dist/cjs/utility/get-auto-dto-context.utility.d.ts +7 -0
- package/dist/cjs/utility/get-auto-dto-context.utility.js +19 -0
- package/dist/cjs/utility/get-auto-dto-context.utility.js.map +1 -0
- package/dist/cjs/utility/index.d.ts +9 -0
- package/dist/cjs/utility/is-entity-constructor.utility.d.ts +8 -0
- package/dist/cjs/utility/is-entity-constructor.utility.js +13 -0
- package/dist/cjs/utility/is-entity-constructor.utility.js.map +1 -0
- package/dist/cjs/utility/is-entity-factory.utility.d.ts +8 -0
- package/dist/cjs/utility/is-entity-factory.utility.js +15 -0
- package/dist/cjs/utility/is-entity-factory.utility.js.map +1 -0
- package/dist/cjs/utility/is-entity-literal.utility.d.ts +7 -0
- package/dist/cjs/utility/is-entity-literal.utility.js +13 -0
- package/dist/cjs/utility/is-entity-literal.utility.js.map +1 -0
- package/dist/cjs/utility/queue-auto-context-retry.utility.d.ts +6 -0
- package/dist/cjs/utility/queue-auto-context-retry.utility.js +23 -0
- package/dist/cjs/utility/queue-auto-context-retry.utility.js.map +1 -0
- package/dist/cjs/utility/register-auto-dto-child.utility.d.ts +14 -0
- package/dist/cjs/utility/register-auto-dto-child.utility.js +69 -0
- package/dist/cjs/utility/register-auto-dto-child.utility.js.map +1 -0
- package/dist/cjs/utility/resolve/decorator-context.utility.d.ts +13 -0
- package/dist/cjs/utility/resolve/decorator-context.utility.js +31 -0
- package/dist/cjs/utility/resolve/decorator-context.utility.js.map +1 -0
- package/dist/cjs/utility/resolve/index.d.ts +2 -0
- package/dist/cjs/utility/resolve/property-entity.utility.d.ts +16 -0
- package/dist/cjs/utility/resolve/property-entity.utility.js +43 -0
- package/dist/cjs/utility/resolve/property-entity.utility.js.map +1 -0
- package/dist/cjs/utility/with-resolved-property-entity.utility.d.ts +11 -0
- package/dist/cjs/utility/with-resolved-property-entity.utility.js +30 -0
- package/dist/cjs/utility/with-resolved-property-entity.utility.js.map +1 -0
- package/dist/esm/class/api/authorization/policy/registry.class.d.ts +1 -5
- package/dist/esm/class/api/authorization/policy/registry.class.js +41 -34
- package/dist/esm/class/api/authorization/policy/registry.class.js.map +1 -1
- package/dist/esm/class/api/subscriber/registry.class.js +13 -0
- package/dist/esm/class/api/subscriber/registry.class.js.map +1 -1
- package/dist/esm/class/metadata-storage.class.d.ts +2 -1
- package/dist/esm/class/metadata-storage.class.js +53 -17
- package/dist/esm/class/metadata-storage.class.js.map +1 -1
- package/dist/esm/constant/dto/auto-context.constant.d.ts +4 -0
- package/dist/esm/constant/dto/auto-context.constant.js +7 -0
- package/dist/esm/constant/dto/auto-context.constant.js.map +1 -0
- package/dist/esm/constant/dto/index.d.ts +1 -0
- package/dist/esm/decorator/api/authorization/policy.decorator.d.ts +1 -0
- package/dist/esm/decorator/api/authorization/policy.decorator.js +1 -0
- package/dist/esm/decorator/api/authorization/policy.decorator.js.map +1 -1
- package/dist/esm/decorator/api/controller/decorator.d.ts +1 -1
- package/dist/esm/decorator/api/controller/decorator.js +1 -1
- package/dist/esm/decorator/api/controller/observable.decorator.d.ts +1 -0
- package/dist/esm/decorator/api/controller/observable.decorator.js +1 -0
- package/dist/esm/decorator/api/controller/observable.decorator.js.map +1 -1
- package/dist/esm/decorator/api/controller/securable.decorator.d.ts +1 -0
- package/dist/esm/decorator/api/controller/securable.decorator.js +1 -0
- package/dist/esm/decorator/api/controller/securable.decorator.js.map +1 -1
- package/dist/esm/decorator/api/function/create.decorator.d.ts +1 -0
- package/dist/esm/decorator/api/function/create.decorator.js +1 -0
- package/dist/esm/decorator/api/function/create.decorator.js.map +1 -1
- package/dist/esm/decorator/api/function/decorator.d.ts +1 -0
- package/dist/esm/decorator/api/function/decorator.js +1 -0
- package/dist/esm/decorator/api/function/decorator.js.map +1 -1
- package/dist/esm/decorator/api/function/delete.decorator.d.ts +1 -0
- package/dist/esm/decorator/api/function/delete.decorator.js +1 -0
- package/dist/esm/decorator/api/function/delete.decorator.js.map +1 -1
- package/dist/esm/decorator/api/function/get-list.decorator.d.ts +1 -0
- package/dist/esm/decorator/api/function/get-list.decorator.js +1 -0
- package/dist/esm/decorator/api/function/get-list.decorator.js.map +1 -1
- package/dist/esm/decorator/api/function/get-many.decorator.d.ts +1 -0
- package/dist/esm/decorator/api/function/get-many.decorator.js +1 -0
- package/dist/esm/decorator/api/function/get-many.decorator.js.map +1 -1
- package/dist/esm/decorator/api/function/get.decorator.d.ts +1 -0
- package/dist/esm/decorator/api/function/get.decorator.js +1 -0
- package/dist/esm/decorator/api/function/get.decorator.js.map +1 -1
- package/dist/esm/decorator/api/function/update.decorator.d.ts +1 -0
- package/dist/esm/decorator/api/function/update.decorator.js +1 -0
- package/dist/esm/decorator/api/function/update.decorator.js.map +1 -1
- package/dist/esm/decorator/api/method.decorator.d.ts +1 -0
- package/dist/esm/decorator/api/method.decorator.js +1 -0
- package/dist/esm/decorator/api/method.decorator.js.map +1 -1
- package/dist/esm/decorator/api/property/boolean.decorator.d.ts +1 -0
- package/dist/esm/decorator/api/property/boolean.decorator.js +12 -5
- package/dist/esm/decorator/api/property/boolean.decorator.js.map +1 -1
- package/dist/esm/decorator/api/property/copy.decorator.d.ts +34 -14
- package/dist/esm/decorator/api/property/copy.decorator.js +83 -30
- package/dist/esm/decorator/api/property/copy.decorator.js.map +1 -1
- package/dist/esm/decorator/api/property/date.decorator.d.ts +1 -0
- package/dist/esm/decorator/api/property/date.decorator.js +12 -5
- package/dist/esm/decorator/api/property/date.decorator.js.map +1 -1
- package/dist/esm/decorator/api/property/describe.decorator.d.ts +1 -1
- package/dist/esm/decorator/api/property/describe.decorator.js +1 -1
- package/dist/esm/decorator/api/property/enum.decorator.d.ts +1 -0
- package/dist/esm/decorator/api/property/enum.decorator.js +12 -5
- package/dist/esm/decorator/api/property/enum.decorator.js.map +1 -1
- package/dist/esm/decorator/api/property/number.decorator.d.ts +1 -0
- package/dist/esm/decorator/api/property/number.decorator.js +17 -7
- package/dist/esm/decorator/api/property/number.decorator.js.map +1 -1
- package/dist/esm/decorator/api/property/object.decorator.d.ts +1 -0
- package/dist/esm/decorator/api/property/object.decorator.js +14 -5
- package/dist/esm/decorator/api/property/object.decorator.js.map +1 -1
- package/dist/esm/decorator/api/property/string.decorator.d.ts +1 -0
- package/dist/esm/decorator/api/property/string.decorator.js +17 -7
- package/dist/esm/decorator/api/property/string.decorator.js.map +1 -1
- package/dist/esm/decorator/api/property/uuid.decorator.d.ts +1 -0
- package/dist/esm/decorator/api/property/uuid.decorator.js +13 -6
- package/dist/esm/decorator/api/property/uuid.decorator.js.map +1 -1
- package/dist/esm/decorator/api/service/observable.decorator.d.ts +1 -0
- package/dist/esm/decorator/api/service/observable.decorator.js +1 -0
- package/dist/esm/decorator/api/service/observable.decorator.js.map +1 -1
- package/dist/esm/decorator/api/service.decorator.d.ts +1 -1
- package/dist/esm/decorator/api/service.decorator.js +1 -1
- package/dist/esm/decorator/api/subscriber/function.decorator.d.ts +1 -0
- package/dist/esm/decorator/api/subscriber/function.decorator.js +1 -0
- package/dist/esm/decorator/api/subscriber/function.decorator.js.map +1 -1
- package/dist/esm/decorator/api/subscriber/route.decorator.d.ts +1 -0
- package/dist/esm/decorator/api/subscriber/route.decorator.js +1 -0
- package/dist/esm/decorator/api/subscriber/route.decorator.js.map +1 -1
- package/dist/esm/factory/api/controller.factory.js +0 -2
- package/dist/esm/factory/api/controller.factory.js.map +1 -1
- package/dist/esm/index.js +13 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interface/class/api/authorization/policy/registry.interface.d.ts +0 -1
- package/dist/esm/type/auto-context-metadata.type.d.ts +5 -0
- package/dist/esm/type/decorator/api/property/base/properties.type.d.ts +2 -1
- package/dist/esm/type/decorator/api/property/copy-properties.type.d.ts +13 -0
- package/dist/esm/type/decorator/api/property/entity.type.d.ts +3 -0
- package/dist/esm/type/decorator/api/property/index.d.ts +2 -0
- package/dist/esm/type/index.d.ts +1 -0
- package/dist/esm/utility/api/controller/apply-metadata.utility.js +1 -1
- package/dist/esm/utility/auto-dto-context-queue.utility.d.ts +11 -0
- package/dist/esm/utility/auto-dto-context-queue.utility.js +37 -0
- package/dist/esm/utility/auto-dto-context-queue.utility.js.map +1 -0
- package/dist/esm/utility/defer-property-decorator-execution.utility.d.ts +5 -0
- package/dist/esm/utility/defer-property-decorator-execution.utility.js +14 -0
- package/dist/esm/utility/defer-property-decorator-execution.utility.js.map +1 -0
- package/dist/esm/utility/dto/auto-context-pop.utility.d.ts +6 -0
- package/dist/esm/utility/dto/auto-context-pop.utility.js +36 -0
- package/dist/esm/utility/dto/auto-context-pop.utility.js.map +1 -0
- package/dist/esm/utility/dto/auto-context-push.utility.d.ts +9 -0
- package/dist/esm/utility/dto/auto-context-push.utility.js +33 -0
- package/dist/esm/utility/dto/auto-context-push.utility.js.map +1 -0
- package/dist/esm/utility/dto/build-decorator.utility.js +9 -1
- package/dist/esm/utility/dto/build-decorator.utility.js.map +1 -1
- package/dist/esm/utility/dto/generate-dynamic.utility.js +21 -13
- package/dist/esm/utility/dto/generate-dynamic.utility.js.map +1 -1
- package/dist/esm/utility/dto/generate.utility.js +35 -27
- package/dist/esm/utility/dto/generate.utility.js.map +1 -1
- package/dist/esm/utility/dto/index.d.ts +2 -1
- package/dist/esm/utility/get-auto-dto-context.utility.d.ts +7 -0
- package/dist/esm/utility/get-auto-dto-context.utility.js +17 -0
- package/dist/esm/utility/get-auto-dto-context.utility.js.map +1 -0
- package/dist/esm/utility/index.d.ts +9 -0
- package/dist/esm/utility/is-entity-constructor.utility.d.ts +8 -0
- package/dist/esm/utility/is-entity-constructor.utility.js +11 -0
- package/dist/esm/utility/is-entity-constructor.utility.js.map +1 -0
- package/dist/esm/utility/is-entity-factory.utility.d.ts +8 -0
- package/dist/esm/utility/is-entity-factory.utility.js +13 -0
- package/dist/esm/utility/is-entity-factory.utility.js.map +1 -0
- package/dist/esm/utility/is-entity-literal.utility.d.ts +7 -0
- package/dist/esm/utility/is-entity-literal.utility.js +11 -0
- package/dist/esm/utility/is-entity-literal.utility.js.map +1 -0
- package/dist/esm/utility/queue-auto-context-retry.utility.d.ts +6 -0
- package/dist/esm/utility/queue-auto-context-retry.utility.js +21 -0
- package/dist/esm/utility/queue-auto-context-retry.utility.js.map +1 -0
- package/dist/esm/utility/register-auto-dto-child.utility.d.ts +14 -0
- package/dist/esm/utility/register-auto-dto-child.utility.js +66 -0
- package/dist/esm/utility/register-auto-dto-child.utility.js.map +1 -0
- package/dist/esm/utility/resolve/decorator-context.utility.d.ts +13 -0
- package/dist/esm/utility/resolve/decorator-context.utility.js +29 -0
- package/dist/esm/utility/resolve/decorator-context.utility.js.map +1 -0
- package/dist/esm/utility/resolve/index.d.ts +2 -0
- package/dist/esm/utility/resolve/property-entity.utility.d.ts +16 -0
- package/dist/esm/utility/resolve/property-entity.utility.js +40 -0
- package/dist/esm/utility/resolve/property-entity.utility.js.map +1 -0
- package/dist/esm/utility/with-resolved-property-entity.utility.d.ts +11 -0
- package/dist/esm/utility/with-resolved-property-entity.utility.js +28 -0
- package/dist/esm/utility/with-resolved-property-entity.utility.js.map +1 -0
- package/package.json +4 -1
- package/dist/cjs/utility/dto/analize.utility.d.ts +0 -8
- package/dist/cjs/utility/dto/analize.utility.js +0 -17
- package/dist/cjs/utility/dto/analize.utility.js.map +0 -1
- package/dist/esm/utility/dto/analize.utility.d.ts +0 -8
- package/dist/esm/utility/dto/analize.utility.js +0 -15
- package/dist/esm/utility/dto/analize.utility.js.map +0 -1
|
@@ -30,6 +30,8 @@ var isShouldBeGenerated_utility = require('./is-should-be-generated.utility.js')
|
|
|
30
30
|
var errorException_utility = require('../error-exception.utility.js');
|
|
31
31
|
var hasPairedCustomSuffixesFields_validator = require('../../validator/has-paired-custom-suffixes-fields.validator.js');
|
|
32
32
|
var classValidator = require('class-validator');
|
|
33
|
+
var autoContextPop_utility = require('./auto-context-pop.utility.js');
|
|
34
|
+
var autoContextPush_utility = require('./auto-context-push.utility.js');
|
|
33
35
|
|
|
34
36
|
const dtoGenerateCache = new Map();
|
|
35
37
|
/**
|
|
@@ -125,40 +127,46 @@ function DtoGenerate(entity, entityMetadata, method, dtoType, dtoConfig, current
|
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
129
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
130
|
+
autoContextPush_utility.DtoAutoContextPush(GeneratedDTO.prototype, method, dtoType);
|
|
131
|
+
try {
|
|
132
|
+
for (const property of markedProperties) {
|
|
133
|
+
const generatedDTOs = generateDynamic_utility.DtoGenerateDynamic(method, property.metadata, entityMetadata, dtoType, property.name, currentGuard);
|
|
134
|
+
const decorators = buildDecorator_utility.DtoBuildDecorator(method, property.metadata, entityMetadata, dtoType, property.name, currentGuard, generatedDTOs);
|
|
135
|
+
if (decorators) {
|
|
136
|
+
for (const [, decorator] of decorators.entries()) {
|
|
137
|
+
if (method === routeType_enum.EApiRouteType.GET_LIST && dtoType === dtoType_enum.EApiDtoType.QUERY) {
|
|
138
|
+
decorator(GeneratedDTO.prototype, `${property.name}[value]`);
|
|
139
|
+
generateFilterDecorator_utility.DtoGenerateFilterDecorator(property.metadata, entityMetadata)(GeneratedDTO.prototype, `${property.name}[operator]`);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
decorator(GeneratedDTO.prototype, property.name);
|
|
143
|
+
}
|
|
139
144
|
}
|
|
140
145
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
if (method === routeType_enum.EApiRouteType.GET_LIST && dtoType === dtoType_enum.EApiDtoType.QUERY) {
|
|
147
|
+
// @ts-ignore
|
|
148
|
+
const metadataArray = { ...property.metadata, isArray: true, isUniqueItems: false, maxItems: generate_constant.DTO_GENERATE_CONSTANT.MAXIMUM_FILTER_PROPERTIES, minItems: generate_constant.DTO_GENERATE_CONSTANT.MINIMUM_FILTER_PROPERTIES };
|
|
149
|
+
const decoratorsArray = buildDecorator_utility.DtoBuildDecorator(method, metadataArray, entityMetadata, dtoType, property.name, currentGuard);
|
|
150
|
+
if (decoratorsArray) {
|
|
151
|
+
for (const [, decorator] of decoratorsArray.entries()) {
|
|
152
|
+
decorator(GeneratedDTO.prototype, `${property.name}[values]`);
|
|
153
|
+
}
|
|
149
154
|
}
|
|
150
155
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
if (property.metadata.type === desribeType_enum.EApiPropertyDescribeType.OBJECT && Array.isArray(property.metadata.dataType)) {
|
|
157
|
+
// @ts-ignore
|
|
158
|
+
extraModels.push(...property.metadata.dataType);
|
|
159
|
+
}
|
|
160
|
+
if (generatedDTOs) {
|
|
161
|
+
for (const [, value] of Object.entries(generatedDTOs)) {
|
|
162
|
+
extraModels.push(value);
|
|
163
|
+
}
|
|
159
164
|
}
|
|
160
165
|
}
|
|
161
166
|
}
|
|
167
|
+
finally {
|
|
168
|
+
autoContextPop_utility.DtoAutoContextPop(GeneratedDTO.prototype);
|
|
169
|
+
}
|
|
162
170
|
if (dtoConfig?.validators) {
|
|
163
171
|
for (const validator of dtoConfig.validators) {
|
|
164
172
|
classValidator.Validate(validator.constraintClass, validator.options)(GeneratedDTO.prototype, "object");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.utility.js","sources":["../../../../../src/utility/dto/generate.utility.ts"],"sourcesContent":[null],"names":["DtoIsShouldBeGenerated","DtoGenerateCacheKey","PROPERTY_DESCRIBE_DECORATOR_API_CONSTANT","ErrorException","DtoIsPropertyShouldBeMarked","EApiRouteType","EApiDtoType","DtoGetGetListQueryBaseClass","DtoGenerateDynamic","DtoBuildDecorator","DtoGenerateFilterDecorator","DTO_GENERATE_CONSTANT","EApiPropertyDescribeType","Validate","HasPairedCustomSuffixesFieldsValidator","ApiExtraModels","CamelCaseString","DtoGenerateGetListResponse"],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate.utility.js","sources":["../../../../../src/utility/dto/generate.utility.ts"],"sourcesContent":[null],"names":["DtoIsShouldBeGenerated","DtoGenerateCacheKey","PROPERTY_DESCRIBE_DECORATOR_API_CONSTANT","ErrorException","DtoIsPropertyShouldBeMarked","EApiRouteType","EApiDtoType","DtoGetGetListQueryBaseClass","DtoAutoContextPush","DtoGenerateDynamic","DtoBuildDecorator","DtoGenerateFilterDecorator","DTO_GENERATE_CONSTANT","EApiPropertyDescribeType","DtoAutoContextPop","Validate","HasPairedCustomSuffixesFieldsValidator","ApiExtraModels","CamelCaseString","DtoGenerateGetListResponse"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,gBAAgB,GAA+B,IAAI,GAAG,EAAyB;AAErF;;;;;;;;;;;;;AAaG;AACG,SAAU,WAAW,CAAI,MAAqB,EAAE,cAA6B,EAAE,MAAqB,EAAE,OAAoB,EAAE,SAAsD,EAAE,YAA+B,EAAA;IACxN,IAAI,CAACA,kDAAsB,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE;AAC7C,QAAA,OAAO,SAAS;IACjB;IAEA,MAAM,QAAQ,GAAWC,4CAAmB,CAAC;QAC5C,SAAS;QACT,OAAO;AACP,QAAA,UAAU,EAAE,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC;QACvC,SAAS,EAAE,YAAY,EAAE,IAAI;QAC7B,MAAM;AACN,KAAA,CAAC;IAEF,MAAM,MAAM,GAA8B,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC;IAExE,IAAI,MAAM,EAAE;AACX,QAAA,OAAO,MAAM;IACd;AAEA,IAAA,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,QAAQ,GAAGC,kEAAwC,CAAC,YAAY,CAAC,EAAE;QAClG,MAAMC,qCAAc,CAAC,CAAA,uBAAA,EAA0B,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA,8BAAA,CAAgC,CAAC;IAC5G;;IAGA,MAAM,WAAW,GAAoB,EAAE;IAEvC,MAAM,gBAAgB,GAIjB,EAAE;AAEP,IAAA,KAAK,MAAM,MAAM,IAAI,cAAc,CAAC,OAAO,EAAE;AAC5C,QAAA,IAAI,MAAM,CAAC,QAA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,CAAA,EAAGC,uCAAe,CAAC,MAAM,CAAC,CAAA,EAAGA,uCAAe,CAAC,OAAO,CAAC,CAAA,GAAA,CAAK;AAC5G,KAAA,CAAC;;IAGF,MAAM,MAAM,GAAkB,MAAM,KAAKb,4BAAa,CAAC,QAAQ,IAAI,OAAO,KAAKC,wBAAW,CAAC,QAAQ,GAAGa,0DAA0B,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,cAAc,CAAC,IAAI,IAAI,iBAAiB,GAAGD,uCAAe,CAAC,MAAM,CAAC,CAAA,EAAGA,uCAAe,CAAC,OAAO,CAAC,CAAA,QAAA,CAAU,CAAC,GAAG,YAAY;AAEjR,IAAA,gBAAgB,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC;AAEtC,IAAA,OAAO,MAAM;AACd;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { DtoAutoContextPop } from './auto-context-pop.utility';
|
|
2
|
+
export { DtoAutoContextPush } from './auto-context-push.utility';
|
|
2
3
|
export { DtoBuildDecorator } from './build-decorator.utility';
|
|
3
4
|
export { DtoGenerateCacheKey } from './generate-cache-key.utility';
|
|
4
5
|
export { DtoGenerateDecorator } from './generate-decorator.utility';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IDtoAutoContextMetadata } from '../type/auto-context-metadata.type';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieves stored DTO auto-context (route method + dto type) for a generated DTO prototype.
|
|
4
|
+
* @param {object} target - DTO prototype that may contain context metadata.
|
|
5
|
+
* @returns {IDtoAutoContextMetadata | undefined} Stored context metadata if available.
|
|
6
|
+
*/
|
|
7
|
+
export declare function GetAutoDtoContext(target: object): IDtoAutoContextMetadata | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var autoContext_constant = require('../constant/dto/auto-context.constant.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Retrieves stored DTO auto-context (route method + dto type) for a generated DTO prototype.
|
|
7
|
+
* @param {object} target - DTO prototype that may contain context metadata.
|
|
8
|
+
* @returns {IDtoAutoContextMetadata | undefined} Stored context metadata if available.
|
|
9
|
+
*/
|
|
10
|
+
function GetAutoDtoContext(target) {
|
|
11
|
+
const stack = Reflect.getMetadata?.(autoContext_constant.DTO_AUTO_CONTEXT_METADATA_KEY, target);
|
|
12
|
+
if (!stack || stack.length === 0) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
return stack.at(-1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
exports.GetAutoDtoContext = GetAutoDtoContext;
|
|
19
|
+
//# sourceMappingURL=get-auto-dto-context.utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-auto-dto-context.utility.js","sources":["../../../../src/utility/get-auto-dto-context.utility.ts"],"sourcesContent":[null],"names":["DTO_AUTO_CONTEXT_METADATA_KEY"],"mappings":";;;;AAIA;;;;AAIG;AACG,SAAU,iBAAiB,CAAC,MAAc,EAAA;IAC/C,MAAM,KAAK,GAA+C,OAAO,CAAC,WAAW,GAAGA,kDAA6B,EAAE,MAAM,CAA+C;IAEpK,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;AACjC,QAAA,OAAO,SAAS;IACjB;AAEA,IAAA,OAAO,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;AACpB;;;;"}
|
|
@@ -2,10 +2,19 @@ export * from './api/index';
|
|
|
2
2
|
export * from './authorization/index';
|
|
3
3
|
export { CamelCaseString } from './camel-case-string.utility';
|
|
4
4
|
export { CapitalizeString } from './capitalize-string.utility';
|
|
5
|
+
export { DeferPropertyDecoratorExecution } from './defer-property-decorator-execution.utility';
|
|
5
6
|
export * from './dto/index';
|
|
6
7
|
export { ErrorException } from './error-exception.utility';
|
|
7
8
|
export { ErrorString } from './error-string.utility';
|
|
8
9
|
export { GenerateEntityInformation } from './generate-entity-information.utility';
|
|
10
|
+
export { GetAutoDtoContext } from './get-auto-dto-context.utility';
|
|
9
11
|
export { GetEntityColumns } from './get-entity-columns.utility';
|
|
12
|
+
export { IsEntityConstructor } from './is-entity-constructor.utility';
|
|
13
|
+
export { IsEntityFactory } from './is-entity-factory.utility';
|
|
14
|
+
export { IsEntityLiteral } from './is-entity-literal.utility';
|
|
10
15
|
export { IsErrorOfType } from './is-error-of-type.utility';
|
|
11
16
|
export { LoggerUtility } from './logger.utility';
|
|
17
|
+
export { QueueAutoContextRetry } from './queue-auto-context-retry.utility';
|
|
18
|
+
export { GetRegisteredAutoDtoChildren, RegisterAutoDtoChild } from './register-auto-dto-child.utility';
|
|
19
|
+
export * from './resolve/index';
|
|
20
|
+
export { WithResolvedPropertyEntity } from './with-resolved-property-entity.utility';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IApiBaseEntity } from '../interface/api-base-entity.interface';
|
|
2
|
+
import type { Type } from "@nestjs/common";
|
|
3
|
+
/**
|
|
4
|
+
* Checks whether the candidate is a class constructor reference.
|
|
5
|
+
* @param {unknown} candidate - Value to inspect.
|
|
6
|
+
* @returns {boolean} True when candidate is a constructor function.
|
|
7
|
+
*/
|
|
8
|
+
export declare function IsEntityConstructor(candidate: unknown): candidate is Type<IApiBaseEntity>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Checks whether the candidate is a class constructor reference.
|
|
5
|
+
* @param {unknown} candidate - Value to inspect.
|
|
6
|
+
* @returns {boolean} True when candidate is a constructor function.
|
|
7
|
+
*/
|
|
8
|
+
function IsEntityConstructor(candidate) {
|
|
9
|
+
return typeof candidate === "function" && Object.prototype.hasOwnProperty.call(candidate, "prototype");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
exports.IsEntityConstructor = IsEntityConstructor;
|
|
13
|
+
//# sourceMappingURL=is-entity-constructor.utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-entity-constructor.utility.js","sources":["../../../../src/utility/is-entity-constructor.utility.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAGA;;;;AAIG;AACG,SAAU,mBAAmB,CAAC,SAAkB,EAAA;AACrD,IAAA,OAAO,OAAO,SAAS,KAAK,UAAU,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC;AACvG;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IApiBaseEntity } from '../interface/api-base-entity.interface';
|
|
2
|
+
import type { Type } from "@nestjs/common";
|
|
3
|
+
/**
|
|
4
|
+
* Checks whether the candidate is a factory returning an entity reference.
|
|
5
|
+
* @param {unknown} candidate - Value to inspect.
|
|
6
|
+
* @returns {boolean} True when candidate is a lazy resolver function.
|
|
7
|
+
*/
|
|
8
|
+
export declare function IsEntityFactory(candidate: unknown): candidate is () => IApiBaseEntity | Type<IApiBaseEntity> | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var isEntityConstructor_utility = require('./is-entity-constructor.utility.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Checks whether the candidate is a factory returning an entity reference.
|
|
7
|
+
* @param {unknown} candidate - Value to inspect.
|
|
8
|
+
* @returns {boolean} True when candidate is a lazy resolver function.
|
|
9
|
+
*/
|
|
10
|
+
function IsEntityFactory(candidate) {
|
|
11
|
+
return typeof candidate === "function" && !isEntityConstructor_utility.IsEntityConstructor(candidate);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.IsEntityFactory = IsEntityFactory;
|
|
15
|
+
//# sourceMappingURL=is-entity-factory.utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-entity-factory.utility.js","sources":["../../../../src/utility/is-entity-factory.utility.ts"],"sourcesContent":[null],"names":["IsEntityConstructor"],"mappings":";;;;AAKA;;;;AAIG;AACG,SAAU,eAAe,CAAC,SAAkB,EAAA;IACjD,OAAO,OAAO,SAAS,KAAK,UAAU,IAAI,CAACA,+CAAmB,CAAC,SAAS,CAAC;AAC1E;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IApiBaseEntity } from '../interface/api-base-entity.interface';
|
|
2
|
+
/**
|
|
3
|
+
* Checks whether the candidate is an object literal representing metadata.
|
|
4
|
+
* @param {unknown} candidate - Value to inspect.
|
|
5
|
+
* @returns {boolean} True when candidate is a non-null object.
|
|
6
|
+
*/
|
|
7
|
+
export declare function IsEntityLiteral(candidate: unknown): candidate is IApiBaseEntity;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Checks whether the candidate is an object literal representing metadata.
|
|
5
|
+
* @param {unknown} candidate - Value to inspect.
|
|
6
|
+
* @returns {boolean} True when candidate is a non-null object.
|
|
7
|
+
*/
|
|
8
|
+
function IsEntityLiteral(candidate) {
|
|
9
|
+
return typeof candidate === "object" && candidate !== null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
exports.IsEntityLiteral = IsEntityLiteral;
|
|
13
|
+
//# sourceMappingURL=is-entity-literal.utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-entity-literal.utility.js","sources":["../../../../src/utility/is-entity-literal.utility.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;AAIG;AACG,SAAU,eAAe,CAAC,SAAkB,EAAA;IACjD,OAAO,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,IAAI;AAC3D;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Queues execution until auto DTO context becomes available on the provided prototype.
|
|
3
|
+
* @param {object} target - DTO prototype awaiting context.
|
|
4
|
+
* @param {() => void} executor - Callback to execute once context is ready.
|
|
5
|
+
*/
|
|
6
|
+
export declare function QueueAutoContextRetry(target: object, executor: () => void): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var autoDtoContextQueue_utility = require('./auto-dto-context-queue.utility.js');
|
|
4
|
+
var getAutoDtoContext_utility = require('./get-auto-dto-context.utility.js');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Queues execution until auto DTO context becomes available on the provided prototype.
|
|
8
|
+
* @param {object} target - DTO prototype awaiting context.
|
|
9
|
+
* @param {() => void} executor - Callback to execute once context is ready.
|
|
10
|
+
*/
|
|
11
|
+
function QueueAutoContextRetry(target, executor) {
|
|
12
|
+
const context = getAutoDtoContext_utility.GetAutoDtoContext(target);
|
|
13
|
+
if (context) {
|
|
14
|
+
executor();
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
autoDtoContextQueue_utility.QueueAutoDtoContextExecution(target, () => {
|
|
18
|
+
executor();
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
exports.QueueAutoContextRetry = QueueAutoContextRetry;
|
|
23
|
+
//# sourceMappingURL=queue-auto-context-retry.utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue-auto-context-retry.utility.js","sources":["../../../../src/utility/queue-auto-context-retry.utility.ts"],"sourcesContent":[null],"names":["GetAutoDtoContext","QueueAutoDtoContextExecution"],"mappings":";;;;;AAKA;;;;AAIG;AACG,SAAU,qBAAqB,CAAC,MAAc,EAAE,QAAoB,EAAA;AACzE,IAAA,MAAM,OAAO,GAAgEA,2CAAiB,CAAC,MAAM,CAAC;IAEtG,IAAI,OAAO,EAAE;AACZ,QAAA,QAAQ,EAAE;QAEV;IACD;AAEA,IAAAC,wDAA4B,CAAC,MAAM,EAAE,MAAK;AACzC,QAAA,QAAQ,EAAE;AACX,IAAA,CAAC,CAAC;AACH;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Type } from "@nestjs/common";
|
|
2
|
+
/**
|
|
3
|
+
* Returns registered child DTO constructors for the provided parent prototype.
|
|
4
|
+
* @param {object} parentPrototype - Parent DTO prototype.
|
|
5
|
+
* @returns {Set<Type<unknown>> | undefined} Set of registered child constructors.
|
|
6
|
+
*/
|
|
7
|
+
export declare function GetRegisteredAutoDtoChildren(parentPrototype: object): Set<Type<unknown>> | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Registers DTO constructors as children of the provided parent prototype.
|
|
10
|
+
* Used to propagate auto DTO context to nested manual DTOs.
|
|
11
|
+
* @param {object} parentPrototype - Parent DTO prototype.
|
|
12
|
+
* @param {unknown} child - Child constructor or array of constructors.
|
|
13
|
+
*/
|
|
14
|
+
export declare function RegisterAutoDtoChild(parentPrototype: object, child: unknown): void;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var autoContext_constant = require('../constant/dto/auto-context.constant.js');
|
|
4
|
+
var autoDtoContextQueue_utility = require('./auto-dto-context-queue.utility.js');
|
|
5
|
+
|
|
6
|
+
const AUTO_DTO_CHILDREN = new WeakMap();
|
|
7
|
+
/**
|
|
8
|
+
* Returns registered child DTO constructors for the provided parent prototype.
|
|
9
|
+
* @param {object} parentPrototype - Parent DTO prototype.
|
|
10
|
+
* @returns {Set<Type<unknown>> | undefined} Set of registered child constructors.
|
|
11
|
+
*/
|
|
12
|
+
function GetRegisteredAutoDtoChildren(parentPrototype) {
|
|
13
|
+
return AUTO_DTO_CHILDREN.get(parentPrototype);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Registers DTO constructors as children of the provided parent prototype.
|
|
17
|
+
* Used to propagate auto DTO context to nested manual DTOs.
|
|
18
|
+
* @param {object} parentPrototype - Parent DTO prototype.
|
|
19
|
+
* @param {unknown} child - Child constructor or array of constructors.
|
|
20
|
+
*/
|
|
21
|
+
function RegisterAutoDtoChild(parentPrototype, child) {
|
|
22
|
+
if (!parentPrototype || !child)
|
|
23
|
+
return;
|
|
24
|
+
if (Array.isArray(child)) {
|
|
25
|
+
for (const entry of child) {
|
|
26
|
+
RegisterAutoDtoChild(parentPrototype, entry);
|
|
27
|
+
}
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (typeof child === "function") {
|
|
31
|
+
const childConstructor = child;
|
|
32
|
+
let children = AUTO_DTO_CHILDREN.get(parentPrototype);
|
|
33
|
+
if (!children) {
|
|
34
|
+
children = new Set();
|
|
35
|
+
AUTO_DTO_CHILDREN.set(parentPrototype, children);
|
|
36
|
+
}
|
|
37
|
+
if (!children.has(childConstructor)) {
|
|
38
|
+
children.add(childConstructor);
|
|
39
|
+
inheritExistingContexts(parentPrototype, childConstructor.prototype);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Copies currently active auto DTO contexts from parent prototype to child prototype.
|
|
45
|
+
* @param {object} parentPrototype - Parent DTO prototype.
|
|
46
|
+
* @param {object} childPrototype - Child DTO prototype.
|
|
47
|
+
*/
|
|
48
|
+
function inheritExistingContexts(parentPrototype, childPrototype) {
|
|
49
|
+
const parentStack = Reflect.getMetadata?.(autoContext_constant.DTO_AUTO_CONTEXT_METADATA_KEY, parentPrototype);
|
|
50
|
+
if (!parentStack || parentStack.length === 0) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const childStack = Reflect.getMetadata?.(autoContext_constant.DTO_AUTO_CONTEXT_METADATA_KEY, childPrototype) ?? [];
|
|
54
|
+
if (childStack.length < parentStack.length) {
|
|
55
|
+
const updatedStack = [...childStack, ...parentStack.slice(childStack.length)];
|
|
56
|
+
Reflect.defineMetadata?.(autoContext_constant.DTO_AUTO_CONTEXT_METADATA_KEY, updatedStack, childPrototype);
|
|
57
|
+
autoDtoContextQueue_utility.FlushAutoDtoContextExecutions(childPrototype);
|
|
58
|
+
}
|
|
59
|
+
const grandchildren = AUTO_DTO_CHILDREN.get(childPrototype);
|
|
60
|
+
if (!grandchildren)
|
|
61
|
+
return;
|
|
62
|
+
for (const grandchild of grandchildren) {
|
|
63
|
+
inheritExistingContexts(childPrototype, grandchild.prototype);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
exports.GetRegisteredAutoDtoChildren = GetRegisteredAutoDtoChildren;
|
|
68
|
+
exports.RegisterAutoDtoChild = RegisterAutoDtoChild;
|
|
69
|
+
//# sourceMappingURL=register-auto-dto-child.utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-auto-dto-child.utility.js","sources":["../../../../src/utility/register-auto-dto-child.utility.ts"],"sourcesContent":[null],"names":["DTO_AUTO_CONTEXT_METADATA_KEY","FlushAutoDtoContextExecutions"],"mappings":";;;;;AAMA,MAAM,iBAAiB,GAAwC,IAAI,OAAO,EAA8B;AAExG;;;;AAIG;AACG,SAAU,4BAA4B,CAAC,eAAuB,EAAA;AACnE,IAAA,OAAO,iBAAiB,CAAC,GAAG,CAAC,eAAe,CAAC;AAC9C;AAEA;;;;;AAKG;AACG,SAAU,oBAAoB,CAAC,eAAuB,EAAE,KAAc,EAAA;AAC3E,IAAA,IAAI,CAAC,eAAe,IAAI,CAAC,KAAK;QAAE;AAEhC,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AACzB,QAAA,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE;AAC1B,YAAA,oBAAoB,CAAC,eAAe,EAAE,KAAK,CAAC;QAC7C;QAEA;IACD;AAEA,IAAA,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE;QAChC,MAAM,gBAAgB,GAAkB,KAAsB;QAC9D,IAAI,QAAQ,GAAmC,iBAAiB,CAAC,GAAG,CAAC,eAAe,CAAC;QAErF,IAAI,CAAC,QAAQ,EAAE;AACd,YAAA,QAAQ,GAAG,IAAI,GAAG,EAAiB;AACnC,YAAA,iBAAiB,CAAC,GAAG,CAAC,eAAe,EAAE,QAAQ,CAAC;QACjD;QAEA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE;AACpC,YAAA,QAAQ,CAAC,GAAG,CAAC,gBAAgB,CAAC;AAC9B,YAAA,uBAAuB,CAAC,eAAe,EAAE,gBAAgB,CAAC,SAAmB,CAAC;QAC/E;IACD;AACD;AAEA;;;;AAIG;AACH,SAAS,uBAAuB,CAAC,eAAuB,EAAE,cAAsB,EAAA;IAC/E,MAAM,WAAW,GAA+C,OAAO,CAAC,WAAW,GAAGA,kDAA6B,EAAE,eAAe,CAA+C;IAEnL,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;QAC7C;IACD;AAEA,IAAA,MAAM,UAAU,GAAoC,OAAO,CAAC,WAAW,GAAGA,kDAA6B,EAAE,cAAc,CAAoC,IAAI,EAAE;IAEjK,IAAI,UAAU,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE;AAC3C,QAAA,MAAM,YAAY,GAAmC,CAAC,GAAG,UAAU,EAAE,GAAG,WAAW,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAC7G,OAAO,CAAC,cAAc,GAAGA,kDAA6B,EAAE,YAAY,EAAE,cAAc,CAAC;QACrFC,yDAA6B,CAAC,cAAc,CAAC;IAC9C;IAEA,MAAM,aAAa,GAAmC,iBAAiB,CAAC,GAAG,CAAC,cAAc,CAAC;AAE3F,IAAA,IAAI,CAAC,aAAa;QAAE;AAEpB,IAAA,KAAK,MAAM,UAAU,IAAI,aAAa,EAAE;AACvC,QAAA,uBAAuB,CAAC,cAAc,EAAE,UAAU,CAAC,SAAmB,CAAC;IACxE;AACD;;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EApiDtoType, EApiRouteType } from '../../enum/index';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves decorator context using explicit config or auto-propagated DTO metadata.
|
|
4
|
+
* @param {object} target - Decorated DTO prototype.
|
|
5
|
+
* @param {EApiRouteType | undefined} method - Explicit method override.
|
|
6
|
+
* @param {EApiDtoType | undefined} dtoType - Explicit DTO type override.
|
|
7
|
+
* @param {boolean} shouldAutoResolve - Whether to pull context from auto DTO pipeline.
|
|
8
|
+
* @returns {{ dtoType: EApiDtoType; method: EApiRouteType } | undefined} Resolved context if available.
|
|
9
|
+
*/
|
|
10
|
+
export declare function ResolveDecoratorContext(target: object, method: EApiRouteType | undefined, dtoType: EApiDtoType | undefined, shouldAutoResolve: boolean): {
|
|
11
|
+
dtoType: EApiDtoType;
|
|
12
|
+
method: EApiRouteType;
|
|
13
|
+
} | undefined;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var getAutoDtoContext_utility = require('../get-auto-dto-context.utility.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Resolves decorator context using explicit config or auto-propagated DTO metadata.
|
|
7
|
+
* @param {object} target - Decorated DTO prototype.
|
|
8
|
+
* @param {EApiRouteType | undefined} method - Explicit method override.
|
|
9
|
+
* @param {EApiDtoType | undefined} dtoType - Explicit DTO type override.
|
|
10
|
+
* @param {boolean} shouldAutoResolve - Whether to pull context from auto DTO pipeline.
|
|
11
|
+
* @returns {{ dtoType: EApiDtoType; method: EApiRouteType } | undefined} Resolved context if available.
|
|
12
|
+
*/
|
|
13
|
+
function ResolveDecoratorContext(target, method, dtoType, shouldAutoResolve) {
|
|
14
|
+
let resolvedMethod = method;
|
|
15
|
+
let resolvedDtoType = dtoType;
|
|
16
|
+
if (shouldAutoResolve && (!resolvedMethod || !resolvedDtoType)) {
|
|
17
|
+
const context = getAutoDtoContext_utility.GetAutoDtoContext(target);
|
|
18
|
+
if (!context) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
resolvedMethod ??= context.method;
|
|
22
|
+
resolvedDtoType ??= context.dtoType;
|
|
23
|
+
}
|
|
24
|
+
if (!resolvedMethod || !resolvedDtoType) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
return { dtoType: resolvedDtoType, method: resolvedMethod };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports.ResolveDecoratorContext = ResolveDecoratorContext;
|
|
31
|
+
//# sourceMappingURL=decorator-context.utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorator-context.utility.js","sources":["../../../../../src/utility/resolve/decorator-context.utility.ts"],"sourcesContent":[null],"names":["GetAutoDtoContext"],"mappings":";;;;AAIA;;;;;;;AAOG;AACG,SAAU,uBAAuB,CAAC,MAAc,EAAE,MAAiC,EAAE,OAAgC,EAAE,iBAA0B,EAAA;IACtJ,IAAI,cAAc,GAA8B,MAAM;IACtD,IAAI,eAAe,GAA4B,OAAO;IAEtD,IAAI,iBAAiB,KAAK,CAAC,cAAc,IAAI,CAAC,eAAe,CAAC,EAAE;AAC/D,QAAA,MAAM,OAAO,GAAgEA,2CAAiB,CAAC,MAAM,CAAC;QAEtG,IAAI,CAAC,OAAO,EAAE;AACb,YAAA,OAAO,SAAS;QACjB;AAEA,QAAA,cAAc,KAAK,OAAO,CAAC,MAAM;AACjC,QAAA,eAAe,KAAK,OAAO,CAAC,OAAO;IACpC;AAEA,IAAA,IAAI,CAAC,cAAc,IAAI,CAAC,eAAe,EAAE;AACxC,QAAA,OAAO,SAAS;IACjB;IAEA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE;AAC5D;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IApiBaseEntity } from '../../interface/api-base-entity.interface';
|
|
2
|
+
import type { Type } from "@nestjs/common";
|
|
3
|
+
import type { TApiPropertyEntity } from '../../type/index';
|
|
4
|
+
/**
|
|
5
|
+
* Resolves property decorator entity references immediately or throws if unavailable.
|
|
6
|
+
* @param {TApiPropertyEntity} entity - Entity reference or resolver.
|
|
7
|
+
* @param {string} decoratorName - Decorator name for error context.
|
|
8
|
+
* @returns {IApiBaseEntity | Type<IApiBaseEntity>} Normalized entity reference.
|
|
9
|
+
*/
|
|
10
|
+
export declare function ResolvePropertyEntity(entity: TApiPropertyEntity, decoratorName: string): IApiBaseEntity | Type<IApiBaseEntity>;
|
|
11
|
+
/**
|
|
12
|
+
* Attempts to resolve the entity reference without throwing when the resolver returns undefined.
|
|
13
|
+
* @param {TApiPropertyEntity} entity - Entity reference or factory.
|
|
14
|
+
* @returns {IApiBaseEntity | Type<IApiBaseEntity> | undefined} Resolved entity or undefined when not ready.
|
|
15
|
+
*/
|
|
16
|
+
export declare function TryResolvePropertyEntity(entity: TApiPropertyEntity): IApiBaseEntity | Type<IApiBaseEntity> | undefined;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var errorException_utility = require('../error-exception.utility.js');
|
|
4
|
+
var isEntityConstructor_utility = require('../is-entity-constructor.utility.js');
|
|
5
|
+
var isEntityFactory_utility = require('../is-entity-factory.utility.js');
|
|
6
|
+
var isEntityLiteral_utility = require('../is-entity-literal.utility.js');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Resolves property decorator entity references immediately or throws if unavailable.
|
|
10
|
+
* @param {TApiPropertyEntity} entity - Entity reference or resolver.
|
|
11
|
+
* @param {string} decoratorName - Decorator name for error context.
|
|
12
|
+
* @returns {IApiBaseEntity | Type<IApiBaseEntity>} Normalized entity reference.
|
|
13
|
+
*/
|
|
14
|
+
function ResolvePropertyEntity(entity, decoratorName) {
|
|
15
|
+
// eslint-disable-next-line @elsikora/sonar/use-type-alias
|
|
16
|
+
const resolved = TryResolvePropertyEntity(entity);
|
|
17
|
+
if (!resolved) {
|
|
18
|
+
throw errorException_utility.ErrorException(`Entity for ${decoratorName} could not be resolved. Provide the entity class or a factory that returns it.`);
|
|
19
|
+
}
|
|
20
|
+
return resolved;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Attempts to resolve the entity reference without throwing when the resolver returns undefined.
|
|
24
|
+
* @param {TApiPropertyEntity} entity - Entity reference or factory.
|
|
25
|
+
* @returns {IApiBaseEntity | Type<IApiBaseEntity> | undefined} Resolved entity or undefined when not ready.
|
|
26
|
+
*/
|
|
27
|
+
function TryResolvePropertyEntity(entity) {
|
|
28
|
+
if (isEntityConstructor_utility.IsEntityConstructor(entity)) {
|
|
29
|
+
return entity;
|
|
30
|
+
}
|
|
31
|
+
if (isEntityLiteral_utility.IsEntityLiteral(entity)) {
|
|
32
|
+
return entity;
|
|
33
|
+
}
|
|
34
|
+
if (isEntityFactory_utility.IsEntityFactory(entity)) {
|
|
35
|
+
const factory = entity;
|
|
36
|
+
return factory();
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
exports.ResolvePropertyEntity = ResolvePropertyEntity;
|
|
42
|
+
exports.TryResolvePropertyEntity = TryResolvePropertyEntity;
|
|
43
|
+
//# sourceMappingURL=property-entity.utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property-entity.utility.js","sources":["../../../../../src/utility/resolve/property-entity.utility.ts"],"sourcesContent":[null],"names":["ErrorException","IsEntityConstructor","IsEntityLiteral","IsEntityFactory"],"mappings":";;;;;;;AASA;;;;;AAKG;AACG,SAAU,qBAAqB,CAAC,MAA0B,EAAE,aAAqB,EAAA;;AAEtF,IAAA,MAAM,QAAQ,GAAsD,wBAAwB,CAAC,MAAM,CAAC;IAEpG,IAAI,CAAC,QAAQ,EAAE;AACd,QAAA,MAAMA,qCAAc,CAAC,CAAA,WAAA,EAAc,aAAa,CAAA,8EAAA,CAAgF,CAAC;IAClI;AAEA,IAAA,OAAO,QAAQ;AAChB;AAEA;;;;AAIG;AACG,SAAU,wBAAwB,CAAC,MAA0B,EAAA;AAClE,IAAA,IAAIC,+CAAmB,CAAC,MAAM,CAAC,EAAE;AAChC,QAAA,OAAO,MAAM;IACd;AAEA,IAAA,IAAIC,uCAAe,CAAC,MAAM,CAAC,EAAE;AAC5B,QAAA,OAAO,MAAM;IACd;AAEA,IAAA,IAAIC,uCAAe,CAAC,MAAM,CAAC,EAAE;QAC5B,MAAM,OAAO,GAA4D,MAAM;QAE/E,OAAO,OAAO,EAAE;IACjB;AAEA,IAAA,OAAO,SAAS;AACjB;;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IApiBaseEntity } from '../interface/api-base-entity.interface';
|
|
2
|
+
import type { Type } from "@nestjs/common";
|
|
3
|
+
import type { TApiPropertyEntity } from '../type/decorator/api/property/entity.type';
|
|
4
|
+
/**
|
|
5
|
+
* Executes the provided callback once the entity reference resolves.
|
|
6
|
+
* If the entity cannot be resolved immediately, the callback runs in a microtask after modules finish loading.
|
|
7
|
+
* @param {TApiPropertyEntity} entity - Entity reference or resolver.
|
|
8
|
+
* @param {string} decoratorName - Decorator name for error context.
|
|
9
|
+
* @param {(resolved: IApiBaseEntity | Type<IApiBaseEntity>) => void} onResolved - Callback executed with the resolved entity.
|
|
10
|
+
*/
|
|
11
|
+
export declare function WithResolvedPropertyEntity(entity: TApiPropertyEntity, decoratorName: string, onResolved: (resolved: IApiBaseEntity | Type<IApiBaseEntity>) => void): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var deferPropertyDecoratorExecution_utility = require('./defer-property-decorator-execution.utility.js');
|
|
4
|
+
var errorException_utility = require('./error-exception.utility.js');
|
|
5
|
+
var propertyEntity_utility = require('./resolve/property-entity.utility.js');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Executes the provided callback once the entity reference resolves.
|
|
9
|
+
* If the entity cannot be resolved immediately, the callback runs in a microtask after modules finish loading.
|
|
10
|
+
* @param {TApiPropertyEntity} entity - Entity reference or resolver.
|
|
11
|
+
* @param {string} decoratorName - Decorator name for error context.
|
|
12
|
+
* @param {(resolved: IApiBaseEntity | Type<IApiBaseEntity>) => void} onResolved - Callback executed with the resolved entity.
|
|
13
|
+
*/
|
|
14
|
+
function WithResolvedPropertyEntity(entity, decoratorName, onResolved) {
|
|
15
|
+
const resolved = propertyEntity_utility.TryResolvePropertyEntity(entity);
|
|
16
|
+
if (resolved) {
|
|
17
|
+
onResolved(resolved);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
deferPropertyDecoratorExecution_utility.DeferPropertyDecoratorExecution(() => {
|
|
21
|
+
const deferredResolved = propertyEntity_utility.TryResolvePropertyEntity(entity);
|
|
22
|
+
if (!deferredResolved) {
|
|
23
|
+
throw errorException_utility.ErrorException(`Entity for ${decoratorName} could not be resolved. Provide the entity class or a factory that returns it.`);
|
|
24
|
+
}
|
|
25
|
+
onResolved(deferredResolved);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
exports.WithResolvedPropertyEntity = WithResolvedPropertyEntity;
|
|
30
|
+
//# sourceMappingURL=with-resolved-property-entity.utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-resolved-property-entity.utility.js","sources":["../../../../src/utility/with-resolved-property-entity.utility.ts"],"sourcesContent":[null],"names":["TryResolvePropertyEntity","DeferPropertyDecoratorExecution","ErrorException"],"mappings":";;;;;;AAQA;;;;;;AAMG;SACa,0BAA0B,CAAC,MAA0B,EAAE,aAAqB,EAAE,UAAqE,EAAA;AAClK,IAAA,MAAM,QAAQ,GAAsDA,+CAAwB,CAAC,MAAM,CAAC;IAEpG,IAAI,QAAQ,EAAE;QACb,UAAU,CAAC,QAAQ,CAAC;QAEpB;IACD;IAEAC,uEAA+B,CAAC,MAAK;AACpC,QAAA,MAAM,gBAAgB,GAAsDD,+CAAwB,CAAC,MAAM,CAAC;QAE5G,IAAI,CAAC,gBAAgB,EAAE;AACtB,YAAA,MAAME,qCAAc,CAAC,CAAA,WAAA,EAAc,aAAa,CAAA,8EAAA,CAAgF,CAAC;QAClI;QAEA,UAAU,CAAC,gBAAgB,CAAC;AAC7B,IAAA,CAAC,CAAC;AACH;;;;"}
|
|
@@ -3,14 +3,11 @@ import type { IApiAuthorizationPolicy, IApiAuthorizationPolicyRegistry, IApiAuth
|
|
|
3
3
|
import type { TApiAuthorizationPolicyHookResult } from '../../../../type/class/api/authorization/policy/hook/index';
|
|
4
4
|
type TEntityConstructor<E extends IApiBaseEntity> = new () => E;
|
|
5
5
|
export declare class ApiAuthorizationPolicyRegistry implements IApiAuthorizationPolicyRegistry {
|
|
6
|
-
private readonly LEGACY_POLICIES;
|
|
7
6
|
private readonly POLICY_CACHE;
|
|
8
|
-
private readonly
|
|
9
|
-
private readonly POLICY_REGISTRATIONS_BY_ID;
|
|
7
|
+
private readonly POLICY_REGISTRY;
|
|
10
8
|
constructor();
|
|
11
9
|
buildAggregatedPolicy<E extends IApiBaseEntity, TAction extends string>(entity: TEntityConstructor<E>, action: TAction): Promise<IApiAuthorizationPolicy<E, TApiAuthorizationPolicyHookResult<TAction, E>> | undefined>;
|
|
12
10
|
clear(): void;
|
|
13
|
-
registerPolicy<E extends IApiBaseEntity, R>(policy: IApiAuthorizationPolicy<E, R>): void;
|
|
14
11
|
registerSubscriber<E extends IApiBaseEntity>(registration: IApiAuthorizationPolicySubscriberRegistration<E>): void;
|
|
15
12
|
private cachePolicy;
|
|
16
13
|
private createCacheKey;
|
|
@@ -19,7 +16,6 @@ export declare class ApiAuthorizationPolicyRegistry implements IApiAuthorization
|
|
|
19
16
|
private normalizeRule;
|
|
20
17
|
private resolvePolicyId;
|
|
21
18
|
private resolveRouteType;
|
|
22
|
-
private setLegacyPolicy;
|
|
23
19
|
private toBasePolicy;
|
|
24
20
|
}
|
|
25
21
|
export declare const apiAuthorizationPolicyRegistry: ApiAuthorizationPolicyRegistry;
|