supabase/storage-js

Provide consistent naming between data returned form storage upload and equivalent storage.objects field

emmbm opened this issue · 0 comments

emmbm commented

Feature request

Is your feature request related to a problem? Please describe.

Not really a problem, but more of a consistency concern. Is there a reason why the data returned by a storage upload and the storage.objects's table field holding the same value aren't named consistently?

An upload response's data contains a path string, whereas the same value is held under a name column in the storage.objects table.

const storageRes = await db.storage
  .from('someBucket')
  .upload('some/path/to/a/file.webp', buffer, {contentType: 'image/webp'})
// storageRes: {
//    data: {
//        path: string;
//        ^^^^
//    };
//    error: null;
//} | {
//    data: null;
//    error: StorageError;
//}

I understand that the data returned is not necessarily resulting form a select on the objects table, but since the values are identical (in all cases?), maybe giving the same name to both would ensure a clearer assessment of their equivalence in developpers' mental models.

Describe the solution you'd like

Name both the concerned column and the data prop identically.

Describe alternatives you've considered

Keep things as they are. This really isn't a critical thing.

Additional context

Add any other context or screenshots about the feature request here.