@@ -41,10 +41,7 @@ export default class PostgrestQueryBuilder<Table extends GenericTable> {
41
41
*/
42
42
select <
43
43
Query extends string = '*' ,
44
- Result = GetResult <
45
- Table [ 'Required' ] & Table [ 'Optional' ] & Table [ 'Readonly' ] ,
46
- Query extends '*' ? '*' : Query
47
- >
44
+ Result = GetResult < Table [ 'Row' ] , Query extends '*' ? '*' : Query >
48
45
> (
49
46
columns ?: Query ,
50
47
{
@@ -54,7 +51,7 @@ export default class PostgrestQueryBuilder<Table extends GenericTable> {
54
51
head ?: boolean
55
52
count ?: 'exact' | 'planned' | 'estimated'
56
53
} = { }
57
- ) : PostgrestFilterBuilder < Table [ 'Required' ] & Table [ 'Optional' ] & Table [ 'Readonly '] , Result > {
54
+ ) : PostgrestFilterBuilder < Table [ 'Row ' ] , Result > {
58
55
const method = head ? 'HEAD' : 'GET'
59
56
// Remove whitespaces except when quoted
60
57
let quoted = false
@@ -92,17 +89,14 @@ export default class PostgrestQueryBuilder<Table extends GenericTable> {
92
89
* @param values The values to insert.
93
90
* @param count Count algorithm to use to count rows in a table.
94
91
*/
95
- insert <
96
- Row extends Table [ 'Required' ] &
97
- Partial < Table [ 'Optional' ] & { [ _ in keyof Table [ 'Readonly' ] ] ?: never } >
98
- > (
92
+ insert < Row extends Table [ 'Insert' ] > (
99
93
values : Row | Row [ ] ,
100
94
{
101
95
count,
102
96
} : {
103
97
count ?: 'exact' | 'planned' | 'estimated'
104
98
} = { }
105
- ) : PostgrestFilterBuilder < Table [ 'Required' ] & Table [ 'Optional' ] & Table [ 'Readonly '] , undefined > {
99
+ ) : PostgrestFilterBuilder < Table [ 'Row ' ] , undefined > {
106
100
const method = 'POST'
107
101
108
102
const prefersHeaders = [ ]
@@ -144,10 +138,7 @@ export default class PostgrestQueryBuilder<Table extends GenericTable> {
144
138
* @param options.onConflict By specifying the `on_conflict` query parameter, you can make UPSERT work on a column(s) that has a UNIQUE constraint.
145
139
* @param options.ignoreDuplicates Specifies if duplicate rows should be ignored and not inserted.
146
140
*/
147
- upsert <
148
- Row extends Table [ 'Required' ] &
149
- Partial < Table [ 'Optional' ] > & { [ _ in keyof Table [ 'Readonly' ] ] ?: never }
150
- > (
141
+ upsert < Row extends Table [ 'Insert' ] > (
151
142
values : Row | Row [ ] ,
152
143
{
153
144
onConflict,
@@ -158,7 +149,7 @@ export default class PostgrestQueryBuilder<Table extends GenericTable> {
158
149
count ?: 'exact' | 'planned' | 'estimated'
159
150
ignoreDuplicates ?: boolean
160
151
} = { }
161
- ) : PostgrestFilterBuilder < Table [ 'Required' ] & Table [ 'Optional' ] & Table [ 'Readonly '] , undefined > {
152
+ ) : PostgrestFilterBuilder < Table [ 'Row ' ] , undefined > {
162
153
const method = 'POST'
163
154
164
155
const prefersHeaders = [ `resolution=${ ignoreDuplicates ? 'ignore' : 'merge' } -duplicates` ]
@@ -191,18 +182,14 @@ export default class PostgrestQueryBuilder<Table extends GenericTable> {
191
182
* @param values The values to update.
192
183
* @param count Count algorithm to use to count rows in a table.
193
184
*/
194
- update <
195
- Row extends Table [ 'Readonly' ] extends Record < string , unknown >
196
- ? Partial < Table [ 'Optional' | 'Required' ] > & { [ _ in keyof Table [ 'Readonly' ] ] ?: never }
197
- : any
198
- > (
185
+ update < Row extends Table [ 'Update' ] > (
199
186
values : Row ,
200
187
{
201
188
count,
202
189
} : {
203
190
count ?: 'exact' | 'planned' | 'estimated'
204
191
} = { }
205
- ) : PostgrestFilterBuilder < Table [ 'Required' ] & Table [ 'Optional' ] & Table [ 'Readonly '] , undefined > {
192
+ ) : PostgrestFilterBuilder < Table [ 'Row ' ] , undefined > {
206
193
const method = 'PATCH'
207
194
const prefersHeaders = [ ]
208
195
const body = values
@@ -235,10 +222,7 @@ export default class PostgrestQueryBuilder<Table extends GenericTable> {
235
222
count,
236
223
} : {
237
224
count ?: 'exact' | 'planned' | 'estimated'
238
- } = { } ) : PostgrestFilterBuilder <
239
- Table [ 'Required' ] & Table [ 'Optional' ] & Table [ 'Readonly' ] ,
240
- undefined
241
- > {
225
+ } = { } ) : PostgrestFilterBuilder < Table [ 'Row' ] , undefined > {
242
226
const method = 'DELETE'
243
227
const prefersHeaders = [ ]
244
228
if ( count ) {
0 commit comments