@anncic-api/validator 1.0.8 → 1.0.13
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.
- package/dist/config/config.default.d.ts +3 -3
- package/dist/config/config.default.js +1 -1
- package/dist/configuration.js +1 -1
- package/dist/decorator/Rule.js +1 -1
- package/dist/decorator/Validator.d.ts +2 -2
- package/dist/decorator/Validator.js +1 -1
- package/dist/exception/ValidatorError.d.ts +2 -1
- package/dist/exception/ValidatorError.js +1 -1
- package/dist/helper/dtoHelper.js +1 -1
- package/dist/helpers/dtoHelper.js +1 -1
- package/dist/index.js +1 -1
- package/dist/interface.d.ts +3 -3
- package/dist/interface.js +1 -1
- package/dist/service/ValidateService.js +1 -1
- package/dist/service/ValidatorService.d.ts +4 -9
- package/dist/service/ValidatorService.js +1 -1
- package/dist/services/ValidateService.js +1 -1
- package/package.json +3 -3
|
@@ -2,19 +2,14 @@ import * as Joi from "joi";
|
|
|
2
2
|
import { MidwayI18nServiceSingleton } from '@midwayjs/i18n';
|
|
3
3
|
export declare class ValidatorService {
|
|
4
4
|
protected i18nConfig: any;
|
|
5
|
-
protected
|
|
5
|
+
protected validatorConfig: any;
|
|
6
6
|
protected i18nService: MidwayI18nServiceSingleton;
|
|
7
7
|
protected messages: {};
|
|
8
|
-
|
|
8
|
+
init(): Promise<void>;
|
|
9
9
|
getSchema<T extends new (...args: any[]) => any>(ClzType: T): Joi.ObjectSchema<any> | undefined;
|
|
10
|
-
|
|
11
|
-
locale?: string;
|
|
12
|
-
errorStatus?: number;
|
|
13
|
-
validationOptions?: Joi.ValidationOptions;
|
|
14
|
-
}): any | undefined;
|
|
15
|
-
validate<T extends new (...args: any[]) => any>(ClzType: T, value: any, options?: {
|
|
10
|
+
validator<T extends new (...args: any[]) => any>(ClzType: T | Joi.ObjectSchema<any>, value: any, options?: {
|
|
16
11
|
errorStatus?: number;
|
|
17
12
|
locale?: string;
|
|
18
13
|
validationOptions?: Joi.ValidationOptions;
|
|
19
|
-
}): any
|
|
14
|
+
}): any;
|
|
20
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const
|
|
1
|
+
'use strict';const a10_0x8f918c=a10_0x21a8;(function(_0x313467,_0x5c12fe){const _0xb83505=a10_0x21a8,_0x5666ab=_0x313467();while(!![]){try{const _0x2b02dc=-parseInt(_0xb83505(0xa4))/0x1+-parseInt(_0xb83505(0xaa))/0x2+parseInt(_0xb83505(0x8e))/0x3+parseInt(_0xb83505(0x97))/0x4+-parseInt(_0xb83505(0x8d))/0x5*(-parseInt(_0xb83505(0xb4))/0x6)+parseInt(_0xb83505(0xbd))/0x7*(parseInt(_0xb83505(0xa0))/0x8)+-parseInt(_0xb83505(0xa8))/0x9;if(_0x2b02dc===_0x5c12fe)break;else _0x5666ab['push'](_0x5666ab['shift']());}catch(_0x447e31){_0x5666ab['push'](_0x5666ab['shift']());}}}(a10_0x2a1e,0x7297e));function a10_0x2a1e(){const _0x6fd47c=['21718NXfzvX','design:type','i18nService','RULES_KEY','assign','@midwayjs/i18n','Config','validationOptions','__esModule','type','12YrfHde','localeTable','../interface','__metadata','locale','defineProperty','function','prototype','key','8498bpSoAM','keys','forEach','i18nConfig','YYYY-MM-DD\x20HH:mm:ss','getOwnPropertyDescriptor','validator','getAvailableLocale','NOFIND_SCHEMA','language','length','__decorate','date','$_terms','joi','validatorConfig','ValidatorError','Singleton','getSchema','1286735qdsxey','2485932hAUAGV','i18n','design:returntype','PARAMS','object','ScopeEnum','getLocaleMapping','decorate','schema','1662860pxOUtC','messages','value','getClassExtendedMetadata','formatLocale','errors','Inject','defaultLocale','format','3272dLsdyA','../exception/ValidatorError','@midwayjs/decorator','Scope','149230WyzEzq','error','design:paramtypes','init','14635044XFfiKy','ValidatorService'];a10_0x2a1e=function(){return _0x6fd47c;};return a10_0x2a1e();}var __decorate=this&&this[a10_0x8f918c(0xc8)]||function(_0x3f1ce5,_0x9156c8,_0x5d192d,_0x5ef1fe){const _0x677190=a10_0x8f918c;var _0x558fb3=arguments[_0x677190(0xc7)],_0xaf70b5=_0x558fb3<0x3?_0x9156c8:_0x5ef1fe===null?_0x5ef1fe=Object[_0x677190(0xc2)](_0x9156c8,_0x5d192d):_0x5ef1fe,_0x13b894;if(typeof Reflect==='object'&&typeof Reflect[_0x677190(0x95)]===_0x677190(0xba))_0xaf70b5=Reflect[_0x677190(0x95)](_0x3f1ce5,_0x9156c8,_0x5d192d,_0x5ef1fe);else{for(var _0x313e55=_0x3f1ce5[_0x677190(0xc7)]-0x1;_0x313e55>=0x0;_0x313e55--)if(_0x13b894=_0x3f1ce5[_0x313e55])_0xaf70b5=(_0x558fb3<0x3?_0x13b894(_0xaf70b5):_0x558fb3>0x3?_0x13b894(_0x9156c8,_0x5d192d,_0xaf70b5):_0x13b894(_0x9156c8,_0x5d192d))||_0xaf70b5;}return _0x558fb3>0x3&&_0xaf70b5&&Object[_0x677190(0xb9)](_0x9156c8,_0x5d192d,_0xaf70b5),_0xaf70b5;},__metadata=this&&this[a10_0x8f918c(0xb7)]||function(_0x5825fe,_0x58750f){const _0x3802ec=a10_0x8f918c;if(typeof Reflect===_0x3802ec(0x92)&&typeof Reflect['metadata']===_0x3802ec(0xba))return Reflect['metadata'](_0x5825fe,_0x58750f);};function a10_0x21a8(_0x2cb22b,_0x2bfcaf){const _0x2a1ed6=a10_0x2a1e();return a10_0x21a8=function(_0x21a8be,_0xa5380a){_0x21a8be=_0x21a8be-0x8d;let _0xdbf92b=_0x2a1ed6[_0x21a8be];return _0xdbf92b;},a10_0x21a8(_0x2cb22b,_0x2bfcaf);}Object['defineProperty'](exports,a10_0x8f918c(0xb2),{'value':!![]}),exports[a10_0x8f918c(0xa9)]=void 0x0;const Joi=require(a10_0x8f918c(0xcb)),i18n_1=require(a10_0x8f918c(0xaf)),decorator_1=require(a10_0x8f918c(0xa2)),interface_1=require(a10_0x8f918c(0xb6)),ValidatorError_1=require(a10_0x8f918c(0xa1));let ValidatorService=class ValidatorService{constructor(){const _0x1a71e8=a10_0x8f918c;this[_0x1a71e8(0x98)]={};}async[a10_0x8f918c(0xa7)](){const _0x4da979=a10_0x8f918c,_0x2c9e9d=Object[_0x4da979(0xbe)](this[_0x4da979(0xc0)][_0x4da979(0xb5)]);_0x2c9e9d[_0x4da979(0xbf)](_0x1c2d70=>{const _0x584962=_0x4da979;this[_0x584962(0x98)][(0x0,i18n_1[_0x584962(0x9b)])(_0x1c2d70)]=Object['fromEntries'](this[_0x584962(0xac)][_0x584962(0x94)](_0x1c2d70,_0x584962(0xc3)));});}[a10_0x8f918c(0xcf)](_0x558c64){const _0x281490=a10_0x8f918c,_0x3a0bd5=(0x0,decorator_1[_0x281490(0x9a)])(interface_1[_0x281490(0xad)],_0x558c64);return _0x3a0bd5?Joi['object'](_0x3a0bd5):undefined;}[a10_0x8f918c(0xc3)](_0x3fd4fa,_0x5adeee,_0x3ea19a={}){const _0x13fa76=a10_0x8f918c;var _0x85aa2d,_0x3e3847;const _0x16c1f4=Joi['isSchema'](_0x3fd4fa)?_0x3fd4fa:this[_0x13fa76(0xcf)](_0x3fd4fa);if(!_0x16c1f4)throw new AnnError(ValidatorError_1['ValidatorError'][_0x13fa76(0xc5)]);_0x3ea19a[_0x13fa76(0xb1)]=Object[_0x13fa76(0xae)]((_0x85aa2d=this['validatorConfig'][_0x13fa76(0xb1)])!==null&&_0x85aa2d!==void 0x0?_0x85aa2d:{},{'messages':this[_0x13fa76(0x98)]},_0x3ea19a['validationOptions']||{}),_0x3ea19a[_0x13fa76(0xb1)][_0x13fa76(0x9c)]=_0x3ea19a['validationOptions'][_0x13fa76(0x9c)]||{},_0x3ea19a['validationOptions'][_0x13fa76(0x9c)][_0x13fa76(0xc6)]=(0x0,i18n_1[_0x13fa76(0x9b)])(this[_0x13fa76(0xac)][_0x13fa76(0xc4)](_0x3ea19a[_0x13fa76(0xb1)][_0x13fa76(0x9c)][_0x13fa76(0xc6)]||_0x3ea19a[_0x13fa76(0xb8)]||this[_0x13fa76(0xc0)][_0x13fa76(0x9e)],_0x13fa76(0xc3)));const _0x59c2d1=_0x16c1f4['validate'](_0x5adeee,_0x3ea19a['validationOptions']);if(_0x59c2d1===null||_0x59c2d1===void 0x0?void 0x0:_0x59c2d1[_0x13fa76(0xa5)])throw new AnnError(ValidatorError_1['ValidatorError']['PARAMS'],{'validator':_0x59c2d1['error']});if(_0x59c2d1===null||_0x59c2d1===void 0x0?void 0x0:_0x59c2d1[_0x13fa76(0x99)]){const _0x183aeb=(_0x3e3847=_0x16c1f4===null||_0x16c1f4===void 0x0?void 0x0:_0x16c1f4[_0x13fa76(0xca)])===null||_0x3e3847===void 0x0?void 0x0:_0x3e3847['keys'],_0x182241=function(_0x51a35c,_0x428197){const _0x3bf26d=_0x13fa76;var _0x2e41cc,_0x409764,_0xd980c4,_0x5b3926,_0x35dd89,_0x205455,_0x4059f7,_0x809ef9,_0x508442,_0x20ace3,_0x381219;for(let _0x1db698 in _0x51a35c){if(_0x428197[(_0x2e41cc=_0x51a35c[_0x1db698])===null||_0x2e41cc===void 0x0?void 0x0:_0x2e41cc[_0x3bf26d(0xbc)]]&&((_0xd980c4=(_0x409764=_0x51a35c[_0x1db698])===null||_0x409764===void 0x0?void 0x0:_0x409764[_0x3bf26d(0x96)])===null||_0xd980c4===void 0x0?void 0x0:_0xd980c4[_0x3bf26d(0xb3)])){if(((_0x35dd89=(_0x5b3926=_0x51a35c[_0x1db698])===null||_0x5b3926===void 0x0?void 0x0:_0x5b3926['schema'])===null||_0x35dd89===void 0x0?void 0x0:_0x35dd89['type'])==_0x3bf26d(0x92))_0x428197[_0x51a35c[_0x1db698][_0x3bf26d(0xbc)]]=_0x182241((_0x4059f7=(_0x205455=_0x51a35c[_0x1db698])===null||_0x205455===void 0x0?void 0x0:_0x205455['schema'][_0x3bf26d(0xca)])===null||_0x4059f7===void 0x0?void 0x0:_0x4059f7[_0x3bf26d(0xbe)],_0x428197[_0x51a35c[_0x1db698]['key']]);else{if(_0x51a35c[_0x1db698]['schema']['type']==_0x3bf26d(0xc9)&&_0x59c2d1[_0x3bf26d(0x99)][(_0x809ef9=_0x51a35c[_0x1db698])===null||_0x809ef9===void 0x0?void 0x0:_0x809ef9[_0x3bf26d(0xbc)]]){const _0x452322=((_0x381219=(_0x20ace3=(_0x508442=_0x51a35c[_0x1db698])===null||_0x508442===void 0x0?void 0x0:_0x508442[_0x3bf26d(0x96)])===null||_0x20ace3===void 0x0?void 0x0:_0x20ace3['_flags'])===null||_0x381219===void 0x0?void 0x0:_0x381219[_0x3bf26d(0x9f)])||_0x3bf26d(0xc1);_0x428197[_0x51a35c[_0x1db698][_0x3bf26d(0xbc)]]=dayjs(_0x59c2d1['value'][_0x51a35c[_0x1db698]['key']])[_0x3bf26d(0x9f)](_0x452322);}}}}return _0x428197;};return _0x182241(_0x183aeb,_0x59c2d1['value']);}throw new AnnError(ValidatorError_1[_0x13fa76(0xcd)][_0x13fa76(0x91)]);}};__decorate([(0x0,decorator_1[a10_0x8f918c(0xb0)])(a10_0x8f918c(0x8f)),__metadata(a10_0x8f918c(0xab),Object)],ValidatorService['prototype'],a10_0x8f918c(0xc0),void 0x0),__decorate([(0x0,decorator_1[a10_0x8f918c(0xb0)])(a10_0x8f918c(0xc3)),__metadata(a10_0x8f918c(0xab),Object)],ValidatorService[a10_0x8f918c(0xbb)],a10_0x8f918c(0xcc),void 0x0),__decorate([(0x0,decorator_1[a10_0x8f918c(0x9d)])(),__metadata(a10_0x8f918c(0xab),i18n_1['MidwayI18nServiceSingleton'])],ValidatorService['prototype'],'i18nService',void 0x0),__decorate([(0x0,decorator_1['Init'])(),__metadata(a10_0x8f918c(0xab),Function),__metadata(a10_0x8f918c(0xa6),[]),__metadata(a10_0x8f918c(0x90),Promise)],ValidatorService[a10_0x8f918c(0xbb)],a10_0x8f918c(0xa7),null),ValidatorService=__decorate([(0x0,decorator_1['Provide'])(a10_0x8f918c(0xc3)),(0x0,decorator_1[a10_0x8f918c(0xa3)])(decorator_1[a10_0x8f918c(0x93)][a10_0x8f918c(0xce)])],ValidatorService),exports[a10_0x8f918c(0xa9)]=ValidatorService;
|