Skip to content

Commit 57233b7

Browse files
committed
chore: bump postgrest-js to canary
1 parent c4c6bd5 commit 57233b7

File tree

4 files changed

+26
-17
lines changed

4 files changed

+26
-17
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"@supabase/auth-js": "2.71.1",
5454
"@supabase/functions-js": "2.5.0",
5555
"@supabase/node-fetch": "2.6.15",
56-
"@supabase/postgrest-js": "1.21.4",
56+
"@supabase/postgrest-js": "https://pkg.pr.new/@supabase/postgrest-js@632",
5757
"@supabase/realtime-js": "2.15.5",
5858
"@supabase/storage-js": "2.12.1"
5959
},

src/SupabaseClient.ts

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { FunctionsClient } from '@supabase/functions-js'
22
import { AuthChangeEvent } from '@supabase/auth-js'
33
import {
4+
GetRpcFunctionFilterBuilderByArgs,
45
PostgrestClient,
56
PostgrestFilterBuilder,
67
PostgrestQueryBuilder,
@@ -238,25 +239,33 @@ export default class SupabaseClient<
238239
* `"estimated"`: Uses exact count for low numbers and planned count for high
239240
* numbers.
240241
*/
241-
rpc<FnName extends string & keyof Schema['Functions'], Fn extends Schema['Functions'][FnName]>(
242+
rpc<
243+
FnName extends string & keyof Schema['Functions'],
244+
Args extends Schema['Functions'][FnName]['Args'] = never,
245+
FilterBuilder extends GetRpcFunctionFilterBuilderByArgs<
246+
Schema,
247+
FnName,
248+
Args
249+
> = GetRpcFunctionFilterBuilderByArgs<Schema, FnName, Args>
250+
>(
242251
fn: FnName,
243-
args: Fn['Args'] = {},
252+
args: Args = {} as Args,
244253
options: {
245254
head?: boolean
246255
get?: boolean
247256
count?: 'exact' | 'planned' | 'estimated'
248-
} = {}
257+
} = {
258+
head: false,
259+
get: false,
260+
count: undefined,
261+
}
249262
): PostgrestFilterBuilder<
250263
ClientOptions,
251264
Schema,
252-
Fn['Returns'] extends any[]
253-
? Fn['Returns'][number] extends Record<string, unknown>
254-
? Fn['Returns'][number]
255-
: never
256-
: never,
257-
Fn['Returns'],
258-
FnName,
259-
null,
265+
FilterBuilder['Row'],
266+
FilterBuilder['Result'],
267+
FilterBuilder['RelationName'],
268+
FilterBuilder['Relationships'],
260269
'RPC'
261270
> {
262271
return this.rest.rpc(fn, args, options)

test/types/index.test-d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const supabase = createClient<Database>(URL, KEY)
7171

7272
// rpc return type
7373
{
74-
const { data, error } = await supabase.rpc('get_status')
74+
const { data, error } = await supabase.rpc('get_status', { name_param: 'supabot' })
7575
if (error) {
7676
throw new Error(error.message)
7777
}

0 commit comments

Comments
 (0)