@supabase/supabase-js 2.101.1 → 2.102.0-beta.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/supabase-js",
3
- "version": "2.101.1",
3
+ "version": "2.102.0-beta.0",
4
4
  "description": "Isomorphic Javascript SDK for Supabase",
5
5
  "keywords": [
6
6
  "javascript",
@@ -80,11 +80,11 @@
80
80
  "update:test-deps:bun": "cd test/integration/bun && bun install"
81
81
  },
82
82
  "dependencies": {
83
- "@supabase/auth-js": "2.101.1",
84
- "@supabase/functions-js": "2.101.1",
85
- "@supabase/postgrest-js": "2.101.1",
86
- "@supabase/realtime-js": "2.101.1",
87
- "@supabase/storage-js": "2.101.1"
83
+ "@supabase/auth-js": "2.102.0-beta.0",
84
+ "@supabase/functions-js": "2.102.0-beta.0",
85
+ "@supabase/postgrest-js": "2.102.0-beta.0",
86
+ "@supabase/realtime-js": "2.102.0-beta.0",
87
+ "@supabase/storage-js": "2.102.0-beta.0"
88
88
  },
89
89
  "devDependencies": {
90
90
  "jsr": "^0.13.5",
package/src/cors.ts CHANGED
@@ -33,8 +33,15 @@
33
33
  * - x-client-info: Library version information
34
34
  * - apikey: Project API key
35
35
  * - content-type: Standard HTTP content type
36
+ * - x-retry-count: Retry attempt number sent by postgrest-js on retried requests
36
37
  */
37
- const SUPABASE_HEADERS = ['authorization', 'x-client-info', 'apikey', 'content-type'].join(', ')
38
+ const SUPABASE_HEADERS = [
39
+ 'authorization',
40
+ 'x-client-info',
41
+ 'apikey',
42
+ 'content-type',
43
+ 'x-retry-count',
44
+ ].join(', ')
38
45
 
39
46
  /**
40
47
  * All HTTP methods used by the Supabase SDK
@@ -12,6 +12,33 @@
12
12
 
13
13
  export type Fetch = typeof fetch
14
14
 
15
+ /**
16
+ * Default number of retry attempts.
17
+ */
18
+ export const DEFAULT_MAX_RETRIES = 3
19
+
20
+ /**
21
+ * Default exponential backoff delay function.
22
+ * Delays: 1s, 2s, 4s, 8s, ... (max 30s)
23
+ *
24
+ * @param attemptIndex - Zero-based index of the retry attempt
25
+ * @returns Delay in milliseconds before the next retry
26
+ */
27
+ export const getRetryDelay = (attemptIndex: number): number =>
28
+ Math.min(1000 * 2 ** attemptIndex, 30000)
29
+
30
+ /**
31
+ * Status codes that are safe to retry.
32
+ * 520 = Cloudflare timeout/connection errors (transient)
33
+ * 503 = PostgREST schema cache not yet loaded (transient, signals retry via Retry-After header)
34
+ */
35
+ export const RETRYABLE_STATUS_CODES = [520, 503] as const
36
+
37
+ /**
38
+ * HTTP methods that are safe to retry (idempotent operations).
39
+ */
40
+ export const RETRYABLE_METHODS = ['GET', 'HEAD', 'OPTIONS'] as const
41
+
15
42
  export type GenericRelationship = {
16
43
  foreignKeyName: string
17
44
  columns: string[]
@@ -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.101.1'
7
+ export const version = '2.102.0-beta.0'