Skip to content

Commit 1904574

Browse files
committed
chore: use string based version
1 parent c5f81be commit 1904574

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/PostgrestTransformBuilder.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import PostgrestBuilder from './PostgrestBuilder'
22
import { InvalidMethodError } from './PostgrestFilterBuilder'
33
import { GetResult } from './select-query-parser/result'
4-
import { GenericSchema, CheckMatchingArrayTypes, ClientServerOptions } from './types'
4+
import {
5+
GenericSchema,
6+
CheckMatchingArrayTypes,
7+
ClientServerOptions,
8+
MaxAffectedEnabled,
9+
} from './types'
510

611
export default class PostgrestTransformBuilder<
712
ClientOptions extends ClientServerOptions,
@@ -346,15 +351,15 @@ export default class PostgrestTransformBuilder<
346351
*
347352
* @param value - The maximum number of rows that can be affected
348353
*/
349-
maxAffected(value: number): ClientOptions['postgrestVersion'] extends 13
354+
maxAffected(value: number): MaxAffectedEnabled<ClientOptions['postgrestVersion']> extends true
350355
? // TODO: update the RPC case to only work on RPC that returns SETOF rows
351356
Method extends 'PATCH' | 'DELETE' | 'RPC'
352357
? this
353358
: InvalidMethodError<'maxAffected method only available on update or delete'>
354359
: InvalidMethodError<'maxAffected method only available on postgrest 13+'> {
355360
this.headers.append('Prefer', 'handling=strict')
356361
this.headers.append('Prefer', `max-affected=${value}`)
357-
return this as unknown as ClientOptions['postgrestVersion'] extends 13
362+
return this as unknown as MaxAffectedEnabled<ClientOptions['postgrestVersion']> extends true
358363
? Method extends 'PATCH' | 'DELETE' | 'RPC'
359364
? this
360365
: InvalidMethodError<'maxAffected method only available on update or delete'>

0 commit comments

Comments
 (0)