UNPKG

mage-validator

Version:

Validation utility for MAGE user commands & topics (TypeScript)

27 lines (26 loc) 810 B
import * as mage from 'mage'; /** * Validate function type (currently used for MapOf) */ export declare type ValidateFunction = (key: string, value: any) => void; export * from 'class-transformer'; export * from 'class-validator'; /** * * @param type */ export declare function MapOf(type: any, validateFunction?: ValidateFunction): (target: any, key?: string | undefined) => void; /** * Wrap @Type from class-transformer * * @param type The type to configure */ export declare function Type(type: any): (target: any, key: string) => void; /** * @Acl decorator * * Protect the user command with the given ACL and defined type validation */ export declare function Acl(...acl: string[]): (UserCommand: any, key: string) => { value: (state: mage.core.IState, ...args: any[]) => Promise<any>; };