@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.
- package/dist/config/config.default.d.ts +17 -0
- package/dist/config/config.default.js +1 -0
- package/dist/configuration.d.ts +7 -0
- package/dist/configuration.js +1 -0
- package/dist/decorator/Rule.d.ts +3 -0
- package/dist/decorator/Rule.js +1 -0
- package/dist/decorator/Validator.d.ts +3 -0
- package/dist/decorator/Validator.js +1 -0
- package/dist/exception/ValidatorError.d.ts +3 -0
- package/dist/exception/ValidatorError.js +1 -0
- package/dist/helper/dtoHelper.d.ts +5 -0
- package/dist/helper/dtoHelper.js +1 -0
- package/dist/helpers/dtoHelper.d.ts +5 -0
- package/dist/helpers/dtoHelper.js +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +1 -0
- package/dist/interface.d.ts +9 -0
- package/dist/interface.js +1 -0
- package/dist/service/ValidateService.d.ts +20 -0
- package/dist/service/ValidateService.js +1 -0
- package/dist/service/ValidatorService.d.ts +20 -0
- package/dist/service/ValidatorService.js +1 -0
- package/dist/services/ValidateService.d.ts +20 -0
- package/dist/services/ValidateService.js +1 -0
- package/locales/en_US.json +116 -0
- package/locales/zh_CN.json +116 -0
- package/package.json +28 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./interface";
|
|
2
|
+
export * from './helper/dtoHelper';
|
|
3
|
+
export { Validator } from "./decorator/Validator";
|
|
4
|
+
export { Rule, RuleType } from "./decorator/Rule";
|
|
5
|
+
export { ValidatorError } from './exception/ValidatorError';
|
|
6
|
+
export { ValidatorService } from "./service/ValidatorService";
|
|
7
|
+
export { CustomConfiguration as Configuration } from './configuration';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var a7_0x3ad6b0=a7_0x31c8;(function(_0x141bb5,_0x23e36c){var _0x1aed61=a7_0x31c8,_0x15b1c1=_0x141bb5();while(!![]){try{var _0x144645=-parseInt(_0x1aed61(0x208))/0x1*(-parseInt(_0x1aed61(0x204))/0x2)+-parseInt(_0x1aed61(0x200))/0x3+parseInt(_0x1aed61(0x207))/0x4*(-parseInt(_0x1aed61(0x1ef))/0x5)+-parseInt(_0x1aed61(0x1fc))/0x6*(-parseInt(_0x1aed61(0x202))/0x7)+parseInt(_0x1aed61(0x1f8))/0x8*(-parseInt(_0x1aed61(0x1ed))/0x9)+-parseInt(_0x1aed61(0x209))/0xa*(parseInt(_0x1aed61(0x20d))/0xb)+parseInt(_0x1aed61(0x210))/0xc;if(_0x144645===_0x23e36c)break;else _0x15b1c1['push'](_0x15b1c1['shift']());}catch(_0xfe6a31){_0x15b1c1['push'](_0x15b1c1['shift']());}}}(a7_0xf49e,0x2a4eb));var __createBinding=this&&this[a7_0x3ad6b0(0x1fb)]||(Object[a7_0x3ad6b0(0x1f1)]?function(_0x3fd7db,_0x2e3b91,_0x36acb2,_0x80b47){var _0x1048f=a7_0x3ad6b0;if(_0x80b47===undefined)_0x80b47=_0x36acb2;var _0x22d7a7=Object[_0x1048f(0x20a)](_0x2e3b91,_0x36acb2);(!_0x22d7a7||(_0x1048f(0x1f7)in _0x22d7a7?!_0x2e3b91[_0x1048f(0x20e)]:_0x22d7a7[_0x1048f(0x1fe)]||_0x22d7a7[_0x1048f(0x20f)]))&&(_0x22d7a7={'enumerable':!![],'get':function(){return _0x2e3b91[_0x36acb2];}}),Object['defineProperty'](_0x3fd7db,_0x80b47,_0x22d7a7);}:function(_0x4d6095,_0x8e2e80,_0x3f6e61,_0x11db58){if(_0x11db58===undefined)_0x11db58=_0x3f6e61;_0x4d6095[_0x11db58]=_0x8e2e80[_0x3f6e61];}),__exportStar=this&&this['__exportStar']||function(_0x4e203a,_0x36f733){var _0x381c6b=a7_0x3ad6b0;for(var _0x12d2e0 in _0x4e203a)if(_0x12d2e0!==_0x381c6b(0x20c)&&!Object[_0x381c6b(0x206)][_0x381c6b(0x1f4)]['call'](_0x36f733,_0x12d2e0))__createBinding(_0x36f733,_0x4e203a,_0x12d2e0);};Object[a7_0x3ad6b0(0x1f5)](exports,a7_0x3ad6b0(0x20e),{'value':!![]}),exports[a7_0x3ad6b0(0x205)]=exports[a7_0x3ad6b0(0x1f9)]=exports[a7_0x3ad6b0(0x1f3)]=exports['RuleType']=exports[a7_0x3ad6b0(0x1f6)]=exports[a7_0x3ad6b0(0x1f2)]=void 0x0,__exportStar(require(a7_0x3ad6b0(0x1fd)),exports),__exportStar(require(a7_0x3ad6b0(0x1ff)),exports);function a7_0x31c8(_0x50d78a,_0x1bce89){var _0xf49e93=a7_0xf49e();return a7_0x31c8=function(_0x31c8ef,_0x3ce17f){_0x31c8ef=_0x31c8ef-0x1ec;var _0x396adf=_0xf49e93[_0x31c8ef];return _0x396adf;},a7_0x31c8(_0x50d78a,_0x1bce89);}var Validator_1=require(a7_0x3ad6b0(0x1ec));Object[a7_0x3ad6b0(0x1f5)](exports,a7_0x3ad6b0(0x1f2),{'enumerable':!![],'get':function(){return Validator_1['Validator'];}});var Rule_1=require(a7_0x3ad6b0(0x20b));Object['defineProperty'](exports,'Rule',{'enumerable':!![],'get':function(){var _0x5bb5cf=a7_0x3ad6b0;return Rule_1[_0x5bb5cf(0x1f6)];}}),Object[a7_0x3ad6b0(0x1f5)](exports,a7_0x3ad6b0(0x1fa),{'enumerable':!![],'get':function(){var _0x2bc6e8=a7_0x3ad6b0;return Rule_1[_0x2bc6e8(0x1fa)];}});var ValidatorError_1=require(a7_0x3ad6b0(0x201));Object[a7_0x3ad6b0(0x1f5)](exports,a7_0x3ad6b0(0x1f3),{'enumerable':!![],'get':function(){var _0x3754f1=a7_0x3ad6b0;return ValidatorError_1[_0x3754f1(0x1f3)];}});var ValidatorService_1=require(a7_0x3ad6b0(0x203));Object['defineProperty'](exports,a7_0x3ad6b0(0x1f9),{'enumerable':!![],'get':function(){var _0x4b5e2d=a7_0x3ad6b0;return ValidatorService_1[_0x4b5e2d(0x1f9)];}});var configuration_1=require(a7_0x3ad6b0(0x1f0));Object[a7_0x3ad6b0(0x1f5)](exports,a7_0x3ad6b0(0x205),{'enumerable':!![],'get':function(){var _0x53ca58=a7_0x3ad6b0;return configuration_1[_0x53ca58(0x1ee)];}});function a7_0xf49e(){var _0x1bda30=['28709SuCdTP','2500ObVhor','getOwnPropertyDescriptor','./decorator/Rule','default','4268OpJavn','__esModule','configurable','4517772ZuxFxF','./decorator/Validator','18szHmcE','CustomConfiguration','566080YtlFln','./configuration','create','Validator','ValidatorError','hasOwnProperty','defineProperty','Rule','get','223672dwYkeQ','ValidatorService','RuleType','__createBinding','1087782IEGWzP','./interface','writable','./helper/dtoHelper','101538uQGGKk','./exception/ValidatorError','7rIuryb','./service/ValidatorService','2CLMHNL','Configuration','prototype','8WpurUu'];a7_0xf49e=function(){return _0x1bda30;};return a7_0xf49e();}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as Joi from 'joi';
|
|
2
|
+
export declare const RULES_KEY = "anncic-api:validate:rules";
|
|
3
|
+
export declare const VALIDATE_KEY = "anncic-api:validate:validate";
|
|
4
|
+
export interface ValidateOptions {
|
|
5
|
+
locale?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
errorStatus?: number;
|
|
8
|
+
validationOptions?: Joi.ValidationOptions;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var a8_0x2fe4d5=a8_0x4d2f;function a8_0x4d2f(_0xab0239,_0x2131a4){var _0x15d7b8=a8_0x15d7();return a8_0x4d2f=function(_0x4d2fc6,_0x550784){_0x4d2fc6=_0x4d2fc6-0x89;var _0x13da54=_0x15d7b8[_0x4d2fc6];return _0x13da54;},a8_0x4d2f(_0xab0239,_0x2131a4);}function a8_0x15d7(){var _0x56ca59=['8KWQGnd','defineProperty','anncic-api:validate:validate','__esModule','3092245lxfVqq','VALIDATE_KEY','9632190xTMtaT','175ujMiBa','992656DnVFNq','RULES_KEY','54jzXoGG','6675312PjDeir','1465690jcirmQ','anncic-api:validate:rules','4149006gexIti','309210etcDMs'];a8_0x15d7=function(){return _0x56ca59;};return a8_0x15d7();}(function(_0x3490d9,_0x41a3e2){var _0x2790fb=a8_0x4d2f,_0x2393a3=_0x3490d9();while(!![]){try{var _0x47947c=parseInt(_0x2790fb(0x8a))/0x1+parseInt(_0x2790fb(0x96))/0x2+parseInt(_0x2790fb(0x8c))/0x3+parseInt(_0x2790fb(0x8e))/0x4*(parseInt(_0x2790fb(0x92))/0x5)+parseInt(_0x2790fb(0x8d))/0x6*(parseInt(_0x2790fb(0x95))/0x7)+parseInt(_0x2790fb(0x89))/0x8+-parseInt(_0x2790fb(0x98))/0x9*(parseInt(_0x2790fb(0x94))/0xa);if(_0x47947c===_0x41a3e2)break;else _0x2393a3['push'](_0x2393a3['shift']());}catch(_0x32b7b2){_0x2393a3['push'](_0x2393a3['shift']());}}}(a8_0x15d7,0xe1ed1));Object[a8_0x2fe4d5(0x8f)](exports,a8_0x2fe4d5(0x91),{'value':!![]}),exports[a8_0x2fe4d5(0x93)]=exports[a8_0x2fe4d5(0x97)]=void 0x0,exports[a8_0x2fe4d5(0x97)]=a8_0x2fe4d5(0x8b),exports['VALIDATE_KEY']=a8_0x2fe4d5(0x90);
|
|
@@ -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
|
+
}
|