1
1
import { FunctionsClient } from '@supabase/functions-js'
2
2
import { AuthChangeEvent } from '@supabase/gotrue-js'
3
- import {
4
- PostgrestClient ,
5
- PostgrestFilterBuilder ,
6
- PostgrestQueryBuilder ,
7
- } from '@supabase/postgrest-js'
3
+ import { PostgrestClient } from '@supabase/postgrest-js'
8
4
import {
9
5
RealtimeChannel ,
10
6
RealtimeChannelOptions ,
@@ -143,20 +139,12 @@ export default class SupabaseClient<
143
139
return new SupabaseStorageClient ( this . storageUrl , this . headers , this . fetch )
144
140
}
145
141
146
- from <
147
- TableName extends string & keyof Schema [ 'Tables' ] ,
148
- Table extends Schema [ 'Tables' ] [ TableName ]
149
- > ( relation : TableName ) : PostgrestQueryBuilder < Schema , Table >
150
- from < ViewName extends string & keyof Schema [ 'Views' ] , View extends Schema [ 'Views' ] [ ViewName ] > (
151
- relation : ViewName
152
- ) : PostgrestQueryBuilder < Schema , View >
153
- from ( relation : string ) : PostgrestQueryBuilder < Schema , any >
154
142
/**
155
143
* Perform a query on a table or a view.
156
144
*
157
145
* @param relation - The table or view name to query
158
146
*/
159
- from ( relation : string ) : PostgrestQueryBuilder < Schema , any > {
147
+ from : PostgrestClient < Database , SchemaName > [ 'from' ] = ( relation : string ) = > {
160
148
return this . rest . from ( relation )
161
149
}
162
150
@@ -168,13 +156,11 @@ export default class SupabaseClient<
168
156
*
169
157
* @param schema - The name of the schema to query
170
158
*/
171
- schema < DynamicSchema extends string & keyof Database > (
159
+ schema : PostgrestClient < Database , SchemaName > [ 'schema' ] = <
160
+ DynamicSchema extends string & keyof Database
161
+ > (
172
162
schema : DynamicSchema
173
- ) : PostgrestClient <
174
- Database ,
175
- DynamicSchema ,
176
- Database [ DynamicSchema ] extends GenericSchema ? Database [ DynamicSchema ] : any
177
- > {
163
+ ) => {
178
164
return this . rest . schema < DynamicSchema > ( schema )
179
165
}
180
166
@@ -199,7 +185,7 @@ export default class SupabaseClient<
199
185
* `"estimated"`: Uses exact count for low numbers and planned count for high
200
186
* numbers.
201
187
*/
202
- rpc <
188
+ rpc : PostgrestClient < Database , SchemaName > [ 'rpc' ] = <
203
189
FunctionName extends string & keyof Schema [ 'Functions' ] ,
204
190
Function_ extends Schema [ 'Functions' ] [ FunctionName ]
205
191
> (
@@ -209,15 +195,7 @@ export default class SupabaseClient<
209
195
head ?: boolean
210
196
count ?: 'exact' | 'planned' | 'estimated'
211
197
}
212
- ) : PostgrestFilterBuilder <
213
- Schema ,
214
- Function_ [ 'Returns' ] extends any [ ]
215
- ? Function_ [ 'Returns' ] [ number ] extends Record < string , unknown >
216
- ? Function_ [ 'Returns' ] [ number ]
217
- : never
218
- : never ,
219
- Function_ [ 'Returns' ]
220
- > {
198
+ ) => {
221
199
return this . rest . rpc ( fn , args , options )
222
200
}
223
201
0 commit comments