@@ -29,6 +29,7 @@ interface PostgrestResponse<T> {
29
29
/**
30
30
* Base builder
31
31
*/
32
+
32
33
export abstract class PostgrestBuilder < T > implements PromiseLike < any > {
33
34
method ! : 'GET' | 'HEAD' | 'POST' | 'PATCH' | 'DELETE'
34
35
url ! : URL
@@ -97,7 +98,7 @@ export class PostgrestQueryBuilder<T> extends PostgrestBuilder<T> {
97
98
/**
98
99
* Performs horizontal filtering with SELECT.
99
100
*
100
- * @param { string } columns - The columns to retrieve, separated by commas.
101
+ * @param columns The columns to retrieve, separated by commas.
101
102
*/
102
103
select ( columns = '*' ) : PostgrestFilterBuilder < T > {
103
104
this . method = 'GET'
@@ -122,8 +123,8 @@ export class PostgrestQueryBuilder<T> extends PostgrestBuilder<T> {
122
123
/**
123
124
* Performs an INSERT into the table.
124
125
*
125
- * @param { (Partial<T>|Partial<T>[]) } values - The values to insert.
126
- * @param { boolean } object. upsert - If `true`, performs an UPSERT.
126
+ * @param values The values to insert.
127
+ * @param upsert If `true`, performs an UPSERT.
127
128
*/
128
129
insert ( values : Partial < T > | Partial < T > [ ] , { upsert = false } = { } ) : PostgrestBuilder < T > {
129
130
this . method = 'POST'
@@ -137,7 +138,7 @@ export class PostgrestQueryBuilder<T> extends PostgrestBuilder<T> {
137
138
/**
138
139
* Performs an UPDATE on the table.
139
140
*
140
- * @param { Partial<T> } values - The values to update.
141
+ * @param values The values to update.
141
142
*/
142
143
update ( values : Partial < T > ) : PostgrestFilterBuilder < T > {
143
144
this . method = 'PATCH'
@@ -155,10 +156,7 @@ export class PostgrestQueryBuilder<T> extends PostgrestBuilder<T> {
155
156
return new PostgrestFilterBuilder ( this )
156
157
}
157
158
158
- /**
159
- * @internal
160
- * @param {?object } params
161
- */
159
+ /** @internal */
162
160
rpc ( params ?: object ) : PostgrestBuilder < T > {
163
161
this . method = 'POST'
164
162
this . body = params
@@ -174,10 +172,10 @@ class PostgrestTransformBuilder<T> extends PostgrestBuilder<T> {
174
172
/**
175
173
* Orders the result with the specified `column`.
176
174
*
177
- * @param { T } column - The column to order on.
178
- * @param { ?boolean } ascending - If `true`, the result will be in ascending order.
179
- * @param { ?boolean } nullsFirst - If `true`, `null`s appear first.
180
- * @param { ?string } foreignTable - The foreign table to use (if `column` is a foreign column).
175
+ * @param column The column to order on.
176
+ * @param ascending If `true`, the result will be in ascending order.
177
+ * @param nullsFirst If `true`, `null`s appear first.
178
+ * @param foreignTable The foreign table to use (if `column` is a foreign column).
181
179
*/
182
180
order (
183
181
column : keyof T ,
@@ -198,8 +196,8 @@ class PostgrestTransformBuilder<T> extends PostgrestBuilder<T> {
198
196
/**
199
197
* Limits the result with the specified `count`.
200
198
*
201
- * @param { number } count - The maximum no. of rows to limit to.
202
- * @param { ?string } object. foreignTable - The foreign table to use (for foreign columns).
199
+ * @param count The maximum no. of rows to limit to.
200
+ * @param foreignTable The foreign table to use (for foreign columns).
203
201
*/
204
202
limit (
205
203
count : number ,
@@ -213,9 +211,9 @@ class PostgrestTransformBuilder<T> extends PostgrestBuilder<T> {
213
211
/**
214
212
* Limits the result to rows within the specified range, inclusive.
215
213
*
216
- * @param { number } from - The starting index from which to limit the result, inclusive.
217
- * @param { number } to - The last index to which to limit the result, inclusive.
218
- * @param { ?string } foreignTable - The foreign table to use (for foreign columns).
214
+ * @param from The starting index from which to limit the result, inclusive.
215
+ * @param to The last index to which to limit the result, inclusive.
216
+ * @param foreignTable The foreign table to use (for foreign columns).
219
217
*/
220
218
range (
221
219
from : number ,
@@ -274,9 +272,9 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
274
272
/**
275
273
* Finds all rows which doesn't satisfy the filter.
276
274
*
277
- * @param { T } column - The column to filter on.
278
- * @param { FilterOperator } operator - The operator to filter with.
279
- * @param { * } value - The value to filter with.
275
+ * @param column The column to filter on.
276
+ * @param operator The operator to filter with.
277
+ * @param value The value to filter with.
280
278
*/
281
279
not ( column : keyof T , operator : FilterOperator , value : any ) : this {
282
280
this . url . searchParams . append ( `${ column } ` , `not.${ operator } .${ value } ` )
@@ -286,7 +284,7 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
286
284
/**
287
285
* Finds all rows satisfying at least one of the filters.
288
286
*
289
- * @param { string } filters - The filters to use, separated by commas.
287
+ * @param filters The filters to use, separated by commas.
290
288
*/
291
289
or ( filters : string ) : this {
292
290
this . url . searchParams . append ( 'or' , `(${ filters } )` )
@@ -297,8 +295,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
297
295
* Finds all rows whose value on the stated `column` exactly matches the
298
296
* specified `value`.
299
297
*
300
- * @param { T } column - The column to filter on.
301
- * @param { T[] } value - The value to filter with.
298
+ * @param column The column to filter on.
299
+ * @param value The value to filter with.
302
300
*/
303
301
eq ( column : keyof T , value : T [ keyof T ] ) : this {
304
302
this . url . searchParams . append ( `${ column } ` , `eq.${ value } ` )
@@ -309,8 +307,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
309
307
* Finds all rows whose value on the stated `column` doesn't match the
310
308
* specified `value`.
311
309
*
312
- * @param { T } column - The column to filter on.
313
- * @param { T[] } value - The value to filter with.
310
+ * @param column The column to filter on.
311
+ * @param value The value to filter with.
314
312
*/
315
313
neq ( column : keyof T , value : T [ keyof T ] ) : this {
316
314
this . url . searchParams . append ( `${ column } ` , `neq.${ value } ` )
@@ -321,8 +319,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
321
319
* Finds all rows whose value on the stated `column` is greater than the
322
320
* specified `value`.
323
321
*
324
- * @param { T } column - The column to filter on.
325
- * @param { T[] } value - The value to filter with.
322
+ * @param column The column to filter on.
323
+ * @param value The value to filter with.
326
324
*/
327
325
gt ( column : keyof T , value : T [ keyof T ] ) : this {
328
326
this . url . searchParams . append ( `${ column } ` , `gt.${ value } ` )
@@ -333,8 +331,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
333
331
* Finds all rows whose value on the stated `column` is greater than or
334
332
* equal to the specified `value`.
335
333
*
336
- * @param { T } column - The column to filter on.
337
- * @param { T[] } value - The value to filter with.
334
+ * @param column The column to filter on.
335
+ * @param value The value to filter with.
338
336
*/
339
337
gte ( column : keyof T , value : T [ keyof T ] ) : this {
340
338
this . url . searchParams . append ( `${ column } ` , `gte.${ value } ` )
@@ -345,8 +343,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
345
343
* Finds all rows whose value on the stated `column` is less than the
346
344
* specified `value`.
347
345
*
348
- * @param { T } column - The column to filter on.
349
- * @param { T[] } value - The value to filter with.
346
+ * @param column The column to filter on.
347
+ * @param value The value to filter with.
350
348
*/
351
349
lt ( column : keyof T , value : T [ keyof T ] ) : this {
352
350
this . url . searchParams . append ( `${ column } ` , `lt.${ value } ` )
@@ -357,8 +355,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
357
355
* Finds all rows whose value on the stated `column` is less than or equal
358
356
* to the specified `value`.
359
357
*
360
- * @param { T } column - The column to filter on.
361
- * @param { T[] } value - The value to filter with.
358
+ * @param column The column to filter on.
359
+ * @param value The value to filter with.
362
360
*/
363
361
lte ( column : keyof T , value : T [ keyof T ] ) : this {
364
362
this . url . searchParams . append ( `${ column } ` , `lte.${ value } ` )
@@ -369,8 +367,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
369
367
* Finds all rows whose value in the stated `column` matches the supplied
370
368
* `pattern` (case sensitive).
371
369
*
372
- * @param { T } column - The column to filter on.
373
- * @param { string } pattern - The pattern to filter with.
370
+ * @param column The column to filter on.
371
+ * @param pattern The pattern to filter with.
374
372
*/
375
373
like ( column : keyof T , pattern : string ) : this {
376
374
this . url . searchParams . append ( `${ column } ` , `like.${ pattern } ` )
@@ -381,8 +379,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
381
379
* Finds all rows whose value in the stated `column` matches the supplied
382
380
* `pattern` (case insensitive).
383
381
*
384
- * @param { T } column - The column to filter on.
385
- * @param { string } pattern - The pattern to filter with.
382
+ * @param column The column to filter on.
383
+ * @param pattern The pattern to filter with.
386
384
*/
387
385
ilike ( column : keyof T , pattern : string ) : this {
388
386
this . url . searchParams . append ( `${ column } ` , `ilike.${ pattern } ` )
@@ -393,8 +391,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
393
391
* A check for exact equality (null, true, false), finds all rows whose
394
392
* value on the stated `column` exactly match the specified `value`.
395
393
*
396
- * @param { T } column - The column to filter on.
397
- * @param { (boolean|null) } value - The value to filter with.
394
+ * @param column The column to filter on.
395
+ * @param value The value to filter with.
398
396
*/
399
397
is ( column : keyof T , value : boolean | null ) : this {
400
398
this . url . searchParams . append ( `${ column } ` , `is.${ value } ` )
@@ -405,8 +403,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
405
403
* Finds all rows whose value on the stated `column` is found on the
406
404
* specified `values`.
407
405
*
408
- * @param { T } column - The column to filter on.
409
- * @param { T[] } values - The values to filter with.
406
+ * @param column The column to filter on.
407
+ * @param values The values to filter with.
410
408
*/
411
409
in ( column : keyof T , values : T [ keyof T ] [ ] ) : this {
412
410
this . url . searchParams . append ( `${ column } ` , `in.(${ cleanFilterArray ( values ) } )` )
@@ -417,8 +415,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
417
415
* Finds all rows whose json, array, or range value on the stated `column`
418
416
* contains the values specified in `value`.
419
417
*
420
- * @param { T } column - The column to filter on.
421
- * @param { (string|T[][]|object) } value - The value to filter with.
418
+ * @param column The column to filter on.
419
+ * @param value The value to filter with.
422
420
*/
423
421
cs ( column : keyof T , value : string | T [ keyof T ] [ ] | object ) : this {
424
422
if ( typeof value === 'string' ) {
@@ -439,8 +437,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
439
437
* Finds all rows whose json, array, or range value on the stated `column` is
440
438
* contained by the specified `value`.
441
439
*
442
- * @param { T } column - The column to filter on.
443
- * @param { string|T[][]|object } value - The value to filter with.
440
+ * @param column The column to filter on.
441
+ * @param value The value to filter with.
444
442
*/
445
443
cd ( column : keyof T , value : string | T [ keyof T ] [ ] | object ) : this {
446
444
if ( typeof value === 'string' ) {
@@ -460,8 +458,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
460
458
* Finds all rows whose range value on the stated `column` is strictly to the
461
459
* left of the specified `range`.
462
460
*
463
- * @param { T } column - The column to filter on.
464
- * @param { string } range - The range to filter with.
461
+ * @param column The column to filter on.
462
+ * @param range The range to filter with.
465
463
*/
466
464
sl ( column : keyof T , range : string ) : this {
467
465
this . url . searchParams . append ( `${ column } ` , `sl.${ range } ` )
@@ -472,8 +470,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
472
470
* Finds all rows whose range value on the stated `column` is strictly to
473
471
* the right of the specified `range`.
474
472
*
475
- * @param { T } column - The column to filter on.
476
- * @param { string } range - The range to filter with.
473
+ * @param column The column to filter on.
474
+ * @param range The range to filter with.
477
475
*/
478
476
sr ( column : keyof T , range : string ) : this {
479
477
this . url . searchParams . append ( `${ column } ` , `sr.${ range } ` )
@@ -484,8 +482,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
484
482
* Finds all rows whose range value on the stated `column` does not extend
485
483
* to the left of the specified `range`.
486
484
*
487
- * @param { T } column - The column to filter on.
488
- * @param { string } range - The range to filter with.
485
+ * @param column The column to filter on.
486
+ * @param range The range to filter with.
489
487
*/
490
488
nxl ( column : keyof T , range : string ) : this {
491
489
this . url . searchParams . append ( `${ column } ` , `nxl.${ range } ` )
@@ -496,8 +494,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
496
494
* Finds all rows whose range value on the stated `column` does not extend
497
495
* to the right of the specified `range`.
498
496
*
499
- * @param { T } column - The column to filter on.
500
- * @param { string } range - The range to filter with.
497
+ * @param column The column to filter on.
498
+ * @param range The range to filter with.
501
499
*/
502
500
nxr ( column : keyof T , range : string ) : this {
503
501
this . url . searchParams . append ( `${ column } ` , `nxr.${ range } ` )
@@ -508,8 +506,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
508
506
* Finds all rows whose range value on the stated `column` is adjacent to
509
507
* the specified `range`.
510
508
*
511
- * @param { T } column - The column to filter on.
512
- * @param { string } range - The range to filter with.
509
+ * @param column The column to filter on.
510
+ * @param range The range to filter with.
513
511
*/
514
512
adj ( column : keyof T , range : string ) : this {
515
513
this . url . searchParams . append ( `${ column } ` , `adj.${ range } ` )
@@ -520,8 +518,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
520
518
* Finds all rows whose array or range value on the stated `column` is
521
519
* contained by the specified `value`.
522
520
*
523
- * @param { T } column - The column to filter on.
524
- * @param { (string|T[][]) } value - The value to filter with.
521
+ * @param column The column to filter on.
522
+ * @param value The value to filter with.
525
523
*/
526
524
ov ( column : keyof T , value : string | T [ keyof T ] [ ] ) : this {
527
525
if ( typeof value === 'string' ) {
@@ -538,9 +536,9 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
538
536
* Finds all rows whose tsvector value on the stated `column` matches
539
537
* to_tsquery(`query`).
540
538
*
541
- * @param { T } column - The column to filter on.
542
- * @param { string } query - The Postgres tsquery string to filter with.
543
- * @param { ?string } config - The text search configuration to use.
539
+ * @param column The column to filter on.
540
+ * @param query The Postgres tsquery string to filter with.
541
+ * @param config The text search configuration to use.
544
542
*/
545
543
fts ( column : keyof T , query : string , { config } : { config ?: string } = { } ) : this {
546
544
const configPart = typeof config === 'undefined' ? '' : `(${ config } )`
@@ -552,9 +550,9 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
552
550
* Finds all rows whose tsvector value on the stated `column` matches
553
551
* plainto_tsquery(`query`).
554
552
*
555
- * @param { * } column - The column to filter on.
556
- * @param { string } query - The Postgres tsquery string to filter with.
557
- * @param { ?string } config - The text search configuration to use.
553
+ * @param column The column to filter on.
554
+ * @param query The Postgres tsquery string to filter with.
555
+ * @param config The text search configuration to use.
558
556
*/
559
557
plfts ( column : keyof T , query : string , { config } : { config ?: string } = { } ) : this {
560
558
const configPart = typeof config === 'undefined' ? '' : `(${ config } )`
@@ -566,9 +564,9 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
566
564
* Finds all rows whose tsvector value on the stated `column` matches
567
565
* phraseto_tsquery(`query`).
568
566
*
569
- * @param { T } column - The column to filter on.
570
- * @param { string } query - The Postgres tsquery string to filter with.
571
- * @param { ?string } config - The text search configuration to use.
567
+ * @param column The column to filter on.
568
+ * @param query The Postgres tsquery string to filter with.
569
+ * @param config The text search configuration to use.
572
570
*/
573
571
phfts ( column : keyof T , query : string , { config } : { config ?: string } = { } ) : this {
574
572
const configPart = typeof config === 'undefined' ? '' : `(${ config } )`
@@ -580,9 +578,9 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
580
578
* Finds all rows whose tsvector value on the stated `column` matches
581
579
* websearch_to_tsquery(`query`).
582
580
*
583
- * @param { T } column - The column to filter on.
584
- * @param { string } query - The Postgres tsquery string to filter with.
585
- * @param { ?string } config - The text search configuration to use.
581
+ * @param column The column to filter on.
582
+ * @param query The Postgres tsquery string to filter with.
583
+ * @param config The text search configuration to use.
586
584
*/
587
585
wfts ( column : keyof T , query : string , { config } : { config ?: string } = { } ) : this {
588
586
const configPart = typeof config === 'undefined' ? '' : `(${ config } )`
@@ -593,9 +591,9 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
593
591
/**
594
592
* Finds all rows whose `column` satisfies the filter.
595
593
*
596
- * @param { T } column - The column to filter on.
597
- * @param { FilterOperator } operator - The operator to filter with.
598
- * @param { * } value - The value to filter with.
594
+ * @param column The column to filter on.
595
+ * @param operator The operator to filter with.
596
+ * @param value The value to filter with.
599
597
*/
600
598
filter ( column : keyof T , operator : FilterOperator , value : any ) : this {
601
599
this . url . searchParams . append ( `${ column } ` , `${ operator } .${ value } ` )
@@ -605,7 +603,7 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
605
603
/**
606
604
* Finds all rows whose columns match the specified `query` object.
607
605
*
608
- * @param { object } query - The object to filter with, with column names as keys mapped
606
+ * @param query The object to filter with, with column names as keys mapped
609
607
* to their filter values.
610
608
*/
611
609
match ( query : { [ key : string ] : string } ) {
0 commit comments