LCOV - code coverage report
Current view: top level - src/platform/assets/utils - outputExportUtil.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 20.0 % 10 2
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import type { CreateAssetExportData } from '@comfyorg/ingest-types'
       2              : 
       3              : import type { ResultItem } from '@comfyorg/api-client/executionTypes'
       4              : import { api } from '@/scripts/api'
       5              : 
       6              : type AssetExportRequest = CreateAssetExportData['body']
       7              : 
       8              : export type DownloadableOutput = ResultItem & { filename: string }
       9              : 
      10         2489 : export function isDownloadableOutput(
      11              :   item: ResultItem | null | undefined
      12              : ): item is DownloadableOutput {
      13         2489 :   return !!item?.filename
      14              : }
      15              : 
      16            0 : export function buildOutputsExportRequest(
      17              :   outputs: DownloadableOutput[]
      18              : ): AssetExportRequest | undefined {
      19            0 :   const assetIds = outputs.map((output) => output.id)
      20            0 :   if (assetIds.length === 0 || !assetIds.every((id): id is string => !!id)) {
      21            0 :     return undefined
      22              :   }
      23            0 :   return { asset_ids: assetIds, naming_strategy: 'preserve' }
      24              : }
      25              : 
      26            0 : export function outputFileUrl({
      27              :   filename,
      28              :   subfolder,
      29              :   type
      30              : }: DownloadableOutput): string {
      31            0 :   const params = new URLSearchParams({
      32              :     filename,
      33              :     subfolder: subfolder ?? '',
      34              :     type: type ?? 'output'
      35              :   })
      36            0 :   return api.apiURL(`/view?${params}`)
      37              : }
        

Generated by: LCOV version 2.0-1