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CAAC;AACN,CAAC;AALe,cAAM,SAKrB,CAAA;AAED;;;;GAIG;AACH,iBAAwB,OAAwB;IAC5C,MAAM,CAAC,UAAS,MAAuB,EAAE,YAAqB;QAC1D,IAAM,QAAQ,GAAG,IAAI,iCAAe,CAAC,MAAM,YAAY,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,YAAY,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;QAC5H,gCAAsB,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACxD,CAAC,CAAC;AACN,CAAC;AALe,eAAO,UAKtB,CAAA","file":"decorators.js","sourcesContent":["import {defaultMetadataStorage} from \"./storage\";\nimport {TypeMetadata} from \"./metadata/TypeMetadata\";\nimport {ExposeMetadata} from \"./metadata/ExposeMetadata\";\nimport {ExposeOptions, ExcludeOptions, TypeOptions, TransformOptions} from \"./metadata/ExposeExcludeOptions\";\nimport {ExcludeMetadata} from \"./metadata/ExcludeMetadata\";\nimport {TransformMetadata} from \"./metadata/TransformMetadata\";\n\n/**\n * Defines a custom logic for value transformation.\n */\nexport function Transform(transformFn: (value: any) => any, options?: TransformOptions) {\n return function(target: any, key: string) {\n const metadata = new TransformMetadata(target.constructor, key, transformFn, options);\n defaultMetadataStorage.addTransformMetadata(metadata);\n };\n}\n\n/**\n * Specifies a type of the property.\n */\nexport function Type(typeFunction?: (type?: TypeOptions) => Function) {\n return function(target: any, key: string) {\n const type = (Reflect as any).getMetadata(\"design:type\", target, key);\n const metadata = new TypeMetadata(target.constructor, key, type, typeFunction);\n defaultMetadataStorage.addTypeMetadata(metadata);\n };\n}\n\n/**\n * Marks property as included in the process of transformation. By default it includes the property for both\n * constructorToPlain and plainToConstructor transformations, however you can specify on which of transformation types\n * you want to skip this property.\n */\nexport function Expose(options?: ExposeOptions) {\n return function(object: Object|Function, propertyName?: string) {\n const metadata = new ExposeMetadata(object instanceof Function ? object : object.constructor, propertyName, options || {});\n defaultMetadataStorage.addExposeMetadata(metadata);\n };\n}\n\n/**\n * Marks property as excluded from the process of transformation. By default it excludes the property for both\n * constructorToPlain and plainToConstructor transformations, however you can specify on which of transformation types\n * you want to skip this property.\n */\nexport function Exclude(options?: ExcludeOptions) {\n return function(object: Object|Function, propertyName?: string) {\n const metadata = new ExcludeMetadata(object instanceof Function ? object : object.constructor, propertyName, options || {});\n defaultMetadataStorage.addExcludeMetadata(metadata);\n };\n}"],"sourceRoot":""}
\No newline at end of file