@supabase/postgrest-js 2.107.0-beta.0 → 2.107.0-canary.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supabase/postgrest-js",
3
- "version": "2.107.0-beta.0",
3
+ "version": "2.107.0-canary.0",
4
4
  "description": "Isomorphic PostgREST client",
5
5
  "keywords": [
6
6
  "postgrest",
@@ -69,11 +69,9 @@ export default abstract class PostgrestBuilder<
69
69
  ClientOptions extends ClientServerOptions,
70
70
  Result,
71
71
  ThrowOnError extends boolean = false,
72
- > implements
73
- PromiseLike<
74
- ThrowOnError extends true ? PostgrestResponseSuccess<Result> : PostgrestSingleResponse<Result>
75
- >
76
- {
72
+ > implements PromiseLike<
73
+ ThrowOnError extends true ? PostgrestResponseSuccess<Result> : PostgrestSingleResponse<Result>
74
+ > {
77
75
  protected method: 'GET' | 'HEAD' | 'POST' | 'PATCH' | 'DELETE'
78
76
  protected url: URL
79
77
  protected headers: Headers
@@ -476,7 +474,17 @@ export default abstract class PostgrestBuilder<
476
474
  ) {
477
475
  data = body
478
476
  } else {
479
- data = JSON.parse(body)
477
+ try {
478
+ data = JSON.parse(body)
479
+ } catch {
480
+ // A 2xx status doesn't guarantee a JSON body; mirror the non-2xx fallback below.
481
+ error = { message: body }
482
+ data = null
483
+
484
+ if (this.shouldThrowOnError) {
485
+ throw new PostgrestError({ message: body, details: '', hint: '', code: '' })
486
+ }
487
+ }
480
488
  }
481
489
  }
482
490
 
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.107.0-beta.0'
7
+ export const version = '2.107.0-canary.0'