storageUtils.ts 776 B

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