supabase / postgrest-js

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

Incorrect RPC Types After Select #480

Closed jdgamble555 closed 7 months ago

jdgamble555 commented 9 months ago

Bug report

Describe the bug

The Typing For RPC Functions is incorrect after a select. I do not have access to eq, contains, or, etc...

For example:

const { data, error } = await supabase.rpc('custom_function').select('*, author(*)')
.eq(... // can't do this
.or(... // can't do this

To Reproduce

  1. Create an rpc function that returns a setof posts (or any table).
  2. Make sure to update your types supabase gen types typescript --local > database.ts (or whatever file)
  3. Import the types in your createClient as usual per the generating types

This is the result:

rpc function

Expected behavior

from and rpc should work the exact same way:

from function

You can see I can scroll a lot further in this example.

System information

Additional context

It is very important to note that this DOES WORK. postgREST DOES support these filters. supabase-js does not.

J

jdgamble555 commented 7 months ago

This can actually be closed out. You can do the eq and all the other filters before the select, which is probably more efficient anyways. Didn't think of that before.

J