@anncic-api/validator 1.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,20 @@
1
+ import * as Joi from "joi";
2
+ import { MidwayI18nServiceSingleton } from '@midwayjs/i18n';
3
+ export declare class ValidatorService {
4
+ protected i18nConfig: any;
5
+ protected validateConfig: any;
6
+ protected i18nService: MidwayI18nServiceSingleton;
7
+ protected messages: {};
8
+ function(): Promise<void>;
9
+ getSchema<T extends new (...args: any[]) => any>(ClzType: T): Joi.ObjectSchema<any> | undefined;
10
+ validateWithSchema<T>(schema: Joi.ObjectSchema<any>, value: any, options?: {
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?: {
16
+ errorStatus?: number;
17
+ locale?: string;
18
+ validationOptions?: Joi.ValidationOptions;
19
+ }): any | undefined;
20
+ }
@@ -0,0 +1 @@
1
+ 'use strict';const a10_0xad6129=a10_0x5427;function a10_0x27c0(){const _0x10d202=['design:returntype','i18n','date','validationOptions','Provide','Config','@midwayjs/i18n','language','Singleton','../interface','getClassExtendedMetadata','getSchema','1Adrvvo','decorate','length','5253465ZKuKLZ','design:type','MidwayI18nServiceSingleton','schema','validateConfig','75212qBvQzC','355KxMBLe','9GHABqq','validateWithSchema','312582JodTzi','keys','format','PARAMS','fromEntries','design:paramtypes','localeTable','getOwnPropertyDescriptor','RULES_KEY','messages','error','__metadata','key','__esModule','Init','getAvailableLocale','getLocaleMapping','__decorate','$_terms','ScopeEnum','joi','defaultLocale','function','@midwayjs/decorator','_flags','Inject','i18nService','1422116QjqJgp','6582200HRtkfQ','object','errors','forEach','prototype','metadata','147poMtan','locale','validate','defineProperty','62324042vijPXp','formatLocale','i18nConfig','../exception/ValidatorError','YYYY-MM-DD\x20HH:mm:ss','type','value','ValidatorError','Scope','6538890VpGQon'];a10_0x27c0=function(){return _0x10d202;};return a10_0x27c0();}(function(_0x1f646a,_0x3ea004){const _0x137ad8=a10_0x5427,_0x2cf2bc=_0x1f646a();while(!![]){try{const _0x351b34=-parseInt(_0x137ad8(0x119))/0x1*(parseInt(_0x137ad8(0xf8))/0x2)+-parseInt(_0x137ad8(0x11c))/0x3+-parseInt(_0x137ad8(0x121))/0x4*(parseInt(_0x137ad8(0x122))/0x5)+-parseInt(_0x137ad8(0x125))/0x6*(parseInt(_0x137ad8(0xff))/0x7)+parseInt(_0x137ad8(0xf9))/0x8+-parseInt(_0x137ad8(0x123))/0x9*(parseInt(_0x137ad8(0x10c))/0xa)+parseInt(_0x137ad8(0x103))/0xb;if(_0x351b34===_0x3ea004)break;else _0x2cf2bc['push'](_0x2cf2bc['shift']());}catch(_0x131751){_0x2cf2bc['push'](_0x2cf2bc['shift']());}}}(a10_0x27c0,0xe6555));function a10_0x5427(_0xe15713,_0x1cf889){const _0x27c04a=a10_0x27c0();return a10_0x5427=function(_0x5427df,_0x560256){_0x5427df=_0x5427df-0xf2;let _0xb32335=_0x27c04a[_0x5427df];return _0xb32335;},a10_0x5427(_0xe15713,_0x1cf889);}var __decorate=this&&this[a10_0xad6129(0x136)]||function(_0x3a715a,_0x25350b,_0x5161cb,_0x3b39db){const _0x1b3496=a10_0xad6129;var _0x39a5c2=arguments[_0x1b3496(0x11b)],_0x1b2efc=_0x39a5c2<0x3?_0x25350b:_0x3b39db===null?_0x3b39db=Object[_0x1b3496(0x12c)](_0x25350b,_0x5161cb):_0x3b39db,_0x403d9c;if(typeof Reflect===_0x1b3496(0xfa)&&typeof Reflect[_0x1b3496(0x11a)]==='function')_0x1b2efc=Reflect[_0x1b3496(0x11a)](_0x3a715a,_0x25350b,_0x5161cb,_0x3b39db);else{for(var _0x1a6382=_0x3a715a['length']-0x1;_0x1a6382>=0x0;_0x1a6382--)if(_0x403d9c=_0x3a715a[_0x1a6382])_0x1b2efc=(_0x39a5c2<0x3?_0x403d9c(_0x1b2efc):_0x39a5c2>0x3?_0x403d9c(_0x25350b,_0x5161cb,_0x1b2efc):_0x403d9c(_0x25350b,_0x5161cb))||_0x1b2efc;}return _0x39a5c2>0x3&&_0x1b2efc&&Object[_0x1b3496(0x102)](_0x25350b,_0x5161cb,_0x1b2efc),_0x1b2efc;},__metadata=this&&this[a10_0xad6129(0x130)]||function(_0xc0d72a,_0x453f2c){const _0x59bece=a10_0xad6129;if(typeof Reflect===_0x59bece(0xfa)&&typeof Reflect[_0x59bece(0xfe)]==='function')return Reflect[_0x59bece(0xfe)](_0xc0d72a,_0x453f2c);};Object[a10_0xad6129(0x102)](exports,a10_0xad6129(0x132),{'value':!![]}),exports['ValidatorService']=void 0x0;const Joi=require(a10_0xad6129(0x139)),i18n_1=require(a10_0xad6129(0x113)),decorator_1=require(a10_0xad6129(0xf4)),interface_1=require(a10_0xad6129(0x116)),ValidatorError_1=require(a10_0xad6129(0x106));let ValidatorService=class ValidatorService{constructor(){const _0x42926c=a10_0xad6129;this[_0x42926c(0x12e)]={};}async[a10_0xad6129(0xf3)](){const _0x58c2f5=a10_0xad6129,_0x41b90b=Object['keys'](this[_0x58c2f5(0x105)][_0x58c2f5(0x12b)]);_0x41b90b[_0x58c2f5(0xfc)](_0x31127e=>{const _0x50e5b8=_0x58c2f5;this[_0x50e5b8(0x12e)][(0x0,i18n_1['formatLocale'])(_0x31127e)]=Object[_0x50e5b8(0x129)](this['i18nService'][_0x50e5b8(0x135)](_0x31127e,_0x50e5b8(0x101)));});}[a10_0xad6129(0x118)](_0xf74cc8){const _0x41e538=a10_0xad6129,_0x336081=(0x0,decorator_1[_0x41e538(0x117)])(interface_1[_0x41e538(0x12d)],_0xf74cc8);return _0x336081?Joi[_0x41e538(0xfa)](_0x336081):undefined;}[a10_0xad6129(0x124)](_0x5315a0,_0xc71978,_0x4f802b={}){const _0x4ccf87=a10_0xad6129;var _0xc23749,_0x41091a;_0x4f802b[_0x4ccf87(0x110)]=Object['assign']((_0xc23749=this[_0x4ccf87(0x120)][_0x4ccf87(0x110)])!==null&&_0xc23749!==void 0x0?_0xc23749:{},{'messages':this['messages']},_0x4f802b[_0x4ccf87(0x110)]||{}),_0x4f802b[_0x4ccf87(0x110)][_0x4ccf87(0xfb)]=_0x4f802b['validationOptions'][_0x4ccf87(0xfb)]||{},_0x4f802b['validationOptions'][_0x4ccf87(0xfb)][_0x4ccf87(0x114)]=(0x0,i18n_1[_0x4ccf87(0x104)])(this[_0x4ccf87(0xf7)][_0x4ccf87(0x134)](_0x4f802b[_0x4ccf87(0x110)]['errors'][_0x4ccf87(0x114)]||_0x4f802b[_0x4ccf87(0x100)]||this['i18nConfig'][_0x4ccf87(0xf2)],_0x4ccf87(0x101)));const _0x5a7c73=_0x5315a0[_0x4ccf87(0x101)](_0xc71978,_0x4f802b[_0x4ccf87(0x110)]);if(_0x5a7c73===null||_0x5a7c73===void 0x0?void 0x0:_0x5a7c73['error'])throw new AnnError(ValidatorError_1[_0x4ccf87(0x10a)][_0x4ccf87(0x128)],{'validator':_0x5a7c73[_0x4ccf87(0x12f)]});else{if(_0x5a7c73===null||_0x5a7c73===void 0x0?void 0x0:_0x5a7c73[_0x4ccf87(0x109)]){const _0x216ab5=(_0x41091a=_0x5315a0===null||_0x5315a0===void 0x0?void 0x0:_0x5315a0[_0x4ccf87(0x137)])===null||_0x41091a===void 0x0?void 0x0:_0x41091a[_0x4ccf87(0x126)],_0x26ad01=function(_0x5614e3,_0x3febb6){const _0x44e12a=_0x4ccf87;var _0x5170db,_0x310163,_0x43d4b7,_0x4e250c,_0x160e28,_0x3e9f3f,_0x4eccf0,_0x549eb4,_0x131f32,_0x3827e5,_0x71383f;for(let _0x33d3d3 in _0x5614e3){if(_0x3febb6[(_0x5170db=_0x5614e3[_0x33d3d3])===null||_0x5170db===void 0x0?void 0x0:_0x5170db[_0x44e12a(0x131)]]&&((_0x43d4b7=(_0x310163=_0x5614e3[_0x33d3d3])===null||_0x310163===void 0x0?void 0x0:_0x310163[_0x44e12a(0x11f)])===null||_0x43d4b7===void 0x0?void 0x0:_0x43d4b7[_0x44e12a(0x108)])){if(((_0x160e28=(_0x4e250c=_0x5614e3[_0x33d3d3])===null||_0x4e250c===void 0x0?void 0x0:_0x4e250c[_0x44e12a(0x11f)])===null||_0x160e28===void 0x0?void 0x0:_0x160e28[_0x44e12a(0x108)])=='object')_0x3febb6[_0x5614e3[_0x33d3d3]['key']]=_0x26ad01((_0x4eccf0=(_0x3e9f3f=_0x5614e3[_0x33d3d3])===null||_0x3e9f3f===void 0x0?void 0x0:_0x3e9f3f[_0x44e12a(0x11f)][_0x44e12a(0x137)])===null||_0x4eccf0===void 0x0?void 0x0:_0x4eccf0[_0x44e12a(0x126)],_0x3febb6[_0x5614e3[_0x33d3d3][_0x44e12a(0x131)]]);else{if(_0x5614e3[_0x33d3d3][_0x44e12a(0x11f)][_0x44e12a(0x108)]==_0x44e12a(0x10f)&&_0x5a7c73[_0x44e12a(0x109)][(_0x549eb4=_0x5614e3[_0x33d3d3])===null||_0x549eb4===void 0x0?void 0x0:_0x549eb4[_0x44e12a(0x131)]]){const _0x460255=((_0x71383f=(_0x3827e5=(_0x131f32=_0x5614e3[_0x33d3d3])===null||_0x131f32===void 0x0?void 0x0:_0x131f32[_0x44e12a(0x11f)])===null||_0x3827e5===void 0x0?void 0x0:_0x3827e5[_0x44e12a(0xf5)])===null||_0x71383f===void 0x0?void 0x0:_0x71383f['format'])||_0x44e12a(0x107);_0x3febb6[_0x5614e3[_0x33d3d3][_0x44e12a(0x131)]]=dayjs(_0x5a7c73[_0x44e12a(0x109)][_0x5614e3[_0x33d3d3][_0x44e12a(0x131)]])[_0x44e12a(0x127)](_0x460255);}}}}return _0x3febb6;};return _0x26ad01(_0x216ab5,_0x5a7c73[_0x4ccf87(0x109)]);}}return undefined;}[a10_0xad6129(0x101)](_0x13e336,_0x4fd679,_0x2030bc={}){const _0x2827f6=a10_0xad6129,_0x2705ad=this[_0x2827f6(0x118)](_0x13e336);return _0x2705ad?this[_0x2827f6(0x124)](_0x2705ad,_0x4fd679,_0x2030bc):undefined;}};__decorate([(0x0,decorator_1[a10_0xad6129(0x112)])(a10_0xad6129(0x10e)),__metadata(a10_0xad6129(0x11d),Object)],ValidatorService[a10_0xad6129(0xfd)],'i18nConfig',void 0x0),__decorate([(0x0,decorator_1['Config'])(a10_0xad6129(0x101)),__metadata(a10_0xad6129(0x11d),Object)],ValidatorService[a10_0xad6129(0xfd)],a10_0xad6129(0x120),void 0x0),__decorate([(0x0,decorator_1[a10_0xad6129(0xf6)])(),__metadata(a10_0xad6129(0x11d),i18n_1[a10_0xad6129(0x11e)])],ValidatorService[a10_0xad6129(0xfd)],'i18nService',void 0x0),__decorate([(0x0,decorator_1[a10_0xad6129(0x133)])(),__metadata(a10_0xad6129(0x11d),Function),__metadata(a10_0xad6129(0x12a),[]),__metadata(a10_0xad6129(0x10d),Promise)],ValidatorService['prototype'],a10_0xad6129(0xf3),null),ValidatorService=__decorate([(0x0,decorator_1[a10_0xad6129(0x111)])(a10_0xad6129(0x101)),(0x0,decorator_1[a10_0xad6129(0x10b)])(decorator_1[a10_0xad6129(0x138)][a10_0xad6129(0x115)])],ValidatorService),exports['ValidatorService']=ValidatorService;
@@ -0,0 +1,20 @@
1
+ import * as Joi from "joi";
2
+ import { MidwayI18nServiceSingleton } from '@midwayjs/i18n';
3
+ export declare class ValidateService {
4
+ protected i18nConfig: any;
5
+ protected validateConfig: any;
6
+ protected i18nService: MidwayI18nServiceSingleton;
7
+ protected messages: {};
8
+ function(): Promise<void>;
9
+ getSchema<T extends new (...args: any[]) => any>(ClzType: T): Joi.ObjectSchema<any> | undefined;
10
+ validateWithSchema<T>(schema: Joi.ObjectSchema<any>, value: any, options?: {
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?: {
16
+ errorStatus?: number;
17
+ locale?: string;
18
+ validationOptions?: Joi.ValidationOptions;
19
+ }): any | undefined;
20
+ }