supabase / postgrest-js

Isomorphic JavaScript client for PostgREST.
https://supabase.com
MIT License
962 stars 128 forks source link

Remove signature to allow any table name for from #514

Open olee opened 5 months ago

olee commented 5 months ago

I think the 3rd signature for the from method should be removed which currently allows using any table name inside the postgrest client: https://github.com/supabase/postgrest-js/blob/f730aa793fbc8650de8bf914c816e943eba42844/src/PostgrestClient.ts#L59-L66 Currently this makes it quite hard to catch errors when for example removing or renaming tables.


If anyone would like to allow calling from on unknown tables, they could still do it imho by adding an index signature to the schema eg.

type Database = {
    public: {
        Tables: {
            /* standard signatures go here */

            // Allow any table name in from etc
            [key: string]: any;
        }
    }
}