@anveroapi/validator 0.0.0-stage → 3.0.1

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
+ const a0_0x1df037=a0_0x463b;(function(_0x40677b,_0x16504b){const _0x3e1a49=a0_0x463b,_0x1b5516=_0x40677b();while(!![]){try{const _0x21506b=-parseInt(_0x3e1a49(0x13c))/0x1+-parseInt(_0x3e1a49(0x13a))/0x2*(parseInt(_0x3e1a49(0x13d))/0x3)+parseInt(_0x3e1a49(0x13e))/0x4+parseInt(_0x3e1a49(0x132))/0x5+parseInt(_0x3e1a49(0x142))/0x6+parseInt(_0x3e1a49(0x141))/0x7*(-parseInt(_0x3e1a49(0x133))/0x8)+parseInt(_0x3e1a49(0x13f))/0x9*(parseInt(_0x3e1a49(0x138))/0xa);if(_0x21506b===_0x16504b)break;else _0x1b5516['push'](_0x1b5516['shift']());}catch(_0x583f77){_0x1b5516['push'](_0x1b5516['shift']());}}}(a0_0x4309,0x9ae9d));const a0_0x34ef69=(function(){let _0xdbb27c=!![];return function(_0x447022,_0x4f1ef1){const _0x12aa51=_0xdbb27c?function(){const _0x154bb4=a0_0x463b;if(_0x4f1ef1){const _0x1fc313=_0x4f1ef1[_0x154bb4(0x13b)](_0x447022,arguments);return _0x4f1ef1=null,_0x1fc313;}}:function(){};return _0xdbb27c=![],_0x12aa51;};}()),a0_0x275384=a0_0x34ef69(this,function(){const _0x2be641=a0_0x463b;return a0_0x275384[_0x2be641(0x139)]()['search'](_0x2be641(0x136))[_0x2be641(0x139)]()[_0x2be641(0x135)](a0_0x275384)['search']('(((.+)+)+)+$');});a0_0x275384();'use strict';function a0_0x4309(){const _0x540a31=['default','6636329mMpaNF','536034EJWRLT','string','defineProperty','ValidatorError','PARAMS','401555LVVrLr','8cwobCq','../exception/ValidatorError','constructor','(((.+)+)+)+$','__esModule','26300CTFvQt','toString','1886854CPyMll','apply','1258680zuppna','3mTFEoX','1047116nYZpbj','11475fCUfVs'];a0_0x4309=function(){return _0x540a31;};return a0_0x4309();}function a0_0x463b(_0x380f61,_0x1891dc){_0x380f61=_0x380f61-0x130;const _0x4713ba=a0_0x4309();let _0x275384=_0x4713ba[_0x380f61];return _0x275384;}Object[a0_0x1df037(0x144)](exports,a0_0x1df037(0x137),{'value':!![]});const ValidatorError_1=require(a0_0x1df037(0x134));exports[a0_0x1df037(0x140)]={'validator':{'errorStatus':ValidatorError_1[a0_0x1df037(0x130)][a0_0x1df037(0x131)],'validationOptions':{'allowUnknown':!![],'stripUnknown':!![],'dateFormat':a0_0x1df037(0x143)}},'i18n':{'localeTable':{'en_US':{'validator':require('../../locales/en_US.json')},'zh_CN':{'validator':require('../../locales/zh_CN.json')}}}};
@@ -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_0x1340f3=a1_0x2743;function a1_0x2743(_0x3d14f,_0x31b375){_0x3d14f=_0x3d14f-0x77;const _0x23fde3=a1_0x3c73();let _0x4e3b1f=_0x23fde3[_0x3d14f];return _0x4e3b1f;}(function(_0x175733,_0x97394a){const _0x29e7f7=a1_0x2743,_0x52dbec=_0x175733();while(!![]){try{const _0x533d3=parseInt(_0x29e7f7(0xa8))/0x1+parseInt(_0x29e7f7(0x7f))/0x2*(-parseInt(_0x29e7f7(0x92))/0x3)+-parseInt(_0x29e7f7(0x77))/0x4*(parseInt(_0x29e7f7(0x81))/0x5)+-parseInt(_0x29e7f7(0xb4))/0x6*(-parseInt(_0x29e7f7(0x9b))/0x7)+-parseInt(_0x29e7f7(0x86))/0x8*(-parseInt(_0x29e7f7(0xa1))/0x9)+-parseInt(_0x29e7f7(0x9e))/0xa*(-parseInt(_0x29e7f7(0x99))/0xb)+-parseInt(_0x29e7f7(0x79))/0xc*(parseInt(_0x29e7f7(0x89))/0xd);if(_0x533d3===_0x97394a)break;else _0x52dbec['push'](_0x52dbec['shift']());}catch(_0x460981){_0x52dbec['push'](_0x52dbec['shift']());}}}(a1_0x3c73,0x5a739));const a1_0x1c31b9=(function(){let _0x4da437=!![];return function(_0x28efbd,_0x2840e8){const _0x45182d=_0x4da437?function(){const _0x1e7a7a=a1_0x2743;if(_0x2840e8){const _0x2e43d5=_0x2840e8[_0x1e7a7a(0x85)](_0x28efbd,arguments);return _0x2840e8=null,_0x2e43d5;}}:function(){};return _0x4da437=![],_0x45182d;};}()),a1_0x4e3b1f=a1_0x1c31b9(this,function(){const _0x2118c6=a1_0x2743;return a1_0x4e3b1f[_0x2118c6(0xae)]()['search']('(((.+)+)+)+$')[_0x2118c6(0xae)]()[_0x2118c6(0x8e)](a1_0x4e3b1f)['search'](_0x2118c6(0x84));});a1_0x4e3b1f();'use strict';var __decorate=this&&this[a1_0x1340f3(0xa6)]||function(_0x1fb969,_0x18a08f,_0x93eb67,_0x30c52f){const _0x54258b=a1_0x1340f3;var _0x4a9730=arguments[_0x54258b(0x78)],_0x4c2882=_0x4a9730<0x3?_0x18a08f:_0x30c52f===null?_0x30c52f=Object[_0x54258b(0xa3)](_0x18a08f,_0x93eb67):_0x30c52f,_0x5a5245;if(typeof Reflect===_0x54258b(0x9d)&&typeof Reflect[_0x54258b(0x95)]===_0x54258b(0x9a))_0x4c2882=Reflect['decorate'](_0x1fb969,_0x18a08f,_0x93eb67,_0x30c52f);else{for(var _0x172185=_0x1fb969[_0x54258b(0x78)]-0x1;_0x172185>=0x0;_0x172185--)if(_0x5a5245=_0x1fb969[_0x172185])_0x4c2882=(_0x4a9730<0x3?_0x5a5245(_0x4c2882):_0x4a9730>0x3?_0x5a5245(_0x18a08f,_0x93eb67,_0x4c2882):_0x5a5245(_0x18a08f,_0x93eb67))||_0x4c2882;}return _0x4a9730>0x3&&_0x4c2882&&Object[_0x54258b(0xa4)](_0x18a08f,_0x93eb67,_0x4c2882),_0x4c2882;},__metadata=this&&this['__metadata']||function(_0x1daccd,_0xe770f4){const _0x4269f1=a1_0x1340f3;if(typeof Reflect===_0x4269f1(0x9d)&&typeof Reflect[_0x4269f1(0x97)]===_0x4269f1(0x9a))return Reflect['metadata'](_0x1daccd,_0xe770f4);};Object[a1_0x1340f3(0xa4)](exports,a1_0x1340f3(0xaf),{'value':!![]}),exports[a1_0x1340f3(0x98)]=void 0x0;function a1_0x3c73(){const _0x61d1e5=['getAttr','345839ISijHX','getClassMetadata','REQUEST_OBJ_CTX_KEY','validator','./config/config.default','constructor','request','param','body','24XfkWIb','decorator','design:type','decorate','getSchema','metadata','CustomConfiguration','11hBBxbW','function','4810204poiQcc','VALIDATOR_KEY','object','820390agzsUz','params','args','9RvdDnk','splice','getOwnPropertyDescriptor','defineProperty','query','__decorate','@anveroapi/core','456597hbMrZc','@midwayjs/i18n','res','locale','Configuration','method','toString','__esModule','./interface','Inject','registerMethodHandler','onReady','6fvXhRw','3232evAdxi','length','264tfjDcX','anvero-api:validator','prototype','ValidatorService','name','methodName','125906CJmVmc','find','1695vdmZcI','propertyName','methodArgs','(((.+)+)+)+$','apply','4059864SgMnEd','MidwayDecoratorService'];a1_0x3c73=function(){return _0x61d1e5;};return a1_0x3c73();}const i18n_1=require('@midwayjs/i18n'),core_1=require('@midwayjs/core'),core_2=require('@midwayjs/core'),interface_1=require(a1_0x1340f3(0xb0)),ValidatorService_1=require('./service/ValidatorService'),i18n=require(a1_0x1340f3(0xa9)),anvero=require(a1_0x1340f3(0xa7)),ConfigDefault=require(a1_0x1340f3(0x8d));let CustomConfiguration=class CustomConfiguration{async[a1_0x1340f3(0xb3)](){const _0x3a3ad5=a1_0x1340f3;this['decorator'][_0x3a3ad5(0xb2)](interface_1[_0x3a3ad5(0x9c)],_0x4b0dbc=>{const _0x376b97=_0x3a3ad5,_0x2e7a6f=_0x4b0dbc['metadata'],_0x2774b3=(0x0,core_2['getMethodParamTypes'])(_0x4b0dbc['target'],_0x4b0dbc[_0x376b97(0x82)]);return{'before':_0x2287c8=>{const _0x36194c=_0x376b97;var _0x1fdc4c,_0x5cbd5b,_0x120580,_0x368ca5,_0x524e54,_0x54f649,_0x1ec4f1,_0xe09761,_0x17d7ef,_0x2a2626,_0x48e80c,_0x119448,_0x148c55;const _0x104948=_0x2287c8['target'][core_1[_0x36194c(0x8b)]],_0x4f0fd7=Object['assign']({},((_0x1fdc4c=_0x104948===null||_0x104948===void 0x0?void 0x0:_0x104948['request'])===null||_0x1fdc4c===void 0x0?void 0x0:_0x1fdc4c[_0x36194c(0xa5)])||{},((_0x5cbd5b=_0x104948===null||_0x104948===void 0x0?void 0x0:_0x104948[_0x36194c(0x8f)])===null||_0x5cbd5b===void 0x0?void 0x0:_0x5cbd5b[_0x36194c(0x91)])||{}),_0x200af8=((0x0,core_2[_0x36194c(0x8a)])(interface_1[_0x36194c(0x9c)],_0x2287c8['target'])||[])[_0x36194c(0x80)](_0x73ce9f=>_0x73ce9f[_0x36194c(0xad)]==_0x2287c8[_0x36194c(0x7e)]);!(_0x2e7a6f===null||_0x2e7a6f===void 0x0?void 0x0:_0x2e7a6f[_0x36194c(0xab)])&&_0x104948&&_0x104948[_0x36194c(0x88)]&&(_0x2e7a6f[_0x36194c(0xab)]=_0x104948['getAttr'](i18n_1['I18N_ATTR_KEY']));for(let _0x7d7f45=0x0;_0x7d7f45<_0x2774b3[_0x36194c(0x78)];_0x7d7f45++){const _0x24ca42=_0x2774b3[_0x7d7f45],_0x37e891=this['ValidatorService'][_0x36194c(0x96)](_0x24ca42);if(_0x37e891){if(typeof _0x2287c8[_0x36194c(0xa0)][_0x7d7f45]=='undefined'||((_0x120580=_0x2287c8[_0x36194c(0xa0)][_0x7d7f45])===null||_0x120580===void 0x0?void 0x0:_0x120580[_0x36194c(0x8f)])&&((_0x368ca5=_0x2287c8[_0x36194c(0xa0)][_0x7d7f45])===null||_0x368ca5===void 0x0?void 0x0:_0x368ca5[_0x36194c(0xaa)])&&((_0x524e54=_0x2287c8['args'][_0x7d7f45])===null||_0x524e54===void 0x0?void 0x0:_0x524e54['req']))_0x2287c8[_0x36194c(0xa0)][_0x7d7f45]=_0x4f0fd7;else((_0x54f649=_0x2287c8[_0x36194c(0xa0)][_0x7d7f45])===null||_0x54f649===void 0x0?void 0x0:_0x54f649[_0x36194c(0x7d)])=='bound\x20dispatch'&&_0x2287c8['args'][_0x36194c(0xa2)](_0x7d7f45,0x0,_0x4f0fd7);const _0x44365b=this[_0x36194c(0x7c)][_0x36194c(0x8c)](_0x37e891,_0x2287c8[_0x36194c(0xa0)][_0x7d7f45],_0x2e7a6f);_0x44365b&&(_0x2287c8['args'][_0x7d7f45]=_0x44365b);}else{if((_0x200af8===null||_0x200af8===void 0x0?void 0x0:_0x200af8[_0x36194c(0x83)][_0x7d7f45])&&((_0x1ec4f1=_0x2287c8[_0x36194c(0xa0)][_0x7d7f45])===null||_0x1ec4f1===void 0x0?void 0x0:_0x1ec4f1[_0x36194c(0x9f)])&&typeof _0x2287c8[_0x36194c(0xa0)][_0x7d7f45][_0x36194c(0x90)]==_0x36194c(0x9a)&&((_0xe09761=_0x104948===null||_0x104948===void 0x0?void 0x0:_0x104948[_0x36194c(0x9f)])===null||_0xe09761===void 0x0?void 0x0:_0xe09761[_0x200af8[_0x36194c(0x83)][_0x7d7f45]]))_0x2287c8['args'][_0x7d7f45]=_0x24ca42((_0x17d7ef=_0x104948===null||_0x104948===void 0x0?void 0x0:_0x104948[_0x36194c(0x9f)])===null||_0x17d7ef===void 0x0?void 0x0:_0x17d7ef[_0x200af8[_0x36194c(0x83)][_0x7d7f45]]);else(_0x200af8===null||_0x200af8===void 0x0?void 0x0:_0x200af8['methodArgs'][_0x7d7f45])&&((_0x48e80c=(_0x2a2626=_0x2287c8[_0x36194c(0xa0)][_0x7d7f45])===null||_0x2a2626===void 0x0?void 0x0:_0x2a2626['params'])===null||_0x48e80c===void 0x0?void 0x0:_0x48e80c[_0x200af8['methodArgs'][_0x7d7f45]])&&(_0x2287c8['args'][_0x7d7f45]=(_0x148c55=(_0x119448=_0x2287c8[_0x36194c(0xa0)][_0x7d7f45])===null||_0x119448===void 0x0?void 0x0:_0x119448[_0x36194c(0x9f)])===null||_0x148c55===void 0x0?void 0x0:_0x148c55[_0x200af8[_0x36194c(0x83)][_0x7d7f45]]);}}},'afterThrow':(_0x3e82e8,_0x4e7ae5)=>{throw _0x4e7ae5;}};});}};exports[a1_0x1340f3(0x98)]=CustomConfiguration,__decorate([(0x0,core_2['Inject'])(),__metadata(a1_0x1340f3(0x94),core_1[a1_0x1340f3(0x87)])],CustomConfiguration[a1_0x1340f3(0x7b)],a1_0x1340f3(0x93),void 0x0),__decorate([(0x0,core_2[a1_0x1340f3(0xb1)])(),__metadata(a1_0x1340f3(0x94),ValidatorService_1[a1_0x1340f3(0x7c)])],CustomConfiguration[a1_0x1340f3(0x7b)],a1_0x1340f3(0x7c),void 0x0),exports[a1_0x1340f3(0x98)]=CustomConfiguration=__decorate([(0x0,core_2[a1_0x1340f3(0xac)])({'conflictCheck':![],'imports':[i18n,anvero],'namespace':a1_0x1340f3(0x7a),'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_0x139c0f=a2_0x6c31;function a2_0x4637(){const _0x413386=['109feEUml','toString','9329670KdpwEH','getPropertyType','1185530HzqHgN','attachClassMetadata','5466CzeGWW','description','(((.+)+)+)+$','RuleType','label','search','array','default','function','RULES_KEY','getClassMetadata','../interface','@midwayjs/core','__esModule','2873166LzTFrX','Rule','@joi/date','saveClassMetadata','extend','name','isSchema','joi','3329160SSpvUl','4064536JYRdse','31856KUAwlZ','keys','items','369XfgAkk'];a2_0x4637=function(){return _0x413386;};return a2_0x4637();}(function(_0x3bc1e8,_0x1b3080){const _0x1f151e=a2_0x6c31,_0x6bd284=_0x3bc1e8();while(!![]){try{const _0x17943b=parseInt(_0x1f151e(0x19a))/0x1*(parseInt(_0x1f151e(0x1a0))/0x2)+parseInt(_0x1f151e(0x1ae))/0x3+parseInt(_0x1f151e(0x195))/0x4+parseInt(_0x1f151e(0x19e))/0x5+-parseInt(_0x1f151e(0x1b6))/0x6+-parseInt(_0x1f151e(0x19c))/0x7+parseInt(_0x1f151e(0x196))/0x8*(parseInt(_0x1f151e(0x199))/0x9);if(_0x17943b===_0x1b3080)break;else _0x6bd284['push'](_0x6bd284['shift']());}catch(_0x5c9968){_0x6bd284['push'](_0x6bd284['shift']());}}}(a2_0x4637,0xbf843));const a2_0x2ab4a1=(function(){let _0x13ac6c=!![];return function(_0x570770,_0x64f44e){const _0x58a3b1=_0x13ac6c?function(){if(_0x64f44e){const _0x448d39=_0x64f44e['apply'](_0x570770,arguments);return _0x64f44e=null,_0x448d39;}}:function(){};return _0x13ac6c=![],_0x58a3b1;};}()),a2_0x411f85=a2_0x2ab4a1(this,function(){const _0x4387d2=a2_0x6c31;return a2_0x411f85[_0x4387d2(0x19b)]()[_0x4387d2(0x1a5)]('(((.+)+)+)+$')[_0x4387d2(0x19b)]()['constructor'](a2_0x411f85)['search'](_0x4387d2(0x1a2));});a2_0x411f85();'use strict';Object['defineProperty'](exports,a2_0x139c0f(0x1ad),{'value':!![]}),exports[a2_0x139c0f(0x1a3)]=void 0x0,exports[a2_0x139c0f(0x1af)]=Rule;const joi=require(a2_0x139c0f(0x1b5)),date_1=require(a2_0x139c0f(0x1b0)),core_1=require(a2_0x139c0f(0x1ac)),interface_1=require(a2_0x139c0f(0x1ab));exports[a2_0x139c0f(0x1a3)]=joi[a2_0x139c0f(0x1b2)](date_1[a2_0x139c0f(0x1a7)]);function a2_0x6c31(_0x3f7239,_0x52e2f1){_0x3f7239=_0x3f7239-0x195;const _0x31b2a0=a2_0x4637();let _0x411f85=_0x31b2a0[_0x3f7239];return _0x411f85;}function Rule(_0x434e90,_0x10dea3,_0x2ccb56=''){return(_0x16deff,_0x4e59e9)=>{const _0x2e74d5=a2_0x6c31;var _0x489224;if(_0x4e59e9)!joi[_0x2e74d5(0x1b4)](_0x10dea3)&&(_0x10dea3===null||_0x10dea3===void 0x0?void 0x0:_0x10dea3[_0x2e74d5(0x1b3)])&&(_0x10dea3=joi['object']((0x0,core_1[_0x2e74d5(0x1aa)])(interface_1[_0x2e74d5(0x1a9)],_0x10dea3))['meta']({'id':_0x10dea3[_0x2e74d5(0x1b3)]}),(0x0,core_1[_0x2e74d5(0x19d)])(_0x16deff,_0x4e59e9)[_0x2e74d5(0x1b3)]==='Array'&&(_0x10dea3=joi[_0x2e74d5(0x1a6)]()[_0x2e74d5(0x198)](_0x10dea3))),joi['isSchema'](_0x10dea3)&&(_0x434e90&&typeof(_0x10dea3===null||_0x10dea3===void 0x0?void 0x0:_0x10dea3[_0x2e74d5(0x1a4)])==_0x2e74d5(0x1a8)&&(_0x10dea3=_0x10dea3['label'](_0x434e90)),_0x2ccb56&&typeof(_0x10dea3===null||_0x10dea3===void 0x0?void 0x0:_0x10dea3[_0x2e74d5(0x1a1)])==_0x2e74d5(0x1a8)&&(_0x10dea3=_0x10dea3[_0x2e74d5(0x1a1)](_0x2ccb56)),(0x0,core_1[_0x2e74d5(0x19f)])(interface_1['RULES_KEY'],_0x10dea3,_0x16deff,_0x4e59e9));else{const _0xad873a=(0x0,core_1[_0x2e74d5(0x1aa)])(interface_1[_0x2e74d5(0x1a9)],_0x10dea3);if(_0xad873a){let _0x2e8224=(_0x489224=(0x0,core_1[_0x2e74d5(0x1aa)])(interface_1[_0x2e74d5(0x1a9)],_0x16deff))!==null&&_0x489224!==void 0x0?_0x489224:{};Object[_0x2e74d5(0x197)](_0xad873a)['map'](_0x402390=>{!_0x2e8224[_0x402390]&&(_0x2e8224[_0x402390]=_0xad873a[_0x402390]);}),(0x0,core_1[_0x2e74d5(0x1b1)])(interface_1[_0x2e74d5(0x1a9)],_0x2e8224,_0x16deff);}}};}
@@ -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
+ const a3_0x31a09c=a3_0x3110;(function(_0x118fd5,_0x2d20ad){const _0x12f1ff=a3_0x3110,_0x24beab=_0x118fd5();while(!![]){try{const _0x3386f9=-parseInt(_0x12f1ff(0x16d))/0x1+parseInt(_0x12f1ff(0x163))/0x2*(parseInt(_0x12f1ff(0x173))/0x3)+-parseInt(_0x12f1ff(0x164))/0x4+-parseInt(_0x12f1ff(0x17a))/0x5+parseInt(_0x12f1ff(0x161))/0x6+-parseInt(_0x12f1ff(0x171))/0x7*(-parseInt(_0x12f1ff(0x166))/0x8)+-parseInt(_0x12f1ff(0x175))/0x9*(-parseInt(_0x12f1ff(0x176))/0xa);if(_0x3386f9===_0x2d20ad)break;else _0x24beab['push'](_0x24beab['shift']());}catch(_0x46db6a){_0x24beab['push'](_0x24beab['shift']());}}}(a3_0x1bce,0x57c07));const a3_0x219976=(function(){let _0x16fa23=!![];return function(_0x15220f,_0x161d63){const _0x5952b0=_0x16fa23?function(){const _0x147310=a3_0x3110;if(_0x161d63){const _0x126304=_0x161d63[_0x147310(0x179)](_0x15220f,arguments);return _0x161d63=null,_0x126304;}}:function(){};return _0x16fa23=![],_0x5952b0;};}()),a3_0xd45c7c=a3_0x219976(this,function(){const _0x392187=a3_0x3110;return a3_0xd45c7c[_0x392187(0x17c)]()['search'](_0x392187(0x16a))[_0x392187(0x17c)]()[_0x392187(0x16b)](a3_0xd45c7c)[_0x392187(0x16f)](_0x392187(0x16a));});function a3_0x1bce(){const _0x48cd25=['toString','2445228RUyIpN','attachClassMetadata','1021102DLopCG','322488ZnSyfO','getFuncArgs','176FByREh','function','prototype','match','(((.+)+)+)+$','constructor','indexOf','528807TMbAGW','replace','search','@midwayjs/core','95606oVFXtC','defineProperty','3LBerAR','createCustomMethodDecorator','9ESCcmZ','2968130sVyCad','slice','VALIDATOR_KEY','apply','2732590xhkdEK','../interface'];a3_0x1bce=function(){return _0x48cd25;};return a3_0x1bce();}a3_0xd45c7c();function a3_0x3110(_0x22db10,_0x2a82f7){_0x22db10=_0x22db10-0x161;const _0x9057af=a3_0x1bce();let _0xd45c7c=_0x9057af[_0x22db10];return _0xd45c7c;}'use strict';Object[a3_0x31a09c(0x172)](exports,'__esModule',{'value':!![]}),exports['Validator']=Validator,exports[a3_0x31a09c(0x165)]=getFuncArgs;const core_1=require(a3_0x31a09c(0x170)),interface_1=require(a3_0x31a09c(0x17b));function Validator(_0x2e3e80={}){return(_0x307cbe,_0x56966a,_0x3cfc26)=>{const _0x4de620=a3_0x3110,_0x3ea7c0=getFuncArgs(_0x307cbe[_0x56966a]);(0x0,core_1[_0x4de620(0x162)])(interface_1[_0x4de620(0x178)],{'method':_0x56966a,'methodArgs':_0x3ea7c0},_0x307cbe),(0x0,core_1[_0x4de620(0x174)])(interface_1[_0x4de620(0x178)],_0x2e3e80)(_0x307cbe,_0x56966a,_0x3cfc26);};}function getFuncArgs(_0x583f56){const _0x21b7db=a3_0x31a09c;if(typeof _0x583f56==_0x21b7db(0x167)){const _0x2953f7=/=>.*$/mg,_0x2f3f84=/=[^,)]+/mg,_0x13adb2=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,_0x35b409=(_0x583f56[_0x21b7db(0x168)]?_0x583f56[_0x21b7db(0x168)][_0x21b7db(0x16b)][_0x21b7db(0x17c)]():_0x583f56[_0x21b7db(0x17c)]())[_0x21b7db(0x16e)](_0x13adb2,'')[_0x21b7db(0x16e)](_0x2953f7,'')[_0x21b7db(0x16e)](_0x2f3f84,''),_0x199112=_0x35b409[_0x21b7db(0x177)](_0x35b409[_0x21b7db(0x16c)]('(')+0x1,_0x35b409[_0x21b7db(0x16c)](')'))[_0x21b7db(0x169)](/([^\s,]+)/g)||[];return _0x199112;}}
@@ -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_0x44398e=a4_0x219e;(function(_0x1aac3e,_0x5daf11){var _0x3ed8c8=a4_0x219e,_0x56d7e0=_0x1aac3e();while(!![]){try{var _0x3c0d99=parseInt(_0x3ed8c8(0xc9))/0x1*(parseInt(_0x3ed8c8(0xd5))/0x2)+parseInt(_0x3ed8c8(0xcd))/0x3+parseInt(_0x3ed8c8(0xc5))/0x4*(-parseInt(_0x3ed8c8(0xbf))/0x5)+-parseInt(_0x3ed8c8(0xc4))/0x6*(-parseInt(_0x3ed8c8(0xc8))/0x7)+-parseInt(_0x3ed8c8(0xc7))/0x8*(parseInt(_0x3ed8c8(0xcf))/0x9)+-parseInt(_0x3ed8c8(0xbb))/0xa+-parseInt(_0x3ed8c8(0xd0))/0xb*(-parseInt(_0x3ed8c8(0xbc))/0xc);if(_0x3c0d99===_0x5daf11)break;else _0x56d7e0['push'](_0x56d7e0['shift']());}catch(_0x1f0240){_0x56d7e0['push'](_0x56d7e0['shift']());}}}(a4_0x1a3c,0xc5b0c));var a4_0x1d92c7=(function(){var _0x327d5b=!![];return function(_0x35982b,_0xc70a07){var _0x1d85a4=_0x327d5b?function(){if(_0xc70a07){var _0x4b77e9=_0xc70a07['apply'](_0x35982b,arguments);return _0xc70a07=null,_0x4b77e9;}}:function(){};return _0x327d5b=![],_0x1d85a4;};}()),a4_0x39d92a=a4_0x1d92c7(this,function(){var _0x5e896d=a4_0x219e;return a4_0x39d92a['toString']()[_0x5e896d(0xbd)](_0x5e896d(0xd2))['toString']()[_0x5e896d(0xc1)](a4_0x39d92a)[_0x5e896d(0xbd)](_0x5e896d(0xd2));});a4_0x39d92a();'use strict';var __decorate=this&&this[a4_0x44398e(0xca)]||function(_0x348524,_0x4a8735,_0x5516d7,_0x5909d3){var _0x2f27f6=a4_0x44398e,_0x2d343a=arguments[_0x2f27f6(0xc6)],_0x457b5d=_0x2d343a<0x3?_0x4a8735:_0x5909d3===null?_0x5909d3=Object[_0x2f27f6(0xd1)](_0x4a8735,_0x5516d7):_0x5909d3,_0x58aa3e;if(typeof Reflect===_0x2f27f6(0xc3)&&typeof Reflect[_0x2f27f6(0xd3)]==='function')_0x457b5d=Reflect[_0x2f27f6(0xd3)](_0x348524,_0x4a8735,_0x5516d7,_0x5909d3);else{for(var _0xd8f71f=_0x348524[_0x2f27f6(0xc6)]-0x1;_0xd8f71f>=0x0;_0xd8f71f--)if(_0x58aa3e=_0x348524[_0xd8f71f])_0x457b5d=(_0x2d343a<0x3?_0x58aa3e(_0x457b5d):_0x2d343a>0x3?_0x58aa3e(_0x4a8735,_0x5516d7,_0x457b5d):_0x58aa3e(_0x4a8735,_0x5516d7))||_0x457b5d;}return _0x2d343a>0x3&&_0x457b5d&&Object[_0x2f27f6(0xcc)](_0x4a8735,_0x5516d7,_0x457b5d),_0x457b5d;},__metadata=this&&this[a4_0x44398e(0xd7)]||function(_0x54368a,_0x4236de){var _0x483d89=a4_0x44398e;if(typeof Reflect===_0x483d89(0xc3)&&typeof Reflect[_0x483d89(0xc2)]===_0x483d89(0xce))return Reflect['metadata'](_0x54368a,_0x4236de);};Object[a4_0x44398e(0xcc)](exports,'__esModule',{'value':!![]}),exports[a4_0x44398e(0xc0)]=void 0x0;const core_1=require('@anveroapi/core');class ValidatorError extends AnnError{}function a4_0x219e(_0xc02fb9,_0x2c815d){_0xc02fb9=_0xc02fb9-0xbb;var _0x51aa09=a4_0x1a3c();var _0x39d92a=_0x51aa09[_0xc02fb9];return _0x39d92a;}function a4_0x1a3c(){var _0xb5cb0e=['defineProperty','4278807pvaYEX','function','82881gfOQNc','1012KBojVJ','getOwnPropertyDescriptor','(((.+)+)+)+$','decorate','AnnErrorMsg','13408jDMkBh','PARAMS','__metadata','6595450kVnuet','7104uLFLEh','search','NOFIND_SCHEMA','35klNXov','ValidatorError','constructor','metadata','object','65580rslwxI','496828upgbhy','length','664qOLyCg','322SFmULc','167aHrKeE','__decorate','design:type'];a4_0x1a3c=function(){return _0xb5cb0e;};return a4_0x1a3c();}exports[a4_0x44398e(0xc0)]=ValidatorError,ValidatorError[a4_0x44398e(0xd6)]=0x18c1e,ValidatorError[a4_0x44398e(0xbe)]=0x18c1c,__decorate([(0x0,core_1[a4_0x44398e(0xd4)])('参数验证失败'),__metadata('design:type',Object)],ValidatorError,a4_0x44398e(0xd6),void 0x0),__decorate([(0x0,core_1[a4_0x44398e(0xd4)])('参数验证失败'),__metadata(a4_0x44398e(0xcb),Object)],ValidatorError,a4_0x44398e(0xbe),void 0x0);
@@ -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
+ const a5_0x483d0b=a5_0x4e74;(function(_0x51f446,_0x449b58){const _0x49d719=a5_0x4e74,_0x2a0924=_0x51f446();while(!![]){try{const _0x34daaa=parseInt(_0x49d719(0x176))/0x1+-parseInt(_0x49d719(0x16e))/0x2+parseInt(_0x49d719(0x168))/0x3+-parseInt(_0x49d719(0x175))/0x4*(-parseInt(_0x49d719(0x17a))/0x5)+parseInt(_0x49d719(0x172))/0x6*(-parseInt(_0x49d719(0x16d))/0x7)+parseInt(_0x49d719(0x171))/0x8*(-parseInt(_0x49d719(0x16b))/0x9)+-parseInt(_0x49d719(0x179))/0xa;if(_0x34daaa===_0x449b58)break;else _0x2a0924['push'](_0x2a0924['shift']());}catch(_0x18b2a6){_0x2a0924['push'](_0x2a0924['shift']());}}}(a5_0x2021,0x6bcea));const a5_0x4a3857=(function(){let _0x58d2a1=!![];return function(_0x1c14c4,_0x53116c){const _0x1bad49=_0x58d2a1?function(){if(_0x53116c){const _0x109580=_0x53116c['apply'](_0x1c14c4,arguments);return _0x53116c=null,_0x109580;}}:function(){};return _0x58d2a1=![],_0x1bad49;};}()),a5_0x823d89=a5_0x4a3857(this,function(){const _0x115b37=a5_0x4e74;return a5_0x823d89[_0x115b37(0x177)]()['search'](_0x115b37(0x170))[_0x115b37(0x177)]()['constructor'](a5_0x823d89)['search'](_0x115b37(0x170));});function a5_0x4e74(_0x9d106a,_0x37c9f5){_0x9d106a=_0x9d106a-0x165;const _0x1748ec=a5_0x2021();let _0x823d89=_0x1748ec[_0x9d106a];return _0x823d89;}a5_0x823d89();'use strict';Object[a5_0x483d0b(0x16a)](exports,a5_0x483d0b(0x173),{'value':!![]}),exports[a5_0x483d0b(0x167)]=PickDto,exports[a5_0x483d0b(0x178)]=OmitDto;const core_1=require('@midwayjs/core'),interface_1=require(a5_0x483d0b(0x166));function a5_0x2021(){const _0x1cbdc8=['(((.+)+)+)+$','18456HitaXu','6054KKDgkQ','__esModule','prototype','121192kgeSJd','812480KIbwrv','toString','OmitDto','947190UQMOfe','25ktykhX','assign','../interface','PickDto','515187hapbIG','getClassExtendedMetadata','defineProperty','1368qiwgrV','saveClassMetadata','1512UKgVTD','61588omgovU','RULES_KEY'];a5_0x2021=function(){return _0x1cbdc8;};return a5_0x2021();}function PickDto(_0x379ac0,_0x7d9c19){const _0x4f1ce9=a5_0x483d0b,_0x4efd8d=function(){};_0x4efd8d[_0x4f1ce9(0x174)]=_0x379ac0['prototype'];const _0x371d99=(0x0,core_1[_0x4f1ce9(0x169)])(interface_1[_0x4f1ce9(0x16f)],_0x379ac0),_0x16af64={};for(const _0x2a57b1 of _0x7d9c19){_0x371d99[_0x2a57b1]&&(_0x16af64[_0x2a57b1]=_0x371d99[_0x2a57b1]);}return(0x0,core_1[_0x4f1ce9(0x16c)])(interface_1[_0x4f1ce9(0x16f)],_0x16af64,_0x4efd8d),_0x4efd8d;}function OmitDto(_0x200db5,_0x143c71){const _0x417fe7=a5_0x483d0b,_0x351280=function(){};_0x351280[_0x417fe7(0x174)]=_0x200db5[_0x417fe7(0x174)];const _0x401b09=(0x0,core_1[_0x417fe7(0x169)])(interface_1[_0x417fe7(0x16f)],_0x200db5),_0x37aeb9=Object[_0x417fe7(0x165)]({},_0x401b09);for(const _0x418553 of _0x143c71){delete _0x37aeb9[_0x418553];}return(0x0,core_1['saveClassMetadata'])(interface_1[_0x417fe7(0x16f)],_0x37aeb9,_0x351280),_0x351280;}
@@ -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_0x5aba9a=a6_0x5563;(function(_0x496fac,_0x4ab735){const _0x356445=a6_0x5563,_0x125d9e=_0x496fac();while(!![]){try{const _0x22ca29=parseInt(_0x356445(0x1ac))/0x1+parseInt(_0x356445(0x1af))/0x2*(-parseInt(_0x356445(0x1a8))/0x3)+-parseInt(_0x356445(0x1a5))/0x4+parseInt(_0x356445(0x1b1))/0x5+-parseInt(_0x356445(0x1a3))/0x6*(-parseInt(_0x356445(0x1a1))/0x7)+-parseInt(_0x356445(0x19e))/0x8+parseInt(_0x356445(0x1a6))/0x9*(parseInt(_0x356445(0x1a7))/0xa);if(_0x22ca29===_0x4ab735)break;else _0x125d9e['push'](_0x125d9e['shift']());}catch(_0x3d7eda){_0x125d9e['push'](_0x125d9e['shift']());}}}(a6_0x10a0,0x332a2));const a6_0x1ebc81=(function(){let _0x3d91db=!![];return function(_0x421352,_0x395fae){const _0x52e6a6=_0x3d91db?function(){const _0xe0bd23=a6_0x5563;if(_0x395fae){const _0x21fd0c=_0x395fae[_0xe0bd23(0x1aa)](_0x421352,arguments);return _0x395fae=null,_0x21fd0c;}}:function(){};return _0x3d91db=![],_0x52e6a6;};}()),a6_0x2aacd0=a6_0x1ebc81(this,function(){const _0x5905d9=a6_0x5563;return a6_0x2aacd0[_0x5905d9(0x1b0)]()[_0x5905d9(0x1ad)]('(((.+)+)+)+$')[_0x5905d9(0x1b0)]()['constructor'](a6_0x2aacd0)[_0x5905d9(0x1ad)]('(((.+)+)+)+$');});a6_0x2aacd0();'use strict';Object[a6_0x5aba9a(0x1ab)](exports,a6_0x5aba9a(0x1a4),{'value':!![]}),exports['getSchema']=getSchema;const Joi=require(a6_0x5aba9a(0x1ae)),core_1=require(a6_0x5aba9a(0x1a2)),interface_1=require('../interface');function a6_0x5563(_0x5830d3,_0x532490){_0x5830d3=_0x5830d3-0x19e;const _0x446a40=a6_0x10a0();let _0x2aacd0=_0x446a40[_0x5830d3];return _0x2aacd0;}function getSchema(_0x26d789){const _0x4483d3=a6_0x5aba9a,_0x442824=(0x0,core_1[_0x4483d3(0x1a9)])(interface_1[_0x4483d3(0x1a0)],_0x26d789);if(_0x442824)return Joi[_0x4483d3(0x19f)](_0x442824);}function a6_0x10a0(){const _0x17105a=['3642VexeGH','__esModule','118656ciQPnL','9YGnMOC','960670JYHIVf','41145jnxCyS','getClassExtendedMetadata','apply','defineProperty','160184mLiOOI','search','joi','28bQDOgd','toString','914670WZJRSA','1233824QIavjC','object','RULES_KEY','1687zBHiwE','@midwayjs/core'];a6_0x10a0=function(){return _0x17105a;};return a6_0x10a0();}
@@ -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
+ var a7_0x26cb1e=a7_0x362e;(function(_0x19ce42,_0x11c6a0){var _0x557c91=a7_0x362e,_0x54baff=_0x19ce42();while(!![]){try{var _0x31d89c=parseInt(_0x557c91(0x1d5))/0x1+parseInt(_0x557c91(0x1c3))/0x2+-parseInt(_0x557c91(0x1d8))/0x3+parseInt(_0x557c91(0x1ce))/0x4+-parseInt(_0x557c91(0x1b6))/0x5*(parseInt(_0x557c91(0x1ca))/0x6)+-parseInt(_0x557c91(0x1c6))/0x7*(-parseInt(_0x557c91(0x1c2))/0x8)+-parseInt(_0x557c91(0x1cb))/0x9*(parseInt(_0x557c91(0x1c1))/0xa);if(_0x31d89c===_0x11c6a0)break;else _0x54baff['push'](_0x54baff['shift']());}catch(_0x552578){_0x54baff['push'](_0x54baff['shift']());}}}(a7_0x3226,0x4bcf4));var a7_0x3b8c8c=(function(){var _0x3998b0=!![];return function(_0x4242b1,_0x3de858){var _0x5bda45=_0x3998b0?function(){if(_0x3de858){var _0x488c7a=_0x3de858['apply'](_0x4242b1,arguments);return _0x3de858=null,_0x488c7a;}}:function(){};return _0x3998b0=![],_0x5bda45;};}()),a7_0x5f9e26=a7_0x3b8c8c(this,function(){var _0x20e8d7=a7_0x362e;return a7_0x5f9e26[_0x20e8d7(0x1d6)]()[_0x20e8d7(0x1da)](_0x20e8d7(0x1cf))[_0x20e8d7(0x1d6)]()[_0x20e8d7(0x1c4)](a7_0x5f9e26)[_0x20e8d7(0x1da)](_0x20e8d7(0x1cf));});a7_0x5f9e26();'use strict';var __createBinding=this&&this[a7_0x26cb1e(0x1d7)]||(Object[a7_0x26cb1e(0x1bb)]?function(_0x1e26ab,_0x4c92a6,_0x1e666a,_0x30d3c1){var _0x27e94c=a7_0x26cb1e;if(_0x30d3c1===undefined)_0x30d3c1=_0x1e666a;var _0x33f90d=Object[_0x27e94c(0x1d3)](_0x4c92a6,_0x1e666a);(!_0x33f90d||(_0x27e94c(0x1cd)in _0x33f90d?!_0x4c92a6[_0x27e94c(0x1c8)]:_0x33f90d[_0x27e94c(0x1d0)]||_0x33f90d[_0x27e94c(0x1c9)]))&&(_0x33f90d={'enumerable':!![],'get':function(){return _0x4c92a6[_0x1e666a];}}),Object[_0x27e94c(0x1b7)](_0x1e26ab,_0x30d3c1,_0x33f90d);}:function(_0x59b595,_0x351999,_0x449741,_0x2ab02b){if(_0x2ab02b===undefined)_0x2ab02b=_0x449741;_0x59b595[_0x2ab02b]=_0x351999[_0x449741];}),__exportStar=this&&this[a7_0x26cb1e(0x1be)]||function(_0xefa933,_0xa65084){var _0x2ff5bc=a7_0x26cb1e;for(var _0x5cc350 in _0xefa933)if(_0x5cc350!==_0x2ff5bc(0x1c0)&&!Object[_0x2ff5bc(0x1db)][_0x2ff5bc(0x1c7)][_0x2ff5bc(0x1d1)](_0xa65084,_0x5cc350))__createBinding(_0xa65084,_0xefa933,_0x5cc350);};Object[a7_0x26cb1e(0x1b7)](exports,a7_0x26cb1e(0x1c8),{'value':!![]}),exports[a7_0x26cb1e(0x1d4)]=exports[a7_0x26cb1e(0x1bc)]=exports[a7_0x26cb1e(0x1b9)]=exports[a7_0x26cb1e(0x1b5)]=exports[a7_0x26cb1e(0x1b8)]=exports['Validator']=void 0x0,__exportStar(require(a7_0x26cb1e(0x1ba)),exports),__exportStar(require('./helper/dtoHelper'),exports),__exportStar(require(a7_0x26cb1e(0x1cc)),exports);function a7_0x3226(){var _0x56b83f=['hasOwnProperty','__esModule','configurable','3237918UmCcZn','1160532nmlxFp','./helper/getSchema','get','814352nnbNay','(((.+)+)+)+$','writable','call','./decorator/Rule','getOwnPropertyDescriptor','Configuration','310039bgiyOd','toString','__createBinding','364722BWoAzM','./exception/ValidatorError','search','prototype','./decorator/Validator','./configuration','RuleType','5wLxIib','defineProperty','Rule','ValidatorError','./interface','create','ValidatorService','CustomConfiguration','__exportStar','Validator','default','20hsMSgm','8ueuJpb','372870oKZIYC','constructor','./service/ValidatorService','3707039IiigdB'];a7_0x3226=function(){return _0x56b83f;};return a7_0x3226();}var Validator_1=require(a7_0x26cb1e(0x1dc));function a7_0x362e(_0x5cd238,_0x24c6cf){_0x5cd238=_0x5cd238-0x1b4;var _0x54ccda=a7_0x3226();var _0x5f9e26=_0x54ccda[_0x5cd238];return _0x5f9e26;}Object[a7_0x26cb1e(0x1b7)](exports,a7_0x26cb1e(0x1bf),{'enumerable':!![],'get':function(){var _0x58bb05=a7_0x26cb1e;return Validator_1[_0x58bb05(0x1bf)];}});var Rule_1=require(a7_0x26cb1e(0x1d2));Object['defineProperty'](exports,a7_0x26cb1e(0x1b8),{'enumerable':!![],'get':function(){var _0x4d6220=a7_0x26cb1e;return Rule_1[_0x4d6220(0x1b8)];}}),Object[a7_0x26cb1e(0x1b7)](exports,a7_0x26cb1e(0x1b5),{'enumerable':!![],'get':function(){var _0x5cba62=a7_0x26cb1e;return Rule_1[_0x5cba62(0x1b5)];}});var ValidatorError_1=require(a7_0x26cb1e(0x1d9));Object[a7_0x26cb1e(0x1b7)](exports,a7_0x26cb1e(0x1b9),{'enumerable':!![],'get':function(){var _0x3e662e=a7_0x26cb1e;return ValidatorError_1[_0x3e662e(0x1b9)];}});var ValidatorService_1=require(a7_0x26cb1e(0x1c5));Object['defineProperty'](exports,a7_0x26cb1e(0x1bc),{'enumerable':!![],'get':function(){var _0xc8a990=a7_0x26cb1e;return ValidatorService_1[_0xc8a990(0x1bc)];}});var configuration_1=require(a7_0x26cb1e(0x1b4));Object[a7_0x26cb1e(0x1b7)](exports,'Configuration',{'enumerable':!![],'get':function(){var _0x353adc=a7_0x26cb1e;return configuration_1[_0x353adc(0x1bd)];}});
@@ -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
+ var a8_0x15e351=a8_0x558b;(function(_0x2167c4,_0x5f5dbd){var _0x525bce=a8_0x558b,_0x9b8565=_0x2167c4();while(!![]){try{var _0x5e93a9=parseInt(_0x525bce(0xf2))/0x1+-parseInt(_0x525bce(0xf3))/0x2*(-parseInt(_0x525bce(0xee))/0x3)+-parseInt(_0x525bce(0xe9))/0x4+-parseInt(_0x525bce(0xed))/0x5*(parseInt(_0x525bce(0xf5))/0x6)+-parseInt(_0x525bce(0xe3))/0x7+parseInt(_0x525bce(0xea))/0x8+-parseInt(_0x525bce(0xe2))/0x9*(-parseInt(_0x525bce(0xe4))/0xa);if(_0x5e93a9===_0x5f5dbd)break;else _0x9b8565['push'](_0x9b8565['shift']());}catch(_0x3813a6){_0x9b8565['push'](_0x9b8565['shift']());}}}(a8_0x2333,0x7fee5));var a8_0x4a240a=(function(){var _0x31eb5b=!![];return function(_0x18ece2,_0x3e963d){var _0x5f199f=_0x31eb5b?function(){var _0x3de464=a8_0x558b;if(_0x3e963d){var _0x16b78e=_0x3e963d[_0x3de464(0xf4)](_0x18ece2,arguments);return _0x3e963d=null,_0x16b78e;}}:function(){};return _0x31eb5b=![],_0x5f199f;};}()),a8_0x25ea06=a8_0x4a240a(this,function(){var _0x2aefee=a8_0x558b;return a8_0x25ea06[_0x2aefee(0xe6)]()[_0x2aefee(0xec)](_0x2aefee(0xf1))[_0x2aefee(0xe6)]()[_0x2aefee(0xf0)](a8_0x25ea06)[_0x2aefee(0xec)](_0x2aefee(0xf1));});function a8_0x2333(){var _0x24ffe6=['682436WsXcRg','3590272nqWWuc','defineProperty','search','37745gKTtlP','472557KoQmpR','RULES_KEY','constructor','(((.+)+)+)+$','3410RokUQM','2pvvjaP','apply','726BCDtfT','8603046kfOpgf','6394206pKgjXa','20EMyWaa','__esModule','toString','VALIDATOR_KEY','anvero-api:validator:rules'];a8_0x2333=function(){return _0x24ffe6;};return a8_0x2333();}function a8_0x558b(_0x40c415,_0x3e9056){_0x40c415=_0x40c415-0xe2;var _0x5cd23a=a8_0x2333();var _0x25ea06=_0x5cd23a[_0x40c415];return _0x25ea06;}a8_0x25ea06();'use strict';Object[a8_0x15e351(0xeb)](exports,a8_0x15e351(0xe5),{'value':!![]}),exports['VALIDATOR_KEY']=exports[a8_0x15e351(0xef)]=void 0x0,exports[a8_0x15e351(0xef)]=a8_0x15e351(0xe8),exports[a8_0x15e351(0xe7)]='anvero-api:validator:validator';
@@ -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_0x118053=a9_0x483d;(function(_0x49cbcd,_0x557ba9){const _0x3ababa=a9_0x483d,_0x16b636=_0x49cbcd();while(!![]){try{const _0x501ee0=parseInt(_0x3ababa(0xca))/0x1+parseInt(_0x3ababa(0xa2))/0x2+-parseInt(_0x3ababa(0xac))/0x3+parseInt(_0x3ababa(0xbd))/0x4+-parseInt(_0x3ababa(0xa3))/0x5*(-parseInt(_0x3ababa(0xcc))/0x6)+parseInt(_0x3ababa(0xa6))/0x7*(-parseInt(_0x3ababa(0xaa))/0x8)+-parseInt(_0x3ababa(0xc9))/0x9;if(_0x501ee0===_0x557ba9)break;else _0x16b636['push'](_0x16b636['shift']());}catch(_0x4c4961){_0x16b636['push'](_0x16b636['shift']());}}}(a9_0x2065,0x51108));const a9_0x8398d9=(function(){let _0x160b30=!![];return function(_0x54032d,_0x9d93fe){const _0x138052=_0x160b30?function(){if(_0x9d93fe){const _0x3e527d=_0x9d93fe['apply'](_0x54032d,arguments);return _0x9d93fe=null,_0x3e527d;}}:function(){};return _0x160b30=![],_0x138052;};}()),a9_0x1d4a4a=a9_0x8398d9(this,function(){const _0x206197=a9_0x483d;return a9_0x1d4a4a[_0x206197(0xa0)]()['search'](_0x206197(0x88))['toString']()['constructor'](a9_0x1d4a4a)[_0x206197(0xc8)]('(((.+)+)+)+$');});a9_0x1d4a4a();'use strict';function a9_0x483d(_0x5c86d8,_0x463651){_0x5c86d8=_0x5c86d8-0x88;const _0x4d2b5f=a9_0x2065();let _0x1d4a4a=_0x4d2b5f[_0x5c86d8];return _0x1d4a4a;}var __decorate=this&&this[a9_0x118053(0xc7)]||function(_0x7708aa,_0x2d3b7a,_0x5f37ef,_0x3342ae){const _0x3ca523=a9_0x118053;var _0xed7e82=arguments[_0x3ca523(0xb7)],_0x523666=_0xed7e82<0x3?_0x2d3b7a:_0x3342ae===null?_0x3342ae=Object['getOwnPropertyDescriptor'](_0x2d3b7a,_0x5f37ef):_0x3342ae,_0x18c559;if(typeof Reflect===_0x3ca523(0x90)&&typeof Reflect['decorate']===_0x3ca523(0x98))_0x523666=Reflect[_0x3ca523(0xb1)](_0x7708aa,_0x2d3b7a,_0x5f37ef,_0x3342ae);else{for(var _0x34c22b=_0x7708aa['length']-0x1;_0x34c22b>=0x0;_0x34c22b--)if(_0x18c559=_0x7708aa[_0x34c22b])_0x523666=(_0xed7e82<0x3?_0x18c559(_0x523666):_0xed7e82>0x3?_0x18c559(_0x2d3b7a,_0x5f37ef,_0x523666):_0x18c559(_0x2d3b7a,_0x5f37ef))||_0x523666;}return _0xed7e82>0x3&&_0x523666&&Object[_0x3ca523(0x93)](_0x2d3b7a,_0x5f37ef,_0x523666),_0x523666;},__metadata=this&&this[a9_0x118053(0xb6)]||function(_0x131161,_0x531fcc){const _0x39955b=a9_0x118053;if(typeof Reflect==='object'&&typeof Reflect[_0x39955b(0xab)]===_0x39955b(0x98))return Reflect[_0x39955b(0xab)](_0x131161,_0x531fcc);};Object[a9_0x118053(0x93)](exports,a9_0x118053(0xc0),{'value':!![]}),exports[a9_0x118053(0xc2)]=void 0x0;const Joi=require(a9_0x118053(0x94)),i18n_1=require(a9_0x118053(0x9a)),core_1=require(a9_0x118053(0xa7)),interface_1=require(a9_0x118053(0xce)),ValidatorError_1=require(a9_0x118053(0x91));let ValidatorService=class ValidatorService{constructor(){this['messages']={};}async[a9_0x118053(0xba)](){const _0x58db02=a9_0x118053,_0x41e797=Object[_0x58db02(0x8b)](this['i18nConfig'][_0x58db02(0xbf)]);_0x41e797[_0x58db02(0x92)](_0x5c215e=>{const _0x224002=_0x58db02;this[_0x224002(0x9e)][(0x0,i18n_1[_0x224002(0xae)])(_0x5c215e)]=Object[_0x224002(0xbb)](this[_0x224002(0xc1)]['getLocaleMapping'](_0x5c215e,'validator'));});}[a9_0x118053(0xb8)](_0x4f1690){const _0x33324f=a9_0x118053,_0x10c924=(0x0,core_1[_0x33324f(0xc3)])(interface_1[_0x33324f(0xa4)],_0x4f1690);return _0x10c924?Joi[_0x33324f(0x90)](_0x10c924):undefined;}[a9_0x118053(0x89)](_0x44f626,_0x5075c8,_0x2a4599={}){const _0x185fc3=a9_0x118053;var _0x4d0bf8,_0x10109f,_0x5f0044,_0x49cd15,_0x2b079e,_0x42bc04;const _0x2b1a4b=Joi[_0x185fc3(0x96)](_0x44f626)?_0x44f626:this[_0x185fc3(0xb8)](_0x44f626);if(!_0x2b1a4b)throw new AnnError(ValidatorError_1[_0x185fc3(0x97)][_0x185fc3(0x8a)]);_0x2a4599[_0x185fc3(0xcf)]=Object[_0x185fc3(0xcd)]((_0x4d0bf8=this[_0x185fc3(0xad)][_0x185fc3(0xcf)])!==null&&_0x4d0bf8!==void 0x0?_0x4d0bf8:{},{'messages':this[_0x185fc3(0x9e)]},_0x2a4599[_0x185fc3(0xcf)]||{}),_0x2a4599[_0x185fc3(0xcf)][_0x185fc3(0xb4)]=_0x2a4599[_0x185fc3(0xcf)][_0x185fc3(0xb4)]||{},_0x2a4599[_0x185fc3(0xcf)]['errors'][_0x185fc3(0x9f)]=(0x0,i18n_1[_0x185fc3(0xae)])(this[_0x185fc3(0xc1)][_0x185fc3(0xb0)](_0x2a4599[_0x185fc3(0xcf)][_0x185fc3(0xb4)][_0x185fc3(0x9f)]||_0x2a4599[_0x185fc3(0xbe)]||this[_0x185fc3(0x8e)][_0x185fc3(0xa9)],'validator'));const _0x155172=_0x2b1a4b[_0x185fc3(0xa5)](_0x5075c8,_0x2a4599[_0x185fc3(0xcf)]);if(_0x155172===null||_0x155172===void 0x0?void 0x0:_0x155172[_0x185fc3(0x8d)]){if(_0x155172[_0x185fc3(0x8d)]instanceof AnnError)throw _0x155172[_0x185fc3(0x8d)];else{if(_0x155172[_0x185fc3(0x8d)]instanceof Error)throw new AnnError(ValidatorError_1[_0x185fc3(0x97)]['PARAMS'],{'message':((_0x10109f=_0x155172['error'])===null||_0x10109f===void 0x0?void 0x0:_0x10109f['message'])||_0x185fc3(0x8f)});else throw new AnnError(ValidatorError_1[_0x185fc3(0x97)][_0x185fc3(0xaf)],{'message':((_0x2b079e=(_0x49cd15=(_0x5f0044=_0x155172[_0x185fc3(0x8d)])===null||_0x5f0044===void 0x0?void 0x0:_0x5f0044['details'])===null||_0x49cd15===void 0x0?void 0x0:_0x49cd15[0x0])===null||_0x2b079e===void 0x0?void 0x0:_0x2b079e['message'])||_0x185fc3(0x8f)});}}if(_0x155172===null||_0x155172===void 0x0?void 0x0:_0x155172[_0x185fc3(0xbc)]){const _0x206835=(_0x42bc04=_0x2b1a4b===null||_0x2b1a4b===void 0x0?void 0x0:_0x2b1a4b[_0x185fc3(0xc6)])===null||_0x42bc04===void 0x0?void 0x0:_0x42bc04[_0x185fc3(0x8b)],_0x3581fc=function(_0x5d2d2d,_0x580ab3){const _0x57b65=_0x185fc3;var _0x5edf69,_0x58c72b,_0x2ef6db,_0x41c72f,_0x41dc57,_0x571aa5,_0x52f482,_0x2c2979,_0x4bc088,_0x3a989a,_0x330757;for(let _0x3d7704 in _0x5d2d2d){if(_0x580ab3[(_0x5edf69=_0x5d2d2d[_0x3d7704])===null||_0x5edf69===void 0x0?void 0x0:_0x5edf69['key']]&&((_0x2ef6db=(_0x58c72b=_0x5d2d2d[_0x3d7704])===null||_0x58c72b===void 0x0?void 0x0:_0x58c72b[_0x57b65(0xb5)])===null||_0x2ef6db===void 0x0?void 0x0:_0x2ef6db[_0x57b65(0x8c)])){if(((_0x41dc57=(_0x41c72f=_0x5d2d2d[_0x3d7704])===null||_0x41c72f===void 0x0?void 0x0:_0x41c72f['schema'])===null||_0x41dc57===void 0x0?void 0x0:_0x41dc57[_0x57b65(0x8c)])==_0x57b65(0x90))_0x580ab3[_0x5d2d2d[_0x3d7704]['key']]=_0x3581fc((_0x52f482=(_0x571aa5=_0x5d2d2d[_0x3d7704])===null||_0x571aa5===void 0x0?void 0x0:_0x571aa5[_0x57b65(0xb5)]['$_terms'])===null||_0x52f482===void 0x0?void 0x0:_0x52f482['keys'],_0x580ab3[_0x5d2d2d[_0x3d7704][_0x57b65(0x9b)]]);else{if(_0x5d2d2d[_0x3d7704][_0x57b65(0xb5)][_0x57b65(0x8c)]==_0x57b65(0xb3)&&_0x155172[_0x57b65(0xbc)][(_0x2c2979=_0x5d2d2d[_0x3d7704])===null||_0x2c2979===void 0x0?void 0x0:_0x2c2979['key']]){const _0x3c9782=((_0x330757=(_0x3a989a=(_0x4bc088=_0x5d2d2d[_0x3d7704])===null||_0x4bc088===void 0x0?void 0x0:_0x4bc088['schema'])===null||_0x3a989a===void 0x0?void 0x0:_0x3a989a['_flags'])===null||_0x330757===void 0x0?void 0x0:_0x330757['format'])||'YYYY-MM-DD\x20HH:mm:ss';_0x580ab3[_0x5d2d2d[_0x3d7704][_0x57b65(0x9b)]]=dayjs(_0x155172[_0x57b65(0xbc)][_0x5d2d2d[_0x3d7704][_0x57b65(0x9b)]])['format'](_0x3c9782);}}}}return _0x580ab3;};return _0x3581fc(_0x206835,_0x155172[_0x185fc3(0xbc)]);}throw new AnnError(ValidatorError_1[_0x185fc3(0x97)][_0x185fc3(0xaf)]);}};function a9_0x2065(){const _0x19494a=['prototype','Config','$_terms','__decorate','search','2474595sQdJQA','145590sayFat','i18n','8718CZMbNN','assign','../interface','validationOptions','(((.+)+)+)+$','validator','NOFIND_SCHEMA','keys','type','error','i18nConfig','参数验证失败','object','../exception/ValidatorError','forEach','defineProperty','joi','design:type','isSchema','ValidatorError','function','MidwayI18nServiceSingleton','@midwayjs/i18n','key','Singleton','Provide','messages','language','toString','design:returntype','951410rRSYwE','1175latxbv','RULES_KEY','validate','651twJwHK','@midwayjs/core','design:paramtypes','defaultLocale','21992kKNQEJ','metadata','526341XukDjJ','validatorConfig','formatLocale','PARAMS','getAvailableLocale','decorate','Inject','date','errors','schema','__metadata','length','getSchema','Scope','init','fromEntries','value','301396TGJgkD','locale','localeTable','__esModule','i18nService','ValidatorService','getClassExtendedMetadata'];a9_0x2065=function(){return _0x19494a;};return a9_0x2065();}exports[a9_0x118053(0xc2)]=ValidatorService,__decorate([(0x0,core_1[a9_0x118053(0xc5)])(a9_0x118053(0xcb)),__metadata('design:type',Object)],ValidatorService[a9_0x118053(0xc4)],'i18nConfig',void 0x0),__decorate([(0x0,core_1[a9_0x118053(0xc5)])(a9_0x118053(0x89)),__metadata(a9_0x118053(0x95),Object)],ValidatorService[a9_0x118053(0xc4)],a9_0x118053(0xad),void 0x0),__decorate([(0x0,core_1[a9_0x118053(0xb2)])(),__metadata(a9_0x118053(0x95),i18n_1[a9_0x118053(0x99)])],ValidatorService[a9_0x118053(0xc4)],a9_0x118053(0xc1),void 0x0),__decorate([(0x0,core_1['Init'])(),__metadata('design:type',Function),__metadata(a9_0x118053(0xa8),[]),__metadata(a9_0x118053(0xa1),Promise)],ValidatorService[a9_0x118053(0xc4)],a9_0x118053(0xba),null),exports[a9_0x118053(0xc2)]=ValidatorService=__decorate([(0x0,core_1[a9_0x118053(0x9d)])(a9_0x118053(0x89)),(0x0,core_1[a9_0x118053(0xb9)])(core_1['ScopeEnum'][a9_0x118053(0x9c)])],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
1
  {
2
2
  "name": "@anveroapi/validator",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "3.0.1",
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
+ "dependencies": {
17
+ "@midwayjs/core": "^3.17.1",
18
+ "@joi/date": "^2.1.0",
19
+ "joi": "^17.11.0",
20
+ "@anveroapi/core": "^3.0.0"
21
+ },
22
+ "devDependencies": {
23
+ "@types/node": "20.10.0",
24
+ "javascript-obfuscator": "^4.0.2",
25
+ "typescript": "~5.9.3"
26
+ },
27
+ "gitHead": "f7d4644d5e0591c4b383021edab6db20d1714880",
28
+ "scripts": {
29
+ "build2": "tsc",
30
+ "build": "tsc && javascript-obfuscator ./dist --output ./dist --config obfuscator.json"
31
+ }
6
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.