File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -151,10 +151,13 @@ export default class SupabaseClient<
151151 from <
152152 TableName extends string & keyof Schema [ 'Tables' ] ,
153153 Table extends Schema [ 'Tables' ] [ TableName ]
154- > ( table : TableName ) : PostgrestQueryBuilder < Table >
155- from ( table : string ) : PostgrestQueryBuilder < any >
156- from ( table : string ) : PostgrestQueryBuilder < any > {
157- return this . rest . from ( table )
154+ > ( relation : TableName ) : PostgrestQueryBuilder < Table >
155+ from < ViewName extends string & keyof Schema [ 'Views' ] , View extends Schema [ 'Views' ] [ ViewName ] > (
156+ relation : ViewName
157+ ) : PostgrestQueryBuilder < View >
158+ from ( relation : string ) : PostgrestQueryBuilder < any >
159+ from ( relation : string ) : PostgrestQueryBuilder < any > {
160+ return this . rest . from ( relation )
158161 }
159162
160163 /**
Original file line number Diff line number Diff line change @@ -59,12 +59,25 @@ export type GenericTable = {
5959 Update : Record < string , unknown >
6060}
6161
62+ export type GenericUpdatableView = {
63+ Row : Record < string , unknown >
64+ Insert : Record < string , unknown >
65+ Update : Record < string , unknown >
66+ }
67+
68+ export type GenericNonUpdatableView = {
69+ Row : Record < string , unknown >
70+ }
71+
72+ export type GenericView = GenericUpdatableView | GenericNonUpdatableView
73+
6274export type GenericFunction = {
6375 Args : Record < string , unknown >
6476 Returns : unknown
6577}
6678
6779export type GenericSchema = {
6880 Tables : Record < string , GenericTable >
81+ Views : Record < string , GenericView >
6982 Functions : Record < string , GenericFunction >
7083}
You can’t perform that action at this time.
0 commit comments