LCOV - code coverage report
Current view: top level - src/stores - rekeyGraphId.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 92.3 % 13 12
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import type { UUID } from '@/utils/uuid'
       2              : 
       3              : import { useEntityIdStore } from './entityIdStore'
       4              : import { useGraphMetadataStore } from './graphMetadataStore'
       5              : 
       6              : type GraphIdOwner = { kind: 'root' } | { kind: 'subgraph'; rootGraphId: UUID }
       7              : 
       8        11674 : export function rekeyGraphId(
       9              :   previousId: UUID,
      10              :   nextId: UUID,
      11              :   owner: GraphIdOwner
      12              : ): boolean {
      13        11674 :   if (previousId === nextId) return true
      14              : 
      15        11674 :   const metadata = useGraphMetadataStore()
      16        11674 :   const entityIds = useEntityIdStore()
      17        11674 :   const metadataOccupied =
      18              :     owner.kind === 'root'
      19              :       ? metadata.hasRoot(nextId)
      20              :       : metadata.has(owner.rootGraphId, nextId)
      21        11674 :   const entityIdsOccupied = owner.kind === 'root' && entityIds.has(nextId)
      22              : 
      23        11674 :   if (metadataOccupied || entityIdsOccupied) {
      24            0 :     return false
      25              :   }
      26              : 
      27        11674 :   if (owner.kind === 'root') {
      28        10907 :     metadata.rekeyRoot(previousId, nextId)
      29        10907 :     entityIds.rekey(previousId, nextId)
      30              :   } else {
      31          767 :     metadata.rekeyGraph(owner.rootGraphId, previousId, nextId)
      32              :   }
      33        11674 :   return true
      34              : }
        

Generated by: LCOV version 2.0-1