@cargolift-cdi/lib-payload 0.1.56 → 0.1.58
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/cjs/payload-validation/payload-validation.js +4 -5
- package/dist/cjs/payload-validation/payload-validation.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/payload-validation/payload-validation.js +4 -5
- package/dist/esm/payload-validation/payload-validation.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/payload-validation/payload-validation.d.ts +2 -2
- package/dist/types/payload-validation/payload-validation.interface.d.ts +7 -7
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SchemaValidation, SchemaValidationResult } from "./payload-validation.interface.js";
|
|
2
2
|
export declare class PayloadValidation {
|
|
3
|
-
run(rawPayload: any, schema:
|
|
3
|
+
run(rawPayload: any, schema: SchemaValidation): Promise<SchemaValidationResult>;
|
|
4
4
|
private applyValidation;
|
|
5
5
|
private validateRule;
|
|
6
6
|
private validateRequired;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
type
|
|
1
|
+
export type SchemaFieldType = "string" | "number" | "boolean" | "date" | "object" | "array" | "email";
|
|
2
|
+
export interface Schema {
|
|
3
|
+
type?: SchemaFieldType;
|
|
4
4
|
required?: boolean;
|
|
5
5
|
length?: {
|
|
6
6
|
min?: number;
|
|
@@ -18,16 +18,16 @@ export interface SchemaValidation {
|
|
|
18
18
|
pattern?: string;
|
|
19
19
|
message?: string;
|
|
20
20
|
}
|
|
21
|
-
export interface
|
|
22
|
-
|
|
21
|
+
export interface SchemaValidation {
|
|
22
|
+
[fieldPath: string]: Schema;
|
|
23
23
|
}
|
|
24
|
-
export interface
|
|
24
|
+
export interface SchemaValidationResult {
|
|
25
25
|
success: boolean;
|
|
26
26
|
errors: {
|
|
27
27
|
field: string;
|
|
28
28
|
value: any;
|
|
29
29
|
error: string;
|
|
30
|
-
rule?:
|
|
30
|
+
rule?: Schema;
|
|
31
31
|
}[];
|
|
32
32
|
errorsList: string[];
|
|
33
33
|
}
|
package/package.json
CHANGED