@anveroapi/validator 0.0.0-stage → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ declare const _default: {
2
+ validator: {
3
+ errorStatus: number;
4
+ validationOptions: {
5
+ allowUnknown: boolean;
6
+ stripUnknown: boolean;
7
+ dateFormat: string;
8
+ };
9
+ };
10
+ i18n: {
11
+ localeTable: {
12
+ en_US: {
13
+ validator: any;
14
+ };
15
+ zh_CN: {
16
+ validator: any;
17
+ };
18
+ };
19
+ };
20
+ };
21
+ export default _default;
@@ -0,0 +1 @@
1
+ function a0_0x274d(_0x5f5dc7,_0x500150){_0x5f5dc7=_0x5f5dc7-0x72;const _0x5d2b07=a0_0x1287();let _0x3e9e89=_0x5d2b07[_0x5f5dc7];return _0x3e9e89;}const a0_0x463eaf=a0_0x274d;(function(_0x520f22,_0x4ddf9c){const _0x71aa39=a0_0x274d,_0x213350=_0x520f22();while(!![]){try{const _0x3bd3f7=-parseInt(_0x71aa39(0x7a))/0x1+parseInt(_0x71aa39(0x78))/0x2*(-parseInt(_0x71aa39(0x7f))/0x3)+parseInt(_0x71aa39(0x84))/0x4*(parseInt(_0x71aa39(0x74))/0x5)+-parseInt(_0x71aa39(0x8a))/0x6*(-parseInt(_0x71aa39(0x7c))/0x7)+parseInt(_0x71aa39(0x86))/0x8+-parseInt(_0x71aa39(0x85))/0x9*(-parseInt(_0x71aa39(0x75))/0xa)+-parseInt(_0x71aa39(0x77))/0xb*(-parseInt(_0x71aa39(0x8b))/0xc);if(_0x3bd3f7===_0x4ddf9c)break;else _0x213350['push'](_0x213350['shift']());}catch(_0x194095){_0x213350['push'](_0x213350['shift']());}}}(a0_0x1287,0x7b316));const a0_0x557556=(function(){let _0x5f05c2=!![];return function(_0x752c5f,_0x4b4834){const _0x3eb694=_0x5f05c2?function(){const _0x58558d=a0_0x274d;if(_0x4b4834){const _0x13c6a5=_0x4b4834[_0x58558d(0x76)](_0x752c5f,arguments);return _0x4b4834=null,_0x13c6a5;}}:function(){};return _0x5f05c2=![],_0x3eb694;};}()),a0_0x3e9e89=a0_0x557556(this,function(){const _0x56ea58=a0_0x274d;return a0_0x3e9e89[_0x56ea58(0x88)]()[_0x56ea58(0x73)]('(((.+)+)+)+$')[_0x56ea58(0x88)]()[_0x56ea58(0x87)](a0_0x3e9e89)[_0x56ea58(0x73)](_0x56ea58(0x72));});a0_0x3e9e89();'use strict';Object[a0_0x463eaf(0x7d)](exports,a0_0x463eaf(0x79),{'value':!![]});const ValidatorError_1=require(a0_0x463eaf(0x7b));exports[a0_0x463eaf(0x80)]={'validator':{'errorStatus':ValidatorError_1[a0_0x463eaf(0x82)][a0_0x463eaf(0x7e)],'validationOptions':{'allowUnknown':!![],'stripUnknown':!![],'dateFormat':a0_0x463eaf(0x83)}},'i18n':{'localeTable':{'en_US':{'validator':require(a0_0x463eaf(0x89))},'zh_CN':{'validator':require(a0_0x463eaf(0x81))}}}};function a0_0x1287(){const _0x1b5854=['../../locales/en_US.json','6DOPqYh','12egzHrp','(((.+)+)+)+$','search','215ykeYZd','110xKWLOq','apply','3457839aUlnvx','124DBtRfN','__esModule','451933wbcgJe','../exception/ValidatorError','3772510pPwVqQ','defineProperty','PARAMS','11199gkeCYC','default','../../locales/zh_CN.json','ValidatorError','string','5948JiOZwo','207765kHpNEr','134576VwZEFg','constructor','toString'];a0_0x1287=function(){return _0x1b5854;};return a0_0x1287();}
@@ -0,0 +1,7 @@
1
+ import { MidwayDecoratorService } from '@midwayjs/core';
2
+ import { ValidatorService } from './service/ValidatorService';
3
+ export declare class CustomConfiguration {
4
+ decorator: MidwayDecoratorService;
5
+ ValidatorService: ValidatorService;
6
+ onReady(): Promise<void>;
7
+ }
@@ -0,0 +1 @@
1
+ const a1_0x5437ac=a1_0x2d9e;function a1_0x2d42(){const _0x20ee08=['692838rKVAyA','Configuration','5500rasHDP','methodName','189275GXWURJ','@midwayjs/i18n','method','20VQapaq','target','request','getClassMetadata','req','5539650zEeTMC','MidwayDecoratorService','__decorate','CustomConfiguration','locale','(((.+)+)+)+$','constructor','metadata','find','defineProperty','90RSyRZC','query','2068491slWBxN','name','getMethodParamTypes','getAttr','bound\x20dispatch','./config/config.default','search','58872TkEGFH','args','./interface','registerMethodHandler','REQUEST_OBJ_CTX_KEY','length','decorate','getSchema','__esModule','decorator','splice','function','undefined','@anveroapi/core','body','ValidatorService','9196376WLsmFT','prototype','propertyName','Inject','2jYBcoK','7tsAUxH','param','27506CVOONl','params','methodArgs','assign','toString','validator','VALIDATOR_KEY'];a1_0x2d42=function(){return _0x20ee08;};return a1_0x2d42();}(function(_0x280cde,_0x1be132){const _0x427f1c=a1_0x2d9e,_0x2edb04=_0x280cde();while(!![]){try{const _0x3bfd49=parseInt(_0x427f1c(0xe5))/0x1+-parseInt(_0x427f1c(0xe2))/0x2*(parseInt(_0x427f1c(0xc7))/0x3)+-parseInt(_0x427f1c(0xb6))/0x4*(-parseInt(_0x427f1c(0xb3))/0x5)+parseInt(_0x427f1c(0xbb))/0x6*(-parseInt(_0x427f1c(0xe3))/0x7)+-parseInt(_0x427f1c(0xde))/0x8+-parseInt(_0x427f1c(0xec))/0x9*(-parseInt(_0x427f1c(0xc5))/0xa)+-parseInt(_0x427f1c(0xee))/0xb*(-parseInt(_0x427f1c(0xce))/0xc);if(_0x3bfd49===_0x1be132)break;else _0x2edb04['push'](_0x2edb04['shift']());}catch(_0x385d3d){_0x2edb04['push'](_0x2edb04['shift']());}}}(a1_0x2d42,0x928ec));const a1_0xf72672=(function(){let _0x57fd24=!![];return function(_0x436e29,_0x5bb69c){const _0x3746a0=_0x57fd24?function(){if(_0x5bb69c){const _0x58705c=_0x5bb69c['apply'](_0x436e29,arguments);return _0x5bb69c=null,_0x58705c;}}:function(){};return _0x57fd24=![],_0x3746a0;};}()),a1_0x2b8b24=a1_0xf72672(this,function(){const _0x4b8bb3=a1_0x2d9e;return a1_0x2b8b24['toString']()[_0x4b8bb3(0xcd)](_0x4b8bb3(0xc0))[_0x4b8bb3(0xe9)]()[_0x4b8bb3(0xc1)](a1_0x2b8b24)[_0x4b8bb3(0xcd)](_0x4b8bb3(0xc0));});a1_0x2b8b24();'use strict';var __decorate=this&&this[a1_0x5437ac(0xbd)]||function(_0x19c23d,_0x480e3a,_0x1b4f83,_0x1798f8){const _0x15baf7=a1_0x5437ac;var _0x37fbc3=arguments[_0x15baf7(0xd3)],_0x13e0ac=_0x37fbc3<0x3?_0x480e3a:_0x1798f8===null?_0x1798f8=Object['getOwnPropertyDescriptor'](_0x480e3a,_0x1b4f83):_0x1798f8,_0x3d6742;if(typeof Reflect==='object'&&typeof Reflect[_0x15baf7(0xd4)]===_0x15baf7(0xd9))_0x13e0ac=Reflect[_0x15baf7(0xd4)](_0x19c23d,_0x480e3a,_0x1b4f83,_0x1798f8);else{for(var _0x3cac8a=_0x19c23d[_0x15baf7(0xd3)]-0x1;_0x3cac8a>=0x0;_0x3cac8a--)if(_0x3d6742=_0x19c23d[_0x3cac8a])_0x13e0ac=(_0x37fbc3<0x3?_0x3d6742(_0x13e0ac):_0x37fbc3>0x3?_0x3d6742(_0x480e3a,_0x1b4f83,_0x13e0ac):_0x3d6742(_0x480e3a,_0x1b4f83))||_0x13e0ac;}return _0x37fbc3>0x3&&_0x13e0ac&&Object[_0x15baf7(0xc4)](_0x480e3a,_0x1b4f83,_0x13e0ac),_0x13e0ac;},__metadata=this&&this['__metadata']||function(_0x9bd328,_0x506800){const _0x3e6acf=a1_0x5437ac;if(typeof Reflect==='object'&&typeof Reflect[_0x3e6acf(0xc2)]===_0x3e6acf(0xd9))return Reflect['metadata'](_0x9bd328,_0x506800);};function a1_0x2d9e(_0x42056c,_0x68bcf9){_0x42056c=_0x42056c-0xb3;const _0x5a5161=a1_0x2d42();let _0x2b8b24=_0x5a5161[_0x42056c];return _0x2b8b24;}Object[a1_0x5437ac(0xc4)](exports,a1_0x5437ac(0xd6),{'value':!![]}),exports[a1_0x5437ac(0xbe)]=void 0x0;const i18n_1=require(a1_0x5437ac(0xb4)),core_1=require('@midwayjs/core'),core_2=require('@midwayjs/core'),interface_1=require(a1_0x5437ac(0xd0)),ValidatorService_1=require('./service/ValidatorService'),i18n=require(a1_0x5437ac(0xb4)),anvero=require(a1_0x5437ac(0xdb)),ConfigDefault=require(a1_0x5437ac(0xcc));let CustomConfiguration=class CustomConfiguration{async['onReady'](){const _0x32c041=a1_0x5437ac;this[_0x32c041(0xd7)][_0x32c041(0xd1)](interface_1[_0x32c041(0xeb)],_0x28775e=>{const _0x23de44=_0x32c041,_0x5ada6f=_0x28775e[_0x23de44(0xc2)],_0x15081c=(0x0,core_2[_0x23de44(0xc9)])(_0x28775e['target'],_0x28775e[_0x23de44(0xe0)]);return{'before':_0x412253=>{const _0x62953c=_0x23de44;var _0x15335a,_0x3e9538,_0x239a11,_0x25e4b7,_0x3497e4,_0x483a53,_0x345a22,_0x5dba47,_0x96f924,_0x455473,_0x34365d,_0x36e497,_0x398aae;const _0x574fe4=_0x412253['target'][core_1[_0x62953c(0xd2)]],_0x3c4e76=Object[_0x62953c(0xe8)]({},((_0x15335a=_0x574fe4===null||_0x574fe4===void 0x0?void 0x0:_0x574fe4[_0x62953c(0xb8)])===null||_0x15335a===void 0x0?void 0x0:_0x15335a[_0x62953c(0xc6)])||{},((_0x3e9538=_0x574fe4===null||_0x574fe4===void 0x0?void 0x0:_0x574fe4[_0x62953c(0xb8)])===null||_0x3e9538===void 0x0?void 0x0:_0x3e9538[_0x62953c(0xdc)])||{}),_0x2c8e83=((0x0,core_2[_0x62953c(0xb9)])(interface_1['VALIDATOR_KEY'],_0x412253[_0x62953c(0xb7)])||[])[_0x62953c(0xc3)](_0x189727=>_0x189727[_0x62953c(0xb5)]==_0x412253[_0x62953c(0xef)]);!(_0x5ada6f===null||_0x5ada6f===void 0x0?void 0x0:_0x5ada6f[_0x62953c(0xbf)])&&_0x574fe4&&_0x574fe4[_0x62953c(0xca)]&&(_0x5ada6f[_0x62953c(0xbf)]=_0x574fe4[_0x62953c(0xca)](i18n_1['I18N_ATTR_KEY']));for(let _0x3399c8=0x0;_0x3399c8<_0x15081c[_0x62953c(0xd3)];_0x3399c8++){const _0x5a91b6=_0x15081c[_0x3399c8],_0x2a6e6e=this[_0x62953c(0xdd)][_0x62953c(0xd5)](_0x5a91b6);if(_0x2a6e6e){if(typeof _0x412253[_0x62953c(0xcf)][_0x3399c8]==_0x62953c(0xda)||((_0x239a11=_0x412253['args'][_0x3399c8])===null||_0x239a11===void 0x0?void 0x0:_0x239a11[_0x62953c(0xb8)])&&((_0x25e4b7=_0x412253[_0x62953c(0xcf)][_0x3399c8])===null||_0x25e4b7===void 0x0?void 0x0:_0x25e4b7['res'])&&((_0x3497e4=_0x412253[_0x62953c(0xcf)][_0x3399c8])===null||_0x3497e4===void 0x0?void 0x0:_0x3497e4[_0x62953c(0xba)]))_0x412253[_0x62953c(0xcf)][_0x3399c8]=_0x3c4e76;else((_0x483a53=_0x412253[_0x62953c(0xcf)][_0x3399c8])===null||_0x483a53===void 0x0?void 0x0:_0x483a53[_0x62953c(0xc8)])==_0x62953c(0xcb)&&_0x412253['args'][_0x62953c(0xd8)](_0x3399c8,0x0,_0x3c4e76);const _0xce96bb=this['ValidatorService'][_0x62953c(0xea)](_0x2a6e6e,_0x412253[_0x62953c(0xcf)][_0x3399c8],_0x5ada6f);_0xce96bb&&(_0x412253[_0x62953c(0xcf)][_0x3399c8]=_0xce96bb);}else{if((_0x2c8e83===null||_0x2c8e83===void 0x0?void 0x0:_0x2c8e83[_0x62953c(0xe7)][_0x3399c8])&&((_0x345a22=_0x412253[_0x62953c(0xcf)][_0x3399c8])===null||_0x345a22===void 0x0?void 0x0:_0x345a22[_0x62953c(0xe6)])&&typeof _0x412253[_0x62953c(0xcf)][_0x3399c8][_0x62953c(0xe4)]==_0x62953c(0xd9)&&((_0x5dba47=_0x574fe4===null||_0x574fe4===void 0x0?void 0x0:_0x574fe4[_0x62953c(0xe6)])===null||_0x5dba47===void 0x0?void 0x0:_0x5dba47[_0x2c8e83[_0x62953c(0xe7)][_0x3399c8]]))_0x412253[_0x62953c(0xcf)][_0x3399c8]=_0x5a91b6((_0x96f924=_0x574fe4===null||_0x574fe4===void 0x0?void 0x0:_0x574fe4[_0x62953c(0xe6)])===null||_0x96f924===void 0x0?void 0x0:_0x96f924[_0x2c8e83[_0x62953c(0xe7)][_0x3399c8]]);else(_0x2c8e83===null||_0x2c8e83===void 0x0?void 0x0:_0x2c8e83['methodArgs'][_0x3399c8])&&((_0x34365d=(_0x455473=_0x412253[_0x62953c(0xcf)][_0x3399c8])===null||_0x455473===void 0x0?void 0x0:_0x455473[_0x62953c(0xe6)])===null||_0x34365d===void 0x0?void 0x0:_0x34365d[_0x2c8e83[_0x62953c(0xe7)][_0x3399c8]])&&(_0x412253[_0x62953c(0xcf)][_0x3399c8]=(_0x398aae=(_0x36e497=_0x412253['args'][_0x3399c8])===null||_0x36e497===void 0x0?void 0x0:_0x36e497['params'])===null||_0x398aae===void 0x0?void 0x0:_0x398aae[_0x2c8e83[_0x62953c(0xe7)][_0x3399c8]]);}}},'afterThrow':(_0x10a4de,_0x1a8776)=>{throw _0x1a8776;}};});}};exports['CustomConfiguration']=CustomConfiguration,__decorate([(0x0,core_2[a1_0x5437ac(0xe1)])(),__metadata('design:type',core_1[a1_0x5437ac(0xbc)])],CustomConfiguration['prototype'],a1_0x5437ac(0xd7),void 0x0),__decorate([(0x0,core_2[a1_0x5437ac(0xe1)])(),__metadata('design:type',ValidatorService_1[a1_0x5437ac(0xdd)])],CustomConfiguration[a1_0x5437ac(0xdf)],'ValidatorService',void 0x0),exports['CustomConfiguration']=CustomConfiguration=__decorate([(0x0,core_2[a1_0x5437ac(0xed)])({'conflictCheck':![],'imports':[i18n,anvero],'namespace':'anvero-api:validator','importConfigs':[{'default':ConfigDefault}]})],CustomConfiguration);
@@ -0,0 +1,3 @@
1
+ import * as joi from 'joi';
2
+ export declare const RuleType: joi.Root;
3
+ export declare function Rule<Schema extends joi.SchemaInternals>(comment: string, schema?: Schema | any, description?: string): (target: any, propertyKey: string) => void;
@@ -0,0 +1 @@
1
+ const a2_0x58b3f6=a2_0x4ceb;(function(_0x27925f,_0x516501){const _0x4065a7=a2_0x4ceb,_0x4ec20b=_0x27925f();while(!![]){try{const _0x4d9c1b=-parseInt(_0x4065a7(0xeb))/0x1*(parseInt(_0x4065a7(0xd2))/0x2)+-parseInt(_0x4065a7(0xce))/0x3*(parseInt(_0x4065a7(0xe7))/0x4)+-parseInt(_0x4065a7(0xe8))/0x5*(parseInt(_0x4065a7(0xf0))/0x6)+-parseInt(_0x4065a7(0xcf))/0x7+parseInt(_0x4065a7(0xe4))/0x8*(parseInt(_0x4065a7(0xe2))/0x9)+parseInt(_0x4065a7(0xdc))/0xa*(parseInt(_0x4065a7(0xea))/0xb)+parseInt(_0x4065a7(0xd1))/0xc;if(_0x4d9c1b===_0x516501)break;else _0x4ec20b['push'](_0x4ec20b['shift']());}catch(_0x253be7){_0x4ec20b['push'](_0x4ec20b['shift']());}}}(a2_0x4465,0x24475));function a2_0x4465(){const _0x369162=['object','RuleType','function','80fQTrrB','keys','getPropertyType','../interface','@midwayjs/core','__esModule','252fRIqzS','extend','2672TlXaQC','label','toString','68uEvvBc','95vEhkLc','apply','389653XbnJOP','147776AQVOiI','@joi/date','search','saveClassMetadata','constructor','75828yCDcca','map','name','description','6759uHbvIP','124544pyWAFf','Rule','5371536IielAo','4pHFFYh','meta','RULES_KEY','isSchema','Array','getClassMetadata','defineProperty'];a2_0x4465=function(){return _0x369162;};return a2_0x4465();}const a2_0x317724=(function(){let _0x193bf7=!![];return function(_0x4b61af,_0x210223){const _0x2fda6b=_0x193bf7?function(){const _0x7ec0c7=a2_0x4ceb;if(_0x210223){const _0xdb96c1=_0x210223[_0x7ec0c7(0xe9)](_0x4b61af,arguments);return _0x210223=null,_0xdb96c1;}}:function(){};return _0x193bf7=![],_0x2fda6b;};}()),a2_0x900e0f=a2_0x317724(this,function(){const _0x5ccb10=a2_0x4ceb;return a2_0x900e0f[_0x5ccb10(0xe6)]()[_0x5ccb10(0xed)]('(((.+)+)+)+$')[_0x5ccb10(0xe6)]()[_0x5ccb10(0xef)](a2_0x900e0f)['search']('(((.+)+)+)+$');});a2_0x900e0f();'use strict';Object[a2_0x58b3f6(0xd8)](exports,a2_0x58b3f6(0xe1),{'value':!![]}),exports[a2_0x58b3f6(0xda)]=void 0x0,exports[a2_0x58b3f6(0xd0)]=Rule;const joi=require('joi'),date_1=require(a2_0x58b3f6(0xec)),core_1=require(a2_0x58b3f6(0xe0)),interface_1=require(a2_0x58b3f6(0xdf));exports[a2_0x58b3f6(0xda)]=joi[a2_0x58b3f6(0xe3)](date_1['default']);function a2_0x4ceb(_0x583ad0,_0x44d95e){_0x583ad0=_0x583ad0-0xcd;const _0x43fac8=a2_0x4465();let _0x900e0f=_0x43fac8[_0x583ad0];return _0x900e0f;}function Rule(_0x3b8500,_0xbeab16,_0x3c069c=''){return(_0xacf9e4,_0x322709)=>{const _0x5d6c26=a2_0x4ceb;var _0x5871db;if(_0x322709)!joi[_0x5d6c26(0xd5)](_0xbeab16)&&(_0xbeab16===null||_0xbeab16===void 0x0?void 0x0:_0xbeab16['name'])&&(_0xbeab16=joi[_0x5d6c26(0xd9)]((0x0,core_1[_0x5d6c26(0xd7)])(interface_1[_0x5d6c26(0xd4)],_0xbeab16))[_0x5d6c26(0xd3)]({'id':_0xbeab16[_0x5d6c26(0xf2)]}),(0x0,core_1[_0x5d6c26(0xde)])(_0xacf9e4,_0x322709)[_0x5d6c26(0xf2)]===_0x5d6c26(0xd6)&&(_0xbeab16=joi['array']()['items'](_0xbeab16))),joi[_0x5d6c26(0xd5)](_0xbeab16)&&(_0x3b8500&&typeof(_0xbeab16===null||_0xbeab16===void 0x0?void 0x0:_0xbeab16[_0x5d6c26(0xe5)])==_0x5d6c26(0xdb)&&(_0xbeab16=_0xbeab16['label'](_0x3b8500)),_0x3c069c&&typeof(_0xbeab16===null||_0xbeab16===void 0x0?void 0x0:_0xbeab16[_0x5d6c26(0xcd)])=='function'&&(_0xbeab16=_0xbeab16['description'](_0x3c069c)),(0x0,core_1['attachClassMetadata'])(interface_1[_0x5d6c26(0xd4)],_0xbeab16,_0xacf9e4,_0x322709));else{const _0xd24350=(0x0,core_1[_0x5d6c26(0xd7)])(interface_1[_0x5d6c26(0xd4)],_0xbeab16);if(_0xd24350){let _0x4b8194=(_0x5871db=(0x0,core_1[_0x5d6c26(0xd7)])(interface_1[_0x5d6c26(0xd4)],_0xacf9e4))!==null&&_0x5871db!==void 0x0?_0x5871db:{};Object[_0x5d6c26(0xdd)](_0xd24350)[_0x5d6c26(0xf1)](_0x53351e=>{!_0x4b8194[_0x53351e]&&(_0x4b8194[_0x53351e]=_0xd24350[_0x53351e]);}),(0x0,core_1[_0x5d6c26(0xee)])(interface_1[_0x5d6c26(0xd4)],_0x4b8194,_0xacf9e4);}}};}
@@ -0,0 +1,3 @@
1
+ import { ValidatorOptions } from '../interface';
2
+ export declare function Validator(options?: ValidatorOptions): (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => void;
3
+ export declare function getFuncArgs(fn: Function): string[];
@@ -0,0 +1 @@
1
+ function a3_0x5b6f(){const _0x55d957=['constructor','../interface','replace','match','slice','797559RazFCI','VALIDATOR_KEY','attachClassMetadata','1456120BnsNVg','2676246mCGsmC','prototype','defineProperty','Validator','indexOf','(((.+)+)+)+$','18lJDlRW','function','search','5DvhVmt','__esModule','toString','262sZbQqR','527ybyKWR','3823688GqxHAA','1538404McLWDP','@midwayjs/core','905037ZgqDWw','apply'];a3_0x5b6f=function(){return _0x55d957;};return a3_0x5b6f();}const a3_0x425a89=a3_0x48b7;(function(_0x198b0a,_0x2bbd72){const _0x47a6b4=a3_0x48b7,_0x35db27=_0x198b0a();while(!![]){try{const _0x2d9795=parseInt(_0x47a6b4(0x1c5))/0x1*(-parseInt(_0x47a6b4(0x1c4))/0x2)+parseInt(_0x47a6b4(0x1c9))/0x3+-parseInt(_0x47a6b4(0x1c7))/0x4+parseInt(_0x47a6b4(0x1c1))/0x5*(-parseInt(_0x47a6b4(0x1d4))/0x6)+parseInt(_0x47a6b4(0x1d0))/0x7+parseInt(_0x47a6b4(0x1c6))/0x8+-parseInt(_0x47a6b4(0x1da))/0x9*(-parseInt(_0x47a6b4(0x1d3))/0xa);if(_0x2d9795===_0x2bbd72)break;else _0x35db27['push'](_0x35db27['shift']());}catch(_0x529adf){_0x35db27['push'](_0x35db27['shift']());}}}(a3_0x5b6f,0x459c2));function a3_0x48b7(_0x1d13da,_0x25c66b){_0x1d13da=_0x1d13da-0x1bf;const _0x2abc53=a3_0x5b6f();let _0x438412=_0x2abc53[_0x1d13da];return _0x438412;}const a3_0x19e534=(function(){let _0xd80308=!![];return function(_0x2f75b0,_0x1d2834){const _0x83d3aa=_0xd80308?function(){const _0x308591=a3_0x48b7;if(_0x1d2834){const _0x1dfd60=_0x1d2834[_0x308591(0x1ca)](_0x2f75b0,arguments);return _0x1d2834=null,_0x1dfd60;}}:function(){};return _0xd80308=![],_0x83d3aa;};}()),a3_0x438412=a3_0x19e534(this,function(){const _0x2d832c=a3_0x48b7;return a3_0x438412[_0x2d832c(0x1c3)]()[_0x2d832c(0x1c0)](_0x2d832c(0x1d9))['toString']()[_0x2d832c(0x1cb)](a3_0x438412)['search'](_0x2d832c(0x1d9));});a3_0x438412();'use strict';Object[a3_0x425a89(0x1d6)](exports,a3_0x425a89(0x1c2),{'value':!![]}),exports[a3_0x425a89(0x1d7)]=Validator,exports['getFuncArgs']=getFuncArgs;const core_1=require(a3_0x425a89(0x1c8)),interface_1=require(a3_0x425a89(0x1cc));function Validator(_0x380558={}){return(_0x3a5424,_0x5dbb10,_0x5b4a76)=>{const _0x59acce=a3_0x48b7,_0x36c818=getFuncArgs(_0x3a5424[_0x5dbb10]);(0x0,core_1[_0x59acce(0x1d2)])(interface_1[_0x59acce(0x1d1)],{'method':_0x5dbb10,'methodArgs':_0x36c818},_0x3a5424),(0x0,core_1['createCustomMethodDecorator'])(interface_1['VALIDATOR_KEY'],_0x380558)(_0x3a5424,_0x5dbb10,_0x5b4a76);};}function getFuncArgs(_0x360eb6){const _0x53906f=a3_0x425a89;if(typeof _0x360eb6==_0x53906f(0x1bf)){const _0x5ece8b=/=>.*$/mg,_0x46b96f=/=[^,)]+/mg,_0x53c82c=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,_0x29aad6=(_0x360eb6[_0x53906f(0x1d5)]?_0x360eb6[_0x53906f(0x1d5)][_0x53906f(0x1cb)][_0x53906f(0x1c3)]():_0x360eb6['toString']())['replace'](_0x53c82c,'')[_0x53906f(0x1cd)](_0x5ece8b,'')[_0x53906f(0x1cd)](_0x46b96f,''),_0x7309a8=_0x29aad6[_0x53906f(0x1cf)](_0x29aad6['indexOf']('(')+0x1,_0x29aad6[_0x53906f(0x1d8)](')'))[_0x53906f(0x1ce)](/([^\s,]+)/g)||[];return _0x7309a8;}}
@@ -0,0 +1,4 @@
1
+ export declare class ValidatorError extends AnnError {
2
+ static readonly PARAMS = 101406;
3
+ static readonly NOFIND_SCHEMA = 101404;
4
+ }
@@ -0,0 +1 @@
1
+ var a4_0x5d41c1=a4_0x450f;(function(_0x5a7b2f,_0x5f1d9f){var _0x256efc=a4_0x450f,_0x3712c8=_0x5a7b2f();while(!![]){try{var _0x362650=parseInt(_0x256efc(0x16d))/0x1*(-parseInt(_0x256efc(0x156))/0x2)+-parseInt(_0x256efc(0x169))/0x3+parseInt(_0x256efc(0x167))/0x4+parseInt(_0x256efc(0x172))/0x5+-parseInt(_0x256efc(0x15b))/0x6*(-parseInt(_0x256efc(0x15f))/0x7)+-parseInt(_0x256efc(0x16f))/0x8+-parseInt(_0x256efc(0x170))/0x9*(-parseInt(_0x256efc(0x161))/0xa);if(_0x362650===_0x5f1d9f)break;else _0x3712c8['push'](_0x3712c8['shift']());}catch(_0x78d975){_0x3712c8['push'](_0x3712c8['shift']());}}}(a4_0x114c,0xa2b2b));var a4_0x24ebd8=(function(){var _0x310eeb=!![];return function(_0x20963d,_0x3f64ed){var _0x399ea9=_0x310eeb?function(){var _0xbba7dd=a4_0x450f;if(_0x3f64ed){var _0x16a1da=_0x3f64ed[_0xbba7dd(0x162)](_0x20963d,arguments);return _0x3f64ed=null,_0x16a1da;}}:function(){};return _0x310eeb=![],_0x399ea9;};}()),a4_0x136baa=a4_0x24ebd8(this,function(){var _0x479571=a4_0x450f;return a4_0x136baa[_0x479571(0x16a)]()[_0x479571(0x15c)]('(((.+)+)+)+$')[_0x479571(0x16a)]()['constructor'](a4_0x136baa)[_0x479571(0x15c)](_0x479571(0x166));});a4_0x136baa();'use strict';var __decorate=this&&this[a4_0x5d41c1(0x160)]||function(_0x3645ae,_0x52d496,_0x1e5c65,_0x249e5c){var _0x262010=a4_0x5d41c1,_0x2ee560=arguments['length'],_0x31053c=_0x2ee560<0x3?_0x52d496:_0x249e5c===null?_0x249e5c=Object[_0x262010(0x171)](_0x52d496,_0x1e5c65):_0x249e5c,_0x4ef8f4;if(typeof Reflect===_0x262010(0x15d)&&typeof Reflect[_0x262010(0x155)]===_0x262010(0x157))_0x31053c=Reflect['decorate'](_0x3645ae,_0x52d496,_0x1e5c65,_0x249e5c);else{for(var _0xba70a2=_0x3645ae[_0x262010(0x168)]-0x1;_0xba70a2>=0x0;_0xba70a2--)if(_0x4ef8f4=_0x3645ae[_0xba70a2])_0x31053c=(_0x2ee560<0x3?_0x4ef8f4(_0x31053c):_0x2ee560>0x3?_0x4ef8f4(_0x52d496,_0x1e5c65,_0x31053c):_0x4ef8f4(_0x52d496,_0x1e5c65))||_0x31053c;}return _0x2ee560>0x3&&_0x31053c&&Object[_0x262010(0x16e)](_0x52d496,_0x1e5c65,_0x31053c),_0x31053c;},__metadata=this&&this[a4_0x5d41c1(0x159)]||function(_0x59d5d4,_0x224f6e){var _0x5be38c=a4_0x5d41c1;if(typeof Reflect==='object'&&typeof Reflect[_0x5be38c(0x163)]===_0x5be38c(0x157))return Reflect[_0x5be38c(0x163)](_0x59d5d4,_0x224f6e);};function a4_0x450f(_0x143fe3,_0x2fefe0){_0x143fe3=_0x143fe3-0x155;var _0x20927b=a4_0x114c();var _0x136baa=_0x20927b[_0x143fe3];return _0x136baa;}Object[a4_0x5d41c1(0x16e)](exports,'__esModule',{'value':!![]}),exports[a4_0x5d41c1(0x158)]=void 0x0;const core_1=require(a4_0x5d41c1(0x165));class ValidatorError extends AnnError{}exports['ValidatorError']=ValidatorError,ValidatorError[a4_0x5d41c1(0x16c)]=0x18c1e,ValidatorError[a4_0x5d41c1(0x16b)]=0x18c1c,__decorate([(0x0,core_1[a4_0x5d41c1(0x15e)])('参数验证失败'),__metadata(a4_0x5d41c1(0x164),Object)],ValidatorError,'PARAMS',void 0x0),__decorate([(0x0,core_1[a4_0x5d41c1(0x15e)])(a4_0x5d41c1(0x15a)),__metadata(a4_0x5d41c1(0x164),Object)],ValidatorError,a4_0x5d41c1(0x16b),void 0x0);function a4_0x114c(){var _0x27ea14=['PARAMS','276079YcTNMa','defineProperty','8633128kEdNAg','9yReeOH','getOwnPropertyDescriptor','73785vlSvEc','decorate','6FuEWzg','function','ValidatorError','__metadata','参数验证失败','6kWSWvx','search','object','AnnErrorMsg','4701361KLPuAM','__decorate','21436300ZIDror','apply','metadata','design:type','@anveroapi/core','(((.+)+)+)+$','2870300jdZSTH','length','2921388XwMUAR','toString','NOFIND_SCHEMA'];a4_0x114c=function(){return _0x27ea14;};return a4_0x114c();}
@@ -0,0 +1,5 @@
1
+ export interface Dto<T> {
2
+ new (): T;
3
+ }
4
+ export declare function PickDto<T, K extends keyof T>(dto: Dto<T>, keys: K[]): Dto<Pick<T, (typeof keys)[number]>>;
5
+ export declare function OmitDto<T, K extends keyof T>(dto: Dto<T>, keys: K[]): Dto<Omit<T, (typeof keys)[number]>>;
@@ -0,0 +1 @@
1
+ function a5_0x5cd0(){const _0x1763ce=['7665680sdYyLz','97528JaPlaL','toString','12411gDhntT','22720CqPLOK','@midwayjs/core','PickDto','../interface','getClassExtendedMetadata','defineProperty','3824056qYfjFt','apply','(((.+)+)+)+$','constructor','3137225PEtjrY','OmitDto','search','assign','RULES_KEY','546axulFs','prototype','saveClassMetadata','35412CIOTcG','528920cxAMrA','78sRVClh'];a5_0x5cd0=function(){return _0x1763ce;};return a5_0x5cd0();}function a5_0x521f(_0x5d48ac,_0x14d6c4){_0x5d48ac=_0x5d48ac-0x1be;const _0x571a25=a5_0x5cd0();let _0xd8c88=_0x571a25[_0x5d48ac];return _0xd8c88;}const a5_0x4c1e57=a5_0x521f;(function(_0x42798a,_0x1be86b){const _0xfd35d2=a5_0x521f,_0x4bb7d2=_0x42798a();while(!![]){try{const _0x27aa4f=parseInt(_0xfd35d2(0x1d4))/0x1+parseInt(_0xfd35d2(0x1be))/0x2*(parseInt(_0xfd35d2(0x1d5))/0x3)+parseInt(_0xfd35d2(0x1c7))/0x4+parseInt(_0xfd35d2(0x1cb))/0x5+parseInt(_0xfd35d2(0x1d3))/0x6*(-parseInt(_0xfd35d2(0x1d0))/0x7)+parseInt(_0xfd35d2(0x1d6))/0x8+-parseInt(_0xfd35d2(0x1c0))/0x9*(parseInt(_0xfd35d2(0x1c1))/0xa);if(_0x27aa4f===_0x1be86b)break;else _0x4bb7d2['push'](_0x4bb7d2['shift']());}catch(_0x3a0419){_0x4bb7d2['push'](_0x4bb7d2['shift']());}}}(a5_0x5cd0,0xb5e31));const a5_0x3107bf=(function(){let _0xa8319e=!![];return function(_0xbf7833,_0x491fe0){const _0x58b05a=_0xa8319e?function(){const _0x8b9123=a5_0x521f;if(_0x491fe0){const _0x33974a=_0x491fe0[_0x8b9123(0x1c8)](_0xbf7833,arguments);return _0x491fe0=null,_0x33974a;}}:function(){};return _0xa8319e=![],_0x58b05a;};}()),a5_0xd8c88=a5_0x3107bf(this,function(){const _0x41b58f=a5_0x521f;return a5_0xd8c88[_0x41b58f(0x1bf)]()[_0x41b58f(0x1cd)](_0x41b58f(0x1c9))['toString']()[_0x41b58f(0x1ca)](a5_0xd8c88)[_0x41b58f(0x1cd)](_0x41b58f(0x1c9));});a5_0xd8c88();'use strict';Object[a5_0x4c1e57(0x1c6)](exports,'__esModule',{'value':!![]}),exports[a5_0x4c1e57(0x1c3)]=PickDto,exports[a5_0x4c1e57(0x1cc)]=OmitDto;const core_1=require(a5_0x4c1e57(0x1c2)),interface_1=require(a5_0x4c1e57(0x1c4));function PickDto(_0x667cfb,_0x1c7121){const _0x56c6d6=a5_0x4c1e57,_0x187ec3=function(){};_0x187ec3[_0x56c6d6(0x1d1)]=_0x667cfb[_0x56c6d6(0x1d1)];const _0x391f34=(0x0,core_1['getClassExtendedMetadata'])(interface_1[_0x56c6d6(0x1cf)],_0x667cfb),_0x21161a={};for(const _0x491ca5 of _0x1c7121){_0x391f34[_0x491ca5]&&(_0x21161a[_0x491ca5]=_0x391f34[_0x491ca5]);}return(0x0,core_1[_0x56c6d6(0x1d2)])(interface_1['RULES_KEY'],_0x21161a,_0x187ec3),_0x187ec3;}function OmitDto(_0x1702f6,_0x45e2da){const _0x16fc2e=a5_0x4c1e57,_0x5de8b0=function(){};_0x5de8b0[_0x16fc2e(0x1d1)]=_0x1702f6[_0x16fc2e(0x1d1)];const _0x2f238c=(0x0,core_1[_0x16fc2e(0x1c5)])(interface_1[_0x16fc2e(0x1cf)],_0x1702f6),_0x35bbb1=Object[_0x16fc2e(0x1ce)]({},_0x2f238c);for(const _0x334ec2 of _0x45e2da){delete _0x35bbb1[_0x334ec2];}return(0x0,core_1['saveClassMetadata'])(interface_1[_0x16fc2e(0x1cf)],_0x35bbb1,_0x5de8b0),_0x5de8b0;}
@@ -0,0 +1,2 @@
1
+ import * as Joi from 'joi';
2
+ export declare function getSchema<T extends new (...args: any[]) => any>(ClzType: T): Joi.ObjectSchema<any>;
@@ -0,0 +1 @@
1
+ const a6_0x500d53=a6_0x4c8a;(function(_0x1ed9c4,_0x1238ac){const _0x11d79d=a6_0x4c8a,_0x442324=_0x1ed9c4();while(!![]){try{const _0x3ede3e=-parseInt(_0x11d79d(0x186))/0x1*(-parseInt(_0x11d79d(0x185))/0x2)+-parseInt(_0x11d79d(0x17a))/0x3*(parseInt(_0x11d79d(0x179))/0x4)+parseInt(_0x11d79d(0x172))/0x5*(parseInt(_0x11d79d(0x175))/0x6)+-parseInt(_0x11d79d(0x174))/0x7+-parseInt(_0x11d79d(0x173))/0x8+-parseInt(_0x11d79d(0x182))/0x9*(-parseInt(_0x11d79d(0x17f))/0xa)+-parseInt(_0x11d79d(0x176))/0xb*(-parseInt(_0x11d79d(0x183))/0xc);if(_0x3ede3e===_0x1238ac)break;else _0x442324['push'](_0x442324['shift']());}catch(_0x299356){_0x442324['push'](_0x442324['shift']());}}}(a6_0x1107,0x48f37));const a6_0x4fc674=(function(){let _0x8f1f2e=!![];return function(_0x1fd304,_0x5b3c65){const _0x16ba63=_0x8f1f2e?function(){const _0xe50d4e=a6_0x4c8a;if(_0x5b3c65){const _0x5def40=_0x5b3c65[_0xe50d4e(0x17e)](_0x1fd304,arguments);return _0x5b3c65=null,_0x5def40;}}:function(){};return _0x8f1f2e=![],_0x16ba63;};}()),a6_0x3aa7f2=a6_0x4fc674(this,function(){const _0x267da5=a6_0x4c8a;return a6_0x3aa7f2[_0x267da5(0x17b)]()[_0x267da5(0x178)](_0x267da5(0x17d))[_0x267da5(0x17b)]()['constructor'](a6_0x3aa7f2)[_0x267da5(0x178)](_0x267da5(0x17d));});a6_0x3aa7f2();function a6_0x4c8a(_0x1cfeb0,_0x43b9ac){_0x1cfeb0=_0x1cfeb0-0x170;const _0x379884=a6_0x1107();let _0x3aa7f2=_0x379884[_0x1cfeb0];return _0x3aa7f2;}'use strict';Object[a6_0x500d53(0x171)](exports,a6_0x500d53(0x181),{'value':!![]}),exports[a6_0x500d53(0x184)]=getSchema;const Joi=require(a6_0x500d53(0x180)),core_1=require('@midwayjs/core'),interface_1=require(a6_0x500d53(0x170));function a6_0x1107(){const _0x11cb7f=['RULES_KEY','(((.+)+)+)+$','apply','2070uDlIeB','joi','__esModule','15021iDCyuj','48WhirEz','getSchema','82jsKLHa','6189bJQgTI','../interface','defineProperty','135bmqzem','2808752Unsvsu','3235414eHUIKV','87426zBnnSs','1582988EEUQjY','getClassExtendedMetadata','search','1824712oZNerN','3uzUhUH','toString'];a6_0x1107=function(){return _0x11cb7f;};return a6_0x1107();}function getSchema(_0x44d315){const _0x5128f6=a6_0x500d53,_0xa8437b=(0x0,core_1[_0x5128f6(0x177)])(interface_1[_0x5128f6(0x17c)],_0x44d315);if(_0xa8437b)return Joi['object'](_0xa8437b);}
@@ -0,0 +1,8 @@
1
+ export * from "./interface";
2
+ export * from './helper/dtoHelper';
3
+ export * from './helper/getSchema';
4
+ export { Validator } from "./decorator/Validator";
5
+ export { Rule, RuleType } from "./decorator/Rule";
6
+ export { ValidatorError } from './exception/ValidatorError';
7
+ export { ValidatorService } from "./service/ValidatorService";
8
+ export { CustomConfiguration as Configuration } from './configuration';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ function a7_0x24d7(){var _0x3d5e93=['__exportStar','writable','getOwnPropertyDescriptor','126SYZeJd','14199352RoyZHV','7623468kwwiXY','8292VlxDZE','./decorator/Rule','hasOwnProperty','(((.+)+)+)+$','109912IuVMPI','search','RuleType','create','__esModule','configurable','Validator','CustomConfiguration','toString','Configuration','__createBinding','3dykgwJ','./configuration','apply','constructor','./service/ValidatorService','./decorator/Validator','defineProperty','7306BPiThj','33485LRrjmq','prototype','ValidatorError','Rule','290Mcosui','ValidatorService','./exception/ValidatorError','12162423leEtxB','./interface','114cFTJBK','./helper/getSchema','20113rtzExI','9CxmnnL'];a7_0x24d7=function(){return _0x3d5e93;};return a7_0x24d7();}var a7_0x24a5ec=a7_0x3937;(function(_0x431c23,_0x3df087){var _0x285fa7=a7_0x3937,_0x4cfeca=_0x431c23();while(!![]){try{var _0x4a3d6c=parseInt(_0x285fa7(0x1ef))/0x1*(-parseInt(_0x285fa7(0x1ed))/0x2)+-parseInt(_0x285fa7(0x206))/0x3*(parseInt(_0x285fa7(0x1f6))/0x4)+parseInt(_0x285fa7(0x20e))/0x5*(-parseInt(_0x285fa7(0x1f4))/0x6)+parseInt(_0x285fa7(0x1eb))/0x7+parseInt(_0x285fa7(0x1f5))/0x8*(parseInt(_0x285fa7(0x1f0))/0x9)+parseInt(_0x285fa7(0x212))/0xa*(parseInt(_0x285fa7(0x1fb))/0xb)+-parseInt(_0x285fa7(0x1f7))/0xc*(-parseInt(_0x285fa7(0x20d))/0xd);if(_0x4a3d6c===_0x3df087)break;else _0x4cfeca['push'](_0x4cfeca['shift']());}catch(_0x378bee){_0x4cfeca['push'](_0x4cfeca['shift']());}}}(a7_0x24d7,0xf38c5));var a7_0x58d486=(function(){var _0x3b3a90=!![];return function(_0x152f4d,_0x1b42f3){var _0x3a4d7b=_0x3b3a90?function(){var _0x39cb99=a7_0x3937;if(_0x1b42f3){var _0x14fb2c=_0x1b42f3[_0x39cb99(0x208)](_0x152f4d,arguments);return _0x1b42f3=null,_0x14fb2c;}}:function(){};return _0x3b3a90=![],_0x3a4d7b;};}()),a7_0x4b53f8=a7_0x58d486(this,function(){var _0x17f065=a7_0x3937;return a7_0x4b53f8['toString']()['search'](_0x17f065(0x1fa))[_0x17f065(0x203)]()[_0x17f065(0x209)](a7_0x4b53f8)[_0x17f065(0x1fc)](_0x17f065(0x1fa));});a7_0x4b53f8();function a7_0x3937(_0x337ef8,_0x3667ba){_0x337ef8=_0x337ef8-0x1e9;var _0x1fe9ff=a7_0x24d7();var _0x4b53f8=_0x1fe9ff[_0x337ef8];return _0x4b53f8;}'use strict';var __createBinding=this&&this[a7_0x24a5ec(0x205)]||(Object[a7_0x24a5ec(0x1fe)]?function(_0x5c3967,_0x10cfc6,_0x3690a4,_0x2089b5){var _0x135fe7=a7_0x24a5ec;if(_0x2089b5===undefined)_0x2089b5=_0x3690a4;var _0x7091df=Object[_0x135fe7(0x1f3)](_0x10cfc6,_0x3690a4);(!_0x7091df||('get'in _0x7091df?!_0x10cfc6[_0x135fe7(0x1ff)]:_0x7091df[_0x135fe7(0x1f2)]||_0x7091df[_0x135fe7(0x200)]))&&(_0x7091df={'enumerable':!![],'get':function(){return _0x10cfc6[_0x3690a4];}}),Object[_0x135fe7(0x20c)](_0x5c3967,_0x2089b5,_0x7091df);}:function(_0x23e1bb,_0x474569,_0x1badfa,_0x42ab4e){if(_0x42ab4e===undefined)_0x42ab4e=_0x1badfa;_0x23e1bb[_0x42ab4e]=_0x474569[_0x1badfa];}),__exportStar=this&&this[a7_0x24a5ec(0x1f1)]||function(_0x1c42a4,_0x11fb8a){var _0x599c8a=a7_0x24a5ec;for(var _0x197af3 in _0x1c42a4)if(_0x197af3!=='default'&&!Object[_0x599c8a(0x20f)][_0x599c8a(0x1f9)]['call'](_0x11fb8a,_0x197af3))__createBinding(_0x11fb8a,_0x1c42a4,_0x197af3);};Object[a7_0x24a5ec(0x20c)](exports,a7_0x24a5ec(0x1ff),{'value':!![]}),exports['Configuration']=exports[a7_0x24a5ec(0x1e9)]=exports[a7_0x24a5ec(0x210)]=exports[a7_0x24a5ec(0x1fd)]=exports['Rule']=exports[a7_0x24a5ec(0x201)]=void 0x0,__exportStar(require(a7_0x24a5ec(0x1ec)),exports),__exportStar(require('./helper/dtoHelper'),exports),__exportStar(require(a7_0x24a5ec(0x1ee)),exports);var Validator_1=require(a7_0x24a5ec(0x20b));Object[a7_0x24a5ec(0x20c)](exports,a7_0x24a5ec(0x201),{'enumerable':!![],'get':function(){return Validator_1['Validator'];}});var Rule_1=require(a7_0x24a5ec(0x1f8));Object[a7_0x24a5ec(0x20c)](exports,a7_0x24a5ec(0x211),{'enumerable':!![],'get':function(){var _0x5476c1=a7_0x24a5ec;return Rule_1[_0x5476c1(0x211)];}}),Object[a7_0x24a5ec(0x20c)](exports,a7_0x24a5ec(0x1fd),{'enumerable':!![],'get':function(){var _0x5d18bf=a7_0x24a5ec;return Rule_1[_0x5d18bf(0x1fd)];}});var ValidatorError_1=require(a7_0x24a5ec(0x1ea));Object[a7_0x24a5ec(0x20c)](exports,a7_0x24a5ec(0x210),{'enumerable':!![],'get':function(){var _0x14eeb6=a7_0x24a5ec;return ValidatorError_1[_0x14eeb6(0x210)];}});var ValidatorService_1=require(a7_0x24a5ec(0x20a));Object[a7_0x24a5ec(0x20c)](exports,a7_0x24a5ec(0x1e9),{'enumerable':!![],'get':function(){var _0x2064cf=a7_0x24a5ec;return ValidatorService_1[_0x2064cf(0x1e9)];}});var configuration_1=require(a7_0x24a5ec(0x207));Object[a7_0x24a5ec(0x20c)](exports,a7_0x24a5ec(0x204),{'enumerable':!![],'get':function(){var _0x440476=a7_0x24a5ec;return configuration_1[_0x440476(0x202)];}});
@@ -0,0 +1,9 @@
1
+ import * as Joi from 'joi';
2
+ export declare const RULES_KEY = "anvero-api:validator:rules";
3
+ export declare const VALIDATOR_KEY = "anvero-api:validator:validator";
4
+ export interface ValidatorOptions {
5
+ locale?: string;
6
+ description?: string;
7
+ errorStatus?: number;
8
+ validationOptions?: Joi.ValidationOptions;
9
+ }
@@ -0,0 +1 @@
1
+ function a8_0x5d63(_0x26e2c0,_0x13bd5c){_0x26e2c0=_0x26e2c0-0x108;var _0x549cb9=a8_0x5cab();var _0x4965cd=_0x549cb9[_0x26e2c0];return _0x4965cd;}var a8_0x54e891=a8_0x5d63;(function(_0x4a900d,_0x360846){var _0x58769a=a8_0x5d63,_0x1a802d=_0x4a900d();while(!![]){try{var _0x1e10f4=parseInt(_0x58769a(0x110))/0x1*(parseInt(_0x58769a(0x109))/0x2)+-parseInt(_0x58769a(0x117))/0x3+parseInt(_0x58769a(0x10c))/0x4+parseInt(_0x58769a(0x113))/0x5*(-parseInt(_0x58769a(0x115))/0x6)+-parseInt(_0x58769a(0x111))/0x7*(-parseInt(_0x58769a(0x116))/0x8)+parseInt(_0x58769a(0x119))/0x9+-parseInt(_0x58769a(0x10f))/0xa;if(_0x1e10f4===_0x360846)break;else _0x1a802d['push'](_0x1a802d['shift']());}catch(_0x242a0f){_0x1a802d['push'](_0x1a802d['shift']());}}}(a8_0x5cab,0x1a370));var a8_0x4cb6b3=(function(){var _0x2894a7=!![];return function(_0x329da2,_0x1cf826){var _0x4f281c=_0x2894a7?function(){if(_0x1cf826){var _0x413072=_0x1cf826['apply'](_0x329da2,arguments);return _0x1cf826=null,_0x413072;}}:function(){};return _0x2894a7=![],_0x4f281c;};}()),a8_0x4965cd=a8_0x4cb6b3(this,function(){var _0x5a4ec6=a8_0x5d63;return a8_0x4965cd[_0x5a4ec6(0x10d)]()['search'](_0x5a4ec6(0x10b))[_0x5a4ec6(0x10d)]()['constructor'](a8_0x4965cd)[_0x5a4ec6(0x10e)](_0x5a4ec6(0x10b));});a8_0x4965cd();'use strict';function a8_0x5cab(){var _0x197d38=['276GaanMc','1295413tQZldt','RULES_KEY','5YSEIwG','anvero-api:validator:rules','59874qAitJm','8gJskox','632034MuqlVC','defineProperty','30114EGSKGJ','VALIDATOR_KEY','1256PfjOSp','anvero-api:validator:validator','(((.+)+)+)+$','602096jFbKpT','toString','search','1842240acMnaV'];a8_0x5cab=function(){return _0x197d38;};return a8_0x5cab();}Object[a8_0x54e891(0x118)](exports,'__esModule',{'value':!![]}),exports[a8_0x54e891(0x108)]=exports['RULES_KEY']=void 0x0,exports[a8_0x54e891(0x112)]=a8_0x54e891(0x114),exports[a8_0x54e891(0x108)]=a8_0x54e891(0x10a);
@@ -0,0 +1,15 @@
1
+ import * as Joi from "joi";
2
+ import { MidwayI18nServiceSingleton } from '@midwayjs/i18n';
3
+ export declare class ValidatorService {
4
+ protected i18nConfig: any;
5
+ protected validatorConfig: any;
6
+ protected i18nService: MidwayI18nServiceSingleton;
7
+ protected messages: {};
8
+ init(): Promise<void>;
9
+ getSchema<T extends new (...args: any[]) => any>(ClzType: T): Joi.ObjectSchema<any> | undefined;
10
+ validator<T extends new (...args: any[]) => any>(ClzType: T | Joi.ObjectSchema<any>, value: any, options?: {
11
+ errorStatus?: number;
12
+ locale?: string;
13
+ validationOptions?: Joi.ValidationOptions;
14
+ }): any;
15
+ }
@@ -0,0 +1 @@
1
+ const a9_0x4681c6=a9_0x101c;function a9_0x101c(_0x4d1757,_0x282dfd){_0x4d1757=_0x4d1757-0xf5;const _0x584f6f=a9_0x44a2();let _0x1b04a3=_0x584f6f[_0x4d1757];return _0x1b04a3;}(function(_0x1c583d,_0x5b4ed4){const _0xc19a6d=a9_0x101c,_0x1b7c21=_0x1c583d();while(!![]){try{const _0x3b6e55=parseInt(_0xc19a6d(0x130))/0x1+-parseInt(_0xc19a6d(0x129))/0x2*(parseInt(_0xc19a6d(0x12d))/0x3)+-parseInt(_0xc19a6d(0x12b))/0x4*(parseInt(_0xc19a6d(0x126))/0x5)+parseInt(_0xc19a6d(0x12f))/0x6+parseInt(_0xc19a6d(0x131))/0x7*(-parseInt(_0xc19a6d(0x13a))/0x8)+-parseInt(_0xc19a6d(0xf9))/0x9+parseInt(_0xc19a6d(0xfa))/0xa*(parseInt(_0xc19a6d(0x107))/0xb);if(_0x3b6e55===_0x5b4ed4)break;else _0x1b7c21['push'](_0x1b7c21['shift']());}catch(_0x398a58){_0x1b7c21['push'](_0x1b7c21['shift']());}}}(a9_0x44a2,0xd3154));const a9_0x3a7d59=(function(){let _0x56189e=!![];return function(_0x1d6842,_0x3adabe){const _0x4a1018=_0x56189e?function(){const _0x1a5444=a9_0x101c;if(_0x3adabe){const _0x1d0924=_0x3adabe[_0x1a5444(0xfc)](_0x1d6842,arguments);return _0x3adabe=null,_0x1d0924;}}:function(){};return _0x56189e=![],_0x4a1018;};}()),a9_0x1b04a3=a9_0x3a7d59(this,function(){const _0x266f6a=a9_0x101c;return a9_0x1b04a3[_0x266f6a(0x122)]()[_0x266f6a(0x111)](_0x266f6a(0x11a))[_0x266f6a(0x122)]()[_0x266f6a(0x135)](a9_0x1b04a3)[_0x266f6a(0x111)](_0x266f6a(0x11a));});a9_0x1b04a3();'use strict';function a9_0x44a2(){const _0x487e4a=['getSchema','getAvailableLocale','date','decorate','_flags','getClassExtendedMetadata','function','toString','type','design:type','Provide','104795gnvnoM','RULES_KEY','Inject','1215174abNDba','ValidatorError','204LAKqWg','i18nConfig','3LSSOfE','i18nService','9532482sdWmvB','247087EDVWDL','62993VawoYv','design:returntype','key','$_terms','constructor','locale','i18n','prototype','validationOptions','192anHwnd','getOwnPropertyDescriptor','length','messages','__decorate','Scope','ValidatorService','15418269foZyUn','8781250dPGOZW','参数验证失败','apply','Config','@midwayjs/i18n','message','language','object','validate','getLocaleMapping','value','../exception/ValidatorError','localeTable','33uqUqSm','PARAMS','Init','keys','error','metadata','__esModule','joi','../interface','init','search','NOFIND_SCHEMA','validator','formatLocale','errors','defineProperty','schema','format','Singleton','(((.+)+)+)+$'];a9_0x44a2=function(){return _0x487e4a;};return a9_0x44a2();}var __decorate=this&&this[a9_0x4681c6(0xf6)]||function(_0x241e56,_0x3d36f6,_0x4e4a23,_0x320179){const _0x4ecb10=a9_0x4681c6;var _0x18eef0=arguments[_0x4ecb10(0x13c)],_0x29b634=_0x18eef0<0x3?_0x3d36f6:_0x320179===null?_0x320179=Object[_0x4ecb10(0x13b)](_0x3d36f6,_0x4e4a23):_0x320179,_0x22494a;if(typeof Reflect===_0x4ecb10(0x101)&&typeof Reflect[_0x4ecb10(0x11e)]===_0x4ecb10(0x121))_0x29b634=Reflect['decorate'](_0x241e56,_0x3d36f6,_0x4e4a23,_0x320179);else{for(var _0x495d2b=_0x241e56[_0x4ecb10(0x13c)]-0x1;_0x495d2b>=0x0;_0x495d2b--)if(_0x22494a=_0x241e56[_0x495d2b])_0x29b634=(_0x18eef0<0x3?_0x22494a(_0x29b634):_0x18eef0>0x3?_0x22494a(_0x3d36f6,_0x4e4a23,_0x29b634):_0x22494a(_0x3d36f6,_0x4e4a23))||_0x29b634;}return _0x18eef0>0x3&&_0x29b634&&Object[_0x4ecb10(0x116)](_0x3d36f6,_0x4e4a23,_0x29b634),_0x29b634;},__metadata=this&&this['__metadata']||function(_0x3839f6,_0x4df68d){const _0x575aea=a9_0x4681c6;if(typeof Reflect===_0x575aea(0x101)&&typeof Reflect[_0x575aea(0x10c)]==='function')return Reflect[_0x575aea(0x10c)](_0x3839f6,_0x4df68d);};Object['defineProperty'](exports,a9_0x4681c6(0x10d),{'value':!![]}),exports[a9_0x4681c6(0xf8)]=void 0x0;const Joi=require(a9_0x4681c6(0x10e)),i18n_1=require(a9_0x4681c6(0xfe)),core_1=require('@midwayjs/core'),interface_1=require(a9_0x4681c6(0x10f)),ValidatorError_1=require(a9_0x4681c6(0x105));let ValidatorService=class ValidatorService{constructor(){const _0x3b8be8=a9_0x4681c6;this[_0x3b8be8(0xf5)]={};}async[a9_0x4681c6(0x110)](){const _0xcf1f51=a9_0x4681c6,_0x11386a=Object[_0xcf1f51(0x10a)](this['i18nConfig'][_0xcf1f51(0x106)]);_0x11386a['forEach'](_0x2488b4=>{const _0x13442f=_0xcf1f51;this[_0x13442f(0xf5)][(0x0,i18n_1[_0x13442f(0x114)])(_0x2488b4)]=Object['fromEntries'](this[_0x13442f(0x12e)][_0x13442f(0x103)](_0x2488b4,_0x13442f(0x113)));});}[a9_0x4681c6(0x11b)](_0x179235){const _0x745b8e=a9_0x4681c6,_0x231430=(0x0,core_1[_0x745b8e(0x120)])(interface_1[_0x745b8e(0x127)],_0x179235);return _0x231430?Joi['object'](_0x231430):undefined;}[a9_0x4681c6(0x113)](_0x54740a,_0x362ffe,_0x36c793={}){const _0x328dcd=a9_0x4681c6;var _0x6b0795,_0x2d7211,_0x37ea90,_0x55ca2f,_0x1d50b9,_0x11fd63;const _0x8c75b9=Joi['isSchema'](_0x54740a)?_0x54740a:this[_0x328dcd(0x11b)](_0x54740a);if(!_0x8c75b9)throw new AnnError(ValidatorError_1['ValidatorError'][_0x328dcd(0x112)]);_0x36c793[_0x328dcd(0x139)]=Object['assign']((_0x6b0795=this['validatorConfig']['validationOptions'])!==null&&_0x6b0795!==void 0x0?_0x6b0795:{},{'messages':this[_0x328dcd(0xf5)]},_0x36c793[_0x328dcd(0x139)]||{}),_0x36c793['validationOptions'][_0x328dcd(0x115)]=_0x36c793[_0x328dcd(0x139)][_0x328dcd(0x115)]||{},_0x36c793[_0x328dcd(0x139)][_0x328dcd(0x115)][_0x328dcd(0x100)]=(0x0,i18n_1[_0x328dcd(0x114)])(this[_0x328dcd(0x12e)][_0x328dcd(0x11c)](_0x36c793['validationOptions']['errors']['language']||_0x36c793[_0x328dcd(0x136)]||this['i18nConfig']['defaultLocale'],_0x328dcd(0x113)));const _0x553b53=_0x8c75b9[_0x328dcd(0x102)](_0x362ffe,_0x36c793[_0x328dcd(0x139)]);if(_0x553b53===null||_0x553b53===void 0x0?void 0x0:_0x553b53['error']){if(_0x553b53['error']instanceof AnnError)throw _0x553b53[_0x328dcd(0x10b)];else{if(_0x553b53[_0x328dcd(0x10b)]instanceof Error)throw new AnnError(ValidatorError_1['ValidatorError'][_0x328dcd(0x108)],{'message':((_0x2d7211=_0x553b53[_0x328dcd(0x10b)])===null||_0x2d7211===void 0x0?void 0x0:_0x2d7211['message'])||_0x328dcd(0xfb)});else throw new AnnError(ValidatorError_1[_0x328dcd(0x12a)][_0x328dcd(0x108)],{'message':((_0x1d50b9=(_0x55ca2f=(_0x37ea90=_0x553b53[_0x328dcd(0x10b)])===null||_0x37ea90===void 0x0?void 0x0:_0x37ea90['details'])===null||_0x55ca2f===void 0x0?void 0x0:_0x55ca2f[0x0])===null||_0x1d50b9===void 0x0?void 0x0:_0x1d50b9[_0x328dcd(0xff)])||_0x328dcd(0xfb)});}}if(_0x553b53===null||_0x553b53===void 0x0?void 0x0:_0x553b53[_0x328dcd(0x104)]){const _0x315529=(_0x11fd63=_0x8c75b9===null||_0x8c75b9===void 0x0?void 0x0:_0x8c75b9[_0x328dcd(0x134)])===null||_0x11fd63===void 0x0?void 0x0:_0x11fd63[_0x328dcd(0x10a)],_0x3b3eda=function(_0x5089e1,_0x4eef2e){const _0x127157=_0x328dcd;var _0xbb5d0f,_0x5cfb7c,_0x31e14a,_0x2ebfef,_0x256397,_0x1ca2ad,_0x4dfef5,_0x3379cb,_0x4930d4,_0x5b1fb4,_0x1e059c;for(let _0x596460 in _0x5089e1){if(_0x4eef2e[(_0xbb5d0f=_0x5089e1[_0x596460])===null||_0xbb5d0f===void 0x0?void 0x0:_0xbb5d0f['key']]&&((_0x31e14a=(_0x5cfb7c=_0x5089e1[_0x596460])===null||_0x5cfb7c===void 0x0?void 0x0:_0x5cfb7c['schema'])===null||_0x31e14a===void 0x0?void 0x0:_0x31e14a[_0x127157(0x123)])){if(((_0x256397=(_0x2ebfef=_0x5089e1[_0x596460])===null||_0x2ebfef===void 0x0?void 0x0:_0x2ebfef['schema'])===null||_0x256397===void 0x0?void 0x0:_0x256397['type'])=='object')_0x4eef2e[_0x5089e1[_0x596460][_0x127157(0x133)]]=_0x3b3eda((_0x4dfef5=(_0x1ca2ad=_0x5089e1[_0x596460])===null||_0x1ca2ad===void 0x0?void 0x0:_0x1ca2ad['schema'][_0x127157(0x134)])===null||_0x4dfef5===void 0x0?void 0x0:_0x4dfef5['keys'],_0x4eef2e[_0x5089e1[_0x596460][_0x127157(0x133)]]);else{if(_0x5089e1[_0x596460][_0x127157(0x117)]['type']==_0x127157(0x11d)&&_0x553b53['value'][(_0x3379cb=_0x5089e1[_0x596460])===null||_0x3379cb===void 0x0?void 0x0:_0x3379cb[_0x127157(0x133)]]){const _0x2225ee=((_0x1e059c=(_0x5b1fb4=(_0x4930d4=_0x5089e1[_0x596460])===null||_0x4930d4===void 0x0?void 0x0:_0x4930d4[_0x127157(0x117)])===null||_0x5b1fb4===void 0x0?void 0x0:_0x5b1fb4[_0x127157(0x11f)])===null||_0x1e059c===void 0x0?void 0x0:_0x1e059c[_0x127157(0x118)])||'YYYY-MM-DD\x20HH:mm:ss';_0x4eef2e[_0x5089e1[_0x596460][_0x127157(0x133)]]=dayjs(_0x553b53['value'][_0x5089e1[_0x596460]['key']])[_0x127157(0x118)](_0x2225ee);}}}}return _0x4eef2e;};return _0x3b3eda(_0x315529,_0x553b53['value']);}throw new AnnError(ValidatorError_1['ValidatorError'][_0x328dcd(0x108)]);}};exports[a9_0x4681c6(0xf8)]=ValidatorService,__decorate([(0x0,core_1[a9_0x4681c6(0xfd)])(a9_0x4681c6(0x137)),__metadata('design:type',Object)],ValidatorService[a9_0x4681c6(0x138)],a9_0x4681c6(0x12c),void 0x0),__decorate([(0x0,core_1[a9_0x4681c6(0xfd)])(a9_0x4681c6(0x113)),__metadata(a9_0x4681c6(0x124),Object)],ValidatorService[a9_0x4681c6(0x138)],'validatorConfig',void 0x0),__decorate([(0x0,core_1[a9_0x4681c6(0x128)])(),__metadata('design:type',i18n_1['MidwayI18nServiceSingleton'])],ValidatorService[a9_0x4681c6(0x138)],a9_0x4681c6(0x12e),void 0x0),__decorate([(0x0,core_1[a9_0x4681c6(0x109)])(),__metadata(a9_0x4681c6(0x124),Function),__metadata('design:paramtypes',[]),__metadata(a9_0x4681c6(0x132),Promise)],ValidatorService[a9_0x4681c6(0x138)],a9_0x4681c6(0x110),null),exports[a9_0x4681c6(0xf8)]=ValidatorService=__decorate([(0x0,core_1[a9_0x4681c6(0x125)])('validator'),(0x0,core_1[a9_0x4681c6(0xf7)])(core_1['ScopeEnum'][a9_0x4681c6(0x119)])],ValidatorService);
package/index.d.ts ADDED
@@ -0,0 +1,10 @@
1
+
2
+ export * from './dist/index';
3
+
4
+ declare module 'joi' {
5
+
6
+ interface DateSchema {
7
+ format(format: string | string[]): this;
8
+ utc(): this;
9
+ }
10
+ }
@@ -0,0 +1,116 @@
1
+ {
2
+ "alternatives.all": "{{#label}} does not match all of the required types",
3
+ "alternatives.any": "{{#label}} does not match any of the allowed types",
4
+ "alternatives.match": "{{#label}} does not match any of the allowed types",
5
+ "alternatives.one": "{{#label}} matches more than one allowed type",
6
+ "alternatives.types": "{{#label}} must be one of {{#types}}",
7
+ "any.custom": "{{#label}} failed custom validation because {{#error.message}}",
8
+ "any.default": "{{#label}} threw an error when running default method",
9
+ "any.failover": "{{#label}} threw an error when running failover method",
10
+ "any.invalid": "{{#label}} contains an invalid value",
11
+ "any.only": "{{#label}} must be {if(#valids.length == 1, \"\", \"one of \")}{{#valids}}",
12
+ "any.ref": "{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}",
13
+ "any.required": "{{#label}} is required",
14
+ "any.unknown": "{{#label}} is not allowed",
15
+ "array.base": "{{#label}} must be an array",
16
+ "array.excludes": "{{#label}} contains an excluded value",
17
+ "array.hasKnown": "{{#label}} does not contain at least one required match for type {:#patternLabel}",
18
+ "array.hasUnknown": "{{#label}} does not contain at least one required match",
19
+ "array.includes": "{{#label}} does not match any of the allowed types",
20
+ "array.includesRequiredBoth": "{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)",
21
+ "array.includesRequiredKnowns": "{{#label}} does not contain {{#knownMisses}}",
22
+ "array.includesRequiredUnknowns": "{{#label}} does not contain {{#unknownMisses}} required value(s)",
23
+ "array.length": "{{#label}} must contain {{#limit}} items",
24
+ "array.max": "{{#label}} must contain less than or equal to {{#limit}} items",
25
+ "array.min": "{{#label}} must contain at least {{#limit}} items",
26
+ "array.orderedLength": "{{#label}} must contain at most {{#limit}} items",
27
+ "array.sort": "{{#label}} must be sorted in {#order} order by {{#by}}",
28
+ "array.sort.mismatching": "{{#label}} cannot be sorted due to mismatching types",
29
+ "array.sort.unsupported": "{{#label}} cannot be sorted due to unsupported type {#type}",
30
+ "array.sparse": "{{#label}} must not be a sparse array item",
31
+ "array.unique": "{{#label}} contains a duplicate value",
32
+ "binary.base": "{{#label}} must be a buffer or a string",
33
+ "binary.length": "{{#label}} must be {{#limit}} bytes",
34
+ "binary.max": "{{#label}} must be less than or equal to {{#limit}} bytes",
35
+ "binary.min": "{{#label}} must be at least {{#limit}} bytes",
36
+ "boolean.base": "{{#label}} must be a boolean",
37
+ "date.base": "{{#label}} must be a valid date",
38
+ "date.format": "{{#label}} must be in {msg(\"date.format.\" + #format) || #format} format",
39
+ "date.greater": "{{#label}} must be greater than {{:#limit}}",
40
+ "date.less": "{{#label}} must be less than {{:#limit}}",
41
+ "date.max": "{{#label}} must be less than or equal to {{:#limit}}",
42
+ "date.min": "{{#label}} must be greater than or equal to {{:#limit}}",
43
+ "date.format.iso": "ISO 8601 date",
44
+ "date.format.javascript": "timestamp or number of milliseconds",
45
+ "date.format.unix": "timestamp or number of seconds",
46
+ "function.arity": "{{#label}} must have an arity of {{#n}}",
47
+ "function.class": "{{#label}} must be a class",
48
+ "function.maxArity": "{{#label}} must have an arity lesser or equal to {{#n}}",
49
+ "function.minArity": "{{#label}} must have an arity greater or equal to {{#n}}",
50
+ "object.and": "{{#label}} contains {{#presentWithLabels}} without its required peers {{#missingWithLabels}}",
51
+ "object.assert": "{{#label}} is invalid because {if(#subject.key, `\"` + #subject.key + `\" failed to ` + (#message || \"pass the assertion test\"), #message || \"the assertion failed\")}",
52
+ "object.base": "{{#label}} must be of type {{#type}}",
53
+ "object.instance": "{{#label}} must be an instance of {{:#type}}",
54
+ "object.length": "{{#label}} must have {{#limit}} key{if(#limit == 1, \"\", \"s\")}",
55
+ "object.max": "{{#label}} must have less than or equal to {{#limit}} key{if(#limit == 1, \"\", \"s\")}",
56
+ "object.min": "{{#label}} must have at least {{#limit}} key{if(#limit == 1, \"\", \"s\")}",
57
+ "object.missing": "{{#label}} must contain at least one of {{#peersWithLabels}}",
58
+ "object.nand": "{{:#mainWithLabel}} must not exist simultaneously with {{#peersWithLabels}}",
59
+ "object.oxor": "{{#label}} contains a conflict between optional exclusive peers {{#peersWithLabels}}",
60
+ "object.pattern.match": "{{#label}} keys failed to match pattern requirements",
61
+ "object.refType": "{{#label}} must be a Joi reference",
62
+ "object.regex": "{{#label}} must be a RegExp object",
63
+ "object.rename.multiple": "{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}",
64
+ "object.rename.override": "{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists",
65
+ "object.schema": "{{#label}} must be a Joi schema of {{#type}} type",
66
+ "object.unknown": "{{#label}} is not allowed",
67
+ "object.with": "{{:#mainWithLabel}} missing required peer {{:#peerWithLabel}}",
68
+ "object.without": "{{:#mainWithLabel}} conflict with forbidden peer {{:#peerWithLabel}}",
69
+ "object.xor": "{{#label}} contains a conflict between exclusive peers {{#peersWithLabels}}",
70
+ "number.base": "{{#label}} must be a number",
71
+ "number.greater": "{{#label}} must be greater than {{#limit}}",
72
+ "number.infinity": "{{#label}} cannot be infinity",
73
+ "number.integer": "{{#label}} must be an integer",
74
+ "number.less": "{{#label}} must be less than {{#limit}}",
75
+ "number.max": "{{#label}} must be less than or equal to {{#limit}}",
76
+ "number.min": "{{#label}} must be greater than or equal to {{#limit}}",
77
+ "number.multiple": "{{#label}} must be a multiple of {{#multiple}}",
78
+ "number.negative": "{{#label}} must be a negative number",
79
+ "number.port": "{{#label}} must be a valid port",
80
+ "number.positive": "{{#label}} must be a positive number",
81
+ "number.precision": "{{#label}} must have no more than {{#limit}} decimal places",
82
+ "number.unsafe": "{{#label}} must be a safe number",
83
+ "string.alphanum": "{{#label}} must only contain alpha-numeric characters",
84
+ "string.base": "{{#label}} must be a string",
85
+ "string.base64": "{{#label}} must be a valid base64 string",
86
+ "string.creditCard": "{{#label}} must be a credit card",
87
+ "string.dataUri": "{{#label}} must be a valid dataUri string",
88
+ "string.domain": "{{#label}} must contain a valid domain name",
89
+ "string.email": "{{#label}} must be a valid email",
90
+ "string.empty": "{{#label}} is not allowed to be empty",
91
+ "string.guid": "{{#label}} must be a valid GUID",
92
+ "string.hex": "{{#label}} must only contain hexadecimal characters",
93
+ "string.hexAlign": "{{#label}} hex decoded representation must be byte aligned",
94
+ "string.hostname": "{{#label}} must be a valid hostname",
95
+ "string.ip": "{{#label}} must be a valid ip address with a {{#cidr}} CIDR",
96
+ "string.ipVersion": "{{#label}} must be a valid ip address of one of the following versions {{#version}} with a {{#cidr}} CIDR",
97
+ "string.isoDate": "{{#label}} must be in iso format",
98
+ "string.isoDuration": "{{#label}} must be a valid ISO 8601 duration",
99
+ "string.length": "{{#label}} length must be {{#limit}} characters long",
100
+ "string.lowercase": "{{#label}} must only contain lowercase characters",
101
+ "string.max": "{{#label}} length must be less than or equal to {{#limit}} characters long",
102
+ "string.min": "{{#label}} length must be at least {{#limit}} characters long",
103
+ "string.normalize": "{{#label}} must be unicode normalized in the {{#form}} form",
104
+ "string.token": "{{#label}} must only contain alpha-numeric and underscore characters",
105
+ "string.pattern.base": "{{#label}} with value {:[.]} fails to match the required pattern: {{#regex}}",
106
+ "string.pattern.name": "{{#label}} with value {:[.]} fails to match the {{#name}} pattern",
107
+ "string.pattern.invert.base": "{{#label}} with value {:[.]} matches the inverted pattern: {{#regex}}",
108
+ "string.pattern.invert.name": "{{#label}} with value {:[.]} matches the inverted {{#name}} pattern",
109
+ "string.trim": "{{#label}} must not have leading or trailing whitespace",
110
+ "string.uri": "{{#label}} must be a valid uri",
111
+ "string.uriCustomScheme": "{{#label}} must be a valid uri with a scheme matching the {{#scheme}} pattern",
112
+ "string.uriRelativeOnly": "{{#label}} must be a valid relative uri",
113
+ "string.uppercase": "{{#label}} must only contain uppercase characters",
114
+ "symbol.base": "{{#label}} must be a symbol",
115
+ "symbol.map": "{{#label}} must be one of {{#map}}"
116
+ }
@@ -0,0 +1,116 @@
1
+ {
2
+ "alternatives.all": "{{#label}} 不能匹配上所以可选项",
3
+ "alternatives.any": "{{#label}} 不能匹配上任何可选项",
4
+ "alternatives.match": "{{#label}} 不能匹配上任何可选项",
5
+ "alternatives.one": "{{#label}} 匹配超过一个可选项",
6
+ "alternatives.types": "{{#label}} 必须是 {{#types}}",
7
+ "any.custom": "{{#label}} 自定义校验失败,原因为 {{#error.message}}",
8
+ "any.default": "{{#label}} 运行默认函数时出错",
9
+ "any.failover": "{{#label}} 运行 failover 函数时出错",
10
+ "any.invalid": "{{#label}} 不是可选值",
11
+ "any.only": "{{#label}} 必须是 {{#valids}} {if(#valids.length == 1, \"\", \"中的一个\")}",
12
+ "any.ref": "{{#label}} {{#arg}} 引用 {{:#ref}} 其中 {{#reason}}",
13
+ "any.required": "{{#label}} 不能为空",
14
+ "any.unknown": "{{#label}} 参数错误",
15
+ "array.base": "{{#label}} 必须是数组",
16
+ "array.excludes": "{{#label}} 包含非法的值",
17
+ "array.hasKnown": "{{#label}} 中至少一个类型为 {:#patternLabel} 的选项",
18
+ "array.hasUnknown": "{{#label}} 中至少有一个选项",
19
+ "array.includes": "{{#label}} 不能匹配任何可选项",
20
+ "array.includesRequiredBoth": "{{#label}} 不包含 {{#knownMisses}} 及 {{#unknownMisses}} 个必选项",
21
+ "array.includesRequiredKnowns": "{{#label}} 不包含 {{#knownMisses}} 等必选项",
22
+ "array.includesRequiredUnknowns": "{{#label}} 不包含 {{#unknownMisses}} 个必选项",
23
+ "array.length": "{{#label}} 必须正好包含 {{#limit}} 个成员",
24
+ "array.max": "{{#label}} 最多包含 {{#limit}} 个成员",
25
+ "array.min": "{{#label}} 至少包含 {{#limit}} 个成员",
26
+ "array.orderedLength": "{{#label}} 必须至少包含 {{#limit}} 个成员",
27
+ "array.sort": "{{#label}} 必须按 {#order} 顺序按 {{#by}} 排序",
28
+ "array.sort.mismatching": "{{#label}} 由于类型不匹配而无法排序",
29
+ "array.sort.unsupported": "{{#label}} 类型 {#type} 不支持排序",
30
+ "array.sparse": "{{#label}} 不能包含未定义成员",
31
+ "array.unique": "{{#label}} 是重复的成员",
32
+ "binary.base": "{{#label}} 必须是一段内容",
33
+ "binary.length": "{{#label}} 至少包含 {{#limit}} 个字节",
34
+ "binary.max": "{{#label}} 最多包含 {{#limit}} 个字节",
35
+ "binary.min": "{{#label}} 至少包含 {{#limit}} 个字节",
36
+ "boolean.base": "{{#label}} 必须是 bool 值",
37
+ "date.base": "{{#label}} 必须是毫秒数或者有效的时间字符串",
38
+ "date.format": "{{#label}} 必须是以下格式的字符串 {msg(\"date.format.\" + #format) || #format}",
39
+ "date.greater": "{{#label}} 必须晚于 {{:#limit}}",
40
+ "date.less": "{{#label}} 必须早于 {{:#limit}}",
41
+ "date.max": "{{#label}} 必须早于 {{:#limit}}",
42
+ "date.min": "{{#label}} 必须晚于 {{:#limit}}",
43
+ "date.format.iso": "必须是有效的\"ISO 8601\"格式的时间",
44
+ "date.format.javascript": "必须是有效的时间戳或者毫秒数",
45
+ "date.format.unix": "必须是有效的时间戳或者秒数",
46
+ "function.arity": "{{#label}} 必须正好拥有 {{#n}} 个参数",
47
+ "function.class": "{{#label}} 必须是对象类",
48
+ "function.maxArity": "{{#label}} 必须最多拥有 {{#n}} 个参数",
49
+ "function.minArity": "{{#label}} 必须至少拥有 {{#n}} 个参数",
50
+ "object.and": "{{#label}} 当前 {{#presentWithLabels}} 需要有对应的 {{#missingWithLabels}}",
51
+ "object.assert": "{{#label}} 无效,原因为 {if(#subject.key, `\"` + #subject.key + `\" failed to ` + (#message || \"pass the assertion test\"), #message || \"the assertion failed\")}",
52
+ "object.base": "{{#label}} 必须是一个对象 {{#type}}",
53
+ "object.instance": "{{#label}} 必须是一个 {{:#type}} 的实例",
54
+ "object.length": "{{#label}} 必须正好包含 {{#limit}} 个子对象",
55
+ "object.max": "{{#label}} 最多包含 {{#limit}} 个子对象",
56
+ "object.min": "{{#label}} 至少包含 {{#limit}} 个子对象",
57
+ "object.missing": "{{#label}} 没有对应的 {{#peersWithLabels}}",
58
+ "object.nand": "{{:#mainWithLabel}} 不得与 {{#peersWithLabels}} 同时存在",
59
+ "object.oxor": "{{#label}} 和 {{#peerWithLabels}} 有冲突",
60
+ "object.pattern.match": "{{#label}} 键匹配失败",
61
+ "object.refType": "{{#label}} 必须是 Joi 引用",
62
+ "object.regex": "{{#label}} 必须是正则对象",
63
+ "object.rename.multiple": "{{#label}} 无法重命名 {{:#from}} 因为多次重命名被禁用并且另一个键已经重命名为 {{:#to}}",
64
+ "object.rename.override": "{{#label}} 无法重命名 {{:#from}} 因为覆盖被禁用并且目标 {{:#to}} 存在",
65
+ "object.schema": "{{#label}} 必须是 {{#type}} 类型的 Joi Schema",
66
+ "object.unknown": "{{#label}} 不被允许",
67
+ "object.with": "{{:#mainWithLabel}} 缺少必需的对等方 {{:#peerWithLabel}}",
68
+ "object.without": "{{:#mainWithLabel}} 与禁止的节点冲突 {{:#peerWithLabel}}",
69
+ "object.xor": "{{#label}} 包含独占对等体之间的冲突 {{#peersWithLabels}}",
70
+ "number.base": "{{#label}} 必须是数值",
71
+ "number.greater": "{{#label}} 必须大于 {{#limit}}",
72
+ "number.infinity": "{{#label}} 不能是无穷大",
73
+ "number.integer": "{{#label}} 必须是整数",
74
+ "number.less": "{{#label}} 必须小于 {{#limit}}",
75
+ "number.max": "{{#label}} 必须小于或等于 {{#limit}}",
76
+ "number.min": "{{#label}} 必须大于或等于 {{#limit}}",
77
+ "number.multiple": "{{#label}} 必须是 {{#multiple}} 的倍数",
78
+ "number.negative": "{{#label}} 必须是负数",
79
+ "number.port": "{{#label}} 必须是有效的端口号",
80
+ "number.positive": "{{#label}} 必须是正数",
81
+ "number.precision": "{{#label}} 必须有 {{#limit}} 位小数",
82
+ "number.unsafe": "{{#label}} 必须是安全号码",
83
+ "string.alphanum": "{{#label}} must only contain alpha-numeric characters",
84
+ "string.base": "{{#label}} 必须是字符串",
85
+ "string.base64": "{{#label}} 必须是有效的 base64 字符串",
86
+ "string.creditCard": "{{#label}} 必须是有效的信用卡号",
87
+ "string.dataUri": "{{#label}} 必须是有效的 dataUri 字符串",
88
+ "string.domain": "{{#label}} 必须包含有效的域名",
89
+ "string.email": "{{#label}} 必须是有效的电子邮件",
90
+ "string.empty": "{{#label}} 不能为空",
91
+ "string.guid": "{{#label}} 必须是有效的 GUID",
92
+ "string.hex": "{{#label}} 只能包含十六进制字符",
93
+ "string.hexAlign": "{{#label}} 十六进制解码表示必须字节对齐",
94
+ "string.hostname": "{{#label}} 必须是有效的主机名",
95
+ "string.ip": "{{#label}} 必须是具有 {{#cidr}} CIDR 的有效 IP 地址",
96
+ "string.ipVersion": "{{#label}} 必须是以下版本之一的有效 IP 地址 {{#version}} 和 {{#cidr}} CIDR",
97
+ "string.isoDate": "{{#label}} 必须是 iso 格式",
98
+ "string.isoDuration": "{{#label}} 必须是有效的 ISO 8601 持续时间",
99
+ "string.length": "{{#label}} 长度必须为 {{#limit}} 个字符长",
100
+ "string.lowercase": "{{#label}} 只能包含小写字符",
101
+ "string.max": "{{#label}} 长度必须小于或等于 {{#limit}} 个字符长",
102
+ "string.min": "{{#label}} 长度必须至少为 {{#limit}} 个字符长",
103
+ "string.normalize": "{{#label}} 必须以 {{#form}} 形式进行 unicode 规范化",
104
+ "string.token": "{{#label}} 只能包含字母数字和下划线字符",
105
+ "string.pattern.base": "{{#label}} 的值为 {:[.]} 未能匹配所需的模式:{{#regex}}",
106
+ "string.pattern.name": "{{#label}} 值为 {:[.]} 未能匹配 {{#name}} 模式",
107
+ "string.pattern.invert.base": "{{#label}} 与值 {:[.]} 匹配反转模式:{{#regex}}",
108
+ "string.pattern.invert.name": "{{#label}} 与值 {:[.]} 匹配倒置的 {{#name}} 模式",
109
+ "string.trim": "{{#label}} 不得前后空格",
110
+ "string.uri": "{{#label}} 必须是有效的 uri",
111
+ "string.uriCustomScheme": "{{#label}} 必须是有效的 uri,其方案与 {{#scheme}} 模式匹配",
112
+ "string.uriRelativeOnly": "{{#label}} 必须是有效的相对 uri",
113
+ "string.uppercase": "{{#label}} 只能包含大写字符",
114
+ "symbol.base": "{{#label}} 必须是符号",
115
+ "symbol.map": "{{#label}} 必须是 {{#map}} 之一"
116
+ }
package/package.json CHANGED
@@ -1,6 +1,32 @@
1
- {
2
- "name": "@anveroapi/validator",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "@anveroapi/validator",
3
+ "version": "3.0.0",
4
+ "main": "./dist/index.js",
5
+ "typings": "index.d.ts",
6
+ "license": "MIT",
7
+ "files": [
8
+ "dist",
9
+ "locales",
10
+ "index.d.ts"
11
+ ],
12
+ "publishConfig": {
13
+ "access": "public",
14
+ "registry": "https://registry.npmjs.org/"
15
+ },
16
+ "scripts": {
17
+ "build2": "tsc",
18
+ "build": "tsc && javascript-obfuscator ./dist --output ./dist --config obfuscator.json"
19
+ },
20
+ "dependencies": {
21
+ "@midwayjs/core": "^3.17.1",
22
+ "@anveroapi/core": "workspace:^",
23
+ "@joi/date": "^2.1.0",
24
+ "joi": "^17.11.0"
25
+ },
26
+ "devDependencies": {
27
+ "@types/node": "20.10.0",
28
+ "javascript-obfuscator": "^4.0.2",
29
+ "typescript": "~5.9.3"
30
+ },
31
+ "gitHead": "f7d4644d5e0591c4b383021edab6db20d1714880"
32
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.