UNPKG

2.01 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../../src/decorator/Check.ts"],"names":[],"mappings":";;AAAA,yBAA2C;AAiB3C;;;;GAIG;AACH,SAAgB,KAAK,CAAC,gBAAwB,EAAE,eAAwB;IAEpE,IAAM,IAAI,GAAG,eAAe,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5D,IAAM,UAAU,GAAG,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,gBAAgB,CAAC;IAExE,IAAI,CAAC,UAAU;QACX,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAEpD,OAAO,UAAU,WAA4B,EAAE,YAAqB;QAEhE,0BAAsB,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;YACjC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,WAAuB;YACxE,IAAI,EAAE,IAAI;YACV,UAAU,EAAE,UAAU;SACJ,CAAC,CAAC;IAC5B,CAAC,CAAC;AACN,CAAC;AAhBD,sBAgBC","file":"Check.js","sourcesContent":["import {getMetadataArgsStorage} from \"../\";\nimport {CheckMetadataArgs} from \"../metadata-args/CheckMetadataArgs\";\n\n/**\n * Creates a database check.\n * Can be used on entity property or on entity.\n * Can create checks with composite columns when used on entity.\n */\nexport function Check(expression: string): Function;\n\n/**\n * Creates a database check.\n * Can be used on entity property or on entity.\n * Can create checks with composite columns when used on entity.\n */\nexport function Check(name: string, expression: string): Function;\n\n/**\n * Creates a database check.\n * Can be used on entity property or on entity.\n * Can create checks with composite columns when used on entity.\n */\nexport function Check(nameOrExpression: string, maybeExpression?: string): Function {\n\n const name = maybeExpression ? nameOrExpression : undefined;\n const expression = maybeExpression ? maybeExpression : nameOrExpression;\n\n if (!expression)\n throw new Error(`Check expression is required`);\n\n return function (clsOrObject: Function|Object, propertyName?: string) {\n\n getMetadataArgsStorage().checks.push({\n target: propertyName ? clsOrObject.constructor : clsOrObject as Function,\n name: name,\n expression: expression\n } as CheckMetadataArgs);\n };\n}\n"],"sourceRoot":".."}
\No newline at end of file