mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-26 06:44:58 +00:00
code: validation,dbal,workflow (2 files)
This commit is contained in:
@@ -2,20 +2,12 @@
|
||||
* @file package-validation.ts
|
||||
* @description Package validation functions
|
||||
*/
|
||||
import { isValidSemver } from '../../validation/is-valid-semver'
|
||||
|
||||
const PACKAGE_ID_REGEX = /^[a-z0-9_]+$/;
|
||||
const VERSION_REGEX = /^\d+\.\d+\.\d+$/;
|
||||
const PACKAGE_ID_REGEX = /^[a-z0-9_]+$/
|
||||
|
||||
/**
|
||||
* Validate package ID format (snake_case)
|
||||
*/
|
||||
export function validatePackageId(packageId: string): boolean {
|
||||
return packageId.length > 0 && packageId.length <= 50 && PACKAGE_ID_REGEX.test(packageId);
|
||||
export const validatePackageId = (packageId: string): boolean => {
|
||||
return packageId.length > 0 && packageId.length <= 255 && PACKAGE_ID_REGEX.test(packageId)
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate version format (semver: x.y.z)
|
||||
*/
|
||||
export function validateVersion(version: string): boolean {
|
||||
return VERSION_REGEX.test(version);
|
||||
}
|
||||
export const validateVersion = (version: string): boolean => isValidSemver(version)
|
||||
|
||||
@@ -3,11 +3,8 @@
|
||||
* @description Workflow validation functions
|
||||
*/
|
||||
|
||||
const VALID_WORKFLOW_TYPES = ['manual', 'automated', 'scheduled', 'triggered'];
|
||||
const VALID_WORKFLOW_TYPES = ['manual', 'schedule', 'event', 'webhook'] as const
|
||||
|
||||
/**
|
||||
* Validate workflow type
|
||||
*/
|
||||
export function validateWorkflowType(type: string): boolean {
|
||||
return VALID_WORKFLOW_TYPES.includes(type);
|
||||
export const validateWorkflowType = (type: string): boolean => {
|
||||
return VALID_WORKFLOW_TYPES.includes(type as (typeof VALID_WORKFLOW_TYPES)[number])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user