mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-25 22:34:56 +00:00
81 lines
2.3 KiB
JSON
81 lines
2.3 KiB
JSON
{
|
|
"$schema": "https://metabuilder.dev/schemas/json-script-validation.schema.json",
|
|
"schemaVersion": "2.0.0",
|
|
"package": "complete-example",
|
|
"description": "Validation functions for complete example package",
|
|
"patterns": {
|
|
"email": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
|
|
"uuid": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
|
|
"password": "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{8,}$",
|
|
"slug": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
|
|
},
|
|
"functions": [
|
|
{
|
|
"id": "validate_email",
|
|
"name": "validateEmail",
|
|
"description": "Validates email address format",
|
|
"params": [
|
|
{
|
|
"name": "email",
|
|
"type": "string",
|
|
"sanitize": true
|
|
}
|
|
],
|
|
"returnType": "ValidationResult",
|
|
"async": false,
|
|
"severity": "error"
|
|
},
|
|
{
|
|
"id": "validate_password",
|
|
"name": "validatePassword",
|
|
"description": "Validates password strength",
|
|
"params": [
|
|
{
|
|
"name": "password",
|
|
"type": "string",
|
|
"sanitize": false
|
|
}
|
|
],
|
|
"returnType": "ValidationResult",
|
|
"async": false,
|
|
"severity": "error",
|
|
"message": "Password must be at least 8 characters with uppercase, lowercase, number, and special character"
|
|
},
|
|
{
|
|
"id": "validate_user_create",
|
|
"name": "validateUserCreate",
|
|
"description": "Validates user creation input",
|
|
"params": [
|
|
{
|
|
"name": "input",
|
|
"type": "CreateUserInput",
|
|
"sanitize": true
|
|
}
|
|
],
|
|
"returnType": "ValidationResult",
|
|
"async": true,
|
|
"severity": "error"
|
|
},
|
|
{
|
|
"id": "validate_unique_email",
|
|
"name": "validateUniqueEmail",
|
|
"description": "Checks if email is unique in database",
|
|
"params": [
|
|
{
|
|
"name": "email",
|
|
"type": "string",
|
|
"sanitize": true
|
|
}
|
|
],
|
|
"returnType": "ValidationResult",
|
|
"async": true,
|
|
"severity": "error",
|
|
"message": "Email already exists"
|
|
}
|
|
],
|
|
"exports": {
|
|
"functions": ["validateEmail", "validatePassword", "validateUserCreate", "validateUniqueEmail"],
|
|
"patterns": ["email", "password", "uuid", "slug"]
|
|
}
|
|
}
|