@stacksjs/validation 0.67.0 → 0.68.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.
package/dist/is.d.ts CHANGED
@@ -23,6 +23,6 @@ export declare function isPositive(v: any): boolean;
23
23
  export declare function isNegative(v: any): boolean;
24
24
  export declare function isEven(v: any): boolean;
25
25
  export declare function isOdd(v: any): boolean;
26
- export declare function isEvenOrOdd(v: any): "even" | "odd";
27
- export declare function isPositiveOrNegative(v: any): "positive" | "negative";
28
- export declare function isIntegerOrFloat(v: any): "integer" | "float";
26
+ export declare function isEvenOrOdd(v: any): 'even' | 'odd';
27
+ export declare function isPositiveOrNegative(v: any): 'positive' | 'negative';
28
+ export declare function isIntegerOrFloat(v: any): 'integer' | 'float';
@@ -1,8 +1,7 @@
1
- interface MessageObject {
2
- message: string;
3
- rule: string;
4
- field: string;
1
+ declare interface MessageObject {
2
+ message: string
3
+ rule: string
4
+ field: string
5
5
  }
6
6
  export declare function reportError(errors: MessageObject[]): void;
7
- export declare function getErrors(): MessageObject[];
8
- export {};
7
+ export declare function getErrors(): MessageObject[];
package/dist/rules.d.ts CHANGED
@@ -1,79 +1,30 @@
1
- /**
2
- * Thanks to VineJS for the following types:
3
- *
4
- * The context shared with the entire validation pipeline.
5
- * Each field gets its own context object.
6
- */
7
- export interface FieldContext {
8
- /**
9
- * Field value
10
- */
11
- value: unknown;
12
- /**
13
- * The data property is the top-level object under validation.
14
- */
15
- data: any;
16
- /**
17
- * Shared metadata across the entire validation lifecycle. It can be
18
- * used to pass data between validation rules
19
- */
20
- meta: Record<string, any>;
21
- /**
22
- * Mutate the value of field under validation.
23
- */
24
- mutate: (newValue: any, field: FieldContext) => void;
25
- /**
26
- * Report error to the error reporter
27
- */
28
- report: ErrorReporterContract["report"];
29
- /**
30
- * Is this field valid. Default: true
31
- */
32
- isValid: boolean;
33
- /**
34
- * Is this field has value defined.
35
- */
36
- isDefined: boolean;
37
- /**
38
- * Wildcard path for the field. The value is a nested
39
- * pointer to the field under validation.
40
- *
41
- * In case of arrays, the `*` wildcard is used.
42
- */
43
- wildCardPath: string;
44
- /**
45
- * The parent property is the parent of the field. It could be an
46
- * array or an object.
47
- */
48
- parent: any;
49
- /**
50
- * Name of the field under validation. In case of an array, the field
51
- * name will be a number
52
- */
53
- name: string | number;
54
- /**
55
- * Is this field an array member
56
- */
57
- isArrayMember: boolean;
58
- }
59
- /**
60
- * Thanks to VineJS for the following types:
61
- *
62
- * The error reporter is used to report errors during the validation
63
- * process.
64
- */
65
- export interface ErrorReporterContract {
66
- /**
67
- * A boolean to known if there are one or more
68
- * errors.
69
- */
70
- hasErrors: boolean;
71
- /**
72
- * Creates an instance of an exception to throw
73
- */
74
- createError: () => Error;
75
- /**
76
- * Report error for a field
77
- */
78
- report: (message: string, rule: string, field: FieldContext, args?: Record<string, any>) => any;
1
+ export declare interface FieldContext {
2
+ value: unknown
3
+
4
+ data: any
5
+
6
+ meta: Record<string, any>
7
+
8
+ mutate: (newValue: any, field: FieldContext) => void
9
+
10
+ report: ErrorReporterContract['report']
11
+
12
+ isValid: boolean
13
+
14
+ isDefined: boolean
15
+
16
+ wildCardPath: string
17
+
18
+ parent: any
19
+
20
+ name: string | number
21
+
22
+ isArrayMember: boolean
79
23
  }
24
+ export declare interface ErrorReporterContract {
25
+ hasErrors: boolean
26
+
27
+ createError: () => Error
28
+
29
+ report: (message: string, rule: string, field: FieldContext, args?: Record<string, any>) => any
30
+ }
package/dist/schema.d.ts CHANGED
@@ -1,16 +1,14 @@
1
- import schema, { SimpleMessagesProvider, errors as VineError } from "@vinejs/vine";
2
- import rule from "validator";
3
- export { rule, schema, SimpleMessagesProvider, VineError };
4
- type SchemaString = string;
5
- type SchemaNumber = number;
6
- type SchemaBoolean = boolean;
7
- type SchemaEnum = string[];
8
- export type SchemaType = SchemaString | SchemaNumber | SchemaBoolean | SchemaEnum;
9
- export { VineBoolean, VineDate, VineEnum, VineNumber, VineString } from "@vinejs/vine";
10
- export type { Infer } from "@vinejs/vine/types";
1
+ export { rule, schema, SimpleMessagesProvider, VineError }
2
+ export { VineBoolean, VineDate, VineEnum, VineNumber, VineString } from '@vinejs/vine'
3
+ export type { Infer } from '@vinejs/vine/types';
4
+ declare type SchemaString = string
5
+ type SchemaNumber = number
6
+ type SchemaBoolean = boolean
7
+ type SchemaEnum = string[]
8
+ export declare type SchemaType = SchemaString | SchemaNumber | SchemaBoolean | SchemaEnum
11
9
  export declare const validate: {
12
- string: (defaultValue?: string) => SchemaString;
13
- number: (defaultValue?: number) => SchemaNumber;
14
- boolean: (defaultValue?: boolean) => SchemaBoolean;
15
- enum: (values: string[]) => SchemaEnum;
16
- };
10
+ string: (defaultValue: string) => SchemaString;
11
+ number: (defaultValue: number) => SchemaNumber;
12
+ boolean: (defaultValue: boolean) => SchemaBoolean;
13
+ enum: (values: string[]) => SchemaEnum
14
+ };
@@ -1,15 +1,15 @@
1
- import type { VineType } from "@stacksjs/types";
2
- interface RequestData {
3
- [key: string]: any;
1
+ import type { VineType } from '@stacksjs/types';
2
+
3
+ declare interface RequestData {
4
+ [key: string]: any
4
5
  }
5
- interface ValidationField {
6
- rule: VineType;
7
- message: Record<string, string>;
6
+ declare interface ValidationField {
7
+ rule: VineType
8
+ message: Record<string, string>
8
9
  }
9
- interface CustomAttributes {
10
- [key: string]: ValidationField;
10
+ declare interface CustomAttributes {
11
+ [key: string]: ValidationField
11
12
  }
12
13
  export declare function isObjectNotEmpty(obj: object | undefined): boolean;
13
14
  export declare function validateField(modelFile: string, params: RequestData): Promise<any>;
14
- export declare function customValidate(attributes: CustomAttributes, params: RequestData): Promise<any>;
15
- export {};
15
+ export declare function customValidate(attributes: CustomAttributes, params: RequestData): Promise<any>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/validation",
3
3
  "type": "module",
4
- "version": "0.67.0",
4
+ "version": "0.68.1",
5
5
  "description": "The Stacks Validation ways.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": ["Chris Breuer <chris@stacksjs.org>"],
@@ -1 +0,0 @@
1
- export { VineBoolean as ValidationBoolean, VineEnum as ValidationEnum, VineNumber as ValidationNumber, VineString as ValidationString } from "@vinejs/vine";