From a5729356ded374ef875ec4c118eb4ee4a7c7fd00 Mon Sep 17 00:00:00 2001 From: JohnDoe6345789 Date: Fri, 26 Dec 2025 01:38:51 +0000 Subject: [PATCH] code: validation,dbal,workflow (2 files) --- .../entities/validation/package-validation.ts | 18 +++++------------- .../entities/validation/workflow-validation.ts | 9 +++------ 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/dbal/ts/src/core/entities/validation/package-validation.ts b/dbal/ts/src/core/entities/validation/package-validation.ts index d7ecf1fe9..5795421a3 100644 --- a/dbal/ts/src/core/entities/validation/package-validation.ts +++ b/dbal/ts/src/core/entities/validation/package-validation.ts @@ -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) diff --git a/dbal/ts/src/core/entities/validation/workflow-validation.ts b/dbal/ts/src/core/entities/validation/workflow-validation.ts index 7d563599c..6a777075f 100644 --- a/dbal/ts/src/core/entities/validation/workflow-validation.ts +++ b/dbal/ts/src/core/entities/validation/workflow-validation.ts @@ -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]) }