module import * as g from 'window-or-global' ; import { Schema , object } from 'yup' ; import 'reflect-metadata' ; hidden const isSchema = ( schema ) : schema is Schema < any > => 'validate' in schema ; hidden export const paramMetadataKey = g . ConvectorParamMetadataKey || Symbol ( 'param' ) ; g . ConvectorParamMetadataKey = paramMetadataKey ; decorator param model param opts export function Param < T > ( model , opts = { context : { } } ) { return ( target , propertyKey , parameterIndex ) => { const schemas = Reflect . getOwnMetadata ( paramMetadataKey , target , propertyKey ) || [ ] ; const schema = isSchema ( model ) ? model : object ( ) . transform ( value => value instanceof model ? value : new model ( value ) ) ; schemas [ parameterIndex ] = [ schema , opts , ! isSchema ( model ) && model ] ; Reflect . defineMetadata ( paramMetadataKey , schemas , target , propertyKey ) ; } ; }