LCOV - code coverage report
Current view: top level - src/platform/workspace/ports - workspaceIdentity.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 53.8 % 13 7
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import type { WorkspaceWithRole } from '@comfyorg/ingest-types'
       2              : 
       3              : import { useCurrentUserAccess } from '@/platform/auth/currentUserAccess'
       4              : import { useTeamWorkspaceStore } from '@/platform/workspace/stores/teamWorkspaceStore'
       5              : 
       6              : export interface WorkspaceIdentityAccess {
       7              :   readonly workspaces: readonly Pick<WorkspaceWithRole, 'id' | 'type'>[]
       8              :   readonly activeWorkspace: Pick<
       9              :     WorkspaceWithRole,
      10              :     'id' | 'name' | 'type' | 'role' | 'subscription_tier'
      11              :   > | null
      12              :   readonly activeWorkspaceId: string | null
      13              :   readonly initSettled: boolean
      14              :   readonly isInPersonalWorkspace: boolean
      15              :   readonly workspaceTransitionGeneration: number
      16              :   readonly identityGeneration: number
      17              : }
      18              : 
      19        34441 : export function useWorkspaceIdentity(): WorkspaceIdentityAccess {
      20        34441 :   const workspace = useTeamWorkspaceStore()
      21        34441 :   return {
      22              :     get workspaces() {
      23            0 :       return workspace.workspaces
      24              :     },
      25              :     get activeWorkspace() {
      26        14524 :       return workspace.activeWorkspace
      27              :     },
      28              :     get activeWorkspaceId() {
      29         7374 :       return workspace.activeWorkspaceId
      30              :     },
      31              :     get initSettled() {
      32            0 :       const { initState } = workspace
      33            0 :       if (initState === 'ready' || initState === 'error') return true
      34            0 :       if (initState !== 'uninitialized') return false
      35            0 :       return !useCurrentUserAccess().isLoggedIn.value
      36              :     },
      37              :     get isInPersonalWorkspace() {
      38            0 :       return workspace.isInPersonalWorkspace
      39              :     },
      40              :     get workspaceTransitionGeneration() {
      41           31 :       return workspace.workspaceTransitionGeneration
      42              :     },
      43              :     get identityGeneration() {
      44          120 :       return workspace.identityGeneration
      45              :     }
      46              :   }
      47              : }
        

Generated by: LCOV version 2.0-1