@nestjs/mapped-types
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -7,4 +7,9 @@ "use strict"; | ||
} | ||
type_helpers_utils_1.inheritValidationMetadata(classRef, PartialClassType); | ||
const propertyKeys = type_helpers_utils_1.inheritValidationMetadata(classRef, PartialClassType); | ||
type_helpers_utils_1.inheritTransformationMetadata(classRef, PartialClassType); | ||
if (propertyKeys) { | ||
propertyKeys.forEach(key => { | ||
type_helpers_utils_1.applyIsOptionalDecorator(PartialClassType, key); | ||
}); | ||
} | ||
Object.defineProperty(PartialClassType, 'name', { | ||
@@ -11,0 +16,0 @@ value: `Partial${classRef.name}`, |
import { Type } from '@nestjs/common'; | ||
export declare function applyIsOptionalDecorator(targetClass: Function, propertyKey: string): void; | ||
export declare function inheritValidationMetadata(parentClass: Type<any>, targetClass: Function, isPropertyInherited?: (key: string) => boolean): void; | ||
export declare function inheritValidationMetadata(parentClass: Type<any>, targetClass: Function, isPropertyInherited?: (key: string) => boolean): string[] | undefined; | ||
export declare function inheritTransformationMetadata(parentClass: Type<any>, targetClass: Function, isPropertyInherited?: (key: string) => boolean): void; |
@@ -22,5 +22,8 @@ "use strict"; | ||
const targetMetadata = metadataStorage.getTargetValidationMetadatas(parentClass, null); | ||
targetMetadata | ||
return targetMetadata | ||
.filter(({ propertyName }) => !isPropertyInherited || isPropertyInherited(propertyName)) | ||
.forEach(value => metadataStorage.addValidationMetadata(Object.assign(Object.assign({}, value), { target: targetClass }))); | ||
.map(value => { | ||
metadataStorage.addValidationMetadata(Object.assign(Object.assign({}, value), { target: targetClass })); | ||
return value.propertyName; | ||
}); | ||
} | ||
@@ -27,0 +30,0 @@ catch (err) { |
{ | ||
"name": "@nestjs/mapped-types", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Nest - modern, fast, powerful node.js web framework (@mapped-types)", | ||
@@ -31,3 +31,3 @@ "author": "Kamil Mysliwiec", | ||
"eslint-config-prettier": "6.10.1", | ||
"eslint-plugin-import": "2.20.1", | ||
"eslint-plugin-import": "2.20.2", | ||
"husky": "4.2.3", | ||
@@ -34,0 +34,0 @@ "jest": "25.1.0", |
16336
253