11import { createLogger } from '@sim/logger'
2- import { generateId } from '@/lib/core/utils/uuid'
2+ import { generateId , isValidUuid } from '@/lib/core/utils/uuid'
33import type { PermissionGroupConfig } from '@/lib/permission-groups/types'
44import { getEffectiveBlockOutputs } from '@/lib/workflows/blocks/block-outputs'
55import {
@@ -12,7 +12,7 @@ import { getAllBlocks } from '@/blocks/registry'
1212import type { BlockConfig } from '@/blocks/types'
1313import { TRIGGER_RUNTIME_SUBBLOCK_IDS } from '@/triggers/constants'
1414import type { EditWorkflowOperation , SkippedItem , ValidationError } from './types'
15- import { logSkippedItem , UUID_REGEX } from './types'
15+ import { logSkippedItem } from './types'
1616import {
1717 validateInputsForBlock ,
1818 validateSourceHandleForBlock ,
@@ -302,7 +302,7 @@ export function normalizeArrayWithIds(value: unknown): any[] {
302302 return item
303303 }
304304
305- const hasValidUUID = typeof item . id === 'string' && UUID_REGEX . test ( item . id )
305+ const hasValidUUID = typeof item . id === 'string' && isValidUuid ( item . id )
306306 if ( ! hasValidUUID ) {
307307 return { ...item , id : generateId ( ) }
308308 }
@@ -669,7 +669,7 @@ export function normalizeBlockIdsInOperations(operations: EditWorkflowOperation[
669669 // First pass: collect all non-UUID block_ids from add/insert operations
670670 for ( const op of operations ) {
671671 if ( op . operation_type === 'add' || op . operation_type === 'insert_into_subflow' ) {
672- if ( op . block_id && ! UUID_REGEX . test ( op . block_id ) ) {
672+ if ( op . block_id && ! isValidUuid ( op . block_id ) ) {
673673 const newId = generateId ( )
674674 idMapping . set ( op . block_id , newId )
675675 logger . debug ( 'Normalizing block ID' , { oldId : op . block_id , newId } )
0 commit comments