@supabase/postgrest-js 2.107.0 → 2.108.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +13 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +13 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/PostgrestBuilder.ts +11 -3
- package/src/PostgrestTransformBuilder.ts +7 -7
- package/src/version.ts +1 -1
package/package.json
CHANGED
package/src/PostgrestBuilder.ts
CHANGED
|
@@ -304,9 +304,17 @@ export default abstract class PostgrestBuilder<
|
|
|
304
304
|
let attemptCount = 0
|
|
305
305
|
|
|
306
306
|
while (true) {
|
|
307
|
-
|
|
307
|
+
// Serialize headers as a plain object rather than a Headers instance.
|
|
308
|
+
// React Native's XHR-based fetch silently drops headers (notably Content-Type)
|
|
309
|
+
// when given a Headers instance, causing PGRST202 on parameter-less RPC calls.
|
|
310
|
+
// See supabase/supabase-js#1562 and facebook/react-native#33933.
|
|
311
|
+
// All sibling packages (auth-js, storage-js, functions-js) already pass plain objects.
|
|
312
|
+
const headers: Record<string, string> = {}
|
|
313
|
+
this.headers.forEach((value, key) => {
|
|
314
|
+
headers[key] = value
|
|
315
|
+
})
|
|
308
316
|
if (attemptCount > 0) {
|
|
309
|
-
|
|
317
|
+
headers['X-Retry-Count'] = String(attemptCount)
|
|
310
318
|
}
|
|
311
319
|
|
|
312
320
|
// Only wrap the fetch call itself — processResponse errors must never trigger retries
|
|
@@ -314,7 +322,7 @@ export default abstract class PostgrestBuilder<
|
|
|
314
322
|
try {
|
|
315
323
|
res = await _fetch(this.url.toString(), {
|
|
316
324
|
method: this.method,
|
|
317
|
-
headers
|
|
325
|
+
headers,
|
|
318
326
|
body: JSON.stringify(this.body, (_, value) =>
|
|
319
327
|
typeof value === 'bigint' ? value.toString() : value
|
|
320
328
|
),
|
|
@@ -346,9 +346,9 @@ export default class PostgrestTransformBuilder<
|
|
|
346
346
|
}
|
|
347
347
|
|
|
348
348
|
/**
|
|
349
|
-
* Limit the query result by `
|
|
349
|
+
* Limit the query result by `rows`.
|
|
350
350
|
*
|
|
351
|
-
* @param
|
|
351
|
+
* @param rows - The maximum number of rows to return
|
|
352
352
|
* @param options - Named parameters
|
|
353
353
|
* @param options.referencedTable - Set this to limit rows of referenced
|
|
354
354
|
* tables instead of the parent table
|
|
@@ -446,14 +446,14 @@ export default class PostgrestTransformBuilder<
|
|
|
446
446
|
* ```
|
|
447
447
|
*/
|
|
448
448
|
limit(
|
|
449
|
-
|
|
449
|
+
rows: number,
|
|
450
450
|
{
|
|
451
451
|
foreignTable,
|
|
452
452
|
referencedTable = foreignTable,
|
|
453
453
|
}: { foreignTable?: string; referencedTable?: string } = {}
|
|
454
454
|
): this {
|
|
455
455
|
const key = typeof referencedTable === 'undefined' ? 'limit' : `${referencedTable}.limit`
|
|
456
|
-
this.url.searchParams.set(key, `${
|
|
456
|
+
this.url.searchParams.set(key, `${rows}`)
|
|
457
457
|
return this
|
|
458
458
|
}
|
|
459
459
|
|
|
@@ -960,18 +960,18 @@ export default class PostgrestTransformBuilder<
|
|
|
960
960
|
* Set the maximum number of rows that can be affected by the query.
|
|
961
961
|
* Only available in PostgREST v13+ and only works with PATCH and DELETE methods.
|
|
962
962
|
*
|
|
963
|
-
* @param
|
|
963
|
+
* @param rows - The maximum number of rows that can be affected
|
|
964
964
|
*
|
|
965
965
|
* @category Database
|
|
966
966
|
*/
|
|
967
|
-
maxAffected(
|
|
967
|
+
maxAffected(rows: number): MaxAffectedEnabled<ClientOptions['PostgrestVersion']> extends true
|
|
968
968
|
? // TODO: update the RPC case to only work on RPC that returns SETOF rows
|
|
969
969
|
Method extends 'PATCH' | 'DELETE' | 'RPC'
|
|
970
970
|
? this
|
|
971
971
|
: InvalidMethodError<'maxAffected method only available on update or delete'>
|
|
972
972
|
: InvalidMethodError<'maxAffected method only available on postgrest 13+'> {
|
|
973
973
|
this.headers.append('Prefer', 'handling=strict')
|
|
974
|
-
this.headers.append('Prefer', `max-affected=${
|
|
974
|
+
this.headers.append('Prefer', `max-affected=${rows}`)
|
|
975
975
|
return this as unknown as MaxAffectedEnabled<ClientOptions['PostgrestVersion']> extends true
|
|
976
976
|
? Method extends 'PATCH' | 'DELETE' | 'RPC'
|
|
977
977
|
? this
|
package/src/version.ts
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
// - Debugging and support (identifying which version is running)
|
|
5
5
|
// - Telemetry and logging (version reporting in errors/analytics)
|
|
6
6
|
// - Ensuring build artifacts match the published package version
|
|
7
|
-
export const version = '2.
|
|
7
|
+
export const version = '2.108.0'
|