kanun 1.1.2 → 1.2.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/index.cjs +23 -1
- package/dist/index.d.ts +517 -510
- package/dist/index.js +20 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -381,276 +381,285 @@ declare class ErrorBag {
|
|
|
381
381
|
declare function register(rule: string, validate: (value: any, parameters?: string[], attribute?: string) => boolean | Promise<boolean>, replaceMessage?: (message: string, paramters: string[], data?: object, getDisplayableAttribute?: GenericCallable) => string): boolean;
|
|
382
382
|
declare function registerImplicit(rule: string, validate: (value: any, parameters?: string[] | number[], attribute?: string) => boolean | Promise<boolean>, replaceMessage?: (message: string, paramters: string[], data?: object, getDisplayableAttribute?: GenericCallable) => string): void;
|
|
383
383
|
//#endregion
|
|
384
|
-
//#region src/
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
matches: (value: any) => boolean;
|
|
388
|
-
size?: (value: any) => number;
|
|
389
|
-
}
|
|
390
|
-
interface ValidatorPluginApi {
|
|
391
|
-
registerRule: typeof register;
|
|
392
|
-
registerImplicitRule: typeof registerImplicit;
|
|
393
|
-
registerValueInspector: (inspector: ValidationValueInspector) => void;
|
|
394
|
-
extendTranslations: (translations: GenericObject) => void;
|
|
395
|
-
}
|
|
396
|
-
interface ValidatorPlugin {
|
|
397
|
-
name: string;
|
|
398
|
-
install: (api: ValidatorPluginApi) => void;
|
|
399
|
-
}
|
|
400
|
-
declare function definePlugin(plugin: ValidatorPlugin): ValidatorPlugin;
|
|
401
|
-
declare function usePlugin(plugin: ValidatorPlugin): void;
|
|
402
|
-
declare function registerValueInspector(inspector: ValidationValueInspector): void;
|
|
403
|
-
declare function getValidationValueInspector(value: any): ValidationValueInspector | undefined;
|
|
404
|
-
declare function getValidationMessageType(value: any, hasNumericRule?: boolean): string;
|
|
405
|
-
declare function getValidationSize(value: any, hasNumericRule?: boolean): number;
|
|
406
|
-
//#endregion
|
|
407
|
-
//#region src/BaseValidator.d.ts
|
|
408
|
-
declare class BaseValidator<D extends GenericObject = GenericObject> {
|
|
409
|
-
private excludedAttributes;
|
|
384
|
+
//#region src/Contracts/IValidationRule.d.ts
|
|
385
|
+
declare abstract class IValidationRule {
|
|
386
|
+
rules: ValidationRuleCallable[];
|
|
410
387
|
/**
|
|
411
|
-
*
|
|
388
|
+
* Run the validation rule.
|
|
412
389
|
*/
|
|
413
|
-
|
|
390
|
+
abstract validate(attribute: string, value: any, fail: (msg: string) => any): void;
|
|
414
391
|
/**
|
|
415
|
-
*
|
|
392
|
+
* Set the current validator.
|
|
416
393
|
*/
|
|
417
|
-
private data;
|
|
418
394
|
/**
|
|
419
|
-
*
|
|
395
|
+
* Set the data under validation.
|
|
420
396
|
*/
|
|
421
|
-
|
|
397
|
+
setData(_data: Record<string, any>): this;
|
|
398
|
+
passes(value: any, attribute: string): boolean | Promise<boolean>;
|
|
399
|
+
}
|
|
400
|
+
//#endregion
|
|
401
|
+
//#region src/Contracts/RuleBuilder.d.ts
|
|
402
|
+
interface ValidationRuleCallable {
|
|
403
|
+
name: string;
|
|
404
|
+
validator: (value: any, parameters?: string[], attribute?: string) => boolean | Promise<boolean>;
|
|
405
|
+
message?: string;
|
|
406
|
+
}
|
|
407
|
+
type CustomValidationRules = IValidationRule | ValidationRuleCallable;
|
|
408
|
+
declare class BaseValidationRuleClass {}
|
|
409
|
+
//#endregion
|
|
410
|
+
//#region src/Contracts/ValidatorContracts.d.ts
|
|
411
|
+
/**
|
|
412
|
+
* Parse rule names from rule string or string[] definitions
|
|
413
|
+
*/
|
|
414
|
+
type ExtractRules<R> = R extends string ? R extends `${infer Head}|${infer Tail}` ? Head extends `${infer Rule}:${string}` ? Rule | ExtractRules<Tail> : Head | ExtractRules<Tail> : R extends `${infer Rule}:${string}` ? Rule : R : R extends string[] ? ExtractRules<R[number]> : never;
|
|
415
|
+
type ValidatedData<T> = { [K in keyof T]: T[K] };
|
|
416
|
+
type RuleOutputKey<T extends string> = T extends `${infer Root}.*${string}` ? Root : T extends `${infer Root}.${string}` ? Root : T;
|
|
417
|
+
type RuleOutputKeys<R extends Record<string, any>> = RuleOutputKey<Extract<keyof R, string>>;
|
|
418
|
+
type RuleOutputOverride<R> = 'files' extends ExtractRules<R> ? ('files' extends keyof ValidationRuleOutputTypeMap ? ValidationRuleOutputTypeMap['files'] : never) : ValidationRuleOutputTypeMap[Extract<ExtractRules<R>, keyof ValidationRuleOutputTypeMap>];
|
|
419
|
+
type FieldOutputValue<D extends Record<string, any>, K extends string, FieldRules> = K extends keyof D ? [RuleOutputOverride<FieldRules>] extends [never] ? D[K] : D[K] extends RuleOutputOverride<FieldRules> ? D[K] : RuleOutputOverride<FieldRules> : [RuleOutputOverride<FieldRules>] extends [never] ? any : RuleOutputOverride<FieldRules>;
|
|
420
|
+
type ValidatedByRules<D extends Record<string, any>, R extends RulesForData<D>> = ValidatedData<{ [K in RuleOutputKeys<R>]: FieldOutputValue<D, K, K extends keyof R ? R[K] : never> }>;
|
|
421
|
+
/**
|
|
422
|
+
* Flatten data structure into dot-notation keys
|
|
423
|
+
* including wildcards (*) for arrays.
|
|
424
|
+
*/
|
|
425
|
+
type DotPaths<T, Prefix extends string = ''> = { [K in keyof T & string]: T[K] extends (infer A)[] ? `${Prefix}${K}` | `${Prefix}${K}.*` | (A extends Record<string, any> ? `${Prefix}${K}.*.${DotPaths<A>}` : never) : T[K] extends Record<string, any> ? `${Prefix}${K}` | `${Prefix}${K}.${DotPaths<T[K]>}` : `${Prefix}${K}` }[keyof T & string];
|
|
426
|
+
/**
|
|
427
|
+
* Builds message keys only for rules used on that field
|
|
428
|
+
*/
|
|
429
|
+
type FieldMessages<Field extends string, R> = `${Field}` | `${Field}.${ExtractRules<R> & ValidationRuleName}`;
|
|
430
|
+
/**
|
|
431
|
+
* Build all valid message keys for a given rules object
|
|
432
|
+
*/
|
|
433
|
+
type MessagesForRules<Rules extends Record<string, any>> = { [K in keyof Rules & string]: FieldMessages<K, Rules[K]> }[keyof Rules & string];
|
|
434
|
+
/**
|
|
435
|
+
* Make rules align with keys in the data object
|
|
436
|
+
*/
|
|
437
|
+
type RulesForData<D extends Record<string, any>> = Partial<Record<DotPaths<D>, ValidationRuleSet>>;
|
|
438
|
+
//#endregion
|
|
439
|
+
//#region src/Contracts/IDatabaseDriver.d.ts
|
|
440
|
+
interface ValidationDatabaseExistsInput {
|
|
441
|
+
table: string;
|
|
442
|
+
column: string;
|
|
443
|
+
value: any;
|
|
444
|
+
ignore?: any;
|
|
445
|
+
connection?: string;
|
|
446
|
+
attribute?: string;
|
|
447
|
+
data?: Record<string, any>;
|
|
448
|
+
}
|
|
449
|
+
declare abstract class IDatabaseDriver {
|
|
450
|
+
abstract exists(input: ValidationDatabaseExistsInput): boolean | Promise<boolean>;
|
|
451
|
+
}
|
|
452
|
+
//#endregion
|
|
453
|
+
//#region src/Contracts/IMessageBag.d.ts
|
|
454
|
+
declare class ValidationMessageProvider {
|
|
455
|
+
getMessageBag(): IMessageBag;
|
|
456
|
+
}
|
|
457
|
+
declare class IMessageBag implements ValidationMessageProvider {
|
|
422
458
|
/**
|
|
423
|
-
*
|
|
459
|
+
* Create a new message bag instance.
|
|
424
460
|
*/
|
|
425
|
-
|
|
461
|
+
constructor(messages: Record<string, string[] | string>);
|
|
462
|
+
getMessageBag(): IMessageBag;
|
|
426
463
|
/**
|
|
427
|
-
*
|
|
464
|
+
* Get all message keys.
|
|
428
465
|
*/
|
|
429
|
-
|
|
466
|
+
keys(): string[];
|
|
430
467
|
/**
|
|
431
|
-
*
|
|
468
|
+
* Add a message.
|
|
432
469
|
*/
|
|
433
|
-
|
|
470
|
+
add(key: string, message: string): this;
|
|
434
471
|
/**
|
|
435
|
-
*
|
|
472
|
+
* Add a message conditionally.
|
|
436
473
|
*/
|
|
437
|
-
|
|
474
|
+
addIf(condition: boolean, key: string, message: string): this;
|
|
438
475
|
/**
|
|
439
|
-
*
|
|
476
|
+
* Merge another message source into this one.
|
|
440
477
|
*/
|
|
441
|
-
|
|
478
|
+
merge(messages: Record<string, string[]> | ValidationMessageProvider): this;
|
|
442
479
|
/**
|
|
443
|
-
*
|
|
480
|
+
* Determine if messages exist for all given keys.
|
|
444
481
|
*/
|
|
445
|
-
|
|
482
|
+
has(key?: string | string[] | null): boolean;
|
|
446
483
|
/**
|
|
447
|
-
*
|
|
484
|
+
* Determine if messages exist for any given key.
|
|
448
485
|
*/
|
|
449
|
-
|
|
486
|
+
hasAny(keys: string | string[]): boolean;
|
|
450
487
|
/**
|
|
451
|
-
*
|
|
488
|
+
* Determine if messages don't exist for given keys.
|
|
452
489
|
*/
|
|
453
|
-
|
|
454
|
-
constructor(data: D, rules: InitialRules<D>, customMessages?: CustomMessages<D>, customAttributes?: CustomAttributes<D>);
|
|
455
|
-
static use(plugin: ValidatorPlugin | ValidatorPlugin[]): typeof BaseValidator;
|
|
456
|
-
static useContext(context?: GenericObject): typeof BaseValidator;
|
|
457
|
-
use(plugin: ValidatorPlugin | ValidatorPlugin[]): this;
|
|
458
|
-
setData<ND extends GenericObject>(data: ND): BaseValidator<ND>;
|
|
459
|
-
setRules(rules: InitialRules<D>): this;
|
|
460
|
-
setLang(lang: string): this;
|
|
490
|
+
missing(key: string | string[]): boolean;
|
|
461
491
|
/**
|
|
462
|
-
*
|
|
492
|
+
* Get the first message for a given key.
|
|
463
493
|
*/
|
|
464
|
-
|
|
494
|
+
first(key?: string | null, format?: string | null): string;
|
|
465
495
|
/**
|
|
466
|
-
* Get
|
|
467
|
-
* This is useful for custom rules that need access to additional data or services.
|
|
468
|
-
*
|
|
469
|
-
* @returns The current context object
|
|
496
|
+
* Get all messages for a given key.
|
|
470
497
|
*/
|
|
471
|
-
|
|
498
|
+
get(key: string, format?: string | null): string[] | Record<string, string[]>;
|
|
472
499
|
/**
|
|
473
|
-
* Get
|
|
474
|
-
*
|
|
475
|
-
* @returns
|
|
500
|
+
* Get all messages.
|
|
476
501
|
*/
|
|
477
|
-
|
|
502
|
+
all(format?: string): string[];
|
|
478
503
|
/**
|
|
479
|
-
*
|
|
480
|
-
*
|
|
481
|
-
* @param customMessages
|
|
482
|
-
* @returns
|
|
504
|
+
* Get unique messages.
|
|
483
505
|
*/
|
|
484
|
-
|
|
506
|
+
unique(format?: string | null): string[];
|
|
485
507
|
/**
|
|
486
|
-
*
|
|
487
|
-
*
|
|
488
|
-
* @param customAttributes
|
|
489
|
-
* @returns
|
|
508
|
+
* Remove messages for a key.
|
|
490
509
|
*/
|
|
491
|
-
|
|
510
|
+
forget(key: string): this;
|
|
492
511
|
/**
|
|
493
|
-
*
|
|
494
|
-
*
|
|
495
|
-
* @param stopOnFirstFailure
|
|
496
|
-
* @returns
|
|
512
|
+
* Get raw messages.
|
|
497
513
|
*/
|
|
498
|
-
|
|
514
|
+
messagesRaw(): Record<string, string[]>;
|
|
499
515
|
/**
|
|
500
|
-
*
|
|
501
|
-
*
|
|
502
|
-
* @returns
|
|
516
|
+
* Alias for messagesRaw().
|
|
503
517
|
*/
|
|
504
|
-
|
|
505
|
-
getExcludedAttributes(): string[];
|
|
518
|
+
getMessages(): Record<string, string[]>;
|
|
506
519
|
/**
|
|
507
|
-
*
|
|
508
|
-
* If no keys are provided, all error messages will be cleared.
|
|
509
|
-
*
|
|
510
|
-
* @param keys The keys of the error messages to clear
|
|
511
|
-
* @returns The updated ErrorBag instance
|
|
520
|
+
* Return message bag instance.
|
|
512
521
|
*/
|
|
513
|
-
|
|
522
|
+
getMessageBag(): IMessageBag;
|
|
514
523
|
/**
|
|
515
|
-
*
|
|
524
|
+
* Get format string.
|
|
516
525
|
*/
|
|
517
|
-
|
|
526
|
+
getFormat(): string;
|
|
518
527
|
/**
|
|
519
|
-
*
|
|
528
|
+
* Set default message format.
|
|
520
529
|
*/
|
|
521
|
-
|
|
530
|
+
setFormat(format: string): this;
|
|
522
531
|
/**
|
|
523
|
-
*
|
|
532
|
+
* Empty checks.
|
|
524
533
|
*/
|
|
525
|
-
|
|
534
|
+
isEmpty(): boolean;
|
|
535
|
+
isNotEmpty(): boolean;
|
|
536
|
+
any(): boolean;
|
|
526
537
|
/**
|
|
527
|
-
*
|
|
538
|
+
* Count total messages.
|
|
528
539
|
*/
|
|
529
|
-
|
|
540
|
+
count(): number;
|
|
530
541
|
/**
|
|
531
|
-
*
|
|
532
|
-
*
|
|
533
|
-
* @param attribute
|
|
534
|
-
* @returns
|
|
542
|
+
* Array & JSON conversions.
|
|
535
543
|
*/
|
|
536
|
-
|
|
537
|
-
|
|
544
|
+
toArray(): Record<string, string[]>;
|
|
545
|
+
jsonSerialize(): any;
|
|
546
|
+
toJson(options: number): string;
|
|
547
|
+
toPrettyJson(): string;
|
|
538
548
|
/**
|
|
539
|
-
*
|
|
549
|
+
* String representation.
|
|
540
550
|
*/
|
|
541
|
-
|
|
551
|
+
toString(): string;
|
|
552
|
+
}
|
|
553
|
+
//#endregion
|
|
554
|
+
//#region src/Contracts/IValidator.d.ts
|
|
555
|
+
declare class IValidator<D extends Record<string, any> = any, R extends RulesForData<D> = RulesForData<D>> {
|
|
556
|
+
constructor(data: D, rules: R, messages: Partial<Record<MessagesForRules<R>, string>>);
|
|
542
557
|
/**
|
|
543
|
-
*
|
|
558
|
+
* Validate the data and return the instance
|
|
544
559
|
*/
|
|
545
|
-
|
|
560
|
+
static make<D extends Record<string, any>, R extends RulesForData<D>>(data: D, rules: R, messages: Partial<Record<MessagesForRules<R>, string>>): IValidator<D, R>;
|
|
561
|
+
static useDatabase(driver: IDatabaseDriver): typeof IValidator;
|
|
562
|
+
static use(plugin: ValidatorPlugin | ValidatorPlugin[]): typeof IValidator;
|
|
563
|
+
static useContext(context: Record<string, any>): typeof IValidator;
|
|
546
564
|
/**
|
|
547
|
-
*
|
|
565
|
+
* Run the validator and store results.
|
|
548
566
|
*/
|
|
549
|
-
|
|
567
|
+
passes(): Promise<boolean>;
|
|
550
568
|
/**
|
|
551
|
-
*
|
|
569
|
+
* Opposite of passes()
|
|
552
570
|
*/
|
|
553
|
-
|
|
571
|
+
fails(): Promise<boolean>;
|
|
554
572
|
/**
|
|
555
|
-
*
|
|
573
|
+
* Throw if validation fails, else return executed data
|
|
574
|
+
*
|
|
575
|
+
* @throws ValidationException if validation fails
|
|
556
576
|
*/
|
|
557
|
-
|
|
577
|
+
validate(): Promise<ValidatedByRules<D, R>>;
|
|
558
578
|
/**
|
|
559
|
-
* Run
|
|
579
|
+
* Run the validator's rules against its data.
|
|
580
|
+
* @param bagName
|
|
581
|
+
* @returns
|
|
560
582
|
*/
|
|
561
|
-
|
|
583
|
+
validateWithBag(bagName: string): Promise<ValidatedByRules<D, R>>;
|
|
562
584
|
/**
|
|
563
|
-
*
|
|
585
|
+
* Stop validation on first failure.
|
|
564
586
|
*/
|
|
565
|
-
|
|
587
|
+
stopOnFirstFailure(): this;
|
|
588
|
+
use(plugin: ValidatorPlugin | ValidatorPlugin[]): this;
|
|
589
|
+
withContext(context: Record<string, any>): this;
|
|
590
|
+
getContext(): Record<string, any>;
|
|
566
591
|
/**
|
|
567
|
-
*
|
|
592
|
+
* Get the data that passed validation.
|
|
568
593
|
*/
|
|
569
|
-
|
|
594
|
+
validatedData(): ValidatedByRules<D, R>;
|
|
570
595
|
/**
|
|
571
|
-
*
|
|
596
|
+
* Return all validated input.
|
|
572
597
|
*/
|
|
573
|
-
|
|
598
|
+
validated(): Partial<D>;
|
|
574
599
|
/**
|
|
575
|
-
*
|
|
600
|
+
* Return a portion of validated input
|
|
576
601
|
*/
|
|
577
|
-
|
|
602
|
+
safe(): {
|
|
603
|
+
only: (keys: string[]) => Partial<D>;
|
|
604
|
+
except: (keys: string[]) => Partial<D>;
|
|
605
|
+
};
|
|
578
606
|
/**
|
|
579
|
-
*
|
|
607
|
+
* Get the message container for the validator.
|
|
580
608
|
*/
|
|
581
|
-
|
|
609
|
+
messages(): Promise<Partial<Record<MessagesForRules<R>, string>>>;
|
|
582
610
|
/**
|
|
583
|
-
*
|
|
611
|
+
* Add an after validation callback.
|
|
612
|
+
*
|
|
613
|
+
* @param callback
|
|
584
614
|
*/
|
|
585
|
-
|
|
615
|
+
after<C extends ((validator: IValidator<D, R>) => void) | BaseValidationRuleClass>(callback: C | C[]): this;
|
|
586
616
|
/**
|
|
587
|
-
*
|
|
617
|
+
* Get all errors.
|
|
588
618
|
*/
|
|
589
|
-
|
|
619
|
+
errors(): IMessageBag;
|
|
620
|
+
errorBag(): string;
|
|
590
621
|
/**
|
|
591
|
-
*
|
|
592
|
-
*
|
|
593
|
-
* Example: parameters = [name.*.first] and keys = [1], then the result will be name.1.first
|
|
622
|
+
* Reset validator with new data.
|
|
594
623
|
*/
|
|
595
|
-
|
|
624
|
+
setData(data: D): this;
|
|
596
625
|
/**
|
|
597
|
-
*
|
|
626
|
+
* Set validation rules.
|
|
598
627
|
*/
|
|
599
|
-
|
|
628
|
+
setRules(rules: R): this;
|
|
600
629
|
/**
|
|
601
|
-
*
|
|
630
|
+
* Add a single rule to existing rules.
|
|
602
631
|
*/
|
|
603
|
-
|
|
632
|
+
addRule(key: DotPaths<D>, rule: ValidationRuleSet): this;
|
|
604
633
|
/**
|
|
605
|
-
*
|
|
634
|
+
* Merge additional rules.
|
|
606
635
|
*/
|
|
607
|
-
|
|
636
|
+
mergeRules(rules: Record<string, string>): this;
|
|
608
637
|
/**
|
|
609
|
-
*
|
|
638
|
+
* Get current data.
|
|
610
639
|
*/
|
|
611
|
-
|
|
640
|
+
getData(): ValidatedByRules<D, R>;
|
|
612
641
|
/**
|
|
613
|
-
*
|
|
642
|
+
* Get current rules.
|
|
614
643
|
*/
|
|
615
|
-
|
|
644
|
+
getRules(): R;
|
|
645
|
+
database(driver: IDatabaseDriver): this;
|
|
646
|
+
getDatabaseDriver(): IDatabaseDriver | undefined;
|
|
647
|
+
}
|
|
648
|
+
//#endregion
|
|
649
|
+
//#region src/utilities/MessageBag.d.ts
|
|
650
|
+
declare class MessageBag implements IMessageBag {
|
|
616
651
|
/**
|
|
617
|
-
*
|
|
618
|
-
*
|
|
619
|
-
* Example: if "name.0" is given, "name.*" will be returned
|
|
652
|
+
* All of the registered messages.
|
|
620
653
|
*/
|
|
621
|
-
|
|
654
|
+
protected messages: Record<string, string[]>;
|
|
622
655
|
/**
|
|
623
|
-
*
|
|
624
|
-
*
|
|
625
|
-
* Example: 'foo.1.bar.spark.baz' -> [1, 'spark'] for 'foo.*.bar.*.baz'
|
|
656
|
+
* Default format for message output.
|
|
626
657
|
*/
|
|
627
|
-
|
|
628
|
-
}
|
|
629
|
-
//#endregion
|
|
630
|
-
//#region src/Contracts/IDatabaseDriver.d.ts
|
|
631
|
-
interface ValidationDatabaseExistsInput {
|
|
632
|
-
table: string;
|
|
633
|
-
column: string;
|
|
634
|
-
value: any;
|
|
635
|
-
ignore?: any;
|
|
636
|
-
connection?: string;
|
|
637
|
-
attribute?: string;
|
|
638
|
-
data?: Record<string, any>;
|
|
639
|
-
}
|
|
640
|
-
declare abstract class IDatabaseDriver {
|
|
641
|
-
abstract exists(input: ValidationDatabaseExistsInput): boolean | Promise<boolean>;
|
|
642
|
-
}
|
|
643
|
-
//#endregion
|
|
644
|
-
//#region src/Contracts/IMessageBag.d.ts
|
|
645
|
-
declare class ValidationMessageProvider {
|
|
646
|
-
getMessageBag(): IMessageBag;
|
|
647
|
-
}
|
|
648
|
-
declare class IMessageBag implements ValidationMessageProvider {
|
|
658
|
+
protected format: string;
|
|
649
659
|
/**
|
|
650
660
|
* Create a new message bag instance.
|
|
651
661
|
*/
|
|
652
|
-
constructor(messages
|
|
653
|
-
getMessageBag(): IMessageBag;
|
|
662
|
+
constructor(messages?: Record<string, string[] | string>);
|
|
654
663
|
/**
|
|
655
664
|
* Get all message keys.
|
|
656
665
|
*/
|
|
@@ -663,6 +672,10 @@ declare class IMessageBag implements ValidationMessageProvider {
|
|
|
663
672
|
* Add a message conditionally.
|
|
664
673
|
*/
|
|
665
674
|
addIf(condition: boolean, key: string, message: string): this;
|
|
675
|
+
/**
|
|
676
|
+
* Check uniqueness of key/message pair.
|
|
677
|
+
*/
|
|
678
|
+
protected isUnique(key: string, message: string): boolean;
|
|
666
679
|
/**
|
|
667
680
|
* Merge another message source into this one.
|
|
668
681
|
*/
|
|
@@ -670,11 +683,11 @@ declare class IMessageBag implements ValidationMessageProvider {
|
|
|
670
683
|
/**
|
|
671
684
|
* Determine if messages exist for all given keys.
|
|
672
685
|
*/
|
|
673
|
-
has(key
|
|
686
|
+
has(key: string | string[] | null): boolean;
|
|
674
687
|
/**
|
|
675
688
|
* Determine if messages exist for any given key.
|
|
676
689
|
*/
|
|
677
|
-
hasAny(keys
|
|
690
|
+
hasAny(keys?: string | string[]): boolean;
|
|
678
691
|
/**
|
|
679
692
|
* Determine if messages don't exist for given keys.
|
|
680
693
|
*/
|
|
@@ -687,10 +700,14 @@ declare class IMessageBag implements ValidationMessageProvider {
|
|
|
687
700
|
* Get all messages for a given key.
|
|
688
701
|
*/
|
|
689
702
|
get(key: string, format?: string | null): string[] | Record<string, string[]>;
|
|
703
|
+
/**
|
|
704
|
+
* Wildcard key match.
|
|
705
|
+
*/
|
|
706
|
+
protected getMessagesForWildcardKey(key: string, format: string | null): Record<string, string[]>;
|
|
690
707
|
/**
|
|
691
708
|
* Get all messages.
|
|
692
709
|
*/
|
|
693
|
-
all(format?: string): string[];
|
|
710
|
+
all(format?: string | null): string[];
|
|
694
711
|
/**
|
|
695
712
|
* Get unique messages.
|
|
696
713
|
*/
|
|
@@ -699,6 +716,14 @@ declare class IMessageBag implements ValidationMessageProvider {
|
|
|
699
716
|
* Remove messages for a key.
|
|
700
717
|
*/
|
|
701
718
|
forget(key: string): this;
|
|
719
|
+
/**
|
|
720
|
+
* Format an array of messages.
|
|
721
|
+
*/
|
|
722
|
+
protected transform(messages: string[], format: string, messageKey: string): string[];
|
|
723
|
+
/**
|
|
724
|
+
* Get proper format string.
|
|
725
|
+
*/
|
|
726
|
+
protected checkFormat(format?: string | null): string;
|
|
702
727
|
/**
|
|
703
728
|
* Get raw messages.
|
|
704
729
|
*/
|
|
@@ -710,7 +735,7 @@ declare class IMessageBag implements ValidationMessageProvider {
|
|
|
710
735
|
/**
|
|
711
736
|
* Return message bag instance.
|
|
712
737
|
*/
|
|
713
|
-
getMessageBag():
|
|
738
|
+
getMessageBag(): MessageBag;
|
|
714
739
|
/**
|
|
715
740
|
* Get format string.
|
|
716
741
|
*/
|
|
@@ -718,7 +743,7 @@ declare class IMessageBag implements ValidationMessageProvider {
|
|
|
718
743
|
/**
|
|
719
744
|
* Set default message format.
|
|
720
745
|
*/
|
|
721
|
-
setFormat(format
|
|
746
|
+
setFormat(format?: string): this;
|
|
722
747
|
/**
|
|
723
748
|
* Empty checks.
|
|
724
749
|
*/
|
|
@@ -734,7 +759,7 @@ declare class IMessageBag implements ValidationMessageProvider {
|
|
|
734
759
|
*/
|
|
735
760
|
toArray(): Record<string, string[]>;
|
|
736
761
|
jsonSerialize(): any;
|
|
737
|
-
toJson(options
|
|
762
|
+
toJson(options?: number): string;
|
|
738
763
|
toPrettyJson(): string;
|
|
739
764
|
/**
|
|
740
765
|
* String representation.
|
|
@@ -742,71 +767,50 @@ declare class IMessageBag implements ValidationMessageProvider {
|
|
|
742
767
|
toString(): string;
|
|
743
768
|
}
|
|
744
769
|
//#endregion
|
|
745
|
-
//#region src/
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
770
|
+
//#region src/Validator.d.ts
|
|
771
|
+
declare class Validator<D extends Record<string, any> = any, R extends RulesForData<D> = RulesForData<D>> implements IValidator<D, R> {
|
|
772
|
+
#private;
|
|
773
|
+
private static defaultDatabaseDriver?;
|
|
774
|
+
private data;
|
|
775
|
+
private rules;
|
|
776
|
+
private _errors;
|
|
777
|
+
private passing;
|
|
778
|
+
private executed;
|
|
779
|
+
private instance?;
|
|
780
|
+
private databaseDriver?;
|
|
781
|
+
private errorBagName;
|
|
782
|
+
private registeredCustomRules;
|
|
783
|
+
private shouldStopOnFirstFailure;
|
|
784
|
+
private context;
|
|
785
|
+
constructor(data: D, rules: R, messages?: Partial<Record<MessagesForRules<R>, string>>);
|
|
757
786
|
/**
|
|
758
|
-
*
|
|
787
|
+
* Validate the data and return the instance
|
|
759
788
|
*/
|
|
760
|
-
|
|
789
|
+
static make<D extends Record<string, any>, R extends RulesForData<D>>(data: D, rules: R, messages?: Partial<Record<MessagesForRules<R>, string>>): Validator<D, R>;
|
|
790
|
+
static useDatabase(driver: IDatabaseDriver): typeof Validator;
|
|
761
791
|
/**
|
|
762
|
-
* Set the
|
|
792
|
+
* Set the validator's context.
|
|
793
|
+
*
|
|
794
|
+
* @param context
|
|
795
|
+
* @returns
|
|
763
796
|
*/
|
|
797
|
+
static useContext(context?: Record<string, any>): typeof Validator;
|
|
764
798
|
/**
|
|
765
|
-
*
|
|
799
|
+
* Register a plugin with the validator.
|
|
800
|
+
* Plugins can add rules, messages, and even override existing rules and messages.
|
|
801
|
+
*
|
|
802
|
+
* @param plugin The plugin to register
|
|
803
|
+
* @returns The Validator class for chaining
|
|
766
804
|
*/
|
|
767
|
-
|
|
768
|
-
passes(value: any, attribute: string): boolean | Promise<boolean>;
|
|
769
|
-
}
|
|
770
|
-
//#endregion
|
|
771
|
-
//#region src/Contracts/ValidatorContracts.d.ts
|
|
772
|
-
/**
|
|
773
|
-
* Parse rule names from rule string or string[] definitions
|
|
774
|
-
*/
|
|
775
|
-
type ExtractRules<R> = R extends string ? R extends `${infer Head}|${infer Tail}` ? Head extends `${infer Rule}:${string}` ? Rule | ExtractRules<Tail> : Head | ExtractRules<Tail> : R extends `${infer Rule}:${string}` ? Rule : R : R extends string[] ? ExtractRules<R[number]> : never;
|
|
776
|
-
type ValidatedData<T> = { [K in keyof T]: T[K] };
|
|
777
|
-
type RuleOutputKey<T extends string> = T extends `${infer Root}.*${string}` ? Root : T extends `${infer Root}.${string}` ? Root : T;
|
|
778
|
-
type RuleOutputKeys<R extends Record<string, any>> = RuleOutputKey<Extract<keyof R, string>>;
|
|
779
|
-
type RuleOutputOverride<R> = 'files' extends ExtractRules<R> ? ('files' extends keyof ValidationRuleOutputTypeMap ? ValidationRuleOutputTypeMap['files'] : never) : ValidationRuleOutputTypeMap[Extract<ExtractRules<R>, keyof ValidationRuleOutputTypeMap>];
|
|
780
|
-
type FieldOutputValue<D extends Record<string, any>, K extends string, FieldRules> = K extends keyof D ? [RuleOutputOverride<FieldRules>] extends [never] ? D[K] : D[K] extends RuleOutputOverride<FieldRules> ? D[K] : RuleOutputOverride<FieldRules> : [RuleOutputOverride<FieldRules>] extends [never] ? any : RuleOutputOverride<FieldRules>;
|
|
781
|
-
type ValidatedByRules<D extends Record<string, any>, R extends RulesForData<D>> = ValidatedData<{ [K in RuleOutputKeys<R>]: FieldOutputValue<D, K, K extends keyof R ? R[K] : never> }>;
|
|
782
|
-
/**
|
|
783
|
-
* Flatten data structure into dot-notation keys
|
|
784
|
-
* including wildcards (*) for arrays.
|
|
785
|
-
*/
|
|
786
|
-
type DotPaths<T, Prefix extends string = ''> = { [K in keyof T & string]: T[K] extends (infer A)[] ? `${Prefix}${K}` | `${Prefix}${K}.*` | (A extends Record<string, any> ? `${Prefix}${K}.*.${DotPaths<A>}` : never) : T[K] extends Record<string, any> ? `${Prefix}${K}` | `${Prefix}${K}.${DotPaths<T[K]>}` : `${Prefix}${K}` }[keyof T & string];
|
|
787
|
-
/**
|
|
788
|
-
* Builds message keys only for rules used on that field
|
|
789
|
-
*/
|
|
790
|
-
type FieldMessages<Field extends string, R> = `${Field}` | `${Field}.${ExtractRules<R> & ValidationRuleName}`;
|
|
791
|
-
/**
|
|
792
|
-
* Build all valid message keys for a given rules object
|
|
793
|
-
*/
|
|
794
|
-
type MessagesForRules<Rules extends Record<string, any>> = { [K in keyof Rules & string]: FieldMessages<K, Rules[K]> }[keyof Rules & string];
|
|
795
|
-
/**
|
|
796
|
-
* Make rules align with keys in the data object
|
|
797
|
-
*/
|
|
798
|
-
type RulesForData<D extends Record<string, any>> = Partial<Record<DotPaths<D>, ValidationRuleSet>>;
|
|
799
|
-
//#endregion
|
|
800
|
-
//#region src/Contracts/IValidator.d.ts
|
|
801
|
-
declare class IValidator<D extends Record<string, any> = any, R extends RulesForData<D> = RulesForData<D>> {
|
|
802
|
-
constructor(data: D, rules: R, messages: Partial<Record<MessagesForRules<R>, string>>);
|
|
805
|
+
static use(plugin: ValidatorPlugin | ValidatorPlugin[]): typeof Validator;
|
|
803
806
|
/**
|
|
804
|
-
*
|
|
807
|
+
* Register a plugin with the validator.
|
|
808
|
+
* Plugins can add rules, messages, and even override existing rules and messages.
|
|
809
|
+
*
|
|
810
|
+
* @param plugin The plugin to register
|
|
811
|
+
* @returns The Validator instance for chaining
|
|
805
812
|
*/
|
|
806
|
-
|
|
807
|
-
static useDatabase(driver: IDatabaseDriver): typeof IValidator;
|
|
808
|
-
static use(plugin: ValidatorPlugin | ValidatorPlugin[]): typeof IValidator;
|
|
809
|
-
static useContext(context: Record<string, any>): typeof IValidator;
|
|
813
|
+
use(plugin: ValidatorPlugin | ValidatorPlugin[]): this;
|
|
810
814
|
/**
|
|
811
815
|
* Run the validator and store results.
|
|
812
816
|
*/
|
|
@@ -826,14 +830,33 @@ declare class IValidator<D extends Record<string, any> = any, R extends RulesFor
|
|
|
826
830
|
* @param bagName
|
|
827
831
|
* @returns
|
|
828
832
|
*/
|
|
829
|
-
validateWithBag(bagName: string): Promise<
|
|
833
|
+
validateWithBag(bagName: string): Promise<{ [K_1 in Extract<keyof R, string> extends infer T_1 ? T_1 extends Extract<keyof R, string> ? T_1 extends `${infer Root}.*${string}` ? Root : T_1 extends `${infer Root_1}.${string}` ? Root_1 : T_1 : never : never]: K_1 extends keyof D ? ["files" extends ExtractRules<K_1 extends keyof R ? R[K_1] : never> ? never : ValidationRuleOutputTypeMap[Extract<ExtractRules<K_1 extends keyof R ? R[K_1] : never>, never>]] extends [never] ? D[K_1] : D[K_1] extends ("files" extends ExtractRules<K_1 extends keyof R ? R[K_1] : never> ? never : ValidationRuleOutputTypeMap[Extract<ExtractRules<K_1 extends keyof R ? R[K_1] : never>, never>]) ? D[K_1] : "files" extends ExtractRules<K_1 extends keyof R ? R[K_1] : never> ? never : ValidationRuleOutputTypeMap[Extract<ExtractRules<K_1 extends keyof R ? R[K_1] : never>, never>] : ["files" extends ExtractRules<K_1 extends keyof R ? R[K_1] : never> ? never : ValidationRuleOutputTypeMap[Extract<ExtractRules<K_1 extends keyof R ? R[K_1] : never>, never>]] extends [never] ? any : "files" extends ExtractRules<K_1 extends keyof R ? R[K_1] : never> ? never : ValidationRuleOutputTypeMap[Extract<ExtractRules<K_1 extends keyof R ? R[K_1] : never>, never>] } extends infer T ? { [K in keyof T]: T[K] } : never>;
|
|
830
834
|
/**
|
|
831
835
|
* Stop validation on first failure.
|
|
832
836
|
*/
|
|
833
837
|
stopOnFirstFailure(): this;
|
|
834
|
-
|
|
835
|
-
|
|
838
|
+
/**
|
|
839
|
+
* Set the validator's context.
|
|
840
|
+
* This is useful for custom rules that need access to additional data or services.
|
|
841
|
+
*
|
|
842
|
+
* @param context
|
|
843
|
+
* @returns
|
|
844
|
+
*/
|
|
845
|
+
withContext(context?: Record<string, any>): this;
|
|
846
|
+
/**
|
|
847
|
+
* Get the validator's context.
|
|
848
|
+
* This is useful for custom rules that need access to additional data or services.
|
|
849
|
+
*
|
|
850
|
+
* @returns The current context object
|
|
851
|
+
*/
|
|
836
852
|
getContext(): Record<string, any>;
|
|
853
|
+
/**
|
|
854
|
+
* Prefer request-scoped uploaded files over scalar placeholder body values.
|
|
855
|
+
*
|
|
856
|
+
* @param attribute
|
|
857
|
+
* @returns
|
|
858
|
+
*/
|
|
859
|
+
private getValidatedAttributeValue;
|
|
837
860
|
/**
|
|
838
861
|
* Get the data that passed validation.
|
|
839
862
|
*/
|
|
@@ -858,11 +881,11 @@ declare class IValidator<D extends Record<string, any> = any, R extends RulesFor
|
|
|
858
881
|
*
|
|
859
882
|
* @param callback
|
|
860
883
|
*/
|
|
861
|
-
after<C extends ((validator:
|
|
884
|
+
after<C extends ((validator: Validator<D, R>) => void) | BaseValidationRuleClass>(callback: C | C[]): this;
|
|
862
885
|
/**
|
|
863
886
|
* Get all errors.
|
|
864
887
|
*/
|
|
865
|
-
errors():
|
|
888
|
+
errors(): MessageBag;
|
|
866
889
|
errorBag(): string;
|
|
867
890
|
/**
|
|
868
891
|
* Reset validator with new data.
|
|
@@ -890,407 +913,391 @@ declare class IValidator<D extends Record<string, any> = any, R extends RulesFor
|
|
|
890
913
|
getRules(): R;
|
|
891
914
|
database(driver: IDatabaseDriver): this;
|
|
892
915
|
getDatabaseDriver(): IDatabaseDriver | undefined;
|
|
916
|
+
/**
|
|
917
|
+
* Bind all required services here.
|
|
918
|
+
*/
|
|
919
|
+
private bindServices;
|
|
920
|
+
private execute;
|
|
893
921
|
}
|
|
894
922
|
//#endregion
|
|
895
|
-
//#region src/
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
declare function
|
|
923
|
+
//#region src/Plugin.d.ts
|
|
924
|
+
interface ValidationValueInspector {
|
|
925
|
+
type: string;
|
|
926
|
+
matches: (value: any) => boolean;
|
|
927
|
+
size?: (value: any) => number;
|
|
928
|
+
}
|
|
929
|
+
type ValidationLifecycleHook = (validator: Validator<any, any>) => void | Promise<void>;
|
|
930
|
+
interface ValidatorPluginApi {
|
|
931
|
+
registerRule: typeof register;
|
|
932
|
+
registerImplicitRule: typeof registerImplicit;
|
|
933
|
+
registerValueInspector: (inspector: ValidationValueInspector) => void;
|
|
934
|
+
extendTranslations: (translations: GenericObject) => void;
|
|
935
|
+
onValidationError: (hook: ValidationLifecycleHook) => void;
|
|
936
|
+
onValidationSuccess: (hook: ValidationLifecycleHook) => void;
|
|
937
|
+
}
|
|
938
|
+
interface ValidatorPlugin {
|
|
939
|
+
name: string;
|
|
940
|
+
install: (api: ValidatorPluginApi) => void;
|
|
941
|
+
}
|
|
942
|
+
declare function definePlugin(plugin: ValidatorPlugin): ValidatorPlugin;
|
|
943
|
+
declare function usePlugin(plugin: ValidatorPlugin): void;
|
|
944
|
+
declare function registerValueInspector(inspector: ValidationValueInspector): void;
|
|
945
|
+
declare function registerValidationErrorHook(hook: ValidationLifecycleHook): void;
|
|
946
|
+
declare function registerValidationSuccessHook(hook: ValidationLifecycleHook): void;
|
|
947
|
+
declare function dispatchValidationErrorHooks(validator: Validator<any, any>): Promise<void>;
|
|
948
|
+
declare function dispatchValidationSuccessHooks(validator: Validator<any, any>): Promise<void>;
|
|
949
|
+
declare function getValidationValueInspector(value: any): ValidationValueInspector | undefined;
|
|
950
|
+
declare function getValidationMessageType(value: any, hasNumericRule?: boolean): string;
|
|
951
|
+
declare function getValidationSize(value: any, hasNumericRule?: boolean): number;
|
|
917
952
|
//#endregion
|
|
918
|
-
//#region src/
|
|
919
|
-
declare class
|
|
920
|
-
|
|
921
|
-
* The validator performing the validation.
|
|
922
|
-
*/
|
|
923
|
-
private validator;
|
|
924
|
-
/**
|
|
925
|
-
* The minimum size of the password.
|
|
926
|
-
*/
|
|
927
|
-
private minLength;
|
|
928
|
-
/**
|
|
929
|
-
* The min amount of lower case letters required in the password
|
|
930
|
-
*/
|
|
931
|
-
private minLowerCase;
|
|
932
|
-
/**
|
|
933
|
-
* The min amount of uppercase letters required in the password
|
|
934
|
-
*/
|
|
935
|
-
private minUpperCase;
|
|
936
|
-
/**
|
|
937
|
-
* The min amount of letters required in the password
|
|
938
|
-
*/
|
|
939
|
-
private minLetters;
|
|
940
|
-
/**
|
|
941
|
-
* The min amount of letters required in the password
|
|
942
|
-
*/
|
|
943
|
-
private minNumbers;
|
|
944
|
-
/**
|
|
945
|
-
* The min amount of symbols required in the password
|
|
946
|
-
*/
|
|
947
|
-
private minSymbols;
|
|
948
|
-
/**
|
|
949
|
-
* Additional validation rules that should be merged into the default rules during validation.
|
|
950
|
-
*/
|
|
951
|
-
private customRules;
|
|
953
|
+
//#region src/BaseValidator.d.ts
|
|
954
|
+
declare class BaseValidator<D extends GenericObject = GenericObject> {
|
|
955
|
+
private excludedAttributes;
|
|
952
956
|
/**
|
|
953
|
-
* The
|
|
957
|
+
* The lang used to return error messages
|
|
954
958
|
*/
|
|
955
|
-
|
|
959
|
+
private lang;
|
|
956
960
|
/**
|
|
957
|
-
*
|
|
961
|
+
* The data object that will be validated
|
|
958
962
|
*/
|
|
959
|
-
|
|
963
|
+
private data;
|
|
960
964
|
/**
|
|
961
|
-
*
|
|
965
|
+
* The rules that will be used to check the validity of the data
|
|
962
966
|
*/
|
|
963
|
-
|
|
967
|
+
private rules;
|
|
964
968
|
/**
|
|
965
|
-
*
|
|
969
|
+
* This is an unchanged version of the inital rules before being changed for wildcard validations
|
|
966
970
|
*/
|
|
967
|
-
|
|
971
|
+
private initalRules;
|
|
968
972
|
/**
|
|
969
|
-
*
|
|
973
|
+
* The array of wildcard attributes with their asterisks expanded.
|
|
970
974
|
*/
|
|
971
|
-
|
|
975
|
+
private implicitAttributes;
|
|
972
976
|
/**
|
|
973
|
-
*
|
|
977
|
+
* Hold the error messages
|
|
974
978
|
*/
|
|
975
|
-
|
|
979
|
+
private messages;
|
|
976
980
|
/**
|
|
977
|
-
*
|
|
981
|
+
* Stores an instance of the validateAttributes class
|
|
978
982
|
*/
|
|
979
|
-
|
|
983
|
+
private validateAttributes;
|
|
980
984
|
/**
|
|
981
|
-
*
|
|
985
|
+
* Flag that defines wether or not validation should stop on first failure
|
|
982
986
|
*/
|
|
983
|
-
|
|
987
|
+
private stopOnFirstFailureFlag;
|
|
984
988
|
/**
|
|
985
|
-
*
|
|
989
|
+
* Custom messages returned based on the error
|
|
986
990
|
*/
|
|
987
|
-
|
|
991
|
+
customMessages: CustomMessages<D>;
|
|
988
992
|
/**
|
|
989
|
-
*
|
|
993
|
+
* Object of custom attribute name;
|
|
990
994
|
*/
|
|
991
|
-
|
|
995
|
+
customAttributes: CustomAttributes<D>;
|
|
992
996
|
/**
|
|
993
|
-
*
|
|
997
|
+
* Arbitrary per-validator context for plugins.
|
|
994
998
|
*/
|
|
995
|
-
|
|
999
|
+
private context;
|
|
1000
|
+
constructor(data: D, rules: InitialRules<D>, customMessages?: CustomMessages<D>, customAttributes?: CustomAttributes<D>);
|
|
1001
|
+
static use(plugin: ValidatorPlugin | ValidatorPlugin[]): typeof BaseValidator;
|
|
1002
|
+
static useContext(context?: GenericObject): typeof BaseValidator;
|
|
1003
|
+
use(plugin: ValidatorPlugin | ValidatorPlugin[]): this;
|
|
1004
|
+
setData<ND extends GenericObject>(data: ND): BaseValidator<ND>;
|
|
1005
|
+
setRules(rules: InitialRules<D>): this;
|
|
1006
|
+
setLang(lang: string): this;
|
|
996
1007
|
/**
|
|
997
|
-
* Set the
|
|
1008
|
+
* Set the validator's context.
|
|
998
1009
|
*/
|
|
999
|
-
|
|
1010
|
+
withContext(context?: GenericObject): this;
|
|
1000
1011
|
/**
|
|
1001
|
-
* Get the
|
|
1012
|
+
* Get the validator's context.
|
|
1013
|
+
* This is useful for custom rules that need access to additional data or services.
|
|
1014
|
+
*
|
|
1015
|
+
* @returns The current context object
|
|
1002
1016
|
*/
|
|
1003
|
-
|
|
1004
|
-
}
|
|
1005
|
-
//#endregion
|
|
1006
|
-
//#region src/rule.d.ts
|
|
1007
|
-
declare function requiredIf(callback: boolean | CallableFunction): RequiredIf;
|
|
1008
|
-
declare function ruleIn(values: (string | number)[]): In;
|
|
1009
|
-
declare function ruleNotIn(values: (string | number)[]): NotIn;
|
|
1010
|
-
declare function regex(value: RegExp): Regex;
|
|
1011
|
-
declare function notRegex(value: RegExp): Regex;
|
|
1012
|
-
//#endregion
|
|
1013
|
-
//#region src/Core.d.ts
|
|
1014
|
-
declare class Password extends Password$1 {}
|
|
1015
|
-
declare function make<D extends GenericObject = GenericObject>(data?: D, rules?: InitialRules<D>, customMessages?: CustomMessages<D>, customAttributes?: CustomAttributes<D>): BaseValidator<D>;
|
|
1016
|
-
//#endregion
|
|
1017
|
-
//#region src/Rules/IImplicitRule.d.ts
|
|
1018
|
-
declare class IImplicitRule extends IRuleContract {
|
|
1019
|
-
readonly __isImplicitRule = true;
|
|
1020
|
-
}
|
|
1021
|
-
//#endregion
|
|
1022
|
-
//#region src/utilities/MessageBag.d.ts
|
|
1023
|
-
declare class MessageBag implements IMessageBag {
|
|
1017
|
+
getContext(): GenericObject;
|
|
1024
1018
|
/**
|
|
1025
|
-
*
|
|
1019
|
+
* Get the current language used by the validator.
|
|
1020
|
+
*
|
|
1021
|
+
* @returns
|
|
1026
1022
|
*/
|
|
1027
|
-
|
|
1023
|
+
getLang(): string;
|
|
1028
1024
|
/**
|
|
1029
|
-
*
|
|
1025
|
+
* Set custom error messages for the validator.
|
|
1026
|
+
*
|
|
1027
|
+
* @param customMessages
|
|
1028
|
+
* @returns
|
|
1030
1029
|
*/
|
|
1031
|
-
|
|
1030
|
+
setCustomMessages(customMessages?: CustomMessages<D>): this;
|
|
1032
1031
|
/**
|
|
1033
|
-
*
|
|
1032
|
+
* Set custom attribute names for the validator.
|
|
1033
|
+
*
|
|
1034
|
+
* @param customAttributes
|
|
1035
|
+
* @returns
|
|
1034
1036
|
*/
|
|
1035
|
-
|
|
1037
|
+
setCustomAttributes(customAttributes?: CustomAttributes<D>): this;
|
|
1036
1038
|
/**
|
|
1037
|
-
*
|
|
1039
|
+
* Set whether the validator should stop validating after the first failure.
|
|
1040
|
+
*
|
|
1041
|
+
* @param stopOnFirstFailure
|
|
1042
|
+
* @returns
|
|
1038
1043
|
*/
|
|
1039
|
-
|
|
1044
|
+
stopOnFirstFailure(stopOnFirstFailure?: boolean): this;
|
|
1040
1045
|
/**
|
|
1041
|
-
*
|
|
1046
|
+
* Get the error messages related to the validation.
|
|
1047
|
+
*
|
|
1048
|
+
* @returns
|
|
1042
1049
|
*/
|
|
1043
|
-
|
|
1050
|
+
errors(): ErrorBag;
|
|
1051
|
+
getExcludedAttributes(): string[];
|
|
1044
1052
|
/**
|
|
1045
|
-
*
|
|
1053
|
+
* Clear the error messages for the given keys.
|
|
1054
|
+
* If no keys are provided, all error messages will be cleared.
|
|
1055
|
+
*
|
|
1056
|
+
* @param keys The keys of the error messages to clear
|
|
1057
|
+
* @returns The updated ErrorBag instance
|
|
1046
1058
|
*/
|
|
1047
|
-
|
|
1059
|
+
clearErrors(keys?: string[]): ErrorBag;
|
|
1048
1060
|
/**
|
|
1049
|
-
*
|
|
1061
|
+
* Create a new ErrorBag instance and set the custom errors, thus removing previous error messages
|
|
1050
1062
|
*/
|
|
1051
|
-
|
|
1063
|
+
setErrors(errors: CustomErrors): ErrorBag;
|
|
1052
1064
|
/**
|
|
1053
|
-
*
|
|
1065
|
+
* Append the error messages to the existing ErrorBag instance, thus preserving the old error messages if any
|
|
1054
1066
|
*/
|
|
1055
|
-
|
|
1067
|
+
appendErrors(errors: CustomErrors): ErrorBag;
|
|
1056
1068
|
/**
|
|
1057
|
-
*
|
|
1069
|
+
* Run the validator's rules against its data.
|
|
1058
1070
|
*/
|
|
1059
|
-
|
|
1071
|
+
validate(key?: string, value?: any): boolean;
|
|
1060
1072
|
/**
|
|
1061
|
-
*
|
|
1073
|
+
* Run the validator's rules against its data asynchronously.
|
|
1062
1074
|
*/
|
|
1063
|
-
|
|
1075
|
+
validateAsync(key?: string, value?: any): Promise<boolean>;
|
|
1064
1076
|
/**
|
|
1065
|
-
*
|
|
1077
|
+
* Get the displayable name of the attribute.
|
|
1078
|
+
*
|
|
1079
|
+
* @param attribute
|
|
1080
|
+
* @returns
|
|
1066
1081
|
*/
|
|
1067
|
-
|
|
1082
|
+
getDisplayableAttribute(attribute: string): string;
|
|
1083
|
+
private addCustomErrors;
|
|
1068
1084
|
/**
|
|
1069
|
-
*
|
|
1085
|
+
* Replace all error message place-holders with actual values.
|
|
1070
1086
|
*/
|
|
1071
|
-
|
|
1087
|
+
private makeReplacements;
|
|
1072
1088
|
/**
|
|
1073
|
-
*
|
|
1089
|
+
* Loop through all rules and run validation against each one of them
|
|
1074
1090
|
*/
|
|
1075
|
-
|
|
1091
|
+
private runAllValidations;
|
|
1076
1092
|
/**
|
|
1077
|
-
*
|
|
1093
|
+
* Loop through all rules and run validation against each one of them asynchronously.
|
|
1078
1094
|
*/
|
|
1079
|
-
|
|
1095
|
+
private runAllValidationsAsync;
|
|
1080
1096
|
/**
|
|
1081
|
-
*
|
|
1097
|
+
* Run validation for one specific attribute
|
|
1082
1098
|
*/
|
|
1083
|
-
|
|
1099
|
+
private runSingleValidation;
|
|
1084
1100
|
/**
|
|
1085
|
-
*
|
|
1101
|
+
* Run validation for one specific attribute asynchronously.
|
|
1086
1102
|
*/
|
|
1087
|
-
|
|
1103
|
+
private runSingleValidationAsync;
|
|
1088
1104
|
/**
|
|
1089
|
-
*
|
|
1105
|
+
* Run validation rules for the specified property and stop validation if needed
|
|
1090
1106
|
*/
|
|
1091
|
-
|
|
1107
|
+
private runValidation;
|
|
1092
1108
|
/**
|
|
1093
|
-
*
|
|
1109
|
+
* Run validation rules for the specified property asynchronously and stop validation if needed
|
|
1094
1110
|
*/
|
|
1095
|
-
|
|
1111
|
+
private runValidationAsync;
|
|
1096
1112
|
/**
|
|
1097
|
-
*
|
|
1113
|
+
* Check if we should stop further validations on a given attribute.
|
|
1098
1114
|
*/
|
|
1099
|
-
|
|
1115
|
+
private shouldStopValidating;
|
|
1100
1116
|
/**
|
|
1101
|
-
*
|
|
1117
|
+
* Parse the given rules add assign them to the current rules
|
|
1102
1118
|
*/
|
|
1103
|
-
|
|
1119
|
+
private addRules;
|
|
1104
1120
|
/**
|
|
1105
|
-
*
|
|
1121
|
+
* validate a given attribute against a rule.
|
|
1106
1122
|
*/
|
|
1107
|
-
|
|
1123
|
+
private validateAttribute;
|
|
1108
1124
|
/**
|
|
1109
|
-
*
|
|
1125
|
+
* Validate an attribute using a custom rule object
|
|
1110
1126
|
*/
|
|
1111
|
-
|
|
1127
|
+
private validateUsingCustomRule;
|
|
1112
1128
|
/**
|
|
1113
|
-
*
|
|
1129
|
+
* Set the error message linked to a custom validation rule
|
|
1114
1130
|
*/
|
|
1115
|
-
|
|
1131
|
+
private setCustomRuleErrorMessages;
|
|
1116
1132
|
/**
|
|
1117
|
-
*
|
|
1133
|
+
* Add a new error message to the messages object
|
|
1118
1134
|
*/
|
|
1119
|
-
|
|
1135
|
+
private addFailure;
|
|
1120
1136
|
/**
|
|
1121
|
-
*
|
|
1137
|
+
* Replace each field parameter which has asterisks with the given keys.
|
|
1138
|
+
*
|
|
1139
|
+
* Example: parameters = [name.*.first] and keys = [1], then the result will be name.1.first
|
|
1122
1140
|
*/
|
|
1123
|
-
|
|
1124
|
-
isNotEmpty(): boolean;
|
|
1125
|
-
any(): boolean;
|
|
1141
|
+
private replaceAsterisksInParameters;
|
|
1126
1142
|
/**
|
|
1127
|
-
*
|
|
1143
|
+
* Determine if the attribute is validatable.
|
|
1128
1144
|
*/
|
|
1129
|
-
|
|
1145
|
+
private isValidatable;
|
|
1130
1146
|
/**
|
|
1131
|
-
*
|
|
1147
|
+
* Determine if the field is present, or the rule implies required.
|
|
1132
1148
|
*/
|
|
1133
|
-
|
|
1134
|
-
jsonSerialize(): any;
|
|
1135
|
-
toJson(options?: number): string;
|
|
1136
|
-
toPrettyJson(): string;
|
|
1149
|
+
private presentOrRuleIsImplicit;
|
|
1137
1150
|
/**
|
|
1138
|
-
*
|
|
1151
|
+
* Determine if the attribute passes any optional check.
|
|
1139
1152
|
*/
|
|
1140
|
-
|
|
1141
|
-
}
|
|
1142
|
-
//#endregion
|
|
1143
|
-
//#region src/Validator.d.ts
|
|
1144
|
-
declare class Validator<D extends Record<string, any> = any, R extends RulesForData<D> = RulesForData<D>> implements IValidator<D, R> {
|
|
1145
|
-
#private;
|
|
1146
|
-
private static defaultDatabaseDriver?;
|
|
1147
|
-
private data;
|
|
1148
|
-
private rules;
|
|
1149
|
-
private _errors;
|
|
1150
|
-
private passing;
|
|
1151
|
-
private executed;
|
|
1152
|
-
private instance?;
|
|
1153
|
-
private databaseDriver?;
|
|
1154
|
-
private errorBagName;
|
|
1155
|
-
private registeredCustomRules;
|
|
1156
|
-
private shouldStopOnFirstFailure;
|
|
1157
|
-
private context;
|
|
1158
|
-
constructor(data: D, rules: R, messages?: Partial<Record<MessagesForRules<R>, string>>);
|
|
1153
|
+
private passesOptionalCheck;
|
|
1159
1154
|
/**
|
|
1160
|
-
*
|
|
1155
|
+
* Determine if the attribute fails the nullable check.
|
|
1161
1156
|
*/
|
|
1162
|
-
|
|
1163
|
-
static useDatabase(driver: IDatabaseDriver): typeof Validator;
|
|
1157
|
+
private isNotNullIfMarkedAsNullable;
|
|
1164
1158
|
/**
|
|
1165
|
-
*
|
|
1166
|
-
*
|
|
1167
|
-
* @param context
|
|
1168
|
-
* @returns
|
|
1159
|
+
* Resolve an attribute value from validator data first, then request-scoped file context.
|
|
1169
1160
|
*/
|
|
1170
|
-
|
|
1161
|
+
private getAttributeValue;
|
|
1171
1162
|
/**
|
|
1172
|
-
*
|
|
1173
|
-
* Plugins can add rules, messages, and even override existing rules and messages.
|
|
1163
|
+
* Get the primary attribute name
|
|
1174
1164
|
*
|
|
1175
|
-
*
|
|
1176
|
-
* @returns The Validator class for chaining
|
|
1165
|
+
* Example: if "name.0" is given, "name.*" will be returned
|
|
1177
1166
|
*/
|
|
1178
|
-
|
|
1167
|
+
private getPrimaryAttribute;
|
|
1179
1168
|
/**
|
|
1180
|
-
*
|
|
1181
|
-
* Plugins can add rules, messages, and even override existing rules and messages.
|
|
1169
|
+
* Get the explicit keys from an attribute flattened with dot notation.
|
|
1182
1170
|
*
|
|
1183
|
-
*
|
|
1184
|
-
* @returns The Validator instance for chaining
|
|
1171
|
+
* Example: 'foo.1.bar.spark.baz' -> [1, 'spark'] for 'foo.*.bar.*.baz'
|
|
1185
1172
|
*/
|
|
1186
|
-
|
|
1173
|
+
private getExplicitKeys;
|
|
1174
|
+
}
|
|
1175
|
+
//#endregion
|
|
1176
|
+
//#region src/Context.d.ts
|
|
1177
|
+
type ValidatorContext = Record<string, any>;
|
|
1178
|
+
/**
|
|
1179
|
+
* Get the current validator context.
|
|
1180
|
+
*
|
|
1181
|
+
* @returns
|
|
1182
|
+
*/
|
|
1183
|
+
declare function getValidatorContext(): ValidatorContext;
|
|
1184
|
+
/**
|
|
1185
|
+
* Use a context for the current validator instance and all of its children.
|
|
1186
|
+
*
|
|
1187
|
+
* @param context
|
|
1188
|
+
* @returns
|
|
1189
|
+
*/
|
|
1190
|
+
declare function useValidatorContext(context?: ValidatorContext): ValidatorContext;
|
|
1191
|
+
/**
|
|
1192
|
+
* Run a function with a given validator context.
|
|
1193
|
+
*
|
|
1194
|
+
* @param context The context to use during the execution of the callback
|
|
1195
|
+
* @param callback The function to execute with the given context
|
|
1196
|
+
*/
|
|
1197
|
+
declare function runWithValidatorContext<T>(context: ValidatorContext, callback: () => T): T;
|
|
1198
|
+
//#endregion
|
|
1199
|
+
//#region src/Rules/password.d.ts
|
|
1200
|
+
declare class Password$1 extends IRuleContract {
|
|
1187
1201
|
/**
|
|
1188
|
-
*
|
|
1202
|
+
* The validator performing the validation.
|
|
1189
1203
|
*/
|
|
1190
|
-
|
|
1204
|
+
private validator;
|
|
1191
1205
|
/**
|
|
1192
|
-
*
|
|
1206
|
+
* The minimum size of the password.
|
|
1193
1207
|
*/
|
|
1194
|
-
|
|
1208
|
+
private minLength;
|
|
1195
1209
|
/**
|
|
1196
|
-
*
|
|
1197
|
-
*
|
|
1198
|
-
* @throws ValidationException if validation fails
|
|
1210
|
+
* The min amount of lower case letters required in the password
|
|
1199
1211
|
*/
|
|
1200
|
-
|
|
1212
|
+
private minLowerCase;
|
|
1201
1213
|
/**
|
|
1202
|
-
*
|
|
1203
|
-
* @param bagName
|
|
1204
|
-
* @returns
|
|
1214
|
+
* The min amount of uppercase letters required in the password
|
|
1205
1215
|
*/
|
|
1206
|
-
|
|
1216
|
+
private minUpperCase;
|
|
1207
1217
|
/**
|
|
1208
|
-
*
|
|
1218
|
+
* The min amount of letters required in the password
|
|
1209
1219
|
*/
|
|
1210
|
-
|
|
1220
|
+
private minLetters;
|
|
1211
1221
|
/**
|
|
1212
|
-
*
|
|
1213
|
-
* This is useful for custom rules that need access to additional data or services.
|
|
1214
|
-
*
|
|
1215
|
-
* @param context
|
|
1216
|
-
* @returns
|
|
1222
|
+
* The min amount of letters required in the password
|
|
1217
1223
|
*/
|
|
1218
|
-
|
|
1224
|
+
private minNumbers;
|
|
1219
1225
|
/**
|
|
1220
|
-
*
|
|
1221
|
-
* This is useful for custom rules that need access to additional data or services.
|
|
1222
|
-
*
|
|
1223
|
-
* @returns The current context object
|
|
1226
|
+
* The min amount of symbols required in the password
|
|
1224
1227
|
*/
|
|
1225
|
-
|
|
1228
|
+
private minSymbols;
|
|
1226
1229
|
/**
|
|
1227
|
-
*
|
|
1228
|
-
*
|
|
1229
|
-
* @param attribute
|
|
1230
|
-
* @returns
|
|
1230
|
+
* Additional validation rules that should be merged into the default rules during validation.
|
|
1231
1231
|
*/
|
|
1232
|
-
private
|
|
1232
|
+
private customRules;
|
|
1233
1233
|
/**
|
|
1234
|
-
*
|
|
1234
|
+
* The callback that will generate the "default" version of the password rule.
|
|
1235
1235
|
*/
|
|
1236
|
-
|
|
1236
|
+
static defaultCallback: GenericCallable | Password$1;
|
|
1237
1237
|
/**
|
|
1238
|
-
*
|
|
1238
|
+
* Create a new instance of the password class
|
|
1239
1239
|
*/
|
|
1240
|
-
|
|
1240
|
+
static create(): Password$1;
|
|
1241
1241
|
/**
|
|
1242
|
-
*
|
|
1242
|
+
* Set the minimum length of the password
|
|
1243
1243
|
*/
|
|
1244
|
-
|
|
1245
|
-
only: (keys: string[]) => Partial<D>;
|
|
1246
|
-
except: (keys: string[]) => Partial<D>;
|
|
1247
|
-
};
|
|
1244
|
+
min(min: number): Password$1;
|
|
1248
1245
|
/**
|
|
1249
|
-
*
|
|
1246
|
+
* Set the min amount of letters required in the password
|
|
1250
1247
|
*/
|
|
1251
|
-
|
|
1248
|
+
letters(letters?: number): Password$1;
|
|
1252
1249
|
/**
|
|
1253
|
-
*
|
|
1254
|
-
*
|
|
1255
|
-
* @param callback
|
|
1250
|
+
* Set the min amount of upper and lower case letters required in the password
|
|
1256
1251
|
*/
|
|
1257
|
-
|
|
1252
|
+
mixedCase(upperCase?: number, lowerCase?: number): Password$1;
|
|
1258
1253
|
/**
|
|
1259
|
-
*
|
|
1254
|
+
* Set the min amount of numbers required in the password
|
|
1260
1255
|
*/
|
|
1261
|
-
|
|
1262
|
-
errorBag(): string;
|
|
1256
|
+
numbers(numbers?: number): Password$1;
|
|
1263
1257
|
/**
|
|
1264
|
-
*
|
|
1258
|
+
* Set the min amount of symbols required in the password
|
|
1265
1259
|
*/
|
|
1266
|
-
|
|
1260
|
+
symbols(symbols?: number): Password$1;
|
|
1267
1261
|
/**
|
|
1268
|
-
*
|
|
1262
|
+
* Determine if the validation rule passes.
|
|
1269
1263
|
*/
|
|
1270
|
-
|
|
1264
|
+
passes(value: any, attribute: string): boolean;
|
|
1271
1265
|
/**
|
|
1272
|
-
*
|
|
1266
|
+
* Specify additional validation rules that should be merged with the default rules during validation.
|
|
1273
1267
|
*/
|
|
1274
|
-
|
|
1268
|
+
rules(rules: InitialRule[]): Password$1;
|
|
1275
1269
|
/**
|
|
1276
|
-
*
|
|
1270
|
+
* Get all the validation error messages related to the password
|
|
1277
1271
|
*/
|
|
1278
|
-
|
|
1272
|
+
getMessage(): object;
|
|
1279
1273
|
/**
|
|
1280
|
-
*
|
|
1274
|
+
* Set the validator instance used to validate the password
|
|
1281
1275
|
*/
|
|
1282
|
-
|
|
1276
|
+
setValidator(validator: BaseValidator): Password$1;
|
|
1283
1277
|
/**
|
|
1284
|
-
*
|
|
1278
|
+
* Set the default callback to be used for determining a password's default rules.
|
|
1285
1279
|
*/
|
|
1286
|
-
|
|
1287
|
-
database(driver: IDatabaseDriver): this;
|
|
1288
|
-
getDatabaseDriver(): IDatabaseDriver | undefined;
|
|
1280
|
+
static setDefault(callback?: GenericCallable | Password$1 | null): void;
|
|
1289
1281
|
/**
|
|
1290
|
-
*
|
|
1282
|
+
* Get the default configuration of the password rule.
|
|
1291
1283
|
*/
|
|
1292
|
-
|
|
1293
|
-
|
|
1284
|
+
static default(): IRuleContract | Password$1;
|
|
1285
|
+
}
|
|
1286
|
+
//#endregion
|
|
1287
|
+
//#region src/rule.d.ts
|
|
1288
|
+
declare function requiredIf(callback: boolean | CallableFunction): RequiredIf;
|
|
1289
|
+
declare function ruleIn(values: (string | number)[]): In;
|
|
1290
|
+
declare function ruleNotIn(values: (string | number)[]): NotIn;
|
|
1291
|
+
declare function regex(value: RegExp): Regex;
|
|
1292
|
+
declare function notRegex(value: RegExp): Regex;
|
|
1293
|
+
//#endregion
|
|
1294
|
+
//#region src/Core.d.ts
|
|
1295
|
+
declare class Password extends Password$1 {}
|
|
1296
|
+
declare function make<D extends GenericObject = GenericObject>(data?: D, rules?: InitialRules<D>, customMessages?: CustomMessages<D>, customAttributes?: CustomAttributes<D>): BaseValidator<D>;
|
|
1297
|
+
//#endregion
|
|
1298
|
+
//#region src/Rules/IImplicitRule.d.ts
|
|
1299
|
+
declare class IImplicitRule extends IRuleContract {
|
|
1300
|
+
readonly __isImplicitRule = true;
|
|
1294
1301
|
}
|
|
1295
1302
|
//#endregion
|
|
1296
1303
|
//#region src/ImplicitRule.d.ts
|
|
@@ -1642,4 +1649,4 @@ declare class ValidationException extends Error {
|
|
|
1642
1649
|
getResponse(): any;
|
|
1643
1650
|
}
|
|
1644
1651
|
//#endregion
|
|
1645
|
-
export { BaseRule, BaseValidationRuleClass, BaseValidator, CustomAttributes, CustomErrors, CustomMessages, CustomParamableValidationRuleName, CustomPlainRuleName, CustomValidationRuleNameMap, CustomValidationRules, DotPaths, ErrorBag, ErrorMessage, Errors, ExtendedRules, ExtractRules, FieldMessages, GenericCallable, GenericObject, IDatabaseDriver, IMessageBag, IValidationRule, IValidator, ImplicitAttributes, ImplicitRule, InitialRule, InitialRules, Lang, MessageBag, Messages, MessagesForRules, NestedStringMap, ParamableValidationRuleName, Password, PlainRuleName, ReplaceAttributeInterface, Rules, RulesForData, TRule, ValidatedByRules, ValidationCallback, ValidationDataInterface, ValidationDatabaseExistsInput, ValidationException, ValidationMessageProvider, ValidationRule, ValidationRuleAutocompleteKind, ValidationRuleAutocompleteMap, ValidationRuleCallable, ValidationRuleEntry, ValidationRuleName, ValidationRuleOutputTypeMap, ValidationRuleParserInterface, ValidationRuleSet, ValidationServiceProvider, ValidationValueInspector, Validator, ValidatorPlugin, ValidatorPluginApi, addImplicitRule, buildValidationMethodName, compare, convertValuesToBoolean, convertValuesToNull, convertValuesToNumber, deepEqual, deepFind, deepFindMessage, deepSet, definePlugin, dotify, getFormattedAttribute, getKeyCombinations, getMessage, getNumericRules, getSize, getValidationMessageType, getValidationSize, getValidationValueInspector, getValidatorContext, isArrayOfRules, isImplicitRule, isInteger, isNumericRule, isObject, isRule, isSizeRule, make, mergeDeep, notRegex, plural, regex, register, registerImplicit, registerValueInspector, requiredIf, ruleIn, ruleNotIn, runWithValidatorContext, sameType, toDate, toSnakeCase, usePlugin, useValidatorContext };
|
|
1652
|
+
export { BaseRule, BaseValidationRuleClass, BaseValidator, CustomAttributes, CustomErrors, CustomMessages, CustomParamableValidationRuleName, CustomPlainRuleName, CustomValidationRuleNameMap, CustomValidationRules, DotPaths, ErrorBag, ErrorMessage, Errors, ExtendedRules, ExtractRules, FieldMessages, GenericCallable, GenericObject, IDatabaseDriver, IMessageBag, IValidationRule, IValidator, ImplicitAttributes, ImplicitRule, InitialRule, InitialRules, Lang, MessageBag, Messages, MessagesForRules, NestedStringMap, ParamableValidationRuleName, Password, PlainRuleName, ReplaceAttributeInterface, Rules, RulesForData, TRule, ValidatedByRules, ValidationCallback, ValidationDataInterface, ValidationDatabaseExistsInput, ValidationException, ValidationLifecycleHook, ValidationMessageProvider, ValidationRule, ValidationRuleAutocompleteKind, ValidationRuleAutocompleteMap, ValidationRuleCallable, ValidationRuleEntry, ValidationRuleName, ValidationRuleOutputTypeMap, ValidationRuleParserInterface, ValidationRuleSet, ValidationServiceProvider, ValidationValueInspector, Validator, ValidatorPlugin, ValidatorPluginApi, addImplicitRule, buildValidationMethodName, compare, convertValuesToBoolean, convertValuesToNull, convertValuesToNumber, deepEqual, deepFind, deepFindMessage, deepSet, definePlugin, dispatchValidationErrorHooks, dispatchValidationSuccessHooks, dotify, getFormattedAttribute, getKeyCombinations, getMessage, getNumericRules, getSize, getValidationMessageType, getValidationSize, getValidationValueInspector, getValidatorContext, isArrayOfRules, isImplicitRule, isInteger, isNumericRule, isObject, isRule, isSizeRule, make, mergeDeep, notRegex, plural, regex, register, registerImplicit, registerValidationErrorHook, registerValidationSuccessHook, registerValueInspector, requiredIf, ruleIn, ruleNotIn, runWithValidatorContext, sameType, toDate, toSnakeCase, usePlugin, useValidatorContext };
|