storageUtils.ts26 lines · main
| 1 | /** |
| 2 | * Storage-specific utility functions for service flow |
| 3 | */ |
| 4 | |
| 5 | /** |
| 6 | * getStorageMetadata - Get storage metadata from enriched data or fallback |
| 7 | * |
| 8 | * This is the only storage utility we keep since it's specific to our service flow data structure. |
| 9 | * All other storage utilities (file extensions, type detection, etc.) should use the |
| 10 | * existing storage explorer utilities or standard helpers. |
| 11 | */ |
| 12 | export const getStorageMetadata = (data: any, enrichedData?: any): any => { |
| 13 | // First try to get from enrichedData (service flow) |
| 14 | const storageMetadata = enrichedData?.storage_metadata |
| 15 | if (storageMetadata) { |
| 16 | return storageMetadata |
| 17 | } |
| 18 | |
| 19 | // Fallback to data metadata |
| 20 | const dataMetadata = data?.metadata |
| 21 | if (dataMetadata) { |
| 22 | return dataMetadata |
| 23 | } |
| 24 | |
| 25 | return {} |
| 26 | } |