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<
151
151
from <
152
152
TableName extends string & keyof Schema [ 'Tables' ] ,
153
153
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 )
158
161
}
159
162
160
163
/**
Original file line number Diff line number Diff line change @@ -59,12 +59,25 @@ export type GenericTable = {
59
59
Update : Record < string , unknown >
60
60
}
61
61
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
+
62
74
export type GenericFunction = {
63
75
Args : Record < string , unknown >
64
76
Returns : unknown
65
77
}
66
78
67
79
export type GenericSchema = {
68
80
Tables : Record < string , GenericTable >
81
+ Views : Record < string , GenericView >
69
82
Functions : Record < string , GenericFunction >
70
83
}
You can’t perform that action at this time.
0 commit comments