LCOV - code coverage report
Current view: top level - packages/account-core/src/core - identity.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 100.0 % 3 3
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import type { AccountUser } from './sessionContracts'
       2              : 
       3              : /**
       4              :  * The identity boundary. An internal port, not a host adapter: real hosts
       5              :  * get their implementation from `@comfyorg/account-core/firebase`; tests brand a
       6              :  * fake through `@comfyorg/account-core/testing`. `createSessionClient` accepts
       7              :  * only the branded form.
       8              :  */
       9              : export interface IdentityPort<TUser extends AccountUser = AccountUser> {
      10              :   onUserChanged: (callback: (user: TUser | null) => void) => () => void
      11              : }
      12              : 
      13              : /**
      14              :  * The brand is a compile-time gate only: `createSessionClient` rejects an
      15              :  * unbranded port in the type system, and no runtime check remains. The
      16              :  * package's own identity entries mint it, and `./testing` deliberately
      17              :  * re-exports the minter as `createTestIdentity` so a suite can brand a fake.
      18              :  */
      19         2356 : export const identityBrand: unique symbol = Symbol(
      20              :   '@comfyorg/account-core identity'
      21              : )
      22              : 
      23              : export interface AccountIdentity<
      24              :   TUser extends AccountUser = AccountUser
      25              : > extends IdentityPort<TUser> {
      26              :   readonly [identityBrand]: true
      27              : }
      28              : 
      29         2356 : export function brandIdentity<TUser extends AccountUser>(
      30              :   port: IdentityPort<TUser>
      31              : ): AccountIdentity<TUser> {
      32         2356 :   return { ...port, [identityBrand]: true }
      33              : }
        

Generated by: LCOV version 2.0-1