4
4
PostgrestClient ,
5
5
PostgrestFilterBuilder ,
6
6
PostgrestQueryBuilder ,
7
+ ClientServerOptions as PostgrestClientServerOption ,
7
8
} from '@supabase/postgrest-js'
8
9
import {
9
10
RealtimeChannel ,
@@ -28,8 +29,12 @@ import { Fetch, GenericSchema, SupabaseClientOptions, SupabaseAuthClientOptions
28
29
*
29
30
* An isomorphic Javascript client for interacting with Postgres.
30
31
*/
32
+
33
+ export type ServicesOptions = PostgrestClientServerOption & { }
34
+
31
35
export default class SupabaseClient <
32
36
Database = any ,
37
+ ClientOptions extends ServicesOptions = { postgrestVersion : 12 } ,
33
38
SchemaName extends string & keyof Database = 'public' extends keyof Database
34
39
? 'public'
35
40
: string & keyof Database ,
@@ -47,7 +52,7 @@ export default class SupabaseClient<
47
52
protected authUrl : string
48
53
protected storageUrl : string
49
54
protected functionsUrl : string
50
- protected rest : PostgrestClient < Database , SchemaName , Schema >
55
+ protected rest : PostgrestClient < Database , ClientOptions , SchemaName , Schema >
51
56
protected storageKey : string
52
57
protected fetch ?: Fetch
53
58
protected changedAccessToken ?: string
@@ -154,16 +159,16 @@ export default class SupabaseClient<
154
159
from <
155
160
TableName extends string & keyof Schema [ 'Tables' ] ,
156
161
Table extends Schema [ 'Tables' ] [ TableName ]
157
- > ( relation : TableName ) : PostgrestQueryBuilder < Schema , Table , TableName >
162
+ > ( relation : TableName ) : PostgrestQueryBuilder < ClientOptions , Schema , Table , TableName >
158
163
from < ViewName extends string & keyof Schema [ 'Views' ] , View extends Schema [ 'Views' ] [ ViewName ] > (
159
164
relation : ViewName
160
- ) : PostgrestQueryBuilder < Schema , View , ViewName >
165
+ ) : PostgrestQueryBuilder < ClientOptions , Schema , View , ViewName >
161
166
/**
162
167
* Perform a query on a table or a view.
163
168
*
164
169
* @param relation - The table or view name to query
165
170
*/
166
- from ( relation : string ) : PostgrestQueryBuilder < Schema , any , any > {
171
+ from ( relation : string ) : PostgrestQueryBuilder < ClientOptions , Schema , any , any > {
167
172
return this . rest . from ( relation )
168
173
}
169
174
@@ -179,6 +184,7 @@ export default class SupabaseClient<
179
184
schema : DynamicSchema
180
185
) : PostgrestClient <
181
186
Database ,
187
+ ClientOptions ,
182
188
DynamicSchema ,
183
189
Database [ DynamicSchema ] extends GenericSchema ? Database [ DynamicSchema ] : any
184
190
> {
@@ -218,6 +224,7 @@ export default class SupabaseClient<
218
224
count ?: 'exact' | 'planned' | 'estimated'
219
225
} = { }
220
226
) : PostgrestFilterBuilder <
227
+ ClientOptions ,
221
228
Schema ,
222
229
Fn [ 'Returns' ] extends any [ ]
223
230
? Fn [ 'Returns' ] [ number ] extends Record < string , unknown >
0 commit comments