From 76c93a3303487ae74ac58a8f94a2c21e36b9fda8 Mon Sep 17 00:00:00 2001 From: Bobbie Soedirgo Date: Wed, 14 Feb 2024 11:30:02 +0800 Subject: [PATCH] fix: revert from/schema/rpc changes This reverts commit a5a70dbe21a2e0ec6d8ec117caa35c605f69eb41. --- src/SupabaseClient.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/SupabaseClient.ts b/src/SupabaseClient.ts index 50e588d9..d520d2bc 100644 --- a/src/SupabaseClient.ts +++ b/src/SupabaseClient.ts @@ -130,7 +130,7 @@ export default class SupabaseClient< * * @param relation - The table or view name to query */ - from(relation: string): ReturnType['from']> { + from: PostgrestClient['from'] = (relation: string) => { return this.rest.from(relation) } @@ -142,9 +142,11 @@ export default class SupabaseClient< * * @param schema - The name of the schema to query */ - schema( + schema: PostgrestClient['schema'] = < + DynamicSchema extends string & keyof Database + >( schema: DynamicSchema - ): ReturnType['schema']> { + ) => { return this.rest.schema(schema) } @@ -169,14 +171,17 @@ export default class SupabaseClient< * `"estimated"`: Uses exact count for low numbers and planned count for high * numbers. */ - rpc( - fn: FnName, - args: Fn['Args'] = {}, + rpc: PostgrestClient['rpc'] = < + FunctionName extends string & keyof Schema['Functions'], + Function_ extends Schema['Functions'][FunctionName] + >( + fn: FunctionName, + args: Function_['Args'] = {}, options?: { head?: boolean count?: 'exact' | 'planned' | 'estimated' } - ): ReturnType['rpc']> { + ) => { return this.rest.rpc(fn, args, options) }