@supabase/postgrest-js 3.0.0-next.2 → 3.0.0-next.20

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 CHANGED
@@ -51,6 +51,12 @@ var PostgrestError = class extends Error {
51
51
  */
52
52
  constructor(context) {
53
53
  super(context.message);
54
+ Object.defineProperty(this, "message", {
55
+ value: context.message,
56
+ enumerable: true,
57
+ writable: true,
58
+ configurable: true
59
+ });
54
60
  this.name = "PostgrestError";
55
61
  this.details = context.details;
56
62
  this.hint = context.hint;
@@ -107,7 +113,7 @@ var PostgrestBuilder = class {
107
113
  * ```ts
108
114
  * import { createClient } from '@supabase/supabase-js'
109
115
  *
110
- * const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key')
116
+ * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
111
117
  * const { data, error } = await supabase.from('users').select('*')
112
118
  * ```
113
119
  *
@@ -119,7 +125,7 @@ var PostgrestBuilder = class {
119
125
  *
120
126
  * const builder = new PostgrestQueryBuilder(
121
127
  * new URL('https://xyzcompany.supabase.co/rest/v1/users'),
122
- * { headers: new Headers({ apikey: 'publishable-or-anon-key' }) }
128
+ * { headers: new Headers({ apikey: 'your-publishable-key' }) }
123
129
  * )
124
130
  * ```
125
131
  */
@@ -266,7 +272,7 @@ var PostgrestBuilder = class {
266
272
  signal: _this.signal
267
273
  });
268
274
  } catch (fetchError) {
269
- if ((fetchError === null || fetchError === void 0 ? void 0 : fetchError.name) === "AbortError" || (fetchError === null || fetchError === void 0 ? void 0 : fetchError.code) === "ABORT_ERR") throw fetchError;
275
+ if (fetchError instanceof Error && (fetchError.name === "AbortError" || "code" in fetchError && fetchError.code === "ABORT_ERR")) throw fetchError;
270
276
  if (!RETRYABLE_METHODS.includes(_this.method)) throw fetchError;
271
277
  if (_this.retryEnabled && attemptCount < DEFAULT_MAX_RETRIES) {
272
278
  const delay = getRetryDelay(attemptCount);
@@ -388,7 +394,7 @@ var PostgrestBuilder = class {
388
394
  }
389
395
  return {
390
396
  success: error === null,
391
- error,
397
+ error: error ? new PostgrestError(error) : null,
392
398
  data,
393
399
  count,
394
400
  status,
@@ -3090,7 +3096,7 @@ var PostgrestQueryBuilder = class {
3090
3096
  * ```ts
3091
3097
  * import { createClient } from '@supabase/supabase-js'
3092
3098
  *
3093
- * const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key')
3099
+ * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
3094
3100
  * const { data, error } = await supabase.from('users').select('*')
3095
3101
  * ```
3096
3102
  *
@@ -3100,7 +3106,7 @@ var PostgrestQueryBuilder = class {
3100
3106
  *
3101
3107
  * const query = new PostgrestQueryBuilder(
3102
3108
  * new URL('https://xyzcompany.supabase.co/rest/v1/users'),
3103
- * { headers: { apikey: 'publishable-or-anon-key' }, retry: true }
3109
+ * { headers: { apikey: 'your-publishable-key' }, retry: true }
3104
3110
  * )
3105
3111
  * ```
3106
3112
  */
@@ -4678,7 +4684,7 @@ var PostgrestClient = class PostgrestClient {
4678
4684
  * ```ts
4679
4685
  * import { createClient } from '@supabase/supabase-js'
4680
4686
  *
4681
- * const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key')
4687
+ * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
4682
4688
  * const { data, error } = await supabase.from('profiles').select('*')
4683
4689
  * ```
4684
4690
  *
@@ -4693,7 +4699,7 @@ var PostgrestClient = class PostgrestClient {
4693
4699
  * import { PostgrestClient } from '@supabase/postgrest-js'
4694
4700
  *
4695
4701
  * const postgrest = new PostgrestClient('https://xyzcompany.supabase.co/rest/v1', {
4696
- * headers: { apikey: 'publishable-or-anon-key' },
4702
+ * headers: { apikey: 'your-publishable-key' },
4697
4703
  * schema: 'public',
4698
4704
  * timeout: 30000, // 30 second timeout
4699
4705
  * })