Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Commit 91d8a8c

Browse files
committed
feat: obsolete deprecated features
BREAKING CHANGE: obselete the following previously-deprecated features: - filter shorthands (e.g. `cs` vs. `contains`) - `body` in response (vs. `data`) - `upsert`ing thru `.insert()`
1 parent 106ad9a commit 91d8a8c

File tree

4 files changed

+0
-121
lines changed

4 files changed

+0
-121
lines changed

src/PostgrestBuilder.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ export default abstract class PostgrestBuilder<T> implements PromiseLike<Postgre
128128
count,
129129
status,
130130
statusText,
131-
body: data,
132131
}
133132

134133
return postgrestResponse
@@ -142,7 +141,6 @@ export default abstract class PostgrestBuilder<T> implements PromiseLike<Postgre
142141
code: fetchError.code || '',
143142
},
144143
data: null,
145-
body: null,
146144
count: null,
147145
status: 400,
148146
statusText: 'Bad Request',

src/PostgrestFilterBuilder.ts

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,6 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
203203
return this
204204
}
205205

206-
/** @deprecated Use `contains()` instead. */
207-
cs = this.contains
208-
209206
/**
210207
* Finds all rows whose json, array, or range value on the stated `column` is
211208
* contained by the specified `value`.
@@ -227,9 +224,6 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
227224
return this
228225
}
229226

230-
/** @deprecated Use `containedBy()` instead. */
231-
cd = this.containedBy
232-
233227
/**
234228
* Finds all rows whose range value on the stated `column` is strictly to the
235229
* left of the specified `range`.
@@ -242,9 +236,6 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
242236
return this
243237
}
244238

245-
/** @deprecated Use `rangeLt()` instead. */
246-
sl = this.rangeLt
247-
248239
/**
249240
* Finds all rows whose range value on the stated `column` is strictly to
250241
* the right of the specified `range`.
@@ -257,9 +248,6 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
257248
return this
258249
}
259250

260-
/** @deprecated Use `rangeGt()` instead. */
261-
sr = this.rangeGt
262-
263251
/**
264252
* Finds all rows whose range value on the stated `column` does not extend
265253
* to the left of the specified `range`.
@@ -272,9 +260,6 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
272260
return this
273261
}
274262

275-
/** @deprecated Use `rangeGte()` instead. */
276-
nxl = this.rangeGte
277-
278263
/**
279264
* Finds all rows whose range value on the stated `column` does not extend
280265
* to the right of the specified `range`.
@@ -287,9 +272,6 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
287272
return this
288273
}
289274

290-
/** @deprecated Use `rangeLte()` instead. */
291-
nxr = this.rangeLte
292-
293275
/**
294276
* Finds all rows whose range value on the stated `column` is adjacent to
295277
* the specified `range`.
@@ -302,9 +284,6 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
302284
return this
303285
}
304286

305-
/** @deprecated Use `rangeAdjacent()` instead. */
306-
adj = this.rangeAdjacent
307-
308287
/**
309288
* Finds all rows whose array or range value on the stated `column` overlaps
310289
* (has a value in common) with the specified `value`.
@@ -323,9 +302,6 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
323302
return this
324303
}
325304

326-
/** @deprecated Use `overlaps()` instead. */
327-
ov = this.overlaps
328-
329305
/**
330306
* Finds all rows whose text or tsvector value on the stated `column` matches
331307
* the tsquery in `query`.
@@ -356,70 +332,6 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
356332
return this
357333
}
358334

359-
/**
360-
* Finds all rows whose tsvector value on the stated `column` matches
361-
* to_tsquery(`query`).
362-
*
363-
* @param column The column to filter on.
364-
* @param query The Postgres tsquery string to filter with.
365-
* @param config The text search configuration to use.
366-
*
367-
* @deprecated Use `textSearch()` instead.
368-
*/
369-
fts(column: keyof T, query: string, { config }: { config?: string } = {}): this {
370-
const configPart = typeof config === 'undefined' ? '' : `(${config})`
371-
this.url.searchParams.append(`${column}`, `fts${configPart}.${query}`)
372-
return this
373-
}
374-
375-
/**
376-
* Finds all rows whose tsvector value on the stated `column` matches
377-
* plainto_tsquery(`query`).
378-
*
379-
* @param column The column to filter on.
380-
* @param query The Postgres tsquery string to filter with.
381-
* @param config The text search configuration to use.
382-
*
383-
* @deprecated Use `textSearch()` with `type: 'plain'` instead.
384-
*/
385-
plfts(column: keyof T, query: string, { config }: { config?: string } = {}): this {
386-
const configPart = typeof config === 'undefined' ? '' : `(${config})`
387-
this.url.searchParams.append(`${column}`, `plfts${configPart}.${query}`)
388-
return this
389-
}
390-
391-
/**
392-
* Finds all rows whose tsvector value on the stated `column` matches
393-
* phraseto_tsquery(`query`).
394-
*
395-
* @param column The column to filter on.
396-
* @param query The Postgres tsquery string to filter with.
397-
* @param config The text search configuration to use.
398-
*
399-
* @deprecated Use `textSearch()` with `type: 'phrase'` instead.
400-
*/
401-
phfts(column: keyof T, query: string, { config }: { config?: string } = {}): this {
402-
const configPart = typeof config === 'undefined' ? '' : `(${config})`
403-
this.url.searchParams.append(`${column}`, `phfts${configPart}.${query}`)
404-
return this
405-
}
406-
407-
/**
408-
* Finds all rows whose tsvector value on the stated `column` matches
409-
* websearch_to_tsquery(`query`).
410-
*
411-
* @param column The column to filter on.
412-
* @param query The Postgres tsquery string to filter with.
413-
* @param config The text search configuration to use.
414-
*
415-
* @deprecated Use `textSearch()` with `type: 'websearch'` instead.
416-
*/
417-
wfts(column: keyof T, query: string, { config }: { config?: string } = {}): this {
418-
const configPart = typeof config === 'undefined' ? '' : `(${config})`
419-
this.url.searchParams.append(`${column}`, `wfts${configPart}.${query}`)
420-
return this
421-
}
422-
423335
/**
424336
* Finds all rows whose `column` satisfies the filter.
425337
*

src/PostgrestQueryBuilder.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -77,45 +77,19 @@ export default class PostgrestQueryBuilder<T> extends PostgrestBuilder<T> {
7777
* @param returning By default the new record is returned. Set this to 'minimal' if you don't need this value.
7878
* @param count Count algorithm to use to count rows in a table.
7979
*/
80-
insert(
81-
values: Partial<T> | Partial<T>[],
82-
options?: {
83-
returning?: 'minimal' | 'representation'
84-
count?: null | 'exact' | 'planned' | 'estimated'
85-
}
86-
): PostgrestFilterBuilder<T>
87-
/**
88-
* @deprecated Use `upsert()` instead.
89-
*/
90-
insert(
91-
values: Partial<T> | Partial<T>[],
92-
options?: {
93-
upsert?: boolean
94-
onConflict?: string
95-
returning?: 'minimal' | 'representation'
96-
count?: null | 'exact' | 'planned' | 'estimated'
97-
}
98-
): PostgrestFilterBuilder<T>
9980
insert(
10081
values: Partial<T> | Partial<T>[],
10182
{
102-
upsert = false,
103-
onConflict,
10483
returning = 'representation',
10584
count = null,
10685
}: {
107-
upsert?: boolean
108-
onConflict?: string
10986
returning?: 'minimal' | 'representation'
11087
count?: null | 'exact' | 'planned' | 'estimated'
11188
} = {}
11289
): PostgrestFilterBuilder<T> {
11390
this.method = 'POST'
11491

11592
const prefersHeaders = [`return=${returning}`]
116-
if (upsert) prefersHeaders.push('resolution=merge-duplicates')
117-
118-
if (upsert && onConflict !== undefined) this.url.searchParams.set('on_conflict', onConflict)
11993
this.body = values
12094
if (count) {
12195
prefersHeaders.push(`count=${count}`)

src/types.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,18 @@ interface PostgrestResponseBase {
2525
interface PostgrestResponseSuccess<T> extends PostgrestResponseBase {
2626
error: null
2727
data: T[]
28-
body: T[]
2928
count: number | null
3029
}
3130
interface PostgrestResponseFailure extends PostgrestResponseBase {
3231
error: PostgrestError
3332
data: null
34-
// For backward compatibility: body === data
35-
body: null
3633
count: null
3734
}
3835
export type PostgrestResponse<T> = PostgrestResponseSuccess<T> | PostgrestResponseFailure
3936

4037
interface PostgrestSingleResponseSuccess<T> extends PostgrestResponseBase {
4138
error: null
4239
data: T
43-
// For backward compatibility: body === data
44-
body: T
4540
}
4641
export type PostgrestSingleResponse<T> =
4742
| PostgrestSingleResponseSuccess<T>

0 commit comments

Comments
 (0)